Expand description
The git engine: read-only status/branches plus checkout/create-branch/
commit-push, all shelling git against a caller-supplied cwd. This is the
“reads/runs what-is, no policy” half of the workspace primitive; the axum
HTTP handlers that call these functions stay in Core (server wiring), as do
the pure-filesystem /api/workspace/{new-folder,list} handlers (they shell
no git — node-fs, kernel-owned).
Structs§
- Commit
Push Outcome - Shaped
POST /api/git/commit-pushresult: what the action actually did. - GitBranches
- Shaped
GET /api/git/branchesresult: local branches plus the current one. - GitState
- Shaped
GET /api/git/statusresult: the working-tree state of a repo cwd.
Functions§
- checkout_
branch - Switch
cwdto an existing local branch viagit switch. - create_
branch - Create a new branch off the current HEAD and switch to it (
git switch -c). - list_
branches - List local branches plus the currently checked-out one for
cwd. Returnsis_repo:falsewhencwdis not a git repository. - query_
git_ state - Compute the working-tree state for
cwd(branch, ahead/behind, dirty, diff totals). Returnsis_repo:falsewhencwdis not a git repository. - run_
git_ action - Commit, push, or do both for
cwd.actionis one ofcommit,commit-push, orpush(validated by the caller). Wheninclude_unstagedis set, stages everything before committing. Returns the raw git stderr on any failure.