Skip to content

feat: Add lattice diff command for branch-scoped change summaries#4

Merged
gmoon merged 2 commits intomainfrom
feat/lattice-diff
Mar 8, 2026
Merged

feat: Add lattice diff command for branch-scoped change summaries#4
gmoon merged 2 commits intomainfrom
feat/lattice-diff

Conversation

@gmoon
Copy link
Contributor

@gmoon gmoon commented Mar 8, 2026

Summary

  • Adds lattice diff command that shows lattice nodes added, modified, resolved, or deleted since a given git ref
  • Supports three output modes: colored text (default), JSON (--format json), and markdown (--md)
  • Defaults to merge-base with main when no --since ref is provided

Implementation

  • Core diff logic in src/diff.rs: uses git diff --name-status <ref> -- .lattice/ to detect file changes, parses YAML to extract node metadata, detects newly resolved requirements by comparing old vs new state
  • CLI wiring in src/main.rs: new Diff command variant with --since, --md, and --format flags
  • Library exports in src/lib.rs
  • Lattice requirement REQ-CLI-019 and implementation IMP-CLI-019 added and verified

Test plan

  • 10 unit tests covering is_node_file, DiffResult, format_entry, markdown formatting
  • 8 integration tests: no-crash on HEAD, JSON structure, markdown output, changes since initial commit, explicit ref, invalid ref error, text output structure
  • make pre-push passes (fmt + clippy + 208 tests + release build)
  • lattice drift reports no unresolved drift

Closes #2

🤖 Generated with Claude Code

gmoon and others added 2 commits March 8, 2026 14:16
Implements REQ-CLI-019. Shows lattice nodes added, modified, resolved, or
deleted since a given git ref. Supports text, JSON, and markdown output.

- Core diff logic in src/diff.rs using git diff --name-status
- Detects newly resolved requirements by comparing old/new YAML
- --since flag for explicit ref (defaults to merge-base with main)
- --md flag for GitHub comment-ready markdown output
- 10 unit tests + 8 integration tests

Closes #2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests now gracefully skip when git history is unavailable (shallow clones).
Uses helper functions to check history depth before using refs like HEAD~1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gmoon gmoon merged commit b91038e into main Mar 8, 2026
5 checks passed
@gmoon gmoon deleted the feat/lattice-diff branch March 8, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add lattice diff command for branch-scoped change summaries

1 participant