@voltade/volty 0.1.26 → 0.1.27

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/volty.js +24 -10
  3. 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 with `npx tsc -b`, as the `@voltade/sdk` README explains. Run `npm install` in the folder, then open it in your editor. A file the folder already has is kept. `volty pull` brings in later changes from the workspace and `volty push` sends yours back.
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 `npm install` in the folder, then `npx tsc -b` to check it, then open it in your editor. A file the folder already has is kept. `volty pull` brings in later changes from the workspace and `volty push` sends yours back.
60
60
 
61
61
  ## Upgrading
62
62
 
package/dist/volty.js CHANGED
@@ -688,14 +688,16 @@ function writeTargets(dir, targets) {
688
688
  writeFileSync4(join3(dir, ".volty", "targets"), `${JSON.stringify(targets, null, 2)}
689
689
  `);
690
690
  }
691
+ function refuseOtherWorkspace(dir, targets, workspaceId) {
692
+ const other = Object.values(targets).find((t) => t.workspace !== workspaceId);
693
+ if (other)
694
+ throw new Error(`${dir} holds the project of workspace ${other.workspace}: pull ${workspaceId} into its own folder.`);
695
+ }
691
696
  async function pull(ctx, opts) {
692
697
  const { dir, workspaceId, target } = opts;
693
698
  const targets = readTargets(dir);
694
699
  if (targets) {
695
- const other = Object.entries(targets).find(([, t]) => t.workspace !== workspaceId);
696
- if (other) {
697
- throw new Error(`${dir} holds the project of workspace ${other[1].workspace}: pull ${workspaceId} into its own folder.`);
698
- }
700
+ refuseOtherWorkspace(dir, targets, workspaceId);
699
701
  } else if (existsSync4(dir) && readdirSync(dir).some((name) => !name.startsWith("."))) {
700
702
  throw new Error(`${dir} is not empty and no volty pull wrote it: pull into an empty folder.`);
701
703
  }
@@ -756,15 +758,20 @@ function scaffold(dir) {
756
758
  return { path, written: true };
757
759
  });
758
760
  }
761
+ function initPulled(dir, targets, workspaceId) {
762
+ if (workspaceId)
763
+ refuseOtherWorkspace(dir, targets, workspaceId);
764
+ return scaffold(dir);
765
+ }
759
766
  async function init(ctx, opts) {
760
- const pulled = readTargets(opts.dir) ? null : await pull(ctx, opts);
767
+ const pulled = await pull(ctx, opts);
761
768
  return { pulled, files: scaffold(opts.dir) };
762
769
  }
763
770
  function initLines(dir, files) {
764
771
  return [
765
772
  `${dir} is set up for an editor:`,
766
773
  ...files.map((f) => f.written ? ` wrote ${f.path}` : ` kept ${f.path}, which the folder already has`),
767
- dir === "." ? "Next: run npm install, then open this folder in your editor." : `Next: cd ${dir}, run npm install, then open the folder in your editor.`
774
+ dir === "." ? "Next: run npm install, then npx tsc -b to check the folder, then open it in your editor." : `Next: cd ${dir}, run npm install, then npx tsc -b to check the folder, then open it in your editor.`
768
775
  ];
769
776
  }
770
777
 
@@ -1371,8 +1378,7 @@ async function handlePull(rest, ctx, env) {
1371
1378
  async function handleInit(rest, ctx, env) {
1372
1379
  const dir = folderArg(rest, "init");
1373
1380
  const out = await init(ctx, { dir, workspaceId: await workspaceOf(ctx), target: env });
1374
- const lines = [...out.pulled ? pullLines(dir, out.pulled) : [], ...initLines(dir, out.files)];
1375
- process.stdout.write(`${lines.join(`
1381
+ process.stdout.write(`${[...pullLines(dir, out.pulled), ...initLines(dir, out.files)].join(`
1376
1382
  `)}
1377
1383
  `);
1378
1384
  }
@@ -1471,9 +1477,17 @@ async function main() {
1471
1477
  const workspaceExtract = argv[0] === "pull" || argv[0] === "init" ? takeValue(argv, "--workspace") : { value: undefined, rest: argv };
1472
1478
  argv = workspaceExtract.rest;
1473
1479
  const config = loadConfig();
1474
- if (argv[0] === "push") {
1480
+ const pulled = argv[0] === "init" ? readTargets(folderArg(argv.slice(1), "init")) : null;
1481
+ if (argv[0] === "push" || pulled) {
1475
1482
  if (orgExtract.value)
1476
- fail("volty push takes its workspace from .volty/targets: leave out --org");
1483
+ fail(`volty ${argv[0]} takes its workspace from .volty/targets: leave out --org`);
1484
+ if (pulled) {
1485
+ const dir = folderArg(argv.slice(1), "init");
1486
+ process.stdout.write(`${initLines(dir, initPulled(dir, pulled, workspaceExtract.value)).join(`
1487
+ `)}
1488
+ `);
1489
+ return;
1490
+ }
1477
1491
  return handlePush(argv.slice(1), config, envExtract.value ?? (process.env.VOLTY_ENV || undefined));
1478
1492
  }
1479
1493
  const env = activeEnv(config, envExtract.value ?? (process.env.VOLTY_ENV || undefined));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltade/volty",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Remote CLI for the Volty platform — run operations, trigger real agent wakes, and inspect LLM I/O over an API key.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",