@vocoder/cli 0.11.0 → 0.12.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
@@ -149,7 +149,7 @@ interface TranslationSnapshotResponse {
149
149
  }
150
150
  interface LimitErrorResponse {
151
151
  errorCode: "LIMIT_EXCEEDED" | "INSUFFICIENT_CREDITS";
152
- limitType: "organizations" | "projects" | "git_connections" | "members" | "providers" | "translation_chars" | "source_strings" | "credits";
152
+ limitType: "organizations" | "projects" | "git_connections" | "members" | "providers" | "translation_chars" | "source_strings" | "target_locales" | "credits";
153
153
  planId: string;
154
154
  current: number;
155
155
  required: number;
@@ -401,6 +401,27 @@ declare class VocoderAPI {
401
401
  connectionLabel: string;
402
402
  repoCount: number;
403
403
  }>;
404
+ /**
405
+ * Add a target locale to the project.
406
+ * Idempotent: returns the current list unchanged if the locale is already configured.
407
+ * Project determined from API key.
408
+ *
409
+ * @throws {VocoderAPIError} status 422 for invalid/unsupported locale code
410
+ * @throws {VocoderAPIError} status 403 with limitError.limitType "target_locales" when plan limit reached
411
+ */
412
+ addLocale(locale: string, repoCanonical?: string): Promise<{
413
+ targetLocales: string[];
414
+ }>;
415
+ /**
416
+ * Remove a target locale from the project.
417
+ * Idempotent: returns the current list unchanged if the locale is not configured.
418
+ * Project determined from API key.
419
+ *
420
+ * @throws {VocoderAPIError} on auth or server errors
421
+ */
422
+ removeLocale(locale: string, repoCanonical?: string): Promise<{
423
+ targetLocales: string[];
424
+ }>;
404
425
  listLocales(userToken: string): Promise<{
405
426
  sourceLocales: Array<{
406
427
  code: string;
@@ -489,6 +510,33 @@ interface AuthData {
489
510
  }
490
511
  declare function readAuthData(): AuthData | null;
491
512
  declare function writeAuthData(data: AuthData): void;
513
+ /**
514
+ * Result of checking a stored CLI auth token against the API:
515
+ * - "valid" — token is good; user info is returned
516
+ * - "expired" — token rejected (non-404); user record still exists → reauth,
517
+ * do NOT run the GitHub App install flow again
518
+ * - "gone" — 404; user record deleted → treat as first-time setup
519
+ * - "none" — no token on disk
520
+ */
521
+ type StoredAuthStatus = {
522
+ status: "valid";
523
+ token: string;
524
+ userId: string;
525
+ email: string;
526
+ name: string | null;
527
+ } | {
528
+ status: "expired";
529
+ } | {
530
+ status: "gone";
531
+ } | {
532
+ status: "none";
533
+ };
534
+ /**
535
+ * Verify the stored CLI auth token. Clears the token on failure.
536
+ * Shared by the CLI (`commands/init.ts`) and the MCP (`tools/project-init.ts`)
537
+ * so reauth detection stays in sync.
538
+ */
539
+ declare function verifyStoredAuth(api: VocoderAPI): Promise<StoredAuthStatus>;
492
540
  declare function clearAuthData(): void;
493
541
 
494
542
  interface SetupSnippets {
@@ -515,4 +563,4 @@ declare function getSetupSnippets(params: {
515
563
  targetBranches: string[];
516
564
  }): SetupSnippets;
517
565
 
518
- export { type APIProjectConfig, type AuthData, type DetectedEcosystem, type DetectedFramework, type ExtractedString, type LimitErrorResponse, type LocalDetectionResult, type LocaleInfo, type LocalesMap, type PackageManager, type SetupSnippets, StringExtractor, type SyncPolicyConfig, type SyncPolicyErrorResponse, type TranslationBatchResponse, type TranslationSnapshotResponse, type TranslationStatusResponse, VocoderAPI, VocoderAPIError, type VocoderConfig, buildInstallCommand, clearAuthData, defineConfig, detectLocalEcosystem, getPackagesToInstall, getSetupSnippets, loadVocoderConfig, readAuthData, writeAuthData };
566
+ export { type APIProjectConfig, type AuthData, type DetectedEcosystem, type DetectedFramework, type ExtractedString, type LimitErrorResponse, type LocalDetectionResult, type LocaleInfo, type LocalesMap, type PackageManager, type SetupSnippets, type StoredAuthStatus, StringExtractor, type SyncPolicyConfig, type SyncPolicyErrorResponse, type TranslationBatchResponse, type TranslationSnapshotResponse, type TranslationStatusResponse, VocoderAPI, VocoderAPIError, type VocoderConfig, buildInstallCommand, clearAuthData, defineConfig, detectLocalEcosystem, getPackagesToInstall, getSetupSnippets, loadVocoderConfig, readAuthData, verifyStoredAuth, writeAuthData };
package/dist/lib.mjs CHANGED
@@ -10,8 +10,9 @@ import {
10
10
  getSetupSnippets,
11
11
  loadVocoderConfig,
12
12
  readAuthData,
13
+ verifyStoredAuth,
13
14
  writeAuthData
14
- } from "./chunk-XF3KGGYQ.mjs";
15
+ } from "./chunk-XUCVAFBG.mjs";
15
16
 
16
17
  // ../config/src/index.ts
17
18
  function defineConfig(config) {
@@ -29,6 +30,7 @@ export {
29
30
  getSetupSnippets,
30
31
  loadVocoderConfig,
31
32
  readAuthData,
33
+ verifyStoredAuth,
32
34
  writeAuthData
33
35
  };
34
36
  //# sourceMappingURL=lib.mjs.map
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 ProjectApp 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 ProjectApp 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 ProjectApp 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 ProjectApp 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 ProjectApp 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 ProjectApp 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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vocoder/cli",
3
- "version": "0.11.0",
3
+ "version": "0.12.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.11.0",
55
- "@vocoder/config": "0.11.0"
54
+ "@vocoder/extractor": "0.12.0",
55
+ "@vocoder/config": "0.12.0"
56
56
  },
57
57
  "engines": {
58
58
  "node": ">=18"