@rune-kit/rune 2.2.1 → 2.2.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.
Files changed (94) hide show
  1. package/README.md +39 -13
  2. package/compiler/__tests__/adapters.test.js +109 -0
  3. package/compiler/__tests__/openclaw-adapter.test.js +149 -140
  4. package/compiler/__tests__/pack-split.test.js +145 -145
  5. package/compiler/__tests__/parser.test.js +3 -3
  6. package/compiler/__tests__/pipeline.test.js +110 -0
  7. package/compiler/__tests__/skill-validation.test.js +148 -0
  8. package/compiler/__tests__/transformer.test.js +70 -0
  9. package/compiler/__tests__/transforms.test.js +92 -0
  10. package/compiler/adapters/antigravity.js +5 -6
  11. package/compiler/adapters/claude.js +1 -1
  12. package/compiler/adapters/codex.js +69 -77
  13. package/compiler/adapters/cursor.js +5 -6
  14. package/compiler/adapters/generic.js +5 -6
  15. package/compiler/adapters/index.js +3 -3
  16. package/compiler/adapters/openclaw.js +146 -150
  17. package/compiler/adapters/opencode.js +78 -86
  18. package/compiler/adapters/windsurf.js +5 -6
  19. package/compiler/bin/rune.js +52 -21
  20. package/compiler/doctor.js +19 -7
  21. package/compiler/emitter.js +11 -18
  22. package/compiler/parser.js +5 -5
  23. package/compiler/transformer.js +3 -5
  24. package/compiler/transforms/branding.js +5 -4
  25. package/compiler/transforms/compliance.js +40 -40
  26. package/compiler/transforms/frontmatter.js +1 -1
  27. package/compiler/transforms/hooks.js +12 -14
  28. package/compiler/transforms/subagents.js +1 -3
  29. package/compiler/transforms/tool-names.js +1 -1
  30. package/docs/ANTIGRAVITY-GAP-ANALYSIS.md +369 -0
  31. package/docs/ARCHITECTURE.md +332 -0
  32. package/docs/COMMUNITY-PACKS.md +109 -0
  33. package/docs/CONTRIBUTING-L4.md +215 -0
  34. package/docs/CROSS-IDE-ANALYSIS.md +164 -0
  35. package/docs/EXTENSION-TEMPLATE.md +108 -0
  36. package/docs/MESH-RULES.md +34 -0
  37. package/docs/MULTI-PLATFORM.md +804 -0
  38. package/docs/SKILL-DEPTH-AUDIT.md +191 -0
  39. package/docs/SKILL-TEMPLATE.md +72 -0
  40. package/docs/TRADE-MATRIX.md +327 -0
  41. package/docs/VERSIONING.md +91 -0
  42. package/docs/VISION.md +263 -0
  43. package/docs/assets/demo-subtitles.srt +215 -0
  44. package/docs/assets/end-card.html +276 -0
  45. package/docs/assets/mesh-diagram.html +654 -0
  46. package/docs/assets/thumbnail.html +295 -0
  47. package/docs/guides/cli.md +403 -0
  48. package/docs/guides/index.html +1387 -0
  49. package/docs/index.html +739 -0
  50. package/docs/references/claudekit-analysis.md +414 -0
  51. package/docs/references/voltagent-analysis.md +189 -0
  52. package/docs/script.js +277 -0
  53. package/docs/skills/index.html +832 -0
  54. package/docs/style.css +600 -0
  55. package/docs/video-demo-plan.md +172 -0
  56. package/extensions/security/PACK.md +4 -3
  57. package/extensions/security/skills/defense-in-depth.md +103 -0
  58. package/extensions/ui/PACK.md +2 -0
  59. package/extensions/ui/skills/design-decision.md +10 -0
  60. package/extensions/ui/skills/palette-picker.md +11 -0
  61. package/hooks/.gitkeep +0 -0
  62. package/hooks/auto-format/index.cjs +48 -0
  63. package/hooks/context-watch/index.cjs +68 -0
  64. package/hooks/hooks.json +99 -0
  65. package/hooks/metrics-collector/index.cjs +42 -0
  66. package/hooks/post-session-reflect/index.cjs +153 -0
  67. package/hooks/pre-compact/index.cjs +95 -0
  68. package/hooks/pre-tool-guard/index.cjs +68 -0
  69. package/hooks/run-hook +17 -0
  70. package/hooks/run-hook.cjs +16 -0
  71. package/hooks/run-hook.cmd +1 -0
  72. package/hooks/secrets-scan/index.cjs +100 -0
  73. package/hooks/session-start/index.cjs +65 -0
  74. package/hooks/typecheck/index.cjs +65 -0
  75. package/package.json +16 -4
  76. package/references/ui-pro-max-data/LICENSE-UI-PRO-MAX +21 -0
  77. package/references/ui-pro-max-data/charts.csv +26 -0
  78. package/references/ui-pro-max-data/colors.csv +162 -0
  79. package/references/ui-pro-max-data/styles.csv +85 -0
  80. package/references/ui-pro-max-data/typography.csv +74 -0
  81. package/references/ui-pro-max-data/ui-reasoning.csv +162 -0
  82. package/references/ui-pro-max-data/ux-guidelines.csv +100 -0
  83. package/skills/ba/SKILL.md +10 -0
  84. package/skills/completion-gate/SKILL.md +34 -1
  85. package/skills/context-engine/SKILL.md +13 -0
  86. package/skills/cook/SKILL.md +71 -0
  87. package/skills/debug/SKILL.md +71 -1
  88. package/skills/design/SKILL.md +11 -0
  89. package/skills/fix/SKILL.md +26 -1
  90. package/skills/plan/SKILL.md +23 -6
  91. package/skills/review/SKILL.md +2 -0
  92. package/skills/skill-forge/SKILL.md +94 -3
  93. package/skills/test/SKILL.md +44 -2
  94. package/skills/verification/SKILL.md +60 -2
@@ -3,7 +3,7 @@ name: test
3
3
  description: "TDD test writer. Writes failing tests FIRST (red), then verifies they pass after implementation (green). Covers unit, integration, and e2e tests."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.2.0"
6
+ version: "0.4.0"
7
7
  layer: L2
8
8
  model: sonnet
9
9
  group: development
@@ -23,6 +23,13 @@ THE IRON LAW: Write code before test? DELETE IT. Start over.
23
23
  - Do NOT look at it to "inform" test design
24
24
  - Delete means delete. `git checkout -- <file>` or remove the changes entirely.
25
25
  This is not negotiable. This is not optional. "But I already wrote it" is a sunk cost fallacy.
26
+
27
+ ROLE BOUNDARY: Test writes TEST FILES only. NEVER modify source/implementation files.
28
+ - Do NOT "quickly fix" a broken import in source to make tests run
29
+ - Do NOT refactor source code to be "more testable"
30
+ - Do NOT add missing exports to source files
31
+ - If source needs changes → hand off to `rune:fix`. Test's job ends at the test file.
32
+ This separation ensures test never writes code biased toward passing its own tests.
26
33
  </HARD-GATE>
27
34
 
28
35
  ## Instructions
@@ -232,6 +239,7 @@ If you catch yourself with ANY of these, delete implementation code and restart
232
239
  7. MUST NOT say "tests pass" without showing actual test runner output
233
240
  8. MUST delete implementation code written before tests — Iron Law, no exceptions
234
241
  9. MUST show RED phase output (actual failure) — "I confirmed they fail" without output is REJECTED
242
+ 10. MUST NOT modify source/implementation files — test writes test files ONLY, hand off source changes to rune:fix
235
243
 
236
244
  ## Mesh Gates
237
245
 
@@ -263,6 +271,36 @@ If you catch yourself with ANY of these, delete implementation code and restart
263
271
  - [existing test that broke, with error details]
264
272
  ```
265
273
 
274
+ ## Testing Anti-Patterns (Gate Functions)
275
+
276
+ Before writing tests, check yourself against these 5 anti-patterns. Each has a **gate function** — a question you MUST answer before proceeding.
277
+
278
+ ### Anti-Pattern 1: Testing Mock Behavior
279
+ Asserting that a mock exists (e.g., `testId="sidebar-mock"`) instead of testing real component behavior. You're proving the mock works, not the code.
280
+ **Gate**: "Am I testing real component behavior or just mock existence?" → If mock existence: STOP. Rewrite to test real behavior.
281
+
282
+ ### Anti-Pattern 2: Test-Only Methods in Production
283
+ Adding `destroy()`, `reset()`, or `__testSetup()` methods to production classes that are ONLY called from test files. Production code should not know tests exist.
284
+ **Gate**: "Is this method only called by tests?" → If yes: STOP. Move to test utilities or test helper file, not production class.
285
+
286
+ ### Anti-Pattern 3: Mocking Without Understanding Side Effects
287
+ Mocking a function without first understanding ALL its side effects. The real function may write config files, update caches, or emit events that downstream code depends on.
288
+ **Gate**: Before mocking, STOP and answer: "What side effects does the REAL function have? Does this test depend on any of those?" → Run with real implementation first, observe what happens, THEN add minimal mocking.
289
+
290
+ ### Anti-Pattern 4: Incomplete Mocks
291
+ Partial mock missing fields that downstream code consumes. Your test passes because it only checks the fields you mocked, but production code reads fields your mock doesn't have → runtime crash.
292
+ **Iron Rule**: Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses. Examine actual API response / real data shape before writing mock.
293
+
294
+ ### Anti-Pattern 5: Mock Setup Longer Than Test Logic
295
+ If mock setup is 30 lines and the actual test assertion is 3 lines, the test is testing infrastructure, not behavior. This is a code smell that indicates wrong abstraction level.
296
+ **Gate**: "Is my mock setup longer than my test logic?" → If yes: test at a higher level (integration) or extract mock factories.
297
+
298
+ **Red flags — any of these means STOP and rethink:**
299
+ - Mock setup longer than test logic
300
+ - `*-mock` test IDs in assertions
301
+ - Methods only called in test files
302
+ - Can't explain in one sentence why a mock is needed
303
+
266
304
  ## Sharp Edges
267
305
 
268
306
  Known failure modes for this skill. Check these before declaring done.
@@ -271,9 +309,13 @@ Known failure modes for this skill. Check these before declaring done.
271
309
  |---|---|---|
272
310
  | Tests passing before implementation exists | CRITICAL | RED Gate: rewrite stricter tests — passing without code = not testing real behavior |
273
311
  | Skipping the RED phase (not confirming FAIL) | HIGH | Run tests, confirm FAIL output before calling cook/fix to implement |
274
- | Testing mock behavior instead of real code | HIGH | Constraint 4: test what the real code does, not what the mock returns |
312
+ | Testing mock behavior instead of real code | HIGH | Anti-Pattern 1 gate: "Am I testing real behavior or mock existence?" |
313
+ | Mocking without understanding side effects | HIGH | Anti-Pattern 3 gate: run with real impl first, observe side effects, THEN mock minimally |
314
+ | Incomplete mocks missing downstream fields | HIGH | Anti-Pattern 4 iron rule: mock COMPLETE data structure, not just fields your test checks |
275
315
  | Coverage below 80% without filling gaps | MEDIUM | Coverage Gate: identify uncovered lines and write additional tests |
276
316
  | Introducing a new test framework instead of using existing one | MEDIUM | Constraint 6: detect framework first, use project's existing one always |
317
+ | Modifying source files to make tests work | HIGH | Role boundary: test writes test files ONLY — source changes go to rune:fix |
318
+ | Test-only methods leaking into production code | MEDIUM | Anti-Pattern 2 gate: if method only called by tests → move to test utilities |
277
319
 
278
320
  ## Done When
279
321
 
@@ -3,7 +3,7 @@ name: verification
3
3
  description: "Universal verification runner. Runs lint, type-check, tests, and build. Use after any code change to verify nothing is broken."
4
4
  metadata:
5
5
  author: runedev
6
- version: "0.3.0"
6
+ version: "0.4.0"
7
7
  layer: L3
8
8
  model: haiku
9
9
  group: validation
@@ -98,7 +98,54 @@ If build fails: record first 20 lines of build output, mark as FAIL.
98
98
 
99
99
  Compile all results into the structured report. Update all TodoWrite items to completed.
100
100
 
101
- ### Artifact Verification
101
+ ### 3-Level Artifact Verification
102
+
103
+ > From GSD (gsd-build/get-shit-done, 30.8k★): "Task done ≠ Goal achieved."
104
+
105
+ Every file created or modified during implementation must pass ALL 3 levels:
106
+
107
+ **Level 1 — EXISTS**: File is on disk, non-empty.
108
+ ```
109
+ Glob("path/to/expected/file") → found
110
+ ```
111
+
112
+ **Level 2 — SUBSTANTIVE**: Contains real logic, NOT a stub. Scan for these stub patterns:
113
+
114
+ | Pattern | Language | Meaning |
115
+ |---|---|---|
116
+ | Component returns only `<div>Placeholder</div>` or `<div>TODO</div>` | React/Vue | Stub component |
117
+ | Route returns `{ message: "Not implemented" }` or `res.status(501)` | API | Stub endpoint |
118
+ | Function body is only `return null` / `return {}` / `return []` / `pass` | Any | Stub function |
119
+ | Class with all methods throwing `NotImplementedError` | Python/Java | Stub class |
120
+ | `useEffect` with empty body / `async function` with no `await` | React/JS | Hollow implementation |
121
+ | File has only type/interface exports but no implementation | TypeScript | Stub types-only file |
122
+ | `// TODO` or `# TODO` as the only content in a function | Any | Placeholder |
123
+
124
+ If ANY stub pattern detected → mark file as STUB, Level 2 FAIL.
125
+
126
+ **Level 3 — WIRED**: Actually imported/called/used by the rest of the system.
127
+
128
+ | File Type | Wiring Check |
129
+ |---|---|
130
+ | Component | `Grep("<ComponentName")` in parent files → ≥1 consumer |
131
+ | API route | `Grep("fetch\\|axios\\|api.*endpoint")` for this path → ≥1 caller |
132
+ | Hook | `Grep("useHookName(")` → ≥1 consumer |
133
+ | Utility function | `Grep("import.*from.*this-file")` → ≥1 importer |
134
+ | DB model/schema | `Grep("ModelName\\|table_name")` in query files → ≥1 reference |
135
+ | CSS/style module | `Grep("import.*from.*this-style")` → ≥1 importer |
136
+
137
+ If file has 0 consumers → mark as UNWIRED, Level 3 FAIL.
138
+
139
+ **Exception**: Entry-point files (main.ts, index.ts, App.tsx, routes config) are exempt from Level 3 — they ARE the top-level consumers.
140
+
141
+ <HARD-GATE name="3-level-verification">
142
+ ALL new files must pass Level 1 + Level 2 + Level 3.
143
+ EXISTS but STUB = "Existence Theater" — agent created files but didn't implement them.
144
+ EXISTS and SUBSTANTIVE but UNWIRED = dead code — created but never connected.
145
+ Report which level failed for each file in the Verification Report.
146
+ </HARD-GATE>
147
+
148
+ ### Artifact Output Verification
102
149
 
103
150
  > Inspired by CLI-Anything (HKUDS/CLI-Anything, 14.5k★): "Never trust exit 0."
104
151
  > Many tools exit 0 even when they fail silently. Always verify ACTUAL output.
@@ -168,6 +215,13 @@ Types: [PASS/FAIL/SKIP] ([X errors])
168
215
  Tests: [PASS/FAIL/SKIP] ([passed]/[total], [coverage]%)
169
216
  Build: [PASS/FAIL/SKIP]
170
217
 
218
+ ### 3-Level File Verification
219
+ | File | L1 Exists | L2 Substantive | L3 Wired | Verdict |
220
+ |------|-----------|----------------|----------|---------|
221
+ | src/auth/login.ts | ✓ | ✓ | ✓ (imported by routes.ts) | PASS |
222
+ | src/auth/reset.ts | ✓ | STUB (returns null) | — | FAIL L2 |
223
+ | src/utils/format.ts | ✓ | ✓ | UNWIRED (0 importers) | FAIL L3 |
224
+
171
225
  Overall: [PASS/FAIL]
172
226
 
173
227
  ### Failures (if any)
@@ -175,6 +229,8 @@ Overall: [PASS/FAIL]
175
229
  - Types: [first 5 type errors]
176
230
  - Tests: [first 5 failing test names]
177
231
  - Build: [first 5 build errors]
232
+ - Stubs: [files that failed Level 2 with stub pattern detected]
233
+ - Unwired: [files that failed Level 3 with 0 consumers]
178
234
  ```
179
235
 
180
236
  ## Evidence-Before-Claims Gate
@@ -226,6 +282,8 @@ Known failure modes for this skill. Check these before declaring done.
226
282
  | Stopping after first failure instead of running remaining checks | MEDIUM | Run all checks; aggregate all failures so developer can fix everything at once |
227
283
  | Reporting PASS when output has warnings but zero errors | LOW | PASS is correct but note warning count — caller decides if warnings matter |
228
284
  | Trusting exit code 0 without output verification | CRITICAL | Artifact Verification HARD-GATE: always confirm success indicator in stdout (pass count, "0 errors", output file exists) |
285
+ | Existence Theater — file exists but is a stub | HIGH | 3-Level check: Level 2 scans for stub patterns (`<div>Placeholder</div>`, `return null`, `NotImplementedError`) |
286
+ | Dead code — file created but never imported/used | MEDIUM | 3-Level check: Level 3 greps for consumers. 0 importers = UNWIRED |
229
287
 
230
288
  ## Done When
231
289