@rafter-security/cli 0.5.1 → 0.5.3
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.
- package/README.md +1 -1
- package/dist/commands/agent/audit-skill.js +6 -0
- package/dist/commands/agent/index.js +4 -0
- package/dist/commands/agent/init.js +81 -32
- package/dist/commands/agent/install-hook.js +2 -1
- package/dist/commands/agent/scan.js +70 -5
- package/dist/commands/agent/status.js +115 -0
- package/dist/commands/agent/verify.js +117 -0
- package/dist/commands/completion.js +170 -0
- package/dist/commands/hook/index.js +2 -0
- package/dist/commands/hook/posttool.js +73 -0
- package/dist/core/config-manager.js +16 -0
- package/dist/core/custom-patterns.js +157 -0
- package/dist/core/risk-rules.js +6 -1
- package/dist/index.js +4 -1
- package/dist/scanners/regex-scanner.js +7 -11
- package/dist/utils/binary-manager.js +100 -7
- package/dist/utils/skill-manager.js +22 -9
- package/package.json +1 -1
- package/resources/rafter-security-skill.md +7 -0
|
@@ -151,17 +151,17 @@ export class SkillManager {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
* Install Rafter Security skill to OpenClaw
|
|
154
|
+
* Install Rafter Security skill to OpenClaw (verbose result)
|
|
155
155
|
*/
|
|
156
|
-
async
|
|
157
|
-
if (!this.isOpenClawInstalled()) {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
156
|
+
async installRafterSkillVerbose(force = false) {
|
|
160
157
|
const skillPath = this.getRafterSkillPath();
|
|
161
158
|
const sourcePath = this.getRafterSkillSourcePath();
|
|
159
|
+
if (!this.isOpenClawInstalled()) {
|
|
160
|
+
return { ok: false, sourcePath, destPath: skillPath, error: `OpenClaw skills directory not found: ${this.getOpenClawSkillsDir()}` };
|
|
161
|
+
}
|
|
162
162
|
// Check if already installed and not forcing
|
|
163
163
|
if (!force && this.isRafterSkillInstalled()) {
|
|
164
|
-
return true;
|
|
164
|
+
return { ok: true, sourcePath, destPath: skillPath };
|
|
165
165
|
}
|
|
166
166
|
try {
|
|
167
167
|
// Ensure skills directory exists
|
|
@@ -169,6 +169,10 @@ export class SkillManager {
|
|
|
169
169
|
if (!fs.existsSync(skillsDir)) {
|
|
170
170
|
fs.mkdirSync(skillsDir, { recursive: true });
|
|
171
171
|
}
|
|
172
|
+
// Verify source exists
|
|
173
|
+
if (!fs.existsSync(sourcePath)) {
|
|
174
|
+
return { ok: false, sourcePath, destPath: skillPath, error: `Source skill file not found: ${sourcePath}` };
|
|
175
|
+
}
|
|
172
176
|
// Copy skill file
|
|
173
177
|
const sourceContent = fs.readFileSync(sourcePath, "utf-8");
|
|
174
178
|
fs.writeFileSync(skillPath, sourceContent, "utf-8");
|
|
@@ -180,12 +184,21 @@ export class SkillManager {
|
|
|
180
184
|
}
|
|
181
185
|
// Migrate old skill-auditor if present
|
|
182
186
|
await this.migrateOldSkill();
|
|
183
|
-
return true;
|
|
187
|
+
return { ok: true, sourcePath, destPath: skillPath };
|
|
184
188
|
}
|
|
185
189
|
catch (e) {
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
return { ok: false, sourcePath, destPath: skillPath, error: String(e) };
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Install Rafter Security skill to OpenClaw
|
|
195
|
+
*/
|
|
196
|
+
async installRafterSkill(force = false) {
|
|
197
|
+
const result = await this.installRafterSkillVerbose(force);
|
|
198
|
+
if (!result.ok && result.error) {
|
|
199
|
+
console.error(`Failed to install Rafter Security skill: ${result.error}`);
|
|
188
200
|
}
|
|
201
|
+
return result.ok;
|
|
189
202
|
}
|
|
190
203
|
/**
|
|
191
204
|
* Backup current skill before updating
|
package/package.json
CHANGED
|
@@ -46,6 +46,13 @@ rafter agent scan <path>
|
|
|
46
46
|
- Private keys (RSA, SSH, etc.)
|
|
47
47
|
- 21+ secret patterns
|
|
48
48
|
|
|
49
|
+
**Exit codes:**
|
|
50
|
+
- `0` — clean, no secrets
|
|
51
|
+
- `1` — secrets found
|
|
52
|
+
- `2` — runtime error (path not found, not a git repo)
|
|
53
|
+
|
|
54
|
+
**JSON output** (`--json`): Array of `{file, matches[]}` objects. Each match contains `pattern` (name, severity, description), `line`, `column`, and `redacted` value. Raw secrets are never included.
|
|
55
|
+
|
|
49
56
|
---
|
|
50
57
|
|
|
51
58
|
### /rafter-bash
|