@vocoder/cli 0.14.0 → 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
  }
@@ -97,7 +104,6 @@ interface LocalConfig {
97
104
  interface APIAppConfig {
98
105
  projectName: string;
99
106
  organizationName: string;
100
- shortCode: string;
101
107
  sourceLocale: string;
102
108
  targetLocales: string[];
103
109
  targetBranches: string[];
@@ -106,7 +112,8 @@ interface APIAppConfig {
106
112
  }
107
113
  interface TranslationStringEntry {
108
114
  key: string;
109
- text: string;
115
+ /** Source text. null for id-only entries (<T id="key" /> with no message). */
116
+ text: string | null;
110
117
  context?: string;
111
118
  formality?: "formal" | "informal" | "neutral" | "auto";
112
119
  uiRole?: string;
@@ -336,26 +343,30 @@ declare class VocoderAPI {
336
343
  * Revoke the given CLI user token server-side.
337
344
  */
338
345
  revokeCliToken(userToken: string): Promise<void>;
339
- listWorkspaces(userToken: string, params?: {
346
+ listOrganizations(userToken: string, params?: {
340
347
  repo?: string;
341
348
  }): Promise<{
342
- workspaces: Array<{
349
+ organizations: Array<{
343
350
  id: string;
344
351
  name: string;
345
352
  planId: string;
346
- maxProjects: number;
347
- 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;
348
357
  hasGitHubConnection: boolean;
349
358
  connectionLabel: string | null;
350
359
  /** null when no `repo` param was provided */
351
360
  coversRepo: boolean | null;
352
361
  installationConfigureUrl: string | null;
353
362
  }>;
354
- canCreateWorkspace: boolean;
363
+ canCreateOrganization: boolean;
355
364
  }>;
356
365
  listApps(userToken: string, organizationId: string): Promise<Array<{
357
- id: string;
366
+ appId: string;
367
+ projectId: string;
358
368
  name: string;
369
+ appDir: string;
359
370
  sourceLocale: string;
360
371
  targetLocales: string[];
361
372
  targetBranches: string[];
@@ -409,7 +420,7 @@ declare class VocoderAPI {
409
420
  * @throws {VocoderAPIError} status 422 for invalid/unsupported locale code
410
421
  * @throws {VocoderAPIError} status 403 with limitError.limitType "target_locales" when plan limit reached
411
422
  */
412
- addLocale(locale: string, repoCanonical?: string): Promise<{
423
+ addLocale(locale: string, repoCanonical?: string, appId?: string): Promise<{
413
424
  targetLocales: string[];
414
425
  }>;
415
426
  /**
@@ -419,7 +430,7 @@ declare class VocoderAPI {
419
430
  *
420
431
  * @throws {VocoderAPIError} on auth or server errors
421
432
  */
422
- removeLocale(locale: string, repoCanonical?: string): Promise<{
433
+ removeLocale(locale: string, repoCanonical?: string, appId?: string): Promise<{
423
434
  targetLocales: string[];
424
435
  }>;
425
436
  listLocales(userToken: string): Promise<{
@@ -456,6 +467,10 @@ declare class VocoderAPI {
456
467
  targetBranches: string[];
457
468
  repositoryBound: boolean;
458
469
  configureUrl?: string;
470
+ apps: Array<{
471
+ appDir: string;
472
+ appId: string;
473
+ }>;
459
474
  }>;
460
475
  /**
461
476
  * Look up all project apps for a given repo. Returns info about exact matches,
@@ -467,6 +482,7 @@ declare class VocoderAPI {
467
482
  appDir: string;
468
483
  }): Promise<{
469
484
  exactMatch: {
485
+ appId: string;
470
486
  projectId: string;
471
487
  projectName: string;
472
488
  organizationName: string;
@@ -475,11 +491,18 @@ declare class VocoderAPI {
475
491
  } | null;
476
492
  existingApps: Array<{
477
493
  appDir: string;
494
+ /** Unique identifier for this app — written to vocoder.config.ts. */
495
+ appId: string;
478
496
  projectId: string;
479
497
  projectName: string;
480
498
  organizationName: string;
481
499
  }>;
482
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;
483
506
  }>;
484
507
  /**
485
508
  * Add a new App to an existing project (monorepo: new app directory).
@@ -496,7 +519,6 @@ declare class VocoderAPI {
496
519
  appId: string;
497
520
  projectId: string;
498
521
  projectName: string;
499
- apiKey: string;
500
522
  appDir: string;
501
523
  }>;
502
524
  }
package/dist/lib.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  readAuthData,
13
13
  verifyStoredAuth,
14
14
  writeAuthData
15
- } from "./chunk-T4BLNDJ3.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.0",
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/config": "0.14.0",
55
- "@vocoder/extractor": "0.14.0"
54
+ "@vocoder/extractor": "0.15.0",
55
+ "@vocoder/config": "0.15.0"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=18"