Skip to content

feat: prompt confirmation before creating new owner directory#18

Open
puria wants to merge 1 commit into
mainfrom
feat/confirm-owner-dir-creation
Open

feat: prompt confirmation before creating new owner directory#18
puria wants to merge 1 commit into
mainfrom
feat/confirm-owner-dir-creation

Conversation

@puria

@puria puria commented Jul 5, 2026

Copy link
Copy Markdown
Owner

What

When gg <owner> resolves to an owner path that doesn't exist yet, prompt [Y/n] before creating it.

Why

Typos like gg cc instead of gg c silently create empty directories under ~/.gg/<host>/. This wastes disk and pollutes the checkout namespace.

How

  • New promptConfirm function checks if stdin is a terminal, prompts on stderr, reads one line
  • Auto-confirms in non-interactive environments (scripts, CI, piped stdin — backward compatible)
  • Only affects owner-path creation (gg <owner> with no /); repo clones, worktrees, PRs unchanged
  • Variable is overridable for testing

Behavior

$ gg newowner
Create directory /home/user/.gg/github.com/newowner? [Y/n] █
  • Enter / y / yes → creates directory, cds in
  • n / no → directory creation cancelled, stays put
  • Non-interactive → auto-confirms (same as before)

🤖 Generated with Claude Code

Prevents accidental empty directory creation from typos (e.g. `gg cc`
instead of `gg c`). Shows "[Y/n]" prompt on stderr when target owner
directory does not exist. Auto-confirms in non-interactive environments
(scripts, CI, piped stdin).

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant