@mindfoldhq/trellis 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -11
- package/dist/cli/index.js +1 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +28 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/configurators/opencode.d.ts +24 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +73 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/workflow.d.ts +2 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +30 -1
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/templates/agents/bodies/check.md +91 -0
- package/dist/templates/agents/bodies/debug.md +102 -0
- package/dist/templates/agents/{dispatch.txt → bodies/dispatch.md} +17 -12
- package/dist/templates/agents/bodies/implement.md +94 -0
- package/dist/templates/agents/bodies/research.md +113 -0
- package/dist/templates/agents/index.d.ts +22 -15
- package/dist/templates/agents/index.d.ts.map +1 -1
- package/dist/templates/agents/index.js +125 -48
- package/dist/templates/agents/index.js.map +1 -1
- package/dist/templates/agents/metadata.d.ts +48 -0
- package/dist/templates/agents/metadata.d.ts.map +1 -0
- package/dist/templates/agents/metadata.js +101 -0
- package/dist/templates/agents/metadata.js.map +1 -0
- package/dist/templates/commands/claude/parallel.md.txt +199 -0
- package/dist/templates/commands/claude/start.md.txt +120 -55
- package/dist/templates/commands/common/onboard-developer.txt +2 -2
- package/dist/templates/commands/common/record-agent-flow.txt +1 -1
- package/dist/templates/commands/cursor/start.md.txt +92 -29
- package/dist/templates/commands/index.d.ts +2 -0
- package/dist/templates/commands/index.d.ts.map +1 -1
- package/dist/templates/commands/index.js +16 -0
- package/dist/templates/commands/index.js.map +1 -1
- package/dist/templates/commands/opencode/start.md.txt +127 -0
- package/dist/templates/markdown/agent-traces-index.md.txt +8 -9
- package/dist/templates/markdown/agents.md.txt +1 -1
- package/dist/templates/markdown/init-agent.md.txt +8 -8
- package/dist/templates/markdown/workflow.md.txt +6 -6
- package/dist/templates/scripts/add-session.sh.txt +14 -14
- package/dist/templates/scripts/common/developer.sh.txt +13 -13
- package/dist/templates/scripts/common/git-context.sh.txt +8 -8
- package/dist/templates/scripts/common/paths.sh.txt +4 -4
- package/dist/templates/scripts/common/worktree.sh.txt +138 -0
- package/dist/templates/scripts/feature.sh.txt +292 -0
- package/dist/templates/scripts/index.d.ts +12 -1
- package/dist/templates/scripts/index.d.ts.map +1 -1
- package/dist/templates/scripts/index.js +14 -1
- package/dist/templates/scripts/index.js.map +1 -1
- package/dist/templates/scripts/multi-agent/cleanup.sh.txt +327 -0
- package/dist/templates/scripts/multi-agent/start.sh.txt +323 -0
- package/dist/templates/scripts/multi-agent/status.sh.txt +423 -0
- package/dist/templates/scripts/worktree.yaml.txt +49 -0
- package/dist/types/ai-tools.d.ts +2 -2
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +4 -0
- package/dist/types/ai-tools.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/agents/check.txt +0 -120
- package/dist/templates/agents/debug.txt +0 -121
- package/dist/templates/agents/implement.txt +0 -114
- package/dist/templates/agents/research.txt +0 -258
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dispatch
|
|
3
|
-
description: |
|
|
4
|
-
Multi-Agent Pipeline main dispatcher. Pure dispatcher.
|
|
5
|
-
Does not write code directly, does not read spec/requirement files.
|
|
6
|
-
Only responsible for: calling subagents and scripts in phase order.
|
|
7
|
-
All context injection is handled by Hook, Dispatch just issues call commands.
|
|
8
|
-
tools: Read, Bash, Task, mcp__exa__web_search_exa, mcp__exa__get_code_context_exa
|
|
9
|
-
model: sonnet
|
|
10
|
-
---
|
|
11
|
-
|
|
12
1
|
# Dispatch Agent
|
|
13
2
|
|
|
14
3
|
You are the Dispatch Agent in the Multi-Agent Pipeline (pure dispatcher).
|
|
@@ -140,6 +129,22 @@ Task(
|
|
|
140
129
|
|
|
141
130
|
Hook will auto-inject complete finish-work.md content.
|
|
142
131
|
|
|
132
|
+
### action: "create-pr"
|
|
133
|
+
|
|
134
|
+
This action creates a Pull Request from the feature branch. Run it via Bash:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
./.trellis/scripts/feature.sh create-pr
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This will:
|
|
141
|
+
1. Stage and commit all changes (excluding agent-traces)
|
|
142
|
+
2. Push to origin
|
|
143
|
+
3. Create a Draft PR using `gh pr create`
|
|
144
|
+
4. Update feature.json with status="review" and pr_url
|
|
145
|
+
|
|
146
|
+
**Note**: This is the only action that performs git commit, as it's the final step after all implementation and checks are complete.
|
|
147
|
+
|
|
143
148
|
---
|
|
144
149
|
|
|
145
150
|
## Calling Subagents
|
|
@@ -196,6 +201,6 @@ If a subagent reports failure, read the output and decide:
|
|
|
196
201
|
## Key Constraints
|
|
197
202
|
|
|
198
203
|
1. **Do not read spec/requirement files directly** - Let Hook inject to subagents
|
|
199
|
-
2. **
|
|
204
|
+
2. **Only commit via create-pr action** - Use `feature.sh create-pr` at the end of pipeline
|
|
200
205
|
3. **All subagents should use opus model for complex tasks**
|
|
201
206
|
4. **Keep dispatch logic simple** - Complex logic belongs in subagents
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Implement Agent
|
|
2
|
+
|
|
3
|
+
You are the Implement Agent in the Trellis workflow.
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
Before implementing, read:
|
|
8
|
+
- `.trellis/workflow.md` - Project workflow
|
|
9
|
+
- `.trellis/structure/` - Development guidelines
|
|
10
|
+
- Feature `prd.md` - Requirements document
|
|
11
|
+
- Feature `info.md` - Technical design (if exists)
|
|
12
|
+
|
|
13
|
+
## Core Responsibilities
|
|
14
|
+
|
|
15
|
+
1. **Understand specs** - Read relevant spec files in `.trellis/structure/`
|
|
16
|
+
2. **Understand requirements** - Read prd.md and info.md
|
|
17
|
+
3. **Implement features** - Write code following specs and design
|
|
18
|
+
4. **Self-check** - Ensure code quality
|
|
19
|
+
5. **Report results** - Report completion status
|
|
20
|
+
|
|
21
|
+
## Forbidden Operations
|
|
22
|
+
|
|
23
|
+
**Do NOT execute these git commands:**
|
|
24
|
+
|
|
25
|
+
- `git commit`
|
|
26
|
+
- `git push`
|
|
27
|
+
- `git merge`
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Workflow
|
|
32
|
+
|
|
33
|
+
### 1. Understand Specs
|
|
34
|
+
|
|
35
|
+
Read relevant specs based on task type:
|
|
36
|
+
|
|
37
|
+
- Backend: `.trellis/structure/backend/`
|
|
38
|
+
- Frontend: `.trellis/structure/frontend/`
|
|
39
|
+
- Shared: `.trellis/structure/shared/`
|
|
40
|
+
|
|
41
|
+
### 2. Understand Requirements
|
|
42
|
+
|
|
43
|
+
Read the feature's prd.md and info.md:
|
|
44
|
+
|
|
45
|
+
- What are the core requirements
|
|
46
|
+
- Key points of technical design
|
|
47
|
+
- Which files to modify/create
|
|
48
|
+
|
|
49
|
+
### 3. Implement Features
|
|
50
|
+
|
|
51
|
+
- Write code following specs and technical design
|
|
52
|
+
- Follow existing code patterns
|
|
53
|
+
- Only do what's required, no over-engineering
|
|
54
|
+
|
|
55
|
+
### 4. Verify
|
|
56
|
+
|
|
57
|
+
Run verification checks:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pnpm lint
|
|
61
|
+
pnpm typecheck
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Report Format
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
## Implementation Complete
|
|
70
|
+
|
|
71
|
+
### Files Modified
|
|
72
|
+
|
|
73
|
+
- `src/components/Feature.tsx` - New component
|
|
74
|
+
- `src/hooks/useFeature.ts` - New hook
|
|
75
|
+
|
|
76
|
+
### Implementation Summary
|
|
77
|
+
|
|
78
|
+
1. Created Feature component...
|
|
79
|
+
2. Added useFeature hook...
|
|
80
|
+
|
|
81
|
+
### Verification Results
|
|
82
|
+
|
|
83
|
+
- Lint: Passed
|
|
84
|
+
- TypeCheck: Passed
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Code Standards
|
|
90
|
+
|
|
91
|
+
- Follow existing code patterns
|
|
92
|
+
- Don't add unnecessary abstractions
|
|
93
|
+
- Only do what's required, no over-engineering
|
|
94
|
+
- Keep code readable
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Research Agent
|
|
2
|
+
|
|
3
|
+
You are the Research Agent in the Trellis workflow.
|
|
4
|
+
|
|
5
|
+
## Core Principle
|
|
6
|
+
|
|
7
|
+
**You do one thing: find and explain information.**
|
|
8
|
+
|
|
9
|
+
You are a documenter, not a reviewer. Your job is to help get the information needed.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Core Responsibilities
|
|
14
|
+
|
|
15
|
+
### 1. Internal Search (Project Code)
|
|
16
|
+
|
|
17
|
+
| Search Type | Goal | Tools |
|
|
18
|
+
|-------------|------|-------|
|
|
19
|
+
| **WHERE** | Locate files/components | Glob, Grep |
|
|
20
|
+
| **HOW** | Understand code logic | Read, Grep |
|
|
21
|
+
| **PATTERN** | Discover existing patterns | Grep, Read |
|
|
22
|
+
|
|
23
|
+
### 2. External Search (Tech Solutions)
|
|
24
|
+
|
|
25
|
+
Use web search for best practices and code examples.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Strict Boundaries
|
|
30
|
+
|
|
31
|
+
### Only Allowed
|
|
32
|
+
|
|
33
|
+
- Describe **what exists**
|
|
34
|
+
- Describe **where it is**
|
|
35
|
+
- Describe **how it works**
|
|
36
|
+
- Describe **how components interact**
|
|
37
|
+
|
|
38
|
+
### Forbidden (unless explicitly asked)
|
|
39
|
+
|
|
40
|
+
- Suggest improvements
|
|
41
|
+
- Criticize implementation
|
|
42
|
+
- Recommend refactoring
|
|
43
|
+
- Modify any files
|
|
44
|
+
- Execute git commands
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Workflow
|
|
49
|
+
|
|
50
|
+
### Step 1: Understand Search Request
|
|
51
|
+
|
|
52
|
+
Analyze the query, determine:
|
|
53
|
+
|
|
54
|
+
- Search type (internal/external/mixed)
|
|
55
|
+
- Search scope (global/specific directory)
|
|
56
|
+
- Expected output (file list/code patterns/tech solutions)
|
|
57
|
+
|
|
58
|
+
### Step 2: Execute Search
|
|
59
|
+
|
|
60
|
+
Execute multiple independent searches in parallel for efficiency.
|
|
61
|
+
|
|
62
|
+
### Step 3: Organize Results
|
|
63
|
+
|
|
64
|
+
Output structured results in report format.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Report Format
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
## Search Results
|
|
72
|
+
|
|
73
|
+
### Query
|
|
74
|
+
|
|
75
|
+
{original query}
|
|
76
|
+
|
|
77
|
+
### Files Found
|
|
78
|
+
|
|
79
|
+
| File Path | Description |
|
|
80
|
+
|-----------|-------------|
|
|
81
|
+
| `src/services/xxx.ts` | Main implementation |
|
|
82
|
+
| `src/types/xxx.ts` | Type definitions |
|
|
83
|
+
|
|
84
|
+
### Code Pattern Analysis
|
|
85
|
+
|
|
86
|
+
{Describe discovered patterns, cite specific files and line numbers}
|
|
87
|
+
|
|
88
|
+
### Related Spec Documents
|
|
89
|
+
|
|
90
|
+
- `.trellis/structure/xxx.md` - {description}
|
|
91
|
+
|
|
92
|
+
### Not Found
|
|
93
|
+
|
|
94
|
+
{If some content was not found, explain}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Guidelines
|
|
100
|
+
|
|
101
|
+
### DO
|
|
102
|
+
|
|
103
|
+
- Provide specific file paths and line numbers
|
|
104
|
+
- Quote actual code snippets
|
|
105
|
+
- Distinguish "definitely found" and "possibly related"
|
|
106
|
+
- Explain search scope and limitations
|
|
107
|
+
|
|
108
|
+
### DON'T
|
|
109
|
+
|
|
110
|
+
- Don't guess uncertain info
|
|
111
|
+
- Don't omit important search results
|
|
112
|
+
- Don't add improvement suggestions in report (unless explicitly asked)
|
|
113
|
+
- Don't modify any files
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent templates for Multi-Agent Pipeline
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - research: Code and tech search expert
|
|
4
|
+
* Supports multiple output formats:
|
|
5
|
+
* - Claude Code: YAML frontmatter with name, description, tools (string), model
|
|
6
|
+
* - OpenCode: YAML frontmatter with description, tools (object)
|
|
7
|
+
*
|
|
8
|
+
* The agent body content is shared across formats.
|
|
10
9
|
*/
|
|
11
|
-
export declare const implementAgentTemplate: string;
|
|
12
|
-
export declare const checkAgentTemplate: string;
|
|
13
|
-
export declare const debugAgentTemplate: string;
|
|
14
|
-
export declare const researchAgentTemplate: string;
|
|
15
|
-
export declare const dispatchAgentTemplate: string;
|
|
16
10
|
/**
|
|
17
|
-
*
|
|
11
|
+
* Output format type
|
|
12
|
+
*/
|
|
13
|
+
export type AgentFormat = "claude" | "opencode";
|
|
14
|
+
/**
|
|
15
|
+
* Get full agent content with format-specific frontmatter
|
|
16
|
+
*/
|
|
17
|
+
export declare function getAgentContent(name: string, format: AgentFormat): string;
|
|
18
|
+
/**
|
|
19
|
+
* Agent template definition (for backwards compatibility)
|
|
18
20
|
*/
|
|
19
21
|
export interface AgentTemplate {
|
|
20
22
|
/** Agent name (used for filename) */
|
|
@@ -25,11 +27,16 @@ export interface AgentTemplate {
|
|
|
25
27
|
description: string;
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
|
-
* Get all agent templates
|
|
30
|
+
* Get all agent templates for a specific format
|
|
29
31
|
*/
|
|
30
|
-
export declare function getAllAgents(): AgentTemplate[];
|
|
32
|
+
export declare function getAllAgents(format?: AgentFormat): AgentTemplate[];
|
|
31
33
|
/**
|
|
32
34
|
* Get a specific agent template by name
|
|
33
35
|
*/
|
|
34
|
-
export declare function getAgentByName(name: string): AgentTemplate | undefined;
|
|
36
|
+
export declare function getAgentByName(name: string, format?: AgentFormat): AgentTemplate | undefined;
|
|
37
|
+
export declare const implementAgentTemplate: string;
|
|
38
|
+
export declare const checkAgentTemplate: string;
|
|
39
|
+
export declare const debugAgentTemplate: string;
|
|
40
|
+
export declare const researchAgentTemplate: string;
|
|
41
|
+
export declare const dispatchAgentTemplate: string;
|
|
35
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/agents/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;AAgFhD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,MAAM,CAiBzE;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAE,WAAsB,GAAG,aAAa,EAAE,CAU5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,WAAsB,GAC7B,aAAa,GAAG,SAAS,CAa3B;AAGD,eAAO,MAAM,sBAAsB,EAAE,MAGpC,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,MAA2C,CAAC;AAC7E,eAAO,MAAM,kBAAkB,EAAE,MAA2C,CAAC;AAC7E,eAAO,MAAM,qBAAqB,EAAE,MAGnC,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,MAGnC,CAAC"}
|
|
@@ -1,71 +1,148 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent templates for Multi-Agent Pipeline
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - research: Code and tech search expert
|
|
4
|
+
* Supports multiple output formats:
|
|
5
|
+
* - Claude Code: YAML frontmatter with name, description, tools (string), model
|
|
6
|
+
* - OpenCode: YAML frontmatter with description, tools (object)
|
|
7
|
+
*
|
|
8
|
+
* The agent body content is shared across formats.
|
|
10
9
|
*/
|
|
11
10
|
import { readFileSync } from "fs";
|
|
12
11
|
import { dirname, join } from "path";
|
|
13
12
|
import { fileURLToPath } from "url";
|
|
13
|
+
import { AGENT_METADATA, getAgentMetadata, getAgentNamesForFormat, } from "./metadata.js";
|
|
14
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
15
|
const __dirname = dirname(__filename);
|
|
16
16
|
/**
|
|
17
|
-
* Read an agent template
|
|
17
|
+
* Read an agent body template (without frontmatter)
|
|
18
18
|
*/
|
|
19
|
-
function
|
|
20
|
-
const filePath = join(__dirname,
|
|
19
|
+
function readAgentBody(name) {
|
|
20
|
+
const filePath = join(__dirname, "bodies", `${name}.md`);
|
|
21
21
|
return readFileSync(filePath, "utf-8");
|
|
22
22
|
}
|
|
23
|
-
// Agent templates
|
|
24
|
-
export const implementAgentTemplate = readAgent("implement.txt");
|
|
25
|
-
export const checkAgentTemplate = readAgent("check.txt");
|
|
26
|
-
export const debugAgentTemplate = readAgent("debug.txt");
|
|
27
|
-
export const researchAgentTemplate = readAgent("research.txt");
|
|
28
|
-
export const dispatchAgentTemplate = readAgent("dispatch.txt");
|
|
29
23
|
/**
|
|
30
|
-
*
|
|
24
|
+
* Format tools as Claude Code style (comma-separated string)
|
|
25
|
+
*/
|
|
26
|
+
function formatClaudeTools(tools) {
|
|
27
|
+
const toolNames = [];
|
|
28
|
+
if (tools.read)
|
|
29
|
+
toolNames.push("Read");
|
|
30
|
+
if (tools.write)
|
|
31
|
+
toolNames.push("Write");
|
|
32
|
+
if (tools.edit)
|
|
33
|
+
toolNames.push("Edit");
|
|
34
|
+
if (tools.bash)
|
|
35
|
+
toolNames.push("Bash");
|
|
36
|
+
if (tools.glob)
|
|
37
|
+
toolNames.push("Glob");
|
|
38
|
+
if (tools.grep)
|
|
39
|
+
toolNames.push("Grep");
|
|
40
|
+
// Add external tools for agents that have them
|
|
41
|
+
toolNames.push("mcp__exa__web_search_exa", "mcp__exa__get_code_context_exa");
|
|
42
|
+
return toolNames.join(", ");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Format tools as OpenCode style (YAML object)
|
|
31
46
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
name:
|
|
50
|
-
|
|
51
|
-
description
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
function formatOpenCodeTools(tools) {
|
|
48
|
+
const lines = [
|
|
49
|
+
` read: ${tools.read}`,
|
|
50
|
+
` write: ${tools.write}`,
|
|
51
|
+
` edit: ${tools.edit}`,
|
|
52
|
+
` bash: ${tools.bash}`,
|
|
53
|
+
` glob: ${tools.glob}`,
|
|
54
|
+
` grep: ${tools.grep}`,
|
|
55
|
+
];
|
|
56
|
+
return lines.join("\n");
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Generate Claude Code frontmatter
|
|
60
|
+
*/
|
|
61
|
+
function generateClaudeFrontmatter(meta) {
|
|
62
|
+
const lines = [
|
|
63
|
+
"---",
|
|
64
|
+
`name: ${meta.name}`,
|
|
65
|
+
`description: |`,
|
|
66
|
+
` ${meta.description}`,
|
|
67
|
+
`tools: ${formatClaudeTools(meta.tools)}`,
|
|
68
|
+
];
|
|
69
|
+
if (meta.model) {
|
|
70
|
+
lines.push(`model: ${meta.model}`);
|
|
71
|
+
}
|
|
72
|
+
lines.push("---", "");
|
|
73
|
+
return lines.join("\n");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generate OpenCode frontmatter
|
|
77
|
+
*
|
|
78
|
+
* OpenCode agents use:
|
|
79
|
+
* - description: Brief description of agent purpose
|
|
80
|
+
* - mode: subagent (invoked via @mention) | primary (cycled with Tab) | all
|
|
81
|
+
* - tools: Object with boolean values for each tool
|
|
82
|
+
*/
|
|
83
|
+
function generateOpenCodeFrontmatter(meta) {
|
|
84
|
+
const lines = [
|
|
85
|
+
"---",
|
|
86
|
+
`description: ${meta.description}`,
|
|
87
|
+
"mode: subagent",
|
|
88
|
+
"tools:",
|
|
89
|
+
formatOpenCodeTools(meta.tools),
|
|
90
|
+
"---",
|
|
91
|
+
"",
|
|
92
|
+
];
|
|
93
|
+
return lines.join("\n");
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get full agent content with format-specific frontmatter
|
|
97
|
+
*/
|
|
98
|
+
export function getAgentContent(name, format) {
|
|
99
|
+
const meta = getAgentMetadata(name);
|
|
100
|
+
if (!meta) {
|
|
101
|
+
throw new Error(`Unknown agent: ${name}`);
|
|
102
|
+
}
|
|
103
|
+
if (format === "opencode" && !meta.supportsOpenCode) {
|
|
104
|
+
throw new Error(`Agent ${name} does not support OpenCode format`);
|
|
105
|
+
}
|
|
106
|
+
const body = readAgentBody(name);
|
|
107
|
+
const frontmatter = format === "claude"
|
|
108
|
+
? generateClaudeFrontmatter(meta)
|
|
109
|
+
: generateOpenCodeFrontmatter(meta);
|
|
110
|
+
return frontmatter + body;
|
|
111
|
+
}
|
|
59
112
|
/**
|
|
60
|
-
* Get all agent templates
|
|
113
|
+
* Get all agent templates for a specific format
|
|
61
114
|
*/
|
|
62
|
-
export function getAllAgents() {
|
|
63
|
-
|
|
115
|
+
export function getAllAgents(format = "claude") {
|
|
116
|
+
const names = getAgentNamesForFormat(format);
|
|
117
|
+
return names.map((name) => {
|
|
118
|
+
const meta = AGENT_METADATA[name];
|
|
119
|
+
return {
|
|
120
|
+
name,
|
|
121
|
+
content: getAgentContent(name, format),
|
|
122
|
+
description: meta.description,
|
|
123
|
+
};
|
|
124
|
+
});
|
|
64
125
|
}
|
|
65
126
|
/**
|
|
66
127
|
* Get a specific agent template by name
|
|
67
128
|
*/
|
|
68
|
-
export function getAgentByName(name) {
|
|
69
|
-
|
|
129
|
+
export function getAgentByName(name, format = "claude") {
|
|
130
|
+
const meta = getAgentMetadata(name);
|
|
131
|
+
if (!meta)
|
|
132
|
+
return undefined;
|
|
133
|
+
if (format === "opencode" && !meta.supportsOpenCode) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
name,
|
|
138
|
+
content: getAgentContent(name, format),
|
|
139
|
+
description: meta.description,
|
|
140
|
+
};
|
|
70
141
|
}
|
|
142
|
+
// Legacy exports for backwards compatibility
|
|
143
|
+
export const implementAgentTemplate = getAgentContent("implement", "claude");
|
|
144
|
+
export const checkAgentTemplate = getAgentContent("check", "claude");
|
|
145
|
+
export const debugAgentTemplate = getAgentContent("debug", "claude");
|
|
146
|
+
export const researchAgentTemplate = getAgentContent("research", "claude");
|
|
147
|
+
export const dispatchAgentTemplate = getAgentContent("dispatch", "claude");
|
|
71
148
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/agents/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/agents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,GAGvB,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAOtC;;GAEG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;IACzD,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,KAAiB;IAC1C,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,KAAK,CAAC,KAAK;QAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,KAAK,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,KAAK,CAAC,IAAI;QAAE,SAAS,CAAC,IAAI,CA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AAQ;IAE9B,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAE5B,IAAI,MAAM,KAAK,UAAU,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC;QACtC,WAAW,EAAE,IAAI,CAAC,WAAW;KAC9B,CAAC;AACJ,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAW,eAAe,CAC3D,WAAW,EACX,QAAQ,CACT,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAW,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAW,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAW,eAAe,CAC1D,UAAU,EACV,QAAQ,CACT,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAW,eAAe,CAC1D,UAAU,EACV,QAAQ,CACT,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent metadata definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared metadata for all agents, used to generate format-specific frontmatter.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Tool permissions for agents
|
|
8
|
+
*/
|
|
9
|
+
export interface AgentTools {
|
|
10
|
+
read: boolean;
|
|
11
|
+
write: boolean;
|
|
12
|
+
edit: boolean;
|
|
13
|
+
bash: boolean;
|
|
14
|
+
glob: boolean;
|
|
15
|
+
grep: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Agent metadata
|
|
19
|
+
*/
|
|
20
|
+
export interface AgentMetadata {
|
|
21
|
+
/** Agent name */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Human-readable description */
|
|
24
|
+
description: string;
|
|
25
|
+
/** Tool permissions */
|
|
26
|
+
tools: AgentTools;
|
|
27
|
+
/** Preferred model (Claude format only) */
|
|
28
|
+
model?: "opus" | "sonnet" | "haiku";
|
|
29
|
+
/** Whether this agent is available for OpenCode */
|
|
30
|
+
supportsOpenCode: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* All agent metadata definitions
|
|
34
|
+
*/
|
|
35
|
+
export declare const AGENT_METADATA: Record<string, AgentMetadata>;
|
|
36
|
+
/**
|
|
37
|
+
* Get metadata for a specific agent
|
|
38
|
+
*/
|
|
39
|
+
export declare function getAgentMetadata(name: string): AgentMetadata | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Get all agent names
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAllAgentNames(): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Get agent names that support a specific format
|
|
46
|
+
*/
|
|
47
|
+
export declare function getAgentNamesForFormat(format: "claude" | "opencode"): string[];
|
|
48
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/templates/agents/metadata.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,KAAK,EAAE,UAAU,CAAC;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,mDAAmD;IACnD,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CA4ExD,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAExE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,QAAQ,GAAG,UAAU,GAC5B,MAAM,EAAE,CAIV"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent metadata definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared metadata for all agents, used to generate format-specific frontmatter.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* All agent metadata definitions
|
|
8
|
+
*/
|
|
9
|
+
export const AGENT_METADATA = {
|
|
10
|
+
implement: {
|
|
11
|
+
name: "implement",
|
|
12
|
+
description: "Code implementation expert. Understands specs and requirements, then implements features. No git commit allowed.",
|
|
13
|
+
tools: {
|
|
14
|
+
read: true,
|
|
15
|
+
write: true,
|
|
16
|
+
edit: true,
|
|
17
|
+
bash: true,
|
|
18
|
+
glob: true,
|
|
19
|
+
grep: true,
|
|
20
|
+
},
|
|
21
|
+
model: "opus",
|
|
22
|
+
supportsOpenCode: true,
|
|
23
|
+
},
|
|
24
|
+
check: {
|
|
25
|
+
name: "check",
|
|
26
|
+
description: "Code quality check expert. Reviews code changes against specs and self-fixes issues.",
|
|
27
|
+
tools: {
|
|
28
|
+
read: true,
|
|
29
|
+
write: true,
|
|
30
|
+
edit: true,
|
|
31
|
+
bash: true,
|
|
32
|
+
glob: true,
|
|
33
|
+
grep: true,
|
|
34
|
+
},
|
|
35
|
+
model: "opus",
|
|
36
|
+
supportsOpenCode: true,
|
|
37
|
+
},
|
|
38
|
+
debug: {
|
|
39
|
+
name: "debug",
|
|
40
|
+
description: "Issue fixing expert. Understands issues, fixes against specs, and verifies fixes. Precise fixes only.",
|
|
41
|
+
tools: {
|
|
42
|
+
read: true,
|
|
43
|
+
write: true,
|
|
44
|
+
edit: true,
|
|
45
|
+
bash: true,
|
|
46
|
+
glob: true,
|
|
47
|
+
grep: true,
|
|
48
|
+
},
|
|
49
|
+
model: "sonnet",
|
|
50
|
+
supportsOpenCode: true,
|
|
51
|
+
},
|
|
52
|
+
research: {
|
|
53
|
+
name: "research",
|
|
54
|
+
description: "Code and tech search expert. Pure research, no code modifications. Finds files, patterns, and tech solutions.",
|
|
55
|
+
tools: {
|
|
56
|
+
read: true,
|
|
57
|
+
write: false,
|
|
58
|
+
edit: false,
|
|
59
|
+
bash: false,
|
|
60
|
+
glob: true,
|
|
61
|
+
grep: true,
|
|
62
|
+
},
|
|
63
|
+
model: "haiku",
|
|
64
|
+
supportsOpenCode: true,
|
|
65
|
+
},
|
|
66
|
+
dispatch: {
|
|
67
|
+
name: "dispatch",
|
|
68
|
+
description: "Multi-Agent Pipeline main dispatcher. Pure dispatcher. Only responsible for calling subagents and scripts in phase order.",
|
|
69
|
+
tools: {
|
|
70
|
+
read: true,
|
|
71
|
+
write: false,
|
|
72
|
+
edit: false,
|
|
73
|
+
bash: true,
|
|
74
|
+
glob: false,
|
|
75
|
+
grep: false,
|
|
76
|
+
},
|
|
77
|
+
model: "sonnet",
|
|
78
|
+
supportsOpenCode: false, // OpenCode doesn't use dispatch pattern
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Get metadata for a specific agent
|
|
83
|
+
*/
|
|
84
|
+
export function getAgentMetadata(name) {
|
|
85
|
+
return AGENT_METADATA[name];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get all agent names
|
|
89
|
+
*/
|
|
90
|
+
export function getAllAgentNames() {
|
|
91
|
+
return Object.keys(AGENT_METADATA);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get agent names that support a specific format
|
|
95
|
+
*/
|
|
96
|
+
export function getAgentNamesForFormat(format) {
|
|
97
|
+
return Object.entries(AGENT_METADATA)
|
|
98
|
+
.filter(([_, meta]) => (format === "opencode" ? meta.supportsOpenCode : true))
|
|
99
|
+
.map(([name]) => name);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=metadata.js.map
|