Repository navigation
feat(integrations): add process_registered_command hook with source_id - #5215
Merged
Merged
Conversation
post_process_command_content() only sees rendered text, so an integration cannot tell a core command from an extension or preset command, and any rewrite that depends on the source has to live as an agent-name branch in CommandRegistrar.register_commands(). Add IntegrationBase .process_registered_command(frontmatter, body, *, source_id), called for every registered command after name injection and before placeholder resolution and rendering. The default returns both values unchanged, so no output changes. Assisted-by: Grok Bot (model: unknown, autonomous) Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The hook test cannot detect incorrect argument-conversion ordering because OpenCode leaves $ARGUMENTS unchanged and the fixture lacks a command-reference token.
1 open issue
What changed in this PR
Adds a source-aware integration hook to command registration, preparing for the Cline-specific rewrite changes in #5168 while preserving default output.
Changes:
- Introduces
process_registered_command()with parsed frontmatter, body, andsource_id. - Calls the hook before placeholder resolution and rendering.
- Adds tests for default behavior, source IDs, transformed output, skills layout, and aliases.
| File | Description |
|---|---|
tests/test_registered_command_hook.py |
Adds six tests covering the hook and registration output. |
src/specify_cli/integrations/base.py |
Defines and documents the default no-op hook. |
src/specify_cli/agents.py |
Invokes the integration hook during command registration. |
Review effort: Balanced (auto)
kevin9327
added a commit
to kevin9327/spec-kit
that referenced
this pull request
Nov 2, 2026
…lenames Brings in the process_registered_command hook (github#5215) that the Cline rewrite moves onto. Assisted-by: Grok Bot (model: unknown, autonomous) Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com>
Collaborator
|
Please address Copilot feedback |
OpenCode keeps $ARGUMENTS unchanged and the old fixture had no
__SPECKIT_COMMAND_*__ token, so the existing test still passed if
process_registered_command() ran after argument conversion or command
reference resolution. Add a Gemini case whose source contains both
placeholders: the hook must receive them unresolved, and tokens the hook
adds must come out resolved ({{args}}, /speckit.tasks) in the written
TOML command.
Assisted-by: Grok Bot (model: unknown, autonomous)
Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com>
Collaborator
|
Thank you! |
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.

Description
Prerequisite for #5168, split out as requested in this review and per the integration delivery boundary.
post_process_command_content()is the only per-integration hook thatCommandRegistrar.register_commands()calls, and it only sees the rendered text. It cannot tell whether a command came from core or from an extension or preset, and it runs after$ARGUMENTSand__SPECKIT_COMMAND_*__tokens are resolved. A rewrite that depends on the command's source therefore has nowhere to go except an agent-name branch inside the registrar (today,is_cline_extinagents.py).This PR adds
IntegrationBase.process_registered_command(frontmatter, body, *, source_id) -> (frontmatter, body):register_commands()calls it for every command it registers for the integration, after script-path adjustment andnameinjection, and before$ARGUMENTSconversion,__SPECKIT_COMMAND_*__resolution and rendering, so aliases and every output format (Markdown, TOML, YAML,SKILL.md) use the result.is_cline_extbranch is left as is here; fix(cline): keep .md extension on speckit.* file names in command bodies #5168 moves it into the Cline integration through this hook.Testing
New
tests/test_registered_command_hook.py(6 tests): the default is a no-op and default registration output is unchanged; an overriding integration receives the parsed frontmatter, the raw body (before$ARGUMENTSconversion) andsource_id("core"and an extension id), and its result is what gets written, including for a skills-layout agent and for aliases. 5 of the 6 fail onmain(the hook does not exist); all pass with this change.pytest -n 8 tests/integrations tests/test_post_process.py tests/test_extensions.py tests/test_registered_command_hook.py: 3708 passed, 8 skipped.uvx ruff@0.15.0 check src tests: clean.Tested locally with
uv run specify --helpRan existing tests with
uv sync && uv run pytest(the subset above)Tested with a sample project (if applicable)
AI Disclosure
AI disclosure: Implemented by Grok Bot, an AI coding agent acting on behalf of @kevin9327, running autonomously (model unknown, not exposed to the agent). Extent: design, code, tests and this description. The commit carries an
Assisted-by:trailer. The tests above were run by the agent; no personal human review is claimed.