@swarmvaultai/cli 0.10.0 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.js +44 -5
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  acceptApproval,
10
10
  addInput,
11
11
  addManagedSource,
12
+ addWatchedRoot,
12
13
  archiveCandidate,
13
14
  autoCommitWikiChanges,
14
15
  benchmarkVault,
@@ -42,6 +43,7 @@ import {
42
43
  listManagedSourceRecords,
43
44
  listManifests,
44
45
  listSchedules,
46
+ listWatchedRoots,
45
47
  loadVaultConfig,
46
48
  pathGraphVault,
47
49
  previewCandidatePromotions,
@@ -52,6 +54,7 @@ import {
52
54
  readApproval,
53
55
  rejectApproval,
54
56
  reloadManagedSources,
57
+ removeWatchedRoot,
55
58
  resumeSourceSession,
56
59
  reviewManagedSource,
57
60
  reviewSourceScope,
@@ -280,9 +283,9 @@ program.name("swarmvault").description("SwarmVault is a local-first knowledge co
280
283
  function readCliVersion() {
281
284
  try {
282
285
  const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
283
- return typeof packageJson.version === "string" && packageJson.version.trim() ? packageJson.version : "0.10.0";
286
+ return typeof packageJson.version === "string" && packageJson.version.trim() ? packageJson.version : "0.11.0";
284
287
  } catch {
285
- return "0.10.0";
288
+ return "0.11.0";
286
289
  }
287
290
  }
288
291
  function parsePositiveInt(value, fallback) {
@@ -290,6 +293,9 @@ function parsePositiveInt(value, fallback) {
290
293
  const parsed = Number.parseInt(value, 10);
291
294
  return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
292
295
  }
296
+ function collectRepeated(value, previous) {
297
+ return [...previous, value];
298
+ }
293
299
  function sourceScopeFromManifests(input, manifests) {
294
300
  if (!manifests.length) {
295
301
  return null;
@@ -1134,14 +1140,16 @@ candidate.command("preview-scores").description("Show promotion scores for stage
1134
1140
  log(`${verdict} ${decision.pageId} score=${decision.score.toFixed(2)} ${decision.reasons.join("; ")}`);
1135
1141
  }
1136
1142
  });
1137
- var watch = program.command("watch").description("Watch the inbox directory and optionally tracked repos, or run one refresh cycle immediately.").option("--lint", "Run lint after each compile cycle", false).option("--repo", "Also refresh tracked repo sources and watch their repo roots", false).option("--once", "Run one import/refresh cycle immediately instead of starting a watcher", false).option("--code-only", "Only re-extract code sources (AST-only, no LLM re-analysis)", false).option("--debounce <ms>", "Debounce window in milliseconds", "900").action(async (options) => {
1143
+ var watch = program.command("watch").description("Watch the inbox directory and optionally tracked repos, or run one refresh cycle immediately.").option("--lint", "Run lint after each compile cycle", false).option("--repo", "Also refresh tracked repo sources and watch their repo roots", false).option("--once", "Run one import/refresh cycle immediately instead of starting a watcher", false).option("--code-only", "Only re-extract code sources (AST-only, no LLM re-analysis)", false).option("--debounce <ms>", "Debounce window in milliseconds", "900").option("--root <path>", "Watch this repo root instead of config/auto-discovery (repeat for multiple)", collectRepeated, []).action(async (options) => {
1138
1144
  const debounceMs = parsePositiveInt(options.debounce, 900);
1145
+ const overrideRoots = options.root && options.root.length > 0 ? options.root : void 0;
1139
1146
  if (options.once) {
1140
1147
  const result = await runWatchCycle(process2.cwd(), {
1141
1148
  lint: options.lint ?? false,
1142
1149
  repo: options.repo ?? false,
1143
1150
  codeOnly: options.codeOnly ?? false,
1144
- debounceMs
1151
+ debounceMs,
1152
+ overrideRoots
1145
1153
  });
1146
1154
  if (isJson()) {
1147
1155
  emitJson(result);
@@ -1157,7 +1165,8 @@ var watch = program.command("watch").description("Watch the inbox directory and
1157
1165
  lint: options.lint ?? false,
1158
1166
  repo: options.repo ?? false,
1159
1167
  codeOnly: options.codeOnly ?? false,
1160
- debounceMs
1168
+ debounceMs,
1169
+ overrideRoots
1161
1170
  });
1162
1171
  if (isJson()) {
1163
1172
  emitJson({ status: "watching", inboxDir: paths.inboxDir, repo: options.repo ?? false });
@@ -1172,6 +1181,36 @@ var watch = program.command("watch").description("Watch the inbox directory and
1172
1181
  process2.exit(0);
1173
1182
  });
1174
1183
  });
1184
+ watch.command("list-roots").description("Print the effective watched repo roots resolved from config and auto-discovery.").action(async () => {
1185
+ const roots = await listWatchedRoots(process2.cwd());
1186
+ if (isJson()) {
1187
+ emitJson({ roots });
1188
+ return;
1189
+ }
1190
+ if (roots.length === 0) {
1191
+ log("No watched repo roots.");
1192
+ return;
1193
+ }
1194
+ for (const entry of roots) {
1195
+ log(entry);
1196
+ }
1197
+ });
1198
+ watch.command("add-root <path>").description("Persist a repo root into swarmvault.config.json watch.repoRoots.").action(async (pathValue) => {
1199
+ const resolved = await addWatchedRoot(process2.cwd(), pathValue);
1200
+ if (isJson()) {
1201
+ emitJson({ added: resolved });
1202
+ return;
1203
+ }
1204
+ log(`Watching ${resolved}`);
1205
+ });
1206
+ watch.command("remove-root <path>").description("Remove a repo root from swarmvault.config.json watch.repoRoots.").action(async (pathValue) => {
1207
+ const removed = await removeWatchedRoot(process2.cwd(), pathValue);
1208
+ if (isJson()) {
1209
+ emitJson({ removed });
1210
+ return;
1211
+ }
1212
+ log(removed ? `Removed ${pathValue}` : `${pathValue} was not in watch.repoRoots.`);
1213
+ });
1175
1214
  async function showWatchStatus() {
1176
1215
  const result = await getWatchStatus(process2.cwd());
1177
1216
  if (isJson()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarmvaultai/cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Global CLI for SwarmVault.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "prepublishOnly": "node ../../scripts/check-release-sync.mjs && node ../../scripts/check-published-manifests.mjs"
45
45
  },
46
46
  "dependencies": {
47
- "@swarmvaultai/engine": "0.10.0",
47
+ "@swarmvaultai/engine": "0.11.0",
48
48
  "commander": "^14.0.1"
49
49
  },
50
50
  "devDependencies": {