Skip to content

Cover init command hint display#2776

Open
nike-17 wants to merge 1 commit into
github:mainfrom
nike-17:feat/integration-command-prefixes
Open

Cover init command hint display#2776
nike-17 wants to merge 1 commit into
github:mainfrom
nike-17:feat/integration-command-prefixes

Conversation

@nike-17

@nike-17 nike-17 commented May 30, 2026

Copy link
Copy Markdown

Description

Adds regression coverage for the user-facing command hints printed by specify init.

This is intentionally display-only: it verifies Codex shows $speckit-... in the init next-steps output, Copilot default mode keeps /speckit.<name>, and Copilot skills mode keeps /speckit-<name>. The broader template/script/hook/preset plumbing from the earlier version of this PR has been removed.

Testing

uv run pytest tests/test_init_command_invocations.py -q
uv run pytest tests/integrations tests/test_extensions.py tests/test_workflows.py tests/test_setup_tasks.py tests/test_init_command_invocations.py -q
uv run --with ruff ruff check src/specify_cli tests
git diff --cached --check

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

Implemented with Codex assistance in this repository workspace.

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

This PR makes user-facing Spec Kit command hints “integration-aware” by introducing an integration-owned display invocation API (prefix + separator) and routing template/script placeholder rendering and init guidance through it (notably enabling Codex-style $speckit-… hints while preserving existing slash-command behaviors).

Changes:

  • Added user_command_prefix + build_user_command_invocation() to integrations, and extended resolve_command_refs() / process_template() to render integration-specific command hints.
  • Updated shared infra installation/refresh and presets/template processing to pass the active integration’s prefix/separator and safely escape $speckit… in generated scripts.
  • Expanded test coverage across init output, template/script rendering, and Codex/Copilot behaviors.
Show a summary per file
File Description
tests/test_init_command_invocations.py New regression tests asserting init “next steps” use the correct invocation syntax per integration.
tests/integrations/test_integration_subcommand.py Updates expectations for Codex-switched template content to use $speckit-….
tests/integrations/test_integration_state.py Adds coverage for persisted command_prefix normalization and runtime invocation helpers.
tests/integrations/test_integration_codex.py Verifies Codex display invocations and generated skills use $speckit-… consistently.
tests/integrations/test_integration_base_skills.py Ensures skills integrations’ user-facing invocations remain consistent and hook-note logic aligns with new syntax.
tests/integrations/test_integration_base_markdown.py Adds coverage that markdown integrations keep /speckit.<name> display hints.
tests/integrations/test_cli.py Adds infra-level tests for custom prefix rendering/escaping in templates and scripts, plus end-to-end init coverage for Codex.
tests/integrations/test_base.py Adds unit coverage for build_user_command_invocation() and new resolve_command_refs() capabilities.
templates/commands/*.md Switches hook output examples to {command_invocation} and adds guidance for dot→hyphen conversion when needed.
src/specify_cli/shared_infra.py Passes command_prefix through placeholder resolution and escapes $speckit in generated scripts.
src/specify_cli/presets.py Resolves command refs using both invoke separator and command prefix from agent configs.
src/specify_cli/integrations/*/init.py Sets integration-specific user_command_prefix and passes effective prefix/separator into template processing.
src/specify_cli/integrations/base.py Introduces display invocation API (user_command_prefix, formatter, and command-ref rendering updates).
src/specify_cli/integration_state.py Normalizes command_prefix in integration settings.
src/specify_cli/integration_runtime.py Persists command_prefix and introduces helpers for resolving prefix/invocations from stored state.
src/specify_cli/extensions.py Renders hook command invocations using integration-aware helpers when possible.
src/specify_cli/commands/init.py Uses integration-owned display invocation for init “next steps” hints.
src/specify_cli/agents.py Adds command_prefix to agent configs and uses it when resolving __SPECKIT_COMMAND_*__ in command bodies.
src/specify_cli/init.py Threads command_prefix into shared infra install/refresh across install/switch/upgrade flows.
AGENTS.md Documents user_command_prefix and notes build_user_command_invocation() behavior for skills mode.

Copilot's findings

Tip

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

  • Files reviewed: 35/35 changed files
  • Comments generated: 3

Comment thread src/specify_cli/integration_runtime.py Outdated
Comment thread src/specify_cli/extensions.py Outdated
Comment thread src/specify_cli/integrations/agy/__init__.py

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.

Copilot's findings

  • Files reviewed: 36/36 changed files
  • Comments generated: 1

Comment thread src/specify_cli/integrations/agy/__init__.py Outdated
@mnriem

mnriem commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback and resolve conflicts

@nike-17 nike-17 force-pushed the feat/integration-command-prefixes branch from 7872734 to 5212a54 Compare June 4, 2026 03:45
@mnriem mnriem requested a review from Copilot June 4, 2026 12:50

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.

Copilot's findings

  • Files reviewed: 39/39 changed files
  • Comments generated: 1

Comment thread src/specify_cli/integrations/agy/__init__.py

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address Copilot feedback

@nike-17

nike-17 commented Jun 5, 2026

Copy link
Copy Markdown
Author

Copilot feedback is addressed: the latest Agy comment was resolved by confirming _inject_hook_command_note is inherited from SkillsIntegration, with tests/integrations/test_integration_agy.py covering that call path. All review threads are resolved and CI is green on the current SHA (5212a54). Could you please re-review when you have a chance?

@nike-17

nike-17 commented Jun 5, 2026

Copy link
Copy Markdown
Author

I pushed an explicit Agy compatibility shim in 10d7d39 so AgyIntegration._inject_hook_command_note(...) is defined directly and forwards to SkillsIntegration._inject_hook_command_note(...). This keeps behavior centralized while addressing the Copilot concern. Local verification: 2705 passed, 9 skipped; ruff passed.

@nike-17 nike-17 force-pushed the feat/integration-command-prefixes branch from 64a8e8b to b626ce0 Compare June 5, 2026 05:11
@nike-17

nike-17 commented Jun 5, 2026

Copy link
Copy Markdown
Author

Agentic follow-up completed and pushed in b626ce0 after rebasing on latest main.

What changed after the prior update:

  • Fixed the legacy init-options.json hook fallback so skills integrations without readable .specify/integration.json render native invocations for Agy/Trae/Devin, while preserving legacy non-skills Codex dotted slash behavior.
  • Removed Agy's redundant second post-processing pass; it now relies on the shared SkillsIntegration path plus the explicit compatibility shim.
  • Added regression coverage for persisted command prefixes, Agy $speckit-git-commit hook notes, strict/corrupt ai_skills handling, and legacy skills fallback rendering.

Verification on the rebased branch:

  • uv run pytest tests/integrations tests/test_extensions.py tests/test_workflows.py tests/test_setup_tasks.py -q -> 2750 passed, 9 skipped
  • uv run --with ruff ruff check src/specify_cli tests -> passed
  • git diff --check -> passed

GitHub now reports the branch as mergeable and there are no unresolved review threads. The only remaining blocker I can see is the stale requested-changes review from the earlier Copilot feedback. Could you please re-review when available?

@nike-17 nike-17 force-pushed the feat/integration-command-prefixes branch from b626ce0 to e3e2657 Compare June 6, 2026 01:28
@mnriem mnriem requested a review from Copilot June 8, 2026 16:54

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.

Copilot's findings

  • Files reviewed: 41/41 changed files
  • Comments generated: 1

Comment thread src/specify_cli/extensions.py Outdated
@nike-17

nike-17 commented Jun 9, 2026

Copy link
Copy Markdown
Author

Addressed the new Copilot feedback in 35afa7f.

Change:

  • HookExecutor now caches integration metadata/default key/resolved integration per executor instance, so hook rendering no longer re-reads and parses .specify/integration.json for each hook.
  • Added regression coverage that calls _render_hook_invocation() twice and asserts the integration-state reader is invoked once.

Verification:

  • uv run pytest tests/test_extensions.py tests/integrations/test_integration_agy.py tests/integrations/test_integration_codex.py tests/integrations/test_integration_subcommand.py -q -> 370 passed
  • uv run pytest tests/integrations tests/test_extensions.py tests/test_workflows.py tests/test_setup_tasks.py -q -> 2761 passed, 9 skipped
  • uv run --with ruff ruff check src/specify_cli tests -> passed
  • git diff --check -> passed

The Copilot thread is now resolved.

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.

Copilot's findings

  • Files reviewed: 41/41 changed files
  • Comments generated: 0 new

@mnriem

mnriem commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Please rebase on main and run tests.

@nike-17 nike-17 force-pushed the feat/integration-command-prefixes branch from 35afa7f to dd6a97a Compare June 10, 2026 05:33
@nike-17

nike-17 commented Jun 10, 2026

Copy link
Copy Markdown
Author

Rebased on latest main and pushed dd6a97a.

I also aligned the PR-added init tests with the current CLI after upstream removed --no-git.

Verification after rebase:

  • uv run pytest tests/integrations/test_cli.py::TestSharedInfraCommandRefs::test_full_init_codex_resolves_page_templates tests/test_init_command_invocations.py -q -> 4 passed
  • uv run pytest tests/integrations tests/test_extensions.py tests/test_workflows.py tests/test_setup_tasks.py tests/test_init_command_invocations.py -q -> 2862 passed, 9 skipped
  • uv run --with ruff ruff check src/specify_cli tests -> passed
  • git diff --check -> passed

Current local/GitHub sweep: branch is mergeable and there are no unresolved review threads. GitHub checks have not appeared yet for the new SHA.

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.

Copilot's findings

  • Files reviewed: 41/41 changed files
  • Comments generated: 0 new

@mnriem

mnriem commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

OK I did a deeper dive and this is too many changes for what the title of the PR states. Can we dial it back to display only here? I realize I should have asked earlier, but this is touching way too many files.

@nike-17 nike-17 force-pushed the feat/integration-command-prefixes branch from dd6a97a to dac33db Compare June 13, 2026 05:00
@nike-17 nike-17 changed the title Add integration-aware command hints Cover init command hint display Jun 13, 2026
@nike-17

nike-17 commented Jun 13, 2026

Copy link
Copy Markdown
Author

Dialed this back to display-only as requested.

Current diff:

  • 1 file changed: tests/test_init_command_invocations.py
  • 88 additions, 0 deletions
  • No product-code, template, script, hook, preset, or integration plumbing changes remain.

What it covers:

  • Codex init next steps display $speckit-...
  • Copilot default init next steps keep /speckit.<name>
  • Copilot skills init next steps keep /speckit-<name>

Verification:

  • uv run pytest tests/test_init_command_invocations.py -q -> 3 passed
  • uv run pytest tests/integrations tests/test_extensions.py tests/test_workflows.py tests/test_setup_tasks.py tests/test_init_command_invocations.py -q -> 2822 passed, 9 skipped
  • uv run --with ruff ruff check src/specify_cli tests -> passed (same pre-existing unrelated malformed # noqa warning in tests/test_github_http.py)
  • git diff --cached --check -> passed

I also updated the PR title/body to match the reduced scope.

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