Skip to content

Auto-use current directory instead of prompting for repository path #13

@parshvadaftari

Description

@parshvadaftari

Problem

When running gitclaw without --dir or --prompt, the CLI blocks with an interactive prompt:

? Repository path (. for current dir):

Modern CLI tools like Claude Code automatically use the current working directory without asking. Users must either type . + Enter every time, or always pass --dir ..

Expected Behavior

gitclaw should automatically use process.cwd() as the agent directory when launched without --dir. The --dir flag remains as an optional override.

Current Code

src/index.ts:347-353:

} else if (dir === process.cwd() && !prompt) {
    const answer = await askQuestion(green("? ") + bold("Repository path") + dim(" (. for current dir)") + green(": "));                                                        
    if (answer) {                                                                                                                                                               
        dir = resolve(answer === "." ? process.cwd() : answer);                                                                                                                 
    }                                                                                                                                                                           
}                                                                                                                                                                             

parseArgs() already defaults dir to process.cwd() (line 48), and ensureRepo() already scaffolds agent.yaml if missing. So removing the interactive prompt should work
seamlessly.

Suggested Fix

Remove the interactive prompt branch. The flow becomes:

  1. User runs gitclaw in any directory
  2. dir defaults to process.cwd()
  3. ensureRepo() scaffolds agent.yaml if missing
  4. Agent starts immediately

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions