@rafter-security/cli 0.10.5 → 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 (41) hide show
  1. package/dist/commands/agent/exec.js +26 -9
  2. package/dist/commands/agent/init.js +286 -225
  3. package/dist/commands/agent/install-hook.js +19 -8
  4. package/dist/commands/agent/scan.js +270 -70
  5. package/dist/commands/agent/status.js +2 -2
  6. package/dist/commands/agent/update-skill-scanner.js +1 -1
  7. package/dist/commands/agent/verify.js +39 -15
  8. package/dist/commands/backend/get.js +6 -2
  9. package/dist/commands/backend/run.js +25 -2
  10. package/dist/commands/backend/scan-status.js +34 -4
  11. package/dist/commands/hook/pretool.js +124 -36
  12. package/dist/commands/mcp/server.js +184 -129
  13. package/dist/commands/report.js +6 -2
  14. package/dist/core/audit-logger.js +47 -17
  15. package/dist/core/config-manager.js +46 -8
  16. package/dist/core/custom-patterns.js +28 -8
  17. package/dist/core/docs-loader.js +33 -3
  18. package/dist/core/pattern-engine.js +23 -5
  19. package/dist/core/policy-loader.js +15 -4
  20. package/dist/core/risk-rules.js +391 -9
  21. package/dist/index.js +7 -1
  22. package/dist/scanners/betterleaks.js +127 -14
  23. package/dist/scanners/git-history-scan.js +75 -0
  24. package/dist/scanners/regex-scanner.js +16 -2
  25. package/dist/scanners/secret-patterns.js +5 -1
  26. package/dist/scanners/union.js +31 -19
  27. package/dist/utils/api.js +35 -1
  28. package/dist/utils/env-guard.js +14 -14
  29. package/dist/utils/git-diff.js +36 -20
  30. package/dist/utils/git.js +164 -52
  31. package/dist/utils/skill-manager.js +4 -3
  32. package/package.json +16 -15
  33. package/resources/continue-rules/rafter.md +1 -1
  34. package/resources/cursor-rules/rafter.mdc +1 -1
  35. package/resources/rafter-security-skill.md +3 -1
  36. package/resources/skills/rafter/SKILL.md +1 -2
  37. package/resources/skills/rafter/docs/guardrails.md +1 -1
  38. package/resources/skills/rafter-code-review/SKILL.md +0 -1
  39. package/resources/skills/rafter-secure-design/SKILL.md +0 -1
  40. package/resources/skills/rafter-skill-review/SKILL.md +0 -1
  41. package/resources/windsurf-rules/rafter.md +1 -1
@@ -6,7 +6,7 @@ import { SkillManager } from "../../utils/skill-manager.js";
6
6
  import fs from "fs";
7
7
  import path from "path";
8
8
  import os from "os";
9
- import { execSync, spawnSync } from "child_process";
9
+ import { execFileSync, execSync, spawnSync } from "child_process";
10
10
  import { fileURLToPath } from "url";
11
11
  import { createRequire } from "module";
12
12
  import { askYesNo } from "../../utils/prompt.js";
@@ -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
  }
@@ -1041,15 +1079,21 @@ function registerGeminiSkills(skillsDir) {
1041
1079
  if (!fs.existsSync(absPath))
1042
1080
  continue;
1043
1081
  try {
1044
- execSync(`gemini skills link ${JSON.stringify(absPath)}`, {
1045
- stdio: ["ignore", "pipe", "pipe"],
1046
- timeout: 10000,
1047
- });
1048
- console.log(fmt.success(`Registered ${skill.name} with Gemini CLI`));
1082
+ const execOpts = { stdio: ["ignore", "pipe", "pipe"], timeout: 10000 };
1083
+ // No POSIX shell: the path comes from the working directory, whose name
1084
+ // may hold shell syntax. Windows needs cmd.exe to run gemini's .cmd shim,
1085
+ // and cmd.exe treats a double-quoted path literally.
1086
+ if (process.platform === "win32") {
1087
+ execSync(`gemini skills link ${JSON.stringify(absPath)}`, execOpts);
1088
+ }
1089
+ else {
1090
+ execFileSync("gemini", ["skills", "link", absPath], execOpts);
1091
+ }
1092
+ out.info(fmt.success(`Registered ${skill.name} with Gemini CLI`));
1049
1093
  }
1050
1094
  catch (e) {
1051
1095
  const msg = (e?.stderr?.toString?.() || e?.message || "").trim();
1052
- 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"}`));
1053
1097
  }
1054
1098
  }
1055
1099
  }
@@ -1068,22 +1112,24 @@ export function createInitCommand() {
1068
1112
  .option("--with-hermes", "Install Hermes integration")
1069
1113
  .option("--with-opencode", "Install OpenCode integration")
1070
1114
  .option("--with-betterleaks", "Download and install Betterleaks binary")
1071
- .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)")
1072
1116
  .option("--all", "Install all detected integrations and download Betterleaks")
1073
1117
  .option("-i, --interactive", "Guided setup — prompts for each detected integration")
1074
1118
  .option("--update", "Re-download betterleaks and reinstall integrations without resetting config")
1075
1119
  .option("--local", "Install integration configs project-locally (in CWD) instead of user-globally. " +
1076
1120
  "Supported for Claude Code, Codex, Gemini, Cursor. Other platforms are skipped in local mode.")
1077
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)
1078
1123
  .action(async (opts) => {
1079
- console.log(fmt.header("Rafter Agent Security Setup"));
1080
- console.log(fmt.divider());
1081
- 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();
1082
1128
  const manager = new ConfigManager();
1083
1129
  const root = opts.local ? process.cwd() : os.homedir();
1084
1130
  const scope = opts.local ? "project" : "user";
1085
1131
  if (opts.local) {
1086
- console.log(fmt.info(`Project-local install — writing configs under ${root}`));
1132
+ out.info(fmt.info(`Project-local install — writing configs under ${root}`));
1087
1133
  }
1088
1134
  // Platforms supported in --local scope: Claude Code, Codex, Gemini, Cursor.
1089
1135
  // Windsurf, Continue.dev, Aider are skipped in --local because their
@@ -1137,9 +1183,9 @@ export function createInitCommand() {
1137
1183
  const wantSkillScanner = !!opts.withSkillScanner;
1138
1184
  // Interactive mode: prompt for each detected integration
1139
1185
  if (opts.interactive && !opts.all) {
1140
- console.log();
1141
- console.log(fmt.info("Select integrations to install:"));
1142
- console.log();
1186
+ out.info();
1187
+ out.info(fmt.info("Select integrations to install:"));
1188
+ out.info();
1143
1189
  if (hasClaudeCode && !wantClaudeCode)
1144
1190
  wantClaudeCode = await askYesNo("Install Claude Code hooks + skills?");
1145
1191
  if (hasCodex && !wantCodex)
@@ -1162,7 +1208,7 @@ export function createInitCommand() {
1162
1208
  wantOpenCode = await askYesNo("Install OpenCode MCP server?");
1163
1209
  if (!wantBetterleaks)
1164
1210
  wantBetterleaks = await askYesNo("Download Betterleaks binary (enhanced scanning)?");
1165
- console.log();
1211
+ out.info();
1166
1212
  }
1167
1213
  // Show detected environments with opt-in hints
1168
1214
  const detected = [];
@@ -1187,45 +1233,57 @@ export function createInitCommand() {
1187
1233
  if (hasOpenCode)
1188
1234
  detected.push("OpenCode");
1189
1235
  if (detected.length > 0) {
1190
- console.log(fmt.info(`Detected environments: ${detected.join(", ")}`));
1236
+ out.info(fmt.info(`Detected environments: ${detected.join(", ")}`));
1191
1237
  }
1192
1238
  else {
1193
- console.log(fmt.info("No agent environments detected"));
1239
+ out.info(fmt.info("No agent environments detected"));
1194
1240
  }
1195
1241
  // Warn about requested but undetected environments (user scope only —
1196
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).
1197
1248
  if (scope === "user") {
1198
- if (wantOpenClaw && !hasOpenClaw)
1199
- console.log(fmt.warning("OpenClaw requested but not detected (~/.openclaw not found)"));
1200
- if (wantClaudeCode && !hasClaudeCode)
1201
- console.log(fmt.warning("Claude Code requested but not detected (~/.claude not found)"));
1202
- if (wantCodex && !hasCodex)
1203
- console.log(fmt.warning("Codex CLI requested but not detected (~/.codex not found)"));
1204
- if (wantGemini && !hasGemini)
1205
- console.log(fmt.warning("Gemini CLI requested but not detected (~/.gemini not found)"));
1206
- if (wantCursor && !hasCursor)
1207
- console.log(fmt.warning("Cursor requested but not detected (~/.cursor not found)"));
1208
- if (wantWindsurf && !hasWindsurf)
1209
- console.log(fmt.warning("Windsurf requested but not detected (~/.codeium/windsurf not found)"));
1210
- if (wantContinue && !hasContinueDev)
1211
- console.log(fmt.warning("Continue.dev requested but not detected (~/.continue not found)"));
1212
- if (wantAider && !hasAider)
1213
- console.log(fmt.warning("Aider requested but not detected (~/.aider.conf.yml not found)"));
1214
- if (wantHermes && !hasHermes)
1215
- console.log(fmt.warning("Hermes requested but not detected (~/.hermes not found)"));
1216
- if (wantOpenCode && !hasOpenCode)
1217
- 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)"));
1218
1269
  }
1219
1270
  // --dry-run: print every file path the command would touch, then
1220
1271
  // exit before any filesystem write happens (rf-hrtd). The plan is
1221
1272
  // built from the SAME resolved want* / has* booleans the install
1222
1273
  // path uses, so the listing mirrors what would actually run.
1223
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") ?? {});
1224
1282
  printDryRunPlan({
1225
1283
  root,
1226
1284
  scope,
1227
1285
  wantOpenClaw: wantOpenClaw && (hasOpenClaw),
1228
- wantClaudeCode: wantClaudeCode && (hasClaudeCode || opts.local),
1286
+ wantClaudeCode: wantClaudeCode && (hasClaudeCode || opts.withClaudeCode || opts.local),
1229
1287
  wantCodex: wantCodex && (hasCodex || opts.local),
1230
1288
  wantGemini: wantGemini && (hasGemini || opts.local),
1231
1289
  wantCursor: wantCursor && (hasCursor || opts.local),
@@ -1235,7 +1293,10 @@ export function createInitCommand() {
1235
1293
  wantHermes: wantHermes && hasHermes,
1236
1294
  wantOpenCode: wantOpenCode && hasOpenCode,
1237
1295
  wantBetterleaks,
1296
+ betterleaksExisting,
1297
+ betterleaksSupported: bm.getPlatformInfo().supported,
1238
1298
  wantSkillScanner,
1299
+ claudeCodeMcpDisabled: components["claude-code.mcp"]?.enabled === false,
1239
1300
  riskLevel: opts.riskLevel,
1240
1301
  });
1241
1302
  return;
@@ -1243,7 +1304,7 @@ export function createInitCommand() {
1243
1304
  // Initialize directory structure
1244
1305
  try {
1245
1306
  await manager.initialize();
1246
- console.log(fmt.success("Created config at ~/.rafter/config.json"));
1307
+ out.info(fmt.success("Created config at ~/.rafter/config.json"));
1247
1308
  }
1248
1309
  catch (e) {
1249
1310
  console.error(fmt.error(`Failed to initialize: ${e}`));
@@ -1257,7 +1318,7 @@ export function createInitCommand() {
1257
1318
  process.exit(1);
1258
1319
  }
1259
1320
  manager.set("agent.riskLevel", opts.riskLevel);
1260
- console.log(fmt.success(`Set risk level: ${opts.riskLevel}`));
1321
+ out.info(fmt.success(`Set risk level: ${opts.riskLevel}`));
1261
1322
  // Check / download Betterleaks binary (opt-in via --with-betterleaks or --all)
1262
1323
  if (wantBetterleaks) {
1263
1324
  const binaryManager = new BinaryManager();
@@ -1265,25 +1326,25 @@ export function createInitCommand() {
1265
1326
  // Helper: show diagnostics for a failing binary (mirrors Python's agent init)
1266
1327
  const showDiagnostics = async (binaryPath, verResult) => {
1267
1328
  if (verResult.stderr) {
1268
- console.log(fmt.info(` stderr: ${verResult.stderr}`));
1329
+ out.warn(fmt.info(` stderr: ${verResult.stderr}`));
1269
1330
  }
1270
1331
  const diag = await binaryManager.collectBinaryDiagnostics(binaryPath);
1271
1332
  if (diag) {
1272
- console.log(fmt.info("Diagnostics:"));
1273
- console.log(diag);
1333
+ out.warn(fmt.info("Diagnostics:"));
1334
+ out.warn(diag);
1274
1335
  }
1275
- 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'."));
1276
- 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();
1277
1338
  };
1278
1339
  if (!opts.update && binaryManager.isBetterleaksInstalled()) {
1279
1340
  // Local binary exists — verify it actually works
1280
1341
  const verResult = await binaryManager.verifyBetterleaksVerbose();
1281
1342
  if (verResult.ok) {
1282
- console.log(fmt.success(`Betterleaks already installed (${verResult.stdout})`));
1343
+ out.info(fmt.success(`Betterleaks already installed (${verResult.stdout})`));
1283
1344
  }
1284
1345
  else {
1285
- console.log(fmt.warning("Betterleaks binary found locally but failed to execute."));
1286
- 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()}`));
1287
1348
  await showDiagnostics(binaryManager.getBetterleaksPath(), verResult);
1288
1349
  }
1289
1350
  }
@@ -1294,35 +1355,35 @@ export function createInitCommand() {
1294
1355
  if (pathBinary) {
1295
1356
  const verResult = await binaryManager.verifyBetterleaksVerbose(pathBinary);
1296
1357
  if (verResult.ok) {
1297
- console.log(fmt.success(`Betterleaks available on PATH (${verResult.stdout})`));
1358
+ out.info(fmt.success(`Betterleaks available on PATH (${verResult.stdout})`));
1298
1359
  }
1299
1360
  else {
1300
- console.log(fmt.warning("Betterleaks found on PATH but failed to execute."));
1301
- 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}`));
1302
1363
  await showDiagnostics(pathBinary, verResult);
1303
1364
  }
1304
1365
  }
1305
1366
  else if (!platformInfo.supported) {
1306
- console.log(fmt.info(`Betterleaks not available for ${platformInfo.platform}/${platformInfo.arch}`));
1307
- 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)"));
1308
1369
  }
1309
1370
  else {
1310
1371
  // Not on PATH, not installed locally — download
1311
- console.log();
1312
- console.log(fmt.info("Downloading Betterleaks (enhanced secret detection)..."));
1372
+ out.info();
1373
+ out.info(fmt.info("Downloading Betterleaks (enhanced secret detection)..."));
1313
1374
  try {
1314
1375
  await binaryManager.downloadBetterleaks((msg) => {
1315
- console.log(` ${msg}`);
1376
+ out.info(` ${msg}`);
1316
1377
  });
1317
- console.log();
1378
+ out.info();
1318
1379
  }
1319
1380
  catch (e) {
1320
- console.log();
1321
- console.log(fmt.error(`Betterleaks setup failed — pattern-based scanning will be used instead.`));
1322
- console.log(fmt.warning(String(e)));
1323
- console.log();
1324
- 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'."));
1325
- 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();
1326
1387
  }
1327
1388
  }
1328
1389
  }
@@ -1340,43 +1401,43 @@ export function createInitCommand() {
1340
1401
  }
1341
1402
  })();
1342
1403
  if (onPath) {
1343
- console.log(fmt.success(`skill-scanner available on PATH (${onPath})`));
1404
+ out.info(fmt.success(`skill-scanner available on PATH (${onPath})`));
1344
1405
  }
1345
1406
  else {
1346
- console.log();
1347
- console.log(fmt.info("Installing optional skill-scanner deep engine (heavy third-party package; isolated install)..."));
1348
- 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}`));
1349
1410
  if (result.ok) {
1350
- 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}`));
1351
1412
  }
1352
1413
  else {
1353
- console.log(fmt.warning(`skill-scanner install failed: ${result.message}`));
1354
- 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'."));
1355
1416
  }
1356
1417
  }
1357
1418
  }
1358
1419
  // Install OpenClaw skill if opted in
1359
1420
  let openclawOk = false;
1360
1421
  if (hasOpenClaw && wantOpenClaw) {
1361
- const skillManager = new SkillManager();
1422
+ const skillManager = new SkillManager({ log: (message) => out.info(message) });
1362
1423
  const result = await skillManager.installRafterSkillVerbose();
1363
1424
  openclawOk = result.ok;
1364
1425
  if (result.ok) {
1365
- console.log(fmt.success(`Installed Rafter Security skill to ${result.destPath}`));
1426
+ out.info(fmt.success(`Installed Rafter Security skill to ${result.destPath}`));
1366
1427
  manager.set("agent.environments.openclaw.enabled", true);
1367
1428
  }
1368
1429
  else {
1369
- console.log(fmt.error("Failed to install Rafter Security skill"));
1370
- console.log(fmt.warning(` Source: ${result.sourcePath}`));
1371
- 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}`));
1372
1433
  if (result.error) {
1373
- console.log(fmt.warning(` Error: ${result.error}`));
1434
+ out.warn(fmt.warning(` Error: ${result.error}`));
1374
1435
  }
1375
1436
  }
1376
1437
  }
1377
1438
  // Helper: warn that a platform is not supported in --local mode.
1378
1439
  const localUnsupported = (label) => {
1379
- 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. ` +
1380
1441
  `Re-run without --local to install for this platform user-globally.`));
1381
1442
  };
1382
1443
  // Install Claude Code skills + hooks if opted in
@@ -1384,16 +1445,16 @@ export function createInitCommand() {
1384
1445
  let claudeCodeOk = false;
1385
1446
  if ((hasClaudeCode || opts.withClaudeCode || (opts.local && wantClaudeCode)) && wantClaudeCode) {
1386
1447
  try {
1387
- await installClaudeCodeSkills(root);
1388
- installClaudeCodeSubAgents(root);
1389
- installClaudeCodeHooks(root);
1448
+ await installClaudeCodeSkills(root, out);
1449
+ installClaudeCodeSubAgents(root, out);
1450
+ installClaudeCodeHooks(root, out);
1390
1451
  if (scope === "project") {
1391
1452
  const components = (manager.get("agent.components") ?? {});
1392
1453
  if (components["claude-code.mcp"]?.enabled === false) {
1393
- 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`)"));
1394
1455
  }
1395
1456
  else {
1396
- installClaudeCodeMcp(root);
1457
+ installClaudeCodeMcp(root, out);
1397
1458
  components["claude-code.mcp"] = { enabled: true, updatedAt: new Date().toISOString() };
1398
1459
  manager.set("agent.components", components);
1399
1460
  }
@@ -1410,8 +1471,8 @@ export function createInitCommand() {
1410
1471
  let codexOk = false;
1411
1472
  if ((hasCodex || (opts.local && wantCodex)) && wantCodex) {
1412
1473
  try {
1413
- installCodexSkills(root);
1414
- installCodexHooks(root);
1474
+ installCodexSkills(root, out);
1475
+ installCodexHooks(root, out);
1415
1476
  if (scope === "user")
1416
1477
  manager.set("agent.environments.codex.enabled", true);
1417
1478
  codexOk = true;
@@ -1424,10 +1485,10 @@ export function createInitCommand() {
1424
1485
  let geminiOk = false;
1425
1486
  if ((hasGemini || (opts.local && wantGemini)) && wantGemini) {
1426
1487
  try {
1427
- geminiOk = installGeminiMcp(root);
1428
- installGeminiSkills(root);
1429
- registerGeminiSkills(path.join(root, ".agents", "skills"));
1430
- installGeminiHooks(root);
1488
+ geminiOk = installGeminiMcp(root, out);
1489
+ installGeminiSkills(root, out);
1490
+ registerGeminiSkills(path.join(root, ".agents", "skills"), out);
1491
+ installGeminiHooks(root, out);
1431
1492
  if (geminiOk && scope === "user")
1432
1493
  manager.set("agent.environments.gemini.enabled", true);
1433
1494
  }
@@ -1439,10 +1500,10 @@ export function createInitCommand() {
1439
1500
  let cursorOk = false;
1440
1501
  if ((hasCursor || (opts.local && wantCursor)) && wantCursor) {
1441
1502
  try {
1442
- cursorOk = installCursorMcp(root);
1443
- installCursorHooks(root);
1444
- installCursorRules(root);
1445
- installCursorSubAgents(root);
1503
+ cursorOk = installCursorMcp(root, out);
1504
+ installCursorHooks(root, out);
1505
+ installCursorRules(root, out);
1506
+ installCursorSubAgents(root, out);
1446
1507
  if (cursorOk && scope === "user")
1447
1508
  manager.set("agent.environments.cursor.enabled", true);
1448
1509
  }
@@ -1462,11 +1523,11 @@ export function createInitCommand() {
1462
1523
  if (wantWindsurf && (hasWindsurf || opts.local)) {
1463
1524
  try {
1464
1525
  if (hasWindsurf) {
1465
- windsurfOk = installWindsurfMcp(root);
1526
+ windsurfOk = installWindsurfMcp(root, out);
1466
1527
  if (windsurfOk)
1467
1528
  manager.set("agent.environments.windsurf.enabled", true);
1468
1529
  }
1469
- installWindsurfRules(root);
1530
+ installWindsurfRules(root, out);
1470
1531
  // AGENTS.md is written below in installGlobalInstructions when
1471
1532
  // platforms.windsurf is true.
1472
1533
  if (!hasWindsurf)
@@ -1486,11 +1547,11 @@ export function createInitCommand() {
1486
1547
  if (wantContinue && (hasContinueDev || opts.local)) {
1487
1548
  try {
1488
1549
  if (hasContinueDev) {
1489
- continueOk = installContinueDevMcp(root);
1550
+ continueOk = installContinueDevMcp(root, out);
1490
1551
  if (continueOk)
1491
1552
  manager.set("agent.environments.continueDev.enabled", true);
1492
1553
  }
1493
- installContinueDevRules(root);
1554
+ installContinueDevRules(root, out);
1494
1555
  if (!hasContinueDev)
1495
1556
  continueOk = true; // local-scope success: rules only
1496
1557
  }
@@ -1506,7 +1567,7 @@ export function createInitCommand() {
1506
1567
  let aiderOk = false;
1507
1568
  if (wantAider && (hasAider || opts.local)) {
1508
1569
  try {
1509
- aiderOk = installAiderRead(root);
1570
+ aiderOk = installAiderRead(root, out);
1510
1571
  if (aiderOk && hasAider)
1511
1572
  manager.set("agent.environments.aider.enabled", true);
1512
1573
  }
@@ -1520,7 +1581,7 @@ export function createInitCommand() {
1520
1581
  let hermesOk = false;
1521
1582
  if (wantHermes && hasHermes) {
1522
1583
  try {
1523
- hermesOk = installHermesMcp(root);
1584
+ hermesOk = installHermesMcp(root, out);
1524
1585
  if (hermesOk)
1525
1586
  manager.set("agent.environments.hermes.enabled", true);
1526
1587
  }
@@ -1535,7 +1596,7 @@ export function createInitCommand() {
1535
1596
  let openCodeOk = false;
1536
1597
  if (wantOpenCode && hasOpenCode) {
1537
1598
  try {
1538
- openCodeOk = installOpenCodeMcp(root);
1599
+ openCodeOk = installOpenCodeMcp(root, out);
1539
1600
  if (openCodeOk)
1540
1601
  manager.set("agent.environments.opencode.enabled", true);
1541
1602
  }
@@ -1551,83 +1612,83 @@ export function createInitCommand() {
1551
1612
  codex: codexOk,
1552
1613
  gemini: geminiOk,
1553
1614
  windsurf: windsurfOk,
1554
- }, root, scope);
1555
- console.log();
1615
+ }, root, scope, out);
1616
+ out.info();
1556
1617
  // rf-er8a: do not report a clean success if the hook we just wrote cannot
1557
1618
  // execute and enforce. A silent 127 (or an npx-cache entrypoint) means the
1558
1619
  // gate is inert even though settings.json looks configured.
1559
1620
  const hookWarnings = claudeCodeOk ? installedHookWarnings() : [];
1560
1621
  if (hookWarnings.length > 0) {
1561
1622
  for (const w of hookWarnings)
1562
- console.log(fmt.warning(w));
1563
- 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."));
1564
1625
  }
1565
1626
  else {
1566
- console.log(fmt.success("Agent security initialized!"));
1627
+ out.info(fmt.success("Agent security initialized!"));
1567
1628
  }
1568
- console.log();
1629
+ out.info();
1569
1630
  const anyIntegration = openclawOk || claudeCodeOk || codexOk || geminiOk || cursorOk || windsurfOk || continueOk || aiderOk || hermesOk || openCodeOk;
1570
1631
  if (anyIntegration) {
1571
- console.log("Next steps:");
1632
+ out.info("Next steps:");
1572
1633
  if (openclawOk)
1573
- console.log(" - Restart OpenClaw to load skill");
1634
+ out.info(" - Restart OpenClaw to load skill");
1574
1635
  if (claudeCodeOk)
1575
- console.log(" - Restart Claude Code to load skills");
1636
+ out.info(" - Restart Claude Code to load skills");
1576
1637
  if (codexOk)
1577
- console.log(" - Restart Codex CLI to load skills");
1638
+ out.info(" - Restart Codex CLI to load skills");
1578
1639
  if (geminiOk)
1579
- console.log(" - Restart Gemini CLI to load MCP server");
1640
+ out.info(" - Restart Gemini CLI to load MCP server");
1580
1641
  if (cursorOk)
1581
- console.log(" - Restart Cursor to load MCP server");
1642
+ out.info(" - Restart Cursor to load MCP server");
1582
1643
  if (windsurfOk)
1583
- console.log(" - Restart Windsurf to load MCP server");
1644
+ out.info(" - Restart Windsurf to load MCP server");
1584
1645
  if (continueOk)
1585
- console.log(" - Restart Continue.dev to load MCP server");
1646
+ out.info(" - Restart Continue.dev to load MCP server");
1586
1647
  if (aiderOk)
1587
- 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:");
1588
1649
  if (hermesOk)
1589
- console.log(" - Restart Hermes to load MCP server");
1650
+ out.info(" - Restart Hermes to load MCP server");
1590
1651
  if (openCodeOk)
1591
- console.log(" - Restart OpenCode to load MCP server");
1652
+ out.info(" - Restart OpenCode to load MCP server");
1592
1653
  }
1593
1654
  else if (scope === "project") {
1594
- console.log("No integrations were installed. In --local mode, pass one or more opt-in flags:");
1595
- console.log(" rafter agent init --local --with-claude-code");
1596
- console.log(" rafter agent init --local --with-codex");
1597
- console.log(" rafter agent init --local --with-gemini");
1598
- 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");
1599
1660
  }
1600
1661
  else if (detected.length > 0) {
1601
- console.log("No integrations were installed. To install, re-run with opt-in flags:");
1602
- 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");
1603
1664
  if (hasClaudeCode)
1604
- console.log(" rafter agent init --with-claude-code # Claude Code only");
1665
+ out.info(" rafter agent init --with-claude-code # Claude Code only");
1605
1666
  if (hasOpenClaw)
1606
- console.log(" rafter agent init --with-openclaw # OpenClaw only");
1667
+ out.info(" rafter agent init --with-openclaw # OpenClaw only");
1607
1668
  if (hasCodex)
1608
- console.log(" rafter agent init --with-codex # Codex CLI only");
1669
+ out.info(" rafter agent init --with-codex # Codex CLI only");
1609
1670
  if (hasGemini)
1610
- console.log(" rafter agent init --with-gemini # Gemini CLI only");
1671
+ out.info(" rafter agent init --with-gemini # Gemini CLI only");
1611
1672
  if (hasCursor)
1612
- console.log(" rafter agent init --with-cursor # Cursor only");
1673
+ out.info(" rafter agent init --with-cursor # Cursor only");
1613
1674
  if (hasWindsurf)
1614
- console.log(" rafter agent init --with-windsurf # Windsurf only");
1675
+ out.info(" rafter agent init --with-windsurf # Windsurf only");
1615
1676
  if (hasContinueDev)
1616
- console.log(" rafter agent init --with-continue # Continue.dev only");
1677
+ out.info(" rafter agent init --with-continue # Continue.dev only");
1617
1678
  if (hasAider)
1618
- console.log(" rafter agent init --with-aider # Aider only");
1679
+ out.info(" rafter agent init --with-aider # Aider only");
1619
1680
  if (hasHermes)
1620
- console.log(" rafter agent init --with-hermes # Hermes only");
1681
+ out.info(" rafter agent init --with-hermes # Hermes only");
1621
1682
  if (hasOpenCode)
1622
- console.log(" rafter agent init --with-opencode # OpenCode only");
1683
+ out.info(" rafter agent init --with-opencode # OpenCode only");
1623
1684
  }
1624
1685
  else {
1625
- 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>.");
1626
1687
  }
1627
- console.log();
1628
- console.log(" - Run: rafter secrets . (test secret scanning)");
1629
- console.log(" - Configure: rafter agent config show");
1630
- 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();
1631
1692
  // Warn if a different rafter version shadows this one on PATH
1632
1693
  try {
1633
1694
  const _require = createRequire(import.meta.url);
@@ -1638,9 +1699,9 @@ export function createInitCommand() {
1638
1699
  stdio: ["pipe", "pipe", "ignore"],
1639
1700
  }).trim();
1640
1701
  if (pathVersion && pathVersion !== thisVersion && !pathVersion.includes(thisVersion)) {
1641
- console.log(fmt.warning(`PATH version mismatch: 'rafter --version' reports ${pathVersion}, but this install is ${thisVersion}.`));
1642
- console.log(fmt.info("Another rafter binary may be shadowing this one. Check: which rafter"));
1643
- 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();
1644
1705
  }
1645
1706
  }
1646
1707
  catch {