Skip to content

feat(commitplan): add hunk-aware semantic commit planning - #121

Merged
morluto merged 2 commits into
mainfrom
feature/hunk-semantic-plan
Jul 23, 2026
Merged

feat(commitplan): add hunk-aware semantic commit planning#121
morluto merged 2 commits into
mainfrom
feature/hunk-semantic-plan

Conversation

@morluto

@morluto morluto commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Description

Contribution preparation could summarize changed files, but it could not represent two independent changes in one file or prove that a proposed commit split covered the exact workspace patch.

This adds a read-only two-step planning contract:

  1. inventory a bounded Git-owned patch into stable file/hunk units;
  2. validate agent-authored semantic groups against that frozen inventory.

The deterministic layer verifies one-to-one coverage, duplicate or missing assignments, dependency references and cycles, conventional commit subjects, metadata bounds, untracked-file ownership, and reconstruction digests. It reports generated, binary, rename/copy, whitespace-only, and untracked changes as explicit warnings. Semantic intent remains an agent/human judgment; the tool does not infer commit meaning, stage files, or rewrite history.

Unified-diff parsing uses the maintained sourcegraph/go-diff package instead of a custom parser. Workspace collection uses bounded, non-mutating Git reads and identifies untracked content by Git object ID without persisting file bodies.

MCP exposes separate inspect and build tools so an agent can freeze the patch before proposing groups and detect changes between those steps.

Closes #116.

Suggested review order

  1. internal/commitplan/planner.go and tests for parsing, unit identity, coverage, and dependency rules.
  2. internal/workspace/workspace.go for bounded patch/untracked inventory.
  3. Application and MCP adapters.
  4. Contract documentation and dependency update.

Testing

  • make verify
  • Regression coverage for multiple hunks in one file, binary/rename/untracked units, whitespace warnings, duplicate/missing assignment, dependency cycles, stale inventories, and no-write MCP behavior

Compatibility and scope

  • Storage and side-effect invariants remain intact
  • No unrelated cleanup or generated-output churn is included

The planner is advisory and read-only. Existing commit preparation remains unchanged.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit 8635b00 into main Jul 23, 2026
24 of 25 checks passed
@morluto
morluto deleted the feature/hunk-semantic-plan branch July 28, 2026 17:38
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.

[Feature] Add hunk-aware semantic commit planning for contribution preparation

1 participant