@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
@@ -193,6 +193,16 @@ Deploy Report with platform, status (success/failed/rollback), deployed URL, bui
193
193
  6. MUST complete release checklist for production deploys — version bump, changelog, rollback plan
194
194
  7. MUST create rollback plan artifact before first production deploy of a version
195
195
 
196
+ ## Returns
197
+
198
+ | Artifact | Format | Location |
199
+ |----------|--------|----------|
200
+ | Deploy report | Markdown | inline (chat output) |
201
+ | Deploy status (success/failed/rollback) | Text | inline |
202
+ | Health check results (HTTP status, visual) | Markdown | inline |
203
+ | Rollback plan document | Markdown | `.rune/deploy/rollback-<version>.md` |
204
+ | Monitoring confirmation | Text | inline |
205
+
196
206
  ## Sharp Edges
197
207
 
198
208
  Known failure modes for this skill. Check these before declaring done.
@@ -0,0 +1,192 @@
1
+ # Post-Deploy Integration Verification
2
+
3
+ > After every deploy touching webhooks, payment providers, email services, or GitHub API — run this checklist. A Cloudflare Worker deployed cleanly does not mean integrations work. Polar's webhook defaults to zero events selected; zero events = zero orders = silent failure for days.
4
+
5
+ ---
6
+
7
+ ## Post-Deploy Integration Verification Matrix
8
+
9
+ | Integration Type | Verify | Command / Check | Expected Result |
10
+ |-----------------|--------|-----------------|-----------------|
11
+ | Webhook endpoint | HTTP reachability | `curl -X POST https://your-worker.dev/webhook/provider` | 200 or 400 (not 404/502) |
12
+ | Webhook secret | Signature validation | Send test event from provider dashboard | 200, no signature error in logs |
13
+ | Webhook events | Events subscribed | Provider dashboard → Webhook → Events tab | At least one event type selected |
14
+ | Email delivery | Send + delivery | Trigger a flow that sends email, check inbox | Email arrives within 60s |
15
+ | Email DNS | SPF / DKIM / DMARC | `dig TXT yourdomain.com` + MXToolbox | All three records resolve correctly |
16
+ | GitHub API | PAT scope + expiry | `curl -H "Authorization: Bearer $PAT" https://api.github.com/user` | 200 with user object |
17
+ | GitHub invites | Repo invite flow | Trigger invite, check pending invitations | Invitation appears in GitHub UI |
18
+ | KV / Database | State after transaction | `wrangler kv key list --namespace-id=XXX` | Keys present, count matches expected |
19
+ | DNS / routing | Worker route binding | `curl -I https://yourdomain.com/webhook/provider` | Response from worker (check CF-Ray header) |
20
+
21
+ ---
22
+
23
+ ## Smoke Test Script Pattern
24
+
25
+ Run immediately after every deploy that touches integrations.
26
+
27
+ ```bash
28
+ WORKER_URL="https://your-worker.dev"
29
+ ADMIN_SECRET="$WORKER_ADMIN_SECRET"
30
+
31
+ # 1. Endpoint reachability — expect 200 or 400 (not 404/502)
32
+ echo "=== Endpoint reachability ==="
33
+ curl -s -o /dev/null -w "HTTP %{http_code}\n" -X POST "$WORKER_URL/webhook/polar"
34
+ curl -s -o /dev/null -w "HTTP %{http_code}\n" -X POST "$WORKER_URL/webhook/stripe"
35
+
36
+ # 2. Health endpoint — expect { status: "ok" }
37
+ echo "=== Health check ==="
38
+ curl -s "$WORKER_URL/health" | jq .
39
+
40
+ # 3. Admin orders count — expect number (0 is OK on fresh deploy)
41
+ echo "=== Orders in KV ==="
42
+ curl -s -H "Authorization: Bearer $ADMIN_SECRET" \
43
+ "$WORKER_URL/admin/orders" | jq length
44
+
45
+ # 4. KV namespace populated
46
+ echo "=== KV key count ==="
47
+ npx wrangler kv key list --namespace-id="$KV_NAMESPACE_ID" | jq length
48
+
49
+ # 5. GitHub API access — expect login field
50
+ echo "=== GitHub PAT check ==="
51
+ curl -s -H "Authorization: Bearer $GITHUB_PAT" \
52
+ https://api.github.com/user | jq .login
53
+ ```
54
+
55
+ Expected output on healthy deploy:
56
+
57
+ ```
58
+ === Endpoint reachability ===
59
+ HTTP 400
60
+ HTTP 400
61
+ === Health check ===
62
+ { "status": "ok", "version": "1.0.0" }
63
+ === Orders in KV ===
64
+ 0
65
+ === KV key count ===
66
+ 0
67
+ === GitHub PAT check ===
68
+ "your-github-username"
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Integration-Specific Checklists
74
+
75
+ ### Payment Webhooks (Polar, Stripe, SePay)
76
+
77
+ - [ ] Webhook URL uses HTTPS, not HTTP
78
+ - [ ] Events selected in provider dashboard — **Polar defaults to NONE, must select manually**
79
+ - [ ] Secret copied exactly — no leading/trailing whitespace
80
+ - [ ] Secret format matches what code expects (raw string vs `whsec_` prefix for Stripe)
81
+ - [ ] `wrangler secret list` confirms secret is set in production environment
82
+ - [ ] Test delivery from provider dashboard returns 200
83
+ - [ ] After test delivery: order appears in KV or database
84
+ - [ ] After test delivery: confirmation email sent to test address
85
+ - [ ] Re-delivering the same event does not create a duplicate order (idempotency key check)
86
+ - [ ] Webhook signature verification rejects tampered payload (test with wrong secret)
87
+
88
+ **Polar-specific**: Settings → Webhooks → select your webhook → Events tab → check at least `order.created`, `subscription.created`, `subscription.updated`, `subscription.revoked` are checked.
89
+
90
+ **Stripe-specific**: Dashboard → Developers → Webhooks → endpoint → listen to events. Secret starts with `whsec_` — your code must pass the raw header value, not strip the prefix.
91
+
92
+ ### Email Service (Resend, SES)
93
+
94
+ - [ ] API key is valid and not rotated since last deploy
95
+ - [ ] From address domain is verified in provider dashboard
96
+ - [ ] SPF record: `v=spf1 include:_spf.resend.com ~all` (or provider equivalent)
97
+ - [ ] DKIM record present and propagated (check with `dig TXT resend._domainkey.yourdomain.com`)
98
+ - [ ] DMARC record: `v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com`
99
+ - [ ] Send a real test email after deploy, verify it lands in inbox (not spam)
100
+ - [ ] Email template renders variable substitution correctly (no `{{name}}` literals in output)
101
+ - [ ] Unsubscribe link resolves and triggers unsubscribe flow
102
+
103
+ ### GitHub API (Repo Invites)
104
+
105
+ - [ ] PAT (`GITHUB_PAT`) has scopes: `repo`, `admin:org` (for org repos)
106
+ - [ ] PAT expiry date is in the future — classic PATs can expire silently
107
+ - [ ] Target repos exist and PAT owner has admin access
108
+ - [ ] Invite flow creates a pending invitation (visible at `https://github.com/orgs/ORG/people`)
109
+ - [ ] Invited user receives GitHub notification email within 5 minutes
110
+ - [ ] Accepting invite grants correct permission level (read / write / admin per plan)
111
+ - [ ] Revoking access removes user from repo collaborators within expected SLA
112
+
113
+ **Check PAT expiry:**
114
+ ```bash
115
+ curl -s -H "Authorization: Bearer $GITHUB_PAT" \
116
+ https://api.github.com/rate_limit | jq .rate
117
+ # If you get 401, the PAT is expired or revoked
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Common Failure Patterns
123
+
124
+ | Pattern | Symptom | Root Cause | Fix |
125
+ |---------|---------|------------|-----|
126
+ | Silent webhook failure | No errors in logs, no data in KV, zero orders | Events not selected in provider dashboard | Go to provider dashboard → webhook settings → select event types |
127
+ | All webhook requests 403 | `invalid signature` in logs, every delivery fails | Secret in worker env doesn't match secret shown in provider | Copy secret again, `wrangler secret put SECRET_NAME`, redeploy |
128
+ | Partial integration failure | Some repos invited, email never sends | `catch` block swallowing the email error, only repo invite logged | Add explicit error logging inside each catch; never swallow errors silently |
129
+ | Works in local dev, fails in production | 500s on webhook, env var undefined errors | Secret set in `.dev.vars` but not in production via `wrangler secret put` | Run `wrangler secret list`, add any missing secrets |
130
+ | First webhook succeeds, subsequent are rejected | Duplicate order prevented, but also valid re-deliveries blocked | Idempotency key stored permanently; provider retries are rejected | Use TTL on idempotency keys, or check event timestamp before rejecting |
131
+ | Email sends but lands in spam | Delivery confirmed by API, user never sees it | Missing or misconfigured SPF/DKIM/DMARC | Verify all three DNS records, wait propagation, retest |
132
+ | GitHub invite 422 | `already a collaborator` error | User was previously invited and accepted | Check existing collaborators before sending invite |
133
+ | KV reads return stale data | Data visible in `wrangler kv key get` but worker returns old value | Worker cached old KV binding; binding namespace-id mismatch in wrangler.toml | Verify `wrangler.toml` `kv_namespaces` points to production namespace ID |
134
+
135
+ ---
136
+
137
+ ## Environment Variable Audit
138
+
139
+ Before every deploy, confirm all required secrets exist in the production environment:
140
+
141
+ ```bash
142
+ # List all secrets currently set for the worker
143
+ npx wrangler secret list --name your-worker-name
144
+ ```
145
+
146
+ | Environment Variable | Purpose | How to Verify It Works |
147
+ |---------------------|---------|------------------------|
148
+ | `POLAR_WEBHOOK_SECRET` | Validates Polar webhook signature | Send test event from Polar dashboard → expect 200 |
149
+ | `STRIPE_WEBHOOK_SECRET` | Validates Stripe webhook signature (`whsec_...`) | Stripe CLI `stripe trigger payment_intent.created` |
150
+ | `RESEND_API_KEY` | Sends transactional email | `curl -X POST api.resend.com/emails` with test recipient |
151
+ | `GITHUB_PAT` | Invites users to repos on purchase | `curl api.github.com/user` → expect 200 with login |
152
+ | `ADMIN_SECRET` | Protects `/admin/*` endpoints | `curl /admin/orders -H "Authorization: Bearer $SECRET"` → expect 200 |
153
+ | `KV_NAMESPACE_ID` | Bound KV namespace for order persistence | `wrangler kv key list --namespace-id=$ID` → no error |
154
+
155
+ If any secret is missing from `wrangler secret list` output, add it before considering the deploy complete:
156
+
157
+ ```bash
158
+ npx wrangler secret put POLAR_WEBHOOK_SECRET --name your-worker-name
159
+ # Paste the secret value when prompted (no echo to terminal)
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Rollback Triggers
165
+
166
+ | Situation | Decision | Reasoning |
167
+ |-----------|----------|-----------|
168
+ | Data corruption in KV (duplicate orders, wrong amounts) | Rollback immediately | Data integrity takes priority; forward-fix risks compounding the damage |
169
+ | Webhook returning 5xx consistently | Fix-forward (no rollback) | Provider retries automatically; rollback doesn't fix misconfiguration |
170
+ | Wrong webhook secret | Fix-forward: update secret + redeploy | Secret is env-level, rollback doesn't change env vars |
171
+ | Events not selected in Polar | Fix-forward: configure in provider dashboard | No code change needed; dashboard-only fix, deploy not required |
172
+ | Email API key invalid | Fix-forward: rotate key + `wrangler secret put` | Key lives in secrets, not code; redeploy takes 30s |
173
+ | GitHub PAT expired | Fix-forward: generate new PAT + update secret | Same as above |
174
+ | Health endpoint returning 500 on all routes | Rollback immediately | Worker itself is broken; users are hitting errors |
175
+ | Invite flow broken for subset of users | Fix-forward with hotfix | Partial breakage; rollback removes working functionality too |
176
+
177
+ **Rollback command (Cloudflare Workers):**
178
+ ```bash
179
+ # List recent deployments
180
+ npx wrangler deployments list --name your-worker-name
181
+
182
+ # Rollback to a specific deployment
183
+ npx wrangler rollback --deployment-id <id> --name your-worker-name
184
+ ```
185
+
186
+ **Fix-forward checklist before re-deploy:**
187
+ 1. Identify root cause (check logs via `wrangler tail`)
188
+ 2. Fix in code or secrets
189
+ 3. Run smoke test locally against staging
190
+ 4. Deploy to production
191
+ 5. Re-run smoke test script above
192
+ 6. Confirm provider dashboard shows successful test delivery
@@ -443,6 +443,15 @@ Trading/Fintech — Data-Dense Dark — Web
443
443
  | Persistence Gate | .rune/design-system.md written before reporting done | Write file first |
444
444
  | Platform Gate | Platform detected before generating tokens | Default to web, note assumption |
445
445
 
446
+ ## Returns
447
+
448
+ | Artifact | Format | Location |
449
+ |----------|--------|----------|
450
+ | Design system file | Markdown | `.rune/design-system.md` |
451
+ | Design report | Markdown | inline (chat output) |
452
+ | Accessibility audit findings | Markdown list | inline + appended to design-system.md |
453
+ | UX writing guidelines | Markdown section | `.rune/design-system.md` § UX Writing |
454
+
446
455
  ## Sharp Edges
447
456
 
448
457
  Known failure modes for this skill. Check these before declaring done.
@@ -294,6 +294,18 @@ Docs Update Report:
294
294
  5. MUST NOT generate docs for code that doesn't exist yet (unless explicitly creating spec docs)
295
295
  6. API docs MUST match actual route signatures — wrong API docs are worse than no docs
296
296
 
297
+ ## Returns
298
+
299
+ | Artifact | Format | Location |
300
+ |----------|--------|----------|
301
+ | README.md | Markdown | project root |
302
+ | ARCHITECTURE.md | Markdown | project root (if 10+ files) |
303
+ | API reference | Markdown | `docs/API.md` |
304
+ | Changelog entry | Markdown (Keep a Changelog) | `CHANGELOG.md` |
305
+ | Docs update report | Markdown | inline (chat output) |
306
+
307
+ **Scope guardrail:** Documents only what exists in the codebase — never invents features, endpoints, or APIs.
308
+
297
309
  ## Sharp Edges
298
310
 
299
311
  | Failure Mode | Severity | Mitigation |
@@ -161,6 +161,17 @@ Known failure modes for this skill. Check these before declaring done.
161
161
  - Source URL provided
162
162
  - Documentation emitted in output format
163
163
 
164
+ ## Returns
165
+
166
+ | Artifact | Format | Location |
167
+ |----------|--------|----------|
168
+ | API reference (signature + params) | Markdown | inline |
169
+ | Minimal working code example | Code block | inline |
170
+ | Deprecation / version notes | Markdown | inline |
171
+ | Source URL | Plain text | inline |
172
+
164
173
  ## Cost Profile
165
174
 
166
175
  ~300-600 tokens input, ~200-400 tokens output. Haiku. Fast lookup.
176
+
177
+ **Scope guardrail:** docs-seeker looks up documentation only — it does not apply changes, write code, or interpret whether the API fits the caller's use case.