@rune-kit/rune 2.2.6 → 2.3.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 (91) hide show
  1. package/README.md +395 -389
  2. package/compiler/__tests__/tier-override.test.js +158 -0
  3. package/compiler/adapters/antigravity.js +3 -8
  4. package/compiler/adapters/codex.js +3 -8
  5. package/compiler/adapters/cursor.js +3 -8
  6. package/compiler/adapters/generic.js +3 -8
  7. package/compiler/adapters/openclaw.js +4 -9
  8. package/compiler/adapters/opencode.js +3 -8
  9. package/compiler/adapters/windsurf.js +3 -8
  10. package/compiler/bin/rune.js +34 -1
  11. package/compiler/emitter.js +94 -5
  12. package/compiler/transforms/branding.js +10 -3
  13. package/docs/ARCHITECTURE.md +3 -3
  14. package/docs/SKILL-TEMPLATE.md +15 -0
  15. package/docs/VISION.md +3 -3
  16. package/docs/guides/index.html +14 -14
  17. package/docs/index.html +82 -13
  18. package/docs/script.js +33 -6
  19. package/docs/skills/index.html +832 -832
  20. package/docs/style.css +62 -0
  21. package/extensions/ai-ml/PACK.md +7 -0
  22. package/extensions/content/PACK.md +7 -0
  23. package/extensions/mobile/PACK.md +9 -9
  24. package/extensions/zalo/PACK.md +9 -0
  25. package/package.json +8 -6
  26. package/skills/adversary/SKILL.md +12 -0
  27. package/skills/audit/SKILL.md +526 -467
  28. package/skills/autopsy/SKILL.md +12 -0
  29. package/skills/ba/SKILL.md +349 -342
  30. package/skills/brainstorm/SKILL.md +11 -0
  31. package/skills/completion-gate/SKILL.md +260 -249
  32. package/skills/context-engine/SKILL.md +77 -1
  33. package/skills/context-pack/SKILL.md +160 -0
  34. package/skills/cook/SKILL.md +648 -958
  35. package/skills/cook/references/deviation-rules.md +19 -0
  36. package/skills/cook/references/error-recovery.md +37 -0
  37. package/skills/cook/references/exit-conditions.md +31 -0
  38. package/skills/cook/references/loop-detection.md +39 -0
  39. package/skills/cook/references/mid-run-signals.md +31 -0
  40. package/skills/cook/references/output-format.md +40 -0
  41. package/skills/cook/references/pack-detection.md +82 -0
  42. package/skills/cook/references/pause-resume-template.md +38 -0
  43. package/skills/cook/references/rfc-template.md +52 -0
  44. package/skills/cook/references/sharp-edges.md +24 -0
  45. package/skills/cook/references/subagent-status.md +38 -0
  46. package/skills/db/SKILL.md +12 -0
  47. package/skills/debug/SKILL.md +392 -362
  48. package/skills/deploy/SKILL.md +10 -0
  49. package/skills/deploy/references/post-deploy-integration.md +192 -0
  50. package/skills/design/SKILL.md +9 -0
  51. package/skills/docs/SKILL.md +12 -0
  52. package/skills/docs-seeker/SKILL.md +11 -0
  53. package/skills/fix/SKILL.md +281 -249
  54. package/skills/incident/SKILL.md +10 -0
  55. package/skills/launch/SKILL.md +12 -0
  56. package/skills/logic-guardian/SKILL.md +11 -0
  57. package/skills/marketing/SKILL.md +13 -0
  58. package/skills/mcp-builder/SKILL.md +13 -0
  59. package/skills/onboard/SKILL.md +50 -2
  60. package/skills/perf/SKILL.md +11 -0
  61. package/skills/plan/SKILL.md +342 -688
  62. package/skills/plan/references/completeness-scoring.md +36 -0
  63. package/skills/plan/references/outcome-block.md +40 -0
  64. package/skills/plan/references/plan-templates.md +193 -0
  65. package/skills/plan/references/wave-planning.md +44 -0
  66. package/skills/plan/references/workflow-registry.md +52 -0
  67. package/skills/preflight/SKILL.md +360 -280
  68. package/skills/rescue/SKILL.md +11 -0
  69. package/skills/research/SKILL.md +149 -150
  70. package/skills/retro/SKILL.md +11 -0
  71. package/skills/review/SKILL.md +489 -396
  72. package/skills/review-intake/SKILL.md +11 -0
  73. package/skills/safeguard/SKILL.md +12 -0
  74. package/skills/scaffold/SKILL.md +10 -0
  75. package/skills/scope-guard/SKILL.md +11 -0
  76. package/skills/scout/SKILL.md +9 -0
  77. package/skills/sentinel/SKILL.md +296 -425
  78. package/skills/sentinel/references/config-protection.md +52 -0
  79. package/skills/sentinel/references/destructive-commands.md +39 -0
  80. package/skills/sentinel/references/domain-hooks.md +73 -0
  81. package/skills/sentinel/references/framework-patterns.md +46 -0
  82. package/skills/sentinel/references/owasp-patterns.md +69 -0
  83. package/skills/sentinel/references/secret-patterns.md +40 -0
  84. package/skills/sentinel/references/skill-content-guard.md +54 -0
  85. package/skills/session-bridge/SKILL.md +56 -2
  86. package/skills/skill-forge/SKILL.md +47 -2
  87. package/skills/skill-router/{SKILL.md → skill.md} +446 -365
  88. package/skills/surgeon/SKILL.md +12 -0
  89. package/skills/team/SKILL.md +34 -1
  90. package/skills/test/SKILL.md +585 -427
  91. package/skills/watchdog/references/webhook-health-checks.md +243 -0
@@ -0,0 +1,36 @@
1
+ # Completeness Scoring
2
+
3
+ > Reference for `plan` skill — Step 5.5.
4
+ > Load this when presenting alternative approaches from brainstorm or Step 3 decisions.
5
+
6
+ ## Scoring Table
7
+
8
+ When presenting alternatives, rate each with **Completeness X/10**:
9
+
10
+ | Score | Meaning |
11
+ |-------|---------|
12
+ | 9-10 | Complete — all edge cases, full coverage, production-ready |
13
+ | 7-8 | Happy path covered, some edges skipped |
14
+ | 4-6 | Shortcut — defers significant work |
15
+ | 1-3 | Minimal viable, debt guaranteed |
16
+
17
+ ## Rules
18
+
19
+ - **Always recommend the higher-completeness option.** With AI-assisted coding, the marginal cost of completeness is near-zero.
20
+ - Show **dual effort estimates** for each approach: `(human: ~X / AI: ~Y)`
21
+ - **Anti-pattern**: "Option B saves 70 LOC" → 70 LOC delta is meaningless with AI. Choose complete. The last 10% of coverage is where production bugs hide.
22
+
23
+
24
+ ## Example Format
25
+
26
+ ```
27
+ **Option A: Full validation with Zod** — Completeness 9/10
28
+ - Covers: schema validation, error messages, type inference
29
+ - human: ~2h / AI: ~15min
30
+ - Recommended ✅
31
+
32
+ **Option B: Manual checks** — Completeness 5/10
33
+ - Covers: happy path only, defers edge cases
34
+ - human: ~30min / AI: ~5min
35
+ - Not recommended — defers 40% of error handling
36
+ ```
@@ -0,0 +1,40 @@
1
+ # Outcome Block Format
2
+
3
+ > Reference for `plan` skill — mandatory output section for all plan outputs.
4
+ > Load this when writing the final section of any master plan, phase file, or inline plan.
5
+
6
+ ## Format
7
+
8
+ Every plan output MUST end with an **Outcome Block**:
9
+
10
+ ```markdown
11
+ ## Outcome Block
12
+
13
+ ### What Was Planned
14
+ <1-2 sentences: what this plan delivers when all phases execute successfully>
15
+
16
+ ### Immediate Next Action
17
+ <The SINGLE next action the executor should take right now — not a list, one action>
18
+ Example: "Load phase 1 file and execute Wave 1 tasks (create types, validation schema)"
19
+
20
+ ### How to Measure Success
21
+ | Metric | Target | How to Check |
22
+ |--------|--------|-------------|
23
+ | Tests pass | 100% green | `npm test` or `pytest -v` |
24
+ | Type errors | 0 | `tsc --noEmit` or `mypy` |
25
+ | Phase complete | All tasks ✅ | phase file task list |
26
+ | <domain metric> | <value> | <command> |
27
+ ```
28
+
29
+ ## Rules
30
+
31
+ 1. Outcome Block is the LAST section in every plan output (master plan, phase file, inline plan)
32
+ 2. "Immediate Next Action" = ONE action, present tense, imperative mood. Not a list.
33
+ 3. "How to Measure" table MUST include at least one verifiable shell command
34
+ 4. For phase files: Immediate Next Action = "Execute Wave 1: [list Wave 1 task names]"
35
+ 5. For master plans: Immediate Next Action = "Await approval, then load phase 1 file"
36
+
37
+ ## Why This Matters
38
+
39
+ Plans without a clear "what to do NOW" cause executor drift — agents re-read the plan, re-analyze, and pick arbitrary starting points. The Immediate Next Action eliminates ambiguity: there is exactly ONE right first move.
40
+
@@ -0,0 +1,193 @@
1
+ # Plan Templates
2
+
3
+ > Reference for `plan` skill — Steps 4 and 5.
4
+ > Load this when writing master plan files or phase files.
5
+
6
+ ## Master Plan Template
7
+
8
+ Save to `.rune/plan-<feature>.md`. Max 80 lines.
9
+
10
+ ```markdown
11
+ # Feature: <name>
12
+
13
+ ## Overview
14
+ <1-3 sentences: what and why>
15
+
16
+ ## Phases
17
+ | # | Name | Status | Plan File | Summary |
18
+ |---|------|--------|-----------|---------|
19
+ | 1 | Foundation | ⬚ Pending | plan-X-phase1.md | Types, core engine, basic UI |
20
+ | 2 | Interaction | ⬚ Pending | plan-X-phase2.md | Dialogue, combat, items |
21
+ | 3 | Polish | ⬚ Pending | plan-X-phase3.md | Effects, sounds, game over |
22
+
23
+ ## Key Decisions
24
+ - <decision 1 — chosen approach and why>
25
+ - <decision 2>
26
+
27
+ ## Decision Compliance
28
+ - Decisions (locked): [list from requirements.md — plan MUST honor these]
29
+ - Discretion (agent): [list — agent chose X because Y]
30
+ - Deferred: [list — explicitly excluded from this feature]
31
+
32
+ ## Architecture
33
+ <brief system diagram or component list — NOT implementation detail>
34
+
35
+ ## Dependencies
36
+ - <external dep>: <status>
37
+
38
+ ## Risks
39
+ - <risk>: <mitigation>
40
+ ```
41
+
42
+ No implementation details — that's what phase files are for.
43
+
44
+ ---
45
+
46
+ ## Phase File Template (Amateur-Proof)
47
+
48
+ Save to `.rune/plan-<feature>-phase<N>.md`. Max 200 lines.
49
+
50
+ Phase files follow the **Amateur-Proof Template** — designed so that even the weakest model (Haiku) can execute without guessing. Every section exists because an Amateur said "I need this to code correctly."
51
+
52
+ ```markdown
53
+ # Phase N: <name>
54
+
55
+ ## Goal
56
+ <What this phase delivers — 1-2 sentences>
57
+
58
+ ## Data Flow
59
+ <5-line ASCII diagram showing how data moves through this phase's components>
60
+ ```
61
+ User Input → validateInput() → calculateProfit() → formatResult() → API Response
62
+
63
+ TradeEntry[]
64
+ ```
65
+
66
+ ## Code Contracts
67
+ <Function signatures, interfaces, schemas that this phase MUST implement>
68
+ <This is the MOST IMPORTANT section — coder implements these contracts>
69
+
70
+ ```typescript
71
+ interface TradeEntry {
72
+ side: 'long' | 'short';
73
+ entryPrice: number;
74
+ exitPrice: number;
75
+ quantity: number;
76
+ }
77
+
78
+ interface ProfitResult {
79
+ netPnL: number;
80
+ totalFees: number;
81
+ winRate: number;
82
+ }
83
+
84
+ function calculateProfit(entries: TradeEntry[]): ProfitResult;
85
+ function validateInput(raw: unknown): TradeEntry[]; // throws ValidationError
86
+ ```
87
+
88
+ ## Tasks
89
+
90
+ Each task MUST include: **File** (exact path), **Test** (test file or N/A), **Verify** (shell command), **Commit** (semantic message). Granularity: 2-5 min per task. If >10min, decompose.
91
+
92
+ - [ ] Task 1 — Create calculateProfit function
93
+ - Req: REQ-001 (P&L calculation)
94
+ - File: `src/foo/bar.ts` (new)
95
+ - Test: `tests/foo/bar.test.ts` (new)
96
+ - Verify: `npm test -- --grep "calculateProfit"`
97
+ - Commit: `feat(trading): add calculateProfit with fee calculation`
98
+ - Logic: sum entries by side, apply fees (0.1% per trade), return net P&L
99
+ - Edge: empty array → return { netPnL: 0, totalFees: 0, winRate: 0 }
100
+ - [ ] Task 2 — Add input validation
101
+ - Req: REQ-002 (input validation)
102
+ - File: `src/foo/baz.ts` (modify)
103
+ - Test: `tests/foo/baz.test.ts` (new)
104
+ - Verify: `npm test -- --grep "validateInput"`
105
+ - Commit: `feat(trading): add input validation for trade entries`
106
+ - Logic: check side is 'long'|'short', prices > 0, quantity > 0
107
+ - [ ] Task 3 — Write integration tests
108
+ - Req: REQ-001, REQ-002 (integration coverage)
109
+ - File: `tests/foo/bar.test.ts` (modify)
110
+ - Test: N/A — this IS the test task
111
+ - Verify: `npm test -- --grep "trading" && npx tsc --noEmit`
112
+ - Commit: `test(trading): add integration tests for edge cases`
113
+ - Cases: happy path, empty input, negative values, overflow
114
+
115
+ ## Failure Scenarios
116
+ <What should happen when things go wrong — coder MUST implement these>
117
+
118
+ | When | Then | Error Type |
119
+ |------|------|-----------|
120
+ | entries is empty array | return zero-value ProfitResult | No error (valid edge case) |
121
+ | entry has negative price | throw ValidationError("price must be positive") | ValidationError |
122
+ | entry has quantity = 0 | throw ValidationError("quantity must be > 0") | ValidationError |
123
+ | calculation overflows Number.MAX_SAFE_INTEGER | use BigInt or throw OverflowError | OverflowError |
124
+
125
+ ## Performance Constraints
126
+ <Non-functional requirements — skip if not applicable>
127
+
128
+ | Metric | Requirement | Why |
129
+ |--------|-------------|-----|
130
+ | Input size | Must handle 10,000 entries | Production data volume |
131
+ | Response time | < 100ms for 10K entries | Real-time dashboard |
132
+ | Memory | < 50MB for 10K entries | Container memory limit |
133
+
134
+ ## Rejection Criteria (DO NOT)
135
+ <Anti-patterns the coder MUST avoid — things that seem right but are wrong>
136
+
137
+ - ❌ DO NOT use `toFixed()` for financial calculations — use Decimal.js or integer cents
138
+ - ❌ DO NOT mutate the input array — create new objects (immutability rule)
139
+ - ❌ DO NOT use `any` type — full TypeScript strict
140
+ - ❌ DO NOT import from Phase 2+ files — this phase is self-contained
141
+
142
+ ## Cross-Phase Context
143
+ <What this phase assumes from previous phases / what future phases expect from this one>
144
+
145
+ - **Assumes**: Phase 1 created `src/shared/types.ts` with base types
146
+ - **Exports for Phase 3**: `calculateProfit()` will be imported by `src/dashboard/PnLCard.tsx`
147
+ - **Interface contract**: ProfitResult shape MUST NOT change — Phase 3 depends on it
148
+
149
+ ## Acceptance Criteria
150
+ - [ ] All tasks marked done
151
+ - [ ] Tests pass with 80%+ coverage on new code
152
+ - [ ] No TypeScript errors (`tsc --noEmit` passes)
153
+ - [ ] Failure scenarios all handled (table above)
154
+ - [ ] Performance: calculateProfit(10K entries) < 100ms
155
+ - [ ] No `any` types, no mutation, no `toFixed()` for money
156
+
157
+ ## Traceability Matrix
158
+ | Req ID | Requirement | Task(s) | Test(s) | Status |
159
+ |--------|-------------|---------|---------|--------|
160
+ | REQ-001 | P&L calculation with fees | Task 1 | `tests/foo/bar.test.ts` | ⬚ |
161
+ | REQ-002 | Input validation | Task 2 | `tests/foo/baz.test.ts` | ⬚ |
162
+
163
+ Every requirement from BA's Requirements Document MUST appear in this matrix. Missing requirement = incomplete phase. `completion-gate` checks this matrix during verification.
164
+
165
+ ## Files Touched
166
+ - `src/foo/bar.ts` — new
167
+ - `src/foo/baz.ts` — modify
168
+ - `tests/foo/bar.test.ts` — new
169
+ ```
170
+
171
+ Must be self-contained — coder should NOT need to read master plan or other phases to execute.
172
+
173
+ ---
174
+
175
+ ## Inline Plan Template (Trivial Tasks)
176
+
177
+ For trivial tasks (1-2 phases, < 5 files, < 100 LOC):
178
+
179
+ ```
180
+ ## Plan: [Task Name]
181
+
182
+ ### Changes
183
+ 1. [file]: [what to change] — [function signature]
184
+ 2. [file]: [what to change]
185
+
186
+ ### Tests
187
+ - [test file]: [test cases]
188
+
189
+ ### Risks
190
+ - [risk]: [mitigation]
191
+
192
+ Awaiting approval.
193
+ ```
@@ -0,0 +1,44 @@
1
+ # Wave-Based Task Grouping
2
+
3
+ > Reference for `plan` skill — Step 3 (Decompose into Phases).
4
+ > Load this when writing wave-structured task lists inside a phase.
5
+
6
+ ## Wave Format
7
+
8
+ Tasks inside a phase MUST be organized into **waves** based on dependency analysis. Independent tasks within the same wave can execute in parallel.
9
+
10
+ ```
11
+ ## Tasks
12
+
13
+ ### Wave 1 (parallel — no dependencies)
14
+ - [ ] Task 1 — Create types/interfaces
15
+ - File: `src/types.ts` (new)
16
+ - ...
17
+ - [ ] Task 2 — Create validation schema
18
+ - File: `src/validation.ts` (new)
19
+ - ...
20
+
21
+ ### Wave 2 (depends on Wave 1)
22
+ - [ ] Task 3 — Implement core logic (imports types from Task 1)
23
+ - File: `src/core.ts` (new)
24
+ - depends_on: [Task 1]
25
+ - ...
26
+
27
+ ### Wave 3 (depends on Wave 2)
28
+ - [ ] Task 4 — Wire into API endpoint (imports core from Task 3)
29
+ - File: `src/routes/api.ts` (modify)
30
+ - depends_on: [Task 3]
31
+ - ...
32
+ - [ ] Task 5 — Write integration tests (tests core from Task 3)
33
+ - File: `tests/core.test.ts` (new)
34
+ - depends_on: [Task 3]
35
+ - ...
36
+ ```
37
+
38
+ ## Wave Rules
39
+
40
+ - **Wave 1** = tasks with zero dependencies (types, schemas, configs) — always first
41
+ - **Subsequent waves**: a task goes in the earliest wave where ALL its `depends_on` tasks are in prior waves
42
+ - Tasks within the same wave have NO dependencies on each other → safe for parallel dispatch
43
+ - `depends_on` field is MANDATORY for Wave 2+ tasks — explicit is better than implicit
44
+ - `team` orchestrator can dispatch wave tasks as parallel subagents; solo `cook` executes sequentially within a wave but respects wave ordering
@@ -0,0 +1,52 @@
1
+ # Workflow Registry (4-View)
2
+
3
+ > Reference for `plan` skill — Step 4.5.
4
+ > Load this when building a Workflow Registry for complex features (4+ phases OR 3+ user-facing workflows).
5
+
6
+ ## When to Use
7
+
8
+ Build this registry BEFORE writing phase files for complex features. It catches missing pieces, dead ends, and integration gaps at plan time — not implementation time.
9
+
10
+ **Skip conditions**: trivial tasks, inline plans, single-workflow features.
11
+
12
+
13
+ ## 4-View Format
14
+
15
+ ```markdown
16
+ ## Workflow Registry
17
+
18
+ ### View 1: By Workflow
19
+ | Workflow | Entry Point | Components Touched | Exit Point | Phase |
20
+ |----------|-------------|-------------------|------------|-------|
21
+ | User signup | POST /auth/register | AuthService, UserRepo, EmailService | 201 + email sent | Phase 1 |
22
+ | Password reset | POST /auth/reset | AuthService, EmailService, TokenRepo | 200 + reset email | Phase 2 |
23
+
24
+ ### View 2: By Component
25
+ | Component | Used By Workflows | Owner Phase | Status |
26
+ |-----------|-------------------|-------------|--------|
27
+ | AuthService | signup, login, reset | Phase 1 | Planned |
28
+ | EmailService | signup, reset, invite | Phase 2 | Planned |
29
+ | TokenRepo | reset, invite | Phase 2 | Missing ← RED FLAG |
30
+
31
+ ### View 3: By User Journey
32
+ | Journey | Steps (workflow chain) | Happy Path | Error Path |
33
+ |---------|----------------------|------------|------------|
34
+ | New user → first action | signup → verify email → login → onboard | 4 steps | signup fail, email bounce |
35
+
36
+ ### View 4: By State
37
+ | Step | User Sees | DB State | Logs | Operator Sees |
38
+ |------|-----------|----------|------|---------------|
39
+ | After signup | "Check your email" | user.status=pending | user.created event | New user in admin |
40
+ | After verify | Dashboard | user.status=active | user.verified event | Active user count +1 |
41
+ ```
42
+
43
+ ## Validation Rules
44
+
45
+ - Every component in View 2 MUST appear in at least one workflow in View 1 — orphaned components = dead code
46
+ - Every workflow in View 1 MUST map to a phase — unphased workflows will be forgotten
47
+ - **"Missing" status in View 2 = red flag** — component needed but not planned in any phase → add to a phase or create new phase
48
+ - Every user journey step in View 3 MUST have a corresponding state row in View 4
49
+
50
+ ## Output Placement
51
+
52
+ Add the registry to the master plan file (it fits within the 80-line budget when tables are compact). Phase files reference it but don't duplicate it.