Skip to content

feat: add interactive menu when run with no args#8

Merged
tonychang04 merged 1 commit intomainfrom
feat/interactive-menu
Mar 3, 2026
Merged

feat: add interactive menu when run with no args#8
tonychang04 merged 1 commit intomainfrom
feat/interactive-menu

Conversation

@tonychang04
Copy link
Contributor

@tonychang04 tonychang04 commented Mar 3, 2026

Replace the old showLogoOnFirstRun (which created .insforge/ in CWD as a side effect) with an interactive clack menu that appears when insforge is invoked with no arguments in a TTY. The menu adapts based on auth and project state, guiding users to login, create, link, deploy, docs, or help.

Also add a retry loop in requireAuth so failed login attempts prompt "Would you like to try again?" instead of dying with a raw error.

Summary by CodeRabbit

New Features

  • Interactive CLI menu now appears when running the program without arguments, dynamically displaying available actions based on login and project linking status
  • Enhanced authentication experience with interactive retry prompts when login is required

Replace the old showLogoOnFirstRun (which created .insforge/ in CWD as
a side effect) with an interactive clack menu that appears when `insforge`
is invoked with no arguments in a TTY. The menu adapts based on auth and
project state, guiding users to login, create, link, deploy, docs, or help.

Also add a retry loop in requireAuth so failed login attempts prompt
"Would you like to try again?" instead of dying with a raw error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tonychang04 tonychang04 merged commit fd2f0b9 into main Mar 3, 2026
1 of 2 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02b293f and 5fee567.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • src/index.ts
  • src/lib/credentials.ts

Walkthrough

The changes replace a one-time welcome logo mechanism with an interactive CLI menu that guides users through authentication and project setup. Additionally, credential validation is enhanced with retry logic to improve error recovery during login attempts.

Changes

Cohort / File(s) Summary
Interactive Menu System
src/index.ts
Replaced showLogoOnFirstRun() with a new showInteractiveMenu() function that detects login/project state, displays an interactive clack-driven menu with conditional action options (login, create, link, deploy, docs, help), and dispatches to corresponding subcommands. Updated imports to include clack prompts and config/credential helpers while removing unused filesystem utilities.
Credential Retry Logic
src/lib/credentials.ts
Enhanced requireAuth() to implement an explicit retry loop that attempts OAuth login on missing credentials, logs formatted errors for TTY environments, prompts users for retry decisions, and throws AuthError on user cancellation or non-TTY failures. Preserves existing success paths while improving interactive error recovery.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A menu hops into view, so bright,
No more waiting for the logo's light,
With interactive choices, the user can play,
And credentials retry the OAuth way!
Login flows dance through the terminal night. 🌙✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/interactive-menu

Comment @coderabbitai help to get the list of available commands and usage tips.

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