Skip to content

fix: include untracked files in diff patch for working-tree runs#45

Merged
dastratakos merged 2 commits into
mainfrom
dastratakos/fix-empty-chapters-untracked-files
May 14, 2026
Merged

fix: include untracked files in diff patch for working-tree runs#45
dastratakos merged 2 commits into
mainfrom
dastratakos/fix-empty-chapters-untracked-files

Conversation

@dastratakos
Copy link
Copy Markdown
Contributor

@dastratakos dastratakos commented May 14, 2026

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

  • Export hasStringStdout type guard from git.ts for reuse
  • Add async buildUntrackedPatch() helper in the diff route that lists untracked files and generates their diffs
  • Append untracked file patches to the response for WORKING_TREE/WORK runs

Testing

  • pnpm typecheck, pnpm lint, and pnpm test all pass
  • tested manually

Open in Stage

@stage-review
Copy link
Copy Markdown

stage-review Bot commented May 14, 2026

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Export git stdout type guard
2 Implement untracked file patch generation
3 Include untracked files in working-tree diffs
Open in Stage

Chapters generated by Stage for commit 179a4ef on May 14, 2026 1:43am UTC.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli/src/routes/diff.ts Outdated
Comment thread packages/cli/src/routes/diff.ts
@dastratakos dastratakos marked this pull request as ready for review May 14, 2026 01:40
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/cli/src/routes/diff.ts Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread packages/cli/src/routes/diff.ts
Comment thread packages/cli/src/routes/diff.ts
@dastratakos dastratakos merged commit b94c8b1 into main May 14, 2026
5 checks passed
@dastratakos dastratakos deleted the dastratakos/fix-empty-chapters-untracked-files branch May 14, 2026 02:00
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