@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
@@ -12,6 +12,7 @@ export function createInstallHookCommand() {
12
12
  .description("Install git hook to scan for secrets")
13
13
  .option("--global", "Install globally for all repos (via git config)")
14
14
  .option("--push", "Install pre-push hook instead of pre-commit")
15
+ .option("--quiet", "Suppress informational and success output (errors still go to stderr)", false)
15
16
  .action(async (opts) => {
16
17
  await installHook(opts);
17
18
  });
@@ -20,10 +21,10 @@ async function installHook(opts) {
20
21
  const hookName = opts.push ? "pre-push" : "pre-commit";
21
22
  const templateName = opts.push ? "pre-push-hook.sh" : "pre-commit-hook.sh";
22
23
  if (opts.global) {
23
- await installGlobalHook(hookName, templateName);
24
+ await installGlobalHook(hookName, templateName, opts.quiet);
24
25
  }
25
26
  else {
26
- await installLocalHook(hookName, templateName);
27
+ await installLocalHook(hookName, templateName, opts.quiet);
27
28
  }
28
29
  }
29
30
  function getTemplatePath(templateName) {
@@ -38,7 +39,7 @@ function getTemplatePath(templateName) {
38
39
  /**
39
40
  * Install hook for current repository
40
41
  */
41
- async function installLocalHook(hookName, templateName) {
42
+ async function installLocalHook(hookName, templateName, quiet) {
42
43
  try {
43
44
  execSync("git rev-parse --git-dir", { stdio: "pipe" });
44
45
  }
@@ -57,16 +58,23 @@ async function installLocalHook(hookName, templateName) {
57
58
  const existing = fs.readFileSync(hookPath, "utf-8");
58
59
  const marker = hookName === "pre-push" ? "Rafter Security Pre-Push Hook" : "Rafter Security Pre-Commit Hook";
59
60
  if (existing.includes(marker)) {
60
- console.log(fmt.success(`Rafter ${hookName} hook already installed`));
61
+ if (!quiet) {
62
+ console.log(fmt.success(`Rafter ${hookName} hook already installed`));
63
+ }
61
64
  return;
62
65
  }
63
66
  const backupPath = `${hookPath}.backup-${Date.now()}`;
64
67
  fs.copyFileSync(hookPath, backupPath);
65
- console.log(fmt.info(`Backed up existing hook to: ${path.basename(backupPath)}`));
68
+ if (!quiet) {
69
+ console.log(fmt.info(`Backed up existing hook to: ${path.basename(backupPath)}`));
70
+ }
66
71
  }
67
72
  const hookContent = fs.readFileSync(getTemplatePath(templateName), "utf-8");
68
73
  fs.writeFileSync(hookPath, hookContent, "utf-8");
69
74
  fs.chmodSync(hookPath, 0o755);
75
+ if (quiet) {
76
+ return;
77
+ }
70
78
  console.log(fmt.success(`Installed Rafter ${hookName} hook`));
71
79
  console.log(` Location: ${hookPath}`);
72
80
  console.log();
@@ -87,7 +95,7 @@ async function installLocalHook(hookName, templateName) {
87
95
  /**
88
96
  * Install hook globally for all repositories
89
97
  */
90
- async function installGlobalHook(hookName, templateName) {
98
+ async function installGlobalHook(hookName, templateName, quiet) {
91
99
  const homeDir = os.homedir();
92
100
  if (!homeDir) {
93
101
  console.error(fmt.error("Could not determine home directory"));
@@ -103,6 +111,9 @@ async function installGlobalHook(hookName, templateName) {
103
111
  fs.chmodSync(hookPath, 0o755);
104
112
  try {
105
113
  execFileSync("git", ["config", "--global", "core.hooksPath", globalHooksDir], { stdio: "pipe" });
114
+ if (quiet) {
115
+ return;
116
+ }
106
117
  console.log(fmt.success(`Installed Rafter ${hookName} hook globally`));
107
118
  console.log(` Location: ${hookPath}`);
108
119
  console.log(` Git config: core.hooksPath = ${globalHooksDir}`);