-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Added warning message about git extension no longer being enabled by default #2197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1277,6 +1277,8 @@ def init( | |||||
|
|
||||||
| ensure_constitution_from_template(project_path, tracker=tracker) | ||||||
|
|
||||||
| _git_ext_freshly_installed = False | ||||||
| _git_ext_install_notice: str | None = None | ||||||
| if not no_git: | ||||||
| tracker.start("git") | ||||||
| git_messages = [] | ||||||
|
|
@@ -1307,10 +1309,12 @@ def init( | |||||
| if manager.registry.is_installed("git"): | ||||||
| git_messages.append("extension already installed") | ||||||
| else: | ||||||
| manager.install_from_directory( | ||||||
| ext_manifest = manager.install_from_directory( | ||||||
| bundled_path, get_speckit_version() | ||||||
| ) | ||||||
| git_messages.append("extension installed") | ||||||
| _git_ext_freshly_installed = True | ||||||
| _git_ext_install_notice = ext_manifest.install_notice | ||||||
| else: | ||||||
| git_has_error = True | ||||||
| git_messages.append("bundled extension not found") | ||||||
|
|
@@ -1454,6 +1458,17 @@ def init( | |||||
| console.print(tracker.render()) | ||||||
| console.print("\n[bold green]Project ready.[/bold green]") | ||||||
|
|
||||||
| if _git_ext_freshly_installed and _git_ext_install_notice: | ||||||
| console.print() | ||||||
| console.print( | ||||||
| Panel( | ||||||
| _git_ext_install_notice.strip(), | ||||||
| title="[yellow]⚠ Deprecation notice: git Extension[/yellow]", | ||||||
|
||||||
| title="[yellow]⚠ Deprecation notice: git Extension[/yellow]", | |
| title="[yellow]⚠ Deprecation notice: git extension[/yellow]", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -837,3 +837,118 @@ def test_test_feature_branch_accepts_single_prefix(self, tmp_path: Path): | |
| text=True, | ||
| ) | ||
| assert result.returncode == 0 | ||
|
|
||
|
|
||
| # ── Deprecation Notice Tests ────────────────────────────────────────────────── | ||
|
|
||
|
|
||
| class TestGitExtDeprecationNotice: | ||
| """Tests for the v1.0.0 deprecation notice shown during specify init.""" | ||
|
|
||
| def test_deprecation_notice_shown_on_fresh_install(self, tmp_path: Path): | ||
| """specify init shows the git extension deprecation notice on first install.""" | ||
| from typer.testing import CliRunner | ||
| from unittest.mock import patch, MagicMock | ||
| from specify_cli import app | ||
|
|
||
| project_dir = tmp_path / "test-project" | ||
| runner = CliRunner() | ||
|
|
||
| mock_manifest = MagicMock() | ||
| mock_manifest.install_notice = ( | ||
| "The git extension is currently enabled by default, but starting with\n" | ||
| "v1.0.0 it will require explicit opt-in.\n\n" | ||
| "To opt in after v1.0.0:\n" | ||
| " • specify init --extension git\n" | ||
| " • specify extension add git (post-init)" | ||
| ) | ||
|
|
||
| mock_registry = MagicMock() | ||
| mock_registry.is_installed.return_value = False | ||
|
|
||
| mock_manager = MagicMock() | ||
| mock_manager.registry = mock_registry | ||
| mock_manager.install_from_directory.return_value = mock_manifest | ||
|
|
||
| with patch("specify_cli.extensions.ExtensionManager", return_value=mock_manager): | ||
| result = runner.invoke( | ||
| app, | ||
| ["init", str(project_dir), "--ai", "claude", "--ignore-agent-tools", "--script", "sh"], | ||
| catch_exceptions=False, | ||
| ) | ||
|
aaronrsun marked this conversation as resolved.
|
||
|
|
||
| assert result.exit_code == 0, result.output | ||
| assert "Deprecation notice: git Extension" in result.output | ||
| assert "v1.0.0" in result.output | ||
| assert "specify extension add git" in result.output | ||
|
Comment on lines
+880
to
+883
|
||
|
|
||
| def test_deprecation_notice_not_shown_when_already_installed(self, tmp_path: Path): | ||
| """specify init does NOT show the deprecation notice when git extension is already installed.""" | ||
| from typer.testing import CliRunner | ||
| from unittest.mock import patch, MagicMock | ||
| from specify_cli import app | ||
|
|
||
| project_dir = tmp_path / "test-project" | ||
| runner = CliRunner() | ||
|
|
||
| mock_registry = MagicMock() | ||
| mock_registry.is_installed.return_value = True | ||
|
|
||
| mock_manager = MagicMock() | ||
| mock_manager.registry = mock_registry | ||
|
|
||
| with patch("specify_cli.extensions.ExtensionManager", return_value=mock_manager): | ||
| result = runner.invoke( | ||
| app, | ||
| ["init", str(project_dir), "--ai", "claude", "--ignore-agent-tools", "--script", "sh"], | ||
| catch_exceptions=False, | ||
| ) | ||
|
|
||
| assert result.exit_code == 0, result.output | ||
| assert "Deprecation notice: git Extension" not in result.output | ||
|
|
||
| def test_deprecation_notice_not_shown_with_no_git_flag(self, tmp_path: Path): | ||
| """specify init does NOT show the deprecation notice when --no-git is passed.""" | ||
| from typer.testing import CliRunner | ||
| from specify_cli import app | ||
|
|
||
| project_dir = tmp_path / "test-project" | ||
| runner = CliRunner() | ||
|
|
||
| result = runner.invoke( | ||
| app, | ||
| ["init", str(project_dir), "--ai", "claude", "--ignore-agent-tools", "--no-git", "--script", "sh"], | ||
| catch_exceptions=False, | ||
| ) | ||
|
|
||
| assert result.exit_code == 0, result.output | ||
| assert "Deprecation notice: git Extension" not in result.output | ||
|
|
||
| def test_deprecation_notice_not_shown_when_no_install_notice(self, tmp_path: Path): | ||
| """specify init does NOT show the deprecation notice if extension has no install_notice.""" | ||
| from typer.testing import CliRunner | ||
| from unittest.mock import patch, MagicMock | ||
| from specify_cli import app | ||
|
|
||
| project_dir = tmp_path / "test-project" | ||
| runner = CliRunner() | ||
|
|
||
| mock_manifest = MagicMock() | ||
| mock_manifest.install_notice = None # No notice defined | ||
|
|
||
| mock_registry = MagicMock() | ||
| mock_registry.is_installed.return_value = False | ||
|
|
||
| mock_manager = MagicMock() | ||
| mock_manager.registry = mock_registry | ||
| mock_manager.install_from_directory.return_value = mock_manifest | ||
|
|
||
| with patch("specify_cli.extensions.ExtensionManager", return_value=mock_manager): | ||
| result = runner.invoke( | ||
| app, | ||
| ["init", str(project_dir), "--ai", "claude", "--ignore-agent-tools", "--script", "sh"], | ||
| catch_exceptions=False, | ||
| ) | ||
|
|
||
| assert result.exit_code == 0, result.output | ||
| assert "Deprecation notice: git Extension" not in result.output | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notice text says “starting with v1.0.0…”, but this file also sets the extension version to 1.0.0. That makes it ambiguous whether the message refers to spec-kit/specify-cli v1.0.0 or the git extension’s own version. Consider explicitly naming the product/version (e.g., “spec-kit v1.0.0” or “specify-cli v1.0.0”) to avoid user confusion.