Skip to content

Commit 9319f04

Browse files
committed
Update with --force flag
1 parent 5d764e8 commit 9319f04

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Changelog
22

3+
<!-- markdownlint-disable MD024 -->
4+
35
All notable changes to the Specify CLI will be documented in this file.
46

57
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
68
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
79

10+
## [0.0.16] - 2025-09-22
11+
12+
### Added
13+
14+
- `--force` flag for `init` command to bypass confirmation when using `--here` in a non-empty directory and proceed with merging/overwriting files.
15+
816
## [0.0.15] - 2025-09-21
917

1018
### Added

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ The `specify` command supports the following options:
156156
| `--ignore-agent-tools` | Flag | Skip checks for AI agent tools like Claude Code |
157157
| `--no-git` | Flag | Skip git repository initialization |
158158
| `--here` | Flag | Initialize project in the current directory instead of creating a new one |
159+
| `--force` | Flag | Force merge/overwrite when using `--here` in a non-empty directory (skip confirmation) |
159160
| `--skip-tls` | Flag | Skip SSL/TLS verification (not recommended) |
160161
| `--debug` | Flag | Enable detailed debug output for troubleshooting |
161162
| `--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
181182
# Initialize in current directory
182183
specify init --here --ai copilot
183184

185+
# Force merge into current (non-empty) directory without confirmation
186+
specify init --here --force --ai copilot
187+
184188
# Skip git initialization
185189
specify init my-project --ai gemini --no-git
186190

@@ -287,6 +291,8 @@ Or initialize in the current directory:
287291

288292
```bash
289293
specify init --here
294+
# Skip confirmation when the directory already has files
295+
specify init --here --force
290296
```
291297

292298
![Specify CLI bootstrapping a new project in the terminal](./media/specify_cli.gif)
@@ -305,6 +311,8 @@ specify init <project_name> --ai windsurf
305311
# Or in current directory:
306312
specify init --here --ai claude
307313
specify init --here --ai codex
314+
# Force merge into a non-empty current directory
315+
specify init --here --force --ai claude
308316
```
309317

310318
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:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "specify-cli"
3-
version = "0.0.15"
3+
version = "0.0.16"
44
description = "Specify CLI, part of GitHub Spec Kit. A tool to bootstrap your projects for Spec-Driven Development (SDD)."
55
requires-python = ">=3.11"
66
dependencies = [

src/specify_cli/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ def init(
753753
ignore_agent_tools: bool = typer.Option(False, "--ignore-agent-tools", help="Skip checks for AI agent tools like Claude Code"),
754754
no_git: bool = typer.Option(False, "--no-git", help="Skip git repository initialization"),
755755
here: bool = typer.Option(False, "--here", help="Initialize project in the current directory instead of creating a new one"),
756+
force: bool = typer.Option(False, "--force", help="Force merge/overwrite when using --here (skip confirmation)"),
756757
skip_tls: bool = typer.Option(False, "--skip-tls", help="Skip SSL/TLS verification (not recommended)"),
757758
debug: bool = typer.Option(False, "--debug", help="Show verbose diagnostic output for network and extraction failures"),
758759
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(
783784
specify init --here --ai claude
784785
specify init --here --ai codex
785786
specify init --here
787+
specify init --here --force # Skip confirmation when current directory not empty
786788
"""
787789
# Show banner first
788790
show_banner()
@@ -806,12 +808,14 @@ def init(
806808
if existing_items:
807809
console.print(f"[yellow]Warning:[/yellow] Current directory is not empty ({len(existing_items)} items)")
808810
console.print("[yellow]Template files will be merged with existing content and may overwrite existing files[/yellow]")
809-
810-
# Ask for confirmation
811-
response = typer.confirm("Do you want to continue?")
812-
if not response:
813-
console.print("[yellow]Operation cancelled[/yellow]")
814-
raise typer.Exit(0)
811+
if force:
812+
console.print("[cyan]--force supplied: skipping confirmation and proceeding with merge[/cyan]")
813+
else:
814+
# Ask for confirmation
815+
response = typer.confirm("Do you want to continue?")
816+
if not response:
817+
console.print("[yellow]Operation cancelled[/yellow]")
818+
raise typer.Exit(0)
815819
else:
816820
project_path = Path(project_name).resolve()
817821
# Check if project directory already exists

0 commit comments

Comments
 (0)