bigpowers 2.73.9 → 2.74.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/.continue/rules/context7-mcp.md +0 -0
- package/.continue/rules/diagnose-stall.md +0 -0
- package/.kilocode/rules/context7-mcp.md +0 -0
- package/.kilocode/rules/diagnose-stall.md +0 -0
- package/.pi/package.json +2 -2
- package/.pi/prompts/audit-code.md +17 -13
- package/.pi/prompts/build-epic.md +5 -0
- package/.pi/prompts/change-request.md +4 -1
- package/.pi/prompts/compose-workflow.md +17 -0
- package/.pi/prompts/context7-mcp.md +54 -0
- package/.pi/prompts/craft-skill.md +28 -0
- package/.pi/prompts/deepen-architecture.md +20 -0
- package/.pi/prompts/delegate-task.md +14 -0
- package/.pi/prompts/deploy.md +8 -0
- package/.pi/prompts/develop-tdd.md +15 -4
- package/.pi/prompts/diagnose-stall.md +53 -0
- package/.pi/prompts/dispatch-agents.md +53 -19
- package/.pi/prompts/evolve-skill.md +7 -0
- package/.pi/prompts/gate-trace.md +9 -1
- package/.pi/prompts/guard-git.md +14 -0
- package/.pi/prompts/kickoff-branch.md +4 -0
- package/.pi/prompts/migrate-spec.md +18 -0
- package/.pi/prompts/plan-work.md +62 -2
- package/.pi/prompts/publish-package.md +11 -0
- package/.pi/prompts/release-branch.md +46 -43
- package/.pi/prompts/request-review.md +57 -17
- package/.pi/prompts/research-first.md +3 -0
- package/.pi/prompts/run-benchmark.md +3 -3
- package/.pi/prompts/run-evals.md +26 -6
- package/.pi/prompts/run-planning.md +1 -0
- package/.pi/prompts/scope-work.md +3 -0
- package/.pi/prompts/search-skills.md +3 -0
- package/.pi/prompts/security-review.md +66 -12
- package/.pi/prompts/seed-conventions.md +68 -0
- package/.pi/prompts/session-state.md +5 -10
- package/.pi/prompts/slice-tasks.md +3 -0
- package/.pi/prompts/smoke-test.md +11 -0
- package/.pi/prompts/stocktake-skills.md +6 -1
- package/.pi/prompts/validate-contracts.md +12 -0
- package/.pi/prompts/validate-fix.md +2 -0
- package/.pi/prompts/verify-work.md +42 -20
- package/.pi/prompts/wire-ci.md +11 -0
- package/.pi/prompts/write-document.md +10 -0
- package/.pi/skills/audit-code/SKILL.md +17 -13
- package/.pi/skills/build-epic/SKILL.md +5 -0
- package/.pi/skills/change-request/SKILL.md +4 -1
- package/.pi/skills/compose-workflow/SKILL.md +17 -0
- package/.pi/skills/context7-mcp/SKILL.md +56 -0
- package/.pi/skills/craft-skill/SKILL.md +28 -0
- package/.pi/skills/deepen-architecture/SKILL.md +20 -0
- package/.pi/skills/delegate-task/SKILL.md +14 -0
- package/.pi/skills/deploy/SKILL.md +8 -0
- package/.pi/skills/develop-tdd/SKILL.md +15 -4
- package/.pi/skills/diagnose-stall/SKILL.md +55 -0
- package/.pi/skills/dispatch-agents/SKILL.md +53 -19
- package/.pi/skills/evolve-skill/SKILL.md +7 -0
- package/.pi/skills/gate-trace/SKILL.md +9 -1
- package/.pi/skills/guard-git/SKILL.md +14 -0
- package/.pi/skills/kickoff-branch/SKILL.md +4 -0
- package/.pi/skills/migrate-spec/SKILL.md +18 -0
- package/.pi/skills/plan-work/SKILL.md +62 -2
- package/.pi/skills/publish-package/SKILL.md +11 -0
- package/.pi/skills/release-branch/SKILL.md +46 -43
- package/.pi/skills/request-review/SKILL.md +57 -17
- package/.pi/skills/research-first/SKILL.md +3 -0
- package/.pi/skills/run-benchmark/SKILL.md +3 -3
- package/.pi/skills/run-evals/SKILL.md +26 -6
- package/.pi/skills/run-planning/SKILL.md +1 -0
- package/.pi/skills/scope-work/SKILL.md +3 -0
- package/.pi/skills/search-skills/SKILL.md +3 -0
- package/.pi/skills/security-review/SKILL.md +66 -12
- package/.pi/skills/seed-conventions/SKILL.md +68 -0
- package/.pi/skills/session-state/SKILL.md +5 -10
- package/.pi/skills/slice-tasks/SKILL.md +3 -0
- package/.pi/skills/smoke-test/SKILL.md +11 -0
- package/.pi/skills/stocktake-skills/SKILL.md +6 -1
- package/.pi/skills/validate-contracts/SKILL.md +12 -0
- package/.pi/skills/validate-fix/SKILL.md +2 -0
- package/.pi/skills/verify-work/SKILL.md +42 -20
- package/.pi/skills/wire-ci/SKILL.md +11 -0
- package/.pi/skills/write-document/SKILL.md +10 -0
- package/CHANGELOG.md +15 -0
- package/CLAUDE.md +59 -1
- package/CONVENTIONS.md +81 -0
- package/README.md +1 -1
- package/SKILL-INDEX.md +1 -1
- package/package.json +1 -1
- package/scripts/bp-churn-rank.sh +49 -0
- package/scripts/bp-read-agents.sh +1 -0
- package/scripts/check-import-boundaries.sh +64 -0
- package/scripts/compile-rule-matrix.sh +114 -0
- package/scripts/hooks/rtk-rewrite.sh +11 -0
- package/scripts/hooks/token-mgmt-pre-tool-use.sh +53 -0
- package/scripts/install.sh +6 -0
- package/scripts/lib/completeness-critic.sh +62 -0
- package/scripts/lib/doc-fetch-cache.sh +71 -0
- package/scripts/lib/golden-suite-gates.sh +3 -1
- package/scripts/lib/parallel-review-worktrees.sh +34 -0
- package/scripts/lib/plan-consistency-check.sh +88 -0
- package/scripts/lib/run-benchmark.py +210 -0
- package/scripts/lib/sync-context-engineering-ref.sh +19 -0
- package/scripts/references-manifest.yaml +19 -0
- package/scripts/run-benchmark.sh +6 -0
- package/scripts/run-skill-verify.sh +1 -0
- package/scripts/sync-references.sh +25 -0
- package/scripts/sync-skills.sh +12 -1
- package/scripts/validate-skill-catalog.sh +147 -0
- package/scripts/validate-skill-description.sh +70 -0
- package/skills/audit-code/SKILL.md +19 -13
- package/skills/build-epic/SKILL.md +6 -1
- package/skills/change-request/SKILL.md +4 -1
- package/skills/compose-workflow/SKILL.md +17 -0
- package/skills/context7-mcp/SKILL.md +57 -0
- package/skills/craft-skill/SKILL.md +29 -0
- package/skills/deepen-architecture/SKILL.md +22 -0
- package/skills/delegate-task/SKILL.md +14 -0
- package/skills/deploy/SKILL.md +9 -0
- package/skills/develop-tdd/SKILL.md +18 -4
- package/skills/diagnose-stall/SKILL.md +56 -0
- package/skills/dispatch-agents/SKILL.md +53 -19
- package/skills/elaborate-spec/SKILL.md +1 -0
- package/skills/evolve-skill/SKILL.md +7 -0
- package/skills/gate-trace/SKILL.md +11 -1
- package/skills/guard-git/REFERENCE.md +14 -0
- package/skills/kickoff-branch/SKILL.md +4 -1
- package/skills/migrate-spec/REFERENCE.md +12 -0
- package/skills/migrate-spec/SKILL.md +6 -0
- package/skills/plan-work/REFERENCE.md +29 -2
- package/skills/plan-work/SKILL.md +38 -0
- package/skills/publish-package/REFERENCE.md +11 -0
- package/skills/release-branch/REFERENCE.md +14 -0
- package/skills/release-branch/SKILL.md +33 -44
- package/skills/request-review/SKILL.md +59 -17
- package/skills/research-first/SKILL.md +3 -0
- package/skills/run-benchmark/SKILL.md +5 -4
- package/skills/run-evals/REFERENCE.md +14 -4
- package/skills/run-evals/SKILL.md +13 -2
- package/skills/run-planning/SKILL.md +1 -0
- package/skills/scope-work/SKILL.md +3 -0
- package/skills/search-skills/SKILL.md +3 -0
- package/skills/security-review/REFERENCE-false-positives.md +9 -8
- package/skills/security-review/REFERENCE-vuln-categories.md +4 -0
- package/skills/security-review/SKILL.md +53 -4
- package/skills/security-review/fixtures/CWE-79-xss-negative.js +6 -0
- package/skills/security-review/fixtures/CWE-79-xss-positive.js +6 -0
- package/skills/security-review/fixtures/CWE-89-sqli-negative.py +8 -0
- package/skills/security-review/fixtures/CWE-89-sqli-positive.py +9 -0
- package/skills/seed-conventions/REFERENCE.md +40 -0
- package/skills/seed-conventions/SKILL.md +28 -1
- package/skills/session-state/SKILL.md +5 -10
- package/skills/slice-tasks/SKILL.md +3 -0
- package/skills/smoke-test/REFERENCE.md +11 -0
- package/skills/stocktake-skills/SKILL.md +8 -1
- package/skills/validate-contracts/REFERENCE.md +12 -0
- package/skills/validate-fix/SKILL.md +3 -0
- package/skills/verify-work/REFERENCE.md +17 -0
- package/skills/verify-work/SKILL.md +25 -22
- package/skills/wire-ci/REFERENCE.md +11 -0
- package/skills/write-document/REFERENCE.md +10 -0
- package/skills-lock.json +41 -31
|
@@ -5,6 +5,17 @@ model: haiku
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
<!-- story: e02s01 e46s03 -->
|
|
9
|
+
<!-- story: e38s05 -->
|
|
10
|
+
<!-- story: e45s05 -->
|
|
11
|
+
<!-- story: e45s09 -->
|
|
12
|
+
<!-- story: e45s13 -->
|
|
13
|
+
<!-- story: e45s40 -->
|
|
14
|
+
<!-- story: e51s03 -->
|
|
15
|
+
<!-- story: e20s04 -->
|
|
16
|
+
<!-- story: e20s06 -->
|
|
17
|
+
|
|
18
|
+
|
|
8
19
|
# Verify Work
|
|
9
20
|
|
|
10
21
|
> **HARD GATE** — No story is "done" until manual UAT for the active story is confirmed with evidence.
|
|
@@ -45,12 +56,20 @@ Review answers "is the code good?"; Verify answers "does the built thing do what
|
|
|
45
56
|
2. **Cold-start smoke** (if app; skip if P3): stop server, clear caches, boot from scratch.
|
|
46
57
|
3. **AGENTS.md preflight** — if 0a skipped BP_PREFLIGHT, run `bash scripts/bp-read-agents.sh` and use detected command.
|
|
47
58
|
4. Mechanical gates: build → typecheck → lint → tests (from `CLAUDE.md` or AGENTS.md). Skip tests if P2/P3.
|
|
59
|
+
|
|
60
|
+
> **HARD GATE — One-test-minimum terminal verdict (e45s13):** At least one mechanical gate MUST be a **real terminal-verdict command** (shell exits 0 or non-zero — not prose, not combined log excerpts). Record that command's stdout/stderr from a **single contiguous run** in `specs/verifications/eNNsYY-verify.yaml` under `terminal_verdict`. Bug reports and gap logs MUST NOT merge evidence from multiple runs into one verdict — each failing run gets its own evidence block.
|
|
61
|
+
|
|
48
62
|
5. **Security scan** (skip if P2/P3) — run `security-review` against the git diff (working tree vs merge-base). Parse findings report. If any HIGH findings with confidence ≥ 8 exist → **block the gate**. Write findings to `specs/security/REVIEW.md`. Allow documented exceptions via `specs/security/EXCEPTIONS.md`. MEDIUM/LOW findings warn but don't block.
|
|
49
63
|
5a. **Blind-spot check** — run `bash scripts/check-blind-spots.sh`. This detects structural quality gaps (verify-gap, test-gap, stale-tag, etc.) beyond percentage coverage. If any HIGH-severity findings exist → **block the verify-work PASS gate**. Findings are written to `specs/blind-spots.json`. MEDIUM/LOW findings warn but don't block.
|
|
64
|
+
5a2. **Completeness critic (e45s05)** — `bash scripts/lib/completeness-critic.sh`. **BLOCKER** aborts merge gate; WARNING → gaps loop; FILLED = evidence only.
|
|
65
|
+
|
|
50
66
|
5b. **NFR Evidence Gate** (P0 only) — Produces go/no-go output on three dimensions: Performance (response time, throughput), Reliability (error rate, recovery), and Operability (logging, health checks). Reads thresholds from `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` and writes evidence as OKF verification-report bundles to `specs/verifications/NFR-eNNsYY.json`. FAIL on any dimension blocks the gate.
|
|
51
67
|
6. **Step-by-step UAT** (skip if P2/P3) — one user-observable action at a time.
|
|
52
68
|
7. **Gaps loop** — failures → log → `plan-work` → re-verify. Unaddressed HIGH findings from step 5 feed into this loop alongside other quality gaps.
|
|
53
69
|
|
|
70
|
+
7a. **Validation gate (e45s09)** — All tasks `status: passing`; evidence in `specs/verifications/`; update `execution-status.yaml`.
|
|
71
|
+
7b. **Reopen-don't-refile (e45s09)** — Regressions reopen existing story/bug — no duplicate capsule entries.
|
|
72
|
+
|
|
54
73
|
## Verify sub-operations
|
|
55
74
|
|
|
56
75
|
### Cold-Start Smoke (absorbed)
|
|
@@ -93,6 +112,11 @@ phases:
|
|
|
93
112
|
tests:
|
|
94
113
|
passed: true
|
|
95
114
|
coverage: "94.2%"
|
|
115
|
+
terminal_verdict:
|
|
116
|
+
command: "npm test"
|
|
117
|
+
exit_code: 0
|
|
118
|
+
captured_at: "2026-06-11T14:25:00Z"
|
|
119
|
+
note: "Single run — do not merge output from other attempts"
|
|
96
120
|
manual:
|
|
97
121
|
steps:
|
|
98
122
|
- step: "Open /login"
|
|
@@ -114,26 +138,7 @@ for p in specs/conventions-wiki/*.md; do [ "$(basename "$p")" = "index.md" ]&&co
|
|
|
114
138
|
|
|
115
139
|
## --cli mode
|
|
116
140
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
**Auto-detect binary name:**
|
|
120
|
-
```bash
|
|
121
|
-
# Cargo.toml
|
|
122
|
-
BINARY=$(grep '^name' Cargo.toml | head -1 | awk -F'"' '{print $2}')
|
|
123
|
-
# package.json
|
|
124
|
-
BINARY=$(node -e "console.log(require('./package.json').bin && Object.keys(require('./package.json').bin)[0] || '')" 2>/dev/null)
|
|
125
|
-
# Makefile
|
|
126
|
-
BINARY=$(grep '^BIN\s*=' Makefile 2>/dev/null | awk '{print $3}')
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**CLI verification checklist (replaces cold-start smoke):**
|
|
130
|
-
|
|
131
|
-
1. `--help` smoke: `$BINARY --help` → assert output contains "Usage"
|
|
132
|
-
2. `--version` check: `$BINARY --version` → assert version matches manifest (Cargo.toml / package.json)
|
|
133
|
-
3. Happy-path: run documented example command from README.md → assert non-empty output
|
|
134
|
-
4. Edge case: `$BINARY --invalid-flag` → assert exit code ≠ 0 and error message printed
|
|
135
|
-
|
|
136
|
-
No "stop server" / "clear caches" in `--cli` mode. Steps 3–6 still run unchanged.
|
|
141
|
+
CLI tools: use `--cli` when no server process. Binary detect + checklist: [REFERENCE.md](REFERENCE.md#cli-mode).
|
|
137
142
|
|
|
138
143
|
## Verify
|
|
139
144
|
|
|
@@ -168,3 +173,20 @@ sleep 3 && curl -sf http://localhost:<port>/health || echo "BOOT FAIL"
|
|
|
168
173
|
```
|
|
169
174
|
|
|
170
175
|
Feed gaps to `plan-work` as new steps with verify commands, then re-run verify-work.
|
|
176
|
+
|
|
177
|
+
## CLI mode
|
|
178
|
+
|
|
179
|
+
For CLI tools where cold-start smoke does not apply. Auto-detected when no server process; or use `--cli`.
|
|
180
|
+
|
|
181
|
+
**Auto-detect binary name:**
|
|
182
|
+
```bash
|
|
183
|
+
BINARY=$(grep '^name' Cargo.toml | head -1 | awk -F'"' '{print $2}') # Cargo
|
|
184
|
+
BINARY=$(node -e "console.log(require('./package.json').bin && Object.keys(require('./package.json').bin)[0] || '')" 2>/dev/null)
|
|
185
|
+
BINARY=$(grep '^BIN\s*=' Makefile 2>/dev/null | awk '{print $3}')
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Checklist (replaces cold-start smoke):**
|
|
189
|
+
1. `$BINARY --help` → output contains "Usage"
|
|
190
|
+
2. `$BINARY --version` → matches manifest
|
|
191
|
+
3. README example command → non-empty output
|
|
192
|
+
4. `$BINARY --invalid-flag` → exit ≠ 0 with error message
|
|
@@ -108,6 +108,17 @@ Add the following to the project's documentation or CLAUDE.md after setup:
|
|
|
108
108
|
|
|
109
109
|
# Wire Ci — Reference
|
|
110
110
|
|
|
111
|
+
## Navigation
|
|
112
|
+
|
|
113
|
+
| Lines | Section |
|
|
114
|
+
|-------|---------|
|
|
115
|
+
| 1 | Title |
|
|
116
|
+
| 3–14 | Navigation |
|
|
117
|
+
| 16–38 | Examples |
|
|
118
|
+
| 40–52 | Options |
|
|
119
|
+
| 54–62 | Integration with build-epic |
|
|
120
|
+
| 64–270 | Reference blocks 1–8 |
|
|
121
|
+
|
|
111
122
|
## Examples
|
|
112
123
|
|
|
113
124
|
### Create CI for a Rust project
|
|
@@ -82,6 +82,16 @@ Suggest next skill: `audit-code` or `sync-skills.sh`.
|
|
|
82
82
|
|
|
83
83
|
Combined from dbader/readme-template and jehna/readme-best-practices. No TOC.
|
|
84
84
|
|
|
85
|
+
## Navigation
|
|
86
|
+
|
|
87
|
+
| Lines | Section |
|
|
88
|
+
|-------|---------|
|
|
89
|
+
| 1 | Title |
|
|
90
|
+
| 5–16 | Navigation |
|
|
91
|
+
| 18–24 | Sections intro |
|
|
92
|
+
| 26–178 | README section templates (1–15) |
|
|
93
|
+
| 180–183 | Verify |
|
|
94
|
+
|
|
85
95
|
## Sections
|
|
86
96
|
|
|
87
97
|
### 1. Title + Badges
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [2.74.1](https://github.com/danielvm-git/bigpowers/compare/v2.74.0...v2.74.1) (2026-07-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **planning:** resolve yaml status drift for implemented epics ([fd06c68](https://github.com/danielvm-git/bigpowers/commit/fd06c68fc491746b7b7ff283fa561fce72ebb883))
|
|
7
|
+
* **traceability:** backfill story tags for e01-e29, fix YAML/size issues ([cca4942](https://github.com/danielvm-git/bigpowers/commit/cca494288a4c2e90a2dc871d46acefacf50ccf0b))
|
|
8
|
+
|
|
9
|
+
# [2.74.0](https://github.com/danielvm-git/bigpowers/compare/v2.73.9...v2.74.0) (2026-07-07)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **e45:** skill hardening & verification patterns (s01–s41) ([9253dc0](https://github.com/danielvm-git/bigpowers/commit/9253dc04d4304256cdc07263a24eaf0ec7d757df))
|
|
15
|
+
|
|
1
16
|
## [2.73.9](https://github.com/danielvm-git/bigpowers/compare/v2.73.8...v2.73.9) (2026-07-07)
|
|
2
17
|
|
|
3
18
|
|
package/CLAUDE.md
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
1
|
# story: e38s08
|
|
2
2
|
# story: e51s05
|
|
3
|
+
# story: e45s22
|
|
4
|
+
# story: e45s23
|
|
3
5
|
|
|
4
6
|
# bigpowers — Claude Code
|
|
5
7
|
|
|
6
8
|
Read CONVENTIONS.md before any GitHub or git operation.
|
|
7
9
|
|
|
10
|
+
<!-- BEGIN bigpowers:context-routing -->
|
|
11
|
+
## Context Routing
|
|
12
|
+
|
|
13
|
+
Load subdirectory context **by file glob** — do not read the full doc tree up front.
|
|
14
|
+
|
|
15
|
+
| Glob / trigger | Load first | Fallback |
|
|
16
|
+
|----------------|------------|----------|
|
|
17
|
+
| `skills/**` | Active skill's `SKILL.md` + sibling `REFERENCE.md` if linked | `SKILL-INDEX.md` |
|
|
18
|
+
| `specs/epics/**` | Capsule `epic.yaml` + active story `-tasks.yaml` | `specs/release-plan.yaml` |
|
|
19
|
+
| `specs/product/**` | `SCOPE_LATEST.yaml`, `VISION_LATEST.yaml` | `specs/README.md` |
|
|
20
|
+
| `specs/tech-architecture/**` | `tech-stack.md` + epic `eNN-TEST_PLAN_LATEST.md` if present | `CONVENTIONS.md` |
|
|
21
|
+
| `scripts/**` | `CONVENTIONS.md` § Generated artifact targets | This file § Commands |
|
|
22
|
+
| `website/**` | `website/README.md` if present | Never edit `website/src/content/docs/` (generated) |
|
|
23
|
+
| `docs/**` | Matching doc under `docs/` | `docs/references/` |
|
|
24
|
+
| Default / session start | This file → `CONVENTIONS.md` → `specs/state.yaml` | `survey-context` |
|
|
25
|
+
|
|
26
|
+
Sub-AGENTS.md files (when present in consumer projects) override this table for their directory only.
|
|
27
|
+
<!-- END bigpowers:context-routing -->
|
|
28
|
+
|
|
29
|
+
<!-- BEGIN bigpowers:learned-preferences -->
|
|
30
|
+
## Learned User Preferences
|
|
31
|
+
|
|
32
|
+
_Durable preferences discovered across sessions. Update via `session-state` — do not infer from chat alone._
|
|
33
|
+
|
|
34
|
+
- Prefer `rtk`-prefixed shell commands for git, test, and build output (token savings).
|
|
35
|
+
- Run Preflight before forward work; never dismiss red gates as pre-existing.
|
|
36
|
+
- Edit `skills/*/SKILL.md` sources only — never `.cursor/rules/` or `.gemini/` artifacts.
|
|
37
|
+
|
|
38
|
+
## Workspace Facts
|
|
39
|
+
|
|
40
|
+
_Stable repo facts — prefer these over re-discovery._
|
|
41
|
+
|
|
42
|
+
- Stack: Markdown / Bash documentation project; skills sync via `bash scripts/sync-skills.sh`.
|
|
43
|
+
- Planning SoT: `specs/state.yaml`, `specs/release-plan.yaml`, `specs/execution-status.yaml`.
|
|
44
|
+
- Story traceability: `# story: eNNsNN` tags in implementing files; `bash scripts/trace-stories.sh --strict` in CI.
|
|
45
|
+
- Rule matrix: `bash scripts/compile-rule-matrix.sh` → `specs/rule-matrix.json` (P0–P3 tiers from CONVENTIONS.md).
|
|
46
|
+
<!-- END bigpowers:learned-preferences -->
|
|
47
|
+
|
|
8
48
|
## Project
|
|
9
49
|
|
|
10
50
|
bigpowers — agent skills for spec-driven, test-first software development by solo developers (skill count and catalog are auto-generated in `SKILL-INDEX.md`; never hardcode the count in docs).
|
|
@@ -62,6 +102,18 @@ Collection of verb-noun skills under `skills/`, each with a SKILL.md source file
|
|
|
62
102
|
|
|
63
103
|
## Token Management
|
|
64
104
|
|
|
105
|
+
**Mechanical backstop (e45s03):** `scripts/hooks/token-mgmt-pre-tool-use.sh` blocks oversized tool calls when prose rules are ignored. Wire as a `PreToolUse` hook for `Read`, `Grep`, and `Bash` (alongside `hooks/pre-tool-use.sh` for git safety). Thresholds: Read >100KB, Grep >200 matches without `head_limit`, Bash commands likely to exceed 500 output lines without `rtk`/`sqz compress`. Install snippet:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"hooks": {
|
|
110
|
+
"PreToolUse": [
|
|
111
|
+
{ "matcher": "Read|Grep|Bash", "hooks": [{ "type": "command", "command": "bash scripts/hooks/token-mgmt-pre-tool-use.sh" }] }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
65
117
|
Context engineering (write/select/compress/isolate — see `docs/references/context-engineering.md`):
|
|
66
118
|
|
|
67
119
|
- **Write (token-efficient content):** Short functions (4-20 lines), unique symbol names, headless tests. Don't restate code in comments.
|
|
@@ -113,9 +165,15 @@ Before any task, run this sequence — not optional:
|
|
|
113
165
|
- Search with `bts find` before opening files to locate a symbol or pattern.
|
|
114
166
|
- Pipe anything > 200 lines through `bts compress` before adding to context.
|
|
115
167
|
- Run `bts map` when asked for a repo overview.
|
|
116
|
-
- Use `bts docs <lib>` before answering questions about library APIs.
|
|
168
|
+
- Use `bts docs <lib>` before answering questions about library APIs. Doc fetches use `scripts/lib/doc-fetch-cache.sh` (ETag-revalidated, 300s TTL — see `context7-mcp` skill, e45s20).
|
|
117
169
|
- If a tool is missing, say so and run `bts doctor` — do not silently substitute.
|
|
118
170
|
|
|
171
|
+
<!-- BEGIN rtk-pretooluse-hook (e45s16 — mechanical PreToolUse backstop; remove block to disable) -->
|
|
172
|
+
|
|
173
|
+
**RTK hook (installed):** `scripts/hooks/rtk-rewrite.sh` is symlinked into `~/.claude/hooks/` by `bash scripts/install.sh` and registered as a Bash `PreToolUse` hook. It delegates to `rtk hook claude` — prose rules below are a fallback only when the hook is absent.
|
|
174
|
+
|
|
175
|
+
<!-- END rtk-pretooluse-hook -->
|
|
176
|
+
|
|
119
177
|
<!-- BEGIN sqz-claude-guidance (auto-installed by sqz init; remove this block to disable) -->
|
|
120
178
|
|
|
121
179
|
## sqz — Context Compression (READ FIRST)
|
package/CONVENTIONS.md
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
# story: e05s01 e46s04
|
|
2
|
+
# story: e06s02
|
|
3
|
+
# story: e07s01
|
|
1
4
|
# story: e30s02
|
|
2
5
|
# story: e30s03
|
|
3
6
|
# story: e38s08
|
|
7
|
+
# story: e45s10
|
|
4
8
|
# story: e51s01
|
|
9
|
+
# story: e45s25
|
|
10
|
+
# story: e45s36
|
|
11
|
+
# story: e27s01
|
|
12
|
+
# story: e29s03
|
|
5
13
|
|
|
6
14
|
# Conventions
|
|
7
15
|
|
|
@@ -86,6 +94,43 @@ Discovered fixes ship in the **same PR** as the original work but in **separate
|
|
|
86
94
|
|
|
87
95
|
**Hard block:** Red Preflight or red CI blocks kickoff-branch, develop-tdd, and verify-work forward progress until fix-or-log produces green.
|
|
88
96
|
|
|
97
|
+
## Risk Tiers (Effective Rule Matrix)
|
|
98
|
+
|
|
99
|
+
Human-readable source of truth for verification depth. Machine-readable compile:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
bash scripts/compile-rule-matrix.sh # → specs/rule-matrix.json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Diff `specs/rule-matrix.json` across git tags to audit rule drift. Schema version in JSON `matrix_version` field.
|
|
106
|
+
|
|
107
|
+
### P0 — Critical (never violate)
|
|
108
|
+
|
|
109
|
+
- **[always-green]**: Preflight and CI must be green before forward work. (`verify-work`, `kickoff-branch`, `develop-tdd`)
|
|
110
|
+
- **[no-direct-coding]**: Route feature work through bigpowers skills — no ad-hoc implementation without a plan in `specs/`. (`plan-work`, `orchestrate-project`)
|
|
111
|
+
- **[traceability]**: Every story has ≥1 `story: eNNsNN` tag in implementing code or tests. (`trace-stories.sh --strict`)
|
|
112
|
+
- **[no-generated-edits]**: Never edit `.cursor/rules/`, `.gemini/`, or `website/src/content/docs/` directly. (`sync-skills.sh`)
|
|
113
|
+
|
|
114
|
+
### P1 — High (fix before merge)
|
|
115
|
+
|
|
116
|
+
- **[conventional-commits]**: All commits follow Conventional Commits; semantic-release owns version bumps. (`commit-message`, `release-branch`)
|
|
117
|
+
- **[verify-per-story]**: Every story/task has runnable `verify:` commands; `verify-work` confirms before done. (`plan-work`, `verify-work`)
|
|
118
|
+
- **[test-on-change]**: New functions and bug fixes include tests; regressions get regression tests. (`develop-tdd`, `validate-fix`)
|
|
119
|
+
- **[branch-protection]**: No direct work on `main`/`master`; feature branches via `kickoff-branch`. (`guard-git`)
|
|
120
|
+
|
|
121
|
+
### P2 — Medium (address in same epic or next)
|
|
122
|
+
|
|
123
|
+
- **[plan-tests-waiver]**: P2/P3-dominant epics may set `test_plan: waived` in `state.yaml`. (`plan-tests`)
|
|
124
|
+
- **[file-size-cap]**: Source files under 300 lines unless listed in § File-Size Exceptions. (`audit-code`)
|
|
125
|
+
- **[handoff-signaling]**: Critical-path skills write `handoff.next_skill` to `state.yaml`. (`session-state`)
|
|
126
|
+
- **[delta-requirements]**: Behavior changes require `ADDED`/`MODIFIED`/`REMOVED`/`RENAMED` tags in requirement specs. (`plan-work`, `change-request`)
|
|
127
|
+
|
|
128
|
+
### P3 — Low (best effort)
|
|
129
|
+
|
|
130
|
+
- **[boy-scout]**: Leave touched files at least as clean as found. (`audit-code`)
|
|
131
|
+
- **[terse-when-heavy]**: Switch to `terse-mode` when context exceeds ~20 turns. (`terse-mode`)
|
|
132
|
+
- **[skill-naming]**: Verb-noun kebab-case under `skills/`; documented exceptions only. (`craft-skill`)
|
|
133
|
+
|
|
89
134
|
### Banned dismissive phrases
|
|
90
135
|
|
|
91
136
|
Agents MUST NOT use these phrases (or close paraphrases) to ignore reproducible failures:
|
|
@@ -178,6 +223,30 @@ When planning closes, copy to `specs/product/snapshots/release-<version>/` (`rel
|
|
|
178
223
|
|
|
179
224
|
Validate YAML layout: `bash scripts/validate-specs-yaml.sh`. Patch runtime keys: `bash scripts/bp-yaml-set.sh specs/state.yaml git.branch feat/foo`.
|
|
180
225
|
|
|
226
|
+
### Documentation Responsibilities (e45s36)
|
|
227
|
+
|
|
228
|
+
Each specs/ artifact owns specific facts. Update the owning file when the fact changes — do not duplicate across files.
|
|
229
|
+
|
|
230
|
+
| File / directory | Owns | Update when |
|
|
231
|
+
|------------------|------|-------------|
|
|
232
|
+
| `specs/state.yaml` | Active session, handoff, story timing, workflow mode | Every skill handoff; branch switch; story start/end |
|
|
233
|
+
| `specs/release-plan.yaml` | Epic ordering, WSJF, BCP baselines, release codename | New epic scoped; WSJF re-prioritized; BCP re-estimated |
|
|
234
|
+
| `specs/execution-status.yaml` | Story/epic done/todo status (sole SoT) | Story completes; gate-trace runs; manual status change |
|
|
235
|
+
| `specs/product/SCOPE_LATEST.yaml` | In/out of scope, initiative boundaries | scope-work; change-request Add mode |
|
|
236
|
+
| `specs/product/VISION_LATEST.yaml` | North star, strategic intent | Major product pivot; scope-work |
|
|
237
|
+
| `specs/product/GLOSSARY_LATEST.yaml` | Canonical domain terms | define-language; model-domain term crystallizes |
|
|
238
|
+
| `specs/epics/eNN-*/epic.yaml` | Epic manifest, story list, BCPs | slice-tasks; plan-work adds stories |
|
|
239
|
+
| `specs/epics/eNN-*/eNNsYY-*.md` | Story requirements (countable-story-format) | plan-work; section approval state changes |
|
|
240
|
+
| `specs/epics/eNN-*/eNNsYY-tasks.yaml` | Runnable implementation tasks + verify | plan-work; develop-tdd task completion |
|
|
241
|
+
| `specs/tech-architecture/tech-stack.md` | Stack, modules, gray areas | map-codebase; deepen-architecture; model-domain |
|
|
242
|
+
| `specs/tech-architecture/eNN-TEST_PLAN_LATEST.md` | P0/P1 test scenarios per epic | plan-tests |
|
|
243
|
+
| `specs/adr/ADR-*.md` | Architectural decisions | model-domain; deepen-architecture ADR offer accepted |
|
|
244
|
+
| `specs/bugs/BUG-*.md` | Bug RCA + fix plan | investigate-bug |
|
|
245
|
+
| `specs/bugs/registry.yaml` | Bug index (generated) | inspect-quality; sync-bugs-registry.sh |
|
|
246
|
+
| `specs/verifications/*` | Verify evidence, audit reports, eval reports | verify-work; audit-code; run-evals |
|
|
247
|
+
| `specs/security/REVIEW.md` | Latest security scan findings | security-review |
|
|
248
|
+
| `specs/metrics/cycle-times.yaml` | Delivery velocity ledger | release-branch lands story |
|
|
249
|
+
|
|
181
250
|
### Generated artifact targets
|
|
182
251
|
|
|
183
252
|
Skill content is edited in `skills/*/SKILL.md` and auto-propagated to these targets by `bash scripts/sync-skills.sh`:
|
|
@@ -300,3 +369,15 @@ BUG-2026-07-06-gate-trace-matrix-oversized. Prior exception rows for trace-matri
|
|
|
300
369
|
and trace-stories.py are removed — both are now under the 300-line cap.
|
|
301
370
|
|
|
302
371
|
Any new exception requires an entry in this table with rationale and a review date.
|
|
372
|
+
|
|
373
|
+
## docs/references SSOT Sync (e45s10)
|
|
374
|
+
|
|
375
|
+
Agent-guidance files under `docs/references/` are **distilled from upstream sources**, not hand-edited ad hoc. Canonical inputs live in `CLAUDE.md`, `docs/PRINCIPLES.md`, and `skills/*/SKILL.md`.
|
|
376
|
+
|
|
377
|
+
| Action | Command |
|
|
378
|
+
|--------|---------|
|
|
379
|
+
| Regenerate locally | `bash scripts/sync-references.sh` |
|
|
380
|
+
| Manifest | `scripts/references-manifest.yaml` |
|
|
381
|
+
| Scheduled CI | `.github/workflows/sync-references.yml` (weekly) |
|
|
382
|
+
|
|
383
|
+
After changing SKILL.md `model:` frontmatter or token-management prose in CLAUDE.md, run `sync-references.sh` to refresh reference docs and `.sync-stamp`.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
**Agent skills synthesizing 17 years of software engineering discipline — from Clean Code to AI-native architecture — into a single, prescriptive methodology for solo developers.**
|
|
8
8
|
|
package/SKILL-INDEX.md
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# story: e45s31
|
|
3
|
+
# Rank files by git churn for review prioritization (aidd-churn pattern).
|
|
4
|
+
# Usage: bash scripts/bp-churn-rank.sh [--since 90.days] [--limit N] [path...]
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SINCE="90.days"
|
|
8
|
+
LIMIT=20
|
|
9
|
+
PATHS=()
|
|
10
|
+
|
|
11
|
+
while [[ $# -gt 0 ]]; do
|
|
12
|
+
case "$1" in
|
|
13
|
+
--since)
|
|
14
|
+
SINCE="${2:?--since requires a value}"
|
|
15
|
+
shift 2
|
|
16
|
+
;;
|
|
17
|
+
--limit)
|
|
18
|
+
LIMIT="${2:?--limit requires a number}"
|
|
19
|
+
shift 2
|
|
20
|
+
;;
|
|
21
|
+
-h|--help)
|
|
22
|
+
echo "Usage: bash scripts/bp-churn-rank.sh [--since 90.days] [--limit 20] [path...]"
|
|
23
|
+
exit 0
|
|
24
|
+
;;
|
|
25
|
+
*)
|
|
26
|
+
PATHS+=("$1")
|
|
27
|
+
shift
|
|
28
|
+
;;
|
|
29
|
+
esac
|
|
30
|
+
done
|
|
31
|
+
|
|
32
|
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
33
|
+
echo "FAIL: not a git repository" >&2
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
PATHSPEC=""
|
|
38
|
+
if [[ ${#PATHS[@]} -gt 0 ]]; then
|
|
39
|
+
PATHSPEC="-- ${PATHS[*]}"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# shellcheck disable=SC2086
|
|
43
|
+
git log --since="$SINCE" --name-only --pretty=format: $PATHSPEC \
|
|
44
|
+
| grep -v '^$' \
|
|
45
|
+
| sort \
|
|
46
|
+
| uniq -c \
|
|
47
|
+
| sort -rn \
|
|
48
|
+
| head -n "$LIMIT" \
|
|
49
|
+
| awk '{printf "%4d %s\n", $1, $2}'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
+
# story: e21s03
|
|
2
3
|
# bp-read-agents.sh — Extract preflight/test/build/lint/deploy commands from AGENTS.md.
|
|
3
4
|
# Outputs env-var exports: BP_PREFLIGHT, BP_TEST, BP_BUILD, BP_LINT, BP_DEPLOY
|
|
4
5
|
# Usage: eval "$(bash scripts/bp-read-agents.sh)" # imports env vars
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# story: e45s14
|
|
3
|
+
# check-import-boundaries.sh — enforce specs/import-boundaries.json in CI
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
+
BOUNDARIES="$REPO_ROOT/specs/import-boundaries.json"
|
|
9
|
+
|
|
10
|
+
if [[ ! -f "$BOUNDARIES" ]]; then
|
|
11
|
+
echo "FAIL: missing $BOUNDARIES"
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
python3 - "$REPO_ROOT" "$BOUNDARIES" <<'PY'
|
|
16
|
+
import json, re, sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
root = Path(sys.argv[1])
|
|
20
|
+
rules_path = Path(sys.argv[2])
|
|
21
|
+
rules = json.loads(rules_path.read_text(encoding="utf-8"))
|
|
22
|
+
|
|
23
|
+
def glob_match(pattern: str, path: str) -> bool:
|
|
24
|
+
import fnmatch
|
|
25
|
+
return fnmatch.fnmatch(path, pattern)
|
|
26
|
+
|
|
27
|
+
violations = []
|
|
28
|
+
|
|
29
|
+
for boundary in rules.get("boundaries", []):
|
|
30
|
+
from_pat = boundary["from"]
|
|
31
|
+
allow = boundary.get("allow", [])
|
|
32
|
+
deny = boundary.get("deny", [])
|
|
33
|
+
|
|
34
|
+
for sh in root.glob("scripts/**/*.sh"):
|
|
35
|
+
rel = sh.relative_to(root).as_posix()
|
|
36
|
+
if not glob_match(from_pat, rel):
|
|
37
|
+
continue
|
|
38
|
+
text = sh.read_text(encoding="utf-8", errors="replace")
|
|
39
|
+
for line in text.splitlines():
|
|
40
|
+
m = re.match(r'^\s*(?:source|\.)\s+["\']?([^"\']+)["\']?', line)
|
|
41
|
+
if not m:
|
|
42
|
+
continue
|
|
43
|
+
target = m.group(1)
|
|
44
|
+
if target.startswith("$"):
|
|
45
|
+
continue
|
|
46
|
+
if not target.startswith("scripts/") and not target.startswith("guard-git/"):
|
|
47
|
+
if any(glob_match(d, target) for d in deny):
|
|
48
|
+
violations.append(f"{rel}: forbidden source {target}")
|
|
49
|
+
continue
|
|
50
|
+
rel_target = target
|
|
51
|
+
if not (Path(root / rel_target).exists() or glob_match(rel_target, rel_target)):
|
|
52
|
+
pass
|
|
53
|
+
allowed = any(glob_match(a, rel_target) for a in allow)
|
|
54
|
+
if not allowed:
|
|
55
|
+
violations.append(f"{rel}: source {rel_target} not in allowlist for {from_pat}")
|
|
56
|
+
|
|
57
|
+
if violations:
|
|
58
|
+
print("IMPORT BOUNDARY FAIL:")
|
|
59
|
+
for v in violations:
|
|
60
|
+
print(f" {v}")
|
|
61
|
+
sys.exit(1)
|
|
62
|
+
|
|
63
|
+
print(f"IMPORT BOUNDARIES OK ({len(rules.get('boundaries', []))} rules)")
|
|
64
|
+
PY
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# story: e45s25
|
|
3
|
+
# Compile CONVENTIONS.md risk tiers → versioned specs/rule-matrix.json
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
source "$(dirname "${BASH_SOURCE[0]}")/lib/python-env.sh"
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
9
|
+
CONVENTIONS="$REPO_ROOT/CONVENTIONS.md"
|
|
10
|
+
OUTPUT="$REPO_ROOT/specs/rule-matrix.json"
|
|
11
|
+
MATRIX_VERSION="1.0.0"
|
|
12
|
+
|
|
13
|
+
show_help() {
|
|
14
|
+
cat <<EOF
|
|
15
|
+
Usage: $(basename "$0") [OPTION]
|
|
16
|
+
|
|
17
|
+
Compile CONVENTIONS.md § Risk Tiers into specs/rule-matrix.json.
|
|
18
|
+
P0/P1/P2/P3 entries are diffable across git tags.
|
|
19
|
+
|
|
20
|
+
Options:
|
|
21
|
+
--stdout Print JSON to stdout instead of writing file
|
|
22
|
+
--help Show this help and exit
|
|
23
|
+
EOF
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
STDOUT_ONLY=0
|
|
27
|
+
if [ "$#" -eq 1 ]; then
|
|
28
|
+
case "$1" in
|
|
29
|
+
--help) show_help; exit 0 ;;
|
|
30
|
+
--stdout) STDOUT_ONLY=1 ;;
|
|
31
|
+
*) echo "[ERROR] Unknown option: $1" >&2; exit 1 ;;
|
|
32
|
+
esac
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if [ ! -f "$CONVENTIONS" ]; then
|
|
36
|
+
echo "[ERROR] CONVENTIONS.md not found at $CONVENTIONS" >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
$PYTHON - "$CONVENTIONS" "$OUTPUT" "$MATRIX_VERSION" "$STDOUT_ONLY" <<'PY'
|
|
41
|
+
import hashlib
|
|
42
|
+
import json
|
|
43
|
+
import re
|
|
44
|
+
import sys
|
|
45
|
+
from datetime import datetime, timezone
|
|
46
|
+
|
|
47
|
+
conventions_path, output_path, matrix_version, stdout_only = sys.argv[1:5]
|
|
48
|
+
stdout_only = stdout_only == "1"
|
|
49
|
+
|
|
50
|
+
with open(conventions_path, encoding="utf-8") as f:
|
|
51
|
+
content = f.read()
|
|
52
|
+
|
|
53
|
+
source_hash = hashlib.sha256(content.encode("utf-8")).hexdigest()[:16]
|
|
54
|
+
|
|
55
|
+
# Extract Risk Tiers section
|
|
56
|
+
m = re.search(
|
|
57
|
+
r"^## Risk Tiers \(Effective Rule Matrix\)\s*\n(.*?)(?=^## |\Z)",
|
|
58
|
+
content,
|
|
59
|
+
re.MULTILINE | re.DOTALL,
|
|
60
|
+
)
|
|
61
|
+
if not m:
|
|
62
|
+
print("[ERROR] CONVENTIONS.md missing '## Risk Tiers (Effective Rule Matrix)'", file=sys.stderr)
|
|
63
|
+
sys.exit(1)
|
|
64
|
+
|
|
65
|
+
section = m.group(1)
|
|
66
|
+
tier_re = re.compile(r"^### (P[0-3]) —[^\n]*\n(.*?)(?=^### |\Z)", re.MULTILINE | re.DOTALL)
|
|
67
|
+
rule_re = re.compile(
|
|
68
|
+
r"^- \*\*\[([^\]]+)\]\*\*:\s*(.+?)\.\s*\(([^)]+)\)\s*$",
|
|
69
|
+
re.MULTILINE,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
tiers: dict[str, list[dict]] = {"P0": [], "P1": [], "P2": [], "P3": []}
|
|
73
|
+
|
|
74
|
+
for tier_match in tier_re.finditer(section):
|
|
75
|
+
tier = tier_match.group(1)
|
|
76
|
+
body = tier_match.group(2)
|
|
77
|
+
for rule_match in rule_re.finditer(body):
|
|
78
|
+
rule_id, text, enforce_raw = rule_match.groups()
|
|
79
|
+
enforce = [s.strip().strip("`") for s in enforce_raw.split(",")]
|
|
80
|
+
tiers[tier].append(
|
|
81
|
+
{
|
|
82
|
+
"id": rule_id,
|
|
83
|
+
"text": text.strip(),
|
|
84
|
+
"enforce": enforce,
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
for tier in tiers:
|
|
89
|
+
if not tiers[tier]:
|
|
90
|
+
print(f"[ERROR] No rules parsed for tier {tier}", file=sys.stderr)
|
|
91
|
+
sys.exit(1)
|
|
92
|
+
|
|
93
|
+
doc = {
|
|
94
|
+
"matrix_version": matrix_version,
|
|
95
|
+
"generated_at": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
|
|
96
|
+
"source": "CONVENTIONS.md",
|
|
97
|
+
"source_section": "Risk Tiers (Effective Rule Matrix)",
|
|
98
|
+
"source_hash": source_hash,
|
|
99
|
+
"tiers": tiers,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
payload = json.dumps(doc, indent=2, sort_keys=True) + "\n"
|
|
103
|
+
|
|
104
|
+
if stdout_only:
|
|
105
|
+
print(payload, end="")
|
|
106
|
+
else:
|
|
107
|
+
import os
|
|
108
|
+
|
|
109
|
+
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
|
110
|
+
with open(output_path, "w", encoding="utf-8") as out:
|
|
111
|
+
out.write(payload)
|
|
112
|
+
total = sum(len(v) for v in tiers.values())
|
|
113
|
+
print(f"OK: wrote {output_path} ({total} rules, matrix_version={matrix_version})")
|
|
114
|
+
PY
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# story: e45s16
|
|
3
|
+
# rtk-rewrite.sh — PreToolUse hook delegating to rtk's native Bash rewriter.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
if command -v rtk >/dev/null 2>&1; then
|
|
7
|
+
exec rtk hook claude
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
# rtk missing — pass through unchanged (agent should run `bts doctor` / install rtk)
|
|
11
|
+
exit 0
|