fix: include untracked files in diff patch for working-tree runs#45
Conversation
|
Ready to review this PR? Stage has broken it down into 3 individual chapters for you:
Chapters generated by Stage for commit 179a4ef on May 14, 2026 1:43am UTC. |
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to include untracked files in the diff output when the working tree is selected. It adds a new buildUntrackedPatch helper and updates the diff route to aggregate these patches. Feedback suggests several improvements to the new helper, including parallelizing the git commands for better performance, ensuring standard diff prefixes are used for consistency, and correctly capturing output when git exits with a zero status. There is also a recommendation to refactor this logic into the existing git utility module to reduce code duplication.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c823408219
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 179a4ef. Configure here.

Summary
Fixes a bug where chapters referencing new/untracked files appeared in the table of contents but rendered empty on the detail page. The diff API endpoint now includes untracked file diffs for working-tree WORK scope runs, matching the behavior used during chapter import.
Changes
hasStringStdouttype guard fromgit.tsfor reusebuildUntrackedPatch()helper in the diff route that lists untracked files and generates their diffsTesting
pnpm typecheck,pnpm lint, andpnpm testall pass