@thebassclef/lite 0.1.2 → 1.0.0

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 (293) hide show
  1. package/dist/cli.cjs +238 -127
  2. package/dist/cli.js +240 -129
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/lite/.bassclef-source.json +10 -0
  7. package/dist/lite/.claude/settings.json +212 -0
  8. package/dist/lite/CLAUDE.md +41 -0
  9. package/dist/lite/gitignore +58 -0
  10. package/dist/lite/standards/bassclef-wiring-manifest.json +497 -0
  11. package/dist/lite/whereami.md +24 -0
  12. package/package.json +8 -2
  13. package/substrate/.bassclef/lite-manifest.json +0 -2701
  14. package/substrate/.claude/agents/architect.md +0 -70
  15. package/substrate/.claude/agents/builder.md +0 -114
  16. package/substrate/.claude/agents/designer.md +0 -156
  17. package/substrate/.claude/agents/reviewer.md +0 -88
  18. package/substrate/.claude/hooks/artifact-ingestion-gate.sh +0 -357
  19. package/substrate/.claude/hooks/assert-verify-steering.sh +0 -77
  20. package/substrate/.claude/hooks/bassclef-source-config-validate.sh +0 -215
  21. package/substrate/.claude/hooks/bassclef-sync.sh +0 -634
  22. package/substrate/.claude/hooks/compound-noun-scrub.sh +0 -292
  23. package/substrate/.claude/hooks/kiss-expansion-inject.sh +0 -69
  24. package/substrate/.claude/hooks/longrun-prep-compounding-axis-check.sh +0 -492
  25. package/substrate/.claude/hooks/longrun-prep-compounding-sequence-check.sh +0 -492
  26. package/substrate/.claude/hooks/plain-english-steering.sh +0 -156
  27. package/substrate/.claude/hooks/post-skill-friction-check.sh +0 -177
  28. package/substrate/.claude/hooks/post-skill-telemetry.sh +0 -62
  29. package/substrate/.claude/hooks/pre-build-gate.sh +0 -511
  30. package/substrate/.claude/hooks/pre-commit-gate.sh +0 -451
  31. package/substrate/.claude/hooks/session-end.sh +0 -433
  32. package/substrate/.claude/hooks/session-reflection.sh +0 -303
  33. package/substrate/.claude/hooks/skill-body-grade-gate.sh +0 -219
  34. package/substrate/.claude/hooks/skill-body-intent-drift.sh +0 -107
  35. package/substrate/.claude/hooks/skill-step-list-check.sh +0 -171
  36. package/substrate/.claude/hooks/state-validate.sh +0 -271
  37. package/substrate/.claude/hooks/substrate-clarity-gate.sh +0 -1110
  38. package/substrate/.claude/hooks/temperance-gate.sh +0 -147
  39. package/substrate/.claude/hooks/testing-tier-enforce.sh +0 -233
  40. package/substrate/.claude/hooks/turn-prose-grade-measure.sh +0 -219
  41. package/substrate/.claude/hooks/turn-prose-kiss-check.sh +0 -463
  42. package/substrate/.claude/hooks/vocabulary-migration-check.sh +0 -171
  43. package/substrate/.claude/hooks/whereami-utc-gate.sh +0 -142
  44. package/substrate/.claude/luminaries/alan-cooper.md +0 -170
  45. package/substrate/.claude/luminaries/alistair-cockburn.md +0 -140
  46. package/substrate/.claude/luminaries/amazon-pr-faq.md +0 -34
  47. package/substrate/.claude/luminaries/ash-maurya.md +0 -121
  48. package/substrate/.claude/luminaries/bill-buxton.md +0 -210
  49. package/substrate/.claude/luminaries/charles-sanders-peirce.md +0 -150
  50. package/substrate/.claude/luminaries/david-ogilvy.md +0 -192
  51. package/substrate/.claude/luminaries/don-norman.md +0 -173
  52. package/substrate/.claude/luminaries/edward-tufte.md +0 -179
  53. package/substrate/.claude/luminaries/eric-evans.md +0 -160
  54. package/substrate/.claude/luminaries/frederick-brooks.md +0 -50
  55. package/substrate/.claude/luminaries/gang-of-four.md +0 -157
  56. package/substrate/.claude/luminaries/glenford-myers.md +0 -230
  57. package/substrate/.claude/luminaries/hunt-thomas.md +0 -115
  58. package/substrate/.claude/luminaries/hyrum-wright.md +0 -94
  59. package/substrate/.claude/luminaries/jason-fried-dhh.md +0 -46
  60. package/substrate/.claude/luminaries/jesse-james-garrett.md +0 -154
  61. package/substrate/.claude/luminaries/john-ousterhout.md +0 -94
  62. package/substrate/.claude/luminaries/karl-popper.md +0 -132
  63. package/substrate/.claude/luminaries/kent-beck.md +0 -168
  64. package/substrate/.claude/luminaries/linus-torvalds.md +0 -218
  65. package/substrate/.claude/luminaries/martin-fowler.md +0 -164
  66. package/substrate/.claude/luminaries/michael-feathers.md +0 -125
  67. package/substrate/.claude/luminaries/michael-nygard.md +0 -118
  68. package/substrate/.claude/luminaries/robert-c-martin.md +0 -164
  69. package/substrate/.claude/luminaries/saltzer-schroeder.md +0 -194
  70. package/substrate/.claude/luminaries/sophia-prater.md +0 -193
  71. package/substrate/.claude/luminaries/stephen-toulmin.md +0 -131
  72. package/substrate/.claude/luminaries/tony-hoare.md +0 -170
  73. package/substrate/.claude/luminaries/vaughn-vernon.md +0 -50
  74. package/substrate/.claude/luminaries/w-edwards-deming.md +0 -158
  75. package/substrate/.claude/rules/accessor-library-discipline.md +0 -138
  76. package/substrate/.claude/rules/adr-discipline.md +0 -120
  77. package/substrate/.claude/rules/api-conventions.md +0 -125
  78. package/substrate/.claude/rules/artifact-ingestion.md +0 -179
  79. package/substrate/.claude/rules/assert-only-after-verify.md +0 -137
  80. package/substrate/.claude/rules/blocked-items.md +0 -146
  81. package/substrate/.claude/rules/bootstrap-pair-discipline.md +0 -141
  82. package/substrate/.claude/rules/branching.md +0 -28
  83. package/substrate/.claude/rules/cold-adopter-harness-discipline.md +0 -129
  84. package/substrate/.claude/rules/commit-conventions.md +0 -22
  85. package/substrate/.claude/rules/compounding-axis-fresh-analysis.md +0 -188
  86. package/substrate/.claude/rules/compounding-sequence-fresh-analysis.md +0 -188
  87. package/substrate/.claude/rules/context-engineering.md +0 -202
  88. package/substrate/.claude/rules/context-management.md +0 -85
  89. package/substrate/.claude/rules/defensive-bash.md +0 -68
  90. package/substrate/.claude/rules/deferred-actions.md +0 -233
  91. package/substrate/.claude/rules/destructive-operations.md +0 -69
  92. package/substrate/.claude/rules/diagnosis.md +0 -38
  93. package/substrate/.claude/rules/github-issue-flash-tweet.md +0 -156
  94. package/substrate/.claude/rules/guardrails.md +0 -73
  95. package/substrate/.claude/rules/hook-wire-on-author.md +0 -103
  96. package/substrate/.claude/rules/identifier-leak-prevention.md +0 -104
  97. package/substrate/.claude/rules/iteration-bet-brief-completeness.md +0 -54
  98. package/substrate/.claude/rules/lite-manifest-schema-change-discipline.md +0 -98
  99. package/substrate/.claude/rules/longrun-prep-plan-doc-compression.md +0 -89
  100. package/substrate/.claude/rules/loop-discipline.md +0 -81
  101. package/substrate/.claude/rules/manual-prod-approval.md +0 -100
  102. package/substrate/.claude/rules/marker-enrichment-discipline.md +0 -99
  103. package/substrate/.claude/rules/mobile-ephemeral-session.md +0 -109
  104. package/substrate/.claude/rules/new-dependency-check.md +0 -51
  105. package/substrate/.claude/rules/oo-ad-entry-point.md +0 -117
  106. package/substrate/.claude/rules/operator-facing-prose.md +0 -196
  107. package/substrate/.claude/rules/option-label-discipline.md +0 -108
  108. package/substrate/.claude/rules/pattern-annotation.md +0 -100
  109. package/substrate/.claude/rules/plain-english-discipline.md +0 -156
  110. package/substrate/.claude/rules/plan-enumeration-needs-value-props.md +0 -211
  111. package/substrate/.claude/rules/pr-body-shape.md +0 -317
  112. package/substrate/.claude/rules/pr-strategy.md +0 -167
  113. package/substrate/.claude/rules/pr-title-shape.md +0 -161
  114. package/substrate/.claude/rules/prototype-workflow.md +0 -65
  115. package/substrate/.claude/rules/reserved-skill-names.md +0 -123
  116. package/substrate/.claude/rules/schema-management.md +0 -49
  117. package/substrate/.claude/rules/sdlc-gates.md +0 -149
  118. package/substrate/.claude/rules/security.md +0 -37
  119. package/substrate/.claude/rules/session-artifacts.md +0 -236
  120. package/substrate/.claude/rules/skill-composition-declarations.md +0 -124
  121. package/substrate/.claude/rules/skill-description-clarity.md +0 -247
  122. package/substrate/.claude/rules/skill-procedure-step-list.md +0 -137
  123. package/substrate/.claude/rules/state-schema-validation.md +0 -162
  124. package/substrate/.claude/rules/stuck-signal-diagnostic.md +0 -140
  125. package/substrate/.claude/rules/substrate-config-schema.md +0 -98
  126. package/substrate/.claude/rules/test-list-discipline.md +0 -175
  127. package/substrate/.claude/rules/test-sufficiency.md +0 -210
  128. package/substrate/.claude/rules/testing-tier-config.md +0 -145
  129. package/substrate/.claude/rules/testing.md +0 -38
  130. package/substrate/.claude/rules/turn-estimate-grounding.md +0 -134
  131. package/substrate/.claude/rules/visual-hierarchy.md +0 -437
  132. package/substrate/.claude/rules/we-dont-break-adopters.md +0 -126
  133. package/substrate/.claude/rules/whereami-load-bearing.md +0 -202
  134. package/substrate/.claude/rules/writing-craft-discipline.md +0 -92
  135. package/substrate/.claude/rules/wu-sequencing-compounds.md +0 -145
  136. package/substrate/.claude/skills/build/SKILL.md +0 -640
  137. package/substrate/.claude/skills/chronicle/SKILL.md +0 -55
  138. package/substrate/.claude/skills/clean-artifacts/SKILL.md +0 -249
  139. package/substrate/.claude/skills/decompose/SKILL.md +0 -280
  140. package/substrate/.claude/skills/diagnose/SKILL.md +0 -297
  141. package/substrate/.claude/skills/feynman/SKILL.md +0 -90
  142. package/substrate/.claude/skills/howdoi/SKILL.md +0 -105
  143. package/substrate/.claude/skills/ia-model/SKILL.md +0 -108
  144. package/substrate/.claude/skills/interaction-design/SKILL.md +0 -112
  145. package/substrate/.claude/skills/interpret-input/SKILL.md +0 -180
  146. package/substrate/.claude/skills/journal/SKILL.md +0 -209
  147. package/substrate/.claude/skills/kiss/SKILL.md +0 -449
  148. package/substrate/.claude/skills/launch/SKILL.md +0 -915
  149. package/substrate/.claude/skills/lean-canvas/SKILL.md +0 -332
  150. package/substrate/.claude/skills/longrun/SKILL.md +0 -463
  151. package/substrate/.claude/skills/luminary/SKILL.md +0 -481
  152. package/substrate/.claude/skills/ogilvy-writing-audit/SKILL.md +0 -177
  153. package/substrate/.claude/skills/onboard-repo/SKILL.md +0 -1624
  154. package/substrate/.claude/skills/pattern-review/SKILL.md +0 -99
  155. package/substrate/.claude/skills/personas/SKILL.md +0 -207
  156. package/substrate/.claude/skills/promote/SKILL.md +0 -283
  157. package/substrate/.claude/skills/requirement/SKILL.md +0 -98
  158. package/substrate/.claude/skills/retro/SKILL.md +0 -117
  159. package/substrate/.claude/skills/riff/SKILL.md +0 -114
  160. package/substrate/.claude/skills/roadmap-reconcile/SKILL.md +0 -163
  161. package/substrate/.claude/skills/session-end/SKILL.md +0 -309
  162. package/substrate/.claude/skills/session-log/SKILL.md +0 -299
  163. package/substrate/.claude/skills/skills/SKILL.md +0 -228
  164. package/substrate/.claude/skills/spec/SKILL.md +0 -105
  165. package/substrate/.claude/skills/sprint/SKILL.md +0 -392
  166. package/substrate/.claude/skills/stage/SKILL.md +0 -384
  167. package/substrate/.claude/skills/state-a-problem/SKILL.md +0 -185
  168. package/substrate/.claude/skills/temperance/SKILL.md +0 -108
  169. package/substrate/.claude/skills/use-case/SKILL.md +0 -417
  170. package/substrate/.claude/skills/user-stories/SKILL.md +0 -268
  171. package/substrate/.claude/skills/value-prop/SKILL.md +0 -251
  172. package/substrate/.claude/skills/verify/SKILL.md +0 -160
  173. package/substrate/.claude/skills/visual-review/SKILL.md +0 -503
  174. package/substrate/.claude/skills/whats-the-plan/SKILL.md +0 -202
  175. package/substrate/.claude/skills/whereami/SKILL.md +0 -307
  176. package/substrate/AGENTS.md +0 -79
  177. package/substrate/CLAUDE-lite.md +0 -85
  178. package/substrate/CODE_OF_CONDUCT.md +0 -28
  179. package/substrate/CONTRIBUTING.md +0 -177
  180. package/substrate/README.md +0 -173
  181. package/substrate/SECURITY.md +0 -19
  182. package/substrate/architecture/decisions/ADR-029-release-pipeline.md +0 -79
  183. package/substrate/architecture/decisions/ADR-031-non-breaking-changes-adopter-discipline.md +0 -139
  184. package/substrate/architecture/decisions/ADR-032-adopter-sync-dispatcher-architecture.md +0 -192
  185. package/substrate/architecture/decisions/ADR-039-release-tagging-scheme.md +0 -145
  186. package/substrate/architecture/decisions/ADR-040-planning-skill-vocabulary-and-lite-profile.md +0 -155
  187. package/substrate/architecture/decisions/ADR-044-unified-skill-body-template.md +0 -162
  188. package/substrate/lib/clean-artifacts-sweep.sh +0 -112
  189. package/substrate/lib/code-comment-discipline.sh +0 -144
  190. package/substrate/lib/composer-preflight.sh +0 -459
  191. package/substrate/lib/hook-inject.sh +0 -255
  192. package/substrate/lib/luminary-pick.sh +0 -96
  193. package/substrate/lib/output-discipline.sh +0 -143
  194. package/substrate/lib/prose-scan-boundary.sh +0 -171
  195. package/substrate/lib/rewrite-check.sh +0 -214
  196. package/substrate/lib/state.sh +0 -1372
  197. package/substrate/lib/telemetry.sh +0 -205
  198. package/substrate/lib/tier-check.sh +0 -187
  199. package/substrate/lib/tier-dependency-audit.sh +0 -1088
  200. package/substrate/presence/install/bassclef-hook-connect.sh +0 -178
  201. package/substrate/presence/install/bassclef-sync.dispatcher.template.sh +0 -841
  202. package/substrate/presence/install/bassclef-sync.template.sh +0 -2076
  203. package/substrate/presence/install/schedule-auto-save.cron.sh +0 -88
  204. package/substrate/presence/install/schedule-auto-save.taskscheduler.md +0 -122
  205. package/substrate/scripts/aggregate-telemetry.sh +0 -217
  206. package/substrate/scripts/analyze-tier-dependencies.sh +0 -239
  207. package/substrate/scripts/generate-lite-manifest.sh +0 -505
  208. package/substrate/scripts/generate-tier-manifest.sh +0 -28
  209. package/substrate/scripts/intent-drift-check.sh +0 -456
  210. package/substrate/scripts/lite-manifest-drift-check.sh +0 -146
  211. package/substrate/scripts/render-lite-manifest-doc.sh +0 -150
  212. package/substrate/standards/adr-template.md +0 -86
  213. package/substrate/standards/api-conventions/nextjs.md +0 -84
  214. package/substrate/standards/artifact-composition.md +0 -209
  215. package/substrate/standards/bash-hook-safety.md +0 -246
  216. package/substrate/standards/bassclef-configs-schema.md +0 -232
  217. package/substrate/standards/bassclef-evolution.md +0 -143
  218. package/substrate/standards/bassclef-internal-jargon.md +0 -244
  219. package/substrate/standards/bassclef-managed-sentinel.md +0 -96
  220. package/substrate/standards/bassclef-source-config.md +0 -228
  221. package/substrate/standards/branch-stacking.md +0 -408
  222. package/substrate/standards/code-safety-principles.md +0 -176
  223. package/substrate/standards/composer-prerequisites.md +0 -155
  224. package/substrate/standards/deferred-actions-schema.md +0 -204
  225. package/substrate/standards/dependency-discipline/cargo.md +0 -39
  226. package/substrate/standards/dependency-discipline/gem.md +0 -43
  227. package/substrate/standards/dependency-discipline/go-mod.md +0 -41
  228. package/substrate/standards/dependency-discipline/npm.md +0 -42
  229. package/substrate/standards/dependency-discipline/pip.md +0 -42
  230. package/substrate/standards/deployment-topology/ec2-tailscale.md +0 -225
  231. package/substrate/standards/deployment-topology.md +0 -69
  232. package/substrate/standards/docs-sync-allowlist.md +0 -76
  233. package/substrate/standards/domain-and-dns.md +0 -145
  234. package/substrate/standards/frontend-stack.md +0 -67
  235. package/substrate/standards/frontmatter-schema.md +0 -154
  236. package/substrate/standards/graceful-exit.md +0 -227
  237. package/substrate/standards/hook-idempotency.md +0 -102
  238. package/substrate/standards/hook-injection-discipline.md +0 -202
  239. package/substrate/standards/hook-install-class.md +0 -215
  240. package/substrate/standards/input-handler-interface.md +0 -152
  241. package/substrate/standards/lite-manifest-schema-changes.md +0 -135
  242. package/substrate/standards/luminary-matching.md +0 -105
  243. package/substrate/standards/luminary-problem-patterns.md +0 -481
  244. package/substrate/standards/migration-discipline/active-record.md +0 -50
  245. package/substrate/standards/migration-discipline/alembic.md +0 -43
  246. package/substrate/standards/migration-discipline/gorm.md +0 -50
  247. package/substrate/standards/migration-discipline/prisma.md +0 -53
  248. package/substrate/standards/migration-discipline/sqlalchemy.md +0 -51
  249. package/substrate/standards/mobile-ephemeral-session.md +0 -167
  250. package/substrate/standards/model-routing-discipline.md +0 -160
  251. package/substrate/standards/ogilvy-writing-rules.md +0 -225
  252. package/substrate/standards/opener-discipline.md +0 -96
  253. package/substrate/standards/operator-facing-prose-discipline.md +0 -201
  254. package/substrate/standards/persona-schema.md +0 -229
  255. package/substrate/standards/pluggable-luminaries.md +0 -323
  256. package/substrate/standards/pr-body-discipline.md +0 -115
  257. package/substrate/standards/preview-state-schema.md +0 -189
  258. package/substrate/standards/project-directory-layout.md +0 -276
  259. package/substrate/standards/release-tagging.md +0 -137
  260. package/substrate/standards/reserved-skill-names.md +0 -120
  261. package/substrate/standards/scannable-multi-option-output.md +0 -261
  262. package/substrate/standards/sdlc-compliance.md +0 -286
  263. package/substrate/standards/sdlc-gates/typescript.md +0 -57
  264. package/substrate/standards/secrets-lifecycle.md +0 -210
  265. package/substrate/standards/security-scanner-adapter.md +0 -145
  266. package/substrate/standards/session-board.md +0 -256
  267. package/substrate/standards/skill-output-discipline.md +0 -90
  268. package/substrate/standards/state-spine-contract.md +0 -255
  269. package/substrate/standards/state-spine.md +0 -511
  270. package/substrate/standards/steering-hints/kiss-words.md +0 -11
  271. package/substrate/standards/substrate-config-schema.md +0 -267
  272. package/substrate/standards/tech-stack-config.md +0 -109
  273. package/substrate/standards/tier-dependency-analysis.md +0 -167
  274. package/substrate/standards/tier-runtime-deps/lite.md +0 -57
  275. package/substrate/standards/tier-tag-schema.md +0 -155
  276. package/substrate/standards/two-layer-config.md +0 -99
  277. package/substrate/standards/use-case-format.md +0 -292
  278. package/substrate/standards/user-story-invest.md +0 -268
  279. package/substrate/standards/velocity-and-appetite.md +0 -229
  280. package/substrate/standards/voice-input-pattern.md +0 -119
  281. package/substrate/standards/whereami-schema.md +0 -301
  282. package/substrate/standards/worktree-management.md +0 -211
  283. package/substrate/standards/writing-guide.md +0 -213
  284. package/substrate/templates/chronicle-template.md +0 -75
  285. package/substrate/templates/deferred-action-template.md +0 -45
  286. package/substrate/templates/memory-proposal-template.md +0 -77
  287. package/substrate/templates/persona-template.md +0 -200
  288. package/substrate/templates/pr-faq.md +0 -45
  289. package/substrate/templates/secret-rotation-template.md +0 -162
  290. package/substrate/templates/spec-template.md +0 -131
  291. package/substrate/templates/use-case-template.md +0 -194
  292. package/substrate/templates/user-story-template.md +0 -107
  293. package/substrate/templates/whereami-template.md +0 -101
@@ -1,511 +0,0 @@
1
- #!/bin/bash
2
- # tier: lite
3
- set -e
4
-
5
- # Pre-Build Gate — fires on first Edit/Write per session.
6
- # Requires visible SDLC evidence before writing code.
7
- # Loads relevant design diagrams contextually based on file being edited.
8
-
9
- # === Hook liveness heartbeat (WU-3 of bet 2026-07-31d; closes #1002) ===
10
- # Silent-fail — a missing lib never crashes the hook. Discipline: ADR-048 +
11
- # standards/hook-cadence.json.
12
- {
13
- _hb_sd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14
- for _hb_c in "${_hb_sd}/../../lib/hook-heartbeat.sh" "${HOME:-/}/lib/hook-heartbeat.sh"; do
15
- [ -f "$_hb_c" ] && source "$_hb_c" && heartbeat_mark "pre-build-gate" && break
16
- done
17
- unset _hb_sd _hb_c
18
- } 2>/dev/null || true
19
-
20
- INPUT=$(cat)
21
- # Per bassclef#1125: fail-soft on jq parse failure (malformed stdin JSON
22
- # returns jq exit 5; set -e would crash the hook).
23
- SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // "unknown"' 2>/dev/null || echo "unknown")
24
- TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // "unknown"' 2>/dev/null || echo "unknown")
25
- FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""' 2>/dev/null || echo "")
26
- CWD=$(echo "$INPUT" | jq -r '.cwd // "."' 2>/dev/null || echo ".")
27
-
28
- # === Substrate-defect path detection (bassclef#277) ===
29
- # Paths where a fix proposal ripples to every adopter via /release.
30
- # These paths MUST NOT be skipped — the luminary gate (below) enforces
31
- # /temperance + /luminary discipline on this class of work per ADR-031.
32
- SUBSTRATE_DEFECT_PATH=0
33
- if echo "$FILE_PATH" | grep -qE '\.claude/hooks/.*\.sh$|\.claude/skills/.*/SKILL\.md$|\.claude/rules/.*\.md$|\.claude/luminaries/.*\.md$|lib/state\.sh$|scripts/migrate-adopter-references\.sh$|scripts/bassclef-orphan-parking\.sh$|scripts/bassclef-migrate-summary\.sh$|presence/install/.*\.sh$|standards/state-spine/schemas/.*\.schema\.json$|bassclef-sync\.sh$'; then
34
- SUBSTRATE_DEFECT_PATH=1
35
- fi
36
-
37
- # Skip for non-source files (hooks, config, docs, memory, github workflows)
38
- # UNLESS this is a substrate-defect path — those always run the gate.
39
- if [ "$SUBSTRATE_DEFECT_PATH" -eq 0 ] && echo "$FILE_PATH" | grep -qE '\.(sh|json)$|/\.claude/|/memory/|/docs/|/\.github/|CLAUDE\.md|MEMORY\.md'; then
40
- exit 0
41
- fi
42
-
43
- # Trace log
44
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
45
- source "$SCRIPT_DIR/trace-helper.sh"
46
- trace_log "pre-build" "$TOOL_NAME $FILE_PATH"
47
-
48
- # --- Feature branch enforcement ---
49
- CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
50
- if [ "$CURRENT_BRANCH" = "main" ] || [ "$CURRENT_BRANCH" = "master" ]; then
51
- echo ""
52
- echo "============================================"
53
- echo "WRITING TO MAIN BRANCH — CREATE A FEATURE BRANCH"
54
- echo "============================================"
55
- echo ""
56
- echo "You are editing source code directly on main."
57
- echo "All work should happen on a feature branch:"
58
- echo " git checkout -b feature/ISSUE-NNN-description"
59
- echo "============================================"
60
- echo ""
61
- fi
62
-
63
- # --- Durable marker convention (dual-read: /tmp flag OR git-tracked marker) ---
64
- # Per .claude/rules/mobile-ephemeral-session.md §2 and
65
- # standards/deferred-actions-schema.md. Either form satisfies the gate;
66
- # durable form lets mobile firings cross sandbox boundaries.
67
- BRANCH_SLUG=$(echo "$CURRENT_BRANCH" | tr '/' '-')
68
- DURABLE_DIAG_MARKER="$CWD/state/markers/diagnose/${BRANCH_SLUG}.marker"
69
- DURABLE_TEMP_MARKER="$CWD/state/markers/temperance/${BRANCH_SLUG}.marker"
70
-
71
- # --- DIAGNOSIS GATE (fix branches MUST show diagnosis) ---
72
- if echo "$CURRENT_BRANCH" | grep -qiE '^fix/'; then
73
- DIAG_FLAG="/tmp/claude-diagnosis-done-${SESSION_ID}-$(echo "$CURRENT_BRANCH" | md5 -q 2>/dev/null || echo "$CURRENT_BRANCH" | md5sum 2>/dev/null | cut -d' ' -f1)"
74
- if [ ! -f "$DIAG_FLAG" ] && [ ! -f "$DURABLE_DIAG_MARKER" ]; then
75
- # Per bassclef#1060: BLOCK (exit 2), not advise. Sister fix to
76
- # the temperance block; both gates were advisory which is the
77
- # same shape as bassclef#1027 turn-prose (methodology-only fails).
78
- if [ "${SKIP_DIAGNOSE:-0}" = "1" ]; then
79
- echo "" >&2
80
- echo "DIAGNOSIS — skipped via SKIP_DIAGNOSE=1 (logged)" >&2
81
- [ -f "$SCRIPT_DIR/trace-helper.sh" ] && \
82
- bash -c "source $SCRIPT_DIR/trace-helper.sh && trace_log diagnose-skip override 2>/dev/null" || true
83
- else
84
- cat >&2 <<EOF
85
-
86
- 🛑 DIAGNOSIS — BLOCK (fix/ branch with no diagnosis evidence)
87
-
88
- You are on a fix/ branch but have NOT run /diagnose.
89
-
90
- Before writing ANY code:
91
-
92
- 0. Reproduce — exact command / URL / action that triggers the failure
93
- (skip only for typo / missing env var / off-by-one — state why)
94
- 1. Is / Is Not table — what fails? what similar thing works?
95
- 2. Five Whys — trace to root cause, not symptom
96
- 3. Hypothesis — one sentence, with a falsifiable test
97
-
98
- Run /diagnose. When done, write the marker:
99
- touch state/markers/diagnose/${BRANCH_SLUG}.marker
100
-
101
- Override per-call: SKIP_DIAGNOSE=1 <command> (logged via trace-helper)
102
-
103
- The POA incident (2026-04-05) showed agents jumping straight to code
104
- without understanding the problem. This gate prevents that.
105
-
106
- EOF
107
- exit 2
108
- fi
109
- fi
110
- fi
111
-
112
- # --- TEMPERANCE GATE (scope-decision boundaries; per .claude/rules/sdlc-gates.md) ---
113
- # In stacked-PR work, branches are pre-shaped in a stack manifest. The
114
- # scope decision was made at manifest-write time. Re-firing per-branch
115
- # is ceremony, not gate. When the current branch is declared in any
116
- # stack manifest, suppress per-branch temperance — phase-level firing
117
- # (session kickoff, phase boundary, post-compaction, scope-drift) is
118
- # the load-bearing trigger. Per bassclef#272.
119
-
120
- TEMP_FLAG="/tmp/claude-temperance-done-${SESSION_ID}-$(echo "$CURRENT_BRANCH" | md5 -q 2>/dev/null || echo "$CURRENT_BRANCH" | md5sum 2>/dev/null | cut -d' ' -f1)"
121
-
122
- # Detect: is current branch declared in any stack manifest?
123
- BRANCH_IN_STACK=0
124
- STACK_MANIFEST=""
125
- if [ "$CURRENT_BRANCH" != "main" ] && [ "$CURRENT_BRANCH" != "master" ] && [ "$CURRENT_BRANCH" != "unknown" ]; then
126
- for stack_dir in "$CWD/docs/stacks" "$CWD/docs/branch-stacks"; do
127
- if [ -d "$stack_dir" ]; then
128
- MATCH=$(grep -lF "$CURRENT_BRANCH" "$stack_dir"/*.md 2>/dev/null | head -1)
129
- if [ -n "$MATCH" ]; then
130
- BRANCH_IN_STACK=1
131
- STACK_MANIFEST="$MATCH"
132
- break
133
- fi
134
- fi
135
- done
136
- fi
137
-
138
- if [ "$BRANCH_IN_STACK" -eq 1 ]; then
139
- # Suppress: branch is pre-shaped in stack manifest. Phase-level firing covers this.
140
- if [ ! -f "$DURABLE_TEMP_MARKER" ]; then
141
- echo ""
142
- echo "============================================"
143
- echo "TEMPERANCE — suppressed (stacked branch)"
144
- echo "============================================"
145
- echo ""
146
- echo "Branch '$CURRENT_BRANCH' is declared in:"
147
- echo " $STACK_MANIFEST"
148
- echo ""
149
- echo "Scope decision was made at manifest-write time."
150
- echo "Per .claude/rules/sdlc-gates.md, temperance fires at"
151
- echo "scope-decision boundaries (session kickoff, phase boundary,"
152
- echo "post-compaction, scope-drift), not per-branch."
153
- echo "============================================"
154
- echo ""
155
- # Auto-write the durable marker so /verify and other consumers see it.
156
- mkdir -p "$(dirname "$DURABLE_TEMP_MARKER")" 2>/dev/null
157
- echo "auto-suppressed-stacked $(date -u +"%Y-%m-%dT%H:%M:%SZ")" > "$DURABLE_TEMP_MARKER" 2>/dev/null || true
158
- touch "$TEMP_FLAG" 2>/dev/null || true
159
- fi
160
- elif [ ! -f "$TEMP_FLAG" ] && [ ! -f "$DURABLE_TEMP_MARKER" ]; then
161
- # Non-stacked work — fire the standard per-branch gate.
162
- # Per bassclef#1060: BLOCK (exit 2), not advise. Methodology-only
163
- # enforcement has 0% adoption — last 15 PRs shipped without markers.
164
- # Override via SKIP_TEMPERANCE=1 env (logged to trace) for genuine cases.
165
- if [ "${SKIP_TEMPERANCE:-0}" = "1" ]; then
166
- echo "" >&2
167
- echo "TEMPERANCE — skipped via SKIP_TEMPERANCE=1 (logged)" >&2
168
- [ -f "$SCRIPT_DIR/trace-helper.sh" ] && \
169
- bash -c "source $SCRIPT_DIR/trace-helper.sh && trace_log temperance-skip override 2>/dev/null" || true
170
- else
171
- cat >&2 <<EOF
172
-
173
- 🛑 TEMPERANCE — BLOCK (mandatory pause before first edit)
174
-
175
- Before your first edit on this branch, STOP and answer:
176
-
177
- 0. RIGHT THING? Does this trace to a real need?
178
- 1. SIMPLEST? Is this the simplest correct approach?
179
- 2. BRUTE FORCE? Am I guessing instead of understanding?
180
- 3. BLAST RADIUS? What else could this break?
181
- 4. VERIFICATION? How will I know this works?
182
- 5. REVERSIBLE? If wrong, how hard to undo?
183
-
184
- State your approach in ONE sentence, then write the marker:
185
- touch state/markers/temperance/${BRANCH_SLUG}.marker
186
-
187
- This gate fires once per branch (non-stacked work).
188
- Stacked branches are pre-shaped in a manifest — the gate suppresses.
189
- Override per-call: SKIP_TEMPERANCE=1 <command> (logged via trace-helper)
190
-
191
- EOF
192
- exit 2
193
- fi
194
- fi
195
-
196
- # --- MARKER ENRICHMENT (V1 advisory; per bassclef-upstream#438 + bet 28a WU-5) ---
197
- # Per .claude/rules/marker-enrichment-discipline.md: gate-marker files
198
- # should carry body content (date + branch + decision/lens/thread context),
199
- # not just exist as empty touch files. V1 advisory; flips to BLOCK in V2
200
- # after the allowlist baseline is cleared.
201
- MARKER_ENRICHMENT_ALLOWLIST="$CWD/.claude/hooks/marker-enrichment-allowlist.txt"
202
- check_marker_enriched() {
203
- local marker_path="$1"
204
- local marker_class="$2" # temperance / luminary / arc-walk / orientation-gate / roadmap-reconcile-gate
205
- [ "${SKIP_MARKER_ENRICHMENT:-0}" = "1" ] && return 0
206
- [ ! -f "$marker_path" ] && return 0
207
- [ -s "$marker_path" ] && return 0
208
- # Empty marker. Check allowlist.
209
- if [ -f "$MARKER_ENRICHMENT_ALLOWLIST" ]; then
210
- local relative_path="${marker_path#$CWD/}"
211
- if grep -qxF "$relative_path" "$MARKER_ENRICHMENT_ALLOWLIST" 2>/dev/null; then
212
- return 0 # grandfathered
213
- fi
214
- fi
215
- # Empty marker, not in allowlist — ADVISORY warn (V1 doesn't block)
216
- echo "" >&2
217
- echo "⚠️ MARKER ENRICHMENT — ADVISORY (V1; per .claude/rules/marker-enrichment-discipline.md)" >&2
218
- echo "" >&2
219
- echo " $marker_class marker is empty: $marker_path" >&2
220
- echo " Per bet 28a WU-5: gate markers should carry body content" >&2
221
- echo " (date + branch + decision/lens/thread context)." >&2
222
- echo "" >&2
223
- echo " Add body via heredoc in the same WU/PR. V2 will flip to BLOCK." >&2
224
- echo "" >&2
225
- }
226
- # Check the marker that just cleared the temperance gate
227
- [ -f "$DURABLE_TEMP_MARKER" ] && check_marker_enriched "$DURABLE_TEMP_MARKER" "temperance"
228
- DURABLE_LUMINARY_MARKER_EARLY="$CWD/state/markers/luminary/${BRANCH_SLUG}.marker"
229
- [ -f "$DURABLE_LUMINARY_MARKER_EARLY" ] && check_marker_enriched "$DURABLE_LUMINARY_MARKER_EARLY" "luminary"
230
- DURABLE_ARC_WALK_MARKER="$CWD/state/markers/arc-walk/${BRANCH_SLUG}.marker"
231
- [ -f "$DURABLE_ARC_WALK_MARKER" ] && check_marker_enriched "$DURABLE_ARC_WALK_MARKER" "arc-walk"
232
-
233
- # --- LUMINARY GATE (substrate-defect paths require BOTH temperance + luminary markers) ---
234
- # Per bassclef#277. Substrate-defect fixes ripple to every adopter via
235
- # /release. Methodology-only failed — operator asked 3 times in one
236
- # session for /temperance + /luminary before fix proposals. This gate
237
- # enforces the discipline at the mechanical layer per memory
238
- # feedback_hooks_beat_methodology_for_substrate_quality.
239
- #
240
- # Primary lens for the gate's own design: Hyrum Wright — every adopter
241
- # branch that lacks a luminary marker at the moment this gate ships
242
- # would break under strict enforcement. The grandfather allowlist
243
- # (.claude/hooks/luminary-gate-allowlist.txt) gives existing branches
244
- # a deprecation window per ADR-031.
245
-
246
- if [ "$SUBSTRATE_DEFECT_PATH" -eq 1 ]; then
247
- DURABLE_LUMINARY_MARKER="$CWD/state/markers/luminary/${BRANCH_SLUG}.marker"
248
- ALLOWLIST="$CWD/.claude/hooks/luminary-gate-allowlist.txt"
249
-
250
- # Hyrum grandfather window — branches matching any line in the
251
- # allowlist bypass the gate during the deprecation window. Lines
252
- # support shell glob patterns (feature/*, fix/*, bet-*, etc.) via
253
- # bash's case/esac matching. Lines starting with # are ignored.
254
- # Exact branch names also work — they're a degenerate-case glob.
255
- IN_ALLOWLIST=0
256
- if [ -f "$ALLOWLIST" ]; then
257
- while IFS= read -r pattern || [ -n "$pattern" ]; do
258
- # Skip comments and blank lines
259
- case "$pattern" in
260
- ''|\#*) continue ;;
261
- esac
262
- # Trim trailing whitespace defensively
263
- pattern="${pattern%"${pattern##*[![:space:]]}"}"
264
- # Glob match against current branch
265
- case "$CURRENT_BRANCH" in
266
- $pattern)
267
- IN_ALLOWLIST=1
268
- break
269
- ;;
270
- esac
271
- done < "$ALLOWLIST"
272
- fi
273
-
274
- if [ "$IN_ALLOWLIST" -eq 0 ] && [ ! -f "$DURABLE_LUMINARY_MARKER" ]; then
275
- if [ "${SKIP_LUMINARY_GATE:-0}" = "1" ]; then
276
- echo "" >&2
277
- echo "LUMINARY GATE — skipped via SKIP_LUMINARY_GATE=1 (logged)" >&2
278
- [ -f "$SCRIPT_DIR/trace-helper.sh" ] && \
279
- bash -c "source $SCRIPT_DIR/trace-helper.sh && trace_log luminary-gate-skip override 2>/dev/null" || true
280
- else
281
- cat >&2 <<EOF
282
-
283
- 🛑 LUMINARY GATE — BLOCK (substrate-defect path without luminary marker)
284
-
285
- You are editing a substrate path: $FILE_PATH
286
-
287
- Substrate-defect fixes ripple to every adopter via /release. Per
288
- ADR-031 (we don't break adopters), every substrate-defect fix needs
289
- BOTH /temperance AND /luminary applied before code lands.
290
-
291
- /temperance marker — found.
292
- /luminary marker — missing at state/markers/luminary/${BRANCH_SLUG}.marker
293
-
294
- Before writing code at this path:
295
-
296
- 1. /luminary --primary — which lenses pin this work?
297
- Common pins: Hyrum (api-stability), Linus (adopter-compat),
298
- Beck (TDD red-green), Hoare (pre/post conditions),
299
- Ousterhout (deep modules), Saltzer-Schroeder (defensive bash).
300
-
301
- 2. Write the marker:
302
- mkdir -p state/markers/luminary
303
- cat > state/markers/luminary/${BRANCH_SLUG}.marker <<'MARKER'
304
- session: <session-id>
305
- branch: ${CURRENT_BRANCH}
306
- primary_lens: <luminary slug>
307
- compatibility_anchor: <luminary slug>
308
- reason: <one line>
309
- MARKER
310
-
311
- Override per-call: SKIP_LUMINARY_GATE=1 <command> (logged via trace-helper)
312
-
313
- Hyrum grandfather: add branch to .claude/hooks/luminary-gate-allowlist.txt
314
- for deprecation-window bypass. The allowlist exists so this gate landing
315
- does not break in-flight branches that pre-date the discipline.
316
-
317
- Source incident: operator asked 3 times in one session (2026-06-22) for
318
- /temperance + /luminary before substrate-defect fix proposals. Methodology
319
- alone (rules + memory) did not hold. Filed as bassclef#277.
320
-
321
- EOF
322
- exit 2
323
- fi
324
- fi
325
- fi
326
-
327
- # --- Budget awareness (cost governance) ---
328
- MANIFEST="$CWD/substrate.config.md"
329
- if [ -f "$MANIFEST" ]; then
330
- # Prefer accessor (state_iteration_bet_active returns frontmatter as JSON);
331
- # fall back to grep for repos pre-spine-v0 OR for bets that store turn_limit
332
- # in body markdown rather than frontmatter.
333
- TURN_LIMIT=""
334
- if [ -f "$CWD/lib/state.sh" ]; then
335
- # shellcheck source=/dev/null
336
- source "$CWD/lib/state.sh" 2>/dev/null && \
337
- TURN_LIMIT=$(state_iteration_bet_active 2>/dev/null | \
338
- jq -r '.appetite.turn_limit // .turn_limit // empty' 2>/dev/null)
339
- fi
340
- if [ -z "$TURN_LIMIT" ]; then
341
- TURN_LIMIT=$(grep 'turn_limit:' "$CWD/docs/iteration-bets/"*.md 2>/dev/null | tail -1 | grep -oE '[0-9]+' | head -1)
342
- fi
343
- if [ -n "$TURN_LIMIT" ]; then
344
- # Count edits this session as a proxy for turns consumed.
345
- # Dual-write: /tmp (existing) + durable (mobile-ephemeral-session.md §2).
346
- EDIT_FLAG="/tmp/claude-edit-count-${SESSION_ID}"
347
- DURABLE_EDIT_DIR="$CWD/state/markers/edit-count"
348
- DURABLE_EDIT_FLAG="$DURABLE_EDIT_DIR/${SESSION_ID}.count"
349
- EDIT_COUNT=0
350
- if [ -f "$DURABLE_EDIT_FLAG" ]; then
351
- EDIT_COUNT=$(cat "$DURABLE_EDIT_FLAG")
352
- elif [ -f "$EDIT_FLAG" ]; then
353
- EDIT_COUNT=$(cat "$EDIT_FLAG")
354
- fi
355
- EDIT_COUNT=$((EDIT_COUNT + 1))
356
- echo "$EDIT_COUNT" > "$EDIT_FLAG"
357
- mkdir -p "$DURABLE_EDIT_DIR" 2>/dev/null
358
- echo "$EDIT_COUNT" > "$DURABLE_EDIT_FLAG" 2>/dev/null
359
-
360
- THRESHOLD=$((TURN_LIMIT * 75 / 100))
361
- if [ "$EDIT_COUNT" -ge "$TURN_LIMIT" ]; then
362
- echo ""
363
- echo "============================================"
364
- echo "BUDGET: TURN LIMIT REACHED ($EDIT_COUNT / $TURN_LIMIT)"
365
- echo "============================================"
366
- echo "Pause. Report state. Propose descoped continuation."
367
- echo "============================================"
368
- echo ""
369
- elif [ "$EDIT_COUNT" -ge "$THRESHOLD" ]; then
370
- echo ""
371
- echo "BUDGET: 75% of turn limit ($EDIT_COUNT / $TURN_LIMIT)"
372
- echo ""
373
- fi
374
- fi
375
- fi
376
-
377
- # Fire full gate first time per session, lightweight reminder on subsequent edits
378
- FLAG_FILE="/tmp/claude-pre-build-gate-${SESSION_ID}"
379
- DOCS_DIR="$CWD/docs/design"
380
-
381
- if [ -f "$FLAG_FILE" ]; then
382
- # Subsequent edit — lightweight per-task reminder
383
- cat <<'PERTASK'
384
- ============================================
385
- PRE-BUILD — PER-TASK CHECK
386
- ============================================
387
-
388
- Before this edit, confirm:
389
- - Building against: [ticket # or "trivial — logged in commit"]
390
- - Temperance: Simplest correct approach? Brute-forcing?
391
- - UI surface impacted? If yes, is IA/state diagram current?
392
- - Env vars needed? Set?
393
- ============================================
394
- PERTASK
395
-
396
- else
397
- # First edit this session — full SDLC checkpoint
398
- touch "$FLAG_FILE"
399
-
400
- cat <<'GATE'
401
- ============================================
402
- PRE-BUILD GATE — MANDATORY BEFORE WRITING CODE
403
- ============================================
404
-
405
- You are about to write/edit source code. STOP.
406
-
407
- YOUR RESPONSE must contain ALL of the following sections as visible text
408
- BEFORE this Edit/Write and any subsequent code changes:
409
-
410
- ## SDLC Checkpoint
411
- - Building against: [ticket #NNN — title, or "no ticket" with justification]
412
- - Spec current?: [yes/no — if no, what needs updating first?]
413
- - Design diagrams: [which need updating and why, or "none — because X"]
414
- - Engineering principles: [any SoC/abstraction/cohesion concerns? or "clean"]
415
-
416
- ## Environment Check
417
- - External credentials needed?: [OAuth, API keys, tokens, etc.]
418
- - Are they set?: [check NOW — if empty, flag blocker before writing code]
419
-
420
- ## Requirements Check
421
- - New requirements surfaced?: [yes → where logged | no]
422
- - Untracked work?: [am I coding something not on any ticket? if yes, log it first]
423
-
424
- ## Test Plan
425
- - Testable logic?: [yes/no — pure functions, utilities, parsers = yes]
426
- - Test approach: [which test file will cover this? new or existing?]
427
-
428
- If this is a bug fix, you must ALSO have completed the Bug Diagnosis
429
- (Is/Is Not + Five Whys) before proceeding.
430
-
431
- Only after writing these sections may you proceed to write code.
432
- ============================================
433
- GATE
434
- fi
435
-
436
- # === Contextual diagram loading ===
437
- echo ""
438
- echo "=== RELEVANT DESIGN DIAGRAMS (verify against these) ==="
439
- echo ""
440
-
441
- LOADED=0
442
-
443
- # Schema / Prisma / migration → load ERD
444
- if echo "$FILE_PATH" | grep -qiE 'prisma|schema|model|migration'; then
445
- [ -f "$DOCS_DIR/erd.md" ] && { echo "### ERD (triggered by: schema/model file)"; head -80 "$DOCS_DIR/erd.md" 2>/dev/null; echo ""; LOADED=1; }
446
- fi
447
-
448
- # Queue / worker / agent → load Sequence + Component diagrams
449
- if echo "$FILE_PATH" | grep -qiE 'worker|queue|agent|job|bull|cron|ingest'; then
450
- [ -f "$DOCS_DIR/sequences/"*.md ] 2>/dev/null && { echo "### Sequence diagrams (triggered by: worker/agent file)"; ls "$DOCS_DIR/sequences/"*.md 2>/dev/null; echo ""; LOADED=1; }
451
- [ -f "$DOCS_DIR/component-diagram.md" ] && { echo "### Component Diagram"; head -60 "$DOCS_DIR/component-diagram.md" 2>/dev/null; echo ""; LOADED=1; }
452
- fi
453
-
454
- # Docker / deploy / infra → load Component + Deployment diagrams
455
- if echo "$FILE_PATH" | grep -qiE 'docker|deploy|infra|compose|Dockerfile|workflow'; then
456
- [ -f "$DOCS_DIR/component-diagram.md" ] && { echo "### Component Diagram (triggered by: infra file)"; head -60 "$DOCS_DIR/component-diagram.md" 2>/dev/null; echo ""; LOADED=1; }
457
- fi
458
-
459
- # Auth / user / role → load Use Case diagram
460
- if echo "$FILE_PATH" | grep -qiE 'auth|user|role|permission|session'; then
461
- [ -f "$DOCS_DIR/use-cases.md" ] && { echo "### Use Cases (triggered by: auth/role file)"; head -60 "$DOCS_DIR/use-cases.md" 2>/dev/null; echo ""; LOADED=1; }
462
- fi
463
-
464
- # Page route → UX check + E2E reminder
465
- if echo "$FILE_PATH" | grep -qiE 'src/app/.*/page\.tsx'; then
466
- echo "### UX Check (triggered by: page route file)"
467
- echo "- Does a state diagram exist for this page?"
468
- echo "- Is this page in the entity model / screen map?"
469
- echo "- Are components named after domain objects?"
470
- echo "- Run /ia-model if navigation or screen structure is changing."
471
- echo ""
472
- echo "### E2E Smoke Test"
473
- echo "User-facing pages MUST be covered by E2E smoke tests."
474
- echo ""
475
- LOADED=1
476
- fi
477
-
478
- # API route → E2E reminder
479
- if echo "$FILE_PATH" | grep -qiE 'src/app/api/.*/route\.ts'; then
480
- echo "### E2E Smoke Test (triggered by: API route file)"
481
- echo "API routes MUST be covered by E2E smoke tests."
482
- echo "- Protected route: add auth gate test"
483
- echo "- Public route: add response shape test"
484
- echo ""
485
- LOADED=1
486
- fi
487
-
488
- # Schema change → entity model + migration reminder
489
- if echo "$FILE_PATH" | grep -qiE 'prisma/schema'; then
490
- echo "### Entity Model Check (triggered by: schema file)"
491
- echo "- Has the entity been added to the object model?"
492
- echo "- Does this entity need a UI surface?"
493
- echo "- Run /ia-model if adding a new entity."
494
- echo ""
495
- echo "### MIGRATION REQUIRED"
496
- echo "After editing schema, run: npx prisma migrate dev --name descriptive_name"
497
- echo "NEVER use prisma db push. It causes schema drift."
498
- echo ""
499
- LOADED=1
500
- fi
501
-
502
- if [ "$LOADED" -eq 0 ]; then
503
- echo "(No diagram matched: $FILE_PATH)"
504
- echo "If this change introduces new objects, async flows, or lifecycle changes,"
505
- echo "manually read the relevant diagram from docs/design/ before proceeding."
506
- fi
507
-
508
- echo ""
509
- echo "=== END DIAGRAMS ==="
510
-
511
- exit 0