@rune-kit/rune 2.1.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.
- package/LICENSE +21 -0
- package/README.md +357 -0
- package/agents/.gitkeep +0 -0
- package/agents/architect.md +29 -0
- package/agents/asset-creator.md +11 -0
- package/agents/audit.md +11 -0
- package/agents/autopsy.md +11 -0
- package/agents/brainstorm.md +11 -0
- package/agents/browser-pilot.md +11 -0
- package/agents/coder.md +29 -0
- package/agents/completion-gate.md +11 -0
- package/agents/constraint-check.md +11 -0
- package/agents/context-engine.md +11 -0
- package/agents/cook.md +11 -0
- package/agents/db.md +11 -0
- package/agents/debug.md +11 -0
- package/agents/dependency-doctor.md +11 -0
- package/agents/deploy.md +11 -0
- package/agents/design.md +11 -0
- package/agents/docs-seeker.md +11 -0
- package/agents/fix.md +11 -0
- package/agents/hallucination-guard.md +11 -0
- package/agents/incident.md +11 -0
- package/agents/integrity-check.md +11 -0
- package/agents/journal.md +11 -0
- package/agents/launch.md +11 -0
- package/agents/logic-guardian.md +11 -0
- package/agents/marketing.md +11 -0
- package/agents/onboard.md +11 -0
- package/agents/perf.md +11 -0
- package/agents/plan.md +11 -0
- package/agents/preflight.md +11 -0
- package/agents/problem-solver.md +11 -0
- package/agents/rescue.md +11 -0
- package/agents/research.md +11 -0
- package/agents/researcher.md +29 -0
- package/agents/review-intake.md +11 -0
- package/agents/review.md +11 -0
- package/agents/reviewer.md +28 -0
- package/agents/safeguard.md +11 -0
- package/agents/sast.md +11 -0
- package/agents/scanner.md +28 -0
- package/agents/scope-guard.md +11 -0
- package/agents/scout.md +11 -0
- package/agents/sentinel.md +11 -0
- package/agents/sequential-thinking.md +11 -0
- package/agents/session-bridge.md +11 -0
- package/agents/skill-forge.md +11 -0
- package/agents/skill-router.md +11 -0
- package/agents/surgeon.md +11 -0
- package/agents/team.md +11 -0
- package/agents/test.md +11 -0
- package/agents/trend-scout.md +11 -0
- package/agents/verification.md +11 -0
- package/agents/video-creator.md +11 -0
- package/agents/watchdog.md +11 -0
- package/agents/worktree.md +11 -0
- package/commands/.gitkeep +0 -0
- package/commands/rune.md +168 -0
- package/compiler/__tests__/openclaw-adapter.test.js +140 -0
- package/compiler/__tests__/parser.test.js +55 -0
- package/compiler/adapters/antigravity.js +59 -0
- package/compiler/adapters/claude.js +37 -0
- package/compiler/adapters/cursor.js +67 -0
- package/compiler/adapters/generic.js +60 -0
- package/compiler/adapters/index.js +45 -0
- package/compiler/adapters/openclaw.js +150 -0
- package/compiler/adapters/windsurf.js +60 -0
- package/compiler/bin/rune.js +288 -0
- package/compiler/doctor.js +153 -0
- package/compiler/emitter.js +240 -0
- package/compiler/parser.js +208 -0
- package/compiler/transformer.js +69 -0
- package/compiler/transforms/branding.js +27 -0
- package/compiler/transforms/cross-references.js +29 -0
- package/compiler/transforms/frontmatter.js +38 -0
- package/compiler/transforms/hooks.js +68 -0
- package/compiler/transforms/subagents.js +36 -0
- package/compiler/transforms/tool-names.js +60 -0
- package/contexts/dev.md +34 -0
- package/contexts/research.md +43 -0
- package/contexts/review.md +55 -0
- package/extensions/ai-ml/PACK.md +517 -0
- package/extensions/analytics/PACK.md +557 -0
- package/extensions/backend/PACK.md +678 -0
- package/extensions/chrome-ext/PACK.md +995 -0
- package/extensions/content/PACK.md +381 -0
- package/extensions/devops/PACK.md +520 -0
- package/extensions/ecommerce/PACK.md +280 -0
- package/extensions/gamedev/PACK.md +393 -0
- package/extensions/mobile/PACK.md +273 -0
- package/extensions/saas/PACK.md +805 -0
- package/extensions/security/PACK.md +536 -0
- package/extensions/trading/PACK.md +597 -0
- package/extensions/ui/PACK.md +947 -0
- package/package.json +47 -0
- package/skills/.gitkeep +0 -0
- package/skills/adversary/SKILL.md +271 -0
- package/skills/asset-creator/SKILL.md +157 -0
- package/skills/audit/SKILL.md +466 -0
- package/skills/autopsy/SKILL.md +200 -0
- package/skills/ba/SKILL.md +279 -0
- package/skills/brainstorm/SKILL.md +266 -0
- package/skills/browser-pilot/SKILL.md +168 -0
- package/skills/completion-gate/SKILL.md +151 -0
- package/skills/constraint-check/SKILL.md +165 -0
- package/skills/context-engine/SKILL.md +176 -0
- package/skills/cook/SKILL.md +636 -0
- package/skills/db/SKILL.md +256 -0
- package/skills/debug/SKILL.md +240 -0
- package/skills/dependency-doctor/SKILL.md +235 -0
- package/skills/deploy/SKILL.md +174 -0
- package/skills/design/DESIGN-REFERENCE.md +365 -0
- package/skills/design/SKILL.md +462 -0
- package/skills/doc-processor/SKILL.md +254 -0
- package/skills/docs/SKILL.md +336 -0
- package/skills/docs-seeker/SKILL.md +166 -0
- package/skills/fix/SKILL.md +192 -0
- package/skills/git/SKILL.md +285 -0
- package/skills/hallucination-guard/SKILL.md +204 -0
- package/skills/incident/SKILL.md +241 -0
- package/skills/integrity-check/SKILL.md +169 -0
- package/skills/journal/SKILL.md +190 -0
- package/skills/launch/SKILL.md +330 -0
- package/skills/logic-guardian/SKILL.md +240 -0
- package/skills/marketing/SKILL.md +229 -0
- package/skills/mcp-builder/SKILL.md +311 -0
- package/skills/onboard/SKILL.md +298 -0
- package/skills/perf/SKILL.md +297 -0
- package/skills/plan/SKILL.md +520 -0
- package/skills/preflight/SKILL.md +231 -0
- package/skills/problem-solver/SKILL.md +284 -0
- package/skills/rescue/SKILL.md +434 -0
- package/skills/research/SKILL.md +122 -0
- package/skills/review/SKILL.md +354 -0
- package/skills/review-intake/SKILL.md +222 -0
- package/skills/safeguard/SKILL.md +188 -0
- package/skills/sast/SKILL.md +190 -0
- package/skills/scaffold/SKILL.md +276 -0
- package/skills/scope-guard/SKILL.md +150 -0
- package/skills/scout/SKILL.md +232 -0
- package/skills/sentinel/SKILL.md +320 -0
- package/skills/sentinel-env/SKILL.md +226 -0
- package/skills/sequential-thinking/SKILL.md +234 -0
- package/skills/session-bridge/SKILL.md +287 -0
- package/skills/skill-forge/SKILL.md +317 -0
- package/skills/skill-router/SKILL.md +267 -0
- package/skills/surgeon/SKILL.md +203 -0
- package/skills/team/SKILL.md +397 -0
- package/skills/test/SKILL.md +271 -0
- package/skills/trend-scout/SKILL.md +145 -0
- package/skills/verification/SKILL.md +201 -0
- package/skills/video-creator/SKILL.md +201 -0
- package/skills/watchdog/SKILL.md +166 -0
- package/skills/worktree/SKILL.md +140 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: safeguard
|
|
3
|
+
description: Build safety nets before refactoring. Creates characterization tests, boundary markers, config freezes, and rollback points.
|
|
4
|
+
metadata:
|
|
5
|
+
author: runedev
|
|
6
|
+
version: "0.2.0"
|
|
7
|
+
layer: L2
|
|
8
|
+
model: sonnet
|
|
9
|
+
group: rescue
|
|
10
|
+
tools: "Read, Write, Edit, Bash, Glob, Grep"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# safeguard
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Build safety nets before any refactoring begins. Safeguard creates characterization tests that capture current behavior, adds boundary markers to distinguish legacy from new code, freezes config files, and creates git rollback points. Nothing gets refactored without safeguard running first.
|
|
18
|
+
|
|
19
|
+
<HARD-GATE>
|
|
20
|
+
Characterization tests MUST pass on the current (unmodified) code before any refactoring starts. If they do not pass, safeguard is not complete.
|
|
21
|
+
</HARD-GATE>
|
|
22
|
+
|
|
23
|
+
## Called By (inbound)
|
|
24
|
+
|
|
25
|
+
- `rescue` (L1): Phase 1 SAFETY NET — build protection before surgery
|
|
26
|
+
- `surgeon` (L2): untested module found during surgery
|
|
27
|
+
|
|
28
|
+
## Calls (outbound)
|
|
29
|
+
|
|
30
|
+
- `scout` (L2): find all entry points and public interfaces of the target module
|
|
31
|
+
- `test` (L2): write and run characterization tests for the target module
|
|
32
|
+
- `verification` (L3): verify characterization tests pass on current code
|
|
33
|
+
|
|
34
|
+
## Cross-Hub Connections
|
|
35
|
+
|
|
36
|
+
- `surgeon` → `safeguard` — untested module found during surgery
|
|
37
|
+
|
|
38
|
+
## Execution Steps
|
|
39
|
+
|
|
40
|
+
### Step 1 — Identify module boundaries
|
|
41
|
+
|
|
42
|
+
Call `rune:scout` targeting the specific module. Ask scout to return:
|
|
43
|
+
- All public functions, classes, and exported symbols
|
|
44
|
+
- All files that import from this module (consumers)
|
|
45
|
+
- All files this module imports from (dependencies)
|
|
46
|
+
- Existing test files for this module (if any)
|
|
47
|
+
|
|
48
|
+
Use `Read` to open the module entry file and confirm the public interface.
|
|
49
|
+
|
|
50
|
+
### Step 2 — Write characterization tests
|
|
51
|
+
|
|
52
|
+
Create a test file at `tests/char/<module-name>.test.ts` (or `.js`, `.py` matching project convention).
|
|
53
|
+
|
|
54
|
+
Use `Write` to create the characterization test file. Rules for characterization tests:
|
|
55
|
+
- Tests MUST capture what the code CURRENTLY does, not what it should do
|
|
56
|
+
- Include edge cases that currently produce surprising output — test for that actual output
|
|
57
|
+
- Do NOT fix bugs in characterization tests — if the current code returns wrong data, test for that wrong data
|
|
58
|
+
- Cover every public function in the module
|
|
59
|
+
- Include at least one integration test calling the module as an external consumer would
|
|
60
|
+
|
|
61
|
+
Example structure:
|
|
62
|
+
```typescript
|
|
63
|
+
// tests/char/<module>.test.ts
|
|
64
|
+
// CHARACTERIZATION TESTS — DO NOT MODIFY without running safeguard again
|
|
65
|
+
// These tests capture existing behavior as of: [date]
|
|
66
|
+
|
|
67
|
+
describe('<module> — characterization', () => {
|
|
68
|
+
it('existing behavior: [function] with [input] returns [actual output]', () => {
|
|
69
|
+
// ...
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Step 3 — Add boundary markers
|
|
75
|
+
|
|
76
|
+
Use `Edit` to add boundary comments at the top of the module file and at key function boundaries:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// @legacy — rune-safeguard [date] — do not refactor without characterization tests passing
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For functions flagged by autopsy as high-risk, add:
|
|
83
|
+
```typescript
|
|
84
|
+
// @do-not-touch — coupled to [module], change both or neither
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
For planned new implementations, mark insertion points:
|
|
88
|
+
```typescript
|
|
89
|
+
// @bridge — new-v2 will replace this interface
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Step 4 — Config freeze
|
|
93
|
+
|
|
94
|
+
Use `Bash` to record current config state:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
mkdir -p .rune
|
|
98
|
+
cp tsconfig.json .rune/tsconfig.frozen.json 2>/dev/null || true
|
|
99
|
+
cp .eslintrc* .rune/ 2>/dev/null || true
|
|
100
|
+
cp package-lock.json .rune/package-lock.frozen.json 2>/dev/null || true
|
|
101
|
+
echo "Config frozen at $(date)" > .rune/freeze.log
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This preserves the baseline config so surgery can be verified against it.
|
|
105
|
+
|
|
106
|
+
### Step 5 — Create rollback point
|
|
107
|
+
|
|
108
|
+
Use `Bash` to create a git tag:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
git add -A
|
|
112
|
+
git commit -m "chore: safeguard checkpoint before [module] surgery" --allow-empty
|
|
113
|
+
git tag rune-safeguard-<module>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Replace `<module>` with the actual module name. Confirm the tag was created.
|
|
117
|
+
|
|
118
|
+
### Step 6 — Verify
|
|
119
|
+
|
|
120
|
+
Call `rune:verification` and explicitly pass the characterization test file path.
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
If characterization tests fail on the CURRENT (unchanged) code → STOP.
|
|
124
|
+
Fix the tests to match actual behavior before proceeding.
|
|
125
|
+
Characterization tests MUST pass on current code. This is non-negotiable.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Only after verification passes, declare the safety net complete.
|
|
129
|
+
|
|
130
|
+
## Output Format
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
## Safeguard Report
|
|
134
|
+
- **Module**: [module name]
|
|
135
|
+
- **Tests Added**: [count] characterization tests
|
|
136
|
+
- **Coverage**: [before]% → [after]%
|
|
137
|
+
- **Markers Added**: [count] boundary comments
|
|
138
|
+
- **Rollback Tag**: rune-safeguard-[module]
|
|
139
|
+
- **Config Frozen**: [list of files in .rune/]
|
|
140
|
+
- **Hard Gate**: PASSED — all characterization tests pass on current code
|
|
141
|
+
|
|
142
|
+
### Characterization Tests
|
|
143
|
+
- `tests/char/[module].test.ts` — [count] tests capturing current behavior
|
|
144
|
+
|
|
145
|
+
### Boundary Markers
|
|
146
|
+
- `@legacy`: [count] files marked
|
|
147
|
+
- `@do-not-touch`: [count] files protected
|
|
148
|
+
- `@bridge`: [count] insertion points marked
|
|
149
|
+
|
|
150
|
+
### Config Frozen
|
|
151
|
+
- [list of locked config files in .rune/]
|
|
152
|
+
|
|
153
|
+
### Next Step
|
|
154
|
+
Safe to proceed with: `rune:surgeon` targeting [module]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Constraints
|
|
158
|
+
|
|
159
|
+
1. MUST write characterization tests that pass on CURRENT code before any refactoring
|
|
160
|
+
2. MUST NOT proceed to surgery if characterization tests fail — the safety net is broken
|
|
161
|
+
3. MUST cover critical paths identified by autopsy — not just easy-to-test functions
|
|
162
|
+
4. MUST verify tests are meaningful — tests that always pass regardless of code are useless
|
|
163
|
+
|
|
164
|
+
## Sharp Edges
|
|
165
|
+
|
|
166
|
+
Known failure modes for this skill. Check these before declaring done.
|
|
167
|
+
|
|
168
|
+
| Failure Mode | Severity | Mitigation |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| Characterization tests that always pass regardless of code (trivial asserts) | CRITICAL | Constraint 4: tests must fail if the module is deleted or its logic is changed |
|
|
171
|
+
| Not covering critical paths identified by autopsy | HIGH | Constraint 3: cover high-risk functions first — autopsy flags which ones |
|
|
172
|
+
| Characterization tests written to "correct" behavior instead of current behavior | HIGH | Tests capture ACTUAL output, including bugs — do not fix behavior in the tests |
|
|
173
|
+
| Skipping config freeze step | MEDIUM | Step 4 is required — baseline config needed for comparison after surgery |
|
|
174
|
+
| No git tag created before declaring safeguard complete | MEDIUM | Tag `rune-safeguard-<module>` must exist before surgery begins |
|
|
175
|
+
|
|
176
|
+
## Done When
|
|
177
|
+
|
|
178
|
+
- Module boundaries identified via scout (public functions, consumers, dependencies)
|
|
179
|
+
- Characterization tests written for all public functions
|
|
180
|
+
- Tests PASS on current (unmodified) code — HARD-GATE verified
|
|
181
|
+
- Boundary markers added (@legacy, @bridge, @do-not-touch)
|
|
182
|
+
- Config files frozen to .rune/
|
|
183
|
+
- Git tag `rune-safeguard-<module>` created
|
|
184
|
+
- Safeguard Report emitted with test count, coverage, and rollback tag
|
|
185
|
+
|
|
186
|
+
## Cost Profile
|
|
187
|
+
|
|
188
|
+
~2000-5000 tokens input, ~1000-2000 tokens output. Sonnet for test writing quality.
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sast
|
|
3
|
+
description: "Static analysis tool runner. Wraps ESLint, Semgrep, Bandit, Clippy, and language-specific analyzers with unified severity output. Use when deeper code analysis needed beyond pattern matching."
|
|
4
|
+
metadata:
|
|
5
|
+
author: runedev
|
|
6
|
+
version: "1.0.0"
|
|
7
|
+
layer: L3
|
|
8
|
+
model: haiku
|
|
9
|
+
group: validation
|
|
10
|
+
tools: "Read, Bash, Glob, Grep"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# sast
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Unified static analysis tool runner. While `sentinel` does regex-based security pattern matching and `verification` runs lint/type/test/build, SAST goes deeper — running dedicated static analysis tools that understand data flow, taint tracking, and language-specific vulnerability patterns.
|
|
18
|
+
|
|
19
|
+
Sentinel catches obvious patterns (hardcoded secrets, SQL string concat). SAST catches subtle ones (tainted data flowing through 3 function calls to a sink, unsafe deserialization behind a wrapper).
|
|
20
|
+
|
|
21
|
+
## Triggers
|
|
22
|
+
|
|
23
|
+
- Called by `sentinel` (L2) when deep analysis needed beyond pattern matching
|
|
24
|
+
- Called by `audit` (L2) during security dimension assessment
|
|
25
|
+
- Called by `cook` (L1) on security-sensitive code (auth, crypto, payments)
|
|
26
|
+
- `/rune sast` — manual static analysis scan
|
|
27
|
+
|
|
28
|
+
## Calls (outbound)
|
|
29
|
+
|
|
30
|
+
None — pure runner using Bash for all tools.
|
|
31
|
+
|
|
32
|
+
## Called By (inbound)
|
|
33
|
+
|
|
34
|
+
- `sentinel` (L2): deep analysis beyond regex patterns
|
|
35
|
+
- `audit` (L2): security dimension in full audit
|
|
36
|
+
- `cook` (L1): security-sensitive code paths
|
|
37
|
+
- `review` (L2): when security patterns detected in diff
|
|
38
|
+
|
|
39
|
+
## Execution
|
|
40
|
+
|
|
41
|
+
### Step 1 — Detect Language and Tools
|
|
42
|
+
|
|
43
|
+
Use `Glob` to detect project language and available tools:
|
|
44
|
+
|
|
45
|
+
| Indicator | Language | Primary Tool | Fallback |
|
|
46
|
+
|---|---|---|---|
|
|
47
|
+
| `package.json` | JavaScript/TypeScript | `npx eslint --ext .js,.ts,.tsx` | `npx oxlint` |
|
|
48
|
+
| `tsconfig.json` | TypeScript | `npx tsc --noEmit` + ESLint | — |
|
|
49
|
+
| `pyproject.toml` / `setup.py` | Python | `bandit -r . -f json` | `ruff check --select S .` |
|
|
50
|
+
| `Cargo.toml` | Rust | `cargo clippy -- -D warnings` | `cargo audit` |
|
|
51
|
+
| `go.mod` | Go | `govulncheck ./...` | `go vet ./...` |
|
|
52
|
+
| `.semgrep.yml` / any | Any | `semgrep --config auto` | — |
|
|
53
|
+
|
|
54
|
+
Check tool availability:
|
|
55
|
+
```
|
|
56
|
+
Bash: command -v <tool> 2>/dev/null
|
|
57
|
+
→ If not installed: mark as SKIP with install instruction
|
|
58
|
+
→ If installed: proceed with scan
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Step 2 — Run Primary Analysis
|
|
62
|
+
|
|
63
|
+
Run the detected primary tool on changed files (or full project if no diff):
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
For each available tool:
|
|
67
|
+
Bash: <tool command> 2>&1
|
|
68
|
+
→ Capture stdout + stderr
|
|
69
|
+
→ Parse output into unified format (see Step 4)
|
|
70
|
+
→ Record: exit code, finding count, execution time
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Tool-specific commands:**
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# ESLint (JS/TS) — security-focused rules
|
|
77
|
+
npx eslint --no-eslintrc --rule '{"no-eval": "error", "no-implied-eval": "error"}' <files>
|
|
78
|
+
|
|
79
|
+
# Bandit (Python) — security scanner
|
|
80
|
+
bandit -r <path> -f json -ll # medium+ severity only
|
|
81
|
+
|
|
82
|
+
# Semgrep (any language) — pattern-based analysis
|
|
83
|
+
semgrep --config auto --json --severity ERROR --severity WARNING <path>
|
|
84
|
+
|
|
85
|
+
# Clippy (Rust) — lint + security
|
|
86
|
+
cargo clippy --all-targets -- -D warnings -W clippy::unwrap_used
|
|
87
|
+
|
|
88
|
+
# govulncheck (Go) — vulnerability check
|
|
89
|
+
govulncheck ./...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Step 3 — Run Semgrep (If Available)
|
|
93
|
+
|
|
94
|
+
Semgrep provides cross-language analysis with community rules. Run regardless of primary language tool:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
IF semgrep is installed:
|
|
98
|
+
Bash: semgrep --config auto --json <changed-files-or-project>
|
|
99
|
+
→ Parse JSON output
|
|
100
|
+
→ Map severity: error→BLOCK, warning→WARN, info→INFO
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If semgrep is NOT installed, log INFO: "semgrep not installed — install with `pip install semgrep` for deeper cross-language analysis."
|
|
104
|
+
|
|
105
|
+
### Step 4 — Normalize to Unified Format
|
|
106
|
+
|
|
107
|
+
Map all tool outputs to unified severity:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
BLOCK (must fix):
|
|
111
|
+
- Bandit: HIGH confidence + HIGH severity
|
|
112
|
+
- ESLint: error-level security rules
|
|
113
|
+
- Semgrep: ERROR severity
|
|
114
|
+
- Clippy: deny-level warnings
|
|
115
|
+
- govulncheck: any known vulnerability
|
|
116
|
+
|
|
117
|
+
WARN (should fix):
|
|
118
|
+
- Bandit: MEDIUM confidence or MEDIUM severity
|
|
119
|
+
- ESLint: warning-level rules
|
|
120
|
+
- Semgrep: WARNING severity
|
|
121
|
+
- Clippy: warn-level suggestions
|
|
122
|
+
|
|
123
|
+
INFO (informational):
|
|
124
|
+
- Bandit: LOW severity
|
|
125
|
+
- Semgrep: INFO severity
|
|
126
|
+
- Style/convention suggestions
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Step 5 — Report
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
## SAST Report
|
|
133
|
+
- **Status**: PASS | WARN | BLOCK
|
|
134
|
+
- **Tools Run**: [list with versions]
|
|
135
|
+
- **Tools Skipped**: [list with install instructions]
|
|
136
|
+
- **Files Scanned**: [count]
|
|
137
|
+
- **Findings**: [count by severity]
|
|
138
|
+
|
|
139
|
+
### BLOCK (must fix)
|
|
140
|
+
- `path/to/file.py:42` — [tool] Possible SQL injection via string formatting (B608)
|
|
141
|
+
- `path/to/auth.ts:15` — [semgrep] JWT token not verified before use
|
|
142
|
+
|
|
143
|
+
### WARN (should fix)
|
|
144
|
+
- `path/to/utils.py:88` — [bandit] Use of `subprocess` with shell=True (B602)
|
|
145
|
+
|
|
146
|
+
### INFO
|
|
147
|
+
- `path/to/config.ts:10` — [eslint] Prefer `const` over `let` for unchanging variable
|
|
148
|
+
|
|
149
|
+
### Tool Coverage
|
|
150
|
+
| Tool | Status | Findings | Duration |
|
|
151
|
+
|------|--------|----------|----------|
|
|
152
|
+
| ESLint | RAN | 2 WARN | 1.2s |
|
|
153
|
+
| Semgrep | SKIPPED | — | — (not installed) |
|
|
154
|
+
| Bandit | N/A | — | — (not Python) |
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Output Format
|
|
158
|
+
|
|
159
|
+
SAST Report with status (PASS/WARN/BLOCK), tools run, files scanned, findings by severity (BLOCK/WARN/INFO), and tool coverage table. See Step 5 Report above for full template.
|
|
160
|
+
|
|
161
|
+
## Constraints
|
|
162
|
+
|
|
163
|
+
1. MUST run all available tools for the detected language — not just one
|
|
164
|
+
2. MUST attempt Semgrep regardless of primary language (if installed)
|
|
165
|
+
3. MUST normalize all outputs to unified BLOCK/WARN/INFO — don't dump raw tool output
|
|
166
|
+
4. MUST show install instructions for missing tools — not silently skip
|
|
167
|
+
5. MUST report which tools ran and which were skipped — transparency
|
|
168
|
+
6. MUST NOT block on missing tools — SKIP with instruction, not FAIL
|
|
169
|
+
|
|
170
|
+
## Sharp Edges
|
|
171
|
+
|
|
172
|
+
| Failure Mode | Severity | Mitigation |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| Tool not installed → entire scan skipped silently | HIGH | Constraint 4: show install instruction, continue with available tools |
|
|
175
|
+
| Raw tool output dumped without normalization | MEDIUM | Step 4: always normalize to unified format |
|
|
176
|
+
| Only running one tool when multiple apply | MEDIUM | Constraint 1: run ALL available tools for the language |
|
|
177
|
+
| Semgrep community rules producing noise | LOW | Filter to ERROR+WARNING severity only — skip INFO-level Semgrep |
|
|
178
|
+
| Long-running scan on large codebase | MEDIUM | Run on changed files only when diff available, full scan only on manual invocation |
|
|
179
|
+
|
|
180
|
+
## Done When
|
|
181
|
+
|
|
182
|
+
- Language detected from project config files
|
|
183
|
+
- All available tools executed (or SKIP with install instruction)
|
|
184
|
+
- Findings normalized to unified BLOCK/WARN/INFO format
|
|
185
|
+
- Tool coverage table showing what ran and what was skipped
|
|
186
|
+
- SAST Report emitted with overall verdict
|
|
187
|
+
|
|
188
|
+
## Cost Profile
|
|
189
|
+
|
|
190
|
+
~300-800 tokens input, ~200-500 tokens output. Haiku + Bash commands. Tool execution time varies (1-30s depending on project size).
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold
|
|
3
|
+
description: Autonomous project bootstrapper. Generates complete project from a description — structure, code, tests, docs, config. Orchestrates ba → plan → design → fix → test → docs → git in one pipeline. The "0 to production-ready" skill.
|
|
4
|
+
metadata:
|
|
5
|
+
author: runedev
|
|
6
|
+
version: "0.1.0"
|
|
7
|
+
layer: L1
|
|
8
|
+
model: sonnet
|
|
9
|
+
group: orchestrator
|
|
10
|
+
tools: "Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# scaffold
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
The "zero to production-ready" orchestrator. Takes a project description and autonomously generates a complete, working project — directory structure, code, tests, documentation, git setup, and verification. Orchestrates 8+ skills in sequence to produce output that builds, passes tests, and is ready for development.
|
|
18
|
+
|
|
19
|
+
<HARD-GATE>
|
|
20
|
+
Generated projects MUST build and pass tests. A scaffold that produces broken code is WORSE than no scaffold. Phase 9 (VERIFY) is mandatory — if verification fails, fix before presenting to user.
|
|
21
|
+
</HARD-GATE>
|
|
22
|
+
|
|
23
|
+
## Triggers
|
|
24
|
+
|
|
25
|
+
- `/rune scaffold <description>` — Interactive mode (asks questions)
|
|
26
|
+
- `/rune scaffold express <detailed-description>` — Express mode (autonomous)
|
|
27
|
+
- Called by `team` when task is greenfield project creation
|
|
28
|
+
- Auto-trigger: when user says "new project", "start from scratch", "bootstrap", "create a new [app/api/lib]"
|
|
29
|
+
|
|
30
|
+
## Calls (outbound)
|
|
31
|
+
|
|
32
|
+
- `ba` (L2): Phase 1 — requirement elicitation (always, even in Express mode)
|
|
33
|
+
- `research` (L3): Phase 2 — best practices, starter templates, library comparison
|
|
34
|
+
- `plan` (L2): Phase 3 — architecture and implementation plan
|
|
35
|
+
- `design` (L2): Phase 4 — design system (frontend projects only)
|
|
36
|
+
- `fix` (L2): Phase 5 — code generation (implements the plan)
|
|
37
|
+
- `team` (L1): Phase 5 — parallel implementation when 3+ independent modules
|
|
38
|
+
- `test` (L2): Phase 6 — test suite generation
|
|
39
|
+
- `docs` (L2): Phase 7 — README, API docs, architecture doc
|
|
40
|
+
- `git` (L3): Phase 8 — initial commit with semantic message
|
|
41
|
+
- `verification` (L3): Phase 9 — lint + types + tests + build
|
|
42
|
+
- `sentinel` (L2): Phase 9 — security scan on generated code
|
|
43
|
+
|
|
44
|
+
## Called By (inbound)
|
|
45
|
+
|
|
46
|
+
- User: `/rune scaffold` direct invocation
|
|
47
|
+
- `team` (L1): when decomposed task is a new project
|
|
48
|
+
- `cook` (L1): when task is classified as greenfield (rare — cook usually handles features, not projects)
|
|
49
|
+
|
|
50
|
+
## Modes
|
|
51
|
+
|
|
52
|
+
### Interactive Mode (default)
|
|
53
|
+
|
|
54
|
+
Full phase-gate workflow. User reviews and approves at each major phase:
|
|
55
|
+
1. BA asks 5 questions → user answers
|
|
56
|
+
2. Plan presented → user approves
|
|
57
|
+
3. Design system presented → user approves (if frontend)
|
|
58
|
+
4. Implementation proceeds
|
|
59
|
+
5. Results presented with full report
|
|
60
|
+
|
|
61
|
+
### Express Mode
|
|
62
|
+
|
|
63
|
+
Autonomous mode for detailed descriptions. User provides enough context upfront:
|
|
64
|
+
1. BA extracts requirements from description (no questions asked)
|
|
65
|
+
2. Plan auto-approved (user gave enough detail)
|
|
66
|
+
3. Implementation proceeds autonomously
|
|
67
|
+
4. User reviews only the final output
|
|
68
|
+
|
|
69
|
+
<HARD-GATE>
|
|
70
|
+
Express mode MUST still validate. Auto-approve doesn't mean skip quality checks.
|
|
71
|
+
BA still extracts requirements — it just doesn't ask questions.
|
|
72
|
+
Verification (Phase 9) is NEVER skipped in any mode.
|
|
73
|
+
</HARD-GATE>
|
|
74
|
+
|
|
75
|
+
## Project Templates
|
|
76
|
+
|
|
77
|
+
Auto-detected from BA output. Template selection informs Phase 3 (Plan) architecture decisions.
|
|
78
|
+
|
|
79
|
+
| Template | Stack | Key Generation Targets |
|
|
80
|
+
|----------|-------|----------------------|
|
|
81
|
+
| REST API | Node.js/Python + DB + Auth | Routes, models, middleware, migrations, Docker, CI |
|
|
82
|
+
| Web App (Full-stack) | Next.js/SvelteKit + DB | Pages, components, API routes, auth, DB setup |
|
|
83
|
+
| CLI Tool | Node.js/Python/Rust | Commands, arg parsing, config, tests |
|
|
84
|
+
| Library/Package | TypeScript/Python | Src, tests, build config, npm/pypi publish setup |
|
|
85
|
+
| MCP Server | TypeScript/Python | Tools, resources, handlers, tests (delegates to mcp-builder) |
|
|
86
|
+
| Chrome Extension | React/Vanilla | Manifest, popup, content script, background, tests |
|
|
87
|
+
| Mobile App | React Native/Expo | Screens, navigation, auth, API client |
|
|
88
|
+
|
|
89
|
+
## Executable Steps
|
|
90
|
+
|
|
91
|
+
### Phase 1 — BA (Requirement Elicitation)
|
|
92
|
+
|
|
93
|
+
Invoke `rune:ba` with the user's project description.
|
|
94
|
+
|
|
95
|
+
**Interactive Mode**: BA asks 5 questions, discovers hidden requirements, produces Requirements Document.
|
|
96
|
+
|
|
97
|
+
**Express Mode**: BA extracts requirements from the detailed description without asking questions. Still produces Requirements Document with scope, user stories, and acceptance criteria.
|
|
98
|
+
|
|
99
|
+
Output: `.rune/features/<project-name>/requirements.md`
|
|
100
|
+
|
|
101
|
+
Gate: In Interactive mode, user must approve requirements before proceeding.
|
|
102
|
+
|
|
103
|
+
### Phase 2 — RESEARCH (Best Practices & Templates)
|
|
104
|
+
|
|
105
|
+
Invoke `rune:research` to find:
|
|
106
|
+
- Best practices for the detected project type
|
|
107
|
+
- Recommended libraries (compare 2-3 options for each concern)
|
|
108
|
+
- Starter templates or skeleton projects to reference
|
|
109
|
+
- Common pitfalls for this stack
|
|
110
|
+
|
|
111
|
+
Do NOT clone templates blindly. Use them as REFERENCE for architecture decisions in Phase 3.
|
|
112
|
+
|
|
113
|
+
### Phase 3 — PLAN (Architecture & Implementation)
|
|
114
|
+
|
|
115
|
+
Invoke `rune:plan` with the Requirements Document from Phase 1 and research from Phase 2.
|
|
116
|
+
|
|
117
|
+
Plan must include:
|
|
118
|
+
- Directory structure (exact paths)
|
|
119
|
+
- File list with purpose of each file
|
|
120
|
+
- Implementation order (dependency-aware)
|
|
121
|
+
- Technology choices with rationale
|
|
122
|
+
- Test strategy (what to test, coverage target)
|
|
123
|
+
|
|
124
|
+
Gate: In Interactive mode, user must approve plan before proceeding.
|
|
125
|
+
|
|
126
|
+
### Phase 4 — DESIGN (Design System — Frontend Only)
|
|
127
|
+
|
|
128
|
+
If project has frontend (Web App, Mobile App, Chrome Extension):
|
|
129
|
+
- Invoke `rune:design` to generate design system
|
|
130
|
+
- Output: `.rune/design-system.md` with tokens, components, patterns
|
|
131
|
+
|
|
132
|
+
If backend-only or CLI → skip this phase.
|
|
133
|
+
|
|
134
|
+
### Phase 5 — IMPLEMENT (Code Generation)
|
|
135
|
+
|
|
136
|
+
Execute the plan from Phase 3. For each planned file:
|
|
137
|
+
|
|
138
|
+
1. Create directory structure first
|
|
139
|
+
2. Generate shared types/interfaces
|
|
140
|
+
3. Generate core modules (models, services, utilities)
|
|
141
|
+
4. Generate API layer (routes, controllers, handlers)
|
|
142
|
+
5. Generate UI layer (pages, components) if applicable
|
|
143
|
+
6. Generate configuration (env, docker, CI)
|
|
144
|
+
|
|
145
|
+
**Parallelization**: If plan has 3+ independent modules → invoke `rune:team` to implement in parallel using worktrees.
|
|
146
|
+
|
|
147
|
+
**Quality during generation**:
|
|
148
|
+
- Follow project conventions from research
|
|
149
|
+
- Include proper error handling
|
|
150
|
+
- Use environment variables for config (never hardcode)
|
|
151
|
+
- Add TypeScript strict types / Python type hints
|
|
152
|
+
- Follow file size limits (< 500 LOC per file)
|
|
153
|
+
|
|
154
|
+
### Phase 6 — TEST (Test Suite Generation)
|
|
155
|
+
|
|
156
|
+
Invoke `rune:test` to generate tests based on acceptance criteria from Phase 1:
|
|
157
|
+
|
|
158
|
+
- Unit tests for each module/function
|
|
159
|
+
- Integration tests for API endpoints
|
|
160
|
+
- E2E test template for critical flows
|
|
161
|
+
- Target: 80%+ coverage on generated code
|
|
162
|
+
|
|
163
|
+
Each acceptance criterion from BA → at least one test case.
|
|
164
|
+
|
|
165
|
+
### Phase 7 — DOCS (Documentation)
|
|
166
|
+
|
|
167
|
+
Invoke `rune:docs init` to generate:
|
|
168
|
+
|
|
169
|
+
- `README.md` — Quick Start, Features, Tech Stack, Commands
|
|
170
|
+
- `ARCHITECTURE.md` — if project has 10+ files
|
|
171
|
+
- `docs/API.md` — if project has API endpoints
|
|
172
|
+
- `.env.example` — all required environment variables with descriptions
|
|
173
|
+
|
|
174
|
+
### Phase 8 — GIT (Initial Commit)
|
|
175
|
+
|
|
176
|
+
Invoke `rune:git commit` to create initial commit:
|
|
177
|
+
|
|
178
|
+
- Stage all generated files (except .env, node_modules, __pycache__)
|
|
179
|
+
- Commit message: `feat: scaffold <project-name> with <template> template`
|
|
180
|
+
- Set up `.gitignore` appropriate for the stack
|
|
181
|
+
|
|
182
|
+
### Phase 9 — VERIFY (Quality Gate)
|
|
183
|
+
|
|
184
|
+
Invoke `rune:verification` to run ALL checks:
|
|
185
|
+
|
|
186
|
+
1. **Lint**: ESLint/Ruff/Clippy — zero errors
|
|
187
|
+
2. **Types**: tsc --noEmit / mypy — zero errors
|
|
188
|
+
3. **Tests**: npm test / pytest — all pass
|
|
189
|
+
4. **Build**: npm run build / python -m build — succeeds
|
|
190
|
+
5. **Security**: `rune:sentinel` quick scan — no critical issues
|
|
191
|
+
|
|
192
|
+
<HARD-GATE>
|
|
193
|
+
If ANY check fails → fix the issue (invoke rune:fix) and re-verify.
|
|
194
|
+
Do NOT present broken scaffold to user.
|
|
195
|
+
Max 3 fix-verify loops. If still failing after 3 → report failures to user with context.
|
|
196
|
+
</HARD-GATE>
|
|
197
|
+
|
|
198
|
+
## Output Format
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
## Scaffold Report: [Project Name]
|
|
202
|
+
- **Template**: [detected template]
|
|
203
|
+
- **Stack**: [framework, language, DB, etc.]
|
|
204
|
+
- **Files Generated**: [count]
|
|
205
|
+
- **Test Coverage**: [percentage]
|
|
206
|
+
- **Phases**: BA → Research → Plan → Design? → Implement → Test → Docs → Git → Verify
|
|
207
|
+
- **Verification**: ✅ All checks passed / ⚠️ [issues]
|
|
208
|
+
|
|
209
|
+
### Generated Structure
|
|
210
|
+
[file tree — max 30 lines, group similar files]
|
|
211
|
+
|
|
212
|
+
### What's Included
|
|
213
|
+
- [feature list with key implementation details]
|
|
214
|
+
|
|
215
|
+
### What's NOT Included (Next Steps)
|
|
216
|
+
- [out-of-scope items from BA — things user should build next]
|
|
217
|
+
|
|
218
|
+
### Commands
|
|
219
|
+
- `[start command]` — start development server
|
|
220
|
+
- `[test command]` — run tests
|
|
221
|
+
- `[build command]` — production build
|
|
222
|
+
- `[lint command]` — check code quality
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Error Recovery
|
|
226
|
+
|
|
227
|
+
| Phase | Failure | Recovery |
|
|
228
|
+
|-------|---------|----------|
|
|
229
|
+
| Phase 1 (BA) | User refuses to answer questions | Extract what you can, flag assumptions prominently |
|
|
230
|
+
| Phase 2 (Research) | No good references found | Use built-in knowledge, flag as "no external reference" |
|
|
231
|
+
| Phase 3 (Plan) | Plan too complex (10+ phases) | Split into MVP (Phase 1) + Future (Phase 2) |
|
|
232
|
+
| Phase 5 (Implement) | Code generation errors | Invoke fix → retry, max 3 attempts per file |
|
|
233
|
+
| Phase 6 (Test) | Tests fail on generated code | Fix code (not tests) → re-run, max 3 loops |
|
|
234
|
+
| Phase 9 (Verify) | Lint/type/build errors | Fix → re-verify, max 3 loops |
|
|
235
|
+
| Phase 9 (Verify) | Still failing after 3 loops | Report to user with specific failures |
|
|
236
|
+
|
|
237
|
+
## Constraints
|
|
238
|
+
|
|
239
|
+
1. MUST run BA (Phase 1) before generating any code — even in Express mode
|
|
240
|
+
2. MUST generate tests — no project without test suite is "production-ready"
|
|
241
|
+
3. MUST generate docs — README at minimum, API docs if applicable
|
|
242
|
+
4. MUST pass verification — generated project must build and pass lint/types/tests
|
|
243
|
+
5. MUST NOT use `--dangerously-skip-permissions` or `--no-verify` — quality gates are mandatory
|
|
244
|
+
6. MUST NOT generate hardcoded secrets — use .env.example with placeholder values
|
|
245
|
+
7. Express mode MUST still extract and validate requirements — auto-approve ≠ skip analysis
|
|
246
|
+
8. MUST generate .gitignore appropriate for the stack
|
|
247
|
+
9. MUST respect user's existing project if scaffolding into non-empty directory — warn and ask before overwriting
|
|
248
|
+
10. Generated files MUST be < 500 LOC each — split large files
|
|
249
|
+
|
|
250
|
+
## Sharp Edges
|
|
251
|
+
|
|
252
|
+
| Failure Mode | Severity | Mitigation |
|
|
253
|
+
|---|---|---|
|
|
254
|
+
| Generating code without BA → wrong features | CRITICAL | Constraint 1: BA is Phase 1, always runs |
|
|
255
|
+
| Scaffold passes locally but fails on fresh clone | HIGH | Phase 9 catches this — verify build from clean state |
|
|
256
|
+
| Overwriting existing files in non-empty directory | HIGH | Constraint 9: detect existing files, warn user |
|
|
257
|
+
| Express mode skipping quality checks | HIGH | HARD-GATE: Express mode still validates everything |
|
|
258
|
+
| Template mismatch (CLI template for web app) | MEDIUM | Template auto-detected from BA output, confirmed with user |
|
|
259
|
+
| Generated tests are trivial (only smoke tests) | MEDIUM | Phase 6: tests derived from acceptance criteria, not generic |
|
|
260
|
+
| Missing .gitignore → committing node_modules | MEDIUM | Constraint 8: generate stack-appropriate .gitignore |
|
|
261
|
+
|
|
262
|
+
## Done When
|
|
263
|
+
|
|
264
|
+
- Requirements gathered (BA complete, Requirements Document produced)
|
|
265
|
+
- Architecture planned (directory structure, tech choices, implementation order)
|
|
266
|
+
- Design system generated (if frontend project)
|
|
267
|
+
- All code generated (following plan, < 500 LOC per file)
|
|
268
|
+
- Test suite generated (80%+ coverage target, acceptance criteria covered)
|
|
269
|
+
- Documentation generated (README + ARCHITECTURE + API docs as applicable)
|
|
270
|
+
- Initial git commit created
|
|
271
|
+
- All verification checks passed (lint + types + tests + build + security)
|
|
272
|
+
- Scaffold Report presented to user
|
|
273
|
+
|
|
274
|
+
## Cost Profile
|
|
275
|
+
|
|
276
|
+
~10000-20000 tokens total (across all sub-skill invocations). Sonnet for orchestration — sub-skills use their own model selection (ba uses opus, git uses haiku, etc.). Most expensive L1 skill due to 9-phase pipeline, but runs rarely (project creation is infrequent).
|