Skip to content

Commit bf2db9c

Browse files
committed
feat: adopt TOML and Agent Skill approach for Gemini CLI extension
- Added `gemini-extension.json` and `commands/opencli.toml` to register OpenCLI as a command-line tool extension for Gemini CLI using a declarative configuration. - Added `skills/opencli/SKILL.md` (via symlink) to provide the AI agent with specific instructions and workflow context on how to use OpenCLI. - Dropped the experimental programmatic tools implementation in favor of this simpler, maintainable architecture.
1 parent 49c2dc7 commit bf2db9c

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

commands/opencli.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
description = "Use OpenCLI to get data or interact with sites from natural language. Make any website or Electron App your CLI."
2+
prompt = """
3+
You are an expert at OpenCLI. The user wants to use OpenCLI to fulfill their request: {{args}}
4+
5+
Here are the commands you have available:
6+
```
7+
!{npx tsx src/main.ts list}
8+
```
9+
10+
1. Understand the user's intent, and identify the single most relevant opencli command.
11+
2. Determine the exact `opencli` shell command needed (including any required arguments).
12+
Note: OpenCLI commands usually use standard POSIX flag structure. E.g. `npx tsx src/main.ts twitter search "my query" --limit 10`
13+
3. Execute the command using the `run_shell_command` tool. Use `npx tsx src/main.ts` as the executable since we are running within the extension repository.
14+
4. If the requested site/command doesn't appear in the list, you might need to use `npx tsx src/main.ts generate` to create the adapter first.
15+
5. Provide a brief answer interpreting the output of the opencli execution, or format it nicely for the user.
16+
"""

gemini-extension.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "opencli",
3+
"version": "1.2.6",
4+
"description": "OpenCLI Gemini Extension"
5+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"test:e2e": "vitest run --project e2e",
3535
"docs:dev": "vitepress dev docs",
3636
"docs:build": "vitepress build docs",
37-
"docs:preview": "vitepress preview docs"
37+
"docs:preview": "vitepress preview docs",
38+
"version": "node -e \"const fs=require('fs'); const pkg=require('./package.json'); const ext=require('./gemini-extension.json'); ext.version=pkg.version; fs.writeFileSync('./gemini-extension.json', JSON.stringify(ext, null, 2) + '\\n');\" && git add gemini-extension.json"
3839
},
3940
"keywords": [
4041
"cli",

skills/opencli/SKILL.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../SKILL.md

0 commit comments

Comments
 (0)