@voltade/volty 0.1.12 → 0.1.14

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 (2) hide show
  1. package/dist/volty.js +42 -7
  2. package/package.json +1 -1
package/dist/volty.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // bin/volty.ts
4
- import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
4
+ import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "node:fs";
5
5
  import { homedir as homedir3 } from "node:os";
6
6
  import { join as join4 } from "node:path";
7
7
 
@@ -275,7 +275,7 @@ async function logout(config, env) {
275
275
  }
276
276
 
277
277
  // src/dispatch.ts
278
- import { readFileSync as readFileSync3 } from "node:fs";
278
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
279
279
 
280
280
  // ../shared/ops/flag-parse.ts
281
281
  function acceptsNull(prop) {
@@ -413,6 +413,22 @@ async function runOp(ctx, op, input) {
413
413
  const res = await apiFetch(ctx, pathForOp(op.name), { method: "POST", body: input });
414
414
  return { status: res.status, ok: res.ok, body: res.body };
415
415
  }
416
+ function saveOutFile(body, path) {
417
+ const structured = body.structuredContent;
418
+ if (typeof structured?.fileBase64 !== "string") {
419
+ throw new CliUsageError("--out: this operation returns no file, so there is nothing to write");
420
+ }
421
+ const bytes = Buffer.from(structured.fileBase64, "base64");
422
+ try {
423
+ writeFileSync3(path, bytes);
424
+ } catch (err) {
425
+ throw new CliUsageError(`--out: cannot write ${path} (${err.code ?? "error"})`);
426
+ }
427
+ return {
428
+ body: { ...body, structuredContent: { ...structured, fileBase64: path } },
429
+ line: `Wrote ${path} (${bytes.byteLength} bytes)`
430
+ };
431
+ }
416
432
 
417
433
  // src/format.ts
418
434
  function flagType(prop) {
@@ -540,7 +556,7 @@ function decideProposal(ctx, proposalId, decision, reason) {
540
556
  }
541
557
 
542
558
  // src/update.ts
543
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
559
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
544
560
  import { homedir as homedir2 } from "node:os";
545
561
  import { dirname as dirname2, join as join3 } from "node:path";
546
562
  var CACHE_PATH = join3(homedir2(), ".config", "volty", "update-check.json");
@@ -574,7 +590,7 @@ function readCache() {
574
590
  function writeCache(cache) {
575
591
  try {
576
592
  mkdirSync3(dirname2(CACHE_PATH), { recursive: true });
577
- writeFileSync3(CACHE_PATH, `${JSON.stringify(cache)}
593
+ writeFileSync4(CACHE_PATH, `${JSON.stringify(cache)}
578
594
  `);
579
595
  } catch {}
580
596
  }
@@ -813,7 +829,7 @@ function handleSkill(rest) {
813
829
  fail("bundled SKILL.md not found — reinstall the @voltade/volty package");
814
830
  const destDir = join4(homedir3(), ".claude", "skills", "volty-cli-ops");
815
831
  mkdirSync4(destDir, { recursive: true });
816
- writeFileSync4(join4(destDir, "SKILL.md"), readFileSync5(source, "utf8"));
832
+ writeFileSync5(join4(destDir, "SKILL.md"), readFileSync5(source, "utf8"));
817
833
  process.stdout.write(`Installed the volty-cli-ops skill → ${join4(destDir, "SKILL.md")}
818
834
  `);
819
835
  }
@@ -883,9 +899,12 @@ async function main() {
883
899
  `);
884
900
  return;
885
901
  }
902
+ const out = takeValue(resolved.rest, "--out");
903
+ if (out.rest.length !== resolved.rest.length && !out.value)
904
+ fail("--out needs a path, as in --out=./logo.png");
886
905
  let parsed;
887
906
  try {
888
- parsed = parseFlags(resolved.op, resolved.rest);
907
+ parsed = parseFlags(resolved.op, out.rest);
889
908
  } catch (err) {
890
909
  if (err instanceof CliUsageError)
891
910
  fail(err.message);
@@ -894,7 +913,23 @@ async function main() {
894
913
  const result = await runOp(ctx, resolved.op, parsed.input);
895
914
  if (!result.ok)
896
915
  failResult(resolved.op.name, result.body, result.status, parsed.json);
897
- process.stdout.write(`${renderResult(result.body, parsed.json)}
916
+ if (out.value === undefined) {
917
+ process.stdout.write(`${renderResult(result.body, parsed.json)}
918
+ `);
919
+ return;
920
+ }
921
+ let saved;
922
+ try {
923
+ saved = saveOutFile(result.body, out.value);
924
+ } catch (err) {
925
+ if (err instanceof CliUsageError)
926
+ fail(err.message);
927
+ throw err;
928
+ }
929
+ process.stdout.write(`${renderResult(saved.body, parsed.json)}
930
+ `);
931
+ if (!parsed.json)
932
+ process.stdout.write(`${saved.line}
898
933
  `);
899
934
  }
900
935
  main().catch((err) => fail(err instanceof Error ? err.message : String(err)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltade/volty",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
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",