jbai-cli 1.2.4 → 1.3.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/README.md +2 -1
- package/bin/jbai-claude.js +6 -3
- package/bin/jbai-gemini.js +66 -0
- package/bin/jbai-opencode.js +13 -6
- package/bin/jbai.js +8 -3
- package/lib/config.js +6 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Use AI coding tools with your JetBrains AI subscription** — no separate API keys needed.
|
|
4
4
|
|
|
5
|
-
One token, all tools: Claude Code, Codex, Aider, OpenCode.
|
|
5
|
+
One token, all tools: Claude Code, Codex, Aider, Gemini CLI, OpenCode.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -89,6 +89,7 @@ jbai-aider --super
|
|
|
89
89
|
| Claude Code | `--dangerously-skip-permissions` |
|
|
90
90
|
| Codex | `--full-auto` |
|
|
91
91
|
| Aider | `--yes` |
|
|
92
|
+
| Gemini CLI | `--yes` |
|
|
92
93
|
| OpenCode | `--yes` |
|
|
93
94
|
|
|
94
95
|
⚠️ **Use with caution** - super mode allows the AI to make changes without confirmation.
|
package/bin/jbai-claude.js
CHANGED
|
@@ -33,11 +33,14 @@ if (superMode) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// Set environment for Claude Code
|
|
36
|
-
//
|
|
36
|
+
// Use ANTHROPIC_CUSTOM_HEADERS for the Grazie auth header
|
|
37
|
+
// Remove /v1 from endpoint - Claude Code adds it automatically
|
|
38
|
+
const baseUrl = endpoints.anthropic.replace(/\/v1$/, '');
|
|
37
39
|
const env = {
|
|
38
40
|
...process.env,
|
|
39
|
-
ANTHROPIC_BASE_URL:
|
|
40
|
-
ANTHROPIC_API_KEY:
|
|
41
|
+
ANTHROPIC_BASE_URL: baseUrl,
|
|
42
|
+
ANTHROPIC_API_KEY: 'placeholder',
|
|
43
|
+
ANTHROPIC_CUSTOM_HEADERS: `Grazie-Authenticate-JWT: ${token}`
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
// Remove any existing auth token that might conflict
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* jbai-gemini - Gemini CLI wrapper for JetBrains AI Platform
|
|
5
|
+
*
|
|
6
|
+
* Uses GEMINI_CLI_CUSTOM_HEADERS and GEMINI_BASE_URL for authentication
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { spawn } = require('child_process');
|
|
10
|
+
const config = require('../lib/config');
|
|
11
|
+
|
|
12
|
+
const token = config.getToken();
|
|
13
|
+
if (!token) {
|
|
14
|
+
console.error('❌ No token found. Run: jbai token set');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (config.isTokenExpired(token)) {
|
|
19
|
+
console.error('⚠️ Token expired. Run: jbai token refresh');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const endpoints = config.getEndpoints();
|
|
24
|
+
let args = process.argv.slice(2);
|
|
25
|
+
|
|
26
|
+
// Check for super mode (--super, --yolo, -s)
|
|
27
|
+
const superFlags = ['--super', '--yolo', '-s'];
|
|
28
|
+
const superMode = args.some(a => superFlags.includes(a));
|
|
29
|
+
args = args.filter(a => !superFlags.includes(a));
|
|
30
|
+
|
|
31
|
+
// Check if model specified
|
|
32
|
+
const hasModel = args.includes('--model') || args.includes('-m');
|
|
33
|
+
let finalArgs = hasModel ? args : ['--model', config.MODELS.gemini.default, ...args];
|
|
34
|
+
|
|
35
|
+
// Add super mode flags (auto-confirm)
|
|
36
|
+
if (superMode) {
|
|
37
|
+
finalArgs = ['--yes', ...finalArgs];
|
|
38
|
+
console.log('🚀 Super mode: --yes (auto-confirm) enabled');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Set environment for Gemini CLI
|
|
42
|
+
// Uses GEMINI_CLI_CUSTOM_HEADERS for auth (supported since Nov 2025)
|
|
43
|
+
const env = {
|
|
44
|
+
...process.env,
|
|
45
|
+
GEMINI_BASE_URL: endpoints.google,
|
|
46
|
+
GEMINI_API_KEY: 'placeholder',
|
|
47
|
+
GEMINI_CLI_CUSTOM_HEADERS: `Grazie-Authenticate-JWT: ${token}`
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const child = spawn('gemini', finalArgs, {
|
|
51
|
+
stdio: 'inherit',
|
|
52
|
+
env
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
child.on('error', (err) => {
|
|
56
|
+
if (err.code === 'ENOENT') {
|
|
57
|
+
console.error(`❌ Gemini CLI not found.\n`);
|
|
58
|
+
console.error(`Install with: npm install -g @google/gemini-cli`);
|
|
59
|
+
console.error(`Or run: jbai install gemini`);
|
|
60
|
+
} else {
|
|
61
|
+
console.error(`Error: ${err.message}`);
|
|
62
|
+
}
|
|
63
|
+
process.exit(1);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
child.on('exit', (code) => process.exit(code || 0));
|
package/bin/jbai-opencode.js
CHANGED
|
@@ -55,11 +55,13 @@ if (!opencodeConfig.provider) {
|
|
|
55
55
|
const envVarName = environment === 'staging' ? 'GRAZIE_STAGING_TOKEN' : 'GRAZIE_API_TOKEN';
|
|
56
56
|
|
|
57
57
|
// Add/update JetBrains provider with custom header (using env var reference)
|
|
58
|
+
// Use openai-compatible SDK which properly sends custom headers
|
|
59
|
+
// Point to OpenAI endpoint for compatibility
|
|
58
60
|
opencodeConfig.provider[providerName] = {
|
|
59
|
-
npm: '@ai-sdk/
|
|
61
|
+
npm: '@ai-sdk/openai-compatible',
|
|
60
62
|
name: `JetBrains AI (${environment})`,
|
|
61
63
|
options: {
|
|
62
|
-
baseURL: endpoints.
|
|
64
|
+
baseURL: endpoints.openai,
|
|
63
65
|
apiKey: `{env:${envVarName}}`,
|
|
64
66
|
headers: {
|
|
65
67
|
'Grazie-Authenticate-JWT': `{env:${envVarName}}`
|
|
@@ -68,10 +70,15 @@ opencodeConfig.provider[providerName] = {
|
|
|
68
70
|
models: {}
|
|
69
71
|
};
|
|
70
72
|
|
|
71
|
-
// Add
|
|
72
|
-
|
|
73
|
+
// Add OpenAI models (since we use openai-compatible SDK)
|
|
74
|
+
// Set context and output limits to avoid "max_tokens too large" errors
|
|
75
|
+
config.MODELS.openai.available.forEach(model => {
|
|
73
76
|
opencodeConfig.provider[providerName].models[model] = {
|
|
74
|
-
name: model
|
|
77
|
+
name: model,
|
|
78
|
+
limit: {
|
|
79
|
+
context: 128000,
|
|
80
|
+
output: 8192
|
|
81
|
+
}
|
|
75
82
|
};
|
|
76
83
|
});
|
|
77
84
|
|
|
@@ -84,7 +91,7 @@ let finalArgs = [];
|
|
|
84
91
|
|
|
85
92
|
if (!hasModel) {
|
|
86
93
|
// Use provider/model format for OpenCode
|
|
87
|
-
finalArgs.push('--model', `${providerName}/${config.MODELS.
|
|
94
|
+
finalArgs.push('--model', `${providerName}/${config.MODELS.openai.default}`);
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
// Add super mode flags
|
package/bin/jbai.js
CHANGED
|
@@ -24,10 +24,16 @@ const TOOLS = {
|
|
|
24
24
|
install: 'pipx install aider-chat',
|
|
25
25
|
check: 'aider --version'
|
|
26
26
|
},
|
|
27
|
+
gemini: {
|
|
28
|
+
name: 'Gemini CLI',
|
|
29
|
+
command: 'gemini',
|
|
30
|
+
install: 'npm install -g @google/gemini-cli',
|
|
31
|
+
check: 'gemini --version'
|
|
32
|
+
},
|
|
27
33
|
opencode: {
|
|
28
34
|
name: 'OpenCode',
|
|
29
35
|
command: 'opencode',
|
|
30
|
-
install: '
|
|
36
|
+
install: 'npm install -g opencode-ai',
|
|
31
37
|
check: 'opencode --version'
|
|
32
38
|
}
|
|
33
39
|
};
|
|
@@ -53,6 +59,7 @@ TOOL WRAPPERS:
|
|
|
53
59
|
jbai-claude Launch Claude Code with JetBrains AI
|
|
54
60
|
jbai-codex Launch Codex CLI with JetBrains AI
|
|
55
61
|
jbai-aider Launch Aider with JetBrains AI
|
|
62
|
+
jbai-gemini Launch Gemini CLI with JetBrains AI
|
|
56
63
|
jbai-opencode Launch OpenCode with JetBrains AI
|
|
57
64
|
|
|
58
65
|
SUPER MODE:
|
|
@@ -277,8 +284,6 @@ function doctor() {
|
|
|
277
284
|
console.log(` Install: ${tool.install}`);
|
|
278
285
|
}
|
|
279
286
|
}
|
|
280
|
-
|
|
281
|
-
console.log('\nTip: For Gemini models, use Aider: jbai-aider --model gemini/gemini-2.5-pro');
|
|
282
287
|
}
|
|
283
288
|
|
|
284
289
|
async function installTools(toolKey) {
|
package/lib/config.js
CHANGED
|
@@ -138,10 +138,15 @@ const TOOLS = {
|
|
|
138
138
|
command: 'aider',
|
|
139
139
|
install: 'pipx install aider-chat'
|
|
140
140
|
},
|
|
141
|
+
gemini: {
|
|
142
|
+
name: 'Gemini CLI',
|
|
143
|
+
command: 'gemini',
|
|
144
|
+
install: 'npm install -g @google/gemini-cli'
|
|
145
|
+
},
|
|
141
146
|
opencode: {
|
|
142
147
|
name: 'OpenCode',
|
|
143
148
|
command: 'opencode',
|
|
144
|
-
install: '
|
|
149
|
+
install: 'npm install -g opencode-ai'
|
|
145
150
|
}
|
|
146
151
|
};
|
|
147
152
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jbai-cli",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "CLI wrappers to use AI coding tools (Claude Code, Codex, Aider, OpenCode) with JetBrains AI Platform",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "CLI wrappers to use AI coding tools (Claude Code, Codex, Aider, Gemini CLI, OpenCode) with JetBrains AI Platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jetbrains",
|
|
7
7
|
"ai",
|
|
8
8
|
"claude",
|
|
9
9
|
"codex",
|
|
10
10
|
"aider",
|
|
11
|
+
"gemini",
|
|
11
12
|
"opencode",
|
|
12
13
|
"cli",
|
|
13
14
|
"openai",
|
|
14
|
-
"anthropic"
|
|
15
|
+
"anthropic",
|
|
16
|
+
"google"
|
|
15
17
|
],
|
|
16
18
|
"author": "Andrii Shchupliak",
|
|
17
19
|
"license": "MIT",
|
|
@@ -28,6 +30,7 @@
|
|
|
28
30
|
"jbai-claude": "./bin/jbai-claude.js",
|
|
29
31
|
"jbai-codex": "./bin/jbai-codex.js",
|
|
30
32
|
"jbai-aider": "./bin/jbai-aider.js",
|
|
33
|
+
"jbai-gemini": "./bin/jbai-gemini.js",
|
|
31
34
|
"jbai-opencode": "./bin/jbai-opencode.js"
|
|
32
35
|
},
|
|
33
36
|
"files": [
|