feat(kiro): add Kiro CLI agent support#354
Conversation
Add kiro-cli to the dependency registry with custom install type. The Kiro CLI uses a native installer from cli.kiro.dev that places the binary in ~/.local/bin.
…MCP) - Add needsKiroInit detection via slices.Contains(imgNeeds.initProviders, "kiro") - Import providers/kiro for KiroAPIKeyPlaceholder in grantToPlaceholder - Add kiro cases to grantToEnvVar (KIRO_API_KEY) and grantToPlaceholder - Add full kiro PrepareContainer dispatch block after the gemini block, mirroring the codex/gemini pattern with credential lookup, remote MCP relay URL construction, local MCP server config, and cleanupAgentConfig chaining on all error paths - Add KiroConfigTempDir field to Run struct and assign/cleanup alongside GeminiConfigTempDir throughout the run lifecycle - Add cleanupAgentConfig(kiroConfig) to all downstream error paths that clean up geminiConfig (13 locations inside services/buildkit/container creation/storage/audit blocks) Wildcard finding (Step 4): gatekeeper v0.2.0 credential injection uses exact host-string map keys (proxy.go getCredentials), not the wildcard pattern matching used by the network firewall. The patterns q.*.amazonaws.com and *.q.*.amazonaws.com in kiroAPIHosts would never match real hostnames during credential injection. Changed kiroAPIHosts to the single concrete host "q.us-east-1.amazonaws.com". NetworkHosts() (firewall allowlist) still uses wildcard patterns for passthrough hosts since that path calls matchHost() which does support wildcards. Updated cli_test.go and constants.go accordingly; fixed prealloc lint in cli.go.
The kiro agent.go set MOAT_KIRO_INIT and mounted the staging dir, but moat-init.sh had no block to copy it into ~/.kiro at container startup, so cli.json/mcp.json/agents/steering never reached the container. Add a MOAT_KIRO_INIT block mirroring the gemini block, copying the settings/, agents/, and steering/ subdirectories. Caught in final holistic review; the implementation plan omitted this step.
|
Thanks for the patch. A few things before merging: Memory bug: Auth path: we're only injecting on Same spirit on the other kiro-cli assumptions the comments flag — the mcp.json key names and the Couple small ones: the CHANGELOG still has the Let's also fold these into this PR rather than follow-ups, since we're calling kiro a first-class agent: it shows up blank in |
Summary
Adds the Kiro CLI as a first-class Moat agent, at parity with the existing
Codex/Claude/Gemini providers: credential grant, transparent proxy credential
injection, container config staging, local + remote MCP, runtime-context
injection, and a
moat kirocommand.What's included
internal/providers/kiro/— agent + credential provider mirroring thecodex provider: proxy Bearer injection, token grant (env
KIRO_API_KEYorinteractive hidden-input prompt),
PrepareContainerstaging~/.kiro/{settings,agents,steering}, and themoat kirocommand.kiro-clidependency (registry + native installer),credential.ProviderKiro,kiro:moat.yaml section (sync_logs,mcp) +ShouldSyncKiroLogs, image-needs detection,manager.godispatch block(local + remote MCP relay, grant→env maps, cleanup/temp-dir lifecycle),
provider registration, and the
moat-init.shblock that copies the staged~/.kirotree into the container.(
docs/content/guides/14-kiro.md), and a CHANGELOG entry. Design spec andimplementation plan under
docs/plans/.Notable design decisions
KIRO_API_KEYenv), stored encrypted;static credential, no refresh — re-grant on expiry. The container only ever
sees a placeholder; the proxy injects the real token.
injection uses exact host-key lookups (no wildcard matching — verified
against
proxy.getCredentials).kiroAPIHostsis therefore scoped to theconcrete
q.us-east-1.amazonaws.com; additional regions are addedexplicitly (documented in code and the guide).
(
url+headers).Out of scope (intentional, documented in the spec)
Token refresh / OAuth device-login, persistent sessions volume, host
~/.kiro/skillslayering, kiro subagents in the default agent, and themoat initquickstart table (separate hand-maintained list — tracked as afollow-up).
Testing
go build ./...clean;make lint0 issues; all kiro-relevant packagespass under
-race.TestRegistryGithubBinaryURLsExist, which makes live requests togithub.com release URLs and fails in network-restricted environments
(fails identically on
main; unrelated to this change).moat kiroend-to-end.Test plan
moat grant kirostores a tokenmoat kiroruns an isolated session with credentials injectedkiro.mcp(local) and top-levelmcp:(remote relay) reach the agent~/.kiro/steering/🤖 Generated with Claude Code