@voltade/volty 0.1.18 → 0.1.19

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 +31 -9
  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 writeFileSync5 } from "node:fs";
4
+ import { existsSync as existsSync4, 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
 
@@ -268,7 +268,7 @@ async function logout(config, env) {
268
268
  }
269
269
 
270
270
  // src/dispatch.ts
271
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
271
+ import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
272
272
 
273
273
  // ../shared/ops/flag-parse.ts
274
274
  function acceptsNull(prop) {
@@ -406,12 +406,29 @@ function parseFlags(op, rest) {
406
406
  const parsed = parseFlagTokens(props, rest, CliUsageError);
407
407
  for (const [key, value] of Object.entries(parsed.input)) {
408
408
  const prop = props[key];
409
- if (typeof value === "string" && value.startsWith("@") && prop && isBase64(prop)) {
409
+ if (typeof value !== "string" || !value.startsWith("@") || !prop)
410
+ continue;
411
+ if (isBase64(prop))
410
412
  parsed.input[key] = readBase64File(key, value.slice(1));
411
- }
413
+ else if (isText(prop))
414
+ parsed.input[key] = readTextFlag(key, value.slice(1)) ?? value;
412
415
  }
413
416
  return parsed;
414
417
  }
418
+ function isText(prop) {
419
+ return [prop, ...prop.anyOf ?? []].some((branch) => branch.type === "string" && !branch.enum);
420
+ }
421
+ function readTextFlag(flag, path) {
422
+ if (path === "-")
423
+ return readFileSync3(0, "utf8");
424
+ if (!existsSync3(path))
425
+ return null;
426
+ try {
427
+ return readFileSync3(path, "utf8");
428
+ } catch (err) {
429
+ throw new CliUsageError(`--${flag}: cannot read ${path} (${err.code ?? "error"})`);
430
+ }
431
+ }
415
432
  function isBase64(prop) {
416
433
  return [prop, ...prop.anyOf ?? []].some((branch) => branch.contentEncoding === "base64");
417
434
  }
@@ -478,14 +495,19 @@ function opUsage(op) {
478
495
  }
479
496
  return parts.join(" ");
480
497
  }
481
- function renderCatalog(catalog) {
482
- const lines = catalog.toSorted((a, b) => a.name.localeCompare(b.name)).map((op) => ` ${op.name} — ${op.description}`);
498
+ function renderCatalog(catalog, group) {
499
+ const shown = group ? catalog.filter((op) => op.name === group || op.name.startsWith(`${group} `)) : catalog;
500
+ if (group && shown.length === 0) {
501
+ const groups = [...new Set(catalog.map((op) => op.name.split(" ")[0]))].toSorted();
502
+ return `No operations in '${group}'. Groups: ${groups.join(", ")}`;
503
+ }
504
+ const lines = shown.toSorted((a, b) => a.name.localeCompare(b.name)).map((op) => ` ${op.name} — ${op.description}`);
483
505
  return [
484
506
  "Run a Volty platform operation: volty <operation> [--flags] [--json]",
485
507
  "",
486
508
  ...lines,
487
509
  "",
488
- "`volty <operation> --help` shows usage; `--json` returns the machine-readable result."
510
+ "`volty help <group>` lists one group (`volty help chat-flow`); `volty <operation> --help` shows usage; `--json` returns the machine-readable result. A text flag takes a file as `--source=@flow.ts`, or stdin as `--source=@-`."
489
511
  ].join(`
490
512
  `);
491
513
  }
@@ -837,7 +859,7 @@ function handleSkill(rest) {
837
859
  join4(import.meta.dirname, "..", "skill", "volty-cli-ops", "SKILL.md"),
838
860
  join4(import.meta.dirname, "..", "..", ".claude", "skills", "volty-cli-ops", "SKILL.md")
839
861
  ];
840
- const source = candidates.find((p) => existsSync3(p));
862
+ const source = candidates.find((p) => existsSync4(p));
841
863
  if (!source)
842
864
  fail("bundled SKILL.md not found — reinstall the @voltade/volty package");
843
865
  const destDir = join4(homedir3(), ".claude", "skills", "volty-cli-ops");
@@ -893,7 +915,7 @@ async function main() {
893
915
  return handleChanges(rest, ctx);
894
916
  const catalog = await fetchCatalog(ctx, env, !cacheFlag.present);
895
917
  if (!cmd || cmd === "help" || cmd === "--help") {
896
- process.stdout.write(`${renderCatalog(catalog.ops)}
918
+ process.stdout.write(`${renderCatalog(catalog.ops, rest.length ? rest.join(" ") : undefined)}
897
919
  `);
898
920
  return;
899
921
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltade/volty",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
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",