Skip to content

fix extension-local script path rewriting#3364

Merged
mnriem merged 1 commit into
github:mainfrom
ZhiyaoWen999:fix/3358-extension-script-paths
Jul 7, 2026
Merged

fix extension-local script path rewriting#3364
mnriem merged 1 commit into
github:mainfrom
ZhiyaoWen999:fix/3358-extension-script-paths

Conversation

@ZhiyaoWen999

Copy link
Copy Markdown
Contributor

Summary

Fixes #3358.

Extension command materialization now keeps extension-owned scripts/... references under .specify/extensions/<extension_id>/scripts/... instead of rewriting them to core .specify/scripts/....

Root Cause

CommandRegistrar.rewrite_project_relative_paths() treated every top-level scripts/ reference as a core project script. That is correct for built-in commands and ../../scripts/... references, but extension command sources may use scripts/... to refer to helper scripts shipped inside the extension archive.

During skills/materialization, those paths were rewritten to .specify/scripts/..., where extension helper scripts do not exist.

Changes

  • Added optional extension context to script path rewriting and skill placeholder resolution.
  • Passed the installed extension id through extension command and skill registration paths.
  • Preserved existing behavior for core scripts such as ../../scripts/..., which still resolve to .specify/scripts/....
  • Added regression coverage for direct path rewriting and auto-registered extension skills.

Validation

  • PYTHONPATH=src .venv/bin/python -m ruff check src/specify_cli/agents.py src/specify_cli/extensions/__init__.py tests/test_extensions.py tests/test_extension_skills.py
  • PYTHONPATH=src .venv/bin/python -m pytest tests/test_extensions.py tests/test_extension_skills.py -q
  • PYTHONPATH=src .venv/bin/python -m pytest tests/test_presets.py -q
  • git diff --check

AI Disclosure

I used Codex to investigate the issue, implement the fix, add tests, and run validation. I reviewed the code paths and test results before submitting.

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 fixes extension command materialization so that extension-owned scripts/... references remain extension-local under .specify/extensions/<extension_id>/scripts/... instead of being rewritten into core .specify/scripts/..., addressing #3358.

Changes:

  • Added an optional extension_id context to CommandRegistrar.rewrite_project_relative_paths() and plumbed it through command/skill rendering flows.
  • Updated extension command + skill registration to pass manifest.id so top-level scripts/ resolves into the installed extension directory when materializing extension content.
  • Added regression tests covering both direct path rewriting and auto-registered extension skills.
Show a summary per file
File Description
src/specify_cli/agents.py Adds extension_id-aware rewriting so extension scripts/ paths resolve under .specify/extensions/<id>/scripts/ during rendering.
src/specify_cli/extensions/__init__.py Passes manifest.id through extension registration/materialization so extension context is applied consistently.
tests/test_extensions.py Extends unit coverage for _adjust_script_paths() and rewrite_project_relative_paths() with extension context behavior.
tests/test_extension_skills.py Adds regression coverage ensuring auto-registered skills preserve extension-local script paths and don’t rewrite into .specify/scripts/.

Review details

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Low

@mnriem mnriem merged commit 1930f89 into github:main Jul 7, 2026
12 checks passed
@mnriem

mnriem commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

kanfil added a commit to tikalk/agentic-sdlc-spec-kit that referenced this pull request Jul 7, 2026
Upstream commits merged (9):

- 4bb5166 Add Charter extension to community catalog (github#3363)

- 1930f89 fix: extension-local script path rewriting (github#3364)

- 0e40438 Update Ralph Loop extension to v1.2.1 (github#3365)

- 2b5e175 fix(bundler): validate catalog URLs in catalog add (github#3367)

- abaed10 chore: release 0.12.6, begin 0.12.7.dev0 (github#3393)

- d4e7d2b feat(integrations): generalize post-processing to all format types (github#3311)

- 1935cf7 Update Ripple extension to v1.1.0 (github#3370)

- 7839acc Update DocGuard extension to v0.30.0 (github#3371)

- f764270 Add Orchestration Task Context Management extension (github#3372)

Conflict resolution: pyproject.toml (trivial version), agents.py (3-way merge

of fork _skip_primary alias-only restructure + upstream extension_id threading

+ post_process_command_content hook).

Assisted-by: OpenCode (model: glm-5.2, autonomous)
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.

[Bug]: Extension materialization rewrites extension-local script paths to .specify/scripts/, breaking installed extensions

3 participants