Add phase note template enforcement hook (#63) #64
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom!64
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "63-check-phase-template-hook"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
PreToolUse hook that validates
mcp__pal-e-docs__create_notecalls wherenote_type=phase. Checks HTML content against required fields fromtemplate-phase: bold header fields (Goal, Owner, Repo, Depends on), structure (Scope OR Problem+Fix), and Related section. Fail-open on all errors.Changes
hooks/check-phase-template.sh(new) -- PreToolUse hook that validates phase note content against template-phase. Checkstool_input.note_type == "phase"first, bails early for non-phase notes. Validates required bold fields, structure shape (full phase vs subphase), and Related section.settings.json-- Registered the new hook under the existingmcp__pal-e-docs__create_notematcher alongsidecheck-note-template.sh.Test Plan
Review Checklist
Related
plan-2026-03-07-note-hierarchy-conventions(Phase 4)PR #64 Review
BLOCKERS
None.
NITS
Hardcoded vs. dynamic template validation --
check-note-template.shandcheck-issue-template.shfetch the template from pal-e-docs at runtime and extract required headings dynamically. This hook hardcodes the required fields (Goal:,Owner:,Repo:,Depends on:,Scope, etc.) directly in the script. This means iftemplate-phasechanges, the hook must be updated manually. This is a reasonable tradeoff (phase templates are stable, and HTML structure parsing for bold fields would be fragile), but worth documenting in the script header that the field list is hardcoded and must be kept in sync withtemplate-phase.sedampersand replacement (pre-existing) -- Line 43:s/&/\&/g-- the\&in sed replacement is a backreference to the matched text, so this replaces&with itself (&). The correct replacement would bes/&/\&/gwith a literal&ors/&/\x26/g. However, this is the exact same pattern used incheck-issue-template.sh(line 53),check-note-template.sh(lines 84, 91), so it is a pre-existing issue across all hooks, not introduced here. Non-blocking.Minor:
grep -qiwith\|alternation -- Lines 57-59 use\|for alternation in basic regex mode. This works on GNU grep (which is what Arch ships) but is not POSIX-standard. Since the platform is Arch Linux only, this is fine, but a comment noting GNU grep dependency would be defensive.SOP COMPLIANCE
63-check-phase-template-hookreferences issue #63)plan-2026-03-07-note-hierarchy-conventions)mcp__pal-e-docs__create_note)Additional Observations
note_typefield confirmed valid --NoteTypeenum inpal-e-docs/schemas.pyincludes"phase". Thetool_input.note_typegate is correct.note_type != "phase". Correct.$CONTENTand$DECODEDare properly double-quoted in all uses.jq -n --argsafely escapes the$MISSINGvariable in JSON output.set -eo pipefail+trap 'exit 0' ERRmatches all existing hooks.mcp__pal-e-docs__create_notematcher array alongsidecheck-note-template.sh. Both hooks will run:check-note-template.shvalidates tag-based templates (plan, bug, etc.),check-phase-template.shvalidates phase-specific structure. No conflict since they check orthogonal things.VERDICT: APPROVED