@voltade/volty 0.1.11 → 0.1.12
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/dist/volty.js +27 -6
- 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
|
|
4
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
|
|
5
5
|
import { homedir as homedir3 } from "node:os";
|
|
6
6
|
import { join as join4 } from "node:path";
|
|
7
7
|
|
|
@@ -274,6 +274,9 @@ async function logout(config, env) {
|
|
|
274
274
|
return `Logged out of '${env}' (key revoked).`;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
// src/dispatch.ts
|
|
278
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
279
|
+
|
|
277
280
|
// ../shared/ops/flag-parse.ts
|
|
278
281
|
function acceptsNull(prop) {
|
|
279
282
|
if (prop.type === "null")
|
|
@@ -386,7 +389,25 @@ function resolveOp(catalog, argv) {
|
|
|
386
389
|
return null;
|
|
387
390
|
}
|
|
388
391
|
function parseFlags(op, rest) {
|
|
389
|
-
|
|
392
|
+
const props = op.input.properties ?? {};
|
|
393
|
+
const parsed = parseFlagTokens(props, rest, CliUsageError);
|
|
394
|
+
for (const [key, value] of Object.entries(parsed.input)) {
|
|
395
|
+
const prop = props[key];
|
|
396
|
+
if (typeof value === "string" && value.startsWith("@") && prop && isBase64(prop)) {
|
|
397
|
+
parsed.input[key] = readBase64File(key, value.slice(1));
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return parsed;
|
|
401
|
+
}
|
|
402
|
+
function isBase64(prop) {
|
|
403
|
+
return [prop, ...prop.anyOf ?? []].some((branch) => branch.contentEncoding === "base64");
|
|
404
|
+
}
|
|
405
|
+
function readBase64File(flag, path) {
|
|
406
|
+
try {
|
|
407
|
+
return readFileSync3(path).toString("base64");
|
|
408
|
+
} catch (err) {
|
|
409
|
+
throw new CliUsageError(`--${flag}: cannot read ${path} (${err.code ?? "error"})`);
|
|
410
|
+
}
|
|
390
411
|
}
|
|
391
412
|
async function runOp(ctx, op, input) {
|
|
392
413
|
const res = await apiFetch(ctx, pathForOp(op.name), { method: "POST", body: input });
|
|
@@ -519,7 +540,7 @@ function decideProposal(ctx, proposalId, decision, reason) {
|
|
|
519
540
|
}
|
|
520
541
|
|
|
521
542
|
// src/update.ts
|
|
522
|
-
import { mkdirSync as mkdirSync3, readFileSync as
|
|
543
|
+
import { mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
523
544
|
import { homedir as homedir2 } from "node:os";
|
|
524
545
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
525
546
|
var CACHE_PATH = join3(homedir2(), ".config", "volty", "update-check.json");
|
|
@@ -527,7 +548,7 @@ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
|
527
548
|
var REGISTRY_LATEST = "https://registry.npmjs.org/@voltade/volty/latest";
|
|
528
549
|
function currentVersion() {
|
|
529
550
|
try {
|
|
530
|
-
const pkg = JSON.parse(
|
|
551
|
+
const pkg = JSON.parse(readFileSync4(join3(import.meta.dirname, "..", "package.json"), "utf8"));
|
|
531
552
|
return pkg.version ?? null;
|
|
532
553
|
} catch {
|
|
533
554
|
return null;
|
|
@@ -545,7 +566,7 @@ function cmpVersion(a, b) {
|
|
|
545
566
|
}
|
|
546
567
|
function readCache() {
|
|
547
568
|
try {
|
|
548
|
-
return JSON.parse(
|
|
569
|
+
return JSON.parse(readFileSync4(CACHE_PATH, "utf8"));
|
|
549
570
|
} catch {
|
|
550
571
|
return null;
|
|
551
572
|
}
|
|
@@ -792,7 +813,7 @@ function handleSkill(rest) {
|
|
|
792
813
|
fail("bundled SKILL.md not found — reinstall the @voltade/volty package");
|
|
793
814
|
const destDir = join4(homedir3(), ".claude", "skills", "volty-cli-ops");
|
|
794
815
|
mkdirSync4(destDir, { recursive: true });
|
|
795
|
-
writeFileSync4(join4(destDir, "SKILL.md"),
|
|
816
|
+
writeFileSync4(join4(destDir, "SKILL.md"), readFileSync5(source, "utf8"));
|
|
796
817
|
process.stdout.write(`Installed the volty-cli-ops skill → ${join4(destDir, "SKILL.md")}
|
|
797
818
|
`);
|
|
798
819
|
}
|
package/package.json
CHANGED