Skip to content

check: add --base <ref> to scope changes to a branch #29

Closed

Description

@ElbertePlinio

pickcheck check --changed diffs the working tree against HEAD, so on a clean committed branch it checks nothing and exits 0. The pickcheck skill works around this with a git diff <base>...HEAD | xargs pickcheck check pipeline, which measures whole files instead of touched functions, and then asks for a second --changed run for uncommitted edits. A --base <ref> option makes one run cover the whole branch at function granularity.

Behavior

  • pickcheck check --base <ref> diffs the merge base of <ref> and HEAD against the working tree (git diff --merge-base <sha>). That covers branch commits plus staged and unstaged edits. It is the same three-dot rule as a GitHub PR diff, so a stacked branch based on its parent branch shows only its own functions. Untracked files stay included in full, as today.
  • --base implies --changed; passing both is accepted. Without --base, --changed is unchanged.
  • The ref is resolved once with git rev-parse --verify --quiet --end-of-options <ref>^{commit} and the SHA is what reaches git diff, so a ref starting with - cannot become an option.
  • An unresolvable ref, or no merge base (for example a shallow CI clone), exits 2 with a short error and does not scan. It never falls back to HEAD, since that would pass silently.
  • The summary DETAILS hint keeps the scope: pickcheck check --base <ref> --verbose <file>.
  • Hooks keep diffing against HEAD.
  • Existing Git hardening applies unchanged (no external diff or textconv, scrubbed GIT_* env, paths resolved against the repo root).

Checklist

  • docs/spec.md: usage line and the check section describe --base, its errors, and the hint
  • crates/core/src/diff.rs: changed_files takes an optional base and resolves it as above
  • crates/cli/src/main.rs and report.rs: the flag and the scoped DETAILS hint
  • crates/cli/tests/cli.rs: committed-only change is reported; committed plus uncommitted plus untracked in one run; functions touched only on the base branch after the fork are not reported; unknown ref and no merge base exit 2 without scanning; --base alone behaves like --changed --base; a stacked branch reports only its own functions; a ref like --output=x is rejected safely
  • README usage example
  • Release with the version bump and the exact pickcheck-core pin in crates/cli/Cargo.toml

Follow-up

After the release, update the pickcheck skill through agent-config-sync to run pickcheck check --base origin/main. That replaces the xargs range script and the separate uncommitted-work step, and the note about failures in untouched legacy functions of whole files goes away. The baseline comparison in #30 changes the skill further, so the skill update is tracked there.

Activity

  1. added
    enhancement
    on Sep 28, 2026
  2. changed the title [-]check: add --base <ref> to scope --changed to a branch[/-] [+]check: add --base <ref> to scope changes to a branch[/+] on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions