@rafter-security/cli 0.10.6 → 0.11.1

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 (37) hide show
  1. package/dist/commands/agent/exec.js +26 -9
  2. package/dist/commands/agent/init.js +275 -220
  3. package/dist/commands/agent/install-hook.js +17 -6
  4. package/dist/commands/agent/scan.js +265 -70
  5. package/dist/commands/agent/update-skill-scanner.js +1 -1
  6. package/dist/commands/agent/verify.js +39 -15
  7. package/dist/commands/backend/get.js +6 -2
  8. package/dist/commands/backend/scan-status.js +34 -4
  9. package/dist/commands/hook/pretool.js +124 -36
  10. package/dist/commands/mcp/server.js +184 -129
  11. package/dist/commands/report.js +6 -2
  12. package/dist/core/audit-logger.js +47 -17
  13. package/dist/core/config-manager.js +46 -8
  14. package/dist/core/custom-patterns.js +28 -8
  15. package/dist/core/docs-loader.js +33 -3
  16. package/dist/core/pattern-engine.js +23 -5
  17. package/dist/core/policy-loader.js +15 -4
  18. package/dist/core/risk-rules.js +391 -9
  19. package/dist/index.js +6 -0
  20. package/dist/scanners/betterleaks.js +127 -14
  21. package/dist/scanners/git-history-scan.js +75 -0
  22. package/dist/scanners/regex-scanner.js +16 -2
  23. package/dist/scanners/secret-patterns.js +5 -1
  24. package/dist/scanners/union.js +31 -19
  25. package/dist/utils/api.js +35 -1
  26. package/dist/utils/git-diff.js +36 -20
  27. package/dist/utils/skill-manager.js +4 -3
  28. package/package.json +16 -15
  29. package/resources/continue-rules/rafter.md +1 -1
  30. package/resources/cursor-rules/rafter.mdc +1 -1
  31. package/resources/rafter-security-skill.md +3 -1
  32. package/resources/skills/rafter/SKILL.md +1 -2
  33. package/resources/skills/rafter/docs/guardrails.md +1 -1
  34. package/resources/skills/rafter-code-review/SKILL.md +0 -1
  35. package/resources/skills/rafter-secure-design/SKILL.md +0 -1
  36. package/resources/skills/rafter-skill-review/SKILL.md +0 -1
  37. package/resources/windsurf-rules/rafter.md +1 -1
@@ -15,6 +15,24 @@ import { injectInstructionFile } from "./instruction-block.js";
15
15
  import yaml from "js-yaml";
16
16
  const __filename = fileURLToPath(import.meta.url);
17
17
  const __dirname = path.dirname(__filename);
18
+ function createInitOutput(quiet) {
19
+ return {
20
+ info(message) {
21
+ if (quiet)
22
+ return;
23
+ if (message === undefined)
24
+ console.log();
25
+ else
26
+ console.log(message);
27
+ },
28
+ warn(message) {
29
+ if (quiet)
30
+ console.error(message);
31
+ else
32
+ console.log(message);
33
+ },
34
+ };
35
+ }
18
36
  /**
19
37
  * Resolve an ABSOLUTE, self-contained hook command (rf-er8a). Agents run a hook
20
38
  * through `sh -c "<command>"` in a minimal environment that need not have
@@ -90,6 +108,7 @@ const AGENT_SKILLS = [
90
108
  { name: "rafter", description: "Rafter Remote" },
91
109
  { name: "rafter-secure-design", description: "Rafter Secure Design" },
92
110
  { name: "rafter-code-review", description: "Rafter Code Review" },
111
+ { name: "rafter-skill-review", description: "Rafter Skill Review" },
93
112
  ];
94
113
  /**
95
114
  * Print every file path the install would touch — without writing anything.
@@ -113,6 +132,9 @@ function printDryRunPlan(plan) {
113
132
  const R = (p, note) => {
114
133
  console.log(` REMOVE ${p}${note ? ` (${note})` : ""}`);
115
134
  };
135
+ const S = (p, note) => {
136
+ console.log(` SKIP ${p} (${note})`);
137
+ };
116
138
  console.log();
117
139
  console.log(fmt.info("DRY RUN — no files will be created or modified."));
118
140
  console.log(fmt.info(`Scope: ${plan.scope}${plan.scope === "project" ? ` (cwd: ${plan.root})` : ""}`));
@@ -125,7 +147,15 @@ function printDryRunPlan(plan) {
125
147
  if (plan.wantBetterleaks) {
126
148
  console.log();
127
149
  console.log("Betterleaks (--with-betterleaks / --all):");
128
- D(path.join(home, ".rafter", "bin", "betterleaks"), "binary, ~12MB from GitHub releases");
150
+ if (plan.betterleaksExisting) {
151
+ S(plan.betterleaksExisting, "betterleaks already present; no download");
152
+ }
153
+ else if (!plan.betterleaksSupported) {
154
+ S(path.join(home, ".rafter", "bin", "betterleaks"), "no betterleaks build for this platform; pattern-based scanning");
155
+ }
156
+ else {
157
+ D(path.join(home, ".rafter", "bin", "betterleaks"), "binary, ~12MB from GitHub releases");
158
+ }
129
159
  }
130
160
  if (plan.wantSkillScanner) {
131
161
  console.log();
@@ -136,12 +166,20 @@ function printDryRunPlan(plan) {
136
166
  console.log();
137
167
  console.log("Claude Code (--with-claude-code):");
138
168
  W(path.join(plan.root, ".claude", "settings.json"), "PreToolUse + PostToolUse hooks merged");
139
- for (const s of ["rafter", "rafter-secure-design", "rafter-code-review", "rafter-skill-review"]) {
140
- W(path.join(plan.root, ".claude", "skills", s, "SKILL.md"));
169
+ for (const s of AGENT_SKILLS) {
170
+ W(path.join(plan.root, ".claude", "skills", s.name, "SKILL.md"));
141
171
  }
142
172
  W(path.join(plan.root, ".claude", "agents", "rafter.md"), "sub-agent");
143
173
  W(path.join(plan.root, ".claude", "CLAUDE.md"), "rafter:start/end marker block");
144
- W(path.join(plan.root, ".mcp.json"), "project-scope MCP config");
174
+ // .mcp.json is a project-scope file; the user-scope install never writes it.
175
+ if (plan.scope === "project") {
176
+ if (plan.claudeCodeMcpDisabled) {
177
+ S(path.join(plan.root, ".mcp.json"), "claude-code.mcp disabled");
178
+ }
179
+ else {
180
+ W(path.join(plan.root, ".mcp.json"), "project-scope MCP config");
181
+ }
182
+ }
145
183
  }
146
184
  if (plan.wantCodex) {
147
185
  console.log();
@@ -242,16 +280,16 @@ function printDryRunPlan(plan) {
242
280
  * Windsurf, Continue.dev, and Aider are project-only and handled by
243
281
  * `rafter agent init-project`.
244
282
  */
245
- function installGlobalInstructions(platforms, root, scope) {
283
+ function installGlobalInstructions(platforms, root, scope, out) {
246
284
  // Claude Code — <root>/.claude/CLAUDE.md
247
285
  if (platforms.claudeCode) {
248
286
  try {
249
287
  const filePath = path.join(root, ".claude", "CLAUDE.md");
250
288
  injectInstructionFile(filePath);
251
- console.log(fmt.success(`Installed Rafter instructions to ${filePath}`));
289
+ out.info(fmt.success(`Installed Rafter instructions to ${filePath}`));
252
290
  }
253
291
  catch (e) {
254
- console.log(fmt.warning(`Failed to write Claude Code instructions: ${e}`));
292
+ out.warn(fmt.warning(`Failed to write Claude Code instructions: ${e}`));
255
293
  }
256
294
  }
257
295
  // AGENTS.md — read natively by Codex AND Windsurf. Codex at user scope keeps
@@ -267,10 +305,10 @@ function installGlobalInstructions(platforms, root, scope) {
267
305
  const readers = [platforms.codex && "Codex", platforms.windsurf && "Windsurf"]
268
306
  .filter(Boolean)
269
307
  .join(" + ");
270
- console.log(fmt.success(`Installed Rafter instructions for ${readers} to ${filePath}`));
308
+ out.info(fmt.success(`Installed Rafter instructions for ${readers} to ${filePath}`));
271
309
  }
272
310
  catch (e) {
273
- console.log(fmt.warning(`Failed to write AGENTS.md: ${e}`));
311
+ out.warn(fmt.warning(`Failed to write AGENTS.md: ${e}`));
274
312
  }
275
313
  }
276
314
  // Gemini — ~/.gemini/GEMINI.md (user) or <cwd>/GEMINI.md (project)
@@ -280,10 +318,10 @@ function installGlobalInstructions(platforms, root, scope) {
280
318
  ? path.join(root, ".gemini", "GEMINI.md")
281
319
  : path.join(root, "GEMINI.md");
282
320
  injectInstructionFile(filePath);
283
- console.log(fmt.success(`Installed Rafter instructions to ${filePath}`));
321
+ out.info(fmt.success(`Installed Rafter instructions to ${filePath}`));
284
322
  }
285
323
  catch (e) {
286
- console.log(fmt.warning(`Failed to write Gemini instructions: ${e}`));
324
+ out.warn(fmt.warning(`Failed to write Gemini instructions: ${e}`));
287
325
  }
288
326
  }
289
327
  // Cursor uses per-skill rules at <root>/.cursor/rules/<skill>.mdc and the
@@ -291,7 +329,7 @@ function installGlobalInstructions(platforms, root, scope) {
291
329
  // Cursor branch above). The consolidated rafter-security.mdc was retired
292
330
  // in rf-svn3 in favor of per-skill rules with trigger-first descriptions.
293
331
  }
294
- function installClaudeCodeHooks(root) {
332
+ function installClaudeCodeHooks(root, out) {
295
333
  const settingsPath = path.join(root, ".claude", "settings.json");
296
334
  const claudeDir = path.join(root, ".claude");
297
335
  if (!fs.existsSync(claudeDir)) {
@@ -305,7 +343,7 @@ function installClaudeCodeHooks(root) {
305
343
  }
306
344
  catch {
307
345
  // Corrupted file — start fresh but warn
308
- console.log(fmt.warning("Existing settings.json was unreadable, creating new one"));
346
+ out.warn(fmt.warning("Existing settings.json was unreadable, creating new one"));
309
347
  }
310
348
  }
311
349
  // Merge hooks — don't overwrite existing non-Rafter hooks
@@ -342,10 +380,10 @@ function installClaudeCodeHooks(root) {
342
380
  // added latency to operations that never produce secrets to redact.
343
381
  settings.hooks.PostToolUse.push({ matcher: "Bash|Write|Edit|MultiEdit", hooks: [postHook] });
344
382
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
345
- console.log(fmt.success(`Installed PreToolUse hooks to ${settingsPath}`));
346
- console.log(fmt.success(`Installed PostToolUse hooks to ${settingsPath}`));
383
+ out.info(fmt.success(`Installed PreToolUse hooks to ${settingsPath}`));
384
+ out.info(fmt.success(`Installed PostToolUse hooks to ${settingsPath}`));
347
385
  }
348
- function installCodexHooks(root) {
386
+ function installCodexHooks(root, out) {
349
387
  const codexDir = path.join(root, ".codex");
350
388
  if (!fs.existsSync(codexDir)) {
351
389
  fs.mkdirSync(codexDir, { recursive: true });
@@ -357,7 +395,7 @@ function installCodexHooks(root) {
357
395
  config = JSON.parse(fs.readFileSync(hooksPath, "utf-8"));
358
396
  }
359
397
  catch {
360
- console.log(fmt.warning("Existing Codex hooks.json was unreadable, creating new one"));
398
+ out.warn(fmt.warning("Existing Codex hooks.json was unreadable, creating new one"));
361
399
  }
362
400
  }
363
401
  if (!config.hooks)
@@ -383,7 +421,7 @@ function installCodexHooks(root) {
383
421
  // (log noise + latency), matching the claude-code posttool scoping (sable-h0ah).
384
422
  config.hooks.PostToolUse.push({ matcher: "Bash|apply_patch", hooks: [postHook] });
385
423
  fs.writeFileSync(hooksPath, JSON.stringify(config, null, 2), "utf-8");
386
- console.log(fmt.success(`Installed hooks to ${hooksPath}`));
424
+ out.info(fmt.success(`Installed hooks to ${hooksPath}`));
387
425
  }
388
426
  /**
389
427
  * Install Cursor hooks at <root>/.cursor/hooks.json.
@@ -397,7 +435,7 @@ function installCodexHooks(root) {
397
435
  * Idempotent — repeated installs do not duplicate rafter entries.
398
436
  * Non-rafter entries (other tools' hooks, unrelated events) are preserved.
399
437
  */
400
- function installCursorHooks(root) {
438
+ function installCursorHooks(root, out) {
401
439
  const cursorDir = path.join(root, ".cursor");
402
440
  if (!fs.existsSync(cursorDir)) {
403
441
  fs.mkdirSync(cursorDir, { recursive: true });
@@ -409,7 +447,7 @@ function installCursorHooks(root) {
409
447
  config = JSON.parse(fs.readFileSync(hooksPath, "utf-8"));
410
448
  }
411
449
  catch {
412
- console.log(fmt.warning("Existing Cursor hooks.json was unreadable, creating new one"));
450
+ out.warn(fmt.warning("Existing Cursor hooks.json was unreadable, creating new one"));
413
451
  }
414
452
  }
415
453
  if (!config.version)
@@ -428,7 +466,7 @@ function installCursorHooks(root) {
428
466
  config.hooks[event].push({ command, type: "command", timeout: 5000 });
429
467
  }
430
468
  fs.writeFileSync(hooksPath, JSON.stringify(config, null, 2), "utf-8");
431
- console.log(fmt.success(`Installed hooks to ${hooksPath}`));
469
+ out.info(fmt.success(`Installed hooks to ${hooksPath}`));
432
470
  }
433
471
  /** Skills shipped as both Cursor rules and (Claude Code / Codex / Gemini) skills. */
434
472
  const CURSOR_RULE_SKILLS = [
@@ -447,7 +485,7 @@ const CURSOR_RULE_SKILLS = [
447
485
  * Replaces the legacy consolidated `.cursor/rules/rafter-security.mdc` — that
448
486
  * single file is no longer written by the Cursor install path.
449
487
  */
450
- function installCursorRules(root) {
488
+ function installCursorRules(root, out) {
451
489
  const rulesDir = path.join(root, ".cursor", "rules");
452
490
  fs.mkdirSync(rulesDir, { recursive: true });
453
491
  // Resolve resources/cursor-rules relative to this module.
@@ -458,18 +496,18 @@ function installCursorRules(root) {
458
496
  ];
459
497
  const sourceDir = candidates.find((p) => fs.existsSync(p));
460
498
  if (!sourceDir) {
461
- console.log(fmt.warning(`Cursor rule templates not found in resources/cursor-rules`));
499
+ out.warn(fmt.warning(`Cursor rule templates not found in resources/cursor-rules`));
462
500
  return;
463
501
  }
464
502
  for (const name of CURSOR_RULE_SKILLS) {
465
503
  const src = path.join(sourceDir, `${name}.mdc`);
466
504
  const dest = path.join(rulesDir, `${name}.mdc`);
467
505
  if (!fs.existsSync(src)) {
468
- console.log(fmt.warning(`Cursor rule template missing: ${src}`));
506
+ out.warn(fmt.warning(`Cursor rule template missing: ${src}`));
469
507
  continue;
470
508
  }
471
509
  fs.copyFileSync(src, dest);
472
- console.log(fmt.success(`Installed Cursor rule to ${dest}`));
510
+ out.info(fmt.success(`Installed Cursor rule to ${dest}`));
473
511
  }
474
512
  // Remove the legacy consolidated rule if present, so reinstall on top of
475
513
  // an old layout migrates cleanly.
@@ -477,7 +515,7 @@ function installCursorRules(root) {
477
515
  if (fs.existsSync(legacy)) {
478
516
  try {
479
517
  fs.unlinkSync(legacy);
480
- console.log(fmt.info(`Removed legacy ${legacy} (superseded by per-skill rules)`));
518
+ out.info(fmt.info(`Removed legacy ${legacy} (superseded by per-skill rules)`));
481
519
  }
482
520
  catch {
483
521
  /* best-effort */
@@ -493,7 +531,7 @@ function installCursorRules(root) {
493
531
  * apply, since Cursor relies on prompt-level constraints rather than
494
532
  * structural restriction.
495
533
  */
496
- function installCursorSubAgents(root) {
534
+ function installCursorSubAgents(root, out) {
497
535
  const agentsDir = path.join(root, ".cursor", "agents");
498
536
  fs.mkdirSync(agentsDir, { recursive: true });
499
537
  const candidates = [
@@ -502,14 +540,14 @@ function installCursorSubAgents(root) {
502
540
  ];
503
541
  const src = candidates.find((p) => fs.existsSync(p));
504
542
  if (!src) {
505
- console.log(fmt.warning(`Rafter sub-agent template not found in resources/agents`));
543
+ out.warn(fmt.warning(`Rafter sub-agent template not found in resources/agents`));
506
544
  return;
507
545
  }
508
546
  const raw = fs.readFileSync(src, "utf-8");
509
547
  const cursored = stripToolsFromFrontmatter(raw);
510
548
  const dest = path.join(agentsDir, "rafter.md");
511
549
  fs.writeFileSync(dest, cursored, "utf-8");
512
- console.log(fmt.success(`Installed Cursor sub-agent to ${dest}`));
550
+ out.info(fmt.success(`Installed Cursor sub-agent to ${dest}`));
513
551
  }
514
552
  /** Strip the Claude-Code `tools:` line from sub-agent frontmatter — Cursor doesn't have it. */
515
553
  function stripToolsFromFrontmatter(content) {
@@ -526,7 +564,7 @@ function stripToolsFromFrontmatter(content) {
526
564
  .join("\n");
527
565
  return `---\n${cleaned}${body}`;
528
566
  }
529
- function installGeminiHooks(root) {
567
+ function installGeminiHooks(root, out) {
530
568
  const geminiDir = path.join(root, ".gemini");
531
569
  if (!fs.existsSync(geminiDir)) {
532
570
  fs.mkdirSync(geminiDir, { recursive: true });
@@ -538,7 +576,7 @@ function installGeminiHooks(root) {
538
576
  settings = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
539
577
  }
540
578
  catch {
541
- console.log(fmt.warning("Existing Gemini settings.json was unreadable, creating new one"));
579
+ out.warn(fmt.warning("Existing Gemini settings.json was unreadable, creating new one"));
542
580
  }
543
581
  }
544
582
  if (!settings.hooks)
@@ -563,7 +601,7 @@ function installGeminiHooks(root) {
563
601
  hooks: [{ type: "command", command: absoluteHookCommand("posttool --format gemini"), timeout: 5000 }],
564
602
  });
565
603
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
566
- console.log(fmt.success(`Installed hooks to ${settingsPath}`));
604
+ out.info(fmt.success(`Installed hooks to ${settingsPath}`));
567
605
  }
568
606
  /** Skills shipped as Windsurf per-workspace rules at .windsurf/rules/<skill>.md (rf-0vr3). */
569
607
  const WINDSURF_RULE_SKILLS = [
@@ -584,7 +622,7 @@ const WINDSURF_RULE_SKILLS = [
584
622
  * no-op — Windsurf has no documented hook surface as of v1.x (research bead
585
623
  * rf-s1n3, gap reports rf-p1ri / rf-vayl).
586
624
  */
587
- function installWindsurfRules(root) {
625
+ function installWindsurfRules(root, out) {
588
626
  const rulesDir = path.join(root, ".windsurf", "rules");
589
627
  fs.mkdirSync(rulesDir, { recursive: true });
590
628
  const candidates = [
@@ -593,18 +631,18 @@ function installWindsurfRules(root) {
593
631
  ];
594
632
  const sourceDir = candidates.find((p) => fs.existsSync(p));
595
633
  if (!sourceDir) {
596
- console.log(fmt.warning(`Windsurf rule templates not found in resources/windsurf-rules`));
634
+ out.warn(fmt.warning(`Windsurf rule templates not found in resources/windsurf-rules`));
597
635
  return;
598
636
  }
599
637
  for (const name of WINDSURF_RULE_SKILLS) {
600
638
  const src = path.join(sourceDir, `${name}.md`);
601
639
  const dest = path.join(rulesDir, `${name}.md`);
602
640
  if (!fs.existsSync(src)) {
603
- console.log(fmt.warning(`Windsurf rule template missing: ${src}`));
641
+ out.warn(fmt.warning(`Windsurf rule template missing: ${src}`));
604
642
  continue;
605
643
  }
606
644
  fs.copyFileSync(src, dest);
607
- console.log(fmt.success(`Installed Windsurf rule to ${dest}`));
645
+ out.info(fmt.success(`Installed Windsurf rule to ${dest}`));
608
646
  }
609
647
  }
610
648
  /** MCP server entry for rafter — shared across MCP-native clients */
@@ -616,7 +654,7 @@ const RAFTER_MCP_ENTRY = {
616
654
  * Install MCP server config for Claude Code (<root>/.mcp.json).
617
655
  * Project-scope MCP config that Claude Code auto-loads on startup.
618
656
  */
619
- function installClaudeCodeMcp(root) {
657
+ function installClaudeCodeMcp(root, out) {
620
658
  const mcpPath = path.join(root, ".mcp.json");
621
659
  let config = {};
622
660
  if (fs.existsSync(mcpPath)) {
@@ -624,20 +662,20 @@ function installClaudeCodeMcp(root) {
624
662
  config = JSON.parse(fs.readFileSync(mcpPath, "utf-8"));
625
663
  }
626
664
  catch {
627
- console.log(fmt.warning("Existing .mcp.json was unreadable, creating new one"));
665
+ out.warn(fmt.warning("Existing .mcp.json was unreadable, creating new one"));
628
666
  }
629
667
  }
630
668
  if (!config.mcpServers)
631
669
  config.mcpServers = {};
632
670
  config.mcpServers.rafter = { ...RAFTER_MCP_ENTRY };
633
671
  fs.writeFileSync(mcpPath, JSON.stringify(config, null, 2), "utf-8");
634
- console.log(fmt.success(`Installed Rafter MCP server to ${mcpPath}`));
672
+ out.info(fmt.success(`Installed Rafter MCP server to ${mcpPath}`));
635
673
  return true;
636
674
  }
637
675
  /**
638
676
  * Install MCP server config for Gemini CLI (~/.gemini/settings.json)
639
677
  */
640
- function installGeminiMcp(root) {
678
+ function installGeminiMcp(root, out) {
641
679
  const geminiDir = path.join(root, ".gemini");
642
680
  const settingsPath = path.join(geminiDir, "settings.json");
643
681
  if (!fs.existsSync(geminiDir)) {
@@ -649,20 +687,20 @@ function installGeminiMcp(root) {
649
687
  settings = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
650
688
  }
651
689
  catch {
652
- console.log(fmt.warning("Existing Gemini settings.json was unreadable, creating new one"));
690
+ out.warn(fmt.warning("Existing Gemini settings.json was unreadable, creating new one"));
653
691
  }
654
692
  }
655
693
  if (!settings.mcpServers)
656
694
  settings.mcpServers = {};
657
695
  settings.mcpServers.rafter = { ...RAFTER_MCP_ENTRY };
658
696
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), "utf-8");
659
- console.log(fmt.success(`Installed Rafter MCP server to ${settingsPath}`));
697
+ out.info(fmt.success(`Installed Rafter MCP server to ${settingsPath}`));
660
698
  return true;
661
699
  }
662
700
  /**
663
701
  * Install MCP server config for Cursor (~/.cursor/mcp.json)
664
702
  */
665
- function installCursorMcp(root) {
703
+ function installCursorMcp(root, out) {
666
704
  const cursorDir = path.join(root, ".cursor");
667
705
  const mcpPath = path.join(cursorDir, "mcp.json");
668
706
  if (!fs.existsSync(cursorDir)) {
@@ -674,20 +712,20 @@ function installCursorMcp(root) {
674
712
  config = JSON.parse(fs.readFileSync(mcpPath, "utf-8"));
675
713
  }
676
714
  catch {
677
- console.log(fmt.warning("Existing Cursor mcp.json was unreadable, creating new one"));
715
+ out.warn(fmt.warning("Existing Cursor mcp.json was unreadable, creating new one"));
678
716
  }
679
717
  }
680
718
  if (!config.mcpServers)
681
719
  config.mcpServers = {};
682
720
  config.mcpServers.rafter = { ...RAFTER_MCP_ENTRY };
683
721
  fs.writeFileSync(mcpPath, JSON.stringify(config, null, 2), "utf-8");
684
- console.log(fmt.success(`Installed Rafter MCP server to ${mcpPath}`));
722
+ out.info(fmt.success(`Installed Rafter MCP server to ${mcpPath}`));
685
723
  return true;
686
724
  }
687
725
  /**
688
726
  * Install MCP server config for Windsurf (~/.codeium/windsurf/mcp_config.json)
689
727
  */
690
- function installWindsurfMcp(root) {
728
+ function installWindsurfMcp(root, out) {
691
729
  const windsurfDir = path.join(root, ".codeium", "windsurf");
692
730
  const mcpPath = path.join(windsurfDir, "mcp_config.json");
693
731
  if (!fs.existsSync(windsurfDir)) {
@@ -699,14 +737,14 @@ function installWindsurfMcp(root) {
699
737
  config = JSON.parse(fs.readFileSync(mcpPath, "utf-8"));
700
738
  }
701
739
  catch {
702
- console.log(fmt.warning("Existing Windsurf mcp_config.json was unreadable, creating new one"));
740
+ out.warn(fmt.warning("Existing Windsurf mcp_config.json was unreadable, creating new one"));
703
741
  }
704
742
  }
705
743
  if (!config.mcpServers)
706
744
  config.mcpServers = {};
707
745
  config.mcpServers.rafter = { ...RAFTER_MCP_ENTRY };
708
746
  fs.writeFileSync(mcpPath, JSON.stringify(config, null, 2), "utf-8");
709
- console.log(fmt.success(`Installed Rafter MCP server to ${mcpPath}`));
747
+ out.info(fmt.success(`Installed Rafter MCP server to ${mcpPath}`));
710
748
  return true;
711
749
  }
712
750
  /** Skills shipped as Continue.dev rules at .continue/rules/<skill>.md (rf-acz0). */
@@ -726,7 +764,7 @@ const CONTINUE_RULE_SKILLS = [
726
764
  * Continue.dev has no documented hook surface (the prior hooks install was
727
765
  * pruned in rf-cia phase b). Rules + MCP are the only intercepts.
728
766
  */
729
- function installContinueDevRules(root) {
767
+ function installContinueDevRules(root, out) {
730
768
  const rulesDir = path.join(root, ".continue", "rules");
731
769
  fs.mkdirSync(rulesDir, { recursive: true });
732
770
  const candidates = [
@@ -735,24 +773,24 @@ function installContinueDevRules(root) {
735
773
  ];
736
774
  const sourceDir = candidates.find((p) => fs.existsSync(p));
737
775
  if (!sourceDir) {
738
- console.log(fmt.warning(`Continue.dev rule templates not found in resources/continue-rules`));
776
+ out.warn(fmt.warning(`Continue.dev rule templates not found in resources/continue-rules`));
739
777
  return;
740
778
  }
741
779
  for (const name of CONTINUE_RULE_SKILLS) {
742
780
  const src = path.join(sourceDir, `${name}.md`);
743
781
  const dest = path.join(rulesDir, `${name}.md`);
744
782
  if (!fs.existsSync(src)) {
745
- console.log(fmt.warning(`Continue.dev rule template missing: ${src}`));
783
+ out.warn(fmt.warning(`Continue.dev rule template missing: ${src}`));
746
784
  continue;
747
785
  }
748
786
  fs.copyFileSync(src, dest);
749
- console.log(fmt.success(`Installed Continue.dev rule to ${dest}`));
787
+ out.info(fmt.success(`Installed Continue.dev rule to ${dest}`));
750
788
  }
751
789
  }
752
790
  /**
753
791
  * Install MCP server config for Continue.dev (~/.continue/config.json)
754
792
  */
755
- function installContinueDevMcp(root) {
793
+ function installContinueDevMcp(root, out) {
756
794
  const continueDir = path.join(root, ".continue");
757
795
  const configPath = path.join(continueDir, "config.json");
758
796
  if (!fs.existsSync(continueDir)) {
@@ -764,7 +802,7 @@ function installContinueDevMcp(root) {
764
802
  config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
765
803
  }
766
804
  catch {
767
- console.log(fmt.warning("Existing Continue.dev config.json was unreadable, creating new one"));
805
+ out.warn(fmt.warning("Existing Continue.dev config.json was unreadable, creating new one"));
768
806
  }
769
807
  }
770
808
  if (!config.mcpServers)
@@ -783,7 +821,7 @@ function installContinueDevMcp(root) {
783
821
  config.mcpServers.rafter = { ...RAFTER_MCP_ENTRY };
784
822
  }
785
823
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
786
- console.log(fmt.success(`Installed Rafter MCP server to ${configPath}`));
824
+ out.info(fmt.success(`Installed Rafter MCP server to ${configPath}`));
787
825
  return true;
788
826
  }
789
827
  /**
@@ -815,7 +853,7 @@ function installContinueDevMcp(root) {
815
853
  * pending confirmation Hermes exposes a hook surface — landing MCP-only as
816
854
  * v0 mirrors how Gemini and Continue.dev were initially shipped.
817
855
  */
818
- function installHermesMcp(root) {
856
+ function installHermesMcp(root, out) {
819
857
  const hermesDir = path.join(root, ".hermes");
820
858
  const configPath = path.join(hermesDir, "config.yaml");
821
859
  if (!fs.existsSync(hermesDir)) {
@@ -831,7 +869,7 @@ function installHermesMcp(root) {
831
869
  }
832
870
  }
833
871
  catch {
834
- console.log(fmt.warning(`Existing Hermes config.yaml was not valid YAML, creating new one`));
872
+ out.warn(fmt.warning(`Existing Hermes config.yaml was not valid YAML, creating new one`));
835
873
  }
836
874
  }
837
875
  if (!config.mcp_servers || typeof config.mcp_servers !== "object" || Array.isArray(config.mcp_servers)) {
@@ -839,7 +877,7 @@ function installHermesMcp(root) {
839
877
  }
840
878
  config.mcp_servers.rafter = { ...RAFTER_MCP_ENTRY };
841
879
  fs.writeFileSync(configPath, yaml.dump(config), "utf-8");
842
- console.log(fmt.success(`Installed Rafter MCP server to ${configPath}`));
880
+ out.info(fmt.success(`Installed Rafter MCP server to ${configPath}`));
843
881
  return true;
844
882
  }
845
883
  /**
@@ -862,7 +900,7 @@ const RAFTER_OPENCODE_MCP_ENTRY = {
862
900
  * pointer is seeded on first write so editors get completion. Any existing
863
901
  * keys / other MCP servers are preserved.
864
902
  */
865
- function installOpenCodeMcp(root) {
903
+ function installOpenCodeMcp(root, out) {
866
904
  const openCodeDir = path.join(root, ".config", "opencode");
867
905
  const configPath = path.join(openCodeDir, "opencode.json");
868
906
  if (!fs.existsSync(openCodeDir)) {
@@ -879,11 +917,11 @@ function installOpenCodeMcp(root) {
879
917
  config = parsed;
880
918
  }
881
919
  else {
882
- console.log(fmt.warning("Existing OpenCode opencode.json was not a JSON object, creating new one"));
920
+ out.warn(fmt.warning("Existing OpenCode opencode.json was not a JSON object, creating new one"));
883
921
  }
884
922
  }
885
923
  catch {
886
- console.log(fmt.warning("Existing OpenCode opencode.json was unreadable, creating new one"));
924
+ out.warn(fmt.warning("Existing OpenCode opencode.json was unreadable, creating new one"));
887
925
  }
888
926
  }
889
927
  if (!config.$schema)
@@ -893,10 +931,10 @@ function installOpenCodeMcp(root) {
893
931
  }
894
932
  config.mcp.rafter = { ...RAFTER_OPENCODE_MCP_ENTRY };
895
933
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
896
- console.log(fmt.success(`Installed Rafter MCP server to ${configPath}`));
934
+ out.info(fmt.success(`Installed Rafter MCP server to ${configPath}`));
897
935
  return true;
898
936
  }
899
- function installAiderRead(root) {
937
+ function installAiderRead(root, out) {
900
938
  const rafterMdPath = path.join(root, "RAFTER.md");
901
939
  const configPath = path.join(root, ".aider.conf.yml");
902
940
  const RAFTER_READ_ENTRY = "RAFTER.md";
@@ -921,7 +959,7 @@ function installAiderRead(root) {
921
959
  }
922
960
  }
923
961
  catch {
924
- console.log(fmt.warning(`Existing ${configPath} was not valid YAML — preserving raw content and appending read: entry`));
962
+ out.warn(fmt.warning(`Existing ${configPath} was not valid YAML — preserving raw content and appending read: entry`));
925
963
  // Append the read: line at the bottom rather than rewriting an
926
964
  // unparseable file. We still need to make sure RAFTER.md ends up in it.
927
965
  if (!new RegExp(`^read:\\s*\\[?[^\\n]*\\b${RAFTER_READ_ENTRY}\\b`, "m").test(raw)) {
@@ -929,7 +967,7 @@ function installAiderRead(root) {
929
967
  raw = `${raw}${sep}read:\n - ${RAFTER_READ_ENTRY}\n`;
930
968
  fs.writeFileSync(configPath, raw, "utf-8");
931
969
  }
932
- console.log(fmt.success(`Installed Rafter read-only context to ${configPath}`));
970
+ out.info(fmt.success(`Installed Rafter read-only context to ${configPath}`));
933
971
  return true;
934
972
  }
935
973
  }
@@ -946,33 +984,33 @@ function installAiderRead(root) {
946
984
  }
947
985
  parsed.read = reads;
948
986
  fs.writeFileSync(configPath, yaml.dump(parsed), "utf-8");
949
- console.log(fmt.success(`Installed Rafter read-only context to ${rafterMdPath} + ${configPath}`));
987
+ out.info(fmt.success(`Installed Rafter read-only context to ${rafterMdPath} + ${configPath}`));
950
988
  return true;
951
989
  }
952
990
  // Copies an entire skill source directory (SKILL.md + any subfolders like docs/)
953
991
  // into the destination. Without this, `docs/` reference material referenced from
954
992
  // SKILL.md would never reach users — only SKILL.md would.
955
- function installSkillDir(sourceSkillDir, destSkillDir, label) {
993
+ function installSkillDir(sourceSkillDir, destSkillDir, label, out) {
956
994
  const sourceSkillFile = path.join(sourceSkillDir, "SKILL.md");
957
995
  if (!fs.existsSync(sourceSkillFile)) {
958
- console.log(fmt.warning(`${label} skill template not found at ${sourceSkillFile}`));
996
+ out.warn(fmt.warning(`${label} skill template not found at ${sourceSkillFile}`));
959
997
  return;
960
998
  }
961
999
  fs.mkdirSync(destSkillDir, { recursive: true });
962
1000
  fs.cpSync(sourceSkillDir, destSkillDir, { recursive: true });
963
- console.log(fmt.success(`Installed ${label} skill to ${destSkillDir}`));
1001
+ out.info(fmt.success(`Installed ${label} skill to ${destSkillDir}`));
964
1002
  }
965
1003
  function skillResourceDir(name) {
966
1004
  return path.join(__dirname, "..", "..", "..", "resources", "skills", name);
967
1005
  }
968
- function installSkillsTo(skillsDir) {
1006
+ function installSkillsTo(skillsDir, out) {
969
1007
  fs.mkdirSync(skillsDir, { recursive: true });
970
1008
  for (const skill of AGENT_SKILLS) {
971
- installSkillDir(skillResourceDir(skill.name), path.join(skillsDir, skill.name), skill.description);
1009
+ installSkillDir(skillResourceDir(skill.name), path.join(skillsDir, skill.name), skill.description, out);
972
1010
  }
973
1011
  }
974
- async function installClaudeCodeSkills(root) {
975
- installSkillsTo(path.join(root, ".claude", "skills"));
1012
+ async function installClaudeCodeSkills(root, out) {
1013
+ installSkillsTo(path.join(root, ".claude", "skills"), out);
976
1014
  }
977
1015
  /**
978
1016
  * Sub-agents shipped by `rafter agent init --with-claude-code`.
@@ -987,7 +1025,7 @@ async function installClaudeCodeSkills(root) {
987
1025
  const CLAUDE_CODE_SUBAGENTS = [
988
1026
  { name: "rafter", description: "Rafter Security" },
989
1027
  ];
990
- function installClaudeCodeSubAgents(root) {
1028
+ function installClaudeCodeSubAgents(root, out) {
991
1029
  const agentsDir = path.join(root, ".claude", "agents");
992
1030
  if (!fs.existsSync(agentsDir)) {
993
1031
  fs.mkdirSync(agentsDir, { recursive: true });
@@ -997,18 +1035,18 @@ function installClaudeCodeSubAgents(root) {
997
1035
  const srcPath = path.join(__dirname, "..", "..", "..", "resources", "agents", `${sub.name}.md`);
998
1036
  if (fs.existsSync(srcPath)) {
999
1037
  fs.copyFileSync(srcPath, destPath);
1000
- console.log(fmt.success(`Installed ${sub.description} sub-agent to ${destPath}`));
1038
+ out.info(fmt.success(`Installed ${sub.description} sub-agent to ${destPath}`));
1001
1039
  }
1002
1040
  else {
1003
- console.log(fmt.warning(`${sub.description} sub-agent template not found at ${srcPath}`));
1041
+ out.warn(fmt.warning(`${sub.description} sub-agent template not found at ${srcPath}`));
1004
1042
  }
1005
1043
  }
1006
1044
  }
1007
- function installCodexSkills(root) {
1008
- installSkillsTo(path.join(root, ".agents", "skills"));
1045
+ function installCodexSkills(root, out) {
1046
+ installSkillsTo(path.join(root, ".agents", "skills"), out);
1009
1047
  }
1010
- function installGeminiSkills(root) {
1011
- installSkillsTo(path.join(root, ".agents", "skills"));
1048
+ function installGeminiSkills(root, out) {
1049
+ installSkillsTo(path.join(root, ".agents", "skills"), out);
1012
1050
  }
1013
1051
  /**
1014
1052
  * Register installed skills with Gemini CLI via `gemini skills link <abs-path>`.
@@ -1017,13 +1055,13 @@ function installGeminiSkills(root) {
1017
1055
  * Missing CLI, missing subcommand, and per-skill registration failures are
1018
1056
  * non-fatal: we warn and continue so the on-disk install still succeeds.
1019
1057
  */
1020
- function registerGeminiSkills(skillsDir) {
1058
+ function registerGeminiSkills(skillsDir, out) {
1021
1059
  // Probe for the `gemini` binary. Absence is expected on CI / fresh machines.
1022
1060
  try {
1023
1061
  execSync("gemini --version", { stdio: ["ignore", "pipe", "ignore"], timeout: 5000 });
1024
1062
  }
1025
1063
  catch {
1026
- console.log(fmt.warning("gemini CLI not found on PATH — skipping skill registration. " +
1064
+ out.warn(fmt.warning("gemini CLI not found on PATH — skipping skill registration. " +
1027
1065
  "Skills are installed to disk; re-run after installing gemini ≥ 0.35."));
1028
1066
  return;
1029
1067
  }
@@ -1032,7 +1070,7 @@ function registerGeminiSkills(skillsDir) {
1032
1070
  execSync("gemini skills --help", { stdio: ["ignore", "pipe", "ignore"], timeout: 5000 });
1033
1071
  }
1034
1072
  catch {
1035
- console.log(fmt.warning("gemini CLI does not support `skills` subcommand (needs ≥ 0.35). " +
1073
+ out.warn(fmt.warning("gemini CLI does not support `skills` subcommand (needs ≥ 0.35). " +
1036
1074
  "Skipping registration — skills are still installed to disk."));
1037
1075
  return;
1038
1076
  }
@@ -1051,11 +1089,11 @@ function registerGeminiSkills(skillsDir) {
1051
1089
  else {
1052
1090
  execFileSync("gemini", ["skills", "link", absPath], execOpts);
1053
1091
  }
1054
- console.log(fmt.success(`Registered ${skill.name} with Gemini CLI`));
1092
+ out.info(fmt.success(`Registered ${skill.name} with Gemini CLI`));
1055
1093
  }
1056
1094
  catch (e) {
1057
1095
  const msg = (e?.stderr?.toString?.() || e?.message || "").trim();
1058
- console.log(fmt.warning(`Failed to register ${skill.name} with Gemini CLI: ${msg.split("\n")[0] || "unknown error"}`));
1096
+ out.warn(fmt.warning(`Failed to register ${skill.name} with Gemini CLI: ${msg.split("\n")[0] || "unknown error"}`));
1059
1097
  }
1060
1098
  }
1061
1099
  }
@@ -1074,22 +1112,24 @@ export function createInitCommand() {
1074
1112
  .option("--with-hermes", "Install Hermes integration")
1075
1113
  .option("--with-opencode", "Install OpenCode integration")
1076
1114
  .option("--with-betterleaks", "Download and install Betterleaks binary")
1077
- .option("--with-skill-scanner", "Install the optional skill-scanner deep engine (heavy; audit-skill --deep)")
1115
+ .option("--with-skill-scanner", "Install the optional skill-scanner deep engine (heavy; skill review --deep)")
1078
1116
  .option("--all", "Install all detected integrations and download Betterleaks")
1079
1117
  .option("-i, --interactive", "Guided setup — prompts for each detected integration")
1080
1118
  .option("--update", "Re-download betterleaks and reinstall integrations without resetting config")
1081
1119
  .option("--local", "Install integration configs project-locally (in CWD) instead of user-globally. " +
1082
1120
  "Supported for Claude Code, Codex, Gemini, Cursor. Other platforms are skipped in local mode.")
1083
1121
  .option("--dry-run", "Print every file path that would be created, modified, or downloaded — without making any changes (rf-hrtd).")
1122
+ .option("--quiet", "Suppress informational and success output (warnings and errors still go to stderr)", false)
1084
1123
  .action(async (opts) => {
1085
- console.log(fmt.header("Rafter Agent Security Setup"));
1086
- console.log(fmt.divider());
1087
- console.log();
1124
+ const out = createInitOutput(opts.quiet === true);
1125
+ out.info(fmt.header("Rafter Agent Security Setup"));
1126
+ out.info(fmt.divider());
1127
+ out.info();
1088
1128
  const manager = new ConfigManager();
1089
1129
  const root = opts.local ? process.cwd() : os.homedir();
1090
1130
  const scope = opts.local ? "project" : "user";
1091
1131
  if (opts.local) {
1092
- console.log(fmt.info(`Project-local install — writing configs under ${root}`));
1132
+ out.info(fmt.info(`Project-local install — writing configs under ${root}`));
1093
1133
  }
1094
1134
  // Platforms supported in --local scope: Claude Code, Codex, Gemini, Cursor.
1095
1135
  // Windsurf, Continue.dev, Aider are skipped in --local because their
@@ -1143,9 +1183,9 @@ export function createInitCommand() {
1143
1183
  const wantSkillScanner = !!opts.withSkillScanner;
1144
1184
  // Interactive mode: prompt for each detected integration
1145
1185
  if (opts.interactive && !opts.all) {
1146
- console.log();
1147
- console.log(fmt.info("Select integrations to install:"));
1148
- console.log();
1186
+ out.info();
1187
+ out.info(fmt.info("Select integrations to install:"));
1188
+ out.info();
1149
1189
  if (hasClaudeCode && !wantClaudeCode)
1150
1190
  wantClaudeCode = await askYesNo("Install Claude Code hooks + skills?");
1151
1191
  if (hasCodex && !wantCodex)
@@ -1168,7 +1208,7 @@ export function createInitCommand() {
1168
1208
  wantOpenCode = await askYesNo("Install OpenCode MCP server?");
1169
1209
  if (!wantBetterleaks)
1170
1210
  wantBetterleaks = await askYesNo("Download Betterleaks binary (enhanced scanning)?");
1171
- console.log();
1211
+ out.info();
1172
1212
  }
1173
1213
  // Show detected environments with opt-in hints
1174
1214
  const detected = [];
@@ -1193,45 +1233,57 @@ export function createInitCommand() {
1193
1233
  if (hasOpenCode)
1194
1234
  detected.push("OpenCode");
1195
1235
  if (detected.length > 0) {
1196
- console.log(fmt.info(`Detected environments: ${detected.join(", ")}`));
1236
+ out.info(fmt.info(`Detected environments: ${detected.join(", ")}`));
1197
1237
  }
1198
1238
  else {
1199
- console.log(fmt.info("No agent environments detected"));
1239
+ out.info(fmt.info("No agent environments detected"));
1200
1240
  }
1201
1241
  // Warn about requested but undetected environments (user scope only —
1202
1242
  // in --local scope we create the directories in CWD as needed).
1243
+ // Gated on the EXPLICIT --with-<platform> flag, not the resolved
1244
+ // want* (which --all also sets): --all means "install all DETECTED
1245
+ // integrations" per its own --help text, so an undetected platform
1246
+ // under --all is normal and shouldn't warn individually — 9 such
1247
+ // warnings buried the ones that actually matter (rafter-cli#231).
1203
1248
  if (scope === "user") {
1204
- if (wantOpenClaw && !hasOpenClaw)
1205
- console.log(fmt.warning("OpenClaw requested but not detected (~/.openclaw not found)"));
1206
- if (wantClaudeCode && !hasClaudeCode)
1207
- console.log(fmt.warning("Claude Code requested but not detected (~/.claude not found)"));
1208
- if (wantCodex && !hasCodex)
1209
- console.log(fmt.warning("Codex CLI requested but not detected (~/.codex not found)"));
1210
- if (wantGemini && !hasGemini)
1211
- console.log(fmt.warning("Gemini CLI requested but not detected (~/.gemini not found)"));
1212
- if (wantCursor && !hasCursor)
1213
- console.log(fmt.warning("Cursor requested but not detected (~/.cursor not found)"));
1214
- if (wantWindsurf && !hasWindsurf)
1215
- console.log(fmt.warning("Windsurf requested but not detected (~/.codeium/windsurf not found)"));
1216
- if (wantContinue && !hasContinueDev)
1217
- console.log(fmt.warning("Continue.dev requested but not detected (~/.continue not found)"));
1218
- if (wantAider && !hasAider)
1219
- console.log(fmt.warning("Aider requested but not detected (~/.aider.conf.yml not found)"));
1220
- if (wantHermes && !hasHermes)
1221
- console.log(fmt.warning("Hermes requested but not detected (~/.hermes not found)"));
1222
- if (wantOpenCode && !hasOpenCode)
1223
- console.log(fmt.warning("OpenCode requested but not detected (~/.config/opencode not found)"));
1249
+ if (opts.withOpenclaw && !hasOpenClaw)
1250
+ out.warn(fmt.warning("OpenClaw requested but not detected (~/.openclaw not found)"));
1251
+ if (opts.withClaudeCode && !hasClaudeCode)
1252
+ out.warn(fmt.warning("Claude Code requested but not detected (~/.claude not found)"));
1253
+ if (opts.withCodex && !hasCodex)
1254
+ out.warn(fmt.warning("Codex CLI requested but not detected (~/.codex not found)"));
1255
+ if (opts.withGemini && !hasGemini)
1256
+ out.warn(fmt.warning("Gemini CLI requested but not detected (~/.gemini not found)"));
1257
+ if (opts.withCursor && !hasCursor)
1258
+ out.warn(fmt.warning("Cursor requested but not detected (~/.cursor not found)"));
1259
+ if (opts.withWindsurf && !hasWindsurf)
1260
+ out.warn(fmt.warning("Windsurf requested but not detected (~/.codeium/windsurf not found)"));
1261
+ if (opts.withContinue && !hasContinueDev)
1262
+ out.warn(fmt.warning("Continue.dev requested but not detected (~/.continue not found)"));
1263
+ if (opts.withAider && !hasAider)
1264
+ out.warn(fmt.warning("Aider requested but not detected (~/.aider.conf.yml not found)"));
1265
+ if (opts.withHermes && !hasHermes)
1266
+ out.warn(fmt.warning("Hermes requested but not detected (~/.hermes not found)"));
1267
+ if (opts.withOpencode && !hasOpenCode)
1268
+ out.warn(fmt.warning("OpenCode requested but not detected (~/.config/opencode not found)"));
1224
1269
  }
1225
1270
  // --dry-run: print every file path the command would touch, then
1226
1271
  // exit before any filesystem write happens (rf-hrtd). The plan is
1227
1272
  // built from the SAME resolved want* / has* booleans the install
1228
1273
  // path uses, so the listing mirrors what would actually run.
1229
1274
  if (opts.dryRun) {
1275
+ const bm = new BinaryManager();
1276
+ const betterleaksExisting = !wantBetterleaks || opts.update
1277
+ ? null
1278
+ : bm.isBetterleaksInstalled()
1279
+ ? bm.getBetterleaksPath()
1280
+ : bm.findBetterleaksOnPath();
1281
+ const components = (manager.get("agent.components") ?? {});
1230
1282
  printDryRunPlan({
1231
1283
  root,
1232
1284
  scope,
1233
1285
  wantOpenClaw: wantOpenClaw && (hasOpenClaw),
1234
- wantClaudeCode: wantClaudeCode && (hasClaudeCode || opts.local),
1286
+ wantClaudeCode: wantClaudeCode && (hasClaudeCode || opts.withClaudeCode || opts.local),
1235
1287
  wantCodex: wantCodex && (hasCodex || opts.local),
1236
1288
  wantGemini: wantGemini && (hasGemini || opts.local),
1237
1289
  wantCursor: wantCursor && (hasCursor || opts.local),
@@ -1241,7 +1293,10 @@ export function createInitCommand() {
1241
1293
  wantHermes: wantHermes && hasHermes,
1242
1294
  wantOpenCode: wantOpenCode && hasOpenCode,
1243
1295
  wantBetterleaks,
1296
+ betterleaksExisting,
1297
+ betterleaksSupported: bm.getPlatformInfo().supported,
1244
1298
  wantSkillScanner,
1299
+ claudeCodeMcpDisabled: components["claude-code.mcp"]?.enabled === false,
1245
1300
  riskLevel: opts.riskLevel,
1246
1301
  });
1247
1302
  return;
@@ -1249,7 +1304,7 @@ export function createInitCommand() {
1249
1304
  // Initialize directory structure
1250
1305
  try {
1251
1306
  await manager.initialize();
1252
- console.log(fmt.success("Created config at ~/.rafter/config.json"));
1307
+ out.info(fmt.success("Created config at ~/.rafter/config.json"));
1253
1308
  }
1254
1309
  catch (e) {
1255
1310
  console.error(fmt.error(`Failed to initialize: ${e}`));
@@ -1263,7 +1318,7 @@ export function createInitCommand() {
1263
1318
  process.exit(1);
1264
1319
  }
1265
1320
  manager.set("agent.riskLevel", opts.riskLevel);
1266
- console.log(fmt.success(`Set risk level: ${opts.riskLevel}`));
1321
+ out.info(fmt.success(`Set risk level: ${opts.riskLevel}`));
1267
1322
  // Check / download Betterleaks binary (opt-in via --with-betterleaks or --all)
1268
1323
  if (wantBetterleaks) {
1269
1324
  const binaryManager = new BinaryManager();
@@ -1271,25 +1326,25 @@ export function createInitCommand() {
1271
1326
  // Helper: show diagnostics for a failing binary (mirrors Python's agent init)
1272
1327
  const showDiagnostics = async (binaryPath, verResult) => {
1273
1328
  if (verResult.stderr) {
1274
- console.log(fmt.info(` stderr: ${verResult.stderr}`));
1329
+ out.warn(fmt.info(` stderr: ${verResult.stderr}`));
1275
1330
  }
1276
1331
  const diag = await binaryManager.collectBinaryDiagnostics(binaryPath);
1277
1332
  if (diag) {
1278
- console.log(fmt.info("Diagnostics:"));
1279
- console.log(diag);
1333
+ out.warn(fmt.info("Diagnostics:"));
1334
+ out.warn(diag);
1280
1335
  }
1281
- console.log(fmt.info("To fix: install betterleaks (https://github.com/betterleaks/betterleaks/releases) and ensure it is on PATH, then re-run 'rafter agent init'."));
1282
- console.log();
1336
+ out.warn(fmt.info("To fix: install betterleaks (https://github.com/betterleaks/betterleaks/releases) and ensure it is on PATH, then re-run 'rafter agent init'."));
1337
+ out.info();
1283
1338
  };
1284
1339
  if (!opts.update && binaryManager.isBetterleaksInstalled()) {
1285
1340
  // Local binary exists — verify it actually works
1286
1341
  const verResult = await binaryManager.verifyBetterleaksVerbose();
1287
1342
  if (verResult.ok) {
1288
- console.log(fmt.success(`Betterleaks already installed (${verResult.stdout})`));
1343
+ out.info(fmt.success(`Betterleaks already installed (${verResult.stdout})`));
1289
1344
  }
1290
1345
  else {
1291
- console.log(fmt.warning("Betterleaks binary found locally but failed to execute."));
1292
- console.log(fmt.info(` Binary: ${binaryManager.getBetterleaksPath()}`));
1346
+ out.warn(fmt.warning("Betterleaks binary found locally but failed to execute."));
1347
+ out.warn(fmt.info(` Binary: ${binaryManager.getBetterleaksPath()}`));
1293
1348
  await showDiagnostics(binaryManager.getBetterleaksPath(), verResult);
1294
1349
  }
1295
1350
  }
@@ -1300,35 +1355,35 @@ export function createInitCommand() {
1300
1355
  if (pathBinary) {
1301
1356
  const verResult = await binaryManager.verifyBetterleaksVerbose(pathBinary);
1302
1357
  if (verResult.ok) {
1303
- console.log(fmt.success(`Betterleaks available on PATH (${verResult.stdout})`));
1358
+ out.info(fmt.success(`Betterleaks available on PATH (${verResult.stdout})`));
1304
1359
  }
1305
1360
  else {
1306
- console.log(fmt.warning("Betterleaks found on PATH but failed to execute."));
1307
- console.log(fmt.info(` Binary: ${pathBinary}`));
1361
+ out.warn(fmt.warning("Betterleaks found on PATH but failed to execute."));
1362
+ out.warn(fmt.info(` Binary: ${pathBinary}`));
1308
1363
  await showDiagnostics(pathBinary, verResult);
1309
1364
  }
1310
1365
  }
1311
1366
  else if (!platformInfo.supported) {
1312
- console.log(fmt.info(`Betterleaks not available for ${platformInfo.platform}/${platformInfo.arch}`));
1313
- console.log(fmt.success("Using pattern-based scanning (21 patterns)"));
1367
+ out.info(fmt.info(`Betterleaks not available for ${platformInfo.platform}/${platformInfo.arch}`));
1368
+ out.info(fmt.success("Using pattern-based scanning (21 patterns)"));
1314
1369
  }
1315
1370
  else {
1316
1371
  // Not on PATH, not installed locally — download
1317
- console.log();
1318
- console.log(fmt.info("Downloading Betterleaks (enhanced secret detection)..."));
1372
+ out.info();
1373
+ out.info(fmt.info("Downloading Betterleaks (enhanced secret detection)..."));
1319
1374
  try {
1320
1375
  await binaryManager.downloadBetterleaks((msg) => {
1321
- console.log(` ${msg}`);
1376
+ out.info(` ${msg}`);
1322
1377
  });
1323
- console.log();
1378
+ out.info();
1324
1379
  }
1325
1380
  catch (e) {
1326
- console.log();
1327
- console.log(fmt.error(`Betterleaks setup failed — pattern-based scanning will be used instead.`));
1328
- console.log(fmt.warning(String(e)));
1329
- console.log();
1330
- console.log(fmt.info("To fix: install betterleaks manually (https://github.com/betterleaks/betterleaks/releases) and ensure it is on PATH, then re-run 'rafter agent init'."));
1331
- console.log();
1381
+ out.info();
1382
+ out.warn(fmt.error(`Betterleaks setup failed — pattern-based scanning will be used instead.`));
1383
+ out.warn(fmt.warning(String(e)));
1384
+ out.info();
1385
+ out.warn(fmt.info("To fix: install betterleaks manually (https://github.com/betterleaks/betterleaks/releases) and ensure it is on PATH, then re-run 'rafter agent init'."));
1386
+ out.info();
1332
1387
  }
1333
1388
  }
1334
1389
  }
@@ -1346,43 +1401,43 @@ export function createInitCommand() {
1346
1401
  }
1347
1402
  })();
1348
1403
  if (onPath) {
1349
- console.log(fmt.success(`skill-scanner available on PATH (${onPath})`));
1404
+ out.info(fmt.success(`skill-scanner available on PATH (${onPath})`));
1350
1405
  }
1351
1406
  else {
1352
- console.log();
1353
- console.log(fmt.info("Installing optional skill-scanner deep engine (heavy third-party package; isolated install)..."));
1354
- const result = await new SkillScannerInstaller().install(SKILL_SCANNER_VERSION, (msg) => console.log(` ${msg}`));
1407
+ out.info();
1408
+ out.info(fmt.info("Installing optional skill-scanner deep engine (heavy third-party package; isolated install)..."));
1409
+ const result = await new SkillScannerInstaller().install(SKILL_SCANNER_VERSION, (msg) => out.info(` ${msg}`));
1355
1410
  if (result.ok) {
1356
- console.log(fmt.success(`skill-scanner installed (via ${result.via}): ${result.message}`));
1411
+ out.info(fmt.success(`skill-scanner installed (via ${result.via}): ${result.message}`));
1357
1412
  }
1358
1413
  else {
1359
- console.log(fmt.warning(`skill-scanner install failed: ${result.message}`));
1360
- console.log(fmt.info("To fix: run 'rafter agent update-skill-scanner' or install manually with 'uv tool install cisco-ai-skill-scanner'."));
1414
+ out.warn(fmt.warning(`skill-scanner install failed: ${result.message}`));
1415
+ out.warn(fmt.info("To fix: run 'rafter agent update-skill-scanner' or install manually with 'uv tool install cisco-ai-skill-scanner'."));
1361
1416
  }
1362
1417
  }
1363
1418
  }
1364
1419
  // Install OpenClaw skill if opted in
1365
1420
  let openclawOk = false;
1366
1421
  if (hasOpenClaw && wantOpenClaw) {
1367
- const skillManager = new SkillManager();
1422
+ const skillManager = new SkillManager({ log: (message) => out.info(message) });
1368
1423
  const result = await skillManager.installRafterSkillVerbose();
1369
1424
  openclawOk = result.ok;
1370
1425
  if (result.ok) {
1371
- console.log(fmt.success(`Installed Rafter Security skill to ${result.destPath}`));
1426
+ out.info(fmt.success(`Installed Rafter Security skill to ${result.destPath}`));
1372
1427
  manager.set("agent.environments.openclaw.enabled", true);
1373
1428
  }
1374
1429
  else {
1375
- console.log(fmt.error("Failed to install Rafter Security skill"));
1376
- console.log(fmt.warning(` Source: ${result.sourcePath}`));
1377
- console.log(fmt.warning(` Destination: ${result.destPath}`));
1430
+ out.warn(fmt.error("Failed to install Rafter Security skill"));
1431
+ out.warn(fmt.warning(` Source: ${result.sourcePath}`));
1432
+ out.warn(fmt.warning(` Destination: ${result.destPath}`));
1378
1433
  if (result.error) {
1379
- console.log(fmt.warning(` Error: ${result.error}`));
1434
+ out.warn(fmt.warning(` Error: ${result.error}`));
1380
1435
  }
1381
1436
  }
1382
1437
  }
1383
1438
  // Helper: warn that a platform is not supported in --local mode.
1384
1439
  const localUnsupported = (label) => {
1385
- console.log(fmt.warning(`${label} is not supported in --local mode yet. Skipping. ` +
1440
+ out.warn(fmt.warning(`${label} is not supported in --local mode yet. Skipping. ` +
1386
1441
  `Re-run without --local to install for this platform user-globally.`));
1387
1442
  };
1388
1443
  // Install Claude Code skills + hooks if opted in
@@ -1390,16 +1445,16 @@ export function createInitCommand() {
1390
1445
  let claudeCodeOk = false;
1391
1446
  if ((hasClaudeCode || opts.withClaudeCode || (opts.local && wantClaudeCode)) && wantClaudeCode) {
1392
1447
  try {
1393
- await installClaudeCodeSkills(root);
1394
- installClaudeCodeSubAgents(root);
1395
- installClaudeCodeHooks(root);
1448
+ await installClaudeCodeSkills(root, out);
1449
+ installClaudeCodeSubAgents(root, out);
1450
+ installClaudeCodeHooks(root, out);
1396
1451
  if (scope === "project") {
1397
1452
  const components = (manager.get("agent.components") ?? {});
1398
1453
  if (components["claude-code.mcp"]?.enabled === false) {
1399
- console.log(fmt.info("Skipped .mcp.json (claude-code.mcp disabled; re-enable with `rafter agent enable claude-code.mcp`)"));
1454
+ out.info(fmt.info("Skipped .mcp.json (claude-code.mcp disabled; re-enable with `rafter agent enable claude-code.mcp`)"));
1400
1455
  }
1401
1456
  else {
1402
- installClaudeCodeMcp(root);
1457
+ installClaudeCodeMcp(root, out);
1403
1458
  components["claude-code.mcp"] = { enabled: true, updatedAt: new Date().toISOString() };
1404
1459
  manager.set("agent.components", components);
1405
1460
  }
@@ -1416,8 +1471,8 @@ export function createInitCommand() {
1416
1471
  let codexOk = false;
1417
1472
  if ((hasCodex || (opts.local && wantCodex)) && wantCodex) {
1418
1473
  try {
1419
- installCodexSkills(root);
1420
- installCodexHooks(root);
1474
+ installCodexSkills(root, out);
1475
+ installCodexHooks(root, out);
1421
1476
  if (scope === "user")
1422
1477
  manager.set("agent.environments.codex.enabled", true);
1423
1478
  codexOk = true;
@@ -1430,10 +1485,10 @@ export function createInitCommand() {
1430
1485
  let geminiOk = false;
1431
1486
  if ((hasGemini || (opts.local && wantGemini)) && wantGemini) {
1432
1487
  try {
1433
- geminiOk = installGeminiMcp(root);
1434
- installGeminiSkills(root);
1435
- registerGeminiSkills(path.join(root, ".agents", "skills"));
1436
- installGeminiHooks(root);
1488
+ geminiOk = installGeminiMcp(root, out);
1489
+ installGeminiSkills(root, out);
1490
+ registerGeminiSkills(path.join(root, ".agents", "skills"), out);
1491
+ installGeminiHooks(root, out);
1437
1492
  if (geminiOk && scope === "user")
1438
1493
  manager.set("agent.environments.gemini.enabled", true);
1439
1494
  }
@@ -1445,10 +1500,10 @@ export function createInitCommand() {
1445
1500
  let cursorOk = false;
1446
1501
  if ((hasCursor || (opts.local && wantCursor)) && wantCursor) {
1447
1502
  try {
1448
- cursorOk = installCursorMcp(root);
1449
- installCursorHooks(root);
1450
- installCursorRules(root);
1451
- installCursorSubAgents(root);
1503
+ cursorOk = installCursorMcp(root, out);
1504
+ installCursorHooks(root, out);
1505
+ installCursorRules(root, out);
1506
+ installCursorSubAgents(root, out);
1452
1507
  if (cursorOk && scope === "user")
1453
1508
  manager.set("agent.environments.cursor.enabled", true);
1454
1509
  }
@@ -1468,11 +1523,11 @@ export function createInitCommand() {
1468
1523
  if (wantWindsurf && (hasWindsurf || opts.local)) {
1469
1524
  try {
1470
1525
  if (hasWindsurf) {
1471
- windsurfOk = installWindsurfMcp(root);
1526
+ windsurfOk = installWindsurfMcp(root, out);
1472
1527
  if (windsurfOk)
1473
1528
  manager.set("agent.environments.windsurf.enabled", true);
1474
1529
  }
1475
- installWindsurfRules(root);
1530
+ installWindsurfRules(root, out);
1476
1531
  // AGENTS.md is written below in installGlobalInstructions when
1477
1532
  // platforms.windsurf is true.
1478
1533
  if (!hasWindsurf)
@@ -1492,11 +1547,11 @@ export function createInitCommand() {
1492
1547
  if (wantContinue && (hasContinueDev || opts.local)) {
1493
1548
  try {
1494
1549
  if (hasContinueDev) {
1495
- continueOk = installContinueDevMcp(root);
1550
+ continueOk = installContinueDevMcp(root, out);
1496
1551
  if (continueOk)
1497
1552
  manager.set("agent.environments.continueDev.enabled", true);
1498
1553
  }
1499
- installContinueDevRules(root);
1554
+ installContinueDevRules(root, out);
1500
1555
  if (!hasContinueDev)
1501
1556
  continueOk = true; // local-scope success: rules only
1502
1557
  }
@@ -1512,7 +1567,7 @@ export function createInitCommand() {
1512
1567
  let aiderOk = false;
1513
1568
  if (wantAider && (hasAider || opts.local)) {
1514
1569
  try {
1515
- aiderOk = installAiderRead(root);
1570
+ aiderOk = installAiderRead(root, out);
1516
1571
  if (aiderOk && hasAider)
1517
1572
  manager.set("agent.environments.aider.enabled", true);
1518
1573
  }
@@ -1526,7 +1581,7 @@ export function createInitCommand() {
1526
1581
  let hermesOk = false;
1527
1582
  if (wantHermes && hasHermes) {
1528
1583
  try {
1529
- hermesOk = installHermesMcp(root);
1584
+ hermesOk = installHermesMcp(root, out);
1530
1585
  if (hermesOk)
1531
1586
  manager.set("agent.environments.hermes.enabled", true);
1532
1587
  }
@@ -1541,7 +1596,7 @@ export function createInitCommand() {
1541
1596
  let openCodeOk = false;
1542
1597
  if (wantOpenCode && hasOpenCode) {
1543
1598
  try {
1544
- openCodeOk = installOpenCodeMcp(root);
1599
+ openCodeOk = installOpenCodeMcp(root, out);
1545
1600
  if (openCodeOk)
1546
1601
  manager.set("agent.environments.opencode.enabled", true);
1547
1602
  }
@@ -1557,83 +1612,83 @@ export function createInitCommand() {
1557
1612
  codex: codexOk,
1558
1613
  gemini: geminiOk,
1559
1614
  windsurf: windsurfOk,
1560
- }, root, scope);
1561
- console.log();
1615
+ }, root, scope, out);
1616
+ out.info();
1562
1617
  // rf-er8a: do not report a clean success if the hook we just wrote cannot
1563
1618
  // execute and enforce. A silent 127 (or an npx-cache entrypoint) means the
1564
1619
  // gate is inert even though settings.json looks configured.
1565
1620
  const hookWarnings = claudeCodeOk ? installedHookWarnings() : [];
1566
1621
  if (hookWarnings.length > 0) {
1567
1622
  for (const w of hookWarnings)
1568
- console.log(fmt.warning(w));
1569
- console.log(fmt.warning("Agent security initialized WITH WARNINGS — the command gate may NOT be active (see above). Run 'rafter agent verify' to confirm."));
1623
+ out.warn(fmt.warning(w));
1624
+ out.warn(fmt.warning("Agent security initialized WITH WARNINGS — the command gate may NOT be active (see above). Run 'rafter agent verify' to confirm."));
1570
1625
  }
1571
1626
  else {
1572
- console.log(fmt.success("Agent security initialized!"));
1627
+ out.info(fmt.success("Agent security initialized!"));
1573
1628
  }
1574
- console.log();
1629
+ out.info();
1575
1630
  const anyIntegration = openclawOk || claudeCodeOk || codexOk || geminiOk || cursorOk || windsurfOk || continueOk || aiderOk || hermesOk || openCodeOk;
1576
1631
  if (anyIntegration) {
1577
- console.log("Next steps:");
1632
+ out.info("Next steps:");
1578
1633
  if (openclawOk)
1579
- console.log(" - Restart OpenClaw to load skill");
1634
+ out.info(" - Restart OpenClaw to load skill");
1580
1635
  if (claudeCodeOk)
1581
- console.log(" - Restart Claude Code to load skills");
1636
+ out.info(" - Restart Claude Code to load skills");
1582
1637
  if (codexOk)
1583
- console.log(" - Restart Codex CLI to load skills");
1638
+ out.info(" - Restart Codex CLI to load skills");
1584
1639
  if (geminiOk)
1585
- console.log(" - Restart Gemini CLI to load MCP server");
1640
+ out.info(" - Restart Gemini CLI to load MCP server");
1586
1641
  if (cursorOk)
1587
- console.log(" - Restart Cursor to load MCP server");
1642
+ out.info(" - Restart Cursor to load MCP server");
1588
1643
  if (windsurfOk)
1589
- console.log(" - Restart Windsurf to load MCP server");
1644
+ out.info(" - Restart Windsurf to load MCP server");
1590
1645
  if (continueOk)
1591
- console.log(" - Restart Continue.dev to load MCP server");
1646
+ out.info(" - Restart Continue.dev to load MCP server");
1592
1647
  if (aiderOk)
1593
- console.log(" - Restart Aider to load RAFTER.md from .aider.conf.yml read:");
1648
+ out.info(" - Restart Aider to load RAFTER.md from .aider.conf.yml read:");
1594
1649
  if (hermesOk)
1595
- console.log(" - Restart Hermes to load MCP server");
1650
+ out.info(" - Restart Hermes to load MCP server");
1596
1651
  if (openCodeOk)
1597
- console.log(" - Restart OpenCode to load MCP server");
1652
+ out.info(" - Restart OpenCode to load MCP server");
1598
1653
  }
1599
1654
  else if (scope === "project") {
1600
- console.log("No integrations were installed. In --local mode, pass one or more opt-in flags:");
1601
- console.log(" rafter agent init --local --with-claude-code");
1602
- console.log(" rafter agent init --local --with-codex");
1603
- console.log(" rafter agent init --local --with-gemini");
1604
- console.log(" rafter agent init --local --with-cursor");
1655
+ out.info("No integrations were installed. In --local mode, pass one or more opt-in flags:");
1656
+ out.info(" rafter agent init --local --with-claude-code");
1657
+ out.info(" rafter agent init --local --with-codex");
1658
+ out.info(" rafter agent init --local --with-gemini");
1659
+ out.info(" rafter agent init --local --with-cursor");
1605
1660
  }
1606
1661
  else if (detected.length > 0) {
1607
- console.log("No integrations were installed. To install, re-run with opt-in flags:");
1608
- console.log(" rafter agent init --all # Install all detected");
1662
+ out.info("No integrations were installed. To install, re-run with opt-in flags:");
1663
+ out.info(" rafter agent init --all # Install all detected");
1609
1664
  if (hasClaudeCode)
1610
- console.log(" rafter agent init --with-claude-code # Claude Code only");
1665
+ out.info(" rafter agent init --with-claude-code # Claude Code only");
1611
1666
  if (hasOpenClaw)
1612
- console.log(" rafter agent init --with-openclaw # OpenClaw only");
1667
+ out.info(" rafter agent init --with-openclaw # OpenClaw only");
1613
1668
  if (hasCodex)
1614
- console.log(" rafter agent init --with-codex # Codex CLI only");
1669
+ out.info(" rafter agent init --with-codex # Codex CLI only");
1615
1670
  if (hasGemini)
1616
- console.log(" rafter agent init --with-gemini # Gemini CLI only");
1671
+ out.info(" rafter agent init --with-gemini # Gemini CLI only");
1617
1672
  if (hasCursor)
1618
- console.log(" rafter agent init --with-cursor # Cursor only");
1673
+ out.info(" rafter agent init --with-cursor # Cursor only");
1619
1674
  if (hasWindsurf)
1620
- console.log(" rafter agent init --with-windsurf # Windsurf only");
1675
+ out.info(" rafter agent init --with-windsurf # Windsurf only");
1621
1676
  if (hasContinueDev)
1622
- console.log(" rafter agent init --with-continue # Continue.dev only");
1677
+ out.info(" rafter agent init --with-continue # Continue.dev only");
1623
1678
  if (hasAider)
1624
- console.log(" rafter agent init --with-aider # Aider only");
1679
+ out.info(" rafter agent init --with-aider # Aider only");
1625
1680
  if (hasHermes)
1626
- console.log(" rafter agent init --with-hermes # Hermes only");
1681
+ out.info(" rafter agent init --with-hermes # Hermes only");
1627
1682
  if (hasOpenCode)
1628
- console.log(" rafter agent init --with-opencode # OpenCode only");
1683
+ out.info(" rafter agent init --with-opencode # OpenCode only");
1629
1684
  }
1630
1685
  else {
1631
- console.log("No agent environments detected. Install an agent tool and re-run with --with-<tool>.");
1686
+ out.info("No agent environments detected. Install an agent tool and re-run with --with-<tool>.");
1632
1687
  }
1633
- console.log();
1634
- console.log(" - Run: rafter secrets . (test secret scanning)");
1635
- console.log(" - Configure: rafter agent config show");
1636
- console.log();
1688
+ out.info();
1689
+ out.info(" - Run: rafter secrets . (test secret scanning)");
1690
+ out.info(" - Configure: rafter agent config show");
1691
+ out.info();
1637
1692
  // Warn if a different rafter version shadows this one on PATH
1638
1693
  try {
1639
1694
  const _require = createRequire(import.meta.url);
@@ -1644,9 +1699,9 @@ export function createInitCommand() {
1644
1699
  stdio: ["pipe", "pipe", "ignore"],
1645
1700
  }).trim();
1646
1701
  if (pathVersion && pathVersion !== thisVersion && !pathVersion.includes(thisVersion)) {
1647
- console.log(fmt.warning(`PATH version mismatch: 'rafter --version' reports ${pathVersion}, but this install is ${thisVersion}.`));
1648
- console.log(fmt.info("Another rafter binary may be shadowing this one. Check: which rafter"));
1649
- console.log();
1702
+ out.warn(fmt.warning(`PATH version mismatch: 'rafter --version' reports ${pathVersion}, but this install is ${thisVersion}.`));
1703
+ out.warn(fmt.info("Another rafter binary may be shadowing this one. Check: which rafter"));
1704
+ out.info();
1650
1705
  }
1651
1706
  }
1652
1707
  catch {