feat(bootstrap): wire role-x intake + coverage hooks in template#19
Conversation
Closes the gap where `bstack bootstrap` installed role-x as a skill (via ROSTER in #13) but left its hooks dormant in `.claude/settings.json` — agents installing bstack fresh had P17 routing files on disk but no UserPromptSubmit or coverage trigger. Every workspace had to wire those by hand. Confirmed end-to-end against this workspace's live settings. Added (assets/templates/settings.json.snippet): - UserPromptSubmit block → role-x-intake-hook.sh (P17 per-prompt routing) - SessionStart block extended → role-x-coverage-hook.sh (P17 registry- health nudge, ≤1/24h cooldown, silent when fire-rate ≥30%) - New ${BROOMVA_HOME} placeholder for $HOME-rooted paths (npx skills add -g installs at ${HOME}/.agents/skills/<name>) Extended (scripts/bootstrap.sh): - Phase 3 sed substitution: -e for both ${BROOMVA_WORKSPACE} and ${BROOMVA_HOME} → workspace dir and $HOME respectively - Phase 3 Python merge path: two-step .replace() for the same two placeholders before json.loads() - Idempotent merge logic unchanged — existing-by-basename detection already handles re-runs correctly (verified Case C: 0 new wires on a workspace where both role-x hooks were already manually wired) - Drive-by fix: log format string was "PP8"/"PP17" (double-P) because the _bstack_primitive value already contains the "P" prefix; corrected to ({primitive}) with P? fallback when key absent Extended (scripts/doctor.sh): - §6 hook-wiring array gets role-x-intake-hook.sh + role-x-coverage-hook.sh with P17 labels - Old skill-freshness-hook.sh label corrected from P7 → P8 (post-PR #16 numbering) - Docstring header §5 now enumerates all 5 hooks by primitive - Docstring header §6 adds P17 disk-presence reachability spec Validation: - JSON valid on new snippet (python3 -c 'json.load(...)') - Bash syntax green on bootstrap.sh + doctor.sh (bash -n) - Three dry-run cases on /tmp scratch: A. Fresh scaffold → snippet renders 5 hook events with absolute ${HOME} paths resolved correctly B. Existing settings.json with only P1/P2 → merge adds 4 missing hooks (P8 freshness, P17 intake, P17 coverage, P1 notification) C. Workspace with all 5 hooks already wired → 0 new wires (idempotency confirmed) - doctor.sh on live workspace: all 5 hook checks [ok] including the two new P17 entries Coordination with concurrent PRs: - PR #17 (broomva): SKILL.md prose drift + AGENTS/CLAUDE templates + scaffold-and-doctor test. Touches SKILL.md, AGENTS.md.template, CLAUDE.md.template, template_lockstep.test.sh — NO overlap with this PR (verified via gh pr diff 17). - SKILL.md ## Hooks section update deferred to a follow-up PR after #17 lands, to keep edits non-overlapping. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughSettings template extended with two new role-x hooks (coverage and intake) wired to SessionStart and UserPromptSubmit. Bootstrap script updated to substitute both workspace and home variables. Doctor script expanded to validate and guide the new hook configuration. ChangesRole-X Hook Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Closes the gap where
bstack bootstrapinstalled role-x as a skill (via #13 ROSTER) but left its hooks dormant in.claude/settings.json. Every workspace had to wireUserPromptSubmitand theSessionStartcoverage entry by hand. After this PR: freshbstack bootstrapwires both automatically.What changes
assets/templates/settings.json.snippet(+15 / -1)UserPromptSubmitevent withrole-x-intake-hook.sh(P17 per-prompt routing)SessionStartevent withrole-x-coverage-hook.sh(P17 registry-health nudge, 24h cooldown, silent when fire-rate ≥30%)${BROOMVA_HOME}placeholder for$HOME-rooted paths (npx skills add -ginstalls at${HOME}/.agents/skills/<name>)scripts/bootstrap.sh(+5 / -2)-eflags for both${BROOMVA_WORKSPACE}and${BROOMVA_HOME}.replace()calls beforejson.loads()(PP8)/(PP17)because_bstack_primitivealready carriesP; now prints(P8)/(P17)scripts/doctor.sh(+10 / -1)role-x-intake-hook.sh+role-x-coverage-hook.shwith P17 labelsskill-freshness-hook.shP7 (SessionStart)→P8 (SessionStart)(post-feat: align P7/P8/P9 numbering to workspace canonical #16 renumbering)Validation — three dry-run cases on /tmp scratch + live doctor
doctor.shon this workspace after the edit:JSON valid (
python3 -c 'json.load(...)'). Bash syntax green on both modified scripts (bash -n).Coordination with concurrent PRs
SKILL.md,assets/templates/AGENTS.md.template,assets/templates/CLAUDE.md.template,tests/template_lockstep.test.sh. Zero file overlap with this PR.## Hookssection documentation update deferred to a follow-up PR after fix(polish): SKILL.md body drift + scaffold-and-doctor detector + P20 Linear-ticket #17 lands, to keep edits non-overlapping.Test plan
[ok]gh pr diff 17)${BROOMVA_HOME}placeholder convention (alternative: hard-code$HOMEin template; only substitute at write-time)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Bug Fixes