feat: make --reason mandatory for all credentialed CLI commands#40
Open
sripathikrishnan wants to merge 1 commit into
Open
feat: make --reason mandatory for all credentialed CLI commands#40sripathikrishnan wants to merge 1 commit into
sripathikrishnan wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #32.
Summary
--reasonis 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.-madded as a third alias alongside the existing-r/--reason.EXTRASUITE_REASONenv var and hardcoded defaults removed — the audit log always reflects real user intent.sheet batchUpdate,gmail compose/edit-draft/reply,calendar create/update, allsharecommands).--reasonin their Flags/Options section and examples._get_reasonunit 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 passuv run pytest tests/ -q— all 191 passuv run ruff check src/ tests/— cleanextrasuite sheet pull <url>without--reason→ exits with clear errorextrasuite sheet pull <url> -m "user asked to review budget"→ proceeds normallyextrasuite sheet diff <folder>without--reason→ works fine (offline, no creds needed)🤖 Generated with Claude Code