Skip to content

feat(extensions): run hooks at named sections of plan and tasks - #5669

Open
Yui1x wants to merge 1 commit into
github:mainfrom
Yui1x:feat/5340-section-hooks
Open

Yui1x wants to merge 1 commit into
github:mainfrom
Yui1x:feat/5340-section-hooks

Conversation

@Yui1x

@Yui1x Yui1x commented Dec 2, 2026 •

Copy link
Copy Markdown

Description

Closes #5340.

An extension can now register after: plan.design to review the generated design before the final constitution check, or before: tasks.generate to check inputs before tasks are derived. Both sections have a matching hook on the other side. Installation translates these bindings into ordinary event keys, so existing hook filtering, ordering and removal apply.

Testing

  • Ran specify --help from an editable install.
  • Ran the extension, hook, skill, installed-info and agent-configuration tests.
  • Tested with a fresh project initialized from this checkout.

On the base revision, the binding list failed to install with Invalid hooks: expected a mapping, and both template boundary tests failed. On Windows, 755 tests passed and 24 skipped. Two existing symlink tests also failed on the base revision with WinError 1314 and were deselected for the repeat run. The same seven test files passed in full under WSL with a POSIX temporary directory (781 tests). The repository's pinned Ruff check and the API guide's Markdown lint passed.

In the offline sample project, I followed the installed Codex skills against a small line-counting feature. A local extension recorded which artifacts existed at each hook.

Generated command Result
T1 · $speckit-specify Wrote the feature spec and feature pointer used by planning.
T2 · $speckit-plan The before-design hook saw the research file. The after-design hook also saw the data model and CLI contract, before the constitution recheck.
T3 · $speckit-tasks The before-generate hook saw the design. The after-generate hook saw the written task IDs and ran before the whole-command post-hook.

AI Disclosure

  • I did not use AI assistance for this contribution.
  • I did use AI assistance.

OpenAI Codex (GPT-6) worked autonomously on behalf of @Yui1x. It wrote the implementation, templates, documentation, tests and PR description, ran the checks, and exercised the sample workflow. The reasoning-effort setting was not exposed in this session.

Allow extension authors to register before/after bindings at the design and task-generation boundaries without replacing a core template.

Assisted-by: OpenAI Codex (model: GPT-6, autonomous)
@Yui1x
Yui1x requested a review from mnriem as a code owner December 2, 2026 10:03
Copilot AI adaptive review requested due to automatic review settings December 2, 2026 10:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Manifest bindings and named-section hooks introduce interacting execution-order, artifact-availability, and mandatory-hook continuation semantics that require human review.

No open issues 🎉

What changed in this PR

Adds hooks around named sections in Spec Kit’s plan and tasks commands, allowing extensions to run intermediate checks without copying command templates.

Changes:

  • Accepts before/after binding lists and converts them to existing hook event keys.
  • Adds boundaries around plan design and task generation.
  • Documents the syntax and tests binding validation and boundary placement.
File Description
tests/​test_extensions.py Tests binding registration and invalid inputs.
tests/​test_command_template_hooks.py Tests section markers and hook boundaries.
templates/​commands/​tasks.md Adds hooks around task generation.
templates/​commands/​plan.md Adds hooks around design generation.
src/​specify_cli/​extensions/​__init__.py Validates and normalizes hook binding lists.
docs/​extensions/​api.md Documents named-section hooks and supported targets.

Review effort: Balanced (adaptive)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hooks at named sections inside a command, not only before and after it

2 participants