ID:WORK-136Status:donePriority:highComplexity:simpleSource:SPEC-038
CLI plan history single-entity mode
Implement the plan history <ID> CLI subcommand for viewing the git-derived lifecycle timeline of a single plan entity.
Acceptance Criteria
plan history WORK-024displays the entity's timeline in reverse chronological order- Each event shows date, structured changes, and short commit hash
- Attribute changes display as
field: old → new - Criteria changes display with ☑/☐ markers
- Resolution events are shown when a Resolution section is added/modified
- Content-only events are included for completeness
- Sub-changes within an event (multiple attributes, multiple criteria) are indented
- Entity title is displayed as a header line
--format jsonoutputs machine-readable JSON- Command is registered in the plan CLI plugin
- Error handling for unknown entity IDs
Dependencies
- Event model types and per-entity git history extraction — Event model and per-entity extraction
Approach
Add a history command handler in runes/plan/src/commands/history.ts. Register it in runes/plan/src/cli-plugin.ts. The handler resolves the entity ID to a file path using the existing scanner, then calls extractEntityHistory() and formats the output.
The formatter should produce the columnar format shown in the spec: date left-aligned, changes indented, commit hash right-aligned.
References
- Git-Native Entity History — Git-Native Entity History (CLI:
plan history— Single-entity mode)
Resolution
Completed: 2026-04-13
Branch: claude/spec-038-breakdown-pChav
What was done
runes/plan/src/history.ts— Core event model types (HistoryEvent, AttributeChange, CriteriaChange) + per-entity extraction algorithm (git log --follow, git show, parse/diff) + batch extraction + cachingrunes/plan/src/commands/history.ts— CLIplan historycommand with single-entity and global modes, all filters (--since, --type, --author, --status, --all, --limit, --format json)runes/plan/src/cli-plugin.ts— Registered history command in CLI pluginrunes/plan/src/tags/plan-history.ts— Self-closing plan-history tag definition with sentinel patternrunes/plan/src/pipeline.ts— Extended PlanAggregatedData with history + repositoryUrl fields, added aggregate hook extraction, added postProcess resolver for per-entity timeline and global commit-grouped feedrunes/plan/src/commands/render-pipeline.ts— Pass plan directory to pipeline via setPlanDirrunes/plan/src/config.ts— Added PlanHistory rune configrunes/plan/src/index.ts— Exported plan-history rune in RunePackagerunes/plan/styles/default.css— Timeline CSS with vertical line, circle markers, diff coloring, responsive layoutrunes/plan/test/history.test.ts— 31 tests covering parsing, diffing, and integration with real git repos
Notes
- All 6 work items were implemented together as they form a cohesive feature
- Pre-existing build issues in the plan package (missing @types/node, unresolved @refrakt-md/runes) prevent full tsc build, but all new code compiles and tests pass via vitest
- History cache uses a separate .plan-history-cache.json file (not merged into .plan-cache.json) to keep concerns separate
Relationships
Dependency of
History
- 607bcd1statusready→done
- ☑ `plan history WORK-024` displays the entity's timeline in reverse chronological order
- ☑ Each event shows date, structured changes, and short commit hash
- ☑ Attribute changes display as `field: old → new`
- +8 more criteria
- a59fd62Created (ready, high, simple, SPEC-038, plan, cli, git, history)