@vocoder/cli 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.d.mts CHANGED
@@ -1,3 +1,15 @@
1
+ interface ExtractedString {
2
+ key: string;
3
+ /** Source text. null for id-only entries (<T id="key" /> with no message or children). */
4
+ text: string | null;
5
+ file: string;
6
+ line: number;
7
+ context?: string;
8
+ formality?: "formal" | "informal" | "neutral" | "auto";
9
+ /** Detected UI role from JSX parent element or prop. e.g. "button_label", "heading", "input_placeholder" */
10
+ uiRole?: string;
11
+ }
12
+
1
13
  /**
2
14
  * Supported app industry classifications.
3
15
  * Set once in vocoder.config.ts; synced to App at extraction time.
@@ -14,6 +26,11 @@ type AppIndustry = "ecommerce" | "saas" | "healthcare" | "fintech" | "gaming" |
14
26
  */
15
27
  type Formality = "formal" | "informal" | "neutral";
16
28
  interface VocoderConfig {
29
+ /**
30
+ * Unique identifier for this app. Written by `vocoder init` — do not edit manually.
31
+ * Used by the CLI to identify which app to update when syncing locales.
32
+ */
33
+ appId?: string;
17
34
  /** Glob patterns for files to extract strings from. */
18
35
  include?: string[];
19
36
  /** Glob patterns to exclude. */
@@ -58,16 +75,6 @@ declare function defineConfig(config: VocoderConfig): VocoderConfig;
58
75
  */
59
76
  declare function loadVocoderConfig(cwd: string): VocoderConfig | null;
60
77
 
61
- interface ExtractedString {
62
- key: string;
63
- text: string;
64
- file: string;
65
- line: number;
66
- context?: string;
67
- formality?: "formal" | "informal" | "neutral" | "auto";
68
- /** Detected UI role from JSX parent element or prop. e.g. "button_label", "heading", "input_placeholder" */
69
- uiRole?: string;
70
- }
71
78
  declare class StringExtractor {
72
79
  extractFromProject(pattern: string | string[], projectRoot?: string, excludePattern?: string | string[]): Promise<ExtractedString[]>;
73
80
  }
@@ -105,7 +112,8 @@ interface APIAppConfig {
105
112
  }
106
113
  interface TranslationStringEntry {
107
114
  key: string;
108
- text: string;
115
+ /** Source text. null for id-only entries (<T id="key" /> with no message). */
116
+ text: string | null;
109
117
  context?: string;
110
118
  formality?: "formal" | "informal" | "neutral" | "auto";
111
119
  uiRole?: string;
@@ -335,26 +343,30 @@ declare class VocoderAPI {
335
343
  * Revoke the given CLI user token server-side.
336
344
  */
337
345
  revokeCliToken(userToken: string): Promise<void>;
338
- listWorkspaces(userToken: string, params?: {
346
+ listOrganizations(userToken: string, params?: {
339
347
  repo?: string;
340
348
  }): Promise<{
341
- workspaces: Array<{
349
+ organizations: Array<{
342
350
  id: string;
343
351
  name: string;
344
352
  planId: string;
345
- maxProjects: number;
346
- projectCount: number;
353
+ /** Plan limit on total apps across all projects (-1 = unlimited). */
354
+ maxApps: number;
355
+ /** Current total app count across all projects in this organization. */
356
+ appCount: number;
347
357
  hasGitHubConnection: boolean;
348
358
  connectionLabel: string | null;
349
359
  /** null when no `repo` param was provided */
350
360
  coversRepo: boolean | null;
351
361
  installationConfigureUrl: string | null;
352
362
  }>;
353
- canCreateWorkspace: boolean;
363
+ canCreateOrganization: boolean;
354
364
  }>;
355
365
  listApps(userToken: string, organizationId: string): Promise<Array<{
356
- id: string;
366
+ appId: string;
367
+ projectId: string;
357
368
  name: string;
369
+ appDir: string;
358
370
  sourceLocale: string;
359
371
  targetLocales: string[];
360
372
  targetBranches: string[];
@@ -408,7 +420,7 @@ declare class VocoderAPI {
408
420
  * @throws {VocoderAPIError} status 422 for invalid/unsupported locale code
409
421
  * @throws {VocoderAPIError} status 403 with limitError.limitType "target_locales" when plan limit reached
410
422
  */
411
- addLocale(locale: string, repoCanonical?: string): Promise<{
423
+ addLocale(locale: string, repoCanonical?: string, appId?: string): Promise<{
412
424
  targetLocales: string[];
413
425
  }>;
414
426
  /**
@@ -418,7 +430,7 @@ declare class VocoderAPI {
418
430
  *
419
431
  * @throws {VocoderAPIError} on auth or server errors
420
432
  */
421
- removeLocale(locale: string, repoCanonical?: string): Promise<{
433
+ removeLocale(locale: string, repoCanonical?: string, appId?: string): Promise<{
422
434
  targetLocales: string[];
423
435
  }>;
424
436
  listLocales(userToken: string): Promise<{
@@ -455,6 +467,10 @@ declare class VocoderAPI {
455
467
  targetBranches: string[];
456
468
  repositoryBound: boolean;
457
469
  configureUrl?: string;
470
+ apps: Array<{
471
+ appDir: string;
472
+ appId: string;
473
+ }>;
458
474
  }>;
459
475
  /**
460
476
  * Look up all project apps for a given repo. Returns info about exact matches,
@@ -466,6 +482,7 @@ declare class VocoderAPI {
466
482
  appDir: string;
467
483
  }): Promise<{
468
484
  exactMatch: {
485
+ appId: string;
469
486
  projectId: string;
470
487
  projectName: string;
471
488
  organizationName: string;
@@ -474,11 +491,18 @@ declare class VocoderAPI {
474
491
  } | null;
475
492
  existingApps: Array<{
476
493
  appDir: string;
494
+ /** Unique identifier for this app — written to vocoder.config.ts. */
495
+ appId: string;
477
496
  projectId: string;
478
497
  projectName: string;
479
498
  organizationName: string;
480
499
  }>;
481
500
  hasWholeRepoApp: boolean;
501
+ /** Present when this repo is linked to a Vocoder organization (with or without a project). */
502
+ organizationContext: {
503
+ organizationId: string;
504
+ organizationName: string;
505
+ } | null;
482
506
  }>;
483
507
  /**
484
508
  * Add a new App to an existing project (monorepo: new app directory).
@@ -495,7 +519,6 @@ declare class VocoderAPI {
495
519
  appId: string;
496
520
  projectId: string;
497
521
  projectName: string;
498
- apiKey: string;
499
522
  appDir: string;
500
523
  }>;
501
524
  }
package/dist/lib.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  readAuthData,
13
13
  verifyStoredAuth,
14
14
  writeAuthData
15
- } from "./chunk-LLEMSC3X.mjs";
15
+ } from "./chunk-62KCB6C6.mjs";
16
16
 
17
17
  // ../config/src/index.ts
18
18
  function defineConfig(config) {
package/dist/lib.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../config/src/index.ts"],"sourcesContent":["/**\n * Supported app industry classifications.\n * Set once in vocoder.config.ts; synced to App at extraction time.\n * Cannot be edited from the dashboard — config file is the source of truth.\n *\n * Keep in sync with APP_INDUSTRIES in\n * vocoder-app/lib/vocoder/translation/context-constants.ts.\n */\nexport type AppIndustry =\n\t| \"ecommerce\"\n\t| \"saas\"\n\t| \"healthcare\"\n\t| \"fintech\"\n\t| \"gaming\"\n\t| \"education\"\n\t| \"media\"\n\t| \"productivity\";\n\n/**\n * Translation formality level.\n * Can be set project-wide in vocoder.config.ts or overridden per-string\n * via <T formality=\"formal\"> (requires allowAiTranslations plan).\n */\nexport type Formality = \"formal\" | \"informal\" | \"neutral\";\n\nexport interface VocoderConfig {\n\t/** Glob patterns for files to extract strings from. */\n\tinclude?: string[];\n\t/** Glob patterns to exclude. */\n\texclude?: string[];\n\t/**\n\t * Git branches that trigger string extraction and translation.\n\t * Synced to the Vocoder dashboard on each push — change here to update.\n\t */\n\ttargetBranches?: string[];\n\t/**\n\t * Directory to write translated locale files after sync (optional).\n\t * If set, `vocoder sync` writes {locale}.json files to this path.\n\t */\n\tlocalesPath?: string;\n\t/**\n\t * The industry or domain of this application.\n\t * Used to improve translation quality for domain-specific terminology\n\t * and to isolate cache entries by industry in the global translation cache.\n\t * Synced to App at extraction time.\n\t */\n\tappIndustry?: AppIndustry;\n\t/**\n\t * Project-wide default formality level for translations.\n\t * Can be overridden per-string via <T formality=\"...\"> on the AI plan.\n\t * Synced to App at extraction time.\n\t */\n\tformality?: Formality;\n}\n\n/** Type helper for vocoder.config.ts — provides autocomplete and type checking. */\nexport function defineConfig(config: VocoderConfig): VocoderConfig {\n\treturn config;\n}\n\n/**\n * Canonical translation bundle format shared by the build plugin and CLI.\n * Both read and write this shape — keeps cache files identical regardless of\n * which tool produced them.\n *\n * translations: locale → sourceKey (hash) → translated text\n * config.locales: locale metadata snapshot for the runtime\n */\nexport interface VocoderTranslationData {\n\tconfig: {\n\t\tsourceLocale: string;\n\t\ttargetLocales: string[];\n\t\tlocales: Record<string, {\n\t\t\tnativeName: string;\n\t\t\tdir?: \"rtl\";\n\t\t\tcurrencyCode?: string;\n\t\t\tordinalForms?: { type: \"suffix\"; suffixes: { zero?: string; one?: string; two?: string; few?: string; many?: string; other: string } } | { type: \"word\"; words: Record<string, Record<number, string>> };\n\t\t}>;\n\t};\n\ttranslations: Record<string, Record<string, string>>;\n\tupdatedAt: string | null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwDO,SAAS,aAAa,QAAsC;AAClE,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../../config/src/index.ts"],"sourcesContent":["/**\n * Supported app industry classifications.\n * Set once in vocoder.config.ts; synced to App at extraction time.\n * Cannot be edited from the dashboard — config file is the source of truth.\n *\n * Keep in sync with APP_INDUSTRIES in\n * vocoder-app/lib/vocoder/translation/context-constants.ts.\n */\nexport type AppIndustry =\n\t| \"ecommerce\"\n\t| \"saas\"\n\t| \"healthcare\"\n\t| \"fintech\"\n\t| \"gaming\"\n\t| \"education\"\n\t| \"media\"\n\t| \"productivity\";\n\n/**\n * Translation formality level.\n * Can be set project-wide in vocoder.config.ts or overridden per-string\n * via <T formality=\"formal\"> (requires allowAiTranslations plan).\n */\nexport type Formality = \"formal\" | \"informal\" | \"neutral\";\n\nexport interface VocoderConfig {\n\t/**\n\t * Unique identifier for this app. Written by `vocoder init` — do not edit manually.\n\t * Used by the CLI to identify which app to update when syncing locales.\n\t */\n\tappId?: string;\n\t/** Glob patterns for files to extract strings from. */\n\tinclude?: string[];\n\t/** Glob patterns to exclude. */\n\texclude?: string[];\n\t/**\n\t * Git branches that trigger string extraction and translation.\n\t * Synced to the Vocoder dashboard on each push — change here to update.\n\t */\n\ttargetBranches?: string[];\n\t/**\n\t * Directory to write translated locale files after sync (optional).\n\t * If set, `vocoder sync` writes {locale}.json files to this path.\n\t */\n\tlocalesPath?: string;\n\t/**\n\t * The industry or domain of this application.\n\t * Used to improve translation quality for domain-specific terminology\n\t * and to isolate cache entries by industry in the global translation cache.\n\t * Synced to App at extraction time.\n\t */\n\tappIndustry?: AppIndustry;\n\t/**\n\t * Project-wide default formality level for translations.\n\t * Can be overridden per-string via <T formality=\"...\"> on the AI plan.\n\t * Synced to App at extraction time.\n\t */\n\tformality?: Formality;\n}\n\n/** Type helper for vocoder.config.ts — provides autocomplete and type checking. */\nexport function defineConfig(config: VocoderConfig): VocoderConfig {\n\treturn config;\n}\n\n// Canonical translation bundle format defined in @vocoder/core and re-exported here\n// so consumers can import it from either package.\nexport type { VocoderTranslationData } from \"@vocoder/core\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA6DO,SAAS,aAAa,QAAsC;AAClE,SAAO;AACR;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vocoder/cli",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "description": "CLI tool for Vocoder translation workflow",
5
5
  "files": [
6
6
  "dist"
@@ -51,8 +51,8 @@
51
51
  "tsup": "^8.0.0",
52
52
  "typescript": "^5.4.0",
53
53
  "vitest": "^1.0.0",
54
- "@vocoder/extractor": "0.14.1",
55
- "@vocoder/config": "0.14.1"
54
+ "@vocoder/extractor": "0.15.0",
55
+ "@vocoder/config": "0.15.0"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=18"