Skip to content

feat(pi): add support for the Pi agent - #59

Merged
ralch[bot] merged 1 commit into
mainfrom
feat/pi-agent
Nov 26, 2026
Merged

ralch[bot] merged 1 commit into
mainfrom
feat/pi-agent

Conversation

@iamralch

Copy link
Copy Markdown
Contributor

Summary

Adds Pi (pi) as a supported AI agent alongside Claude, Codex, and Gemini.

  • New provider scripts/git_cmd_pi.sh
    • _get_pi_default_model returns empty: Pi has no single built-in model, so --model stays unset and Pi resolves its configured provider/credentials. ai.model still overrides when set.
    • _ask_pi runs a deterministic one-shot: --print --no-session --no-context-files --no-mcp --no-tools --no-extensions --no-skills --no-prompt-templates --no-approve, reading the rendered prompt from stdin. Errors go to stderr with the same git-ai: pi failed to generate a response shape as the codex/gemini providers.
  • Wiring: ai.agent=pi dispatch in _get_agent_default_model / _cmd_ask, dependency check (pi — https://pi.dev), devShell hint, README requirements/config/agent-defaults.
  • Tests: mocked pi, empty default model, flag/stdin assertions, model override, failure and empty-response cases, plus dependency-check coverage.

Implementation mirrors the pi provider already merged in gh-extensions/gh-ai#129. One deliberate divergence: gh-ai grants --tools read because its prompts reference repository files, while git-ai embeds the staged diff in the prompt and therefore disables tools entirely.

Usage

git config --global ai.agent pi
git config --global --unset ai.model   # optional: let Pi pick its model
git ai commit

Testing

  • nix develop --command bats tests/ — 43/43 passing
  • shellcheck -x -e SC1091 git-ai scripts/git_cmd.sh scripts/git_cmd_pi.sh — clean
  • Manual end-to-end against real pi in a scratch repo with ai.agent=pi returned the model response through scripts/git_cmd.sh ask

Also fixes tests/git_ai.bats PATH handling so the dependency tests run on NixOS, where /usr/bin has no coreutils.

Add a pi provider module that sends a deterministic one-shot prompt in
print mode with sessions, tools, extensions, skills, and project context
disabled, so commit messages derive only from the rendered diff.

Pi has no single built-in model: it resolves one from the configured
provider and credentials, so pi has no default model override and
`ai.model` is left unset by default.

Wire pi into agent and model resolution, dependency checks, the devShell
hint, and the configuration docs, and cover the provider with tests.
@iamralch iamralch added the auto-merge Enable auto-merge label Nov 26, 2026
@ralch
ralch Bot merged commit 60bcc9b into main Nov 26, 2026
4 checks passed
@ralch
ralch Bot deleted the feat/pi-agent branch November 26, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Enable auto-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant