Add new analytics commands and expand flags#30
Conversation
New CLI commands: - file-activity: Show file read/write activity with --collapse-worktrees option - languages: Language distribution from file extensions - projects: Activity breakdown by project - mcp-usage: MCP server and tool usage grouped by server Expand flag system: - frequency: Now auto-expands Bash→commands, Skill→skills, Task→agents (--no-expand to disable) - sequences: Add --expand flag to show command-level workflow patterns Other improvements: - Add descriptive headers to all CLI output formatters - Update sessions output to show input/output/total token breakdown - Add make reinstall target (pip install + restart LaunchAgent) - Add global-report.sh script for 7-day analytics report - Update CLAUDE.md with restart/reinstall guidance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Add new analytics commands and expand flagsOverall this is a solid PR that adds useful analytics capabilities. The code follows the project's patterns well and the documentation updates are thorough. Here's my detailed feedback: ✅ What looks good
|
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review: Add new analytics commands and expand flagsThanks for this well-structured PR! The new analytics commands and expand flag system are useful additions. Here's my review: ✅ What looks good
|
| Aspect | Assessment |
|---|---|
| Code quality | Good - follows existing patterns |
| Performance | No concerns - queries use existing indexes |
| Security | No concerns |
| Test coverage | Needs improvement - new functions lack tests |
Overall this is a solid PR that adds useful functionality. I'd recommend adding tests for the new query functions before merging. The expand flag implementation in particular is well-designed and the UX improvements (headers, formatting) are thoughtful.
- Add tests for new query functions (file_activity, languages, projects, mcp_usage) - Add MCP tools for new queries (get_file_activity, get_languages, get_projects, get_mcp_usage) - Update query_projects docstring explaining no project filter - Add CLI/MCP parity guidance to CLAUDE.md Architecture Patterns - Document new MCP tools in guide.md and CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Add new analytics commands and expand flagsThis is a well-structured PR that adds useful analytics capabilities while maintaining consistency with the existing codebase. Here's my detailed review: ✅ Strengths1. Excellent CLI/MCP Parity 2. Good Test Coverage
3. Consistent Architecture
4. Thoughtful UX
🔍 Suggestions for Improvement1. Minor: def get_repo_name(path: str) -> str:
parts = path.rstrip("/").split("/")
for i, part in enumerate(parts):
if part in ("projects", "repos", "src", "Documents"):
if i + 1 < len(parts):
return parts[i + 1]
return parts[-1] if parts else pathConsider adding common patterns like 2. Consider: Limiting language CASE statement for performance (
This is minor since the query is limited by the time filter, but worth noting for future scale. 3. Test coverage: def test_cmd_frequency_no_expand(self, populated_storage, capsys):
class Args:
json = False
days = 7
project = None
no_expand = True # New flag
# ...4. Shell script: Add error handling for CLI failures ( "$CLI" mcp-usage --days "$DAYS" 2>&1 || echo "MCP usage unavailable"🐛 Minor Issues1. Unused Consider: -- Add LIMIT to SQL for efficiency if you know you'll sort by total anyway
-- Though the current approach works fine for typical use cases2. CLI test fixture: 📊 Overall AssessmentVerdict: LGTM with minor suggestions This is a solid PR that:
The suggestions above are minor improvements rather than blockers. Nice work! 🎉 🤖 Generated with Claude Code |
Full paths are more useful to callers than truncated display. Changed format to two lines per file for readability. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Add new analytics commands and expand flagsNice work on this substantial feature addition! This PR adds valuable analytics capabilities and improves the CLI UX. Here's my detailed review: StrengthsWell-structured additions:
Good UX improvements:
Issues to Address1. Missing CLI tests for new commands (Minor) While 2. Potential SQL performance consideration In
This is likely fine for typical usage, but worth monitoring. 3. The script outputs to Suggestions
Code Quality
SummaryApprove with minor suggestions. This is a solid PR that adds useful analytics capabilities while maintaining consistency with the existing codebase. The main actionable item is adding CLI tests for the new commands to match the query test coverage. The expand flag system is particularly well-designed - having different defaults for 🤖 Generated with Claude Code |
CLI formatters: - Remove [:20] limits from tools, commands, tokens, sequences, gaps, journey, messages, sessions, commits - Remove [:8] limit from breakdowns - Remove message text truncation ([:57]...) - Remove session_id truncation ([:16], [:12]) - Remove SHA truncation ([:8]) Query layer: - Remove [:20] from parallel_periods - Remove LIMIT 10 from analyze_trends top_tools Full data is more useful to callers than truncated summaries. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Add new analytics commands and expand flagsOverall, this is a well-structured PR that adds valuable new analytics capabilities while maintaining consistency with the existing codebase patterns. Here is my detailed feedback: Strengths1. Excellent CLI/MCP Parity 2. Solid Test Coverage
3. Consistent Design Patterns
4. Good Documentation Updates Minor Suggestions1. Worktree regex is correctly pre-compiled at module level 2. The Potential Issues1. MCP tool name parsing edge case 2. Language detection is hardcoded Test Plan VerificationThe PR description states all tests pass and manual testing was done for:
The test coverage for the new functionality appears thorough. Security ConsiderationsNo security concerns. The new queries use parameterized SQL via SummaryApprove - This PR is well-implemented with good test coverage, proper documentation updates, and follows the established patterns. The expand flag system is thoughtfully designed with different defaults for The only actionable suggestions are cosmetic improvements, which are optional. Generated with Claude Code |
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
PR Review: Add new analytics commands and expand flagsOverall, this is a well-structured PR that adds valuable new analytics features while maintaining consistency with existing patterns. The code quality is high and follows the project's conventions well. ✅ StrengthsCode Quality
New Features
Testing
|
Summary
file-activity,languages,projects,mcp-usagefor deeper analytics insightsfrequencyauto-expands by default (Bash→commands, Skill→skills, Task→agents),sequencessupports--expandfor command-level patternsmake reinstalltargetscripts/global-report.shNew Commands
file-activity--days,--project,--limit,--collapse-worktreeslanguages--days,--projectprojects--daysmcp-usage--days,--projectTest plan
🤖 Generated with Claude Code