Input: Design documents from /specs/017-activity-cli-commands/
Prerequisites: plan.md, spec.md, research.md, data-model.md, contracts/
Tests: Included per spec requirements (FR-025 TDD, constitution V).
Organization: Tasks are grouped by user story to enable independent implementation and testing of each story.
- [P]: Can run in parallel (different files, no dependencies)
- [Story]: Which user story this task belongs to (e.g., US1, US2, US3)
- Include exact file paths in descriptions
cmd/mcpproxy/
├── activity_cmd.go # Main implementation
├── activity_cmd_test.go # Unit tests
└── main.go # Register command
internal/
├── cliclient/client.go # Add activity API methods
└── httpapi/activity.go # Add summary endpoint (backend extension)
scripts/
└── test-api-e2e.sh # E2E test updates
Purpose: Project initialization and scaffolding for activity commands
- T001 Create activity command file scaffolding in cmd/mcpproxy/activity_cmd.go
- T002 Register GetActivityCommand() in cmd/mcpproxy/main.go
- T003 [P] Add activity API client methods in internal/cliclient/client.go
Purpose: Core infrastructure that MUST be complete before ANY user story
- T004 Implement ActivityFilter struct and validation in cmd/mcpproxy/activity_cmd.go
- T005 [P] Implement formatRelativeTime() helper in cmd/mcpproxy/activity_cmd.go
- T006 [P] Implement buildActivityQueryParams() helper in cmd/mcpproxy/activity_cmd.go
- T007 [P] Implement outputActivityError() with structured error support in cmd/mcpproxy/activity_cmd.go
- T008 Add ListActivities() method to internal/cliclient/client.go
- T009 Add GetActivityDetail() method to internal/cliclient/client.go
Checkpoint: Foundation ready - user story implementation can now begin in parallel
Goal: Users can query activity history with filtering and pagination
Independent Test: Run mcpproxy activity list after making tool calls and verify formatted output
- T010 [P] [US1] Unit test for activity list command parsing in cmd/mcpproxy/activity_cmd_test.go
- T011 [P] [US1] Unit test for filter validation in cmd/mcpproxy/activity_cmd_test.go
- T012 [P] [US1] Add activity list E2E test case in scripts/test-api-e2e.sh
- T013 [US1] Define activityListCmd cobra.Command with flags in cmd/mcpproxy/activity_cmd.go
- T014 [US1] Implement runActivityList() function in cmd/mcpproxy/activity_cmd.go
- T015 [US1] Implement table output formatting for list (headers: ID, TYPE, SERVER, TOOL, STATUS, DURATION, TIME) in cmd/mcpproxy/activity_cmd.go
- T016 [US1] Implement JSON/YAML output formatting for list in cmd/mcpproxy/activity_cmd.go
- T017 [US1] Add empty state handling ("No activities found") in cmd/mcpproxy/activity_cmd.go
- T018 [US1] Add pagination info display for table output in cmd/mcpproxy/activity_cmd.go
Checkpoint: mcpproxy activity list works with all filter flags and output formats
Goal: Real-time tail -f style activity streaming via SSE
Independent Test: Run mcpproxy activity watch in one terminal, make tool calls in another
- T019 [P] [US2] Unit test for SSE event parsing in cmd/mcpproxy/activity_cmd_test.go
- T020 [P] [US2] Unit test for watch event filtering logic in cmd/mcpproxy/activity_cmd_test.go
- T021 [US2] Define activityWatchCmd cobra.Command with flags in cmd/mcpproxy/activity_cmd.go
- T022 [US2] Implement watchActivityStream() SSE client using bufio.Scanner in cmd/mcpproxy/activity_cmd.go
- T023 [US2] Implement watchWithReconnect() with exponential backoff in cmd/mcpproxy/activity_cmd.go
- T024 [US2] Implement runActivityWatch() with signal handling (SIGINT/SIGTERM) in cmd/mcpproxy/activity_cmd.go
- T025 [US2] Implement table streaming output ([HH:MM:SS] server:tool status duration) in cmd/mcpproxy/activity_cmd.go
- T026 [US2] Implement NDJSON streaming output for watch in cmd/mcpproxy/activity_cmd.go
- T027 [US2] Add client-side event filtering (type, server) in cmd/mcpproxy/activity_cmd.go
Checkpoint: mcpproxy activity watch streams live events with auto-reconnect
Goal: View full details of a specific activity record
Independent Test: Run mcpproxy activity show <id> with ID from list command
- T028 [P] [US3] Unit test for activity ID validation (ULID format) in cmd/mcpproxy/activity_cmd_test.go
- T029 [P] [US3] Unit test for show output formatting in cmd/mcpproxy/activity_cmd_test.go
- T030 [US3] Define activityShowCmd cobra.Command with id argument in cmd/mcpproxy/activity_cmd.go
- T031 [US3] Implement runActivityShow() function in cmd/mcpproxy/activity_cmd.go
- T032 [US3] Implement detailed table output (key-value pairs with Arguments/Response sections) in cmd/mcpproxy/activity_cmd.go
- T033 [US3] Implement JSON/YAML output for show in cmd/mcpproxy/activity_cmd.go
- T034 [US3] Add --include-response flag support in cmd/mcpproxy/activity_cmd.go
- T035 [US3] Add error handling for not found and invalid ID format in cmd/mcpproxy/activity_cmd.go
Checkpoint: mcpproxy activity show <id> displays full activity details
Goal: Quick overview of activity statistics for a time period
Independent Test: Run mcpproxy activity summary and verify statistics
- T036 [US4] Add ActivitySummary struct to internal/contracts/activity.go
- T037 [US4] Add GetActivitySummary() storage method to internal/storage/activity.go
- T038 [US4] Add handleActivitySummary() endpoint (GET /api/v1/activity/summary) to internal/httpapi/activity.go
- T039 [US4] Add GetActivitySummary() client method to internal/cliclient/client.go
- T040 [P] [US4] Unit test for summary period parsing (1h, 24h, 7d, 30d) in cmd/mcpproxy/activity_cmd_test.go
- T041 [P] [US4] Unit test for summary table formatting in cmd/mcpproxy/activity_cmd_test.go
- T042 [US4] Define activitySummaryCmd cobra.Command with flags in cmd/mcpproxy/activity_cmd.go
- T043 [US4] Implement runActivitySummary() function in cmd/mcpproxy/activity_cmd.go
- T044 [US4] Implement summary table output (metrics, top servers, top tools) in cmd/mcpproxy/activity_cmd.go
- T045 [US4] Implement JSON/YAML output for summary in cmd/mcpproxy/activity_cmd.go
- T046 [US4] Add --by flag support for grouping in cmd/mcpproxy/activity_cmd.go
Checkpoint: mcpproxy activity summary shows usage statistics
Goal: Export activity logs to files for compliance and auditing
Independent Test: Run mcpproxy activity export --output file.jsonl and verify file
- T047 [P] [US5] Unit test for export file path validation in cmd/mcpproxy/activity_cmd_test.go
- T048 [P] [US5] Unit test for export format selection in cmd/mcpproxy/activity_cmd_test.go
- T049 [US5] Define activityExportCmd cobra.Command with flags in cmd/mcpproxy/activity_cmd.go
- T050 [US5] Implement runActivityExport() with streaming output in cmd/mcpproxy/activity_cmd.go
- T051 [US5] Implement file output (--output flag) in cmd/mcpproxy/activity_cmd.go
- T052 [US5] Implement stdout output for piping in cmd/mcpproxy/activity_cmd.go
- T053 [US5] Add --include-bodies flag support in cmd/mcpproxy/activity_cmd.go
- T054 [US5] Add permission error handling for unwritable paths in cmd/mcpproxy/activity_cmd.go
Checkpoint: mcpproxy activity export creates valid JSON/CSV files
Purpose: Documentation, cleanup, and cross-story improvements
- T055 [P] Update docs/cli-management-commands.md with activity commands
- T056 [P] Update CLAUDE.md with activity command examples
- T057 [P] Add activity command examples to docs/features/activity-log.md
- T058 Run quickstart.md validation scenarios
- T059 Run full E2E test suite (scripts/test-api-e2e.sh)
- T060 Run linter (scripts/run-linter.sh)
- Setup (Phase 1): No dependencies - can start immediately
- Foundational (Phase 2): Depends on Setup completion - BLOCKS all user stories
- User Stories (Phase 3-7): All depend on Foundational phase completion
- US1 (list) and US2 (watch) can run in parallel (both P1)
- US3 (show) can start after Foundational
- US4 (summary) requires backend extension first (T036-T039)
- US5 (export) can start after Foundational
- Polish (Phase 8): Depends on all user stories being complete
Phase 1: Setup
↓
Phase 2: Foundational (BLOCKS ALL)
↓
├── Phase 3: US1 - List (P1) 🎯 MVP
│ ↓ (parallel with US2)
├── Phase 4: US2 - Watch (P1)
│ ↓
├── Phase 5: US3 - Show (P2)
│ ↓
├── Phase 6: US4 - Summary (P3) ← requires backend extension
│ ↓
└── Phase 7: US5 - Export (P4)
↓
Phase 8: Polish
- Tests MUST be written and FAIL before implementation
- Command definition before run function
- Run function before output formatting
- Error handling after happy path
- T003 (client methods) can run in parallel with T001-T002
- T005, T006, T007 (helpers) can run in parallel
- T008, T009 (client methods) can run in parallel
- All test tasks marked [P] can run in parallel within their story
- US1 and US2 can run in parallel (both P1 priority)
# Launch all tests in parallel:
Task: "T010 [P] [US1] Unit test for activity list command parsing"
Task: "T011 [P] [US1] Unit test for filter validation"
Task: "T012 [P] [US1] Add activity list E2E test case"
# After tests fail (TDD), implement sequentially:
Task: "T013 [US1] Define activityListCmd cobra.Command"
Task: "T014 [US1] Implement runActivityList()"
# ... etc- Complete Phase 1: Setup
- Complete Phase 2: Foundational (CRITICAL)
- Complete Phase 3: User Story 1 - List
- STOP and VALIDATE: Test
mcpproxy activity listindependently - Deploy/demo if ready
- Setup + Foundational → Foundation ready
- Add US1 (List) → Test independently → MVP!
- Add US2 (Watch) → Test independently → Real-time monitoring
- Add US3 (Show) → Test independently → Detail inspection
- Add US4 (Summary) → Test independently → Dashboard
- Add US5 (Export) → Test independently → Compliance
- Polish phase → Documentation complete
With two developers after Foundational:
- Developer A: US1 (List) → US3 (Show) → US5 (Export)
- Developer B: US2 (Watch) → US4 (Summary) → Polish
- [P] tasks = different files, no dependencies
- [Story] label maps task to specific user story
- Each user story is independently completable and testable
- Verify tests fail before implementing
- Commit after each task or logical group
- Stop at any checkpoint to validate story independently
- US4 (Summary) requires backend extension - coordinate with spec 016