Skip to content

feat: add CLI shortcuts for common auth commands - #18

Merged
neuromechanist merged 2 commits into
mainfrom
feature/cli-shortcuts
Jan 16, 2026
Merged

neuromechanist merged 2 commits into
mainfrom
feature/cli-shortcuts

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Add root-level shortcuts for common commands: nemar login, nemar logout, nemar signup, nemar register, nemar whoami
  • Add nemar auth whoami as alias for nemar auth status
  • Export action handlers from auth.ts for reuse in shortcuts

The two-prong structure (nemar auth login, etc.) remains the canonical/documented approach following CLI best practices. The shortcuts are convenience aliases for users who prefer shorter commands.

Closes #12

Test plan

  • nemar --help shows new shortcuts
  • nemar auth --help shows whoami alias
  • nemar whoami works same as nemar auth status
  • nemar auth whoami works same as nemar auth status
  • All 109 existing tests pass

- Add root-level shortcuts: login, logout, signup, register, whoami
- Add whoami alias under auth command (nemar auth whoami)
- Export action handlers from auth.ts for reuse
- Keep two-prong structure as canonical (best practice), shortcuts as convenience

Closes #12
@neuromechanist

Copy link
Copy Markdown
Contributor Author

PR Review Summary

Critical Issues (0 found)

None.

Important Issues (1 found)

Agent Issue Location
silent-failure-hunter statusAction continues with stale data after refresh failure - When --refresh fails, function shows error but then displays cached data with green "Authenticated" message, which is misleading auth.ts:316-331

Medium Issues (5 found)

Agent Issue Location
silent-failure-hunter Non-ApiError exceptions swallowed without details in loginAction auth.ts:116-128
silent-failure-hunter No exit codes on failures - scripts can't detect CLI failures Throughout auth.ts
silent-failure-hunter loginAction returns silently on invalid API key (exit code 0) auth.ts:99-102
silent-failure-hunter Inconsistent error handling between loginAction and signupAction auth.ts:287-290
silent-failure-hunter Unhandled Ctrl+C in inquirer.prompt calls Multiple locations

Suggestions (4 found)

Agent Suggestion Location
comment-analyzer Header comment should clarify whoami is an alias, not a first-class command auth.ts:8
comment-analyzer JSDoc comments could include parameter documentation auth.ts:55, 153, 303
code-simplifier Consider removing register alias - adds clutter to help output index.ts:83-86
code-simplifier Duplicate "two-prong structure" comments in both files index.ts:7-10, auth.ts:11-13

Strengths

  • Clean refactoring - action handlers extracted and reused without duplication
  • Consistent naming pattern (loginAction, logoutAction, etc.)
  • Good architectural comments explaining design rationale
  • All 109 tests passing
  • Backward compatible - existing nemar auth <cmd> commands unchanged
  • Proper TypeScript type annotations on exported functions

Verdict

Approvable as-is. The refactoring is clean and follows project conventions. The error handling issues noted are pre-existing patterns, not introduced by this PR.

- Add whoami command to auth.md
- Add shortcuts section to commands/index.md
- Document root-level aliases (login, logout, signup, register, whoami)
@neuromechanist
neuromechanist merged commit 91ebc48 into main Jan 16, 2026
@neuromechanist
neuromechanist deleted the feature/cli-shortcuts branch January 16, 2026 17:35
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.

nemar commands

1 participant