pi-diff-review / 2026-04-06T00-14-41-662Z_3319d665-d224-434d-ae2b-0a8b1f989e26.jsonl
badlogicgames's picture
pi-share-hf upload 2026-04-06T02:00:34.440Z
ed2cea5 verified
|
Raw
History Blame Contribute Delete
134 kB
Pi trace
User 2026-04-06T00:14:46.493Z

anything you'd change in this project?

Assistant openai-codex/gpt-5.3-codex 2026-04-06T00:14:49.405Z 2,268↓ 114↑
23 tool calls (bash, read)
Assistant openai-codex/gpt-5.3-codex 2026-04-06T00:15:52.714Z 97↓ 1,041↑ (25,600 cached)

Yeah. After a quick pass, these are the main things I would change.

  1. Make git parsing robust in src/git.ts

    • Use -z output (git diff --name-status -z, ls-files -z, diff-tree -z) and parse NUL-delimited fields.
    • Current parsing uses trim() and split("\t"), which can break for odd but valid file names.
  2. Move binaryExtensions out of isReviewableFilePath in src/git.ts

    • It is recreated on every call.
    • Hoist it to a module-level const Set for less allocation pressure.
  3. Use a Set for currentPaths membership checks in src/git.ts

    • This line is currently currentPaths.includes(change.newPath) inside a loop.
    • For large repos, replace with const currentPathSet = new Set(currentPaths) and currentPathSet.has(...).
  4. Validate host/window messages in src/index.ts

    • const message = data as ReviewWindowMessage trusts unknown input.
    • Add runtime shape checks before branching to avoid malformed-message crashes.
  5. Add test coverage for core logic

    • src/git.ts: parseNameStatus, merge behavior, scope selection logic.
    • src/prompt.ts: prompt formatting and location formatting.
    • This project has high-value pure logic that is easy to unit test.
  6. Ignore local tooling artifacts

    • Add .pi/ to .gitignore (currently only node_modules/ and sessions/).
    • Prevents accidental commits of local agent/session data.
  7. Optional product improvement

    • Bundle Monaco/Tailwind locally instead of CDN in web/index.html.
    • Removes internet dependency and improves reliability in restricted environments.

If you want, I can turn this into a concrete prioritized patch plan (quick wins first, then structural changes).