@voltade/volty 0.1.29 → 0.1.31
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 +1 -1
- package/dist/volty.js +55 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ To edit a workspace's automations, pages, quick paths and inbox settings as file
|
|
|
56
56
|
volty init my-workspace
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
It pulls the workspace into the new folder and adds a `package.json`, a `.gitignore`, and a `tsconfig.json` that references `tsconfig.code.json` and `tsconfig.entry.json`, so your editor and Claude can check the code the way a push does, as the `@voltade/sdk` README explains. Run `
|
|
59
|
+
It pulls the workspace into the new folder and adds a `package.json`, a `.gitignore`, a `CLAUDE.md` that imports `AGENTS.md` for Claude Code, and a `tsconfig.json` that references `tsconfig.code.json` and `tsconfig.entry.json`, so your editor and Claude can check the code the way a push does, as the `@voltade/sdk` README explains. Run `bun install` in the folder, then `bunx tsc -b` to check it, then open it in your editor. A file the folder already has is kept. On prod, name the workspace with `--workspace <id>` (`volty org list --env prod` lists yours). Inside the folder, `volty pull` brings in later changes from the workspace and `volty push` sends yours back, both reading the workspace from the folder's `.volty/targets`.
|
|
60
60
|
|
|
61
61
|
## Upgrading
|
|
62
62
|
|
package/dist/volty.js
CHANGED
|
@@ -620,7 +620,8 @@ var SCAFFOLD_PATHS = [
|
|
|
620
620
|
"tsconfig.json",
|
|
621
621
|
"tsconfig.code.json",
|
|
622
622
|
"tsconfig.entry.json",
|
|
623
|
-
".gitignore"
|
|
623
|
+
".gitignore",
|
|
624
|
+
"CLAUDE.md"
|
|
624
625
|
];
|
|
625
626
|
var ENTRY_FILES = "pages/**/entry.tsx";
|
|
626
627
|
function options(name) {
|
|
@@ -663,6 +664,8 @@ function scaffoldFiles() {
|
|
|
663
664
|
}),
|
|
664
665
|
".gitignore": `${PUSH_EXCLUDES.join(`
|
|
665
666
|
`)}
|
|
667
|
+
`,
|
|
668
|
+
"CLAUDE.md": `@AGENTS.md
|
|
666
669
|
`
|
|
667
670
|
};
|
|
668
671
|
}
|
|
@@ -771,7 +774,7 @@ function initLines(dir, files) {
|
|
|
771
774
|
return [
|
|
772
775
|
`${dir} is set up for an editor:`,
|
|
773
776
|
...files.map((f) => f.written ? ` wrote ${f.path}` : ` kept ${f.path}, which the folder already has`),
|
|
774
|
-
dir === "." ? "Next: run
|
|
777
|
+
dir === "." ? "Next: run bun install, then bunx tsc -b to check the folder, then open it in your editor." : `Next: cd ${dir}, run bun install, then bunx tsc -b to check the folder, then open it in your editor.`
|
|
775
778
|
];
|
|
776
779
|
}
|
|
777
780
|
|
|
@@ -832,6 +835,7 @@ function isProdShaped(env, baseUrl) {
|
|
|
832
835
|
return host !== "localhost" && host !== "127.0.0.1" && host !== "::1" && host !== "[::1]";
|
|
833
836
|
}
|
|
834
837
|
var PROD_ORG_REFUSAL = "prod needs an explicit org: pass --org <id> or VOLTY_ORG=<id>; run 'volty org list --env prod' to see your orgs";
|
|
838
|
+
var PROD_WORKSPACE_REFUSAL = "prod needs an explicit workspace: pass --workspace <id>; run 'volty org list --env prod' to see yours";
|
|
835
839
|
var STICKY_ORG_REFUSAL = "prod does not honour a sticky org: pass --org <id> or VOLTY_ORG=<id> on each command instead; run 'volty org list --env prod' to see your orgs";
|
|
836
840
|
function resolveTargetOrg({ env, baseUrl, override, sticky, command }) {
|
|
837
841
|
if (!isProdShaped(env, baseUrl))
|
|
@@ -840,6 +844,8 @@ function resolveTargetOrg({ env, baseUrl, override, sticky, command }) {
|
|
|
840
844
|
return { org: override };
|
|
841
845
|
if (isOrgFreeCommand(command))
|
|
842
846
|
return { org: undefined };
|
|
847
|
+
if (command[0] === "pull" || command[0] === "init")
|
|
848
|
+
return { refusal: PROD_WORKSPACE_REFUSAL };
|
|
843
849
|
return { refusal: PROD_ORG_REFUSAL };
|
|
844
850
|
}
|
|
845
851
|
|
|
@@ -1368,20 +1374,49 @@ function pullLines(dir, out) {
|
|
|
1368
1374
|
"What the project does not hold is listed in .volty/observed."
|
|
1369
1375
|
];
|
|
1370
1376
|
}
|
|
1371
|
-
async function handlePull(
|
|
1372
|
-
const dir = folderArg(rest, "pull");
|
|
1377
|
+
async function handlePull(dir, ctx, env) {
|
|
1373
1378
|
const out = await pull(ctx, { dir, workspaceId: await workspaceOf(ctx), target: env });
|
|
1374
1379
|
process.stdout.write(`${pullLines(dir, out).join(`
|
|
1375
1380
|
`)}
|
|
1376
1381
|
`);
|
|
1377
1382
|
}
|
|
1378
|
-
async function handleInit(
|
|
1379
|
-
const dir = folderArg(rest, "init");
|
|
1383
|
+
async function handleInit(dir, ctx, env) {
|
|
1380
1384
|
const out = await init(ctx, { dir, workspaceId: await workspaceOf(ctx), target: env });
|
|
1381
1385
|
process.stdout.write(`${[...pullLines(dir, out.pulled), ...initLines(dir, out.files)].join(`
|
|
1382
1386
|
`)}
|
|
1383
1387
|
`);
|
|
1384
1388
|
}
|
|
1389
|
+
async function targetContext(config, name, workspace) {
|
|
1390
|
+
const login = config.contexts[name];
|
|
1391
|
+
if (!login?.apiKey)
|
|
1392
|
+
fail(`not logged in to '${name}', the env target ${name} runs on: run \`volty auth login --env ${name}\``);
|
|
1393
|
+
const selected = await ensureOrgKey(login, workspace, (line) => process.stderr.write(`${line}
|
|
1394
|
+
`));
|
|
1395
|
+
if (selected.minted)
|
|
1396
|
+
saveConfig(config);
|
|
1397
|
+
const ctx = { ...login, apiKey: selected.apiKey, organizationId: selected.organizationId };
|
|
1398
|
+
setOrgOverride(selected.organizationId);
|
|
1399
|
+
if (isProdShaped(name, login.baseUrl)) {
|
|
1400
|
+
const res = await whoami(ctx);
|
|
1401
|
+
if ("error" in res)
|
|
1402
|
+
fail(res.error);
|
|
1403
|
+
process.stderr.write(`→ ${name} · ${res.who.organizationName} (${res.who.organizationId}) · ${res.who.role}
|
|
1404
|
+
`);
|
|
1405
|
+
}
|
|
1406
|
+
return ctx;
|
|
1407
|
+
}
|
|
1408
|
+
async function handlePulledPull(dir, targets, config, envFlag, workspaceId) {
|
|
1409
|
+
if (workspaceId)
|
|
1410
|
+
refuseOtherWorkspace(dir, targets, workspaceId);
|
|
1411
|
+
if (envFlag === "all")
|
|
1412
|
+
fail(`${dir} holds one copy of the files, so a pull takes one target: name it with --env (${Object.keys(targets).join(", ")})`);
|
|
1413
|
+
const name = pickTargets(targets, envFlag)[0];
|
|
1414
|
+
const { workspace } = targets[name];
|
|
1415
|
+
const out = await pull(await targetContext(config, name, workspace), { dir, workspaceId: workspace, target: name });
|
|
1416
|
+
process.stdout.write(`${pullLines(dir, out).join(`
|
|
1417
|
+
`)}
|
|
1418
|
+
`);
|
|
1419
|
+
}
|
|
1385
1420
|
var PUSH_USAGE = "usage: volty push [dir] [--env <target>|all] [--dry-run] [--confirm] [--json]";
|
|
1386
1421
|
async function handlePush(argv, config, envFlag) {
|
|
1387
1422
|
const dryRun = takeBool(argv, "--dry-run");
|
|
@@ -1395,23 +1430,8 @@ async function handlePush(argv, config, envFlag) {
|
|
|
1395
1430
|
const answers = {};
|
|
1396
1431
|
let exitCode = 0;
|
|
1397
1432
|
for (const name of names) {
|
|
1398
|
-
const login = config.contexts[name];
|
|
1399
|
-
if (!login?.apiKey)
|
|
1400
|
-
fail(`not logged in to '${name}', the env target ${name} runs on: run \`volty auth login --env ${name}\``);
|
|
1401
1433
|
const { workspace } = project.targets[name];
|
|
1402
|
-
const
|
|
1403
|
-
`));
|
|
1404
|
-
if (selected.minted)
|
|
1405
|
-
saveConfig(config);
|
|
1406
|
-
const ctx = { ...login, apiKey: selected.apiKey, organizationId: selected.organizationId };
|
|
1407
|
-
setOrgOverride(selected.organizationId);
|
|
1408
|
-
if (isProdShaped(name, login.baseUrl)) {
|
|
1409
|
-
const res = await whoami(ctx);
|
|
1410
|
-
if ("error" in res)
|
|
1411
|
-
fail(res.error);
|
|
1412
|
-
process.stderr.write(`→ ${name} · ${res.who.organizationName} (${res.who.organizationId}) · ${res.who.role}
|
|
1413
|
-
`);
|
|
1414
|
-
}
|
|
1434
|
+
const ctx = await targetContext(config, name, workspace);
|
|
1415
1435
|
if (names.length > 1 && !json.present)
|
|
1416
1436
|
process.stdout.write(`Target ${name}, workspace ${workspace}:
|
|
1417
1437
|
`);
|
|
@@ -1474,21 +1494,25 @@ async function main() {
|
|
|
1474
1494
|
argv = orgExtract.rest;
|
|
1475
1495
|
const cacheFlag = takeBool(argv, "--no-cache");
|
|
1476
1496
|
argv = cacheFlag.rest;
|
|
1477
|
-
const
|
|
1497
|
+
const folderCmd = argv[0] === "pull" || argv[0] === "init" ? argv[0] : null;
|
|
1498
|
+
const workspaceExtract = folderCmd ? takeValue(argv, "--workspace") : { value: undefined, rest: argv };
|
|
1478
1499
|
argv = workspaceExtract.rest;
|
|
1479
1500
|
const config = loadConfig();
|
|
1480
|
-
const
|
|
1501
|
+
const dir = folderCmd ? folderArg(argv.slice(1), folderCmd) : null;
|
|
1502
|
+
const pulled = dir ? readTargets(dir) : null;
|
|
1481
1503
|
if (argv[0] === "push" || pulled) {
|
|
1482
1504
|
if (orgExtract.value)
|
|
1483
1505
|
fail(`volty ${argv[0]} takes its workspace from .volty/targets: leave out --org`);
|
|
1484
|
-
|
|
1485
|
-
|
|
1506
|
+
const envFlag = envExtract.value ?? (process.env.VOLTY_ENV || undefined);
|
|
1507
|
+
if (dir && pulled && folderCmd === "init") {
|
|
1486
1508
|
process.stdout.write(`${initLines(dir, initPulled(dir, pulled, workspaceExtract.value)).join(`
|
|
1487
1509
|
`)}
|
|
1488
1510
|
`);
|
|
1489
1511
|
return;
|
|
1490
1512
|
}
|
|
1491
|
-
|
|
1513
|
+
if (dir && pulled)
|
|
1514
|
+
return handlePulledPull(dir, pulled, config, envFlag, workspaceExtract.value);
|
|
1515
|
+
return handlePush(argv.slice(1), config, envFlag);
|
|
1492
1516
|
}
|
|
1493
1517
|
const env = activeEnv(config, envExtract.value ?? (process.env.VOLTY_ENV || undefined));
|
|
1494
1518
|
const peek = config.contexts[env];
|
|
@@ -1537,10 +1561,10 @@ async function main() {
|
|
|
1537
1561
|
process.stderr.write(`→ ${env} · ${res.who.organizationName} (${res.who.organizationId}) · ${res.who.role}
|
|
1538
1562
|
`);
|
|
1539
1563
|
}
|
|
1540
|
-
if (cmd === "pull")
|
|
1541
|
-
return handlePull(
|
|
1542
|
-
if (cmd === "init")
|
|
1543
|
-
return handleInit(
|
|
1564
|
+
if (dir && cmd === "pull")
|
|
1565
|
+
return handlePull(dir, ctx, env);
|
|
1566
|
+
if (dir && cmd === "init")
|
|
1567
|
+
return handleInit(dir, ctx, env);
|
|
1544
1568
|
if (cmd === "changes" && rest[0] === "decide")
|
|
1545
1569
|
return handleChanges(rest, ctx);
|
|
1546
1570
|
if (cmd === "keys")
|
package/package.json
CHANGED