Skip to content

feat(review): support --include-dirty flag to audit uncommitted changes#80

Open
AsishKumarDalal wants to merge 2 commits into
openclaw:mainfrom
AsishKumarDalal:feat/include-dirty-flag
Open

feat(review): support --include-dirty flag to audit uncommitted changes#80
AsishKumarDalal wants to merge 2 commits into
openclaw:mainfrom
AsishKumarDalal:feat/include-dirty-flag

Conversation

@AsishKumarDalal
Copy link
Copy Markdown

Summary

This Pull Request implements the --include-dirty flag for review, ci, and revalidate commands to allow auditing uncommitted (staged, unstaged, and untracked) files directly from the working tree without requiring them to be committed first.

Key Changes

  • src/git.ts: Introduced dirtyFiles(root: string): Promise<Set<string>> that executes git status --porcelain=v1 -z --untracked-files=all and robustly parses the NUL-terminated output, safely handling rename (R) and copy (C) actions with secondary target paths.
  • src/selection.ts: Updated limitFeatures to lift the default single-candidate constraint when --include-dirty is provided, similar to the behavior when --since is provided.
  • src/cli.ts: Registered includeDirty as a registered boolean command flag and exposed it in the help text and argument parsing limits for review, ci, and revalidate.
  • src/app.ts: Updated filterFeaturesByFilesSince and filterFindingsByOwnedFilesSince to compute the union of changed files (obtained from --since git differences) and dirty files (from --include-dirty unstaged worktree) so they can be seamlessly combined. Extended reviewFlagSubset to propagate includeDirty from CI runs to the nested review step.
  • src/workflow.test.ts: Added three integration tests to cover:
    1. Feature candidate selection based strictly on dirty files.
    2. Correct union behavior when --since and --include-dirty are both supplied.
    3. CLI-level argument parsing and execution with --include-dirty.

Validation

  • git diff --check
  • pnpm format:check
  • pnpm typecheck
  • pnpm lint
  • pnpm test (All tests passing)
  • pnpm build

…mands

Adds a new --include-dirty flag to the `review`, `ci`, and `revalidate`
commands that allows auditing uncommitted (staged, unstaged, and
untracked) files in the working tree without requiring a commit.

Changes:
- src/git.ts: adds dirtyFiles(root) that runs
  `git status --porcelain=v1 -z --untracked-files=all` and parses the
  NUL-delimited output, correctly handling rename/copy two-path entries.
- src/selection.ts: expands limitFeatures to treat --include-dirty like
  --since — lifting the default 1-feature cap so all touched features
  are processed.
- src/cli.ts: registers include-dirty as a boolean flag; adds it to the
  commandFlags allow-list for review, ci, and revalidate; documents it
  in the per-command help text.
- src/app.ts: filterFeaturesByFilesSince and
  filterFindingsByOwnedFilesSince now union changedFilesSince and
  dirtyFiles into a single Set, so --since and --include-dirty can be
  combined freely. reviewFlagSubset propagates includeDirty to the inner
  review call made by ci.
- src/workflow.test.ts: three new integration tests covering dirty-only
  selection, the --since ∪ --include-dirty union, and the CLI
  entrypoint path.

Closes: N/A
… help text for review/ci/revalidate; extend app.ts filter functions and reviewFlagSubset; add three workflow tests
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