@iservu-inc/adf-cli 0.12.11 → 0.13.0
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/.claude/settings.local.json +6 -1
- package/CHANGELOG.md +102 -0
- package/bin/adf.js +72 -0
- package/lib/commands/guide.js +449 -0
- package/lib/generators/opencode-generator.js +241 -81
- package/package.json +1 -1
|
@@ -18,7 +18,12 @@
|
|
|
18
18
|
"WebFetch(domain:github.com)",
|
|
19
19
|
"WebFetch(domain:antigravity.google)",
|
|
20
20
|
"WebSearch",
|
|
21
|
-
"Bash(node -c:*)"
|
|
21
|
+
"Bash(node -c:*)",
|
|
22
|
+
"mcp__MCP_DOCKER__brave_web_search",
|
|
23
|
+
"Bash(adf guide:*)",
|
|
24
|
+
"WebFetch(domain:docs.windsurf.com)",
|
|
25
|
+
"mcp__MCP_DOCKER__resolve-library-id",
|
|
26
|
+
"mcp__MCP_DOCKER__get-library-docs"
|
|
22
27
|
],
|
|
23
28
|
"deny": [],
|
|
24
29
|
"ask": []
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,108 @@ All notable changes to `@iservu-inc/adf-cli` will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.13.0] - 2026-01-03
|
|
9
|
+
|
|
10
|
+
### 🚀 Major Feature - OpenCode Multi-Agent Integration
|
|
11
|
+
|
|
12
|
+
**Minor Release:** Enhanced OpenCode CLI integration with multi-provider, multi-agent support.
|
|
13
|
+
|
|
14
|
+
#### Added
|
|
15
|
+
|
|
16
|
+
**OpenCode Multi-Agent System:**
|
|
17
|
+
- ✨ **Complete OpenCode generator rewrite** using official configuration schema
|
|
18
|
+
- ✨ **Multi-provider support** - Automatically detects and configures all available AI providers from `.adf/.env`:
|
|
19
|
+
- Anthropic (Claude models)
|
|
20
|
+
- OpenAI (GPT models)
|
|
21
|
+
- Google Gemini (Gemini models)
|
|
22
|
+
- OpenRouter (100+ models)
|
|
23
|
+
- ✨ **Multi-agent configuration** - Creates specialized agents based on ADF framework level:
|
|
24
|
+
- **Rapid (PRP)**: dev, qa agents
|
|
25
|
+
- **Balanced (Spec-Kit)**: analyst, pm, dev, qa agents
|
|
26
|
+
- **Comprehensive (BMAD)**: analyst, pm, architect, sm, dev, qa agents
|
|
27
|
+
- ✨ **Optimal model assignment** - Each agent gets the best model for its task complexity:
|
|
28
|
+
- Powerful models (Sonnet/GPT-5/Gemini-2.5-Pro) → analyst, architect
|
|
29
|
+
- Balanced models (Haiku/GPT-4o/Gemini-1.5-Pro) → pm, dev
|
|
30
|
+
- Fast models (Haiku/GPT-4o-mini/Gemini-Flash) → qa, sm
|
|
31
|
+
- ✨ **MCP server integration** - Auto-configures filesystem access via Model Context Protocol
|
|
32
|
+
- ✨ **Auto-loads AGENTS.md** - References universal agent manifest and session outputs via `instructions` field
|
|
33
|
+
- ✨ **Tool permissions** - Agent-specific tool access (e.g., QA can't write production code)
|
|
34
|
+
|
|
35
|
+
**Incremental Deployment:**
|
|
36
|
+
- 📝 **Documented incremental tool deployment** - Add tools anytime with `adf deploy <tool>` without reinitializing
|
|
37
|
+
|
|
38
|
+
**Accurate Documentation:**
|
|
39
|
+
- 📖 **Updated OpenCode guide** with verified information from https://opencode.ai/docs
|
|
40
|
+
- 📖 Installation: `npm install -g opencode-ai@latest`
|
|
41
|
+
- 📖 Configuration schema: https://opencode.ai/config.json
|
|
42
|
+
- 📖 Multi-agent support highlighted in guide
|
|
43
|
+
|
|
44
|
+
#### Technical Details
|
|
45
|
+
|
|
46
|
+
**Modified Files:**
|
|
47
|
+
- `lib/generators/opencode-generator.js` - Complete rewrite (300+ lines)
|
|
48
|
+
- `getAvailableProviders()` - Detects providers from `.adf/.env`
|
|
49
|
+
- `generateProviderConfigurations()` - Creates provider configs with env var substitution
|
|
50
|
+
- `generateAgentConfigurations()` - Maps ADF agents to OpenCode agents
|
|
51
|
+
- `getOptimalModelForAgent()` - Selects best model per agent type
|
|
52
|
+
- `lib/commands/guide.js` - Updated OpenCode guide with accurate info
|
|
53
|
+
- `lib/commands/deploy.js` - Already integrated (no changes needed)
|
|
54
|
+
|
|
55
|
+
#### Impact
|
|
56
|
+
- ✅ OpenCode leverages ALL configured AI providers automatically
|
|
57
|
+
- ✅ Cost-effective: Each agent uses optimal model for its task
|
|
58
|
+
- ✅ Follows official OpenCode v1.0+ configuration standards
|
|
59
|
+
- ✅ Seamless integration with ADF's multi-provider AI system
|
|
60
|
+
- ✅ No breaking changes - existing deployments unaffected
|
|
61
|
+
|
|
62
|
+
## [0.12.14] - 2025-12-23
|
|
63
|
+
|
|
64
|
+
### 🐛 Fix - Windsurf Character Limit
|
|
65
|
+
|
|
66
|
+
**Patch Release:** Corrected Windsurf rule file character limit in guide.
|
|
67
|
+
|
|
68
|
+
#### Fixed
|
|
69
|
+
|
|
70
|
+
**Windsurf Guide Correction:**
|
|
71
|
+
- 🔧 **Fixed character limit** from 6000 to **12000 characters** per rule file
|
|
72
|
+
- Verified against official documentation: https://docs.windsurf.com/windsurf/cascade/memories
|
|
73
|
+
- Added documentation link to guide for reference
|
|
74
|
+
|
|
75
|
+
#### Impact
|
|
76
|
+
- ✅ Accurate character limit for `.windsurf/rules/*.md` files
|
|
77
|
+
- ✅ Users won't incorrectly split files at 6000 chars
|
|
78
|
+
- ✅ Guide now matches official Windsurf documentation
|
|
79
|
+
|
|
80
|
+
## [0.12.13] - 2025-12-23
|
|
81
|
+
|
|
82
|
+
### 🐛 Critical Fix - Guide System Accuracy
|
|
83
|
+
|
|
84
|
+
**Patch Release:** Fixed hallucinated information in `adf guide` command. All tool setup guides now use verified information from official documentation.
|
|
85
|
+
|
|
86
|
+
#### Fixed
|
|
87
|
+
|
|
88
|
+
**Guide System Overhaul:**
|
|
89
|
+
- 🔧 **Replaced all hallucinated content** with accurate information verified via official documentation
|
|
90
|
+
- Fixed installation commands, usage instructions, and file paths for all 9 supported tools
|
|
91
|
+
- All guides now reference real, working documentation and commands
|
|
92
|
+
|
|
93
|
+
**Tool-Specific Corrections:**
|
|
94
|
+
- **Windsurf**: Accurate `.windsurf/rules/*.md` format (6000 char limit per file)
|
|
95
|
+
- **Cursor**: Correct `.cursor/rules/*.mdc` format with YAML frontmatter
|
|
96
|
+
- **VS Code**: Verified `.github/copilot-instructions.md` usage with GitHub Copilot
|
|
97
|
+
- **Zed**: Accurate `settings.json` and MCP configuration details
|
|
98
|
+
- **Antigravity**: Correct "... → Customizations" menu instructions
|
|
99
|
+
- **Claude Code**: Real install script: `curl -fsSL https://claude.ai/install.sh | bash`
|
|
100
|
+
- **OpenCode**: GitHub repo reference, GitHub Copilot authentication requirement
|
|
101
|
+
- **Gemini CLI**: Correct package `@google/gemini-cli` and command `gemini` (not `gemini-cli`)
|
|
102
|
+
- **DeepAgent**: Correct package `@abacus-ai/cli` and command `abacusai` (not `deepagent`)
|
|
103
|
+
|
|
104
|
+
#### Impact
|
|
105
|
+
- ✅ Users can now trust guide information to be accurate
|
|
106
|
+
- ✅ Installation commands actually work as documented
|
|
107
|
+
- ✅ File paths and configurations match official tool documentation
|
|
108
|
+
- ✅ No more "command not found" errors from following guides
|
|
109
|
+
|
|
8
110
|
## [0.12.10] - 2025-12-23
|
|
9
111
|
|
|
10
112
|
### 🐛 Critical Bug Fixes
|
package/bin/adf.js
CHANGED
|
@@ -20,6 +20,7 @@ const initCommand = require('../lib/commands/init');
|
|
|
20
20
|
const deployCommand = require('../lib/commands/deploy');
|
|
21
21
|
const updateCommand = require('../lib/commands/update');
|
|
22
22
|
const configCommand = require('../lib/commands/config');
|
|
23
|
+
const guideCommand = require('../lib/commands/guide');
|
|
23
24
|
|
|
24
25
|
const program = new Command();
|
|
25
26
|
|
|
@@ -41,6 +42,9 @@ ${chalk.cyan.bold('Quick Start:')}
|
|
|
41
42
|
${chalk.gray('3. Deploy to your AI coding assistant')}
|
|
42
43
|
$ adf deploy
|
|
43
44
|
|
|
45
|
+
${chalk.gray('4. Get setup instructions for your tool')}
|
|
46
|
+
$ adf guide <tool>
|
|
47
|
+
|
|
44
48
|
${chalk.cyan.bold('What is ADF?')}
|
|
45
49
|
AgentDevFramework (ADF) is an AI-assisted development framework that helps
|
|
46
50
|
you gather requirements through intelligent AI-guided interviews. It supports
|
|
@@ -61,9 +65,14 @@ ${chalk.cyan.bold('Getting Help:')}
|
|
|
61
65
|
${chalk.gray('# Detailed help for specific commands')}
|
|
62
66
|
$ adf init --help
|
|
63
67
|
$ adf deploy --help
|
|
68
|
+
$ adf guide --help
|
|
64
69
|
$ adf config --help
|
|
65
70
|
$ adf update --help
|
|
66
71
|
|
|
72
|
+
${chalk.gray('# Get tool-specific setup guides')}
|
|
73
|
+
$ adf guide windsurf
|
|
74
|
+
$ adf guide claude-code
|
|
75
|
+
|
|
67
76
|
${chalk.gray('# Check version and install path')}
|
|
68
77
|
$ adf --version
|
|
69
78
|
|
|
@@ -304,6 +313,69 @@ ${chalk.cyan.bold('Backwards Compatibility:')}
|
|
|
304
313
|
`)
|
|
305
314
|
.action(updateCommand);
|
|
306
315
|
|
|
316
|
+
// adf guide
|
|
317
|
+
program
|
|
318
|
+
.command('guide [tool]')
|
|
319
|
+
.description('Show setup guide for deployed tools')
|
|
320
|
+
.addHelpText('after', `
|
|
321
|
+
${chalk.cyan.bold('Description:')}
|
|
322
|
+
Get detailed setup and usage instructions for AI tools after deployment.
|
|
323
|
+
Shows what files were generated, how to configure the tool, and how to start using it.
|
|
324
|
+
|
|
325
|
+
${chalk.cyan.bold('Command Syntax:')}
|
|
326
|
+
${chalk.white('adf guide [tool]')}
|
|
327
|
+
|
|
328
|
+
${chalk.yellow('[tool]')} - (Optional) Tool name
|
|
329
|
+
If omitted, shows list of available guides
|
|
330
|
+
|
|
331
|
+
${chalk.cyan.bold('Available Tools:')}
|
|
332
|
+
${chalk.yellow('windsurf')} - Codeium Windsurf IDE
|
|
333
|
+
${chalk.yellow('cursor')} - Cursor AI IDE
|
|
334
|
+
${chalk.yellow('vscode')} - Visual Studio Code with GitHub Copilot
|
|
335
|
+
${chalk.yellow('zed')} - Zed Editor
|
|
336
|
+
${chalk.yellow('antigravity')} - Google Antigravity
|
|
337
|
+
${chalk.yellow('claude-code')} - Claude Code CLI
|
|
338
|
+
${chalk.yellow('opencode')} - OpenCode CLI
|
|
339
|
+
${chalk.yellow('gemini-cli')} - Google Gemini CLI
|
|
340
|
+
${chalk.yellow('deepagent')} - Abacus.ai DeepAgent
|
|
341
|
+
|
|
342
|
+
${chalk.cyan.bold('What You\'ll Learn:')}
|
|
343
|
+
• Which files were generated and what they do
|
|
344
|
+
• How to configure the tool to use ADF outputs
|
|
345
|
+
• How to start coding with AI assistance
|
|
346
|
+
• MCP server setup (if applicable)
|
|
347
|
+
• Keyboard shortcuts and workflows
|
|
348
|
+
• Troubleshooting common issues
|
|
349
|
+
|
|
350
|
+
${chalk.cyan.bold('Examples:')}
|
|
351
|
+
${chalk.gray('# List all available guides')}
|
|
352
|
+
$ adf guide
|
|
353
|
+
|
|
354
|
+
${chalk.gray('# Get Windsurf setup instructions')}
|
|
355
|
+
$ adf guide windsurf
|
|
356
|
+
|
|
357
|
+
${chalk.gray('# Learn how to use Claude Code CLI')}
|
|
358
|
+
$ adf guide claude-code
|
|
359
|
+
|
|
360
|
+
${chalk.gray('# See Gemini CLI integration steps')}
|
|
361
|
+
$ adf guide gemini-cli
|
|
362
|
+
|
|
363
|
+
${chalk.cyan.bold('Workflow:')}
|
|
364
|
+
1. Run ${chalk.white('adf init')} to gather requirements
|
|
365
|
+
2. Run ${chalk.white('adf deploy <tool>')} to deploy configurations
|
|
366
|
+
3. Run ${chalk.white('adf guide <tool>')} to learn how to use the tool
|
|
367
|
+
4. Start coding with AI assistance!
|
|
368
|
+
|
|
369
|
+
${chalk.cyan.bold('What\'s in a Guide:')}
|
|
370
|
+
• 📁 Generated files with status check (✓ exists / ✗ missing)
|
|
371
|
+
• ⚙️ Step-by-step setup instructions
|
|
372
|
+
• 🔌 MCP server configuration (if applicable)
|
|
373
|
+
• 🚀 Usage examples and workflows
|
|
374
|
+
• 🔧 Troubleshooting tips
|
|
375
|
+
• 📖 Quick reference links
|
|
376
|
+
`)
|
|
377
|
+
.action(guideCommand);
|
|
378
|
+
|
|
307
379
|
// adf config
|
|
308
380
|
program
|
|
309
381
|
.command('config')
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
|
|
5
|
+
const TOOL_GUIDES = {
|
|
6
|
+
'windsurf': {
|
|
7
|
+
name: 'Codeium Windsurf',
|
|
8
|
+
files: [
|
|
9
|
+
{ path: '.windsurfrules', desc: 'Legacy rules file (deprecated)' },
|
|
10
|
+
{ path: '.windsurf/rules/*.md', desc: 'Modular rules (max 12000 chars per file)' },
|
|
11
|
+
{ path: '.windsurf/workflows/*.md', desc: 'Workflow definitions' },
|
|
12
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest (ANDF standard)' }
|
|
13
|
+
],
|
|
14
|
+
setup: [
|
|
15
|
+
'1. Download and install Windsurf from: https://codeium.com/windsurf',
|
|
16
|
+
'2. Open your project in Windsurf IDE',
|
|
17
|
+
'3. Create .windsurf/rules/ directory for modular rules',
|
|
18
|
+
'4. Each .md file in rules/ directory auto-loaded (max 12000 chars)',
|
|
19
|
+
'5. Rules active immediately in Cascade AI'
|
|
20
|
+
],
|
|
21
|
+
usage: [
|
|
22
|
+
'• Cmd/Ctrl+L - Open Cascade AI chat',
|
|
23
|
+
'• Rules from .windsurf/rules/*.md applied automatically',
|
|
24
|
+
'• Character limit: 12000 chars per rule file',
|
|
25
|
+
'• Split large agents across multiple .md files if needed',
|
|
26
|
+
'• Use @agents.md to reference manifest explicitly',
|
|
27
|
+
'• Workflows in .windsurf/workflows/ directory',
|
|
28
|
+
'• Docs: https://docs.windsurf.com/windsurf/cascade/memories'
|
|
29
|
+
],
|
|
30
|
+
mcpServers: [],
|
|
31
|
+
troubleshooting: [
|
|
32
|
+
'• Rules not loading? Check each .md file is ≤12000 characters',
|
|
33
|
+
'• Verify .windsurf/rules/ directory exists',
|
|
34
|
+
'• Restart Windsurf IDE after adding new rules',
|
|
35
|
+
'• Check View → Output → Windsurf for parsing errors'
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
'cursor': {
|
|
40
|
+
name: 'Cursor AI IDE',
|
|
41
|
+
files: [
|
|
42
|
+
{ path: '.cursor/rules/*.mdc', desc: 'Cursor rules with YAML frontmatter' },
|
|
43
|
+
{ path: '.cursorrules', desc: 'Legacy single-file rules (deprecated)' },
|
|
44
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest' },
|
|
45
|
+
{ path: '.context/', desc: 'Deep context (architecture, glossary)' }
|
|
46
|
+
],
|
|
47
|
+
setup: [
|
|
48
|
+
'1. Download and install Cursor from: https://cursor.sh',
|
|
49
|
+
'2. Open your project in Cursor',
|
|
50
|
+
'3. Create .cursor/rules/ directory',
|
|
51
|
+
'4. Add .mdc files with YAML frontmatter (see usage)',
|
|
52
|
+
'5. Rules auto-apply to Agent (Cmd/Ctrl+L) and Cmd+K'
|
|
53
|
+
],
|
|
54
|
+
usage: [
|
|
55
|
+
'• Cmd/Ctrl+K - Inline editing with rules applied',
|
|
56
|
+
'• Cmd/Ctrl+L - Chat (Agent) with rules applied',
|
|
57
|
+
'• Rules format (.mdc file):',
|
|
58
|
+
' ---',
|
|
59
|
+
' title: Developer Agent',
|
|
60
|
+
' description: Development guidelines',
|
|
61
|
+
' ---',
|
|
62
|
+
' [Your agent instructions here]',
|
|
63
|
+
'• Use @AGENTS.md to reference manifest',
|
|
64
|
+
'• Tab to accept AI suggestions'
|
|
65
|
+
],
|
|
66
|
+
mcpServers: [],
|
|
67
|
+
troubleshooting: [
|
|
68
|
+
'• Rules not active? Check .cursor/rules/ directory exists',
|
|
69
|
+
'• Verify .mdc files have valid YAML frontmatter',
|
|
70
|
+
'• Restart Cursor after adding new rules',
|
|
71
|
+
'• Check Cursor Settings → Features → Rules enabled'
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
'vscode': {
|
|
76
|
+
name: 'Visual Studio Code (GitHub Copilot)',
|
|
77
|
+
files: [
|
|
78
|
+
{ path: '.github/copilot-instructions.md', desc: 'GitHub Copilot custom instructions' },
|
|
79
|
+
{ path: '.vscode/settings.json', desc: 'Workspace settings' },
|
|
80
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest' },
|
|
81
|
+
{ path: '.context/', desc: 'Deep context directory' }
|
|
82
|
+
],
|
|
83
|
+
setup: [
|
|
84
|
+
'1. Download VS Code from: https://code.visualstudio.com',
|
|
85
|
+
'2. Install GitHub Copilot extension from marketplace',
|
|
86
|
+
'3. Create .github/copilot-instructions.md in project root',
|
|
87
|
+
'4. Copilot automatically reads instructions on chat start',
|
|
88
|
+
'5. No restart needed - instructions load per conversation'
|
|
89
|
+
],
|
|
90
|
+
usage: [
|
|
91
|
+
'• Cmd/Ctrl+I - Inline Copilot chat',
|
|
92
|
+
'• Cmd/Ctrl+Shift+I - Copilot panel (sidebar)',
|
|
93
|
+
'• Copilot reads .github/copilot-instructions.md automatically',
|
|
94
|
+
'• Use @workspace to include entire workspace context',
|
|
95
|
+
'• Reference specific files: @filename.js',
|
|
96
|
+
'• Instructions format: Plain markdown in copilot-instructions.md',
|
|
97
|
+
'• Documentation: https://docs.github.com/copilot'
|
|
98
|
+
],
|
|
99
|
+
mcpServers: [],
|
|
100
|
+
troubleshooting: [
|
|
101
|
+
'• Instructions not loading? Verify .github/ directory exists',
|
|
102
|
+
'• Check Copilot status icon in bottom-right corner',
|
|
103
|
+
'• Restart Copilot: Cmd/Ctrl+Shift+P → "Copilot: Restart"',
|
|
104
|
+
'• Verify GitHub Copilot subscription is active'
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
'zed': {
|
|
109
|
+
name: 'Zed Editor',
|
|
110
|
+
files: [
|
|
111
|
+
{ path: '.zed/settings.json', desc: 'Project-specific settings' },
|
|
112
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest' },
|
|
113
|
+
{ path: '.context/', desc: 'Deep context directory' }
|
|
114
|
+
],
|
|
115
|
+
setup: [
|
|
116
|
+
'1. Download and install Zed from: https://zed.dev',
|
|
117
|
+
'2. Open your project in Zed',
|
|
118
|
+
'3. Create .zed/settings.json in project root (optional)',
|
|
119
|
+
'4. Global settings at: ~/.config/zed/settings.json',
|
|
120
|
+
'5. MCP servers configured in settings.json'
|
|
121
|
+
],
|
|
122
|
+
usage: [
|
|
123
|
+
'• /assistant - Open AI assistant panel',
|
|
124
|
+
'• Cmd/Ctrl+Enter - Submit to assistant',
|
|
125
|
+
'• Configure MCP servers in settings.json:',
|
|
126
|
+
' {',
|
|
127
|
+
' "context_servers": {',
|
|
128
|
+
' "project": {',
|
|
129
|
+
' "command": "npx",',
|
|
130
|
+
' "args": ["@modelcontextprotocol/server-filesystem", ".context"]',
|
|
131
|
+
' }',
|
|
132
|
+
' }',
|
|
133
|
+
' }',
|
|
134
|
+
'• Reference AGENTS.md manually in conversation'
|
|
135
|
+
],
|
|
136
|
+
mcpServers: [
|
|
137
|
+
{
|
|
138
|
+
name: 'filesystem',
|
|
139
|
+
command: 'npx @modelcontextprotocol/server-filesystem',
|
|
140
|
+
desc: 'Provides file access via MCP protocol'
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
troubleshooting: [
|
|
144
|
+
'• MCP servers not starting? Check Node.js installed',
|
|
145
|
+
'• Verify settings.json syntax is valid JSON',
|
|
146
|
+
'• Check Zed logs: View → Debug → Developer Tools',
|
|
147
|
+
'• Documentation: https://zed.dev/docs'
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
'antigravity': {
|
|
152
|
+
name: 'Google Antigravity',
|
|
153
|
+
files: [
|
|
154
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest' },
|
|
155
|
+
{ path: '.context/', desc: 'Deep context (architecture, glossary)' }
|
|
156
|
+
],
|
|
157
|
+
setup: [
|
|
158
|
+
'1. Access Antigravity (Google internal tool)',
|
|
159
|
+
'2. Open your project or codebase',
|
|
160
|
+
'3. Click ... menu → Customizations',
|
|
161
|
+
'4. Add Rules and Workflows via customization UI',
|
|
162
|
+
'5. Rules and workflows saved automatically'
|
|
163
|
+
],
|
|
164
|
+
usage: [
|
|
165
|
+
'• Access customizations: Click ... → Customizations',
|
|
166
|
+
'• Rules: Add custom instructions for AI behavior',
|
|
167
|
+
'• Workflows: Define multi-step processes',
|
|
168
|
+
'• Reference project files in conversation',
|
|
169
|
+
'• Use "Read AGENTS.md" to access agent manifest',
|
|
170
|
+
'• Conversational commands: "Follow dev workflow"',
|
|
171
|
+
'• .context/ directory accessible for detailed docs'
|
|
172
|
+
],
|
|
173
|
+
mcpServers: [],
|
|
174
|
+
troubleshooting: [
|
|
175
|
+
'• Customizations not applying? Check ... → Customizations menu',
|
|
176
|
+
'• Restart Antigravity session if changes not reflected',
|
|
177
|
+
'• Verify rules syntax is correct in customization UI',
|
|
178
|
+
'• Contact Google internal support for Antigravity issues'
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
'claude-code': {
|
|
183
|
+
name: 'Claude Code CLI',
|
|
184
|
+
files: [
|
|
185
|
+
{ path: '.framework/agents/*.md', desc: 'Agent definition files (analyst, pm, dev, qa, etc.)' },
|
|
186
|
+
{ path: '.claude/commands/', desc: 'Custom commands directory' },
|
|
187
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest' },
|
|
188
|
+
{ path: '.context/', desc: 'Deep context directory' }
|
|
189
|
+
],
|
|
190
|
+
setup: [
|
|
191
|
+
'1. Install Claude Code: curl -fsSL https://claude.ai/install.sh | bash',
|
|
192
|
+
'2. Authenticate: Follow prompts after installation',
|
|
193
|
+
'3. Navigate to your project directory',
|
|
194
|
+
'4. Custom commands in .claude/commands/ (optional)',
|
|
195
|
+
'5. Reference agent files manually in conversation'
|
|
196
|
+
],
|
|
197
|
+
usage: [
|
|
198
|
+
'• Start chat: claude-code',
|
|
199
|
+
'• Interactive terminal-based chat with Claude',
|
|
200
|
+
'• Reference project files: "read .framework/agents/dev.md"',
|
|
201
|
+
'• Access AGENTS.md: "follow instructions in AGENTS.md"',
|
|
202
|
+
'• Custom commands: Place scripts in .claude/commands/',
|
|
203
|
+
'• Requirements: "show .adf/sessions/*/outputs/"',
|
|
204
|
+
'• Documentation: https://claude.ai/code'
|
|
205
|
+
],
|
|
206
|
+
mcpServers: [
|
|
207
|
+
{
|
|
208
|
+
name: 'filesystem',
|
|
209
|
+
desc: 'Can be configured via .claude/settings.json',
|
|
210
|
+
command: 'Configure MCP servers in settings file'
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
troubleshooting: [
|
|
214
|
+
'• Installation issues? Check: https://claude.ai/code',
|
|
215
|
+
'• Command not found? Restart terminal after install',
|
|
216
|
+
'• Authentication failed? Run installation script again',
|
|
217
|
+
'• Custom commands not working? Check .claude/commands/ permissions'
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
'opencode': {
|
|
222
|
+
name: 'OpenCode CLI',
|
|
223
|
+
files: [
|
|
224
|
+
{ path: '.opencode.json', desc: 'OpenCode multi-agent configuration' },
|
|
225
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest (auto-referenced)' },
|
|
226
|
+
{ path: '.context/', desc: 'Deep context directory' }
|
|
227
|
+
],
|
|
228
|
+
setup: [
|
|
229
|
+
'1. Install: npm install -g opencode-ai@latest',
|
|
230
|
+
'2. Or quick install: curl -fsSL https://opencode.ai/install | bash',
|
|
231
|
+
'3. Authenticate: opencode (interactive provider setup)',
|
|
232
|
+
'4. Navigate to your project directory',
|
|
233
|
+
'5. OpenCode reads .opencode.json automatically'
|
|
234
|
+
],
|
|
235
|
+
usage: [
|
|
236
|
+
'• Start session: opencode',
|
|
237
|
+
'• Terminal-based AI coding agent (TUI)',
|
|
238
|
+
'• Supports multiple AI providers (Anthropic, OpenAI, Google, OpenRouter)',
|
|
239
|
+
'• Multi-agent system with specialized agents:',
|
|
240
|
+
' - dev (primary): Senior software engineer',
|
|
241
|
+
' - analyst: Business analyst for requirements',
|
|
242
|
+
' - pm: Product manager for planning',
|
|
243
|
+
' - architect: Solutions architect for design',
|
|
244
|
+
' - qa: QA engineer for testing',
|
|
245
|
+
' - sm: Scrum master for agile workflow',
|
|
246
|
+
'• Configuration schema: https://opencode.ai/config.json',
|
|
247
|
+
'• Auto-loads AGENTS.md and session outputs',
|
|
248
|
+
'• Documentation: https://opencode.ai/docs'
|
|
249
|
+
],
|
|
250
|
+
mcpServers: [
|
|
251
|
+
{
|
|
252
|
+
name: 'project_filesystem',
|
|
253
|
+
desc: 'Provides project file access via MCP protocol',
|
|
254
|
+
command: 'npx -y @modelcontextprotocol/server-filesystem'
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
troubleshooting: [
|
|
258
|
+
'• Command not found? Restart terminal after install',
|
|
259
|
+
'• Config errors? Validate against: https://opencode.ai/config.json',
|
|
260
|
+
'• Provider auth issues? Run: opencode (interactive setup)',
|
|
261
|
+
'• Check version: opencode --version',
|
|
262
|
+
'• Documentation: https://opencode.ai/docs',
|
|
263
|
+
'• GitHub: https://github.com/anomalyco/opencode/issues'
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
'gemini-cli': {
|
|
268
|
+
name: 'Google Gemini CLI',
|
|
269
|
+
files: [
|
|
270
|
+
{ path: 'GEMINI.md', desc: 'Project context and instructions for Gemini' },
|
|
271
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest' },
|
|
272
|
+
{ path: '.context/', desc: 'Deep context directory' }
|
|
273
|
+
],
|
|
274
|
+
setup: [
|
|
275
|
+
'1. Install Gemini CLI: npm install -g @google/gemini-cli',
|
|
276
|
+
'2. Configure API key: gemini auth (interactive setup)',
|
|
277
|
+
'3. Or set manually: export GOOGLE_API_KEY=your_key',
|
|
278
|
+
'4. Navigate to your project directory',
|
|
279
|
+
'5. Start CLI: gemini (not gemini-cli)'
|
|
280
|
+
],
|
|
281
|
+
usage: [
|
|
282
|
+
'• Start session: gemini',
|
|
283
|
+
'• Interactive chat interface with Google Gemini models',
|
|
284
|
+
'• Reference project files: gemini --file path/to/file',
|
|
285
|
+
'• Use GEMINI.md for project context (reference manually)',
|
|
286
|
+
'• Access requirements: "Read .adf/sessions/*/outputs/"',
|
|
287
|
+
'• Documentation: https://geminicli.com'
|
|
288
|
+
],
|
|
289
|
+
mcpServers: [],
|
|
290
|
+
troubleshooting: [
|
|
291
|
+
'• Command not found? Verify npm global install path in PATH',
|
|
292
|
+
'• API key issues? Run: gemini auth',
|
|
293
|
+
'• Check installation: gemini --version',
|
|
294
|
+
'• Documentation: https://geminicli.com/docs'
|
|
295
|
+
]
|
|
296
|
+
},
|
|
297
|
+
|
|
298
|
+
'deepagent': {
|
|
299
|
+
name: 'Abacus.ai DeepAgent',
|
|
300
|
+
files: [
|
|
301
|
+
{ path: '.deepagent/agents/*.md', desc: 'Agent markdown files' },
|
|
302
|
+
{ path: '.deepagent/README.md', desc: 'Project overview and usage' },
|
|
303
|
+
{ path: 'AGENTS.md', desc: 'Universal agent manifest' }
|
|
304
|
+
],
|
|
305
|
+
setup: [
|
|
306
|
+
'1. Install Abacus.ai CLI: npm install -g @abacus-ai/cli',
|
|
307
|
+
'2. Authenticate: abacusai login',
|
|
308
|
+
'3. Navigate to your project directory',
|
|
309
|
+
'4. DeepAgent configurations in .deepagent/ directory',
|
|
310
|
+
'5. Use command: abacusai (not deepagent)'
|
|
311
|
+
],
|
|
312
|
+
usage: [
|
|
313
|
+
'• Start session: abacusai',
|
|
314
|
+
'• Terminal/CLI interface for Abacus.ai platform',
|
|
315
|
+
'• Access DeepAgent features via CLI commands',
|
|
316
|
+
'• Agent markdown files can be referenced manually',
|
|
317
|
+
'• Check available commands: abacusai --help',
|
|
318
|
+
'• Documentation: https://abacus.ai/docs'
|
|
319
|
+
],
|
|
320
|
+
mcpServers: [],
|
|
321
|
+
troubleshooting: [
|
|
322
|
+
'• Command not found? Verify npm global install: npm list -g @abacus-ai/cli',
|
|
323
|
+
'• Authentication issues? Run: abacusai login',
|
|
324
|
+
'• Check CLI version: abacusai --version',
|
|
325
|
+
'• Documentation: https://abacus.ai/docs'
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
async function guide(tool, options) {
|
|
331
|
+
const cwd = process.cwd();
|
|
332
|
+
|
|
333
|
+
// If no tool specified, show available guides
|
|
334
|
+
if (!tool) {
|
|
335
|
+
console.log(chalk.cyan.bold('\n📚 ADF Tool Setup Guides\n'));
|
|
336
|
+
console.log(chalk.gray('Get detailed setup and usage instructions for deployed tools.\n'));
|
|
337
|
+
|
|
338
|
+
console.log(chalk.yellow('Available Guides:'));
|
|
339
|
+
console.log('');
|
|
340
|
+
|
|
341
|
+
for (const [key, toolInfo] of Object.entries(TOOL_GUIDES)) {
|
|
342
|
+
console.log(chalk.green(` adf guide ${key.padEnd(15)}`), chalk.gray(`- ${toolInfo.name}`));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
console.log('');
|
|
346
|
+
console.log(chalk.cyan('Usage:'));
|
|
347
|
+
console.log(chalk.white(' adf guide <tool>'));
|
|
348
|
+
console.log('');
|
|
349
|
+
console.log(chalk.cyan('Examples:'));
|
|
350
|
+
console.log(chalk.gray(' $ adf guide windsurf'));
|
|
351
|
+
console.log(chalk.gray(' $ adf guide claude-code'));
|
|
352
|
+
console.log(chalk.gray(' $ adf guide gemini-cli'));
|
|
353
|
+
console.log('');
|
|
354
|
+
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Get tool guide
|
|
359
|
+
const toolGuide = TOOL_GUIDES[tool];
|
|
360
|
+
if (!toolGuide) {
|
|
361
|
+
console.error(chalk.red(`\n❌ No guide available for "${tool}"`));
|
|
362
|
+
console.log(chalk.yellow('\nRun "adf guide" to see available guides.\n'));
|
|
363
|
+
process.exit(1);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Display guide
|
|
367
|
+
console.log(chalk.cyan.bold(`\n📚 ${toolGuide.name} Setup Guide\n`));
|
|
368
|
+
console.log(chalk.gray('━'.repeat(60)) + '\n');
|
|
369
|
+
|
|
370
|
+
// Check what files exist
|
|
371
|
+
console.log(chalk.yellow.bold('📁 Generated Files:\n'));
|
|
372
|
+
for (const file of toolGuide.files) {
|
|
373
|
+
const exists = await checkFileExists(cwd, file.path);
|
|
374
|
+
const status = exists ? chalk.green('✓') : chalk.red('✗');
|
|
375
|
+
console.log(` ${status} ${chalk.white(file.path)}`);
|
|
376
|
+
console.log(chalk.gray(` ${file.desc}`));
|
|
377
|
+
}
|
|
378
|
+
console.log('');
|
|
379
|
+
|
|
380
|
+
// Setup instructions
|
|
381
|
+
console.log(chalk.yellow.bold('⚙️ Setup Instructions:\n'));
|
|
382
|
+
for (const step of toolGuide.setup) {
|
|
383
|
+
console.log(chalk.gray(` ${step}`));
|
|
384
|
+
}
|
|
385
|
+
console.log('');
|
|
386
|
+
|
|
387
|
+
// MCP Servers (if applicable)
|
|
388
|
+
if (toolGuide.mcpServers && toolGuide.mcpServers.length > 0) {
|
|
389
|
+
console.log(chalk.yellow.bold('🔌 MCP Servers:\n'));
|
|
390
|
+
for (const server of toolGuide.mcpServers) {
|
|
391
|
+
console.log(chalk.cyan(` • ${server.name}`));
|
|
392
|
+
console.log(chalk.gray(` ${server.desc}`));
|
|
393
|
+
if (server.command) {
|
|
394
|
+
console.log(chalk.gray(` Command: ${server.command}`));
|
|
395
|
+
}
|
|
396
|
+
if (server.url) {
|
|
397
|
+
console.log(chalk.gray(` URL: ${server.url}`));
|
|
398
|
+
}
|
|
399
|
+
console.log('');
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// Usage instructions
|
|
404
|
+
console.log(chalk.yellow.bold('🚀 Usage:\n'));
|
|
405
|
+
for (const instruction of toolGuide.usage) {
|
|
406
|
+
console.log(chalk.gray(` ${instruction}`));
|
|
407
|
+
}
|
|
408
|
+
console.log('');
|
|
409
|
+
|
|
410
|
+
// Troubleshooting
|
|
411
|
+
console.log(chalk.yellow.bold('🔧 Troubleshooting:\n'));
|
|
412
|
+
for (const tip of toolGuide.troubleshooting) {
|
|
413
|
+
console.log(chalk.gray(` ${tip}`));
|
|
414
|
+
}
|
|
415
|
+
console.log('');
|
|
416
|
+
|
|
417
|
+
// Quick reference
|
|
418
|
+
console.log(chalk.gray('━'.repeat(60)) + '\n');
|
|
419
|
+
console.log(chalk.cyan.bold('📖 Quick Reference:\n'));
|
|
420
|
+
console.log(chalk.gray(` Requirements: .adf/sessions/*/outputs/`));
|
|
421
|
+
console.log(chalk.gray(` Universal agent config: AGENTS.md`));
|
|
422
|
+
console.log(chalk.gray(` Deep context: .context/memory/`));
|
|
423
|
+
console.log('');
|
|
424
|
+
|
|
425
|
+
console.log(chalk.cyan('Need more help?'));
|
|
426
|
+
console.log(chalk.gray(' • Documentation: https://github.com/iservu/adf-cli#readme'));
|
|
427
|
+
console.log(chalk.gray(' • Issues: https://github.com/iservu/adf-cli/issues'));
|
|
428
|
+
console.log('');
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Check if file/pattern exists
|
|
433
|
+
*/
|
|
434
|
+
async function checkFileExists(cwd, filePath) {
|
|
435
|
+
// Handle glob patterns
|
|
436
|
+
if (filePath.includes('*')) {
|
|
437
|
+
const dir = path.dirname(filePath);
|
|
438
|
+
const dirPath = path.join(cwd, dir);
|
|
439
|
+
if (!await fs.pathExists(dirPath)) return false;
|
|
440
|
+
|
|
441
|
+
const files = await fs.readdir(dirPath);
|
|
442
|
+
return files.length > 0;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// Regular file
|
|
446
|
+
return await fs.pathExists(path.join(cwd, filePath));
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
module.exports = guide;
|
|
@@ -4,12 +4,18 @@ const ToolConfigGenerator = require('./tool-config-generator');
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generator for OpenCode CLI configurations
|
|
7
|
-
* Creates .opencode.json with
|
|
7
|
+
* Creates .opencode.json with multi-agent, multi-provider configuration
|
|
8
|
+
*
|
|
9
|
+
* OpenCode Configuration Reference:
|
|
10
|
+
* - Schema: https://opencode.ai/config.json
|
|
11
|
+
* - Docs: https://opencode.ai/docs/
|
|
12
|
+
* - Multi-provider support: Anthropic, OpenAI, Google Gemini, OpenRouter
|
|
13
|
+
* - Multi-agent support: Specialized agents for different tasks
|
|
8
14
|
*/
|
|
9
15
|
class OpenCodeGenerator extends ToolConfigGenerator {
|
|
10
16
|
/**
|
|
11
17
|
* Generate OpenCode configuration
|
|
12
|
-
* @returns {Object} Generated file
|
|
18
|
+
* @returns {Object} Generated file paths
|
|
13
19
|
*/
|
|
14
20
|
async generate() {
|
|
15
21
|
await this.initialize();
|
|
@@ -19,134 +25,288 @@ class OpenCodeGenerator extends ToolConfigGenerator {
|
|
|
19
25
|
// Generate configuration
|
|
20
26
|
const config = await this.generateConfig();
|
|
21
27
|
|
|
28
|
+
// Write with proper JSON formatting (no schema in JSON, only comments)
|
|
22
29
|
await fs.writeJson(configPath, config, { spaces: 2 });
|
|
23
30
|
|
|
24
31
|
return { config: configPath };
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/**
|
|
28
|
-
* Generate .opencode.json configuration
|
|
35
|
+
* Generate .opencode.json configuration following official OpenCode schema
|
|
36
|
+
* Reference: https://opencode.ai/docs/config
|
|
29
37
|
*/
|
|
30
38
|
async generateConfig() {
|
|
31
39
|
const projectContext = await this.getProjectContext();
|
|
32
|
-
const
|
|
40
|
+
const providers = await this.getAvailableProviders();
|
|
41
|
+
const agents = await this.generateAgentConfigurations(providers);
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
const config = {
|
|
44
|
+
"$schema": "https://opencode.ai/config.json",
|
|
45
|
+
|
|
46
|
+
// Provider configurations (Anthropic, OpenAI, Google, OpenRouter, etc.)
|
|
47
|
+
"provider": await this.generateProviderConfigurations(providers),
|
|
48
|
+
|
|
49
|
+
// Default model (use the most powerful available)
|
|
50
|
+
"model": this.getDefaultModel(providers),
|
|
51
|
+
|
|
52
|
+
// Agent configurations (mapped from ADF framework)
|
|
53
|
+
"agent": agents,
|
|
54
|
+
|
|
55
|
+
// Default agent for primary interactions
|
|
56
|
+
"default_agent": this.getDefaultAgent(),
|
|
57
|
+
|
|
58
|
+
// Global tool permissions
|
|
59
|
+
"tools": {
|
|
60
|
+
"write": true,
|
|
61
|
+
"edit": true,
|
|
62
|
+
"bash": true,
|
|
63
|
+
"webfetch": true,
|
|
64
|
+
"patch": true
|
|
37
65
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
66
|
+
|
|
67
|
+
// Permission settings (ask for destructive operations)
|
|
68
|
+
"permission": {
|
|
69
|
+
"edit": "allow",
|
|
70
|
+
"bash": {
|
|
71
|
+
"git push": "ask",
|
|
72
|
+
"rm -rf": "ask",
|
|
73
|
+
"*": "allow"
|
|
42
74
|
},
|
|
43
|
-
|
|
44
|
-
model: this.getTaskModel(),
|
|
45
|
-
maxTokens: 4000
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
systemPrompt: this.generateSystemPrompt(projectContext, frameworkContext),
|
|
49
|
-
projectContext: {
|
|
50
|
-
framework: this.getFrameworkName(),
|
|
51
|
-
session: this.getSessionId(),
|
|
52
|
-
outputsPath: `.adf/sessions/${this.getSessionId()}/outputs/`
|
|
75
|
+
"webfetch": "allow"
|
|
53
76
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
|
|
78
|
+
// Instructions - reference AGENTS.md and session outputs
|
|
79
|
+
"instructions": [
|
|
80
|
+
"AGENTS.md",
|
|
81
|
+
`.adf/sessions/${this.getSessionId()}/outputs/*.md`
|
|
82
|
+
],
|
|
83
|
+
|
|
84
|
+
// MCP servers for filesystem access
|
|
85
|
+
"mcp": {
|
|
86
|
+
"project_filesystem": {
|
|
87
|
+
"type": "local",
|
|
88
|
+
"command": ["npx", "-y", "@modelcontextprotocol/server-filesystem", this.projectPath],
|
|
89
|
+
"enabled": true
|
|
59
90
|
}
|
|
60
91
|
},
|
|
61
|
-
|
|
62
|
-
|
|
92
|
+
|
|
93
|
+
// Server configuration for 'opencode serve'
|
|
94
|
+
"server": {
|
|
95
|
+
"port": 4096,
|
|
96
|
+
"hostname": "localhost"
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
// Auto-update enabled
|
|
100
|
+
"autoupdate": true
|
|
63
101
|
};
|
|
102
|
+
|
|
103
|
+
return config;
|
|
64
104
|
}
|
|
65
105
|
|
|
66
106
|
/**
|
|
67
|
-
*
|
|
107
|
+
* Detect available AI providers from .adf/.env
|
|
108
|
+
* Returns array of provider IDs that have API keys configured
|
|
68
109
|
*/
|
|
69
|
-
|
|
70
|
-
const
|
|
110
|
+
async getAvailableProviders() {
|
|
111
|
+
const envPath = path.join(this.projectPath, '.adf', '.env');
|
|
112
|
+
const providers = [];
|
|
113
|
+
|
|
114
|
+
if (await fs.pathExists(envPath)) {
|
|
115
|
+
const envContent = await fs.readFile(envPath, 'utf-8');
|
|
116
|
+
const lines = envContent.split('\n');
|
|
117
|
+
|
|
118
|
+
for (const line of lines) {
|
|
119
|
+
if (line.includes('ANTHROPIC_API_KEY=') && !line.startsWith('#')) {
|
|
120
|
+
providers.push('anthropic');
|
|
121
|
+
}
|
|
122
|
+
if (line.includes('OPENAI_API_KEY=') && !line.startsWith('#')) {
|
|
123
|
+
providers.push('openai');
|
|
124
|
+
}
|
|
125
|
+
if ((line.includes('GEMINI_API_KEY=') || line.includes('GOOGLE_API_KEY=')) && !line.startsWith('#')) {
|
|
126
|
+
providers.push('google');
|
|
127
|
+
}
|
|
128
|
+
if (line.includes('OPENROUTER_API_KEY=') && !line.startsWith('#')) {
|
|
129
|
+
providers.push('openrouter');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Default to Anthropic if no providers found
|
|
135
|
+
return providers.length > 0 ? providers : ['anthropic'];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Generate provider configurations for OpenCode
|
|
140
|
+
* Reference: https://opencode.ai/docs/providers
|
|
141
|
+
*/
|
|
142
|
+
async generateProviderConfigurations(providers) {
|
|
143
|
+
const config = {};
|
|
144
|
+
|
|
145
|
+
if (providers.includes('anthropic')) {
|
|
146
|
+
config.anthropic = {
|
|
147
|
+
"options": {
|
|
148
|
+
"apiKey": "{env:ANTHROPIC_API_KEY}"
|
|
149
|
+
},
|
|
150
|
+
"models": {}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
71
153
|
|
|
72
|
-
|
|
154
|
+
if (providers.includes('openai')) {
|
|
155
|
+
config.openai = {
|
|
156
|
+
"options": {
|
|
157
|
+
"apiKey": "{env:OPENAI_API_KEY}"
|
|
158
|
+
},
|
|
159
|
+
"models": {}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
73
162
|
|
|
74
|
-
|
|
163
|
+
if (providers.includes('google')) {
|
|
164
|
+
config.google = {
|
|
165
|
+
"options": {
|
|
166
|
+
"apiKey": "{env:GEMINI_API_KEY}"
|
|
167
|
+
},
|
|
168
|
+
"models": {}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
75
171
|
|
|
76
|
-
|
|
77
|
-
|
|
172
|
+
if (providers.includes('openrouter')) {
|
|
173
|
+
config.openrouter = {
|
|
174
|
+
"options": {
|
|
175
|
+
"apiKey": "{env:OPENROUTER_API_KEY}"
|
|
176
|
+
},
|
|
177
|
+
"models": {}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
78
180
|
|
|
79
|
-
|
|
80
|
-
|
|
181
|
+
return config;
|
|
182
|
+
}
|
|
81
183
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Generate agent configurations based on ADF framework level
|
|
186
|
+
* Reference: https://opencode.ai/docs/agents
|
|
187
|
+
*/
|
|
188
|
+
async generateAgentConfigurations(providers) {
|
|
189
|
+
const agents = {};
|
|
190
|
+
const agentsList = this.getAgentsList();
|
|
88
191
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
192
|
+
// Map ADF agents to OpenCode agents with optimal models
|
|
193
|
+
for (const agentName of agentsList) {
|
|
194
|
+
const agentConfig = this.getAgentConfig(agentName, providers);
|
|
195
|
+
agents[agentName] = agentConfig;
|
|
196
|
+
}
|
|
93
197
|
|
|
94
|
-
|
|
198
|
+
return agents;
|
|
95
199
|
}
|
|
96
200
|
|
|
97
201
|
/**
|
|
98
|
-
* Get
|
|
202
|
+
* Get configuration for a specific agent
|
|
99
203
|
*/
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
'
|
|
103
|
-
'
|
|
104
|
-
'
|
|
204
|
+
getAgentConfig(agentName, providers) {
|
|
205
|
+
const agentDescriptions = {
|
|
206
|
+
'analyst': 'Business analyst for requirements and specifications',
|
|
207
|
+
'pm': 'Product manager for planning and prioritization',
|
|
208
|
+
'architect': 'Solutions architect for system design and architecture decisions',
|
|
209
|
+
'sm': 'Scrum master for agile workflow and team coordination',
|
|
210
|
+
'dev': 'Senior software engineer for implementation and coding',
|
|
211
|
+
'qa': 'QA engineer for testing and quality assurance'
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const config = {
|
|
215
|
+
"description": agentDescriptions[agentName] || 'AI coding assistant',
|
|
216
|
+
"mode": agentName === 'dev' ? 'primary' : 'subagent',
|
|
217
|
+
"model": this.getOptimalModelForAgent(agentName, providers)
|
|
105
218
|
};
|
|
106
|
-
|
|
219
|
+
|
|
220
|
+
// Agent-specific tool permissions
|
|
221
|
+
if (agentName === 'qa') {
|
|
222
|
+
config.tools = {
|
|
223
|
+
"write": false, // QA shouldn't write production code
|
|
224
|
+
"bash": true // Can run tests
|
|
225
|
+
};
|
|
226
|
+
} else if (agentName === 'architect' || agentName === 'analyst') {
|
|
227
|
+
config.tools = {
|
|
228
|
+
"write": false, // Analysis/design agents don't write code
|
|
229
|
+
"edit": false,
|
|
230
|
+
"bash": false
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return config;
|
|
107
235
|
}
|
|
108
236
|
|
|
109
237
|
/**
|
|
110
|
-
* Get model for
|
|
238
|
+
* Get optimal model for each agent type based on task complexity
|
|
111
239
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
240
|
+
getOptimalModelForAgent(agentName, providers) {
|
|
241
|
+
// Model selection strategy:
|
|
242
|
+
// - Powerful models: analyst, architect (deep thinking required)
|
|
243
|
+
// - Balanced models: pm, dev (main implementation)
|
|
244
|
+
// - Fast models: qa, sm (routine tasks)
|
|
245
|
+
|
|
246
|
+
const modelTiers = {
|
|
247
|
+
powerful: this.getPowerfulModel(providers),
|
|
248
|
+
balanced: this.getBalancedModel(providers),
|
|
249
|
+
fast: this.getFastModel(providers)
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const agentModelMap = {
|
|
253
|
+
'analyst': modelTiers.powerful,
|
|
254
|
+
'architect': modelTiers.powerful,
|
|
255
|
+
'pm': modelTiers.balanced,
|
|
256
|
+
'dev': modelTiers.balanced,
|
|
257
|
+
'qa': modelTiers.fast,
|
|
258
|
+
'sm': modelTiers.fast
|
|
117
259
|
};
|
|
118
|
-
|
|
260
|
+
|
|
261
|
+
return agentModelMap[agentName] || modelTiers.balanced;
|
|
119
262
|
}
|
|
120
263
|
|
|
121
264
|
/**
|
|
122
|
-
* Get model
|
|
265
|
+
* Get the most powerful model from available providers
|
|
123
266
|
*/
|
|
124
|
-
|
|
125
|
-
return 'anthropic/claude-
|
|
267
|
+
getPowerfulModel(providers) {
|
|
268
|
+
if (providers.includes('anthropic')) return 'anthropic/claude-sonnet-4-5-20250929';
|
|
269
|
+
if (providers.includes('openai')) return 'openai/gpt-5';
|
|
270
|
+
if (providers.includes('google')) return 'google/gemini-2.5-pro';
|
|
271
|
+
if (providers.includes('openrouter')) return 'openrouter/anthropic/claude-sonnet-4';
|
|
272
|
+
return 'anthropic/claude-sonnet-4-5-20250929'; // Default
|
|
126
273
|
}
|
|
127
274
|
|
|
128
275
|
/**
|
|
129
|
-
* Get
|
|
276
|
+
* Get a balanced model from available providers
|
|
130
277
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return names[this.framework] || this.framework;
|
|
278
|
+
getBalancedModel(providers) {
|
|
279
|
+
if (providers.includes('anthropic')) return 'anthropic/claude-haiku-4-5-20250514';
|
|
280
|
+
if (providers.includes('openai')) return 'openai/gpt-4o';
|
|
281
|
+
if (providers.includes('google')) return 'google/gemini-1.5-pro';
|
|
282
|
+
if (providers.includes('openrouter')) return 'openrouter/anthropic/claude-haiku-4';
|
|
283
|
+
return 'anthropic/claude-haiku-4-5-20250514'; // Default
|
|
138
284
|
}
|
|
139
285
|
|
|
140
286
|
/**
|
|
141
|
-
* Get
|
|
287
|
+
* Get the fastest/cheapest model from available providers
|
|
142
288
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
289
|
+
getFastModel(providers) {
|
|
290
|
+
if (providers.includes('anthropic')) return 'anthropic/claude-haiku-4-5-20250514';
|
|
291
|
+
if (providers.includes('openai')) return 'openai/gpt-4o-mini';
|
|
292
|
+
if (providers.includes('google')) return 'google/gemini-1.5-flash';
|
|
293
|
+
if (providers.includes('openrouter')) return 'openrouter/google/gemini-flash-1.5';
|
|
294
|
+
return 'anthropic/claude-haiku-4-5-20250514'; // Default
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Get default model for OpenCode
|
|
299
|
+
*/
|
|
300
|
+
getDefaultModel(providers) {
|
|
301
|
+
return this.getBalancedModel(providers);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Get default agent based on framework
|
|
306
|
+
*/
|
|
307
|
+
getDefaultAgent() {
|
|
308
|
+
// Default to 'dev' agent as primary interaction point
|
|
309
|
+
return 'dev';
|
|
150
310
|
}
|
|
151
311
|
}
|
|
152
312
|
|