Update with --force flag

This commit is contained in:
den (work)
2025-09-22 14:45:35 -07:00
parent 5d764e8364
commit 9319f0425e
4 changed files with 27 additions and 7 deletions

View File

@@ -1,10 +1,18 @@
# Changelog
<!-- markdownlint-disable MD024 -->
All notable changes to the Specify CLI will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.0.16] - 2025-09-22
### Added
- `--force` flag for `init` command to bypass confirmation when using `--here` in a non-empty directory and proceed with merging/overwriting files.
## [0.0.15] - 2025-09-21
### Added

View File

@@ -156,6 +156,7 @@ The `specify` command supports the following options:
| `--ignore-agent-tools` | Flag | Skip checks for AI agent tools like Claude Code |
| `--no-git` | Flag | Skip git repository initialization |
| `--here` | Flag | Initialize project in the current directory instead of creating a new one |
| `--force` | Flag | Force merge/overwrite when using `--here` in a non-empty directory (skip confirmation) |
| `--skip-tls` | Flag | Skip SSL/TLS verification (not recommended) |
| `--debug` | Flag | Enable detailed debug output for troubleshooting |
| `--github-token` | Option | GitHub token for API requests (or set GH_TOKEN/GITHUB_TOKEN env variable) |
@@ -181,6 +182,9 @@ specify init my-project --ai copilot --script ps
# Initialize in current directory
specify init --here --ai copilot
# Force merge into current (non-empty) directory without confirmation
specify init --here --force --ai copilot
# Skip git initialization
specify init my-project --ai gemini --no-git
@@ -287,6 +291,8 @@ Or initialize in the current directory:
```bash
specify init --here
# Skip confirmation when the directory already has files
specify init --here --force
```
![Specify CLI bootstrapping a new project in the terminal](./media/specify_cli.gif)
@@ -305,6 +311,8 @@ specify init <project_name> --ai windsurf
# Or in current directory:
specify init --here --ai claude
specify init --here --ai codex
# Force merge into a non-empty current directory
specify init --here --force --ai claude
```
The CLI will check if you have Claude Code, Gemini CLI, Cursor CLI, Qwen CLI, opencode, or Codex CLI installed. If you do not, or you prefer to get the templates without checking for the right tools, use `--ignore-agent-tools` with your command:

View File

@@ -1,6 +1,6 @@
[project]
name = "specify-cli"
version = "0.0.15"
version = "0.0.16"
description = "Specify CLI, part of GitHub Spec Kit. A tool to bootstrap your projects for Spec-Driven Development (SDD)."
requires-python = ">=3.11"
dependencies = [

View File

@@ -753,6 +753,7 @@ def init(
ignore_agent_tools: bool = typer.Option(False, "--ignore-agent-tools", help="Skip checks for AI 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)"),
skip_tls: bool = typer.Option(False, "--skip-tls", help="Skip SSL/TLS verification (not recommended)"),
debug: bool = typer.Option(False, "--debug", help="Show verbose diagnostic output for network and extraction failures"),
github_token: str = typer.Option(None, "--github-token", help="GitHub token to use for API requests (or set GH_TOKEN or GITHUB_TOKEN environment variable)"),
@@ -783,6 +784,7 @@ def init(
specify init --here --ai claude
specify init --here --ai codex
specify init --here
specify init --here --force # Skip confirmation when current directory not empty
"""
# Show banner first
show_banner()
@@ -806,7 +808,9 @@ def init(
if existing_items:
console.print(f"[yellow]Warning:[/yellow] Current directory is not empty ({len(existing_items)} items)")
console.print("[yellow]Template files will be merged with existing content and may overwrite existing files[/yellow]")
if force:
console.print("[cyan]--force supplied: skipping confirmation and proceeding with merge[/cyan]")
else:
# Ask for confirmation
response = typer.confirm("Do you want to continue?")
if not response: