Skip to content

fix(extensions): render hyphenated hook invocations for Forge projects#3641

Merged
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/forge-hook-invocation-hyphenated
Jul 22, 2026
Merged

fix(extensions): render hyphenated hook invocations for Forge projects#3641
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/forge-hook-invocation-hyphenated

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

Forge is a hyphenated slash-command agent — it registers its commands as /speckit-<name> (see format_forge_command_name and ForgeIntegration.build_command_invocation in src/specify_cli/integrations/forge/__init__.py), exactly like Cline.

But HookExecutor._render_hook_invocation (src/specify_cli/extensions/__init__.py) special-cases only dollar-skills agents, kimi, cline, and slash-skills agents. Forge matches none of them, so it fell through to:

return f"/{command_id}"

rendering the dotted form — /speckit.plan, /speckit.git.commit — which Forge does not recognize as a registered command. Hook execution messages therefore told Forge users to run commands that don't exist under that name.

Fix

Add a Forge branch mirroring the adjacent Cline branch:

if forge_mode:
    from ..integrations.forge import format_forge_command_name
    return f"/{format_forge_command_name(command_id)}"

format_forge_command_name is idempotent and has the same contract as the Cline formatter already used one branch above. Non-Forge agents are unaffected.

Tests

tests/test_extensions.py::TestHookInvocationRendering — two tests mirroring the existing Cline hook tests:

  • test_forge_hooks_render_hyphenated_invocationspeckit.tasks renders /speckit-tasks
  • test_forge_hooks_render_extension_commandmy-extension.do-something renders /speckit-my-extension-do-something

Verified fail-before / pass-after (reverting only the source hunk makes both fail, rendering the dotted /my-extension.do-something). ruff check clean.


AI-assisted: authored with Claude Code. I confirmed Forge's hyphenated command registration and that the Cline branch is the exact sibling precedent, and verified fail-before/pass-after.

Forge is a hyphenated slash-command agent: it registers its commands as
`/speckit-<name>` (see `format_forge_command_name` and
`ForgeIntegration.build_command_invocation`), exactly like Cline.

`HookExecutor._render_hook_invocation` special-cases dollar-skills agents,
kimi, cline, and slash-skills agents, but had no Forge branch. Forge
matches none of those, so it fell through to `return f"/{command_id}"`
and rendered the DOTTED form — `/speckit.plan`, `/speckit.git.commit` —
which Forge does not recognize as a registered command.

Add a Forge branch mirroring the adjacent Cline branch, using
`format_forge_command_name` (idempotent, same contract as the Cline
formatter). Non-Forge agents are unaffected.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

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.

Pull request overview

Fixes Forge hook messages to use registered hyphenated slash-command names.

Changes:

  • Formats Forge hook invocations with format_forge_command_name.
  • Adds coverage for built-in and extension commands.
Show a summary per file
File Description
src/specify_cli/extensions/__init__.py Adds Forge-specific hook invocation rendering.
tests/test_extensions.py Tests Forge hook command formatting.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

@mnriem
mnriem merged commit 735fe0c into github:main Jul 22, 2026
14 checks passed
@mnriem

mnriem commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

mnriem pushed a commit that referenced this pull request Jul 23, 2026
…sting (#3669)

After `specify extension add`, the "Provided commands" summary hyphenated
command names only for Cline. For a Forge project the names were printed in
dotted form (e.g. `speckit.test-ext.hello`), but Forge registers them
hyphenated (`speckit-test-ext-hello`), so the printed names didn't match
what the user actually invokes in Forge.

Extend the existing Cline handling to Forge via `format_forge_command_name`,
completing the Forge command-name parity already fixed for hook invocations
(#3641) and the init next-steps panel (#3642).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

3 participants