@@ -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