Merge PR #76: Align OpenCode integration with current conventions
fix(opencode): align integration with current OpenCode conventions
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -69,7 +69,7 @@ NOTES.md
|
|||||||
integrations/antigravity/agency-*/
|
integrations/antigravity/agency-*/
|
||||||
integrations/gemini-cli/skills/
|
integrations/gemini-cli/skills/
|
||||||
integrations/gemini-cli/gemini-extension.json
|
integrations/gemini-cli/gemini-extension.json
|
||||||
integrations/opencode/agent/
|
integrations/opencode/agents/
|
||||||
integrations/cursor/rules/
|
integrations/cursor/rules/
|
||||||
integrations/aider/CONVENTIONS.md
|
integrations/aider/CONVENTIONS.md
|
||||||
integrations/windsurf/.windsurfrules
|
integrations/windsurf/.windsurfrules
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -392,7 +392,7 @@ The Agency works natively with Claude Code, and ships conversion + install scrip
|
|||||||
- **[Github Copilot](https://github.com/copilot)** — native `.md` agents, no conversion needed → `~/.github/agents/`
|
- **[Github Copilot](https://github.com/copilot)** — native `.md` agents, no conversion needed → `~/.github/agents/`
|
||||||
- **[Antigravity](https://github.com/google-gemini/antigravity)** — `SKILL.md` per agent → `~/.gemini/antigravity/skills/`
|
- **[Antigravity](https://github.com/google-gemini/antigravity)** — `SKILL.md` per agent → `~/.gemini/antigravity/skills/`
|
||||||
- **[Gemini CLI](https://github.com/google-gemini/gemini-cli)** — extension + `SKILL.md` files → `~/.gemini/extensions/agency-agents/`
|
- **[Gemini CLI](https://github.com/google-gemini/gemini-cli)** — extension + `SKILL.md` files → `~/.gemini/extensions/agency-agents/`
|
||||||
- **[OpenCode](https://opencode.ai)** — `.md` agent files → `.opencode/agent/`
|
- **[OpenCode](https://opencode.ai)** — `.md` agent files → `.opencode/agents/`
|
||||||
- **[Cursor](https://cursor.sh)** — `.mdc` rule files → `.cursor/rules/`
|
- **[Cursor](https://cursor.sh)** — `.mdc` rule files → `.cursor/rules/`
|
||||||
- **[Aider](https://aider.chat)** — single `CONVENTIONS.md` → `./CONVENTIONS.md`
|
- **[Aider](https://aider.chat)** — single `CONVENTIONS.md` → `./CONVENTIONS.md`
|
||||||
- **[Windsurf](https://codeium.com/windsurf)** — single `.windsurfrules` → `./.windsurfrules`
|
- **[Windsurf](https://codeium.com/windsurf)** — single `.windsurfrules` → `./.windsurfrules`
|
||||||
@@ -515,7 +515,7 @@ See [integrations/gemini-cli/README.md](integrations/gemini-cli/README.md) for d
|
|||||||
<details>
|
<details>
|
||||||
<summary><strong>OpenCode</strong></summary>
|
<summary><strong>OpenCode</strong></summary>
|
||||||
|
|
||||||
Agents are placed in `.opencode/agent/` in your project root (project-scoped).
|
Agents are placed in `.opencode/agents/` in your project root (project-scoped).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /your/project
|
cd /your/project
|
||||||
@@ -524,13 +524,13 @@ cd /your/project
|
|||||||
|
|
||||||
Or install globally:
|
Or install globally:
|
||||||
```bash
|
```bash
|
||||||
mkdir -p ~/.config/opencode/agent
|
mkdir -p ~/.config/opencode/agents
|
||||||
cp integrations/opencode/agent/*.md ~/.config/opencode/agent/
|
cp integrations/opencode/agents/*.md ~/.config/opencode/agents/
|
||||||
```
|
```
|
||||||
|
|
||||||
Activate in OpenCode:
|
Activate in OpenCode:
|
||||||
```
|
```
|
||||||
Use the Backend Architect agent to design this API.
|
@backend-architect design this API.
|
||||||
```
|
```
|
||||||
|
|
||||||
See [integrations/opencode/README.md](integrations/opencode/README.md) for details.
|
See [integrations/opencode/README.md](integrations/opencode/README.md) for details.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# OpenCode Integration
|
# OpenCode Integration
|
||||||
|
|
||||||
OpenCode uses the same agent format as Claude Code — `.md` files with YAML
|
OpenCode agents are `.md` files with YAML frontmatter stored in
|
||||||
frontmatter stored in `.opencode/agent/`. No conversion is technically
|
`.opencode/agents/`. The converter maps named colors to hex codes and adds
|
||||||
needed, but this integration packages the agents into the correct directory
|
`mode: subagent` so agents are invoked on-demand via `@agent-name` rather
|
||||||
structure for drop-in use.
|
than cluttering the primary agent picker.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
@@ -13,42 +13,46 @@ cd /your/project
|
|||||||
/path/to/agency-agents/scripts/install.sh --tool opencode
|
/path/to/agency-agents/scripts/install.sh --tool opencode
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates `.opencode/agent/<slug>.md` files in your project directory.
|
This creates `.opencode/agents/<slug>.md` files in your project directory.
|
||||||
|
|
||||||
## Activate an Agent
|
## Activate an Agent
|
||||||
|
|
||||||
In OpenCode, reference an agent by its name or description:
|
In OpenCode, invoke a subagent with the `@` prefix:
|
||||||
|
|
||||||
```
|
```
|
||||||
Use the Frontend Developer agent to help build this component.
|
@frontend-developer help build this component.
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
Activate the Reality Checker agent and review this PR.
|
@reality-checker review this PR.
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also select agents from the OpenCode UI's agent picker.
|
You can also select agents from the OpenCode UI's agent picker.
|
||||||
|
|
||||||
## Agent Format
|
## Agent Format
|
||||||
|
|
||||||
OpenCode agents use the same frontmatter as Claude Code:
|
Each generated agent file contains:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
name: Frontend Developer
|
name: Frontend Developer
|
||||||
description: Expert frontend developer specializing in modern web technologies...
|
description: Expert frontend developer specializing in modern web technologies...
|
||||||
color: cyan
|
mode: subagent
|
||||||
|
color: "#00FFFF"
|
||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **mode: subagent** — agent is available on-demand, not shown in the primary Tab-cycle list
|
||||||
|
- **color** — hex code (named colors from source files are converted automatically)
|
||||||
|
|
||||||
## Project vs Global
|
## Project vs Global
|
||||||
|
|
||||||
Agents in `.opencode/agent/` are **project-scoped**. To make them available
|
Agents in `.opencode/agents/` are **project-scoped**. To make them available
|
||||||
globally across all projects, copy them to your OpenCode config directory:
|
globally across all projects, copy them to your OpenCode config directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p ~/.config/opencode/agent
|
mkdir -p ~/.config/opencode/agents
|
||||||
cp integrations/opencode/agent/*.md ~/.config/opencode/agent/
|
cp integrations/opencode/agents/*.md ~/.config/opencode/agents/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Regenerate
|
## Regenerate
|
||||||
|
|||||||
@@ -127,25 +127,49 @@ ${body}
|
|||||||
HEREDOC
|
HEREDOC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Map named colors to hex codes for OpenCode (which only accepts hex values).
|
||||||
|
# Colors already starting with '#' pass through unchanged.
|
||||||
|
resolve_opencode_color() {
|
||||||
|
local c="$1"
|
||||||
|
case "$c" in
|
||||||
|
cyan) echo "#00FFFF" ;;
|
||||||
|
blue) echo "#3498DB" ;;
|
||||||
|
green) echo "#2ECC71" ;;
|
||||||
|
red) echo "#E74C3C" ;;
|
||||||
|
purple) echo "#9B59B6" ;;
|
||||||
|
orange) echo "#F39C12" ;;
|
||||||
|
teal) echo "#008080" ;;
|
||||||
|
indigo) echo "#6366F1" ;;
|
||||||
|
pink) echo "#E84393" ;;
|
||||||
|
gold) echo "#EAB308" ;;
|
||||||
|
amber) echo "#F59E0B" ;;
|
||||||
|
neon-green) echo "#10B981" ;;
|
||||||
|
neon-cyan) echo "#06B6D4" ;;
|
||||||
|
metallic-blue) echo "#3B82F6" ;;
|
||||||
|
*) echo "$c" ;; # already hex or unknown — pass through
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
convert_opencode() {
|
convert_opencode() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
local name description color slug outfile body
|
local name description color slug outfile body
|
||||||
|
|
||||||
name="$(get_field "name" "$file")"
|
name="$(get_field "name" "$file")"
|
||||||
description="$(get_field "description" "$file")"
|
description="$(get_field "description" "$file")"
|
||||||
color="$(get_field "color" "$file")"
|
color="$(resolve_opencode_color "$(get_field "color" "$file")")"
|
||||||
slug="$(slugify "$name")"
|
slug="$(slugify "$name")"
|
||||||
body="$(get_body "$file")"
|
body="$(get_body "$file")"
|
||||||
|
|
||||||
outfile="$OUT_DIR/opencode/agent/${slug}.md"
|
outfile="$OUT_DIR/opencode/agents/${slug}.md"
|
||||||
mkdir -p "$OUT_DIR/opencode/agent"
|
mkdir -p "$OUT_DIR/opencode/agents"
|
||||||
|
|
||||||
# OpenCode agent format: same as the source format (.md with frontmatter).
|
# OpenCode agent format: .md with YAML frontmatter in .opencode/agents/.
|
||||||
# color field is supported. No conversion needed beyond directory placement.
|
# Named colors are resolved to hex via resolve_opencode_color().
|
||||||
cat > "$outfile" <<HEREDOC
|
cat > "$outfile" <<HEREDOC
|
||||||
---
|
---
|
||||||
name: ${name}
|
name: ${name}
|
||||||
description: ${description}
|
description: ${description}
|
||||||
|
mode: subagent
|
||||||
color: ${color}
|
color: ${color}
|
||||||
---
|
---
|
||||||
${body}
|
${body}
|
||||||
|
|||||||
@@ -328,8 +328,8 @@ install_gemini_cli() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_opencode() {
|
install_opencode() {
|
||||||
local src="$INTEGRATIONS/opencode/agent"
|
local src="$INTEGRATIONS/opencode/agents"
|
||||||
local dest="${PWD}/.opencode/agent"
|
local dest="${PWD}/.opencode/agents"
|
||||||
local count=0
|
local count=0
|
||||||
[[ -d "$src" ]] || { err "integrations/opencode missing. Run convert.sh first."; return 1; }
|
[[ -d "$src" ]] || { err "integrations/opencode missing. Run convert.sh first."; return 1; }
|
||||||
mkdir -p "$dest"
|
mkdir -p "$dest"
|
||||||
|
|||||||
Reference in New Issue
Block a user