@swarmvaultai/cli 0.1.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/README.md +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +76 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @swarmvaultai/cli
|
|
2
|
+
|
|
3
|
+
SwarmVault CLI for local-first knowledge vault workflows.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @swarmvaultai/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
swarmvault init
|
|
15
|
+
swarmvault ingest <path-or-url>
|
|
16
|
+
swarmvault compile
|
|
17
|
+
swarmvault query "What changed?" --save
|
|
18
|
+
swarmvault lint
|
|
19
|
+
swarmvault graph serve
|
|
20
|
+
swarmvault install --agent codex
|
|
21
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import process from "process";
|
|
6
|
+
import {
|
|
7
|
+
compileVault,
|
|
8
|
+
ingestInput,
|
|
9
|
+
initVault,
|
|
10
|
+
installAgent,
|
|
11
|
+
lintVault,
|
|
12
|
+
queryVault,
|
|
13
|
+
startGraphServer
|
|
14
|
+
} from "@swarmvaultai/engine";
|
|
15
|
+
var program = new Command();
|
|
16
|
+
program.name("swarmvault").description("SwarmVault is a local-first LLM wiki compiler with graph outputs and pluggable providers.").version("0.1.0");
|
|
17
|
+
program.command("init").description("Initialize a SwarmVault workspace in the current directory.").action(async () => {
|
|
18
|
+
await initVault(process.cwd());
|
|
19
|
+
process.stdout.write("Initialized SwarmVault workspace.\n");
|
|
20
|
+
});
|
|
21
|
+
program.command("ingest").description("Ingest a local file path or URL into the raw SwarmVault workspace.").argument("<input>", "Local file path or URL").action(async (input) => {
|
|
22
|
+
const manifest = await ingestInput(process.cwd(), input);
|
|
23
|
+
process.stdout.write(`${manifest.sourceId}
|
|
24
|
+
`);
|
|
25
|
+
});
|
|
26
|
+
program.command("compile").description("Compile manifests into wiki pages, graph JSON, and search index.").action(async () => {
|
|
27
|
+
const result = await compileVault(process.cwd());
|
|
28
|
+
process.stdout.write(
|
|
29
|
+
`Compiled ${result.sourceCount} source(s), ${result.pageCount} page(s). Changed: ${result.changedPages.length}.
|
|
30
|
+
`
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
program.command("query").description("Query the compiled SwarmVault wiki.").argument("<question>", "Question to ask SwarmVault").option("--save", "Persist the answer to wiki/outputs", false).action(async (question, options) => {
|
|
34
|
+
const result = await queryVault(process.cwd(), question, options.save ?? false);
|
|
35
|
+
process.stdout.write(`${result.answer}
|
|
36
|
+
`);
|
|
37
|
+
if (result.savedTo) {
|
|
38
|
+
process.stdout.write(`Saved to ${result.savedTo}
|
|
39
|
+
`);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
program.command("lint").description("Run anti-drift and wiki-health checks.").action(async () => {
|
|
43
|
+
const findings = await lintVault(process.cwd());
|
|
44
|
+
if (!findings.length) {
|
|
45
|
+
process.stdout.write("No findings.\n");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
for (const finding of findings) {
|
|
49
|
+
process.stdout.write(
|
|
50
|
+
`[${finding.severity}] ${finding.code}: ${finding.message}${finding.pagePath ? ` (${finding.pagePath})` : ""}
|
|
51
|
+
`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
var graph = program.command("graph").description("Graph-related commands.");
|
|
56
|
+
graph.command("serve").description("Serve the local graph viewer.").option("--port <port>", "Port override").action(async (options) => {
|
|
57
|
+
const port = options.port ? Number.parseInt(options.port, 10) : void 0;
|
|
58
|
+
const server = await startGraphServer(process.cwd(), port);
|
|
59
|
+
process.stdout.write(`Graph viewer running at http://localhost:${server.port}
|
|
60
|
+
`);
|
|
61
|
+
process.on("SIGINT", async () => {
|
|
62
|
+
await server.close();
|
|
63
|
+
process.exit(0);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
program.command("install").description("Install SwarmVault instructions for an agent in the current project.").requiredOption("--agent <agent>", "codex, claude, or cursor").action(async (options) => {
|
|
67
|
+
const target = await installAgent(process.cwd(), options.agent);
|
|
68
|
+
process.stdout.write(`Installed rules into ${target}
|
|
69
|
+
`);
|
|
70
|
+
});
|
|
71
|
+
program.parseAsync(process.argv).catch((error) => {
|
|
72
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
73
|
+
process.stderr.write(`${message}
|
|
74
|
+
`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@swarmvaultai/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Global CLI for SwarmVault.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"swarmvault": "dist/index.js",
|
|
13
|
+
"vault": "dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=24.0.0"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"commander": "^14.0.1",
|
|
23
|
+
"@swarmvaultai/engine": "0.1.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^24.6.0",
|
|
27
|
+
"tsup": "^8.5.0"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
31
|
+
"test": "node -e \"process.exit(0)\"",
|
|
32
|
+
"lint": "tsc --noEmit"
|
|
33
|
+
}
|
|
34
|
+
}
|