feat: real git introspection (changes, wip, file-diff, history ops)#2
Merged
feat: real git introspection (changes, wip, file-diff, history ops)#2
Conversation
… parse_diff_hunks, parse_status_porcelain_v2
…ff, branch_base_ahead_behind, wip_files, wip_file_diff, wip_patch
Fixes the "Format check" step on this PR's CI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fbi/git.gleam— shell-out wrapper (git -C repo_path) with typedGitErrorfbi/git/parse.gleam— pure text parsers: log porcelain, name-status, numstat, unified diff hunks, status porcelain v2fbi/git/repo.gleam— domain ops against the bare repo:commits_on_branch,commit_files,file_diff,branch_base_ahead_behind,wip_files/wip_file_diff/wip_patch(readingrefs/fbi/wip-snapshot)fbi/git/mutex.gleam— per-run OTP actor serialising concurrent history opsfbi/git/history_ops.gleam—squash_local,mirror_rebase,sync_in_container,merge_in_container,dispatch_polish,dispatch_merge_conflictfbi/handlers/history.gleam— realPOST /api/runs/:id/historydispatching all five opshandlers/changes.gleam— real/changes,/commits/:sha/files,/file-diffhandlers/wip.gleam— real/wip,/wip/file,/wip/patch,/wip/discard(viadocker exec)docker.gleam—exec_container(create → start → inspect exec lifecycle)db/runs.gleam—children_of,insert_polish_run,insert_merge_conflict_run,count_active_childrencontext.gleam/fbi.gleam—history_mutexfield; actor started at bootpriv/static/wip-snapshotter.sh— in-container daemon writingrefs/fbi/wip-snapshotto safeguard every 5 ssupervisor.sh— starts snapshotter; handlespolish/merge-conflictkindsrun/worker.gleam— binds snapshotter + polish-prompt into containers; exportsFBI_KINDAll stub handlers replaced. 67 tests pass (2 pre-existing NIF failures unrelated to this change).
Test plan
gleam test— 67 passed, 2 pre-existing failures onlyGET /api/runs/:id/changesreturnsbranch_name,commits[],branch_base,uncommitted[],children[]GET /api/runs/:id/commits/:sha/filesreturns real file list with status + line countsGET /api/runs/:id/file-diff?path=...&ref=<sha>returns hunk listGET /api/runs/:id/wipreturnsok: truewith files once snapshotter has fired (≥5 s after container start)POST /api/runs/:id/wip/discardclears working-tree changes viadocker execPOST /api/runs/:id/historywith{"op":"polish"}spawns a child run and returns{"kind":"agent","child_run_id":N}🤖 Generated with Claude Code