Add OpenCode as a built-in TypeSection recipe that injects a beads
workflow section into AGENTS.md, following the same pattern as the
existing factory and codex recipes.
- Register 'opencode' in BuiltinRecipes (internal/recipes/recipes.go)
- Add cmd/bd/setup/opencode.go with Install/Check/Remove functions
- Wire up 'bd setup opencode' subcommand in cmd/bd/setup.go
- Add tests for install and check modes
Supports: bd setup opencode, bd setup opencode --check,
bd setup opencode --remove
Fixes steveyegge/beads#1321
Amp-Thread-ID: https://ampcode.com/threads/T-019cb569-6bbd-73fd-85a8-167984100b35
Co-authored-by: Amp <amp@ampcode.com>
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package setup
|
|
|
|
var opencodeIntegration = agentsIntegration{
|
|
name: "OpenCode",
|
|
setupCommand: "bd setup opencode",
|
|
readHint: "OpenCode reads AGENTS.md at the start of each session. Restart OpenCode if it is already running.",
|
|
}
|
|
|
|
var opencodeEnvProvider = defaultAgentsEnv
|
|
|
|
// InstallOpenCode installs OpenCode integration.
|
|
func InstallOpenCode() {
|
|
env := opencodeEnvProvider()
|
|
if err := installOpenCode(env); err != nil {
|
|
setupExit(1)
|
|
}
|
|
}
|
|
|
|
func installOpenCode(env agentsEnv) error {
|
|
return installAgents(env, opencodeIntegration)
|
|
}
|
|
|
|
// CheckOpenCode checks if OpenCode integration is installed.
|
|
func CheckOpenCode() {
|
|
env := opencodeEnvProvider()
|
|
if err := checkOpenCode(env); err != nil {
|
|
setupExit(1)
|
|
}
|
|
}
|
|
|
|
func checkOpenCode(env agentsEnv) error {
|
|
return checkAgents(env, opencodeIntegration)
|
|
}
|
|
|
|
// RemoveOpenCode removes OpenCode integration.
|
|
func RemoveOpenCode() {
|
|
env := opencodeEnvProvider()
|
|
if err := removeOpenCode(env); err != nil {
|
|
setupExit(1)
|
|
}
|
|
}
|
|
|
|
func removeOpenCode(env agentsEnv) error {
|
|
return removeAgents(env, opencodeIntegration)
|
|
}
|