@vocoder/cli 0.12.0 → 0.12.2
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/README.md +3 -3
- package/dist/bin.mjs +31 -62
- package/dist/bin.mjs.map +1 -1
- package/dist/{chunk-XUCVAFBG.mjs → chunk-2Q3JPWWV.mjs} +5 -5
- package/dist/{chunk-XUCVAFBG.mjs.map → chunk-2Q3JPWWV.mjs.map} +1 -1
- package/dist/lib.d.mts +7 -6
- package/dist/lib.mjs +1 -1
- package/dist/lib.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -100,13 +100,13 @@ When running `vocoder init` from a subdirectory of a git repository, the CLI aut
|
|
|
100
100
|
|
|
101
101
|
**Stored credentials:**
|
|
102
102
|
|
|
103
|
-
After first sign-in, the CLI stores credentials at `~/.
|
|
103
|
+
After first sign-in, the CLI stores credentials at `~/.vocoder/auth.json` (mode `0600`). Tokens do not expire. Use `vocoder logout` to revoke.
|
|
104
104
|
|
|
105
105
|
**Token resolution:**
|
|
106
106
|
|
|
107
107
|
| Command | Source |
|
|
108
108
|
|---|---|
|
|
109
|
-
| `vocoder init` | `VOCODER_AUTH_TOKEN` env var → `~/.
|
|
109
|
+
| `vocoder init` | `VOCODER_AUTH_TOKEN` env var → `~/.vocoder/auth.json` |
|
|
110
110
|
| `vocoder sync` | `VOCODER_API_KEY` env var → `.env` file |
|
|
111
111
|
| MCP tools | `VOCODER_API_KEY` env var |
|
|
112
112
|
|
|
@@ -274,7 +274,7 @@ Git repository is auto-detected from the current directory's git remote. Use `--
|
|
|
274
274
|
|
|
275
275
|
### `vocoder logout`
|
|
276
276
|
|
|
277
|
-
Revoke the stored credentials and clear `~/.
|
|
277
|
+
Revoke the stored credentials and clear `~/.vocoder/auth.json`.
|
|
278
278
|
|
|
279
279
|
```bash
|
|
280
280
|
vocoder logout
|
package/dist/bin.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
readAuthData,
|
|
14
14
|
verifyStoredAuth,
|
|
15
15
|
writeAuthData
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2Q3JPWWV.mjs";
|
|
17
17
|
|
|
18
18
|
// src/bin.ts
|
|
19
19
|
import { Command } from "commander";
|
|
@@ -47,11 +47,13 @@ function writeVocoderConfig(options) {
|
|
|
47
47
|
const ext = useTypeScript ? "ts" : "js";
|
|
48
48
|
const configPath = join(cwd, `vocoder.config.${ext}`);
|
|
49
49
|
const branchesStr = targetBranches.map((b) => `'${b}'`).join(", ");
|
|
50
|
+
const includes = ["**/*.{tsx,jsx,ts,js}"];
|
|
51
|
+
const includesStr = includes.map((p14) => `'${p14}'`).join(", ");
|
|
50
52
|
const content = `import { defineConfig } from '@vocoder/config'
|
|
51
53
|
|
|
52
54
|
export default defineConfig({
|
|
53
55
|
targetBranches: [${branchesStr}],
|
|
54
|
-
include: [
|
|
56
|
+
include: [${includesStr}],
|
|
55
57
|
exclude: [
|
|
56
58
|
'**/node_modules/**',
|
|
57
59
|
'**/.next/**',
|
|
@@ -878,25 +880,9 @@ async function runProjectCreate(params) {
|
|
|
878
880
|
return null;
|
|
879
881
|
}
|
|
880
882
|
const languageOptions = buildLanguageOptions(sourceLocales);
|
|
881
|
-
|
|
882
|
-
if (
|
|
883
|
-
appDir = params.defaultAppDir;
|
|
883
|
+
const appDir = params.defaultAppDir ?? "";
|
|
884
|
+
if (appDir) {
|
|
884
885
|
p3.log.success(`App directory: ${chalk4.bold(appDir)}`);
|
|
885
|
-
} else {
|
|
886
|
-
const rawScope = await p3.text({
|
|
887
|
-
message: "App directory (leave blank for the entire repo)",
|
|
888
|
-
placeholder: "e.g. apps/web, packages/frontend",
|
|
889
|
-
initialValue: "",
|
|
890
|
-
validate(value) {
|
|
891
|
-
const v = value.trim();
|
|
892
|
-
if (!v) return;
|
|
893
|
-
if (v.startsWith("/"))
|
|
894
|
-
return "Use a relative path, not an absolute path";
|
|
895
|
-
if (v.includes("..")) return 'Path must not contain ".."';
|
|
896
|
-
}
|
|
897
|
-
});
|
|
898
|
-
if (p3.isCancel(rawScope)) return null;
|
|
899
|
-
appDir = (rawScope ?? "").trim();
|
|
900
886
|
}
|
|
901
887
|
const sourceLocale = await searchSelectLocale(
|
|
902
888
|
languageOptions,
|
|
@@ -969,7 +955,7 @@ async function runProjectCreate(params) {
|
|
|
969
955
|
return null;
|
|
970
956
|
}
|
|
971
957
|
}
|
|
972
|
-
async function
|
|
958
|
+
async function runAppCreate(params) {
|
|
973
959
|
const { api, userToken, projectId, projectName, repoCanonical } = params;
|
|
974
960
|
const existingScopes = new Set(params.existingApps.map((a) => a.appDir));
|
|
975
961
|
let sourceLocales;
|
|
@@ -982,35 +968,13 @@ async function runProjectAppCreate(params) {
|
|
|
982
968
|
return null;
|
|
983
969
|
}
|
|
984
970
|
const languageOptions = buildLanguageOptions(sourceLocales);
|
|
985
|
-
|
|
986
|
-
if (
|
|
987
|
-
appDir
|
|
971
|
+
const appDir = params.defaultAppDir ?? "";
|
|
972
|
+
if (existingScopes.has(appDir)) {
|
|
973
|
+
p3.log.error(`App directory "${appDir}" is already configured for this project.`);
|
|
974
|
+
return null;
|
|
975
|
+
}
|
|
976
|
+
if (appDir) {
|
|
988
977
|
p3.log.success(`App directory: ${chalk4.bold(appDir)}`);
|
|
989
|
-
} else {
|
|
990
|
-
if (params.existingApps.length > 0) {
|
|
991
|
-
const configuredList = params.existingApps.map((a) => chalk4.dim(a.appDir || "(entire repo)")).join(", ");
|
|
992
|
-
p3.log.info(`Already configured: ${configuredList}`);
|
|
993
|
-
}
|
|
994
|
-
const hasWholeRepoApp = existingScopes.has("");
|
|
995
|
-
const rawScope = await p3.text({
|
|
996
|
-
message: "App directory for this new app",
|
|
997
|
-
placeholder: "e.g. apps/backend",
|
|
998
|
-
initialValue: params.defaultAppDir ?? "",
|
|
999
|
-
validate(value) {
|
|
1000
|
-
const v = value.trim();
|
|
1001
|
-
if (!v && hasWholeRepoApp)
|
|
1002
|
-
return "This project already covers the entire repo.";
|
|
1003
|
-
if (!v)
|
|
1004
|
-
return "App directory is required when other apps already exist.";
|
|
1005
|
-
if (v.startsWith("/"))
|
|
1006
|
-
return "Use a relative path, not an absolute path.";
|
|
1007
|
-
if (v.includes("..")) return 'Path must not contain "..".';
|
|
1008
|
-
if (existingScopes.has(v))
|
|
1009
|
-
return `"${v}" is already configured. Choose a different directory.`;
|
|
1010
|
-
}
|
|
1011
|
-
});
|
|
1012
|
-
if (p3.isCancel(rawScope)) return null;
|
|
1013
|
-
appDir = (rawScope ?? "").trim();
|
|
1014
978
|
}
|
|
1015
979
|
const sourceLocale = await searchSelectLocale(
|
|
1016
980
|
languageOptions,
|
|
@@ -1062,7 +1026,7 @@ async function runProjectAppCreate(params) {
|
|
|
1062
1026
|
}
|
|
1063
1027
|
const targetBranches = appPushBranches;
|
|
1064
1028
|
try {
|
|
1065
|
-
const result = await api.
|
|
1029
|
+
const result = await api.createApp(userToken, {
|
|
1066
1030
|
projectId,
|
|
1067
1031
|
appDir,
|
|
1068
1032
|
sourceLocale,
|
|
@@ -1302,7 +1266,7 @@ function printPlanLimitMessage(apiUrl, message) {
|
|
|
1302
1266
|
p5.log.info(`Manage subscription: ${getSubscriptionSettingsUrl(apiUrl)}`);
|
|
1303
1267
|
}
|
|
1304
1268
|
function runScaffold(params) {
|
|
1305
|
-
const { sourceLocale, targetBranches } = params;
|
|
1269
|
+
const { sourceLocale, targetBranches, appDir } = params;
|
|
1306
1270
|
const detection = detectLocalEcosystem();
|
|
1307
1271
|
const useTypeScript = detection.isTypeScript;
|
|
1308
1272
|
if (detection.ecosystem) {
|
|
@@ -1345,7 +1309,8 @@ function runScaffold(params) {
|
|
|
1345
1309
|
framework: detection.framework,
|
|
1346
1310
|
ecosystem: detection.ecosystem,
|
|
1347
1311
|
sourceLocale,
|
|
1348
|
-
targetBranches
|
|
1312
|
+
targetBranches,
|
|
1313
|
+
appDir
|
|
1349
1314
|
});
|
|
1350
1315
|
const steps = [];
|
|
1351
1316
|
if (snippets.pluginStep) {
|
|
@@ -1476,8 +1441,9 @@ async function runAuthFlow(api, options, reauth = false, repoCanonical) {
|
|
|
1476
1441
|
return null;
|
|
1477
1442
|
}
|
|
1478
1443
|
if (!shouldOpen) {
|
|
1479
|
-
|
|
1480
|
-
p5.
|
|
1444
|
+
server?.close();
|
|
1445
|
+
p5.cancel("Setup cancelled.");
|
|
1446
|
+
return null;
|
|
1481
1447
|
} else {
|
|
1482
1448
|
const opened = await tryOpenBrowser2(browserUrl);
|
|
1483
1449
|
if (!opened) {
|
|
@@ -1966,7 +1932,7 @@ async function init(options = {}) {
|
|
|
1966
1932
|
`${chalk6.bold(repoProjectName)} is already set up for this repo.
|
|
1967
1933
|
Configured apps: ${existingAppsForRepo.map((a) => chalk6.cyan(a.appDir || "(entire repo)")).join(", ")}`
|
|
1968
1934
|
);
|
|
1969
|
-
const appResult = await
|
|
1935
|
+
const appResult = await runAppCreate({
|
|
1970
1936
|
api,
|
|
1971
1937
|
userToken,
|
|
1972
1938
|
projectId: repoProjectId,
|
|
@@ -1982,7 +1948,8 @@ async function init(options = {}) {
|
|
|
1982
1948
|
}
|
|
1983
1949
|
runScaffold({
|
|
1984
1950
|
sourceLocale: appResult.sourceLocale,
|
|
1985
|
-
targetBranches: appResult.targetBranches
|
|
1951
|
+
targetBranches: appResult.targetBranches,
|
|
1952
|
+
appDir: identity?.repoAppDir
|
|
1986
1953
|
});
|
|
1987
1954
|
p5.outro("You're all set.");
|
|
1988
1955
|
return 0;
|
|
@@ -2039,7 +2006,7 @@ async function init(options = {}) {
|
|
|
2039
2006
|
return 1;
|
|
2040
2007
|
}
|
|
2041
2008
|
const chosen = existingProjects.find((proj) => proj.id === chosenId);
|
|
2042
|
-
const appResult = await
|
|
2009
|
+
const appResult = await runAppCreate({
|
|
2043
2010
|
api,
|
|
2044
2011
|
userToken,
|
|
2045
2012
|
projectId: chosen.id,
|
|
@@ -2055,7 +2022,8 @@ async function init(options = {}) {
|
|
|
2055
2022
|
}
|
|
2056
2023
|
runScaffold({
|
|
2057
2024
|
sourceLocale: appResult.sourceLocale,
|
|
2058
|
-
targetBranches: appResult.targetBranches
|
|
2025
|
+
targetBranches: appResult.targetBranches,
|
|
2026
|
+
appDir: identity?.repoAppDir
|
|
2059
2027
|
});
|
|
2060
2028
|
p5.outro("You're all set.");
|
|
2061
2029
|
return 0;
|
|
@@ -2090,7 +2058,8 @@ Translations won't run automatically until you grant access.
|
|
|
2090
2058
|
}
|
|
2091
2059
|
runScaffold({
|
|
2092
2060
|
sourceLocale: projectResult.sourceLocale,
|
|
2093
|
-
targetBranches: projectResult.targetBranches
|
|
2061
|
+
targetBranches: projectResult.targetBranches,
|
|
2062
|
+
appDir: identity?.repoAppDir
|
|
2094
2063
|
});
|
|
2095
2064
|
printApiKey(projectResult.apiKey);
|
|
2096
2065
|
p5.outro("You're all set.");
|
|
@@ -2405,8 +2374,8 @@ function buildTranslationData(params) {
|
|
|
2405
2374
|
const hashKeyed = {};
|
|
2406
2375
|
for (const [locale, localeMap] of Object.entries(params.translations)) {
|
|
2407
2376
|
hashKeyed[locale] = {};
|
|
2408
|
-
for (const [
|
|
2409
|
-
const hash = textToHash.get(
|
|
2377
|
+
for (const [text, translation] of Object.entries(localeMap)) {
|
|
2378
|
+
const hash = textToHash.get(text);
|
|
2410
2379
|
if (hash) hashKeyed[locale][hash] = translation;
|
|
2411
2380
|
}
|
|
2412
2381
|
}
|
|
@@ -2733,7 +2702,7 @@ async function sync(options = {}) {
|
|
|
2733
2702
|
requestedMaxWaitMs: waitTimeoutMs,
|
|
2734
2703
|
clientRunId: randomUUID(),
|
|
2735
2704
|
force: options.force,
|
|
2736
|
-
// Sync appIndustry from vocoder.config.ts to
|
|
2705
|
+
// Sync appIndustry from vocoder.config.ts to App on every push
|
|
2737
2706
|
...config.appIndustry ? { appIndustry: config.appIndustry } : {}
|
|
2738
2707
|
},
|
|
2739
2708
|
repoIdentity ? { ...repoIdentity, commitSha } : { commitSha }
|