feat: Create CLIBase with shared CLI utilities#203
Conversation
Extract common CLI functionality into a shared module: - load_dotenv/0: Load environment variables from .env file - ensure_api_key!/0: Validate API key environment variables - parse_common_args/1: Parse common CLI arguments (--model, --test, --verbose, --report, --explore) - resolve_model/2: Resolve model names using preset map - format_stats/1: Format session statistics for display - format_number/1: Format integers with thousand separators - format_cost/1: Format cost values with 6 decimal places for CLI precision Fixes #202 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
PR Review: Create CLIBase with shared CLI utilitiesSummaryThis PR creates a new What's Good
Issues (Must Fix)
Verdict on this issue: This is acceptable as-is for Phase 1. The current behavior is reasonable, and the usage printing can be added during Phase 2 (task 2.2) when Suggestions (Optional)
SecurityNo concerns. The functions handle environment variables and file paths appropriately. No user input is passed to dangerous operations. DocumentationNo updates needed. This is internal demo code, and the module has appropriate VerdictApprove ✅ The PR correctly implements task 1.4 from the refactor plan. The code is well-structured, properly documented, and exactly matches the specification. The minor difference in unknown flag handling is not a blocker since this is Phase 1 (foundation only) and the behavior will be refined when |
Auto-Triage SummaryDecisions Made
RationaleIssue #1 - Usage callback (DEFER_ISSUE):
Issue #2 - Doctests (IGNORE):
Issue #3 - Guard clause (IGNORE):
Status
Next StepsNo blocking issues found. The PR is approved and ready to merge. Issue #204 will be addressed in Phase 2. |
Summary
Implement issue #202 by creating
demo/lib/ptc_demo/cli_base.exwith shared CLI utility functions extracted fromLispCLI.Changes
load_dotenv/0- Load environment variables from.envfileensure_api_key!/0- Validate API key environment variablesparse_common_args/1- Parse common CLI argumentsresolve_model/2- Resolve model names using preset mapsformat_stats/1- Format session statisticsformat_number/1- Format integers with thousand separatorsformat_cost/1- Format costs with 6 decimal places (CLI precision)Validation
mix precommitpasses (formatting, compilation, Credo)Fixes #202
🤖 Generated with Claude Code