Skip to content

feat: make --reason mandatory for all credentialed CLI commands#40

Open
sripathikrishnan wants to merge 1 commit into
mainfrom
feat/mandatory-reason
Open

feat: make --reason mandatory for all credentialed CLI commands#40
sripathikrishnan wants to merge 1 commit into
mainfrom
feat/mandatory-reason

Conversation

@sripathikrishnan
Copy link
Copy Markdown
Contributor

Closes #32.

Summary

  • --reason is now required on every command that contacts the ExtraSuite server. Omitting it exits immediately with a clear error before any credential fetch or file I/O.
  • -m added as a third alias alongside the existing -r / --reason.
  • EXTRASUITE_REASON env var and hardcoded defaults removed — the audit log always reflects real user intent.
  • Fail-fast ordering fixed in handlers that previously did file I/O before checking reason (sheet batchUpdate, gmail compose/edit-draft/reply, calendar create/update, all share commands).
  • Help docs updated — top-level README and all 32 credentialed command files now document --reason in their Flags/Options section and examples.
  • 54 new tests covering _get_reason unit behaviour, all three parser aliases, every credentialed command (38 commands), and offline commands (6 commands confirmed not requiring --reason).

Test plan

  • uv run pytest tests/test_reason_required.py -v — all 54 pass
  • uv run pytest tests/ -q — all 191 pass
  • uv run ruff check src/ tests/ — clean
  • extrasuite sheet pull <url> without --reason → exits with clear error
  • extrasuite sheet pull <url> -m "user asked to review budget" → proceeds normally
  • extrasuite sheet diff <folder> without --reason → works fine (offline, no creds needed)

🤖 Generated with Claude Code

Closes #32.

Every command that requests credentials from the ExtraSuite server now
requires --reason (-r / -m). Omitting it exits immediately with a clear
error before any credential fetch or file I/O occurs.

Changes:
- _get_reason(): removed `default` param and EXTRASUITE_REASON env var
  fallback; exits 1 with an actionable message if reason is absent
- All CLI modules: removed hardcoded default= strings from every call site
- Moved _get_reason() to the top of handlers that previously did file I/O
  first (sheet batchUpdate, gmail compose/edit-draft/reply, calendar
  create/update, _cmd_share) so the error fires before any other work
- Added -m as a third alias alongside existing -r / --reason
- Updated --reason help text to say it is required
- Help docs: updated README and all 32 credentialed command files to
  document --reason in their Flags/Options section and examples
- Tests: 54 new tests covering _get_reason unit behaviour, all three
  parser aliases, every credentialed command, and offline commands

Co-Authored-By: Claude Sonnet 4.6 <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.

Make --reason mandatory for all credentialed CLI commands

1 participant