fix(project create): never block on a name prompt — auto-generate a friendly name#46
Conversation
…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
|
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
left a comment
There was a problem hiding this comment.
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 newbase !== homeguard 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', ...)wherehomedir()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 toslugifyName/homedirhandling. - Functionality — no collision handling on generated names (
src/commands/project.ts:59,62-66).generateProjectNamepicks from ~18×18×900 combos with no check against existing project names, soPOST /orgs/:id/projectscan 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 frommain(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) documentsproject createwithout referencing the old prompt, so no doc change is required. Thedeveloping-insta-cliskill notes command/flag changes must be mirrored in theskills/submodule'scli-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
left a comment
There was a problem hiding this comment.
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 positive —
src/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. usergaryrunning in/Users/gary/work/garygets an auto-generated name instead ofgary. 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 branch —
test/create-name.test.ts. The docstring and PR body both call out "the home dir itself" as a generate case, but no test exercises thebase === homebranch. The generic-dir path is covered viaGENERIC_DIRS(/tmp,/Users/gary/projects) but not the home-match path. Add a case likeresolveProjectName(undefined, '/Users/gary', () => 'x')(withhomedir()→/Users/gary) to lock in that behavior.
Information
- Duplicate word in list —
src/commands/project.ts:17-18.'harbor'appears twice inNOUN. 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 collision —
src/commands/project.ts:66.generate()output goes straight toPOST /orgs/:id/projectswith 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.stdinpath 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.
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>
Problem
insta project create(no arg) dropped into an interactive prompt:So
curl … | sh && insta project create— and any run from~/projects— just hangs, with a nonsense default (the cwd basenameprojects). That's exactly the 'why doesn't it just work like Railway' friction.Fix
Name resolution never prompts:
~/my-app→my-app)swift-meadow-482) for generic dirs (projects,tmp,~,src,code, …) and the home dir itselfRemoved the readline prompt path entirely — stdin is no longer touched. Pass a name or rename later for something specific.
Verification
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 createnon-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 likeswift-meadow-482.curl | shand from dirs like~/projectswithout hanging.adjective-noun-###.Written for commit f3d2ca8. Summary will update on new commits.