Skip to content

Commit 822a0e5

Browse files
authored
feat: emit init-time notice for git extension default change (#2165) (#2432)
Add a non-blocking Panel notice during `specify init` when the git extension auto-enables, informing users that starting in v0.10.0 this will require explicit opt-in via `specify extension add git`. - src/specify_cli/__init__.py: track successful git extension install and display yellow "Notice: Git Default Changing" panel - tests/integrations/test_cli.py: integration test validating notice content (v0.10.0 timeline, opt-in messaging, migration command) - docs/reference/core.md: user-facing NOTE about the upcoming change Closes #2165
1 parent 6546026 commit 822a0e5

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

docs/reference/core.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ specify init [<project_name>]
2222

2323
Creates a new Spec Kit project with the necessary directory structure, templates, scripts, and AI coding agent integration files.
2424

25+
> [!NOTE]
26+
> The git extension is currently enabled by default during `specify init`.
27+
> Starting in `v0.10.0`, it will require explicit opt-in. To add it after init, run `specify extension add git`.
28+
2529
Use `<project_name>` to create a new directory, or `--here` (or `.`) to initialize in the current directory. If the directory already has files, use `--force` to merge without confirmation.
2630

2731
### Examples

src/specify_cli/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,8 @@ def init(
12641264
]:
12651265
tracker.add(key, label)
12661266

1267+
git_default_notice = False
1268+
12671269
with Live(tracker.render(), console=console, refresh_per_second=8, transient=True) as live:
12681270
tracker.attach_refresh(lambda: live.update(tracker.render()))
12691271
try:
@@ -1360,6 +1362,7 @@ def init(
13601362
manager.install_from_directory(
13611363
bundled_path, get_speckit_version()
13621364
)
1365+
git_default_notice = True
13631366
git_messages.append("extension installed")
13641367
else:
13651368
git_has_error = True
@@ -1530,6 +1533,18 @@ def init(
15301533
console.print()
15311534
console.print(deprecation_notice)
15321535

1536+
if git_default_notice:
1537+
default_change_notice = Panel(
1538+
"The git extension is currently enabled by default during [bold]specify init[/bold].\n"
1539+
"Starting in [bold]v0.10.0[/bold], this will require explicit opt-in.\n"
1540+
"Use [bold]specify extension add git[/bold] after init when needed.",
1541+
title="[yellow]Notice: Git Default Changing[/yellow]",
1542+
border_style="yellow",
1543+
padding=(1, 2),
1544+
)
1545+
console.print()
1546+
console.print(default_change_notice)
1547+
15331548
steps_lines = []
15341549
if not here:
15351550
steps_lines.append(f"1. Go to the project folder: [cyan]cd {project_name}[/cyan]")

tests/integrations/test_cli.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,32 @@ def test_no_git_emits_deprecation_warning(self, tmp_path):
785785
assert "will be removed" in normalized_output
786786
assert "git extension will no longer be enabled by default" in normalized_output
787787

788+
def test_default_git_auto_enable_emits_notice(self, tmp_path):
789+
"""Default git auto-enable emits notice about the v0.10.0 opt-in change."""
790+
from typer.testing import CliRunner
791+
from specify_cli import app
792+
793+
project = tmp_path / "git-default-notice"
794+
project.mkdir()
795+
old_cwd = os.getcwd()
796+
try:
797+
os.chdir(project)
798+
runner = CliRunner()
799+
result = runner.invoke(app, [
800+
"init", "--here", "--ai", "claude", "--script", "sh",
801+
"--ignore-agent-tools",
802+
], catch_exceptions=False)
803+
finally:
804+
os.chdir(old_cwd)
805+
806+
normalized_output = _normalize_cli_output(result.output)
807+
assert result.exit_code == 0, result.output
808+
# Check for key message components (notice may have box-drawing chars)
809+
assert "git extension is currently enabled by default" in normalized_output
810+
assert "v0.10.0" in normalized_output
811+
assert "explicit opt-in" in normalized_output
812+
assert "specify extension add git" in normalized_output
813+
788814
def test_git_extension_commands_registered(self, tmp_path):
789815
"""Git extension commands are registered with the agent during init."""
790816
from typer.testing import CliRunner

0 commit comments

Comments
 (0)