Update with --force flag
This commit is contained in:
@@ -1,10 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
<!-- markdownlint-disable MD024 -->
|
||||||
|
|
||||||
All notable changes to the Specify CLI will be documented in this file.
|
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/),
|
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).
|
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
|
## [0.0.15] - 2025-09-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ The `specify` command supports the following options:
|
|||||||
| `--ignore-agent-tools` | Flag | Skip checks for AI agent tools like Claude Code |
|
| `--ignore-agent-tools` | Flag | Skip checks for AI agent tools like Claude Code |
|
||||||
| `--no-git` | Flag | Skip git repository initialization |
|
| `--no-git` | Flag | Skip git repository initialization |
|
||||||
| `--here` | Flag | Initialize project in the current directory instead of creating a new one |
|
| `--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) |
|
| `--skip-tls` | Flag | Skip SSL/TLS verification (not recommended) |
|
||||||
| `--debug` | Flag | Enable detailed debug output for troubleshooting |
|
| `--debug` | Flag | Enable detailed debug output for troubleshooting |
|
||||||
| `--github-token` | Option | GitHub token for API requests (or set GH_TOKEN/GITHUB_TOKEN env variable) |
|
| `--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
|
# Initialize in current directory
|
||||||
specify init --here --ai copilot
|
specify init --here --ai copilot
|
||||||
|
|
||||||
|
# Force merge into current (non-empty) directory without confirmation
|
||||||
|
specify init --here --force --ai copilot
|
||||||
|
|
||||||
# Skip git initialization
|
# Skip git initialization
|
||||||
specify init my-project --ai gemini --no-git
|
specify init my-project --ai gemini --no-git
|
||||||
|
|
||||||
@@ -287,6 +291,8 @@ Or initialize in the current directory:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
specify init --here
|
specify init --here
|
||||||
|
# Skip confirmation when the directory already has files
|
||||||
|
specify init --here --force
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
@@ -305,6 +311,8 @@ specify init <project_name> --ai windsurf
|
|||||||
# Or in current directory:
|
# Or in current directory:
|
||||||
specify init --here --ai claude
|
specify init --here --ai claude
|
||||||
specify init --here --ai codex
|
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:
|
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:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "specify-cli"
|
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)."
|
description = "Specify CLI, part of GitHub Spec Kit. A tool to bootstrap your projects for Spec-Driven Development (SDD)."
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -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"),
|
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"),
|
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"),
|
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)"),
|
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"),
|
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)"),
|
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 claude
|
||||||
specify init --here --ai codex
|
specify init --here --ai codex
|
||||||
specify init --here
|
specify init --here
|
||||||
|
specify init --here --force # Skip confirmation when current directory not empty
|
||||||
"""
|
"""
|
||||||
# Show banner first
|
# Show banner first
|
||||||
show_banner()
|
show_banner()
|
||||||
@@ -806,12 +808,14 @@ def init(
|
|||||||
if existing_items:
|
if existing_items:
|
||||||
console.print(f"[yellow]Warning:[/yellow] Current directory is not empty ({len(existing_items)} 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]")
|
console.print("[yellow]Template files will be merged with existing content and may overwrite existing files[/yellow]")
|
||||||
|
if force:
|
||||||
# Ask for confirmation
|
console.print("[cyan]--force supplied: skipping confirmation and proceeding with merge[/cyan]")
|
||||||
response = typer.confirm("Do you want to continue?")
|
else:
|
||||||
if not response:
|
# Ask for confirmation
|
||||||
console.print("[yellow]Operation cancelled[/yellow]")
|
response = typer.confirm("Do you want to continue?")
|
||||||
raise typer.Exit(0)
|
if not response:
|
||||||
|
console.print("[yellow]Operation cancelled[/yellow]")
|
||||||
|
raise typer.Exit(0)
|
||||||
else:
|
else:
|
||||||
project_path = Path(project_name).resolve()
|
project_path = Path(project_name).resolve()
|
||||||
# Check if project directory already exists
|
# Check if project directory already exists
|
||||||
|
|||||||
Reference in New Issue
Block a user