feat(extensions): add --force flag to extension add for overwrite reinstall#2530
Open
grissiom wants to merge 2 commits into
Open
feat(extensions): add --force flag to extension add for overwrite reinstall#2530grissiom wants to merge 2 commits into
grissiom wants to merge 2 commits into
Conversation
…nstall Add --force support to `specify extension add` that allows overwriting an already-installed extension without manually removing it first. - install_from_directory() and install_from_zip() accept force=True, automatically calling remove() before installation - The --force CLI flag works with all install modes (--dev, --from URL, bundled, and catalog) - Config files (*-config.yml) are preserved across force reinstall - Error message suggests --force when extension is already installed - 6 new tests covering unit and CLI force reinstall flows
Contributor
There was a problem hiding this comment.
Pull request overview
Adds --force support to specify extension add so users can overwrite/reinstall an already-installed extension in one step, while preserving *-config.yml files across the reinstall.
Changes:
- Add
forceparameter toExtensionManager.install_from_directory()/install_from_zip()and plumb--forcethrough the CLI. - Preserve extension config files across force reinstalls via
.specify/extensions/.backup/<ext_id>restore logic. - Add unit + CLI tests for force reinstall behavior and updated duplicate-install error messaging.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/extensions.py |
Implements force reinstall path, updated duplicate install error text, and config backup restore. |
src/specify_cli/__init__.py |
Adds --force flag to specify extension add and passes it through to install routines. |
tests/test_extensions.py |
Adds tests for force reinstall flows (directory/zip) and CLI coverage for extension add --dev --force. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
Collaborator
|
Please address Copilot feedback |
- Remove unused `backup_config_dir` variable assignment (Ruff F841) - Defer `remove()` until after `_validate_install_conflicts()` to prevent data loss if validation fails mid-reinstall - Use `TemporaryDirectory` instead of `NamedTemporaryFile` in ZIP test to avoid Windows file-locking failures
Author
|
@mnriem fixed the 3 comments, please review it again. Thanks~ |
Comment on lines
+1208
to
+1212
| # Restore config files from backup when reinstalling with --force | ||
| if force: | ||
| backup_config_dir = self.extensions_dir / ".backup" / manifest.id | ||
| if backup_config_dir.exists(): | ||
| for cfg_file in backup_config_dir.iterdir(): |
mnriem
requested changes
May 13, 2026
Collaborator
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback
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.
feat(extensions): add --force flag to extension add for overwrite reinstall
Add --force support to
specify extension addthat allows overwriting an already-installed extension without manually removing it first.Description
If the extension is updated, --force could eliminate the remove/install loop and simplify the workflow.
Testing
uv run specify --helpuv sync && uv run pytestAI Disclosure
Generated by Copilot(model: DeepSeek-V4).