Skip to content

Commit 1c7350d

Browse files
author
Aaron Sun
committed
Added warning message about git extension no longer being enabled by default
1 parent cdbea09 commit 1c7350d

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

src/specify_cli/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,7 @@ def init(
12111211

12121212
ensure_constitution_from_template(project_path, tracker=tracker)
12131213

1214+
_git_ext_freshly_installed = False
12141215
if not no_git:
12151216
tracker.start("git")
12161217
git_messages = []
@@ -1245,6 +1246,7 @@ def init(
12451246
bundled_path, get_speckit_version()
12461247
)
12471248
git_messages.append("extension installed")
1249+
_git_ext_freshly_installed = True
12481250
else:
12491251
git_has_error = True
12501252
git_messages.append("bundled extension not found")
@@ -1356,6 +1358,21 @@ def init(
13561358
console.print(tracker.render())
13571359
console.print("\n[bold green]Project ready.[/bold green]")
13581360

1361+
if _git_ext_freshly_installed:
1362+
console.print()
1363+
console.print(
1364+
Panel(
1365+
"The [bold]git[/bold] extension is currently enabled by default, "
1366+
"but starting with [bold]v1.0.0[/bold] it will require explicit opt-in.\n\n"
1367+
"To opt in after v1.0.0:\n"
1368+
" • [cyan]specify init --extension git[/cyan]\n"
1369+
" • [cyan]specify extension add git[/cyan] (post-init)",
1370+
title="[yellow]⚠ Upcoming Change: git Extension[/yellow]",
1371+
border_style="yellow",
1372+
padding=(1, 2),
1373+
)
1374+
)
1375+
13591376
# Agent folder security notice
13601377
agent_config = AGENT_CONFIG.get(selected_ai)
13611378
if agent_config:

tests/extensions/git/test_git_extension.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,3 +587,79 @@ def test_check_feature_branch_rejects_malformed_timestamp(self, tmp_path: Path):
587587
capture_output=True, text=True,
588588
)
589589
assert result.returncode != 0
590+
591+
592+
# ── Deprecation Notice Tests ──────────────────────────────────────────────────
593+
594+
595+
class TestGitExtDeprecationNotice:
596+
"""Tests for the v1.0.0 deprecation notice shown during specify init."""
597+
598+
def test_deprecation_notice_shown_on_fresh_install(self, tmp_path: Path):
599+
"""specify init shows the git extension deprecation notice on first install."""
600+
from typer.testing import CliRunner
601+
from unittest.mock import patch, MagicMock
602+
from specify_cli import app
603+
604+
project_dir = tmp_path / "test-project"
605+
runner = CliRunner()
606+
607+
mock_registry = MagicMock()
608+
mock_registry.is_installed.return_value = False
609+
610+
mock_manager = MagicMock()
611+
mock_manager.registry = mock_registry
612+
613+
with patch("specify_cli.extensions.ExtensionManager", return_value=mock_manager):
614+
result = runner.invoke(
615+
app,
616+
["init", str(project_dir), "--ai", "claude", "--ignore-agent-tools", "--script", "sh"],
617+
catch_exceptions=False,
618+
)
619+
620+
assert result.exit_code == 0, result.output
621+
assert "Upcoming Change: git Extension" in result.output
622+
assert "v1.0.0" in result.output
623+
assert "specify init --extension git" in result.output
624+
625+
def test_deprecation_notice_not_shown_when_already_installed(self, tmp_path: Path):
626+
"""specify init does NOT show the deprecation notice when git extension is already installed."""
627+
from typer.testing import CliRunner
628+
from unittest.mock import patch, MagicMock
629+
from specify_cli import app
630+
631+
project_dir = tmp_path / "test-project"
632+
runner = CliRunner()
633+
634+
mock_registry = MagicMock()
635+
mock_registry.is_installed.return_value = True
636+
637+
mock_manager = MagicMock()
638+
mock_manager.registry = mock_registry
639+
640+
with patch("specify_cli.extensions.ExtensionManager", return_value=mock_manager):
641+
result = runner.invoke(
642+
app,
643+
["init", str(project_dir), "--ai", "claude", "--ignore-agent-tools", "--script", "sh"],
644+
catch_exceptions=False,
645+
)
646+
647+
assert result.exit_code == 0, result.output
648+
assert "Upcoming Change: git Extension" not in result.output
649+
650+
def test_deprecation_notice_not_shown_with_no_git_flag(self, tmp_path: Path):
651+
"""specify init does NOT show the deprecation notice when --no-git is passed."""
652+
from typer.testing import CliRunner
653+
from specify_cli import app
654+
655+
project_dir = tmp_path / "test-project"
656+
runner = CliRunner()
657+
658+
result = runner.invoke(
659+
app,
660+
["init", str(project_dir), "--ai", "claude", "--ignore-agent-tools", "--no-git", "--script", "sh"],
661+
catch_exceptions=False,
662+
)
663+
664+
assert result.exit_code == 0, result.output
665+
assert "Upcoming Change: git Extension" not in result.output

0 commit comments

Comments
 (0)