Skip to content

fix(integrations): preserve native skill invocation prefixes#3663

Open
BenBtg wants to merge 12 commits into
mainfrom
fix/native-invocation-prefixes
Open

fix(integrations): preserve native skill invocation prefixes#3663
BenBtg wants to merge 12 commits into
mainfrom
fix/native-invocation-prefixes

Conversation

@BenBtg

@BenBtg BenBtg commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve each integration's native skill invocation syntax when rendering command references:

  • render Codex and ZCode skill invocations as $speckit-<name>
  • retain /speckit-<name> for other skills integrations and /speckit.<name> for command integrations
  • propagate the selected prefix through init, install, switch, upgrade, refresh, extension registration, preset restoration, and shared Bash/PowerShell/Python helpers
  • keep literal documentation examples unchanged while resolving explicit command-reference tokens
  • centralize integration prefix selection to avoid duplicated branching across lifecycle paths

This extracts the invocation-prefix work from #3616 so that PR remains focused on the constitution command guardrail. No constitution template or guardrail test changes are included here.

Validation

  • .venv/bin/python -m pytest tests/integrations/test_base.py tests/integrations/test_cli.py tests/integrations/test_integration_codex.py tests/integrations/test_integration_zcode.py tests/integrations/test_integration_subcommand.py tests/test_extensions.py tests/test_presets.py tests/test_setup_tasks.py -q — 1151 passed
  • uvx ruff check src/specify_cli tests/integrations/test_integration_codex.py tests/integrations/test_integration_zcode.py --quiet
  • git diff --check

Authored autonomously by GitHub Copilot (model: GPT-5.6 Sol) on behalf of @BenBtg.

BenBtg added 11 commits July 22, 2026 18:25
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Resolve generated command references with the active agent prefix instead of rewriting all slash-form text during post-processing.

Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Pass dollar-style skill prefixes through bare-project integration installation and cover the shared template output.

Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Use agent-native invocation prefixes in extension command registration and dynamic shared-script command hints.

Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Escape dollar-prefixed commands embedded in Bash strings and propagate the native prefix into installed Python command helpers.

Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Rewrite installed Bash and PowerShell formatter return expressions so direct callers receive the selected integration's native prefix.

Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Describe hook-derived references as command invocations so dollar-prefixed skills do not receive contradictory slash-command terminology.

Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 02f9e138-da58-4a60-93b9-eae659d2aa19
Copilot AI review requested due to automatic review settings July 22, 2026 17:30
@BenBtg
BenBtg requested a review from mnriem as a code owner July 22, 2026 17:30

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

Preserves native $speckit-* invocation syntax for Codex and ZCode across integration rendering and lifecycle operations.

Changes:

  • Centralizes native prefix resolution.
  • Propagates prefixes through shared infrastructure, extensions, presets, and integration lifecycle flows.
  • Adds coverage for dollar-prefixed rendering across Bash, PowerShell, and Python.
Show a summary per file
File Description
src/specify_cli/__init__.py Forwards invocation prefixes to shared infrastructure.
src/specify_cli/agents.py Applies native prefixes during command registration.
src/specify_cli/commands/init.py Supplies the selected prefix during initialization.
src/specify_cli/integration_runtime.py Resolves prefixes by integration mode.
src/specify_cli/integrations/_helpers.py Preserves prefixes when changing defaults.
src/specify_cli/integrations/_install_commands.py Handles prefixes during installation.
src/specify_cli/integrations/_migrate_commands.py Handles prefixes during switch and upgrade.
src/specify_cli/integrations/base.py Renders native skill invocations and hook guidance.
src/specify_cli/presets/__init__.py Preserves prefixes during preset restoration.
src/specify_cli/shared_infra.py Renders prefixes in templates and scripts.
tests/integrations/test_base.py Tests core invocation rendering.
tests/integrations/test_cli.py Tests shared template and script output.
tests/integrations/test_integration_base_skills.py Updates hook-guidance expectations.
tests/integrations/test_integration_codex.py Verifies Codex guidance wording.
tests/integrations/test_integration_subcommand.py Tests install and switch behavior.
tests/integrations/test_integration_zcode.py Cleans up ZCode test formatting.
tests/test_extensions.py Tests Codex extension references.
tests/test_presets.py Tests dollar-prefixed preset restoration.
tests/test_setup_tasks.py Tests Bash and PowerShell formatters.

Review details

Tip

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

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

slash commands. Subclasses may override — see ``ClaudeIntegration``.
"""
return self._inject_hook_command_note(content)
invocation_prefix = "$" if is_dollar_skills_agent(self.key, True) else "/"
"invoke_separator", "."
)
return IntegrationBase.resolve_command_refs(body, separator)
prefix = "$" if is_dollar_skills_agent(selected_ai, separator == "-") else "/"
Copilot AI review requested due to automatic review settings July 22, 2026 17:34

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.

Review details

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

Comment on lines +105 to +106
skills_mode = integration.is_skills_mode(parsed_options, project_root)
return "$" if is_dollar_skills_agent(key, skills_mode) else "/"
Comment on lines +314 to +315
content = _BASH_FORMATTER_RETURN_RE.sub(
f'''printf '{prefix}speckit%s%s\\\\n' "$separator" "$command_name"''',
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.

2 participants