Skip to content

Commit 9ff9c9f

Browse files
authored
Merge pull request #570 from brunoborges/specify_init_period
feat: support 'specify init .' for current directory initialization
2 parents 45f04ab + 8bbacd4 commit 9ff9c9f

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ All notable changes to the Specify CLI will be documented in this file.
77
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
99

10+
## [LATEST_VERSION] - RELEASE_DATE
11+
12+
### Added
13+
14+
- Support for using `.` as a shorthand for current directory in `specify init .` command, equivalent to `--here` flag but more intuitive for users
15+
1016
## [0.0.17] - 2025-09-22
1117

1218
### Added

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ The `specify` command supports the following options:
150150

151151
| Argument/Option | Type | Description |
152152
|------------------------|----------|------------------------------------------------------------------------------|
153-
| `<project-name>` | Argument | Name for your new project directory (optional if using `--here`) |
153+
| `<project-name>` | Argument | Name for your new project directory (optional if using `--here`, or use `.` for current directory) |
154154
| `--ai` | Option | AI assistant to use: `claude`, `gemini`, `copilot`, `cursor`, `qwen`, `opencode`, `codex`, `windsurf`, `kilocode`, `auggie`, or `roo` |
155155
| `--script` | Option | Script variant to use: `sh` (bash/zsh) or `ps` (PowerShell) |
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) |
159+
| `--force` | Flag | Force merge/overwrite when initializing in current directory (skip confirmation) |
160160
| `--skip-tls` | Flag | Skip SSL/TLS verification (not recommended) |
161161
| `--debug` | Flag | Enable detailed debug output for troubleshooting |
162162
| `--github-token` | Option | GitHub token for API requests (or set GH_TOKEN/GITHUB_TOKEN env variable) |
@@ -180,9 +180,13 @@ specify init my-project --ai windsurf
180180
specify init my-project --ai copilot --script ps
181181

182182
# Initialize in current directory
183+
specify init . --ai copilot
184+
# or use the --here flag
183185
specify init --here --ai copilot
184186

185187
# Force merge into current (non-empty) directory without confirmation
188+
specify init . --force --ai copilot
189+
# or
186190
specify init --here --force --ai copilot
187191

188192
# Skip git initialization
@@ -292,8 +296,12 @@ specify init <project_name>
292296
Or initialize in the current directory:
293297

294298
```bash
299+
specify init .
300+
# or use the --here flag
295301
specify init --here
296302
# Skip confirmation when the directory already has files
303+
specify init . --force
304+
# or
297305
specify init --here --force
298306
```
299307

@@ -311,9 +319,14 @@ specify init <project_name> --ai opencode
311319
specify init <project_name> --ai codex
312320
specify init <project_name> --ai windsurf
313321
# Or in current directory:
322+
specify init . --ai claude
323+
specify init . --ai codex
324+
# or use --here flag
314325
specify init --here --ai claude
315326
specify init --here --ai codex
316327
# Force merge into a non-empty current directory
328+
specify init . --force --ai claude
329+
# or
317330
specify init --here --force --ai claude
318331
```
319332

docs/installation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ uvx --from git+https://github.com/github/spec-kit.git specify init <PROJECT_NAME
2121
Or initialize in the current directory:
2222

2323
```bash
24+
uvx --from git+https://github.com/github/spec-kit.git specify init .
25+
# or use the --here flag
2426
uvx --from git+https://github.com/github/spec-kit.git specify init --here
2527
```
2628

src/specify_cli/__init__.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
1515
Usage:
1616
uvx specify-cli.py init <project-name>
17+
uvx specify-cli.py init .
1718
uvx specify-cli.py init --here
1819
1920
Or install globally:
2021
uv tool install --from specify-cli.py specify-cli
2122
specify init <project-name>
23+
specify init .
2224
specify init --here
2325
"""
2426

@@ -747,7 +749,7 @@ def ensure_executable_scripts(project_path: Path, tracker: StepTracker | None =
747749

748750
@app.command()
749751
def init(
750-
project_name: str = typer.Argument(None, help="Name for your new project directory (optional if using --here)"),
752+
project_name: str = typer.Argument(None, help="Name for your new project directory (optional if using --here, or use '.' for current directory)"),
751753
ai_assistant: str = typer.Option(None, "--ai", help="AI assistant to use: claude, gemini, copilot, cursor, qwen, opencode, codex, windsurf, kilocode, or auggie"),
752754
script_type: str = typer.Option(None, "--script", help="Script type to use: sh or ps"),
753755
ignore_agent_tools: bool = typer.Option(False, "--ignore-agent-tools", help="Skip checks for AI agent tools like Claude Code"),
@@ -781,21 +783,28 @@ def init(
781783
specify init my-project --ai windsurf
782784
specify init my-project --ai auggie
783785
specify init --ignore-agent-tools my-project
784-
specify init --here --ai claude
786+
specify init . --ai claude # Initialize in current directory
787+
specify init . # Initialize in current directory (interactive AI selection)
788+
specify init --here --ai claude # Alternative syntax for current directory
785789
specify init --here --ai codex
786790
specify init --here
787791
specify init --here --force # Skip confirmation when current directory not empty
788792
"""
789793
# Show banner first
790794
show_banner()
791795

796+
# Handle '.' as shorthand for current directory (equivalent to --here)
797+
if project_name == ".":
798+
here = True
799+
project_name = None # Clear project_name to use existing validation logic
800+
792801
# Validate arguments
793802
if here and project_name:
794803
console.print("[red]Error:[/red] Cannot specify both project name and --here flag")
795804
raise typer.Exit(1)
796805

797806
if not here and not project_name:
798-
console.print("[red]Error:[/red] Must specify either a project name or use --here flag")
807+
console.print("[red]Error:[/red] Must specify either a project name, use '.' for current directory, or use --here flag")
799808
raise typer.Exit(1)
800809

801810
# Determine project directory

0 commit comments

Comments
 (0)