Skip to content

feat: Phase 1 diff/context extractor with parser hardening - #2

Merged
getdownandcode merged 5 commits into
mainfrom
feat
Sep 8, 2026
Merged

getdownandcode merged 5 commits into
mainfrom
feat

Conversation

@getdownandcode

Copy link
Copy Markdown
Owner

Overview

Implements Phase 1 diff/context extraction as specified in plan.md with complete ambient git isolation and parser hardening.

Changes Included

  1. DiffExtractor Core (src/gitmate/diff_extractor.py):
    • 3 extraction modes: staged (staged()), branch-to-branch (branch_comparison()), and rev range (rev_range()).
    • Structured FileDiff output with addition/deletion counts, status, patch text, and binary detection.
    • Built-in noise filters for lockfiles, minified files, bundle files, and user-configurable ignore_globs.
    • Complete ambient git config isolation: -c core.quotepath=false -c diff.mnemonicPrefix=false --src-prefix=a/ --dst-prefix=b/ --no-color --no-ext-diff --no-textconv.
    • Robust patch header and chunk parsing supporting filenames with spaces, UTF-8 unicode paths, pure renames, and copy (C) status codes.
  2. CLI & Config UX (src/gitmate/cli.py):
    • gitmate debug-diff command with --base, --from-ref, --to-ref, and --summary flags.
    • gitmate config show displays active ignore_globs.
    • Clean styled red errors for ConfigError, NotAGitRepo, and GitCommandError (exit code 1, no traceback).
  3. Test Suite:
    • 43 passing tests across unit, integration, and scratch-repo fixtures with hostile ambient git configuration (diff.mnemonicPrefix=true, diff.renames=false).

Verification

  • pytest: 43/43 passed
  • ruff check .: passed
  • ruff format --check .: passed
  • mypy src tests --strict: passed

- DiffExtractor with staged, three-dot branch, and rev-range modes over real git subprocess
- Explicit -M rename detection plus -z NUL-separated numstat parsing, merged keyed by path
- Gitignore-flavored ignore filters (dir prefixes, bare basenames) with user overrides
- debug-diff command with per-mode flags and --summary table-only output
- Scratch-repo fixtures with rename detection forced off; 33 tests green
@getdownandcode
getdownandcode merged commit 6bb1d3a into main Sep 8, 2026
2 checks passed
@getdownandcode
getdownandcode deleted the feat branch September 8, 2026 14:55
getdownandcode added a commit that referenced this pull request Sep 19, 2026
…d orchestrator consolidation

- #1 (Blocker): Fail loud with exit code 1 on git errors, budget cap breaches, and gh CLI errors across pr-summary and changelog CLI commands.
- #2: Prevent duplicate printing when no changes/commits exist by early returning None.
- #3: Route diagnostic warnings, budget alerts, and error messages to stderr console (err_console) to keep stdout clean for Unix piping.
- #4: Correctly parse and surface breaking changes (exclamation mark and BREAKING CHANGE: footers) in conventional commits and templates.
- #5: Bump changelog template to version 2, including from_ref..to_ref range and explicit release headers.
- #6: Support --title (-t) flag in pr-summary and propagate gh pr create failures.
- #7: Remove dead head argument from fallback PR summary.
- #8: Consolidate duplicate budget checking, safe telemetry recording, and heuristic token counters into orchestrator.py.
- #9: Enforce strict type hints with CommitLogEntry in fallback.py.
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