@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,459 +0,0 @@
1
- #!/usr/bin/env bash
2
- # tier: lite
3
- # lib/composer-preflight.sh — shared pre-flight check for composer skills.
4
- #
5
- # Composer skills (/launch, /build, /shape full) source this helper
6
- # in Phase -1 (before Phase 0). Surfaces 6 prerequisites at once:
7
- # 1. feature-branch — repo on a feature branch (refuses on main)
8
- # 2. state-spine — lib/state.sh present (AUTO-PREP from bassclef)
9
- # 3. personas — at least 1 persona scaffolded (signal-and-offer)
10
- # 4. budget — iteration_ceiling sufficient for estimate
11
- # 5. skill-registry — dispatching skill resolves (covers bassclef#271)
12
- # 6. deploy-host — hosting_platform set + adapter shipped (bassclef#449/#450)
13
- #
14
- # Usage (from a composer SKILL.md procedure):
15
- # source $BASSCLEF_DIR/lib/composer-preflight.sh
16
- # composer_preflight_check <skill_name> <estimated_turns> [--no-launch]
17
- # case $? in
18
- # 0) ;; # all pass — proceed to Phase 0
19
- # 1) ;; # warnings — composer prompts operator proceed/abort
20
- # 2) exit 1 ;; # failures — composer refuses dispatch
21
- # esac
22
- #
23
- # --no-launch: variants-only run; Check 6 short-circuits to pass.
24
- # Use when /launch is invoked for variant generation only,
25
- # no deploy-host chain. /stage (light) is the typical caller.
26
- #
27
- # Override: SKIP_COMPOSER_PREFLIGHT=1 (logged via trace-helper).
28
- #
29
- # Standard: standards/composer-prerequisites.md
30
- # Refs bassclef#408 (preflight scaffold) + bassclef#449/#450 (deploy-host check).
31
-
32
- # Don't use `set -e` — preflight checks must complete even when one fails.
33
-
34
- # Output format (key=value lines on stdout):
35
- # check_<n>_name=<check name>
36
- # check_<n>_status=<pass|warn|fail>
37
- # check_<n>_message=<single-line message>
38
- # check_<n>_recommendation=<single-line recommendation>
39
- # summary_status=<pass|warn|fail>
40
- # summary_count_pass=<n>
41
- # summary_count_warn=<n>
42
- # summary_count_fail=<n>
43
-
44
- composer_preflight_check() {
45
- local skill_name="${1:-}"
46
- local estimated_turns="${2:-50}"
47
- local mode_flag="${3:-}" # optional: --no-launch for variants-only runs
48
-
49
- # Override hatch
50
- if [ "${SKIP_COMPOSER_PREFLIGHT:-0}" = "1" ]; then
51
- if command -v trace_log >/dev/null 2>&1; then
52
- trace_log "composer-preflight" "OVERRIDE skill=$skill_name" 2>/dev/null || true
53
- fi
54
- echo "summary_status=skip"
55
- return 0
56
- fi
57
-
58
- if [ -z "$skill_name" ]; then
59
- echo "summary_status=fail" >&2
60
- echo "ERROR: composer_preflight_check requires skill_name" >&2
61
- return 2
62
- fi
63
-
64
- local pass=0 warn=0 fail=0
65
-
66
- # === Check 1: feature-branch ===
67
- local current_branch
68
- current_branch=$(git branch --show-current 2>/dev/null || echo "")
69
- echo "check_1_name=feature-branch"
70
- if [ -z "$current_branch" ]; then
71
- echo "check_1_status=fail"
72
- echo "check_1_message=Not in a git repository OR branch detection failed"
73
- echo "check_1_recommendation=Run from inside a git repository"
74
- fail=$((fail + 1))
75
- elif [ "$current_branch" = "main" ] || [ "$current_branch" = "master" ]; then
76
- echo "check_1_status=fail"
77
- echo "check_1_message=On $current_branch — composer skills refuse to run from default branch"
78
- echo "check_1_recommendation=git checkout -b feature/<slug>"
79
- fail=$((fail + 1))
80
- else
81
- echo "check_1_status=pass"
82
- echo "check_1_message=On feature branch: $current_branch"
83
- echo "check_1_recommendation="
84
- pass=$((pass + 1))
85
- fi
86
-
87
- # === Check 2: state-spine ===
88
- local repo_root
89
- repo_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
90
- echo "check_2_name=state-spine"
91
- if [ -f "$repo_root/lib/state.sh" ]; then
92
- echo "check_2_status=pass"
93
- echo "check_2_message=lib/state.sh present"
94
- echo "check_2_recommendation="
95
- pass=$((pass + 1))
96
- else
97
- # Auto-prep available: bootstrap from BASSCLEF_DIR if reachable
98
- local bassclef_state="${BASSCLEF_DIR:-}/lib/state.sh"
99
- if [ -n "${BASSCLEF_DIR:-}" ] && [ -f "$bassclef_state" ]; then
100
- echo "check_2_status=warn"
101
- echo "check_2_message=lib/state.sh missing; AUTO-PREP available from $bassclef_state"
102
- echo "check_2_recommendation=cp $bassclef_state $repo_root/lib/state.sh # safe to auto-execute"
103
- warn=$((warn + 1))
104
- else
105
- echo "check_2_status=fail"
106
- echo "check_2_message=lib/state.sh missing AND BASSCLEF_DIR not reachable"
107
- echo "check_2_recommendation=Run /onboard-repo to bootstrap bassclef substrate"
108
- fail=$((fail + 1))
109
- fi
110
- fi
111
-
112
- # === Check 3: personas ===
113
- echo "check_3_name=personas"
114
- local persona_count=0
115
- if [ -d "$repo_root/docs/personas" ]; then
116
- persona_count=$(find "$repo_root/docs/personas" -maxdepth 1 -name "*.md" -type f 2>/dev/null | wc -l | tr -d ' ')
117
- fi
118
- if [ "$persona_count" -ge 1 ]; then
119
- echo "check_3_status=pass"
120
- echo "check_3_message=$persona_count persona(s) scaffolded"
121
- echo "check_3_recommendation="
122
- pass=$((pass + 1))
123
- else
124
- echo "check_3_status=warn"
125
- echo "check_3_message=No personas scaffolded; composers default to operator-as-persona"
126
- echo "check_3_recommendation=Run /personas to seed primary persona OR proceed with operator-only"
127
- warn=$((warn + 1))
128
- fi
129
-
130
- # === Check 4: budget ===
131
- echo "check_4_name=budget"
132
- local budget_estimate=$(( estimated_turns * 10 / 100 )) # rough $0.10/turn proxy
133
- local ceiling=""
134
- if [ -f "$repo_root/substrate.config.md" ]; then
135
- # Use [[:space:]] (POSIX) instead of \s (GNU extension) for BSD sed compat
136
- ceiling=$(grep -E '^[[:space:]]*iteration_ceiling:' "$repo_root/substrate.config.md" 2>/dev/null \
137
- | head -1 | sed 's/.*:[[:space:]]*//;s/[[:space:]].*//;s/^\$//' || echo "")
138
- fi
139
- if [ -z "$ceiling" ] || [ "$ceiling" = "0" ]; then
140
- # Sequential mode (no burst cost) — pass
141
- echo "check_4_status=pass"
142
- echo "check_4_message=Sequential mode (\$0 burst); estimated $estimated_turns turns"
143
- echo "check_4_recommendation="
144
- pass=$((pass + 1))
145
- elif ! [[ "$ceiling" =~ ^[0-9]+$ ]]; then
146
- # Non-numeric ceiling (e.g., free-form description) — pass with note
147
- echo "check_4_status=pass"
148
- echo "check_4_message=iteration_ceiling: $ceiling (free-form); estimated $estimated_turns turns"
149
- echo "check_4_recommendation="
150
- pass=$((pass + 1))
151
- elif [ "$ceiling" -lt "$budget_estimate" ]; then
152
- echo "check_4_status=warn"
153
- echo "check_4_message=iteration_ceiling \$$ceiling < estimated \$$budget_estimate ($estimated_turns turns)"
154
- echo "check_4_recommendation=Bump iteration_ceiling in substrate.config.md OR reduce composer tier"
155
- warn=$((warn + 1))
156
- else
157
- echo "check_4_status=pass"
158
- echo "check_4_message=iteration_ceiling \$$ceiling >= estimated \$$budget_estimate"
159
- echo "check_4_recommendation="
160
- pass=$((pass + 1))
161
- fi
162
-
163
- # === Check 5: skill-registry ===
164
- # Detects bassclef#271 race — skill not picked up by harness registry.
165
- # Read-and-check approach: the skill MUST exist as SKILL.md at a discoverable
166
- # path. Three discovery paths:
167
- # a) ~/.claude/skills/<skill>/SKILL.md (user-level symlink — harness primary)
168
- # b) <repo>/.claude/skills/<skill>/SKILL.md (repo-level — fallback)
169
- # c) <BASSCLEF_DIR>/.claude/skills/<skill>/SKILL.md (bassclef authoritative)
170
- echo "check_5_name=skill-registry"
171
- local user_skill="$HOME/.claude/skills/$skill_name/SKILL.md"
172
- local repo_skill="$repo_root/.claude/skills/$skill_name/SKILL.md"
173
- local bassclef_skill="${BASSCLEF_DIR:-}/.claude/skills/$skill_name/SKILL.md"
174
-
175
- if [ -f "$user_skill" ] || [ -L "$user_skill" ]; then
176
- echo "check_5_status=pass"
177
- echo "check_5_message=Skill resolves at user-level: $user_skill"
178
- echo "check_5_recommendation="
179
- pass=$((pass + 1))
180
- elif [ -f "$repo_skill" ] || [ -L "$repo_skill" ]; then
181
- echo "check_5_status=warn"
182
- echo "check_5_message=Skill at repo-level only ($repo_skill); user-level symlink missing — harness may not pick up (bassclef#271)"
183
- echo "check_5_recommendation=Run bassclef-sync.sh to create user-level symlink OR restart Claude session"
184
- warn=$((warn + 1))
185
- elif [ -n "${BASSCLEF_DIR:-}" ] && [ -f "$bassclef_skill" ]; then
186
- echo "check_5_status=warn"
187
- echo "check_5_message=Skill at bassclef only; consumer-side links missing — substrate sync incomplete"
188
- echo "check_5_recommendation=Run bassclef-sync.sh in this repo OR /onboard-repo"
189
- warn=$((warn + 1))
190
- else
191
- echo "check_5_status=fail"
192
- echo "check_5_message=Skill /$skill_name not found at any discovery path"
193
- echo "check_5_recommendation=Verify skill name OR check bassclef substrate sync"
194
- fail=$((fail + 1))
195
- fi
196
-
197
- # === Check 6: deploy-host (bassclef#449/#450 + bassclef#523) ===
198
- #
199
- # Reads hosting_platform from substrate.config.md and verifies (a) a deploy
200
- # adapter is shipped AND (b) provisioning has actually happened (the
201
- # per-platform provisioning-indicator field is populated with a real value,
202
- # not the schema's bracketed placeholder). Catches the preview→production
203
- # gap before /launch burns 200t AND the silent-defer-bind class
204
- # where Phase 12 silently no-ops because the consumer never ran
205
- # /provision-deploy-host (bassclef#523 — today's POA mobile session).
206
- #
207
- # Logic:
208
- # missing hosting_platform → fail (set hosting_platform: amplify)
209
- # hosting_platform=none + --no-launch → pass (variants-only run)
210
- # hosting_platform=none + no --no-launch → fail (refuse dispatch)
211
- # adapter shipped + indicator populated → pass
212
- # adapter shipped + indicator MISSING → fail with three-path remediation:
213
- # run /provision-deploy-host inline / re-dispatch with --no-launch /
214
- # explicit defer
215
- # adapter not shipped (vercel | netlify | cf-pages) → warn
216
- # any other value → fail (not in enum)
217
- #
218
- # Per-platform provisioning indicators (set by /provision-deploy-host on success):
219
- # amplify → amplify_app_id (e.g., d154l5usyc80nk)
220
- # ec2-tailscale → deploy_host (e.g., poa-prod.tailnet.ts.net)
221
- # mock → no indicator required (test scaffold)
222
- #
223
- # The override --no-launch lets /launch run in variants-only mode
224
- # (e.g., /stage light callers) without requiring deploy-host provisioning.
225
- echo "check_6_name=deploy-host"
226
- local hosting=""
227
- if [ -f "$repo_root/substrate.config.md" ]; then
228
- hosting=$(grep -E '^[[:space:]]*hosting_platform:' "$repo_root/substrate.config.md" 2>/dev/null \
229
- | head -1 | sed 's/.*:[[:space:]]*//;s/[[:space:]].*//;s/^["'\'']//;s/["'\'']$//')
230
- fi
231
- local bassclef_adapter_dir="${BASSCLEF_DIR:-}/scripts/adapters/deploy"
232
- local adapter_check=""
233
- if [ -n "$hosting" ] && [ -n "${BASSCLEF_DIR:-}" ]; then
234
- adapter_check="${bassclef_adapter_dir}/${hosting}.sh"
235
- fi
236
-
237
- # Helper: read the per-platform provisioning-indicator field from
238
- # substrate.config.md. Returns the field value if populated and not the
239
- # bracketed placeholder shape (e.g., `[e.g., d154l...]`); empty otherwise.
240
- _check6_provisioning_indicator_value() {
241
- local field="$1"
242
- [ -f "$repo_root/substrate.config.md" ] || return 0
243
- local val
244
- val=$(grep -E "^[[:space:]]*${field}:" "$repo_root/substrate.config.md" 2>/dev/null \
245
- | head -1 | sed 's/.*:[[:space:]]*//;s/[[:space:]]*#.*$//;s/^["'\'']//;s/["'\'']$//')
246
- # Reject placeholders (bracketed values are schema templates, not real values)
247
- case "$val" in
248
- "" | \[*\] | "[]" )
249
- echo ""
250
- ;;
251
- *)
252
- echo "$val"
253
- ;;
254
- esac
255
- }
256
-
257
- if [ -z "$hosting" ]; then
258
- echo "check_6_status=fail"
259
- echo "check_6_message=hosting_platform missing from substrate.config.md"
260
- echo "check_6_recommendation=Add 'hosting_platform: amplify' (bassclef default per ADR-008) OR 'hosting_platform: none' if no UI ships"
261
- fail=$((fail + 1))
262
- elif [ "$hosting" = "none" ]; then
263
- if [ "$mode_flag" = "--no-launch" ]; then
264
- echo "check_6_status=pass"
265
- echo "check_6_message=hosting_platform=none + --no-launch (variants-only run)"
266
- echo "check_6_recommendation="
267
- pass=$((pass + 1))
268
- else
269
- echo "check_6_status=fail"
270
- echo "check_6_message=hosting_platform=none — composer would generate variants that can't launch"
271
- echo "check_6_recommendation=Set hosting_platform to a deploy provider (amplify) OR re-run with --no-launch for variants-only"
272
- fail=$((fail + 1))
273
- fi
274
- elif [ -n "$adapter_check" ] && [ -f "$adapter_check" ]; then
275
- # Adapter shipped — now verify provisioning indicator is populated.
276
- # --no-launch override skips this gate (variants-only run).
277
- if [ "$mode_flag" = "--no-launch" ]; then
278
- echo "check_6_status=pass"
279
- echo "check_6_message=hosting_platform=$hosting + --no-launch (variants-only; provisioning indicator gate bypassed)"
280
- echo "check_6_recommendation="
281
- pass=$((pass + 1))
282
- else
283
- local indicator_field=""
284
- case "$hosting" in
285
- amplify) indicator_field="amplify_app_id" ;;
286
- ec2-tailscale) indicator_field="deploy_host" ;;
287
- mock) indicator_field="" ;; # test scaffold, no indicator required
288
- esac
289
- local indicator_value=""
290
- if [ -n "$indicator_field" ]; then
291
- indicator_value=$(_check6_provisioning_indicator_value "$indicator_field")
292
- fi
293
- if [ -z "$indicator_field" ] || [ -n "$indicator_value" ]; then
294
- echo "check_6_status=pass"
295
- if [ -n "$indicator_field" ]; then
296
- echo "check_6_message=hosting_platform=$hosting; adapter shipped; ${indicator_field}=${indicator_value}"
297
- else
298
- echo "check_6_message=hosting_platform=$hosting; adapter shipped (no indicator required for $hosting)"
299
- fi
300
- echo "check_6_recommendation="
301
- pass=$((pass + 1))
302
- else
303
- echo "check_6_status=fail"
304
- echo "check_6_message=hosting_platform=$hosting; adapter shipped but ${indicator_field} not populated in substrate.config.md — /provision-deploy-host has not run for this consumer"
305
- echo "check_6_recommendation=Three paths: (a) run /provision-deploy-host (creates ${hosting} app + populates ${indicator_field}; ~1-2h, mostly waiting); (b) re-dispatch with --no-launch for variants-only (no deploy host needed); (c) explicit defer — tell the agent 'skip launch deploy-host check this session' (per blocked-items.md deferral syntax)"
306
- fail=$((fail + 1))
307
- fi
308
- fi
309
- elif [ "$hosting" = "vercel" ] || [ "$hosting" = "netlify" ] || [ "$hosting" = "cloudflare-pages" ]; then
310
- echo "check_6_status=warn"
311
- echo "check_6_message=hosting_platform=$hosting in schema enum but adapter not yet shipped"
312
- echo "check_6_recommendation=Switch to amplify (bassclef default) OR contribute the adapter at scripts/adapters/deploy/${hosting}.sh"
313
- warn=$((warn + 1))
314
- elif [ "$hosting" = "amplify" ] || [ "$hosting" = "ec2-tailscale" ] || [ "$hosting" = "mock" ]; then
315
- # Known-good enum value but adapter not found at expected path — could be
316
- # BASSCLEF_DIR pointing at the wrong place, or substrate sync incomplete
317
- if [ -z "${BASSCLEF_DIR:-}" ]; then
318
- echo "check_6_status=warn"
319
- echo "check_6_message=hosting_platform=$hosting (BASSCLEF_DIR not reachable; can't verify adapter)"
320
- echo "check_6_recommendation=Set BASSCLEF_DIR OR run /onboard-repo to sync bassclef substrate"
321
- warn=$((warn + 1))
322
- else
323
- echo "check_6_status=warn"
324
- echo "check_6_message=hosting_platform=$hosting in enum but adapter missing at $adapter_check"
325
- echo "check_6_recommendation=Run bassclef-sync.sh to refresh adapter symlinks OR check BASSCLEF_DIR points at bassclef repo root"
326
- warn=$((warn + 1))
327
- fi
328
- else
329
- echo "check_6_status=fail"
330
- echo "check_6_message=hosting_platform=$hosting not in schema enum"
331
- echo "check_6_recommendation=Use one of: amplify | ec2-tailscale | vercel | netlify | cloudflare-pages | none"
332
- fail=$((fail + 1))
333
- fi
334
-
335
- # === Check 7: spec-and-use-case (bet 24a Step 2c per Cockburn ceremony matrix) ===
336
- # Fires when staged diff includes code paths that merit spec + use-case coverage.
337
- # Warns if no artifact at docs/use-cases/UC-*.md OR docs/specs/*.md OR
338
- # docs/decompositions/*.md when substrate + adopter code staged.
339
- # Per .claude/rules/oo-ad-entry-point.md (extended to include hook/lib/script paths).
340
- # Cockburn tiering — new hook + lib merit brief use case; app code merits fully-dressed.
341
- echo "check_7_name=spec-and-use-case"
342
- local staged_code
343
- staged_code=$(git diff --cached --name-only --diff-filter=AM 2>/dev/null | grep -E \
344
- -e '^src/.*\.(ts|tsx|js|py)$' \
345
- -e '^\.claude/hooks/[^/]+\.sh$' \
346
- -e '^lib/[^/]+\.sh$' \
347
- -e '^scripts/[^/]+\.sh$' \
348
- || true)
349
- if [ -z "$staged_code" ]; then
350
- echo "check_7_status=pass"
351
- echo "check_7_message=No code paths staged (docs-only or non-code commit)"
352
- echo "check_7_recommendation="
353
- pass=$((pass + 1))
354
- else
355
- local uc_count spec_count decomp_count total_artifacts
356
- uc_count=$(ls "$repo_root/docs/use-cases/"UC-*.md 2>/dev/null | wc -l | tr -d ' ')
357
- spec_count=$(ls "$repo_root/docs/specs/"*.md 2>/dev/null | wc -l | tr -d ' ')
358
- decomp_count=$(ls "$repo_root/docs/decompositions/"*.md 2>/dev/null | wc -l | tr -d ' ')
359
- total_artifacts=$((uc_count + spec_count + decomp_count))
360
- if [ "$total_artifacts" -gt 0 ]; then
361
- echo "check_7_status=pass"
362
- echo "check_7_message=Code staged + $total_artifacts design artifact(s) present (uc=$uc_count spec=$spec_count decomp=$decomp_count)"
363
- echo "check_7_recommendation="
364
- pass=$((pass + 1))
365
- else
366
- echo "check_7_status=warn"
367
- echo "check_7_message=Code paths staged but no use-case / spec / decomposition present"
368
- echo "check_7_recommendation=Per Cockburn ceremony matrix — new hook + lib merit brief use case at docs/use-cases/UC-<slug>.md; app code merits fully-dressed. Skip only for typo/trivial extensions."
369
- warn=$((warn + 1))
370
- fi
371
- fi
372
-
373
- # === Summary ===
374
- echo "summary_count_pass=$pass"
375
- echo "summary_count_warn=$warn"
376
- echo "summary_count_fail=$fail"
377
- if [ "$fail" -gt 0 ]; then
378
- echo "summary_status=fail"
379
- return 2
380
- elif [ "$warn" -gt 0 ]; then
381
- echo "summary_status=warn"
382
- return 1
383
- else
384
- echo "summary_status=pass"
385
- return 0
386
- fi
387
- }
388
-
389
- # Helper: render the structured output as a human-readable block.
390
- # Composers can pipe `composer_preflight_check ... | composer_preflight_render`
391
- # for a polished operator-facing surface.
392
- composer_preflight_render() {
393
- local skill_name="${1:-the skill}"
394
- local input
395
- input=$(cat)
396
-
397
- echo ""
398
- echo "============================================"
399
- echo "PRE-FLIGHT CHECK — /$skill_name"
400
- echo "============================================"
401
-
402
- local i status name message rec
403
- for i in 1 2 3 4 5 6 7; do
404
- status=$(echo "$input" | grep -E "^check_${i}_status=" | head -1 | sed 's/^check_[0-9]_status=//')
405
- name=$(echo "$input" | grep -E "^check_${i}_name=" | head -1 | sed 's/^check_[0-9]_name=//')
406
- message=$(echo "$input" | grep -E "^check_${i}_message=" | head -1 | sed 's/^check_[0-9]_message=//')
407
- rec=$(echo "$input" | grep -E "^check_${i}_recommendation=" | head -1 | sed 's/^check_[0-9]_recommendation=//')
408
-
409
- # Skip render slot if check didn't fire (e.g., pre-Check-6 fixtures)
410
- [ -z "$name" ] && continue
411
-
412
- local glyph
413
- case "$status" in
414
- pass) glyph="✓" ;;
415
- warn) glyph="⚠️ " ;;
416
- fail) glyph="✗" ;;
417
- *) glyph="?" ;;
418
- esac
419
-
420
- printf " %s %-15s %s\n" "$glyph" "$name" "$message"
421
- if [ -n "$rec" ]; then
422
- printf " └─ recommendation: %s\n" "$rec"
423
- fi
424
- done
425
-
426
- local summary_status pass warn fail
427
- summary_status=$(echo "$input" | grep "^summary_status=" | head -1 | sed 's/^summary_status=//')
428
- pass=$(echo "$input" | grep "^summary_count_pass=" | head -1 | sed 's/^summary_count_pass=//')
429
- warn=$(echo "$input" | grep "^summary_count_warn=" | head -1 | sed 's/^summary_count_warn=//')
430
- fail=$(echo "$input" | grep "^summary_count_fail=" | head -1 | sed 's/^summary_count_fail=//')
431
-
432
- echo ""
433
- case "$summary_status" in
434
- pass)
435
- echo "DISPATCH READY: all $pass checks pass."
436
- ;;
437
- warn)
438
- echo "DISPATCH WITH WARNINGS: $pass pass, $warn warn, $fail fail."
439
- echo "Composer should ask operator to proceed/abort."
440
- ;;
441
- fail)
442
- echo "DISPATCH REFUSED: $pass pass, $warn warn, $fail fail."
443
- echo "Resolve fail-tier checks before proceeding."
444
- ;;
445
- skip)
446
- echo "PRE-FLIGHT SKIPPED (SKIP_COMPOSER_PREFLIGHT=1)."
447
- ;;
448
- esac
449
- echo "============================================"
450
- echo ""
451
- }
452
-
453
- # If sourced, the functions are available. If executed directly, run a
454
- # self-test against the current repo + report.
455
- if [ "${BASH_SOURCE[0]:-$0}" = "${0}" ]; then
456
- echo "Self-test mode: running composer_preflight_check for /launch with 60-turn estimate"
457
- echo ""
458
- composer_preflight_check "launch" 60 | composer_preflight_render "launch"
459
- fi