feat: add night-watch summary command for morning briefings#85
feat: add night-watch summary command for morning briefings#85
night-watch summary command for morning briefings#85Conversation
Adds a new `night-watch summary` command that aggregates data from existing sources into a single "morning briefing" view: - Recent job runs from `getJobRunsAnalytics()` - Open PRs from `collectPrInfo()` - Pending queue items from `getQueueStatus()` Usage: night-watch summary [--hours <n>] [--json] Options: --hours <n> Time window in hours (default: 12) --json Output summary as JSON Examples: night-watch summary # Last 12 hours night-watch summary --hours 24 # Last 24 hours night-watch summary --json # JSON output for scripting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 88/100 This PR adds a well-structured ✅ Key Strengths
|
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Performance | Sequential Async Calls | packages/core/src/utils/summary.ts |
Three independent async operations (getJobRunsAnalytics, collectPrInfo, getQueueStatus) execute sequentially rather than in parallel. |
Low |
| Maintainability | Global State Mutation | summary.test.ts:31-32 |
Overwriting process.cwd globally before module import is fragile and may cause test isolation issues. |
Low |
| Maintainability | Redundant Test Mock | summary.test.ts:288-297 |
getQueueStatus is re-mocked with identical values to beforeEach setup, adding noise without value. |
Low |
🔚 Conclusion
A solid, well-tested feature addition that follows established patterns in the codebase. The parallelization opportunity is minor but worth addressing for CLI responsiveness. Ready to merge with optional polish.
Analyzed using z-ai/glm-5
6488c73 to
51dae65
Compare
DiffGuard AI AnalysisAI Review Summary🏆 Overall Score: 82/100 The PR adds a well-structured "summary" command for a morning briefing feature, with clean separation between CLI and core logic, good TypeScript typing, and comprehensive test coverage. A minor display bug and a few robustness issues prevent a higher score. ✅ Key Strengths
|
| Bug Name | Affected Files | Description | Confidence |
|---|---|---|---|
| Extra Parenthesis in Queue Display | packages/cli/src/commands/summary.ts |
Line 163 has an extra closing parenthesis in the template string: for ${projectNames.join(', ')}) should be for ${projectNames.join(', ')}. Output shows an extra ) character. |
High 🟢 |
📋 Issues Found
| Issue Type | Issue Name | Affected Components | Description | Impact/Severity |
|---|---|---|---|---|
| Maintainability | Fragile Test Setup | summary.test.ts |
Module-level process.cwd replacement before import makes tests dependent on execution order and harder to debug. |
Medium |
| Reliability | Missing Input Validation | summary.ts |
parseInt(options.hours || '12', 10) can produce NaN or accept negative numbers without warning. |
Low |
🔚 Conclusion
A solid implementation with good architecture and test coverage. The extra parenthesis bug should be fixed before merge, and the input validation is worth addressing for production robustness.
Analyzed using z-ai/glm-5
- Added 20 tests for getSummaryData core utility - Tests cover: windowHours, job counts, action items, PR integration, queue integration - All 31 summary-related tests pass (11 CLI + 20 core) Co-Authored-By: Claude <noreply@anthropic.com>
Night Watch QA ReportChanges Classification
Test ResultsAPI Tests
Test Coverage SummaryThe QA agent added comprehensive tests for the core
Files Added
Night Watch QA Agent
|
- Fix unmatched trailing `)` in queue display string
- Fix early return that hid open PRs, queue status, and action items when no job runs existed; only the job table section is now conditional
- Use path.basename() instead of POSIX-only split('/').pop() in getProjectName
- Extract magic number 12 into DEFAULT_SUMMARY_WINDOW_HOURS constant in core/constants.ts
- Import and use DEFAULT_SUMMARY_WINDOW_HOURS in both summary.ts files and CLI command
- Add NaN/non-positive guard for --hours CLI input
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Adds a new
night-watch summarycommand that provides a "morning briefing" aggregating data from multiple sources into a single view:getJobRunsAnalytics()collectPrInfo()getQueueStatus()Usage
Options
--hours <n>: Time window in hours (default: 12)--json: Output summary as JSONExamples
Output Format
When there are failures:
Implementation
Files Changed
packages/core/src/utils/summary.ts- New file:getSummaryData()functionpackages/core/src/index.ts- Export from summary.tspackages/cli/src/commands/summary.ts- New file: command implementationpackages/cli/src/cli.ts- Register summary commandpackages/cli/src/__tests__/commands/summary.test.ts- Unit testsTests
All 11 tests pass:
References
🤖 Generated with Claude Code