@swarmvaultai/cli 1.3.0 → 1.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SwarmVault
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -41,6 +41,7 @@ swarmvault compile --max-tokens 120000
41
41
  swarmvault diff
42
42
  swarmvault graph share --post
43
43
  swarmvault graph share --svg ./share-card.svg
44
+ swarmvault graph share --bundle ./share-kit
44
45
  swarmvault benchmark
45
46
  swarmvault query "What keeps recurring?" --commit
46
47
  swarmvault query "Turn this into slides" --format slides
@@ -87,7 +88,7 @@ Quick-start a scratch vault from a local directory in one command.
87
88
  - initializes the current directory as a SwarmVault workspace
88
89
  - ingests the supplied directory as local sources
89
90
  - compiles the vault immediately
90
- - writes `wiki/graph/share-card.md` and `wiki/graph/share-card.svg`, then prints both paths
91
+ - writes `wiki/graph/share-card.md`, `wiki/graph/share-card.svg`, and `wiki/graph/share-kit/`, then prints the paths
91
92
  - starts `graph serve` unless you pass `--no-serve`
92
93
  - respects `--port` when you want a specific viewer port
93
94
 
@@ -100,7 +101,7 @@ Create a temporary sample vault with bundled sources, compile it immediately, an
100
101
  - writes the demo vault under the system temp directory
101
102
  - requires no API keys or extra setup
102
103
  - is the fastest way to inspect the full init + ingest + compile + graph workflow on a clean machine
103
- - writes `wiki/graph/share-card.md` and `wiki/graph/share-card.svg` inside the demo vault
104
+ - writes `wiki/graph/share-card.md`, `wiki/graph/share-card.svg`, and `wiki/graph/share-kit/` inside the demo vault
104
105
  - respects `--port` when you want a specific viewer port
105
106
 
106
107
  ### `swarmvault diff`
@@ -211,7 +212,7 @@ Compile the current manifests into:
211
212
  - generated markdown in `wiki/`
212
213
  - structured graph data in `state/graph.json`
213
214
  - local search data in `state/search.sqlite`
214
- - share cards at `wiki/graph/share-card.md` and `wiki/graph/share-card.svg`
215
+ - share cards at `wiki/graph/share-card.md` and `wiki/graph/share-card.svg`, plus a portable share kit at `wiki/graph/share-kit/`
215
216
 
216
217
  The compiler also reads `swarmvault.schema.md` and records a `schema_hash` plus lifecycle metadata such as `status`, `created_at`, `updated_at`, `compiled_from`, and `managed_by` in generated pages so schema edits can mark pages stale without losing lifecycle state.
217
218
 
@@ -371,14 +372,15 @@ Inspect graph metadata, community membership, neighbors, provenance, and group-p
371
372
 
372
373
  List the most connected bridge-heavy nodes in the current graph.
373
374
 
374
- ### `swarmvault graph share [--post] [--svg [path]]`
375
+ ### `swarmvault graph share [--post] [--svg [path]] [--bundle [dir]]`
375
376
 
376
377
  Print a shareable summary of the compiled graph.
377
378
 
378
379
  - default output is the same markdown shape written to `wiki/graph/share-card.md`
379
380
  - `--post` prints only the concise social-post text
380
381
  - `--svg [path]` writes the 1200x630 visual share card, defaulting to `wiki/graph/share-card.svg`
381
- - `--json` emits the structured share artifact for automation; with `--svg`, it also includes `svgPath`
382
+ - `--bundle [dir]` writes `share-card.md`, `share-post.txt`, `share-card.svg`, `share-preview.html`, and `share-artifact.json`, defaulting to `wiki/graph/share-kit`
383
+ - `--json` emits the structured share artifact for automation; with `--svg`, it also includes `svgPath`; with `--bundle`, it includes `bundlePath` and named output paths
382
384
  - useful immediately after `swarmvault scan`, `swarmvault demo`, or a normal compile
383
385
 
384
386
  ### `swarmvault graph blast <target> [--depth <n>]`
package/dist/index.js CHANGED
@@ -60,6 +60,7 @@ import {
60
60
  rejectApproval,
61
61
  reloadManagedSources,
62
62
  removeWatchedRoot,
63
+ renderGraphShareBundleFiles,
63
64
  renderGraphShareMarkdown,
64
65
  renderGraphShareSvg,
65
66
  resumeSourceSession,
@@ -292,9 +293,9 @@ program.name("swarmvault").description("SwarmVault is a local-first knowledge co
292
293
  function readCliVersion() {
293
294
  try {
294
295
  const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
295
- return typeof packageJson.version === "string" && packageJson.version.trim() ? packageJson.version : "1.3.0";
296
+ return typeof packageJson.version === "string" && packageJson.version.trim() ? packageJson.version : "1.4.0";
296
297
  } catch {
297
- return "1.3.0";
298
+ return "1.4.0";
298
299
  }
299
300
  }
300
301
  function parsePositiveInt(value, fallback) {
@@ -348,6 +349,20 @@ function log(message) {
348
349
  `);
349
350
  }
350
351
  }
352
+ async function writeShareBundle(bundlePath, files) {
353
+ await mkdir2(bundlePath, { recursive: true });
354
+ const bundleFiles = {
355
+ markdownPath: path2.join(bundlePath, "share-card.md"),
356
+ postPath: path2.join(bundlePath, "share-post.txt"),
357
+ svgPath: path2.join(bundlePath, "share-card.svg"),
358
+ previewHtmlPath: path2.join(bundlePath, "share-preview.html"),
359
+ artifactJsonPath: path2.join(bundlePath, "share-artifact.json")
360
+ };
361
+ for (const file of files) {
362
+ await writeFile2(path2.join(bundlePath, file.relativePath), file.content, "utf8");
363
+ }
364
+ return bundleFiles;
365
+ }
351
366
  function emitNotice(message) {
352
367
  process2.stderr.write(`[swarmvault] ${message}
353
368
  `);
@@ -976,9 +991,10 @@ graph.command("export").description(
976
991
  }
977
992
  }
978
993
  );
979
- graph.command("share").description("Print a shareable summary of the compiled graph.").option("--post", "Print only the short social post text", false).option("--svg [path]", "Write the visual SVG share card, defaulting to wiki/graph/share-card.svg").action(async (options) => {
980
- if (options.post && options.svg) {
981
- throw new Error("Choose either --post or --svg, not both.");
994
+ graph.command("share").description("Print a shareable summary of the compiled graph.").option("--post", "Print only the short social post text", false).option("--svg [path]", "Write the visual SVG share card, defaulting to wiki/graph/share-card.svg").option("--bundle [dir]", "Write the portable share kit bundle, defaulting to wiki/graph/share-kit").action(async (options) => {
995
+ const outputModeCount = [options.post, options.svg, options.bundle].filter(Boolean).length;
996
+ if (outputModeCount > 1) {
997
+ throw new Error("Choose one graph share output mode: --post, --svg, or --bundle.");
982
998
  }
983
999
  const { paths } = await loadVaultConfig(process2.cwd());
984
1000
  const raw = await readFile2(paths.graphPath, "utf-8");
@@ -1000,6 +1016,16 @@ graph.command("share").description("Print a shareable summary of the compiled gr
1000
1016
  log(`Wrote SVG share card to ${svgPath}`);
1001
1017
  return;
1002
1018
  }
1019
+ if (options.bundle) {
1020
+ const bundlePath = typeof options.bundle === "string" ? path2.resolve(process2.cwd(), options.bundle) : path2.join(paths.wikiDir, "graph", "share-kit");
1021
+ const bundleFiles = await writeShareBundle(bundlePath, renderGraphShareBundleFiles(artifact));
1022
+ if (isJson()) {
1023
+ emitJson({ ...artifact, bundlePath, bundleFiles });
1024
+ return;
1025
+ }
1026
+ log(`Wrote share kit to ${bundlePath}`);
1027
+ return;
1028
+ }
1003
1029
  if (isJson()) {
1004
1030
  emitJson(artifact);
1005
1031
  return;
@@ -1568,6 +1594,7 @@ program.command("demo").description("Try SwarmVault with a bundled sample vault
1568
1594
  const { paths } = await loadVaultConfig(demoDir);
1569
1595
  const shareCardPath = path3.join(demoDir, "wiki", "graph", "share-card.md");
1570
1596
  const shareCardSvgPath = path3.join(demoDir, "wiki", "graph", "share-card.svg");
1597
+ const shareKitPath = path3.join(demoDir, "wiki", "graph", "share-kit");
1571
1598
  let graphStats = "";
1572
1599
  try {
1573
1600
  const raw = await readFile2(paths.graphPath, "utf-8");
@@ -1587,6 +1614,7 @@ program.command("demo").description("Try SwarmVault with a bundled sample vault
1587
1614
  log(`Vault location: ${demoDir}`);
1588
1615
  log(`Share card: ${shareCardPath}`);
1589
1616
  log(`Visual card: ${shareCardSvgPath}`);
1617
+ log(`Share kit: ${shareKitPath}`);
1590
1618
  }
1591
1619
  if (options.serve !== false) {
1592
1620
  const port = options.port ? parsePositiveInt(options.port, 0) || void 0 : void 0;
@@ -1597,6 +1625,7 @@ program.command("demo").description("Try SwarmVault with a bundled sample vault
1597
1625
  graphStats: graphStats.trim(),
1598
1626
  shareCardPath,
1599
1627
  shareCardSvgPath,
1628
+ shareKitPath,
1600
1629
  port: server.port,
1601
1630
  url: `http://localhost:${server.port}`
1602
1631
  });
@@ -1617,7 +1646,7 @@ program.command("demo").description("Try SwarmVault with a bundled sample vault
1617
1646
  process2.exit(0);
1618
1647
  });
1619
1648
  } else if (isJson()) {
1620
- emitJson({ demoDir, graphStats: graphStats.trim(), shareCardPath, shareCardSvgPath });
1649
+ emitJson({ demoDir, graphStats: graphStats.trim(), shareCardPath, shareCardSvgPath, shareKitPath });
1621
1650
  } else {
1622
1651
  log("");
1623
1652
  log("Try next:");
@@ -1752,17 +1781,27 @@ program.command("scan").description("Quick-start: initialize, ingest, compile, a
1752
1781
  const compiled = await compileVault(rootDir, {});
1753
1782
  const shareCardPath = path2.join(rootDir, "wiki", "graph", "share-card.md");
1754
1783
  const shareCardSvgPath = path2.join(rootDir, "wiki", "graph", "share-card.svg");
1784
+ const shareKitPath = path2.join(rootDir, "wiki", "graph", "share-kit");
1755
1785
  if (!isJson()) {
1756
1786
  log(`Compiled ${compiled.sourceCount} source(s), ${compiled.pageCount} page(s).`);
1757
1787
  log(`Share card: ${shareCardPath}`);
1758
1788
  log(`Visual card: ${shareCardSvgPath}`);
1789
+ log(`Share kit: ${shareKitPath}`);
1759
1790
  log("Post text: swarmvault graph share --post");
1760
1791
  }
1761
1792
  if (options.serve !== false) {
1762
1793
  const port = options.port ? parsePositiveInt(options.port, 0) || void 0 : void 0;
1763
1794
  const server = await startGraphServer(rootDir, port, { full: false });
1764
1795
  if (isJson()) {
1765
- emitJson({ ...result, compiled, shareCardPath, shareCardSvgPath, port: server.port, url: `http://localhost:${server.port}` });
1796
+ emitJson({
1797
+ ...result,
1798
+ compiled,
1799
+ shareCardPath,
1800
+ shareCardSvgPath,
1801
+ shareKitPath,
1802
+ port: server.port,
1803
+ url: `http://localhost:${server.port}`
1804
+ });
1766
1805
  } else {
1767
1806
  log(`Graph viewer running at http://localhost:${server.port}`);
1768
1807
  }
@@ -1774,7 +1813,7 @@ program.command("scan").description("Quick-start: initialize, ingest, compile, a
1774
1813
  process2.exit(0);
1775
1814
  });
1776
1815
  } else if (isJson()) {
1777
- emitJson({ ...result, compiled, shareCardPath, shareCardSvgPath });
1816
+ emitJson({ ...result, compiled, shareCardPath, shareCardSvgPath, shareKitPath });
1778
1817
  }
1779
1818
  });
1780
1819
  function enableStructuredJsonOnSubcommands(command) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmvaultai/cli",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Global CLI for SwarmVault.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -37,19 +37,18 @@
37
37
  "engines": {
38
38
  "node": ">=24.0.0"
39
39
  },
40
- "scripts": {
41
- "build": "tsup src/index.ts --format esm --dts",
42
- "test": "vitest run",
43
- "typecheck": "tsc --noEmit",
44
- "prepublishOnly": "node ../../scripts/check-release-sync.mjs && node ../../scripts/check-published-manifests.mjs"
45
- },
46
40
  "dependencies": {
47
- "@swarmvaultai/engine": "1.3.0",
41
+ "@swarmvaultai/engine": "1.4.0",
48
42
  "commander": "^14.0.1"
49
43
  },
50
44
  "devDependencies": {
51
45
  "@types/node": "^24.6.0",
52
46
  "tsup": "^8.5.0",
53
47
  "vitest": "^3.2.4"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup src/index.ts --format esm --dts",
51
+ "test": "vitest run",
52
+ "typecheck": "tsc --noEmit"
54
53
  }
55
- }
54
+ }