feat(commands): wire before/after hook events into specify and plan templates#1886
Open
mvanhorn wants to merge 1 commit intogithub:mainfrom
Open
feat(commands): wire before/after hook events into specify and plan templates#1886mvanhorn wants to merge 1 commit intogithub:mainfrom
mvanhorn wants to merge 1 commit intogithub:mainfrom
Conversation
…emplates Replicates the hook evaluation pattern from tasks.md and implement.md (introduced in PR github#1702) into the specify and plan command templates. This completes the hook lifecycle across all SDD phases. Changes: - specify.md: Add before_specify/after_specify hook blocks - plan.md: Add before_plan/after_plan hook blocks - EXTENSION-API-REFERENCE.md: Document new hook events - EXTENSION-USER-GUIDE.md: List all available hook events Fixes github#1788 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the hook lifecycle across the SDD workflow by adding before_*/after_* hook evaluation instructions to the specify and plan command templates, and updating extension documentation to include the newly-supported events.
Changes:
- Add
before_specify/after_specifyhook evaluation blocks totemplates/commands/specify.md. - Add
before_plan/after_planhook evaluation blocks totemplates/commands/plan.md. - Update extension docs to list the expanded set of hook events.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| templates/commands/specify.md | Adds pre/post hook-check instructions for the specification phase. |
| templates/commands/plan.md | Adds pre/post hook-check instructions for the planning phase. |
| extensions/EXTENSION-API-REFERENCE.md | Documents the new hook events in the API reference and examples. |
| extensions/EXTENSION-USER-GUIDE.md | Updates the configuration example comments to list available hook events. |
Comments suppressed due to low confidence (2)
templates/commands/specify.md:220
- This block currently instructs skipping hooks with non-empty
condition. The repository’sHookExecutor.check_hooks_for_event()is explicitly designed to return hooks “with condition evaluation applied”, so skipping conditional hooks here meansafter_specifyhooks can never be conditionally enabled. Recommend aligning the template logic withHookExecutor: defaultenabledto true when missing and evaluate (or otherwise handle)conditioninstead of unconditionally skipping.
- Filter to only hooks where `enabled: true`
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
- For each executable hook, output the following based on its `optional` flag:
templates/commands/plan.md:85
- This
after_planhook-check block instructs skipping hooks wheneverconditionis non-empty. SinceHookExecutor.check_hooks_for_event()supports condition evaluation, this prevents usingconditionforafter_planhooks in practice. Recommend updating the template to evaluate supported condition expressions (or otherwise not exclude hooks purely because a condition is present), and to treat missingenabledas enabled by default.
- Filter to only hooks where `enabled: true`
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
- For each executable hook, output the following based on its `optional` flag:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+30
to
+33
| - Filter to only hooks where `enabled: true` | ||
| - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions: | ||
| - If the hook has no `condition` field, or it is null/empty, treat the hook as executable | ||
| - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation |
Comment on lines
+33
to
+36
| - Filter to only hooks where `enabled: true` | ||
| - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions: | ||
| - If the hook has no `condition` field, or it is null/empty, treat the hook as executable | ||
| - If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation |
Comment on lines
562
to
563
| - `before_commit` - Before git commit | ||
| - `after_commit` - After git commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes the hook lifecycle across all SDD phases by adding
before_specify/after_specifyandbefore_plan/after_planhook evaluation to the specify and plan command templates. This follows the pattern established in PR #1702 for tasks and implement templates.Why this matters
Extensions can register hooks for
after_tasksandafter_implement(since PR #1702), but cannot hook into the specify or plan phases (#1788). This gap means extensions that need to run automation after specification or planning (e.g., creating tracking tickets, running validation, triggering notifications) have no supported hook point.Per @dhilipkumars's feedback on #1788: both
before_andafter_hooks are included, and extension documentation is updated.Changes
templates/commands/specify.md: Addedbefore_specify(Pre-Execution Checks) andafter_specify(step 8) hook evaluation blockstemplates/commands/plan.md: Addedbefore_plan(Pre-Execution Checks) andafter_plan(step 5) hook evaluation blocksextensions/EXTENSION-API-REFERENCE.md: Added all new events to the documented hook events list and updated example referencesextensions/EXTENSION-USER-GUIDE.md: Listed all available hook events in the configuration exampleThe hook blocks replicate the exact format from
tasks.mdandimplement.md- same optional/mandatory handling, same condition-skipping logic, same output format.Testing
uv run pytest)ruff check src/passesAI Disclosure
This PR was authored with AI assistance (Claude Code). The hook blocks were replicated from the existing tasks.md/implement.md pattern and verified for consistency.
Fixes #1788