This file contains foundational mandates and instructions for AI agents working on multi-gitter-agent.
The application is structured to decouple the CLI logic, the multi-gitter orchestration, and the AI agent execution.
cmd/multi-gitter-agent/main.go: The entry point. It defines the Cobra CLI commands (runand the hiddenagentsubcommand).pkg/agent/: The core execution engine for AI models.agent.go: Defines the extensibleAgentinterface and theRegistrypattern.providers.go: Implementations for specific AI CLIs (Gemini, Claude, Copilot).runner.go: Orchestration logic for building and executing agent commands, including TUI and Silent modes.tui.go: The Bubble Tea interactive terminal dashboard.pty.go: A Pseudo-Terminal (PTY) wrapper essential for terminal stability (preventskqueue/isTTYcrashes in runtimes like Bun).
pkg/multigitter/: Library-level wrapper embeddinglindell/multi-gitter. It maps our CLI flags directly to the underlying engine.pkg/prompt/: Markdown prompt templates and Go templating logic via aRegistry.
- Terminal Stability: Always use the PTY wrapper (
pkg/agent/pty.go) when launching interactive agents. This satisfies strictisTTYchecks required by modern JS runtimes. - Concurrency Safety: If
concurrent > 1, agents must run viarunSilent()(no TUI, suppressedstdout/stderr) to prevent terminal display corruption. - Agent Mappings & YOLO:
- Gemini: Use
--prompt(automated) or--prompt-interactive(interactive). Use--yoloand--accept-raw-output-riskfor auto-approval. - Claude: Use
-p(prompt). Use--allow-dangerously-skip-permissionsand--dangerously-skip-permissionsfor auto-approval. - Copilot: Use
-p(prompt) and--yolofor auto-approval.
- Gemini: Use
- Actionability: The prompt template (
pkg/prompt/template.go) explicitly instructs workers to only modify files if the task is applicable. No modifications = No Pull Request. - Self-Contained Executable: Do not rely on external
multi-gitterbinaries. Always execute viacmd.RootCmd()embedded from the library.
- User executes
multi-gitter-agent run. - The
multigitterpackage translates options and invokes the internalmulti-gitterlibrary. - The library discovers repositories and, for each one, invokes the
multi-gitter-agent agentsubcommand as a child process. - The
agentsubcommand hijacks the terminal (using/dev/tty), initializes the Bubble Tea TUI, and launches the AI agent inside a PTY. - If the agent modifies files, the parent
multi-gitterprocess detects the diff, commits the changes, and opens a Pull Request.
- Use
gofmtandgoimports. - Document all exported symbols, structs, and packages.
- Prioritize modularity in
pkg/agent/to allow for adding new LLM providers effortlessly. - Use
testifyfor all unit testing.