fix extension-local script path rewriting#3364
Open
ZhiyaoWen999 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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_idcontext toCommandRegistrar.rewrite_project_relative_paths()and plumbed it through command/skill rendering flows. - Updated extension command + skill registration to pass
manifest.idso top-levelscripts/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
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.
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-levelscripts/reference as a core project script. That is correct for built-in commands and../../scripts/...references, but extension command sources may usescripts/...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
../../scripts/..., which still resolve to.specify/scripts/....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.pyPYTHONPATH=src .venv/bin/python -m pytest tests/test_extensions.py tests/test_extension_skills.py -qPYTHONPATH=src .venv/bin/python -m pytest tests/test_presets.py -qgit diff --checkAI 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.