Skip to content

Redesign snapshot-diff plugin to compare persisted snapshots#88

Merged
saurabhsharma2u merged 1 commit into
mainfrom
codex/redesign-snapshot-diff-plugin-to-compare-snapshots
Mar 3, 2026
Merged

Redesign snapshot-diff plugin to compare persisted snapshots#88
saurabhsharma2u merged 1 commit into
mainfrom
codex/redesign-snapshot-diff-plugin-to-compare-snapshots

Conversation

@saurabhsharma2u

Copy link
Copy Markdown
Contributor

Motivation

  • Replace the prior file-based graph JSON comparison flow with a snapshot-aware workflow that compares persisted Crawlith snapshots by ID.
  • Align the plugin with the AI Agent plugin guidelines and project architecture by separating CLI, lifecycle hooks, service logic, types, and output formatting.
  • Keep and improve incremental crawl behavior so crawls can preload the latest completed snapshot graph for incremental diffing.

Description

  • Reworked the plugin into a manifest plus src/ modules: src/cli.ts, src/plugin.ts, src/Service.ts, src/Output.ts, and src/types.ts, and updated index.ts to register the new CLI and hooks.
  • Replaced --compare <files...> with --compare <snapshots...> which validates exactly two numeric snapshot IDs via SnapshotDiffService.parseCompareRequest and compares graphs with loadGraphFromSnapshot + compareGraphs from core.
  • Implemented presentation helpers renderPrettyDiffOutput and renderJsonDiffOutput to produce colorized terminal summaries or raw JSON depending on --format.
  • Improved incremental baseline logic in SnapshotDiffService.resolvePreviousGraph so --incremental injects the previous completed snapshot graph into ctx.metadata.previousGraph and logs context-aware messages.
  • Updated tests and docs: expanded tests/snapshotDiff.test.ts to cover incremental loading, compare/terminate flow, and invalid input validation, and revised README.md and package.json description to document usage and output.

Testing

  • Built core to ensure exports are resolvable with pnpm --filter @crawlith/core build, which completed successfully.
  • Built the plugin with pnpm --filter @crawlith/plugin-snapshot-diff build, which completed successfully (TypeScript validation passed).
  • Ran the plugin test suite with pnpm --filter @crawlith/plugin-snapshot-diff test, and all tests passed (4 tests passed).

Codex Task

@saurabhsharma2u
saurabhsharma2u merged commit a02eb59 into main Mar 3, 2026
1 of 7 checks passed
@saurabhsharma2u
saurabhsharma2u deleted the codex/redesign-snapshot-diff-plugin-to-compare-snapshots branch March 3, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant