@swarmvaultai/cli 0.2.1 → 0.3.0
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/index.js +18 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
getWatchStatus,
|
|
20
20
|
importInbox,
|
|
21
21
|
ingestDirectory,
|
|
22
|
-
|
|
22
|
+
ingestInputDetailed,
|
|
23
23
|
initVault,
|
|
24
24
|
installAgent,
|
|
25
25
|
installGitHooks,
|
|
@@ -217,13 +217,13 @@ function normalizeVersion(version) {
|
|
|
217
217
|
// src/index.ts
|
|
218
218
|
var program = new Command();
|
|
219
219
|
var CLI_VERSION = readCliVersion();
|
|
220
|
-
program.name("swarmvault").description("SwarmVault is a local-first
|
|
220
|
+
program.name("swarmvault").description("SwarmVault is a local-first knowledge compiler with graph outputs and optional provider-backed workflows.").version(CLI_VERSION).option("--json", "Emit structured JSON output", false);
|
|
221
221
|
function readCliVersion() {
|
|
222
222
|
try {
|
|
223
223
|
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
224
|
-
return typeof packageJson.version === "string" && packageJson.version.trim() ? packageJson.version : "0.
|
|
224
|
+
return typeof packageJson.version === "string" && packageJson.version.trim() ? packageJson.version : "0.3.0";
|
|
225
225
|
} catch {
|
|
226
|
-
return "0.
|
|
226
|
+
return "0.3.0";
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
function parsePositiveInt(value, fallback) {
|
|
@@ -314,11 +314,18 @@ program.command("ingest").description("Ingest a local file path, directory path,
|
|
|
314
314
|
}
|
|
315
315
|
return;
|
|
316
316
|
}
|
|
317
|
-
const
|
|
317
|
+
const ingest = await ingestInputDetailed(process2.cwd(), input, commonOptions);
|
|
318
318
|
if (isJson()) {
|
|
319
|
-
emitJson(
|
|
319
|
+
emitJson(ingest);
|
|
320
320
|
} else {
|
|
321
|
-
|
|
321
|
+
const primary = [...ingest.created, ...ingest.updated, ...ingest.unchanged][0];
|
|
322
|
+
if (ingest.created.length + ingest.updated.length + ingest.removed.length <= 1 && primary) {
|
|
323
|
+
log(primary.sourceId);
|
|
324
|
+
} else {
|
|
325
|
+
log(
|
|
326
|
+
`Created ${ingest.created.length}, updated ${ingest.updated.length}, unchanged ${ingest.unchanged.length}, removed ${ingest.removed.length}.`
|
|
327
|
+
);
|
|
328
|
+
}
|
|
322
329
|
}
|
|
323
330
|
}
|
|
324
331
|
);
|
|
@@ -512,9 +519,9 @@ graphPush.command("neo4j").description("Push the compiled graph directly into Ne
|
|
|
512
519
|
}
|
|
513
520
|
}
|
|
514
521
|
);
|
|
515
|
-
graph.command("serve").description("Serve the local graph viewer.").option("--port <port>", "Port override").action(async (options) => {
|
|
522
|
+
graph.command("serve").description("Serve the local graph viewer.").option("--port <port>", "Port override").option("--full", "Disable overview sampling and render the full graph", false).action(async (options) => {
|
|
516
523
|
const port = options.port ? parsePositiveInt(options.port, 0) || void 0 : void 0;
|
|
517
|
-
const server = await startGraphServer(process2.cwd(), port);
|
|
524
|
+
const server = await startGraphServer(process2.cwd(), port, { full: options.full ?? false });
|
|
518
525
|
if (isJson()) {
|
|
519
526
|
emitJson({ port: server.port, url: `http://localhost:${server.port}` });
|
|
520
527
|
} else {
|
|
@@ -528,7 +535,7 @@ graph.command("serve").description("Serve the local graph viewer.").option("--po
|
|
|
528
535
|
process2.exit(0);
|
|
529
536
|
});
|
|
530
537
|
});
|
|
531
|
-
graph.command("export").description("Export the graph as HTML, SVG, GraphML, or Cypher.").option("--html <output>", "Output HTML file path").option("--svg <output>", "Output SVG file path").option("--graphml <output>", "Output GraphML file path").option("--cypher <output>", "Output Cypher file path").action(async (options) => {
|
|
538
|
+
graph.command("export").description("Export the graph as HTML, SVG, GraphML, or Cypher.").option("--html <output>", "Output HTML file path").option("--svg <output>", "Output SVG file path").option("--graphml <output>", "Output GraphML file path").option("--cypher <output>", "Output Cypher file path").option("--full", "Disable overview sampling for HTML export", false).action(async (options) => {
|
|
532
539
|
const targets = [
|
|
533
540
|
options.html ? { format: "html", outputPath: options.html } : null,
|
|
534
541
|
options.svg ? { format: "svg", outputPath: options.svg } : null,
|
|
@@ -539,7 +546,7 @@ graph.command("export").description("Export the graph as HTML, SVG, GraphML, or
|
|
|
539
546
|
throw new Error("Pass exactly one of --html, --svg, --graphml, or --cypher.");
|
|
540
547
|
}
|
|
541
548
|
const target = targets[0];
|
|
542
|
-
const outputPath = target.format === "html" ? await exportGraphHtml(process2.cwd(), target.outputPath) : (await exportGraphFormat(process2.cwd(), target.format, target.outputPath)).outputPath;
|
|
549
|
+
const outputPath = target.format === "html" ? await exportGraphHtml(process2.cwd(), target.outputPath, { full: options.full ?? false }) : (await exportGraphFormat(process2.cwd(), target.format, target.outputPath)).outputPath;
|
|
543
550
|
if (isJson()) {
|
|
544
551
|
emitJson({ format: target.format, outputPath });
|
|
545
552
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swarmvaultai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Global CLI for SwarmVault.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node": ">=24.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@swarmvaultai/engine": "0.
|
|
41
|
+
"@swarmvaultai/engine": "0.3.0",
|
|
42
42
|
"commander": "^14.0.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|