Skip to content

feat: add pack-only compare mode - #208

Merged
mohanagy merged 1 commit into
mainfrom
mohanagy/issue-160-pack-only-compare
May 17, 2026
Merged

mohanagy merged 1 commit into
mainfrom
mohanagy/issue-160-pack-only-compare

Conversation

@mohanagy

@mohanagy mohanagy commented May 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add compare --baseline-mode pack_only to compare a bounded raw-context baseline against one compiled graphify pack
  • persist pack audit fields in compare reports and cover the new mode with CLI/runtime tests
  • update compare help text, README, proof workflows, and changelog

Test Plan

  • npm run typecheck
  • npm run build
  • npm run test:run

Summary by CodeRabbit

Release Notes

  • New Features

    • Added "pack_only" baseline mode for graphify-ts compare --baseline-mode pack_only, enabling A/B comparison between a bounded raw-context baseline and a compiled graphify pack with persisted audit metrics in report.json.
  • Documentation

    • Updated CLI help text, README, and workflow documentation with examples and guidance for the new pack_only comparison mode.

Review Change Stack

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 17, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7470f484-54ab-470a-94cf-5030059bd83a

📥 Commits

Reviewing files that changed from the base of the PR and between 849e3bb and 0dc7857.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • README.md
  • docs/proof-workflows.md
  • src/cli/main.ts
  • src/cli/parser.ts
  • src/infrastructure/compare.ts
  • tests/unit/cli.test.ts
  • tests/unit/compare.test.ts

📝 Walkthrough

Walkthrough

This PR adds a --baseline-mode pack_only option to graphify-ts compare, enabling side-by-side comparison of a bounded raw-context baseline prompt against a compiled graphify context pack. The implementation extends CLI parsing, adds compact retrieval metadata persistence to report.json, and aligns baseline token budgets with graphify prompt token counts.

Changes

Pack-only compare mode

Layer / File(s) Summary
CLI type declarations and parsing
src/cli/parser.ts, src/cli/main.ts
CompareCliOptions.baselineMode union expands to include pack_only. parseCompareBaselineMode accepts the new mode and parseCompareArgs maintains full as default while supporting pack_only selection via --baseline-mode. Help text updated to document all four baseline modes.
Compare infrastructure for pack_only mode
src/infrastructure/compare.ts
New CompareReportPack interface extends CompactRetrieveResult with optional audit fields. ComparePromptReport adds optional pack field. compareReportPackFromRetrieveResult converts retrieval results to compact pack metadata. buildBaselinePromptPack uses bounded excerpt logic for pack_only. generateCompareArtifacts refactored to compute project root and retrieval budget upfront, run retrieval before prompt building, set baseline token limit to graphify prompt token count for pack_only, and conditionally persist pack metadata in reports. formatCompareSummary includes synthetic-baseline disclosure for pack_only.
Tests and documentation
tests/unit/cli.test.ts, tests/unit/compare.test.ts, CHANGELOG.md, README.md, docs/proof-workflows.md
New CLI test verifies pack_only argument parsing. Existing help-text snapshot updated with pack_only option. New compare unit test exercises pack_only baseline mode, verifying bounded excerpt usage, token budget alignment, and persisted pack metadata (matched nodes, relationships, coverage, diagnostics). CHANGELOG, README, and proof-workflows docs updated to describe pack_only use case and behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • [P0][Compare] Add pack-only compare mode #160: PR implements the requested pack_only compare mode feature by adding CLI parsing, core infrastructure for bounded baselines with compact pack metadata persistence, and test coverage.

Possibly related PRs

  • mohanagy/graphify-ts#58: Both PRs modify compare artifact generation and session-aware token reporting in src/infrastructure/compare.ts, with this PR extending prior session/token refactors to support pack_only mode.
  • mohanagy/graphify-ts#19: Both PRs extend ComparePromptReport structure in src/infrastructure/compare.ts—this PR adds optional pack field for metadata persistence alongside prior usage-field extensions.

Poem

🐰 A baseline and pack, side by side,
Compare their tokens with truthful pride!
The compact audit fields now ride,
In report.json, we confide—
Pack-only wisdom, open and wide! 📦✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add pack-only compare mode' clearly and concisely describes the main change—introducing a new pack-only baseline mode for the compare command.
Description check ✅ Passed The description covers the key changes, includes a completed test plan matching the template requirements, but lacks a 'Related issues' section despite PR #208 being linked to issue #160.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mohanagy/issue-160-pack-only-compare

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant