glaze converts git porcelain to JSON.
With Homebrew:
brew install foundry23/tap/glazeOr with Go:
go install github.com/foundry23/glaze@latestPipe git's output in and name the format with --origin:
git worktree list --porcelain | glaze --origin=git-worktree
git worktree list --porcelain -z | glaze --origin=git-worktreeglaze rejects anything that is not the origin format it was told to expect.
| Origin | Converts | Emits |
|---|---|---|
git-worktree |
git worktree list --porcelain [-z] |
JSON array of worktrees |
More are straightforward to add — see Adding an origin.
| Flag | Purpose | Required |
|---|---|---|
--origin |
format on stdin | Yes |
git worktree list --porcelain -z | glaze --origin=git-worktree | jq -r '.[].path' # every path
git worktree list --porcelain -z | glaze --origin=git-worktree | jq -r '.[] | select(.prunable) | .path' # directory has gone missing
git worktree list --porcelain -z | glaze --origin=git-worktree | jq -r '.[] | select(.branch_name) | .branch_name' # skip detached and bare-
Add a parser to
porcelain/, exported asParse<Thing>([]byte). Accept both delimiter forms by building on the sharedscanner, and return errors prefixed once with the git command's name. -
Register it in
origins.go:{ name: "git-status", parse: func(data []byte) (any, error) { return porcelain.ParseStatus(data) }, },
Each parser needs a unit test over captured bytes and an integration test that produces those bytes from git.
just build # go build -o glaze .
just fmt # goimports + gofumpt
just check # go vet + go test
just test-integration # drives the real git binary
just run # go run . (e.g. just run --origin=git-worktree)Contributions are welcome:
- Open an issue first for anything non-trivial so the approach can be agreed before you build it.
- Fork and branch, and add tests where it makes sense.
- Run
just checkbefore opening a PR. - Keep commits focused and the CI green.
AI-assisted contributions are welcome, but code must be reviewed by a human before being submitted.
Any contributions that have not obviously been reviewed by a human may be closed without comment or justification.
MIT.