Skip to content

feat(init)!: make git extension opt-in and remove --no-git at v0.10.0#2873

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/make-git-extension-opt-in
Draft

feat(init)!: make git extension opt-in and remove --no-git at v0.10.0#2873
Copilot wants to merge 4 commits into
mainfrom
copilot/make-git-extension-opt-in

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

Finalizes the git extension default change at v0.10.0: specify init no longer auto-installs the bundled git extension, and the deprecated --no-git flag is removed. Users who want the git extension must opt in via specify extension add git.

Core changes

  • src/specify_cli/commands/init.py
    • Remove --no-git parameter and its deprecation warning block
    • Remove git extension auto-installation (ExtensionManager.install_from_directory for git) from the init flow
    • Remove git_default_notice variable and the "Notice: Git Default Changing" panel
    • Git repository initialization (git init) still runs unconditionally when git is available and no repo exists — only the extension install is dropped
    • Tracker step relabeled from "Install git extension""Git repository setup"

Tests

  • TestGitExtensionAutoInstall → replaced with TestGitExtensionOptIn:
    • test_git_extension_not_auto_installed — extension dir absent after plain specify init
    • test_no_git_flag_is_rejected--no-git now exits non-zero (unknown option)
    • test_git_extension_commands_not_registered_by_default — no speckit-git-* skills after init
  • Removed --no-git from all other test invocations throughout tests/integrations/test_cli.py

Docs & changelog

  • docs/reference/core.md: removed --no-git row from options table and the pre-v0.10.0 NOTE; updated examples
  • docs/upgrade.md: updated Scenario 4 (no-git projects); removed the ## Using --no-git Flag section
  • docs/local-development.md: updated common-issues table
  • CHANGELOG.md: added ## [0.10.0] - TBD section documenting both breaking changes

Copilot AI requested review from Copilot and removed request for Copilot June 5, 2026 17:20
Copilot AI linked an issue Jun 5, 2026 that may be closed by this pull request
5 tasks
Copilot AI requested review from Copilot and removed request for Copilot June 5, 2026 17:29
Copilot AI changed the title [WIP] Finalize git extension as opt-in and remove --no-git flag feat(init)!: make git extension opt-in and remove --no-git at v0.10.0 Jun 5, 2026
Copilot finished work on behalf of mnriem June 5, 2026 17:31
Copilot AI requested a review from mnriem June 5, 2026 17:31
@mnriem mnriem requested a review from Copilot June 5, 2026 19:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR finalizes the v0.10.0 breaking change around Git behavior during specify init: the bundled git extension is no longer auto-installed, and the deprecated --no-git flag is removed, while git repository initialization (git init) still occurs when git is available and no repo exists.

Changes:

  • Removes --no-git from the init command and drops bundled git extension auto-installation from the init flow.
  • Updates integration tests to stop passing --no-git and adds new opt-in assertions around the git extension.
  • Updates docs/changelog to reflect the new “git extension is opt-in” behavior and the flag removal.
Show a summary per file
File Description
src/specify_cli/commands/init.py Removes the --no-git flag and bundled git extension auto-install; keeps git init when available.
tests/integrations/test_cli.py Removes --no-git usage and replaces auto-install tests with opt-in expectations.
docs/upgrade.md Updates upgrade guidance for projects previously relying on --no-git.
docs/reference/core.md Removes --no-git from specify init reference and updates notes/examples.
docs/local-development.md Updates troubleshooting guidance related to the git step.
CHANGELOG.md Adds a v0.10.0 entry documenting the breaking changes.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 5

Comment thread CHANGELOG.md Outdated

### Breaking Changes

- **Git extension is now opt-in**`specify init` no longer auto-installs the git extension. Use `specify extension add git` to install it, or pass `--extension git` during init.
Comment thread docs/upgrade.md Outdated
### Scenario 4: "I'm working on a project without Git"

If you initialized your project with `--no-git`, you can still upgrade:
If your project directory does not use Git, Spec Kit will automatically detect this and skip repository initialization. You can still upgrade normally:
Comment on lines +826 to +830
])
finally:
os.chdir(old_cwd)

normalized_output = _normalize_cli_output(result.output)
assert result.exit_code == 0, result.output
assert "--no-git" in normalized_output
assert "deprecated" in normalized_output
assert "0.10.0" in normalized_output
assert "specify extension" in normalized_output
assert "will be removed" in normalized_output
assert "git extension will no longer be enabled by default" in normalized_output
assert result.exit_code != 0, "--no-git should be rejected as an unknown option"
Comment thread tests/integrations/test_cli.py Outdated
Comment on lines +852 to +856
# Git extension skill commands should NOT be present
claude_skills = project / ".claude" / "skills"
assert claude_skills.exists(), "Claude skills directory was not created"
git_skills = [f for f in claude_skills.iterdir() if f.name.startswith("speckit-git-")]
assert len(git_skills) > 0, "no git extension commands registered"
if claude_skills.exists():
git_skills = [f for f in claude_skills.iterdir() if f.name.startswith("speckit-git-")]
assert len(git_skills) == 0, "git extension commands should not be registered by default"
Comment on lines 98 to 105
def init(
project_name: str = typer.Argument(None, help="Name for your new project directory (optional if using --here, or use '.' for current directory)"),
ai_assistant: str = typer.Option(None, "--ai", help=AI_ASSISTANT_HELP),
ai_commands_dir: str = typer.Option(None, "--ai-commands-dir", help="Directory for agent command files (required with --ai generic, e.g. .myagent/commands/)"),
script_type: str = typer.Option(None, "--script", help="Script type to use: sh or ps"),
ignore_agent_tools: bool = typer.Option(False, "--ignore-agent-tools", help="Skip checks for coding agent tools like Claude Code"),
no_git: bool = typer.Option(False, "--no-git", help="Skip git repository initialization"),
here: bool = typer.Option(False, "--here", help="Initialize project in the current directory instead of creating a new one"),
force: bool = typer.Option(False, "--force", help="Force merge/overwrite when using --here (skip confirmation)"),
- Remove --no-git parameter from specify init command
- Remove git extension auto-installation from init flow
- Git repository initialization (git init) still runs when git is available
- Remove --no-git from all test invocations across the test suite
- Update docs to reflect opt-in git extension behavior
- Replace TestGitExtensionAutoInstall with TestGitExtensionOptIn tests

BREAKING CHANGE: specify init no longer auto-installs the git extension.
Use `specify extension add git` to install it explicitly.
The --no-git flag has been removed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mnriem mnriem force-pushed the copilot/make-git-extension-opt-in branch from 558bfa9 to 90d1d69 Compare June 5, 2026 20:25
Git functionality is now entirely managed by the git extension.
Core scripts only handle directory-based feature creation and numbering.

- Remove has_git(), check_feature_branch(), git branch creation from core
- Simplify number detection to use only spec directory scanning
- Remove HAS_GIT output from get_feature_paths()
- Remove git remote fetching and branch querying
- Keep BRANCH_NAME output key for backward compatibility

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 5, 2026 23:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 36/36 changed files
  • Comments generated: 6

)
from .._console import StepTracker, console, select_with_arrows, show_banner
from .._utils import check_tool, init_git_repo, is_git_repo
from .._utils import check_tool
Comment on lines 292 to 298
for key, label in [
("chmod", "Ensure scripts executable"),
("constitution", "Constitution setup"),
("git", "Install git extension"),
("workflow", "Install bundled workflow"),
("agent-context", "Install agent-context extension"),
("final", "Finalize"),
]:
Comment on lines 351 to 352
ensure_constitution_from_template(project_path, tracker=tracker)

Comment thread scripts/bash/common.sh Outdated
Comment on lines 50 to 53
local repo_root=$(get_repo_root)
if has_git; then
git -C "$repo_root" rev-parse --abbrev-ref HEAD
return
fi

# For non-git repos, try to find the latest feature directory
# Fall back to the latest feature directory
local specs_dir="$repo_root/specs"
Comment thread scripts/powershell/common.ps1 Outdated
Comment on lines 47 to 50
$repoRoot = Get-RepoRoot
if (Test-HasGit) {
try {
$result = git -C $repoRoot rev-parse --abbrev-ref HEAD 2>$null
if ($LASTEXITCODE -eq 0) {
return $result
}
} catch {
# Git command failed
}
}

# For non-git repos, try to find the latest feature directory
# Fall back to the latest feature directory
$specsDir = Join-Path $repoRoot "specs"
Comment on lines 743 to +747
assert result.exit_code == 0, f"init failed: {result.output}"

# Check that the tracker didn't report a git error
assert "install failed" not in result.output, f"git extension install failed: {result.output}"

# Git extension files should be installed
ext_dir = project / ".specify" / "extensions" / "git"
assert ext_dir.exists(), "git extension directory not installed"
assert (ext_dir / "extension.yml").exists()
assert (ext_dir / "scripts" / "bash" / "create-new-feature.sh").exists()
assert (ext_dir / "scripts" / "bash" / "initialize-repo.sh").exists()

# Hooks should be registered
extensions_yml = project / ".specify" / "extensions.yml"
assert extensions_yml.exists(), "extensions.yml not created"
hooks_data = yaml.safe_load(extensions_yml.read_text(encoding="utf-8"))
assert "hooks" in hooks_data
assert "before_specify" in hooks_data["hooks"]
assert "before_constitution" in hooks_data["hooks"]

def test_no_git_skips_extension(self, tmp_path):
"""With --no-git, the git extension is NOT installed."""
from typer.testing import CliRunner
from specify_cli import app

project = tmp_path / "no-git"
project.mkdir()
old_cwd = os.getcwd()
try:
os.chdir(project)
runner = CliRunner()
result = runner.invoke(app, [
"init", "--here", "--integration", "claude", "--script", "sh",
"--no-git", "--ignore-agent-tools",
], catch_exceptions=False)
finally:
os.chdir(old_cwd)

assert result.exit_code == 0, f"init failed: {result.output}"

# Git extension should NOT be installed
# Git extension directory should NOT be present after init
ext_dir = project / ".specify" / "extensions" / "git"
assert not ext_dir.exists(), "git extension should not be installed with --no-git"
assert not ext_dir.exists(), "git extension should not be auto-installed"
mnriem and others added 2 commits June 5, 2026 19:22
- Remove is_git_repo() and init_git_repo() dead code from _utils.py
- Remove --branch-numbering from init command
- Remove git from 'specify check' (now extension-only)
- Update docs: git is optional prerequisite, check command description
- Fix tests to reflect no-git-in-core reality (fallback to main)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… core

Core scripts now resolve feature context exclusively from:
1. SPECIFY_FEATURE env var (set by git extension)
2. .specify/feature.json (persisted by specify command)

Removed find_feature_dir_by_prefix() and directory scanning heuristics —
these are the git extension's responsibility. Scripts error clearly when
no feature context is available.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 6, 2026 01:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 44/44 changed files
  • Comments generated: 8

Comment thread scripts/bash/common.sh
Comment on lines +131 to 132
echo "ERROR: Feature directory not found. Set SPECIFY_FEATURE or ensure .specify/feature.json contains feature_directory." >&2
return 1
Comment thread scripts/bash/common.sh
Comment on lines +135 to 136
echo "ERROR: Feature directory not found. Set SPECIFY_FEATURE or run the specify command to create .specify/feature.json." >&2
return 1
Comment on lines +151 to +152
[Console]::Error.WriteLine("ERROR: Feature directory not found. Set SPECIFY_FEATURE or ensure .specify/feature.json contains feature_directory.")
exit 1
Comment on lines +155 to +156
[Console]::Error.WriteLine("ERROR: Feature directory not found. Set SPECIFY_FEATURE or run the specify command to create .specify/feature.json.")
exit 1
Comment thread docs/upgrade.md
If you use `--no-git`, you'll need to manage feature directories manually:

**Set the `SPECIFY_FEATURE` environment variable** before using planning commands:
Projects that do not use Git can still work with Spec Kit by setting `SPECIFY_FEATURE` manually before planning commands:
Comment thread docs/upgrade.md
Comment on lines 285 to 288
export SPECIFY_FEATURE="001-my-feature"

# PowerShell
$env:SPECIFY_FEATURE = "001-my-feature"
Comment thread docs/local-development.md
| `ModuleNotFoundError: typer` | Run `uv pip install -e .` |
| Scripts not executable (Linux) | Re-run init or `chmod +x scripts/*.sh` |
| Git step skipped | You passed `--no-git` or Git not installed |
| Git step skipped | Git not installed on your system |
Comment on lines 91 to +97
This command will:
1. Check that required tools are installed (git is optional)
1. Check that required tools are installed
2. Let you choose your coding agent integration, or default to Copilot
in non-interactive sessions
3. Install bundled Spec Kit templates, scripts, workflow, and shared
project infrastructure
4. Initialize a fresh git repository (if not --no-git and no existing repo)
5. Set up coding agent integration commands and optional presets
4. Set up coding agent integration commands and optional presets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make git extension opt-in and remove --no-git at 0.10.0

3 participants