Skip to content

fix(project create): never block on a name prompt — auto-generate a friendly name#46

Merged
tonychang04 merged 1 commit into
mainfrom
fix/project-create-no-prompt
Jul 15, 2026
Merged

fix(project create): never block on a name prompt — auto-generate a friendly name#46
tonychang04 merged 1 commit into
mainfrom
fix/project-create-no-prompt

Conversation

@tonychang04

@tonychang04 tonychang04 commented Jul 15, 2026

Copy link
Copy Markdown
Member

Problem

insta project create (no arg) dropped into an interactive prompt:

project name [projects]:      ← hangs, waiting for input

So curl … | sh && insta project create — and any run from ~/projects — just hangs, with a nonsense default (the cwd basename projects). That's exactly the 'why doesn't it just work like Railway' friction.

Fix

Name resolution never prompts:

  • explicit arg wins (slugified)
  • else the cwd basename when it's a real project-dir name (~/my-appmy-app)
  • else an auto-generated friendly name (Vercel/Render style, e.g. swift-meadow-482) for generic dirs (projects, tmp, ~, src, code, …) and the home dir itself

Removed the readline prompt path entirely — stdin is no longer touched. Pass a name or rename later for something specific.

Verification

  • 77/77 tests green, tsc clean. New tests cover: generic dir → generated name, real dir → basename, and a regression test that resolution never depends on stdin/TTY.
  • Built the binary and ran project create </dev/null — resolves a name instantly, no hang.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GMbAe5K1RfwaAcge5inX7P


Summary by cubic

Make insta project create non-blocking by removing the interactive name prompt. When no name is passed, we use the cwd basename if it’s meaningful; otherwise we auto-generate a friendly name like swift-meadow-482.

  • Bug Fixes
    • Never reads stdin or requires a TTY, so it works in curl | sh and from dirs like ~/projects without hanging.
    • Name resolution: explicit arg wins; else use cwd basename unless it’s generic or your home; else generate adjective-noun-###.
    • Added tests for real vs. generic dirs, deterministic generator shape, and the no-stdin regression.

Written for commit f3d2ca8. Summary will update on new commits.

Review in cubic

…n the dir name is useless

`insta project create` (no arg) dropped into an interactive `project name [projects]:`
prompt — so `curl … | sh && insta project create` and any run from ~/projects just
HANGS, with a nonsense default (the cwd basename 'projects'). Railway-grade onboarding
shouldn't stall on input.

Now name resolution never prompts:
- explicit arg wins (slugified)
- else the cwd basename IF it's a real project-dir name (e.g. ~/my-app → 'my-app')
- else an auto-generated friendly name (Vercel/Render style, e.g. 'swift-meadow-482')
  for generic dirs (projects, tmp, ~, src, code, …) and the home dir itself

Removed the readline prompt path entirely (stdin no longer touched). Pass a name or
rename later if you want something specific. 77/77 tests green, tsc clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMbAe5K1RfwaAcge5inX7P
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Removes the interactive name prompt from insta project create and replaces it with deterministic name resolution (explicit arg → cwd basename for real dirs → auto-generated friendly name), so the paste-and-run one-liner never hangs on stdin.

Requirements context

No matching spec/plan found — this repo has no docs/superpowers/ or docs/specs/ directory. Assessed against the PR description, the linked "why doesn't it just work like Railway" friction, and the repo-local developing-insta-cli skill. Test suite verified locally: 77/77 vitest green, matching the PR's claim.

Findings

Critical

(none)

Suggestion

  • Software engineering — untested branch (src/commands/project.ts:57-58). The new base !== home guard is the one piece of resolution logic with no direct test. All added tests exercise the generic-dir, real-dir, and no-prompt paths, but none run from a cwd whose basename equals the home dir basename (e.g. resolveProjectName(undefined, '/Users/gary', ...) where homedir() is /Users/gary). A one-line test would lock in the "don't name the project after the user's home dir" behavior against future edits to slugifyName/homedir handling.
  • Functionality — no collision handling on generated names (src/commands/project.ts:59, 62-66). generateProjectName picks from ~18×18×900 combos with no check against existing project names, so POST /orgs/:id/projects can still fail on a duplicate. This is not a regression (the old basename path had the same exposure) and the API error will surface, so it's non-blocking — but a create flow that "just works" would ideally retry once on a name conflict. Worth a follow-up rather than blocking here.

Information

  • Functionality — empty-slug arg is pre-existing (src/commands/project.ts:55). if (nameArg) return slugifyName(nameArg) can return '' for an all-symbol arg (e.g. insta project create "!!!"), sending an empty name to the API. This behavior is unchanged from main (the old code had the same line, and the || 'app' fallback only ever applied to the dir path), so it's out of scope for this PR — flagging only for awareness.
  • Software engineering — duplicate entry in NOUN (src/commands/project.ts:17-18). 'harbor' appears twice, slightly skewing name distribution and reducing effective variety. Harmless; drop one for tidiness.
  • Scope/docs. README (README.md:47,63) documents project create without referencing the old prompt, so no doc change is required. The developing-insta-cli skill notes command/flag changes must be mirrored in the skills/ submodule's cli-reference.md; this is a behavior change with no command/flag surface change, so that mirror requirement doesn't apply here.

Security

No security-relevant concerns. The change reduces attack surface by removing stdin/readline reading; the resolved name flows to the platform API as a JSON body field (parameterized server-side), nothing reaches shell/SQL, no secrets or PII are logged, no auth/authorization paths are touched, and no dependencies are added.

Performance

No concerns. Resolution is pure string work with no added I/O or loops; removing the readline prompt eliminates a blocking stdin read from the create path.

Verdict

approved (informational — human approval is still required via the separate approve flow). Clean, well-scoped fix with good test coverage and a solid DI pattern (generate/rand injected for determinism). The two Suggestion items are non-blocking polish. Zero Critical findings.

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review — fix(project create): never block on a name prompt

Summary: Replaces the interactive name prompt with deterministic, non-blocking name resolution (explicit arg → real cwd basename → auto-generated friendly name); the change is focused, well-tested, and I found no blocking issues.

Requirements context

No matching spec/plan found — this repo has no docs/superpowers/ or docs/specs/ directory (verified: docs/ is absent entirely). Assessed against the PR description, the linked "why doesn't it just work like Railway" intent, and repo conventions in .claude/skills/developing-insta-cli/SKILL.md. The project create [name] command/flag surface is unchanged, so the SKILL's "mirror command changes in skills/insta/cli-reference.md" rule does not apply here.

Findings

Critical

(none)

Suggestion

  • Functionality — home-dir basename false positivesrc/commands/project.ts:56-58. The generic-dir guard rejects a basename that equals the home-dir basename (base !== home). This correctly catches "cwd is the home dir", but also mis-fires for a legitimately-named directory that happens to match the username — e.g. user gary running in /Users/gary/work/gary gets an auto-generated name instead of gary. Very low blast radius (and the user can always pass a name / rename), but a comment noting the trade-off, or comparing the full home path rather than just the basename, would be more precise.
  • Software engineering — untested branchtest/create-name.test.ts. The docstring and PR body both call out "the home dir itself" as a generate case, but no test exercises the base === home branch. The generic-dir path is covered via GENERIC_DIRS (/tmp, /Users/gary/projects) but not the home-match path. Add a case like resolveProjectName(undefined, '/Users/gary', () => 'x') (with homedir()/Users/gary) to lock in that behavior.

Information

  • Duplicate word in listsrc/commands/project.ts:17-18. 'harbor' appears twice in NOUN. Harmless, but it slightly skews the random distribution and looks unintentional — likely meant to be a distinct 18th noun.
  • Generated names aren't checked for collisionsrc/commands/project.ts:66. generate() output goes straight to POST /orgs/:id/projects with no dedup against existing project names. Name space is ~18×17×900 ≈ 275k, so collisions are rare, and this matches the prior basename behavior (no regression) — but if the platform enforces unique names within an org, a colliding create fails with no retry. Optional: on a duplicate-name error, regenerate once and retry.
  • Empty-slug edge (pre-existing, not a regression)src/commands/project.ts:55. A garbage explicit arg (e.g. insta project create '!!!') slugifies to '' and is sent as-is; this path predates the PR and is unchanged by it. Noting only for completeness — not introduced here.

Dimension coverage

  • Security: No security-relevant changes. Removing the readline/process.stdin path reduces surface; the resolved name is slugified before reaching the API; no secrets/PII, no auth changes, no new dependencies.
  • Performance: No concerns — pure in-memory string operations, and the change removes I/O (the interactive prompt) from the create path.

Verdict

approved (informational — human approval is still a separate action). Zero Critical findings; the Suggestion/Information items are non-blocking. Nice cleanup: the removed prompt path had no other callers, and src/resolve-project.ts (the separate project picker) is correctly left untouched.

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - approved.

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - approved.

@tonychang04 tonychang04 merged commit dfd013a into main Jul 15, 2026
2 checks passed
@tonychang04 tonychang04 deleted the fix/project-create-no-prompt branch July 15, 2026 14:09
tonychang04 added a commit that referenced this pull request Jul 15, 2026
Ships PR #46: insta project create auto-generates a friendly name instead of
hanging on an interactive prompt.


Claude-Session: https://claude.ai/code/session_01GMbAe5K1RfwaAcge5inX7P

Co-authored-by: Claude Fable 5 <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.

2 participants