Unified Analytics & Velocity Tracking
Status: ✅ Complete · Priority: High · Created: 2025-11-04 · Tags: ux, visualization, analytics, launch, v0.2.0
Split into sub-specs for Context Economy - See detailed sections below
Overview
Consolidate analytics commands and add velocity tracking to measure SDD effectiveness.
What Was Built
- ✅ Timestamp tracking →
created_at,updated_at,completed_at,transitionsin frontmatter - ✅ Velocity metrics → Cycle time, throughput, WIP tracking in
utils/velocity.ts - ✅ Enhanced stats command → Added
--velocity,--timeline,--fullflags - ✅ Board enhancements → Integrated velocity summary into board view
- ❌ Dashboard command → Not implemented (functionality merged into enhanced
statsandboardinstead)
Why Now?
- v0.2.0 launch requires polished, cohesive UX
- Analytics commands overlap in purpose (both show trends/metrics)
- Need single entry point for "show me project health"
- Velocity is critical metric for SDD adoption - proves if specs help or hinder
Before vs After
Before (v0.1.x):
lean-spec stats # Basic metrics only
lean-spec timeline # Separate timeline view
lean-spec board # Basic Kanban
# No velocity tracking
# No timestamp precision
After (v0.2.0):
# Enhanced Stats Command
lean-spec stats # Simplified view with insights
lean-spec stats --timeline # Add timeline section
lean-spec stats --velocity # Cycle time analysis
lean-spec stats --full # Everything combined
# Enhanced Board Command
lean-spec board # Now includes velocity summary
# Timeline Command
lean-spec timeline # Still works (not deprecated)
# Velocity tracking active
# Precise timestamps in frontmatter
Implemented Features
✅ 1. Timestamp Tracking (Foundation)
Precise timestamps alongside existing dates enable velocity metrics:
created_at,updated_at,completed_at(ISO 8601) - IMPLEMENTED- Optional
transitionsarray for stage duration tracking - IMPLEMENTED - Backward compatible (infer from dates if missing) - IMPLEMENTED
- Auto-enrichment on create/update operations - IMPLEMENTED
✅ 2. Velocity Metrics
Comprehensive velocity tracking implemented in src/utils/velocity.ts:
- Cycle Time: Created → Completed (avg, median, P90) - IMPLEMENTED
- Lead Time: Time in each status from transitions - IMPLEMENTED
- Throughput: Specs/week with trend indicators - IMPLEMENTED
- WIP Tracking: Current and historical WIP averages - IMPLEMENTED
✅ 3. Enhanced Stats Command
Completely redesigned stats command with multiple views:
lean-spec stats→ New simplified view with insights (default) - IMPLEMENTEDlean-spec stats --timeline→ Add timeline section - IMPLEMENTEDlean-spec stats --velocity→ Show cycle time analysis - IMPLEMENTEDlean-spec stats --full→ Everything combined (old analytics style) - IMPLEMENTED- Smart insights and completion tracking - IMPLEMENTED
✅ 4. Board Command Enhancements
Integrated velocity metrics into board view:
- Shows velocity summary (cycle time, throughput, WIP) - IMPLEMENTED
- Completion rate and project health - IMPLEMENTED
❌ 5. Dashboard Command (Not Implemented)
Decision: Instead of creating a separate dashboard command, the functionality was distributed:
- Enhanced
statscommand provides comprehensive analytics - Enhanced
boardcommand shows velocity summary - This keeps the CLI simpler and more focused
Quick Reference
Command Comparison
| Command | Purpose | When to Use |
|---|---|---|
lean-spec list | Browse/search specs | Find specific spec, apply filters |
lean-spec board | Kanban workflow + velocity | Sprint planning, project health |
lean-spec stats | Comprehensive analytics | Deep metrics, velocity analysis |
lean-spec timeline | Historical trends | Activity over time |
Stats Output Examples
Simplified view (default):
lean-spec stats
# Shows: Overview, Status, Priority Focus, Needs Attention, Velocity Summary
Velocity analysis:
lean-spec stats --velocity
# Shows: Cycle Time, Lead Time, Throughput, WIP metrics
Full analytics:
lean-spec stats --full
# Shows: Everything combined (stats + timeline + velocity)
Sub-Specs
Detailed information split for Context Economy (<400 lines per file):
- DESIGN.md - Architecture, timestamp tracking, command structure
- RATIONALE.md - Why velocity matters, design decisions, alternatives
- IMPLEMENTATION.md - Step-by-step implementation plan with phases
- TESTING.md - Comprehensive test strategy and success criteria
- ACTUAL-IMPLEMENTATION.md - Final implementation details and outcomes
Success Criteria (Achieved)
✅ User Experience:
- Stats command now provides clear project insights with simplified default view
- Needs Attention section highlights critical issues
- Velocity metrics prove SDD effectiveness
- No breaking changes for existing users
✅ Technical:
- Fast render performance with single spec load
- Backward compatible (old stats behavior available with
--full) - Clean separation: velocity.ts, completion.ts, insights.ts utilities
- Comprehensive test coverage
✅ Business:
- Velocity metrics demonstrate SDD value objectively
- Enhanced board/stats commands improve v0.2.0 launch demo
- Clear analytics for teams to track improvement
Dependencies
None - standalone feature for v0.2.0
Implementation Notes
Why Velocity Metrics Matter
Velocity is SDD's feedback loop:
- Proves whether specs accelerate or slow development
- Identifies workflow bottlenecks
- Tracks team learning curve
- Makes SDD adoption measurable
- Provides objective data for process improvement
Design Decisions
Why no separate dashboard command?
- Decided against
lean-specdefaulting to dashboard (keeps help accessible) - Enhanced
statsandboardcommands provide comprehensive views - Simpler CLI surface area (fewer commands to learn)
- Functionality distributed where it makes most sense
Why keep timeline command?
- Originally planned for deprecation
- Decided to keep it as dedicated historical view
- No user confusion since stats/timeline serve different use cases
- No breaking changes needed
Future Enhancements
- Custom velocity targets via config
- More granular lead time tracking (by spec type/priority)
- Velocity trend predictions
- Export capabilities (JSON, CSV)
- Integration with CI/CD for automated tracking