feat(pig): add pig with Go extension ports #1

Open
hmajid2301 wants to merge 10 commits from feat/pig into main
Owner

Moved from GitLab !409 (https://gitlab.com/hmajid2301/nixicle/-/merge_requests/409).

Adds pig (PiG v0.7.0, the Go port of Pi) as its own den.aspects.pig aspect alongside pi, and ports our Pi extensions to Go standalone binaries built with buildGoModule (CGO_ENABLED=0). pi and its TS extensions are unchanged.

How it works

  • pig wrapper: --no-extensions + explicit -e list = Go ports, then the not-yet-ported TS extensions from home.file (minus replacedTsExtensions), then builtin:mcp|codemode|tool-search|pig-login. Subcommands bypass the flags.
  • The pi-claude-code TS package is not loaded (it hangs every prompt in PiG's Node runtime); the Go claude-code provider replaces it (same provider/model ids, chat only).
  • One template per extension: SDK glue in main.go, pure logic + table tests next to it; tests run in the Nix checkPhase. Shared internal/toolout for tool-output truncation.

Ported (each verified headless or in a tmux-driven pig TUI)

  • session-name
  • claude-code provider (chat; thinking level → --effort + summarized thinking; usage-credits guard, opt-in PI_CLAUDE_CODE_ALLOW_USAGE_CREDITS=1)
  • codegraph, ketch (tools + hidden preference hints)
  • tokens (also fixes the TS version reading a non-existent session dir)
  • footer, quotas (Zen usage URL fixed for pig's model base URLs)
  • db (tested against a real Postgres container)
  • nvim-edit (+ fix(neovim): plugin called readfile in a libuv fast event, so reviews never opened)
  • plan-mode incl. plan_tracker (differential-tested against the TS code)
  • treesitter: not ported, it is not loaded by pi today and is broken

Blockers (not in this MR yet)

  • security-guard, ask-user-question: blocked on the herdr/tuios agent-state decision (how "blocked on user" is signalled under pig). Until then pig still loads their TS versions.
  • pipelines: decided: Go redesign keeping every feature (herdr/TUIOS panes + in-process headless children, same-harness children, same on-disk layout), landed in 7 slices; the Go binary stays off the wrapper until the last slice, so pig keeps loading the TS version until then. /plan <goal> delegation comes in that last slice via the SDK event bus.
  • claude-code beyond chat (tool calls, native transcript, images, process reuse, model discovery): decided as full parity in Go, still to be built; until then tool-using work in pig needs a non-claude-code model.
  • Interactive checks by a human: theme, /model, codex login, tuios/herdr panes.
  • Upstream report of the pi-claude-code hang in PiG: waiting for approval to post.
  • Known PiG limits: kit.Editor in ctx.Custom can't be cancelled with Escape (ask-user-question will use kit.Input); PiG #497 avoided by not replacing the main editor.

Validation

  • deadnix / nixfmt / statix, gofmt, go vet, go test -race ./...
  • nix eval of desktop, framework, vps toplevel
  • wrapped pig built; per-port e2e notes are in the commit-linked tickets

Not deployed or activated.

Moved from GitLab !409 (https://gitlab.com/hmajid2301/nixicle/-/merge_requests/409). Adds `pig` (PiG v0.7.0, the Go port of Pi) as its own `den.aspects.pig` aspect alongside `pi`, and ports our Pi extensions to Go standalone binaries built with `buildGoModule` (`CGO_ENABLED=0`). `pi` and its TS extensions are unchanged. ## How it works - `pig` wrapper: `--no-extensions` + explicit `-e` list = Go ports, then the not-yet-ported TS extensions from `home.file` (minus `replacedTsExtensions`), then `builtin:mcp|codemode|tool-search|pig-login`. Subcommands bypass the flags. - The `pi-claude-code` TS package is not loaded (it hangs every prompt in PiG's Node runtime); the Go `claude-code` provider replaces it (same provider/model ids, chat only). - One template per extension: SDK glue in `main.go`, pure logic + table tests next to it; tests run in the Nix `checkPhase`. Shared `internal/toolout` for tool-output truncation. ## Ported (each verified headless or in a tmux-driven pig TUI) - [x] session-name - [x] claude-code provider (chat; thinking level → `--effort` + summarized thinking; usage-credits guard, opt-in `PI_CLAUDE_CODE_ALLOW_USAGE_CREDITS=1`) - [x] codegraph, ketch (tools + hidden preference hints) - [x] tokens (also fixes the TS version reading a non-existent session dir) - [x] footer, quotas (Zen usage URL fixed for pig's model base URLs) - [x] db (tested against a real Postgres container) - [x] nvim-edit (+ `fix(neovim)`: plugin called `readfile` in a libuv fast event, so reviews never opened) - [x] plan-mode incl. `plan_tracker` (differential-tested against the TS code) - treesitter: not ported, it is not loaded by pi today and is broken ## Blockers (not in this MR yet) - **security-guard, ask-user-question**: blocked on the herdr/tuios agent-state decision (how "blocked on user" is signalled under pig). Until then pig still loads their TS versions. - **pipelines**: decided: Go redesign keeping every feature (herdr/TUIOS panes + in-process headless children, same-harness children, same on-disk layout), landed in 7 slices; the Go binary stays off the wrapper until the last slice, so pig keeps loading the TS version until then. `/plan <goal>` delegation comes in that last slice via the SDK event bus. - **claude-code beyond chat** (tool calls, native transcript, images, process reuse, model discovery): decided as full parity in Go, still to be built; until then tool-using work in pig needs a non-claude-code model. - **Interactive checks by a human**: theme, `/model`, codex login, tuios/herdr panes. - **Upstream report** of the pi-claude-code hang in PiG: waiting for approval to post. - Known PiG limits: `kit.Editor` in `ctx.Custom` can't be cancelled with Escape (ask-user-question will use `kit.Input`); PiG #497 avoided by not replacing the main editor. ## Validation - deadnix / nixfmt / statix, `gofmt`, `go vet`, `go test -race ./...` - `nix eval` of desktop, framework, vps toplevel - wrapped `pig` built; per-port e2e notes are in the commit-linked tickets Not deployed or activated.
hmajid2301 force-pushed feat/pig from 0b8f94c1cf to 0c95bac922
Some checks failed
Lint / fmt (pull_request) Successful in 15s
Lint / lint (pull_request) Successful in 19s
Nix / build (nas) (pull_request) Failing after 33s
Nix / build (vps) (pull_request) Successful in 38s
Nix / build (desktop) (pull_request) Successful in 58s
OpenTofu / validate (pull_request) Successful in 27s
OpenTofu / plan (pull_request) Failing after 21s
OpenTofu / apply (pull_request) Has been skipped
Nix / eval (pull_request) Successful in 2m58s
Nix / repair (pull_request) Has been skipped
2026-11-29 11:02:04 +00:00
Compare
Some checks failed
Lint / fmt (pull_request) Successful in 15s
Lint / lint (pull_request) Successful in 19s
Nix / build (nas) (pull_request) Failing after 33s
Nix / build (vps) (pull_request) Successful in 38s
Nix / build (desktop) (pull_request) Successful in 58s
OpenTofu / validate (pull_request) Successful in 27s
OpenTofu / plan (pull_request) Failing after 21s
OpenTofu / apply (pull_request) Has been skipped
Nix / eval (pull_request) Successful in 2m58s
Nix / repair (pull_request) Has been skipped
Some required checks were not successful.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'feat/pig:feat/pig'
git switch 'feat/pig'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hmajid2301/nixicle!1
No description provided.