Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ Alternatively, clone or copy the plugin files to one of these directories:

| Command | Description | Agent |
|---------|-------------|-------|
| `/agent-promote <name> <grade>` | Change the type of a plugin agent at runtime. Grades: `subagent`, `primary`, `all` | - |
| `/agent-promote <name> [grade]` | Promote an agent to primary (default) or specify grade: `subagent`, `primary`, `all` | - |
| `/agent-demote <name>` | Demote an agent to subagent | - |
| `/commit-push` | Stage, commit, and push changes with user confirmation | `build` |
| `/diff-summary [source] [target]` | Show working tree changes or diff between branches | - |
| `/doc-changes` | Update documentation based on uncommitted changes (new features only) | `doc-writer` |
Expand Down Expand Up @@ -232,34 +233,34 @@ Child sessions (2):

### agent-promote

Change the type of a plugin agent at runtime. Promotes subagents to primary agents (visible in Tab selection) or demotes them back.
Promote an agent to primary (default) or specify a grade.

#### Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | `string` | Yes | Name of the plugin agent (e.g., `rubber-duck`, `architect`) |
| `grade` | `string` | Yes | Target type: `subagent`, `primary`, or `all` |
| `grade` | `string` | No | Target type: `subagent`, `primary`, or `all` (default: `primary`) |

#### Grade Types

| Grade | Effect |
|-------|--------|
| `subagent` | Available only as a subagent (default for most agents) |
| `subagent` | Available only as a subagent |
| `primary` | Appears in Tab selection for direct use |
| `all` | Available both as primary and subagent |

#### Usage Examples

```bash
# Promote rubber-duck to use it directly via Tab
/agent-promote rubber-duck primary
# Promote rubber-duck to primary (default)
/agent-promote rubber-duck

# Make architect available everywhere
# Promote with explicit grade
/agent-promote architect all

# Revert code-reviewer to subagent only
/agent-promote code-reviewer subagent
# Demote back to subagent
/agent-demote rubber-duck
```

#### Notes
Expand Down
5 changes: 5 additions & 0 deletions command/agent-demote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
description: Demote an agent to subagent
---

Use the agent-promote tool with name=$1 and grade=subagent.
4 changes: 2 additions & 2 deletions command/agent-promote.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Change the type of an agent to primary, subagent or all
description: Promote an agent to primary (or specify grade)
---

Use the agent-promote tool to change agent $1 to grade $2.
Use the agent-promote tool to change agent $1 to grade $2. If no grade is provided, use primary.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencode-froggy",
"version": "0.5.0",
"version": "0.5.1",
"description": "OpenCode plugin with a hook layer (tool.before.*, session.idle...), agents (code-reviewer, doc-writer), and commands (/review-pr, /commit)",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
7 changes: 4 additions & 3 deletions src/tools/agent-promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ type Client = ReturnType<typeof createOpencodeClient>

export interface AgentPromoteArgs {
name: string
grade: string
grade?: string
}

export function createAgentPromoteTool(client: Client, pluginAgentNames: string[]) {
return tool({
description: "Change the type of an agent to primary, subagent or all",
args: {
name: tool.schema.string().describe("Name of the agent"),
grade: tool.schema.string().describe("Target type: 'subagent', 'primary', or 'all'"),
grade: tool.schema.string().optional().describe("Target type: 'subagent', 'primary', or 'all' (default: primary)"),
},
async execute(args: AgentPromoteArgs, _context: ToolContext) {
const { name, grade } = args
const { name } = args
const grade = args.grade?.trim() || "primary"

if (!validateGrade(grade)) {
return `Invalid grade "${grade}". Valid grades: ${VALID_GRADES.join(", ")}`
Expand Down
Loading