Skip to content

Commit 87ac038

Browse files
authored
Merge pull request #16 from link-assistant/issue-15-47049ece53b4
Add Gemini CLI to supported tools and fix Agent JSON Input status
2 parents 6927518 + b502589 commit 87ac038

File tree

8 files changed

+1042
-5
lines changed

8 files changed

+1042
-5
lines changed

README.md

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# agent-commander
22

3-
A JavaScript library to control agents enclosed in CLI commands like Anthropic Claude Code CLI, OpenAI Codex, OpenCode, Qwen Code, and @link-assistant/agent.
3+
A JavaScript library to control agents enclosed in CLI commands like Anthropic Claude Code CLI, OpenAI Codex, OpenCode, Qwen Code, Gemini CLI, and @link-assistant/agent.
44

55
Built on the success of [hive-mind](https://github.com/link-assistant/hive-mind), `agent-commander` provides a flexible JavaScript interface and CLI tools for managing agent processes with various isolation levels.
66

@@ -12,6 +12,7 @@ Built on the success of [hive-mind](https://github.com/link-assistant/hive-mind)
1212
- `codex` - OpenAI Codex CLI
1313
- `opencode` - OpenCode CLI
1414
- `qwen` - Qwen Code CLI (Alibaba's AI coding agent)
15+
- `gemini` - Gemini CLI (Google's AI coding agent)
1516
- `agent` - @link-assistant/agent (unrestricted OpenCode fork)
1617
- **Multiple Isolation Modes**:
1718
- No isolation (direct execution)
@@ -58,7 +59,8 @@ bun add agent-commander
5859
| `codex` | OpenAI Codex CLI ||| `gpt5`, `o3`, `gpt4o` |
5960
| `opencode` | OpenCode CLI ||| `grok`, `gemini`, `sonnet` |
6061
| `qwen` | Qwen Code CLI | ✅ (stream-json) | ✅ (stream-json) | `qwen3-coder`, `coder`, `gpt-4o` |
61-
| `agent` | @link-assistant/agent ||| `grok`, `sonnet`, `haiku` |
62+
| `gemini` | Gemini CLI | ✅ (stream-json) || `flash`, `pro`, `lite` |
63+
| `agent` | @link-assistant/agent ||| `grok`, `sonnet`, `haiku` |
6264

6365
### Claude-specific Features
6466

@@ -83,6 +85,28 @@ The [Qwen Code CLI](https://github.com/QwenLM/qwen-code) supports additional fea
8385
- **Partial messages**: Use `--include-partial-messages` with stream-json for real-time UI updates
8486
- **Model flexibility**: Supports Qwen3-Coder models plus OpenAI-compatible models via API
8587

88+
### Gemini-specific Features
89+
90+
The [Gemini CLI](https://github.com/google-gemini/gemini-cli) supports additional features:
91+
92+
- **Stream JSON format**: Uses `--output-format stream-json` for real-time NDJSON streaming
93+
- **Auto-approval mode**: Use `--yolo` flag for automatic action approval (enabled by default)
94+
- **Sandbox mode**: Use `--sandbox` flag for secure tool execution in isolated environment
95+
- **Checkpointing**: Use `--checkpointing` to save project snapshots before file modifications
96+
- **Debug output**: Use `-d` flag for detailed debug output
97+
- **Model selection**: Use `-m` flag to select model (e.g., `gemini-2.5-flash`, `gemini-2.5-pro`)
98+
- **Interactive mode**: Use `-i` flag with prompt to start interactive session
99+
100+
### Agent-specific Features
101+
102+
The [@link-assistant/agent](https://github.com/link-assistant/agent) supports additional features:
103+
104+
- **JSON Input/Output**: Accepts JSON via stdin, outputs JSON event streams (OpenCode-compatible)
105+
- **Unrestricted access**: No sandbox, no permissions system - full autonomous execution
106+
- **13 built-in tools**: Including websearch, codesearch, batch - all enabled by default
107+
- **MCP support**: Model Context Protocol for extending functionality with MCP servers
108+
- **OpenCode compatibility**: 100% compatible with OpenCode's JSON event streaming format
109+
86110
## CLI Usage
87111

88112
### start-agent
@@ -95,7 +119,7 @@ start-agent --tool claude --working-directory "/tmp/dir" --prompt "Solve the iss
95119

96120
#### Options
97121

98-
- `--tool <name>` - CLI tool to use (e.g., 'claude', 'codex', 'opencode', 'qwen', 'agent') [required]
122+
- `--tool <name>` - CLI tool to use (e.g., 'claude', 'codex', 'opencode', 'qwen', 'gemini', 'agent') [required]
99123
- `--working-directory <path>` - Working directory for the agent [required]
100124
- `--prompt <text>` - Prompt for the agent
101125
- `--system-prompt <text>` - System prompt for the agent
@@ -136,6 +160,11 @@ start-agent --tool agent --working-directory "/tmp/dir" --prompt "Analyze code"
136160
start-agent --tool qwen --working-directory "/tmp/dir" --prompt "Review this code" --model qwen3-coder
137161
```
138162

163+
**Using Gemini**
164+
```bash
165+
start-agent --tool gemini --working-directory "/tmp/dir" --prompt "Explain this code" --model flash
166+
```
167+
139168
**With model fallback (Claude)**
140169
```bash
141170
start-agent --tool claude --working-directory "/tmp/dir" \
@@ -259,6 +288,14 @@ const qwenAgent = agent({
259288
prompt: 'Review this code',
260289
model: 'qwen3-coder',
261290
});
291+
292+
// Using Gemini CLI
293+
const geminiAgent = agent({
294+
tool: 'gemini',
295+
workingDirectory: '/tmp/project',
296+
prompt: 'Explain this code',
297+
model: 'flash',
298+
});
262299
```
263300

264301
### Streaming JSON Messages
@@ -373,7 +410,7 @@ await myAgent.start({ dryRun: true });
373410
import { getTool, listTools, isToolSupported } from 'agent-commander';
374411

375412
// List all available tools
376-
console.log(listTools()); // ['claude', 'codex', 'opencode', 'agent', 'qwen']
413+
console.log(listTools()); // ['claude', 'codex', 'opencode', 'agent', 'gemini', 'qwen']
377414

378415
// Check if a tool is supported
379416
console.log(isToolSupported({ toolName: 'claude' })); // true
@@ -394,7 +431,7 @@ console.log(fullId); // 'claude-opus-4-5-20251101'
394431
Creates an agent controller.
395432

396433
**Parameters:**
397-
- `options.tool` (string, required) - CLI tool to use ('claude', 'codex', 'opencode', 'qwen', 'agent')
434+
- `options.tool` (string, required) - CLI tool to use ('claude', 'codex', 'opencode', 'qwen', 'gemini', 'agent')
398435
- `options.workingDirectory` (string, required) - Working directory
399436
- `options.prompt` (string, optional) - Prompt for the agent
400437
- `options.systemPrompt` (string, optional) - System prompt
@@ -562,6 +599,7 @@ agent-commander/
562599
│ │ ├── codex.mjs # Codex CLI config
563600
│ │ ├── opencode.mjs # OpenCode CLI config
564601
│ │ ├── qwen.mjs # Qwen Code CLI config
602+
│ │ ├── gemini.mjs # Gemini CLI config
565603
│ │ └── agent.mjs # @link-assistant/agent config
566604
│ ├── streaming/ # JSON streaming utilities
567605
│ │ ├── index.mjs # Stream exports
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Case Study: JSON Output/Input Documentation Accuracy
2+
3+
**Issue:** [#15 - Double check for JSON Output and JSON Input for all our tools](https://github.com/link-assistant/agent-commander/issues/15)
4+
5+
This document captures the investigation and resolution of documentation discrepancies in the agent-commander README.md regarding JSON input/output support for supported CLI tools.
6+
7+
## Overview
8+
9+
The issue identified two documentation problems:
10+
1. **Missing Gemini CLI** - Not listed in the Supported Tools table despite being fully implemented
11+
2. **Incorrect Agent CLI JSON Input status** - Marked as ❌ but actually supports JSON input
12+
13+
## Investigation Methodology
14+
15+
### Data Collection
16+
17+
1. **Repository Analysis**: Examined the codebase for actual tool configurations
18+
2. **External Verification**: Checked upstream repositories (@link-assistant/agent, google-gemini/gemini-cli)
19+
3. **Code Review**: Analyzed `js/src/tools/*.mjs` configuration files
20+
4. **Documentation Review**: Cross-referenced README.md claims with actual capabilities
21+
22+
### Evidence Sources
23+
24+
| Source | Location | Key Finding |
25+
|--------|----------|-------------|
26+
| agent.mjs | js/src/tools/agent.mjs:246 | `supportsJsonInput: true` |
27+
| gemini.mjs | js/src/tools/gemini.mjs | Full Gemini CLI implementation |
28+
| tools/index.mjs | js/src/tools/index.mjs:21 | Exports `geminiTool` |
29+
| @link-assistant/agent | GitHub README | "JSON Input/Output: Accepts JSON via stdin" |
30+
| google-gemini/gemini-cli | GitHub README | Supports `--output-format stream-json` |
31+
32+
## Root Cause Analysis
33+
34+
### Problem 1: Missing Gemini in README
35+
36+
**Root Cause**: The Gemini CLI tool was added to the codebase in a previous update (gemini.mjs created, index.mjs updated), but the README.md Supported Tools table was not updated to include this new tool.
37+
38+
**Evidence**:
39+
- `js/src/tools/gemini.mjs` exists with full implementation (318 lines)
40+
- `js/src/tools/index.mjs` imports and exports `geminiTool`
41+
- README.md table only lists: claude, codex, opencode, qwen, agent
42+
43+
### Problem 2: Incorrect Agent JSON Input Status
44+
45+
**Root Cause**: Documentation lag - the Agent CLI's JSON input capability was either overlooked during initial documentation or the capability was added after documentation was written.
46+
47+
**Evidence**:
48+
- `js/src/tools/agent.mjs:246` explicitly states `supportsJsonInput: true`
49+
- @link-assistant/agent README states: "JSON Input/Output: Accepts JSON via stdin, outputs JSON event streams (OpenCode-compatible)"
50+
- The code comments in agent.mjs line 71 confirm: "Agent uses stdin for prompt input (NDJSON streaming supported)"
51+
52+
## Timeline of Events
53+
54+
1. **Initial Release**: agent-commander released with support for claude, codex, opencode, agent, qwen
55+
2. **Agent JSON Support**: Agent CLI implemented full JSON input/output (based on OpenCode compatibility)
56+
3. **Gemini Addition**: Gemini CLI tool added to codebase (gemini.mjs created)
57+
4. **Documentation Gap**: README.md not updated to reflect Gemini addition or Agent JSON input capability
58+
5. **Issue #15**: Documentation inconsistency discovered and reported
59+
60+
## Solution Implementation
61+
62+
### Changes Made to README.md
63+
64+
1. **Added Gemini to Supported Tools Table**:
65+
```markdown
66+
| `gemini` | Gemini CLI | ✅ (stream-json) || `flash`, `pro`, `lite` |
67+
```
68+
69+
2. **Fixed Agent JSON Input Status**:
70+
```markdown
71+
| `agent` | @link-assistant/agent ||| `grok`, `sonnet`, `haiku` |
72+
```
73+
74+
3. **Added Gemini-specific Features Section**:
75+
- Stream JSON format documentation
76+
- Yolo mode (auto-approval) documentation
77+
- Sandbox mode documentation
78+
- Checkpointing support documentation
79+
- Model configuration documentation
80+
81+
4. **Updated Feature List**:
82+
- Added `gemini` to the Multiple CLI Agents list
83+
- Updated description to include Gemini CLI
84+
85+
### Verification
86+
87+
| Tool | JSON Output | JSON Input | Verified Source |
88+
|------|-------------|------------|-----------------|
89+
| claude | ✅ (stream-json) | ✅ (stream-json) | Code + README |
90+
| codex ||| Code analysis |
91+
| opencode ||| Code analysis |
92+
| qwen | ✅ (stream-json) | ✅ (stream-json) | Code + README |
93+
| agent ||| Code + upstream README |
94+
| gemini | ✅ (stream-json) || Code + upstream README |
95+
96+
## Lessons Learned
97+
98+
1. **Documentation-Code Sync**: When adding new tools or capabilities, update documentation in the same commit/PR
99+
2. **Verification Process**: Cross-reference code configurations with upstream tool documentation
100+
3. **Case Studies**: Documenting the investigation helps prevent similar issues and provides institutional knowledge
101+
102+
## Files Modified
103+
104+
| File | Changes |
105+
|------|---------|
106+
| README.md | Added Gemini to table, fixed Agent JSON Input, added Gemini features section |
107+
| docs/case-studies/issue-15/README.md | This case study document |
108+
| docs/case-studies/issue-15/evidence-timeline.md | Investigation evidence and timeline |
109+
110+
## References
111+
112+
- [google-gemini/gemini-cli](https://github.com/google-gemini/gemini-cli) - Official Gemini CLI repository
113+
- [@link-assistant/agent](https://github.com/link-assistant/agent) - Agent CLI repository
114+
- [Gemini CLI Headless Mode](https://geminicli.com/docs/cli/headless/) - JSON output documentation
115+
- [Issue #15](https://github.com/link-assistant/agent-commander/issues/15) - Original issue report
116+
117+
## Conclusion
118+
119+
The documentation discrepancies were caused by documentation lag rather than technical issues. The actual code implementations were correct - only the README.md needed updating to accurately reflect the supported tools and their capabilities.
120+
121+
Key insight: Maintaining accurate documentation requires systematic verification against both the codebase and upstream tool capabilities. Creating case studies for such investigations helps prevent similar issues and provides a reference for future contributors.

0 commit comments

Comments
 (0)