@sechroom/cli 2026.6.24 → 2026.6.25

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 +247 -121
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -375,8 +375,8 @@ async function promptYesNo(question) {
375
375
  const { createInterface } = await import("readline");
376
376
  const rl = createInterface({ input: process.stdin, output: process.stderr });
377
377
  try {
378
- const answer = await new Promise((resolve2) => {
379
- rl.question(`${question} [y/N] `, resolve2);
378
+ const answer = await new Promise((resolve3) => {
379
+ rl.question(`${question} [y/N] `, resolve3);
380
380
  });
381
381
  return /^y(es)?$/i.test(answer.trim());
382
382
  } finally {
@@ -389,8 +389,8 @@ async function promptText(question, def) {
389
389
  const rl = createInterface({ input: process.stdin, output: process.stderr });
390
390
  try {
391
391
  const suffix = def ? ` [${def}]` : "";
392
- const answer = await new Promise((resolve2) => {
393
- rl.question(`${question}${suffix} `, resolve2);
392
+ const answer = await new Promise((resolve3) => {
393
+ rl.question(`${question}${suffix} `, resolve3);
394
394
  });
395
395
  const trimmed = answer.trim();
396
396
  return trimmed.length > 0 ? trimmed : def ?? "";
@@ -416,8 +416,8 @@ async function promptSelect(question, choices, def) {
416
416
  process.stderr.write(` ${marker} ${style.bold(String(i + 1))}. ${c.label}${hint}
417
417
  `);
418
418
  });
419
- const answer = await new Promise((resolve2) => {
420
- rl.question(`Choose ${style.dim(`[${defIdx + 1}]`)} `, resolve2);
419
+ const answer = await new Promise((resolve3) => {
420
+ rl.question(`Choose ${style.dim(`[${defIdx + 1}]`)} `, resolve3);
421
421
  });
422
422
  const trimmed = answer.trim();
423
423
  if (!trimmed) return choices[defIdx].value;
@@ -449,8 +449,8 @@ async function promptMultiSelect(question, choices, preselected = []) {
449
449
  process.stderr.write(` ${box} ${style.bold(String(i + 1))}. ${c.label}${hint}
450
450
  `);
451
451
  });
452
- const answer = await new Promise((resolve2) => {
453
- rl.question(`Select ${style.dim("[Enter = \u25C9]")} `, resolve2);
452
+ const answer = await new Promise((resolve3) => {
453
+ rl.question(`Select ${style.dim("[Enter = \u25C9]")} `, resolve3);
454
454
  });
455
455
  const trimmed = answer.trim().toLowerCase();
456
456
  if (!trimmed) return preValues();
@@ -2938,6 +2938,113 @@ async function runClients(clients, cmd, opts) {
2938
2938
  process.stdout.write(opts.dryRun ? "\n(dry run \u2014 nothing written)\n" : "\nDone.\n");
2939
2939
  }
2940
2940
 
2941
+ // src/commands/onboard.ts
2942
+ import { existsSync as existsSync7 } from "fs";
2943
+ import { join as join7 } from "path";
2944
+
2945
+ // src/commands/fanout.ts
2946
+ import { spawnSync } from "child_process";
2947
+ import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync, statSync } from "fs";
2948
+ import { isAbsolute, join as join6, resolve } from "path";
2949
+ var ICON = {
2950
+ refresh: "\u21BB",
2951
+ bind: "+",
2952
+ "skip-missing": "\u2013",
2953
+ "skip-unbound": "\u26A0"
2954
+ };
2955
+ function resolveChildDir(path, root) {
2956
+ return isAbsolute(path) ? path : resolve(root, path);
2957
+ }
2958
+ function discoverChildren(root) {
2959
+ let names;
2960
+ try {
2961
+ names = readdirSync(root);
2962
+ } catch {
2963
+ return [];
2964
+ }
2965
+ const out = [];
2966
+ for (const name of names.sort()) {
2967
+ if (name.startsWith(".") || name === "node_modules") continue;
2968
+ const dir = join6(root, name);
2969
+ try {
2970
+ if (!statSync(dir).isDirectory()) continue;
2971
+ } catch {
2972
+ continue;
2973
+ }
2974
+ if (existsSync6(join6(dir, ".git")) || committedBindingPath(dir)) out.push(name);
2975
+ }
2976
+ return out;
2977
+ }
2978
+ function readManifest(path) {
2979
+ if (!existsSync6(path)) return null;
2980
+ let parsed;
2981
+ try {
2982
+ parsed = JSON.parse(readFileSync5(path, "utf8"));
2983
+ } catch (err2) {
2984
+ throw new Error(`couldn't parse ${path}: ${err2 instanceof Error ? err2.message : String(err2)}`);
2985
+ }
2986
+ return Array.isArray(parsed.repos) ? parsed.repos.filter((r) => r && typeof r.path === "string") : [];
2987
+ }
2988
+ function passthroughGlobals(g) {
2989
+ const out = [];
2990
+ if (g.baseUrl) out.push("--base-url", g.baseUrl);
2991
+ if (g.tenant) out.push("--tenant", g.tenant);
2992
+ return out;
2993
+ }
2994
+ function runChildren(plans, o) {
2995
+ const { globals, dryRun, json } = o;
2996
+ const results = [];
2997
+ for (const plan of plans) {
2998
+ const runs = plan.argv.length > 0;
2999
+ const argv = runs ? [...globals, ...plan.argv] : [];
3000
+ if (!json) {
3001
+ process.stderr.write(` ${ICON[plan.disposition]} ${style.cyan(plan.label)} ${style.dim(plan.reason)}
3002
+ `);
3003
+ if (runs && dryRun) process.stderr.write(` ${style.dim(`would run: sechroom ${argv.join(" ")}`)}
3004
+ `);
3005
+ }
3006
+ let exitCode = runs ? 0 : null;
3007
+ if (runs && !dryRun) {
3008
+ const res = spawnSync(process.execPath, [process.argv[1], ...argv], {
3009
+ cwd: plan.dir,
3010
+ stdio: json ? "ignore" : "inherit"
3011
+ });
3012
+ exitCode = res.status;
3013
+ if (!json) {
3014
+ process.stderr.write(
3015
+ exitCode === 0 ? ` ${ok("\u2713")} ${style.dim("onboard ok")}
3016
+ ` : ` ${warn("\u2717")} ${style.dim(`onboard exited ${exitCode ?? "signal"}`)}
3017
+ `
3018
+ );
3019
+ }
3020
+ }
3021
+ results.push({
3022
+ path: plan.label,
3023
+ dir: plan.dir,
3024
+ disposition: plan.disposition,
3025
+ ran: runs && !dryRun,
3026
+ exitCode,
3027
+ reason: plan.reason
3028
+ });
3029
+ }
3030
+ return results;
3031
+ }
3032
+ function summarizeFanout(results, o) {
3033
+ const ran = results.filter((r) => r.ran);
3034
+ const failed = ran.filter((r) => r.exitCode !== 0);
3035
+ const skipped = results.filter((r) => r.disposition.startsWith("skip"));
3036
+ const wouldRun = results.filter((r) => !r.disposition.startsWith("skip"));
3037
+ const tally = (o.dryRun ? [wouldRun.length ? `${wouldRun.length} would onboard` : null, skipped.length ? `${skipped.length} would skip` : null] : [
3038
+ ran.length ? `${ran.length - failed.length}/${ran.length} onboarded` : null,
3039
+ skipped.length ? `${skipped.length} skipped` : null,
3040
+ failed.length ? `${failed.length} failed` : null
3041
+ ]).filter(Boolean).join(", ");
3042
+ process.stderr.write(`
3043
+ ${failed.length ? warn("\u26A0") : ok("\u2713")} ${tally || "nothing to do"}${o.dryRun ? style.dim(" (dry run)") : ""}
3044
+ `);
3045
+ if (failed.length) process.exit(1);
3046
+ }
3047
+
2941
3048
  // src/commands/onboard.ts
2942
3049
  var DEFAULT_BASE_URL2 = "https://app.sechroom.ai/api";
2943
3050
  function systemTimezone() {
@@ -3010,7 +3117,7 @@ async function warnIfProjectStray(client, projectId, workspaceId, json) {
3010
3117
  );
3011
3118
  }
3012
3119
  }
3013
- async function pickWorkspace(client) {
3120
+ async function pickWorkspace(client, promptLabel = "Bind this directory to a workspace:") {
3014
3121
  const all = await withSpinner("Listing your workspaces", () => fetchWorkspaces(client));
3015
3122
  if (all.length === 0) {
3016
3123
  process.stderr.write(`no workspaces found \u2014 skipping workspace binding (you can set it later with \`sechroom config set --local workspaceId <id>\`)
@@ -3033,7 +3140,7 @@ async function pickWorkspace(client) {
3033
3140
  ...pool.slice().sort((a, b) => workspacePath(a, byId).localeCompare(workspacePath(b, byId))).map((w) => ({ label: workspacePath(w, byId), value: w.id, hint: w.id })),
3034
3141
  { label: style.dim("skip \u2014 don't bind a workspace"), value: SKIP, hint: void 0 }
3035
3142
  ];
3036
- const chosen = await promptSelect("Bind this directory to a workspace:", choices, SKIP);
3143
+ const chosen = await promptSelect(promptLabel, choices, SKIP);
3037
3144
  if (chosen === SKIP) return void 0;
3038
3145
  const picked = byId.get(chosen);
3039
3146
  const collisions = all.filter((w) => w.id !== picked.id && namesCollide(w.name, picked.name));
@@ -3191,8 +3298,79 @@ async function chooseClients(clientFlag, yes, cwd) {
3191
3298
  );
3192
3299
  return picks.length > 0 ? picks : preselected;
3193
3300
  }
3301
+ async function planRecurseChild(entry, root, client, opts) {
3302
+ const dir = resolveChildDir(entry.path, root);
3303
+ if (!existsSync7(dir)) {
3304
+ return { label: entry.path, dir, disposition: "skip-missing", argv: [], reason: "directory does not exist" };
3305
+ }
3306
+ if (existsSync7(join7(dir, ".sechroom.json"))) {
3307
+ return {
3308
+ label: entry.path,
3309
+ dir,
3310
+ disposition: "refresh",
3311
+ argv: ["onboard", "--refresh", "--yes"],
3312
+ reason: "bound (committed .sechroom.json) \u2014 refresh in place"
3313
+ };
3314
+ }
3315
+ if (entry.workspaceId) {
3316
+ return {
3317
+ label: entry.path,
3318
+ dir,
3319
+ disposition: "bind",
3320
+ argv: ["onboard", "--yes", "--local", "--workspace", entry.workspaceId],
3321
+ reason: `unbound \u2014 bind to ${entry.workspaceId}`
3322
+ };
3323
+ }
3324
+ if (opts.dryRun) {
3325
+ return { label: entry.path, dir, disposition: "bind", argv: ["onboard", "--yes", "--local", "--workspace", "<prompt>"], reason: "unbound \u2014 would prompt for a workspace" };
3326
+ }
3327
+ if (opts.yes || !canPrompt()) {
3328
+ return { label: entry.path, dir, disposition: "skip-unbound", argv: [], reason: "unbound + no workspace (run interactively, or add it to ./.sechroom/repos.json)" };
3329
+ }
3330
+ process.stderr.write(`
3331
+ ${style.bold(entry.path)} ${style.dim("is not bound yet.")}
3332
+ `);
3333
+ const ws = await pickWorkspace(client, `Bind ${style.cyan(entry.path)} to a workspace:`);
3334
+ if (!ws) {
3335
+ return { label: entry.path, dir, disposition: "skip-unbound", argv: [], reason: "unbound \u2014 no workspace chosen (skipped)" };
3336
+ }
3337
+ return {
3338
+ label: entry.path,
3339
+ dir,
3340
+ disposition: "bind",
3341
+ argv: ["onboard", "--yes", "--local", "--workspace", ws],
3342
+ reason: `unbound \u2014 bind to ${ws}`
3343
+ };
3344
+ }
3345
+ async function runRecurse(cfg, g, opts) {
3346
+ const { yes, dryRun, json } = opts;
3347
+ const root = process.cwd();
3348
+ const manifestPath = join7(root, ".sechroom", "repos.json");
3349
+ const fromManifest = readManifest(manifestPath);
3350
+ const entries = fromManifest ?? discoverChildren(root).map((path) => ({ path }));
3351
+ const sourceLabel = fromManifest ? `manifest ${manifestPath}` : `auto-discovered under ${root}`;
3352
+ if (entries.length === 0) {
3353
+ if (json) process.stdout.write(JSON.stringify({ recurse: true, root, repos: [] }) + "\n");
3354
+ else process.stderr.write(`${warn("\u26A0")} no child repos found ${fromManifest ? `in ${manifestPath}` : `under ${root}`} \u2014 nothing to do.
3355
+ `);
3356
+ return;
3357
+ }
3358
+ if (!json) {
3359
+ process.stderr.write(`${style.bold("onboard --recurse")} ${style.dim(`(${entries.length} repo${entries.length === 1 ? "" : "s"} from ${sourceLabel})`)}
3360
+ `);
3361
+ }
3362
+ const client = await makeClient(cfg);
3363
+ const plans = [];
3364
+ for (const entry of entries) plans.push(await planRecurseChild(entry, root, client, { yes, dryRun }));
3365
+ const results = runChildren(plans, { globals: passthroughGlobals(g), dryRun, json });
3366
+ if (json) {
3367
+ process.stdout.write(JSON.stringify({ recurse: true, root, dryRun, repos: results }) + "\n");
3368
+ return;
3369
+ }
3370
+ summarizeFanout(results, { dryRun });
3371
+ }
3194
3372
  function registerOnboard(program2) {
3195
- program2.command("onboard").description("Guided first-run setup: configure, sign in, set timezone, detect clients, and wire this project").option("--client <list>", `comma-separated clients (${ALL_CLIENT_KEYS.join(", ")}) or 'all' (default: auto-detected)`).option("--local", "save the binding (tenant + base URL + workspace) to a committed .sechroom.json in this repo instead of the global config", false).option("--workspace <id>", "bind this directory to a workspace (skips the interactive workspace pick)").option("--cli-only", "configure the CLI only \u2014 don't wire any AI client (no MCP config, no agent files)", false).option("--no-mcp", "skip the MCP server config (.mcp.json etc.); still write the agent instruction files").option("--copy", "make a personal copy of the agent instructions you can edit (default: prompt on a TTY, else skip)").option("--dry-run", "walk through without writing files or changing the profile", false).option("--refresh", "re-fetch descriptors and refresh any out-of-date managed blocks (local edits preserved to .proposed)", false).option("--force", "rewrite every managed block, overwriting local edits inside the markers (content outside untouched)", false).option("--check", "report whether anything would change and exit (0 = all current, 1 = stale/drift/absent); writes nothing", false).option("-y, --yes", "non-interactive: accept defaults (system timezone, detected clients, global config, full wire)", false).addHelpText(
3373
+ program2.command("onboard").description("Guided first-run setup: configure, sign in, set timezone, detect clients, and wire this project").option("--recurse", "orchestration-root mode: onboard every child repo under this dir (auto-discovered, or from ./.sechroom/repos.json) \u2014 refreshes bound repos, prompts a workspace per new one", false).option("--client <list>", `comma-separated clients (${ALL_CLIENT_KEYS.join(", ")}) or 'all' (default: auto-detected)`).option("--local", "save the binding (tenant + base URL + workspace) to a committed .sechroom.json in this repo instead of the global config", false).option("--workspace <id>", "bind this directory to a workspace (skips the interactive workspace pick)").option("--cli-only", "configure the CLI only \u2014 don't wire any AI client (no MCP config, no agent files)", false).option("--no-mcp", "skip the MCP server config (.mcp.json etc.); still write the agent instruction files").option("--copy", "make a personal copy of the agent instructions you can edit (default: prompt on a TTY, else skip)").option("--dry-run", "walk through without writing files or changing the profile", false).option("--refresh", "re-fetch descriptors and refresh any out-of-date managed blocks (local edits preserved to .proposed)", false).option("--force", "rewrite every managed block, overwriting local edits inside the markers (content outside untouched)", false).option("--check", "report whether anything would change and exit (0 = all current, 1 = stale/drift/absent); writes nothing", false).option("-y, --yes", "non-interactive: accept defaults (system timezone, detected clients, global config, full wire)", false).addHelpText(
3196
3374
  "after",
3197
3375
  `
3198
3376
  Examples:
@@ -3201,6 +3379,7 @@ Examples:
3201
3379
  $ sechroom onboard --no-mcp agent instructions only, skip MCP config
3202
3380
  $ sechroom onboard --local save tenant + base URL to a committed ./.sechroom.json
3203
3381
  $ sechroom onboard --workspace wsp_XX bind this directory to a workspace (no pick prompt)
3382
+ $ sechroom onboard --recurse orchestration root: onboard every child repo under this dir
3204
3383
  $ sechroom onboard --refresh refresh out-of-date instruction blocks in place
3205
3384
  $ sechroom onboard --check CI/pre-commit: nonzero exit if instructions are out of date
3206
3385
  $ sechroom onboard --yes non-interactive: defaults + global config + full wire
@@ -3212,6 +3391,13 @@ Examples:
3212
3391
  const mode = opts.check ? "check" : opts.force ? "force" : "apply";
3213
3392
  const check = mode === "check";
3214
3393
  const yes = Boolean(opts.yes) || check;
3394
+ if (opts.recurse) {
3395
+ const baseUrl2 = resolveBaseUrl(g);
3396
+ await ensureAuth({ baseUrl: baseUrl2, tenant: "", clientId: readPersisted().clientId }, yes);
3397
+ const cfg2 = await ensureTenant(baseUrl2, g, { yes: true, json, persist: false });
3398
+ await runRecurse(cfg2, g, { yes, dryRun, json });
3399
+ return;
3400
+ }
3215
3401
  const baseUrl = resolveBaseUrl(g);
3216
3402
  await ensureAuth({ baseUrl, tenant: "", clientId: readPersisted().clientId }, yes);
3217
3403
  const cfg = await ensureTenant(baseUrl, g, { yes, json, local: Boolean(opts.local), workspace: opts.workspace, persist: !check });
@@ -3365,18 +3551,17 @@ ${style.bold("Next:")} paste this into your AI agent to get going \u2014
3365
3551
  }
3366
3552
 
3367
3553
  // src/commands/sweep.ts
3368
- import { spawnSync } from "child_process";
3369
- import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
3370
- import { dirname as dirname6, isAbsolute, join as join6, resolve } from "path";
3371
- var DEFAULT_MANIFEST = join6(".sechroom", "repos.json");
3554
+ import { existsSync as existsSync8 } from "fs";
3555
+ import { dirname as dirname6, join as join8, resolve as resolve2 } from "path";
3556
+ var DEFAULT_MANIFEST = join8(".sechroom", "repos.json");
3372
3557
  function planEntry(entry, root) {
3373
- const dir = isAbsolute(entry.path) ? entry.path : resolve(root, entry.path);
3374
- if (!existsSync6(dir)) {
3375
- return { entry, dir, disposition: "skip-missing", argv: [], reason: "directory does not exist" };
3558
+ const dir = resolveChildDir(entry.path, root);
3559
+ if (!existsSync8(dir)) {
3560
+ return { label: entry.path, dir, disposition: "skip-missing", argv: [], reason: "directory does not exist" };
3376
3561
  }
3377
3562
  if (committedBindingPath(dir)) {
3378
3563
  return {
3379
- entry,
3564
+ label: entry.path,
3380
3565
  dir,
3381
3566
  disposition: "refresh",
3382
3567
  argv: ["onboard", "--refresh", "--yes"],
@@ -3385,7 +3570,7 @@ function planEntry(entry, root) {
3385
3570
  }
3386
3571
  if (entry.workspaceId) {
3387
3572
  return {
3388
- entry,
3573
+ label: entry.path,
3389
3574
  dir,
3390
3575
  disposition: "bind",
3391
3576
  argv: ["onboard", "--yes", "--local", "--workspace", entry.workspaceId],
@@ -3393,29 +3578,21 @@ function planEntry(entry, root) {
3393
3578
  };
3394
3579
  }
3395
3580
  return {
3396
- entry,
3581
+ label: entry.path,
3397
3582
  dir,
3398
3583
  disposition: "skip-unbound",
3399
3584
  argv: [],
3400
3585
  reason: "unbound + no workspaceId in the manifest \u2014 add one or run `sechroom onboard` there"
3401
3586
  };
3402
3587
  }
3403
- function passthroughGlobals(g) {
3404
- const out = [];
3405
- if (g.baseUrl) out.push("--base-url", g.baseUrl);
3406
- if (g.tenant) out.push("--tenant", g.tenant);
3407
- return out;
3408
- }
3409
- var ICON = {
3410
- refresh: "\u21BB",
3411
- bind: "+",
3412
- "skip-missing": "\u2013",
3413
- "skip-unbound": "\u26A0"
3414
- };
3415
3588
  function registerSweep(program2) {
3416
- program2.command("sweep").description("Orchestration-root fan-out: run `sechroom onboard` in every repo listed in ./.sechroom/repos.json").option("--manifest <path>", "path to the repos manifest", DEFAULT_MANIFEST).option("--dry-run", "print the plan (per-repo disposition + the onboard command) without running anything", false).addHelpText(
3589
+ program2.command("sweep").description("Non-interactive fan-out from ./.sechroom/repos.json (headless sibling of `onboard --recurse`)").option("--manifest <path>", "path to the repos manifest", DEFAULT_MANIFEST).option("--dry-run", "print the plan (per-repo disposition + the onboard command) without running anything", false).addHelpText(
3417
3590
  "after",
3418
3591
  `
3592
+ For an interactive, no-manifest run use ${"`sechroom onboard --recurse`"} instead \u2014 it
3593
+ auto-discovers the child repos and prompts for a workspace per new one. ${"`sweep`"} is
3594
+ the deterministic manifest-driven form for scripts / CI.
3595
+
3419
3596
  Manifest \u2014 ./.sechroom/repos.json (per-operator, gitignored, alongside lane.json):
3420
3597
  {
3421
3598
  "repos": [
@@ -3439,28 +3616,23 @@ Examples:
3439
3616
  const g = cmd.optsWithGlobals();
3440
3617
  const json = Boolean(g.json);
3441
3618
  const dryRun = Boolean(opts.dryRun);
3442
- const manifestPath = resolve(opts.manifest);
3443
- if (!existsSync6(manifestPath)) {
3444
- fail(`no manifest at ${manifestPath} \u2014 create ./.sechroom/repos.json listing the repos under this root (see \`sechroom sweep --help\`).`);
3445
- }
3446
- let manifest;
3619
+ const manifestPath = resolve2(opts.manifest);
3620
+ let repos;
3447
3621
  try {
3448
- manifest = JSON.parse(readFileSync5(manifestPath, "utf8"));
3622
+ repos = readManifest(manifestPath);
3449
3623
  } catch (err2) {
3450
- fail(`couldn't parse ${manifestPath}: ${err2 instanceof Error ? err2.message : String(err2)}`);
3624
+ fail(err2 instanceof Error ? err2.message : String(err2));
3625
+ }
3626
+ if (repos === null) {
3627
+ fail(`no manifest at ${manifestPath} \u2014 create ./.sechroom/repos.json, or use \`sechroom onboard --recurse\` to auto-discover (see \`sechroom sweep --help\`).`);
3451
3628
  }
3452
- const repos = Array.isArray(manifest.repos) ? manifest.repos.filter((r) => r && typeof r.path === "string") : [];
3453
3629
  if (repos.length === 0) {
3454
- if (json) {
3455
- process.stdout.write(JSON.stringify({ manifest: manifestPath, repos: [] }) + "\n");
3456
- } else {
3457
- process.stderr.write(`${warn("\u26A0")} ${manifestPath} lists no repos \u2014 nothing to do.
3630
+ if (json) process.stdout.write(JSON.stringify({ manifest: manifestPath, repos: [] }) + "\n");
3631
+ else process.stderr.write(`${warn("\u26A0")} ${manifestPath} lists no repos \u2014 nothing to do.
3458
3632
  `);
3459
- }
3460
3633
  return;
3461
3634
  }
3462
3635
  const root = dirname6(dirname6(manifestPath));
3463
- const globals = passthroughGlobals(g);
3464
3636
  const plans = repos.map((entry) => planEntry(entry, root));
3465
3637
  if (!json) {
3466
3638
  process.stderr.write(
@@ -3468,70 +3640,24 @@ Examples:
3468
3640
  `
3469
3641
  );
3470
3642
  }
3471
- const results = [];
3472
- for (const plan of plans) {
3473
- const runs = plan.argv.length > 0;
3474
- const argv = runs ? [...globals, ...plan.argv] : [];
3475
- const skipped2 = !runs;
3476
- if (!json) {
3477
- const head = ` ${ICON[plan.disposition]} ${style.cyan(plan.entry.path)} ${style.dim(plan.reason)}`;
3478
- process.stderr.write(head + "\n");
3479
- if (runs && dryRun) process.stderr.write(` ${style.dim(`would run: sechroom ${argv.join(" ")}`)}
3480
- `);
3481
- }
3482
- let exitCode = skipped2 ? null : 0;
3483
- if (runs && !dryRun) {
3484
- const res = spawnSync(process.execPath, [process.argv[1], ...argv], {
3485
- cwd: plan.dir,
3486
- stdio: json ? "ignore" : "inherit"
3487
- });
3488
- exitCode = res.status;
3489
- if (!json) {
3490
- process.stderr.write(
3491
- exitCode === 0 ? ` ${ok("\u2713")} ${style.dim("onboard ok")}
3492
- ` : ` ${warn("\u2717")} ${style.dim(`onboard exited ${exitCode ?? "signal"}`)}
3493
- `
3494
- );
3495
- }
3496
- }
3497
- results.push({
3498
- path: plan.entry.path,
3499
- dir: plan.dir,
3500
- disposition: plan.disposition,
3501
- ran: runs && !dryRun,
3502
- exitCode,
3503
- reason: plan.reason
3504
- });
3505
- }
3643
+ const results = runChildren(plans, { globals: passthroughGlobals(g), dryRun, json });
3506
3644
  if (json) {
3507
3645
  process.stdout.write(JSON.stringify({ manifest: manifestPath, dryRun, repos: results }) + "\n");
3508
3646
  return;
3509
3647
  }
3510
- const ran = results.filter((r) => r.ran);
3511
- const failed = ran.filter((r) => r.exitCode !== 0);
3512
- const skipped = results.filter((r) => r.disposition.startsWith("skip"));
3513
- const wouldRun = results.filter((r) => !r.disposition.startsWith("skip"));
3514
- const tally = (dryRun ? [wouldRun.length ? `${wouldRun.length} would onboard` : null, skipped.length ? `${skipped.length} would skip` : null] : [
3515
- ran.length ? `${ran.length - failed.length}/${ran.length} onboarded` : null,
3516
- skipped.length ? `${skipped.length} skipped` : null,
3517
- failed.length ? `${failed.length} failed` : null
3518
- ]).filter(Boolean).join(", ");
3519
- process.stderr.write(`
3520
- ${failed.length ? warn("\u26A0") : ok("\u2713")} ${tally || "nothing to do"}${dryRun ? style.dim(" (dry run)") : ""}
3521
- `);
3522
- if (failed.length) process.exit(1);
3648
+ summarizeFanout(results, { dryRun });
3523
3649
  });
3524
3650
  }
3525
3651
 
3526
3652
  // src/commands/skills.ts
3527
3653
  import { homedir as homedir6 } from "os";
3528
- import { join as join7 } from "path";
3529
- import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync6, rmSync as rmSync2, existsSync as existsSync7, readFileSync as readFileSync6 } from "fs";
3654
+ import { join as join9 } from "path";
3655
+ import { mkdirSync as mkdirSync6, writeFileSync as writeFileSync6, rmSync as rmSync2, existsSync as existsSync9, readFileSync as readFileSync6 } from "fs";
3530
3656
  var DEFAULT_SLUG = "operator-skills";
3531
3657
  var ROLE_TAGS = ["sechroom:role:skill-template", "role:skill-template"];
3532
3658
  var LOCK = ".sechroom-skills.json";
3533
3659
  function skillsDir(global) {
3534
- return global ? join7(homedir6(), ".claude", "skills") : join7(process.cwd(), ".claude", "skills");
3660
+ return global ? join9(homedir6(), ".claude", "skills") : join9(process.cwd(), ".claude", "skills");
3535
3661
  }
3536
3662
  function tagValue2(tags, prefix) {
3537
3663
  return (tags ?? []).find((t) => t.startsWith(prefix))?.slice(prefix.length);
@@ -3609,13 +3735,13 @@ Examples:
3609
3735
  const name = tagValue2(tags, "skill:");
3610
3736
  if (!name) continue;
3611
3737
  const body = m.text ?? m.Text ?? "";
3612
- mkdirSync6(join7(dir, name), { recursive: true });
3613
- writeFileSync6(join7(dir, name, "SKILL.md"), body.endsWith("\n") ? body : body + "\n");
3738
+ mkdirSync6(join9(dir, name), { recursive: true });
3739
+ writeFileSync6(join9(dir, name, "SKILL.md"), body.endsWith("\n") ? body : body + "\n");
3614
3740
  written.push(name);
3615
3741
  }
3616
3742
  mkdirSync6(dir, { recursive: true });
3617
- const lockPath = join7(dir, LOCK);
3618
- const lock = existsSync7(lockPath) ? JSON.parse(readFileSync6(lockPath, "utf8")) : {};
3743
+ const lockPath = join9(dir, LOCK);
3744
+ const lock = existsSync9(lockPath) ? JSON.parse(readFileSync6(lockPath, "utf8")) : {};
3619
3745
  lock[slug] = { surface: opts.surface, version, instance: wantInstance, skills: written.sort() };
3620
3746
  writeFileSync6(lockPath, JSON.stringify(lock, null, 2) + "\n");
3621
3747
  if (opts.json) return emit({ slug, version, instance: wantInstance, surface: opts.surface, dir, installed: written }, true);
@@ -3639,15 +3765,15 @@ Examples:
3639
3765
  skills.command("clean [slug]").description(`Remove materialised skill files written by install (default ${DEFAULT_SLUG})`).option("--local", "clean ./.claude/skills instead of ~/.claude/skills").option("--json", "machine output").action(async (slugArg, opts) => {
3640
3766
  const slug = slugArg || DEFAULT_SLUG;
3641
3767
  const dir = skillsDir(!opts.local);
3642
- const lockPath = join7(dir, LOCK);
3643
- if (!existsSync7(lockPath)) fail(`No skills lockfile at ${lockPath}; nothing to clean.`);
3768
+ const lockPath = join9(dir, LOCK);
3769
+ if (!existsSync9(lockPath)) fail(`No skills lockfile at ${lockPath}; nothing to clean.`);
3644
3770
  const lock = JSON.parse(readFileSync6(lockPath, "utf8"));
3645
3771
  const entry = lock[slug];
3646
3772
  if (!entry) fail(`No installed record for '${slug}' in ${lockPath}.`);
3647
3773
  const removed = [];
3648
3774
  for (const name of entry.skills) {
3649
- const skillPath = join7(dir, name);
3650
- if (existsSync7(skillPath)) {
3775
+ const skillPath = join9(dir, name);
3776
+ if (existsSync9(skillPath)) {
3651
3777
  rmSync2(skillPath, { recursive: true, force: true });
3652
3778
  removed.push(name);
3653
3779
  }
@@ -3743,21 +3869,21 @@ Examples:
3743
3869
 
3744
3870
  // src/commands/reset.ts
3745
3871
  import { homedir as homedir7 } from "os";
3746
- import { join as join8 } from "path";
3747
- import { existsSync as existsSync8, readFileSync as readFileSync7, rmSync as rmSync3 } from "fs";
3872
+ import { join as join10 } from "path";
3873
+ import { existsSync as existsSync10, readFileSync as readFileSync7, rmSync as rmSync3 } from "fs";
3748
3874
  var SKILLS_LOCK = ".sechroom-skills.json";
3749
- var localSkillsDir = () => join8(process.cwd(), ".claude", "skills");
3750
- var globalSkillsDir = () => join8(homedir7(), ".claude", "skills");
3875
+ var localSkillsDir = () => join10(process.cwd(), ".claude", "skills");
3876
+ var globalSkillsDir = () => join10(homedir7(), ".claude", "skills");
3751
3877
  function removeMaterialisedSkills(dir) {
3752
3878
  const removed = [];
3753
- const lockPath = join8(dir, SKILLS_LOCK);
3754
- if (!existsSync8(lockPath)) return removed;
3879
+ const lockPath = join10(dir, SKILLS_LOCK);
3880
+ if (!existsSync10(lockPath)) return removed;
3755
3881
  try {
3756
3882
  const lock = JSON.parse(readFileSync7(lockPath, "utf8"));
3757
3883
  for (const entry of Object.values(lock)) {
3758
3884
  for (const name of entry.skills ?? []) {
3759
- const p = join8(dir, name);
3760
- if (existsSync8(p)) {
3885
+ const p = join10(dir, name);
3886
+ if (existsSync10(p)) {
3761
3887
  rmSync3(p, { recursive: true, force: true });
3762
3888
  removed.push(p);
3763
3889
  }
@@ -3788,18 +3914,18 @@ function registerReset(program2) {
3788
3914
  }
3789
3915
  }
3790
3916
  const removed = [];
3791
- const stateDir = join8(process.cwd(), ".sechroom");
3792
- if (existsSync8(stateDir)) {
3917
+ const stateDir = join10(process.cwd(), ".sechroom");
3918
+ if (existsSync10(stateDir)) {
3793
3919
  rmSync3(stateDir, { recursive: true, force: true });
3794
3920
  removed.push(stateDir);
3795
3921
  }
3796
- const legacyCfg = join8(process.cwd(), ".sechroom.json");
3797
- if (existsSync8(legacyCfg)) {
3922
+ const legacyCfg = join10(process.cwd(), ".sechroom.json");
3923
+ if (existsSync10(legacyCfg)) {
3798
3924
  rmSync3(legacyCfg, { force: true });
3799
3925
  removed.push(legacyCfg);
3800
3926
  }
3801
- const legacySem = join8(process.cwd(), ".sem");
3802
- if (existsSync8(legacySem)) {
3927
+ const legacySem = join10(process.cwd(), ".sem");
3928
+ if (existsSync10(legacySem)) {
3803
3929
  rmSync3(legacySem, { force: true });
3804
3930
  removed.push(legacySem);
3805
3931
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sechroom/cli",
3
- "version": "2026.6.24",
3
+ "version": "2026.6.25",
4
4
  "description": "Sechroom CLI — a thin, generated client over the Sechroom HTTP API. An agent/human surface alongside MCP.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",