Skip to content

Commit cc1cfd2

Browse files
committed
Updated Installer
2 parents 4a32def + aff8251 commit cc1cfd2

File tree

10 files changed

+148
-61
lines changed

10 files changed

+148
-61
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ AI.duino will appear in the German Make Magazine. This is the feature-freeze rel
1313
* Response length can be set in four steps with a slider (2000, 4000, 6000 and 8000 tokens)
1414

1515
## Bugfixes
16-
* Fixed critical key generation bug.
16+
* Fixed critical key generation bug
1717
* All settings are now removed correctly when using the uninstall option
1818
* Removed unused file
1919
* Removed debugging code
@@ -28,6 +28,7 @@ AI.duino will appear in the German Make Magazine. This is the feature-freeze rel
2828
* Fixed load model on startup bug
2929
* Fixed addComments locale bug
3030
* Updated Mistral key formation settings
31+
* Installer removes now all previously installed versions
3132

3233
## Other
3334
* You can abort a feature by clicking outside prompt window

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
## 2026
44

5+
<<<<<<< HEAD
56
* **23.01.2026** New logo and banner for AI.duino to avoid copyright issues.
67
* **20.01.2026** Working heavy on agentic coding integration.
78
* **11.01.2026** Updated provider configs. Mstral changed its key format.
9+
=======
10+
* **24.01.2026** New logo and banner to avoid copyright issues.
11+
>>>>>>> aff825164d15bedb0d1090a50adae6fd43f4e821
812
* **01.01.2026** Happy new year! V2.6.0 is in progress, but won't be released until March.
913

1014
## 2025

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ AI.duino integrates the API providers **Claude, ChatGPT, Gemini, Mistral, Perple
99
*Oje, Englisch? Kann ich nicht. Schnell [hier hin](https://github.com/NikolaiRadke/AI.duino/wiki)*.
1010

1111
🆕 What's new?
12+
<<<<<<< HEAD
1213
* **23.01.2026** New logo and banner for AI.duino to avoid copyright issues.
14+
=======
15+
* **23.01.2026** New logo and banner to avoid copyright issues.
16+
>>>>>>> aff825164d15bedb0d1090a50adae6fd43f4e821
1317
-- More news? Check the [newsblog](https://github.com/NikolaiRadke/AI.duino/blob/main/NEWS.md).
1418

1519
## Features

aiduino/extension/out/localProviders/processProviders/claudeCode.js

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,39 @@
44
*/
55

66
const { executeProcessProvider } = require('./processProvider');
7-
const vscode = require('vscode');
87

98
/**
109
* Build command arguments with session support
10+
* @param {string} prompt - User prompt
11+
* @param {string|null} sessionId - Session ID for persistent conversations
12+
* @param {boolean} agenticMode - If true, don't use --print (allow file editing)
13+
* @returns {Array<string>} Command arguments
1114
*/
12-
function buildArgs(prompt, sessionId = null) {
15+
function buildArgs(prompt, sessionId = null, agenticMode = false) {
16+
const args = [
17+
'--dangerously-skip-permissions',
18+
'--output-format', 'json'
19+
];
20+
21+
// Only use --print in non-agentic mode (Claude Code won't edit files with --print)
22+
if (!agenticMode) {
23+
args.unshift('--print');
24+
}
25+
1326
if (sessionId) {
14-
// Use --resume with session ID (like in terminal test)
15-
return ['--print', '--resume', sessionId, '--dangerously-skip-permissions', '--output-format', 'json', prompt];
16-
} else {
17-
return ['--print', '--dangerously-skip-permissions', '--output-format', 'json', prompt];
27+
args.push('--resume', sessionId);
1828
}
29+
30+
args.push(prompt);
31+
return args;
1932
}
2033

2134
/**
2235
* Extract response and session ID from output
36+
* @param {string} stdout - Raw output from CLI
37+
* @returns {Object} { response, sessionId }
2338
*/
2439
function extractResponse(stdout) {
25-
const vscode = require('vscode');
2640
try {
2741
const jsonResponse = JSON.parse(stdout);
2842
const response = jsonResponse.result || jsonResponse.content || stdout;
@@ -34,12 +48,23 @@ function extractResponse(stdout) {
3448
}
3549

3650
/**
37-
* Execute Claude Code command
51+
* Execute Claude Code command with project awareness
52+
* @param {string} toolPath - Path to Claude Code CLI
53+
* @param {string} prompt - User prompt
54+
* @param {Object} context - Extension context
55+
* @param {string|null} sessionId - Session ID for persistent conversations
56+
* @param {string|null} workspacePath - Project directory (used as cwd)
57+
* @param {boolean} agenticMode - If true, allow file editing
58+
* @returns {Promise<string>} Raw output from Claude Code
3859
*/
39-
async function executeCommand(toolPath, prompt, context, sessionId = null) {
60+
async function executeCommand(toolPath, prompt, context, sessionId = null, workspacePath = null, agenticMode = false) {
4061
const { t } = context;
41-
const args = buildArgs(prompt, sessionId);
42-
return executeProcessProvider(toolPath, args, 'Claude Code', t);
62+
const args = buildArgs(prompt, sessionId, agenticMode);
63+
64+
// Pass workspacePath as cwd so Claude Code can access sketch files
65+
const options = workspacePath ? { cwd: workspacePath } : {};
66+
67+
return executeProcessProvider(toolPath, args, 'Claude Code', t, 300000, options);
4368
}
4469

4570
module.exports = {
Lines changed: 89 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,117 @@
11
/**
2-
* Codex CLI Process Provider
3-
* Provider-specific logic for OpenAI Codex CLI
2+
* Codex / ChatGPT CLI integration
3+
* API-identical to claudeCode.js
44
*/
55

6+
'use strict';
7+
68
const { executeProcessProvider, cleanProcessOutput } = require('./processProvider');
79

810
/**
9-
* Build command arguments with session support
10-
* @param {string} prompt - User prompt
11-
* @param {string|null} sessionId - Optional session ID for continuation
12-
* @returns {Array} Command arguments
11+
* Build CLI arguments
12+
* Signature must stay identical to claudeCode.js
13+
*
14+
* @param {string} prompt
15+
* @param {string|null} sessionId
16+
* @param {boolean} agenticMode
17+
* @returns {string[]}
1318
*/
14-
function buildArgs(prompt, sessionId = null) {
19+
function buildArgs(prompt, sessionId = null, agenticMode = false) {
20+
const args = ['exec', '--skip-git-repo-check'];
21+
1522
if (sessionId) {
16-
// Continue existing session
17-
return ['--continue', '--non-interactive', prompt];
18-
} else {
19-
// Start new session
20-
return ['--suggest', '--non-interactive', prompt];
23+
args.push('--session', sessionId);
2124
}
25+
26+
if (agenticMode) {
27+
args.push('--full-auto');
28+
}
29+
30+
args.push('--json');
31+
args.push(prompt);
32+
33+
return args;
2234
}
2335

2436
/**
25-
* Extract response and session ID from output
26-
* @param {string} stdout - Command output
27-
* @returns {Object} {response: string, sessionId: string|null}
37+
* Extract the actual model response from raw CLI output
38+
* Signature must stay identical to claudeCode.js
39+
*
40+
* @param {string} rawOutput
41+
* @returns {string}
2842
*/
29-
function extractResponse(stdout) {
43+
function extractResponse(rawOutput) {
44+
if (!rawOutput) {
45+
return { response: '', sessionId: null };
46+
}
47+
3048
try {
31-
const jsonResponse = JSON.parse(stdout);
49+
// Codex CLI outputs NDJSON - find item.completed events with text
50+
const lines = rawOutput.split(/\}\s*\{/).map((line, i, arr) => {
51+
if (i === 0) return line + '}';
52+
if (i === arr.length - 1) return '{' + line;
53+
return '{' + line + '}';
54+
});
3255

33-
// Try to extract session ID from response
34-
// Codex CLI saves sessions to ~/.codex/sessions/[session-id].jsonl
35-
// The session ID might be in the response metadata
36-
const response = jsonResponse.response || jsonResponse.output || jsonResponse.text || JSON.stringify(jsonResponse, null, 2);
37-
const sessionId = jsonResponse.session_id || jsonResponse.sessionId || null;
56+
let text = '';
57+
for (const line of lines) {
58+
try {
59+
const event = JSON.parse(line);
60+
if (event.type === 'item.completed' && event.item?.text) {
61+
text += event.item.text;
62+
}
63+
} catch (e) {
64+
// Skip invalid JSON
65+
}
66+
}
3867

39-
return { response, sessionId };
40-
} catch {
41-
// Fallback: clean text output, no session ID
42-
return {
43-
response: cleanProcessOutput(stdout),
44-
sessionId: null
45-
};
68+
if (text) {
69+
return { response: text.trim(), sessionId: null };
70+
}
71+
} catch (e) {
72+
// Fallback to raw output
4673
}
74+
75+
return { response: rawOutput.trim(), sessionId: null };
4776
}
4877

4978
/**
50-
* Execute Codex CLI command with optional session continuation
51-
* @param {string} toolPath - Path to codex binary
52-
* @param {string} prompt - User prompt
53-
* @param {Object} context - Extension context
54-
* @param {string|null} sessionId - Optional session ID
55-
* @returns {Promise<string>} Command output
79+
* Execute the Codex / ChatGPT CLI
80+
* Signature and parameter order must stay identical to claudeCode.js
81+
*
82+
* @param {string} toolPath
83+
* @param {string} prompt
84+
* @param {object} context
85+
* @param {string|null} sessionId
86+
* @param {string|null} workspacePath
87+
* @param {boolean} agenticMode
88+
* @returns {Promise<string>}
5689
*/
57-
async function executeCommand(toolPath, prompt, context, sessionId = null) {
90+
async function executeCommand(
91+
toolPath,
92+
prompt,
93+
context,
94+
sessionId = null,
95+
workspacePath = null,
96+
agenticMode = false
97+
) {
5898
const { t } = context;
59-
const args = buildArgs(prompt, sessionId);
60-
return executeProcessProvider(toolPath, args, 'Codex CLI', t);
99+
const args = buildArgs(prompt, sessionId, agenticMode);
100+
101+
const options = workspacePath ? { cwd: workspacePath } : {};
102+
103+
return executeProcessProvider(
104+
toolPath,
105+
args,
106+
'Codex CLI',
107+
t,
108+
300000,
109+
options
110+
);
61111
}
62112

63113
module.exports = {
64114
executeCommand,
65115
extractResponse
66116
};
117+

aiduino/extension/out/localProviders/processProviders/processProvider.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ async function executeCommand(toolPath, prompt, context, provider, sessionId = n
6060
* @param {string} providerName - Provider name for error messages
6161
* @param {Function} t - Translation function
6262
* @param {number} timeout - Timeout in milliseconds (default: 300000 = 5 min)
63+
* @param {Object} options - Additional options (e.g., { cwd: '/path' })
6364
* @returns {Promise<string>} stdout output
6465
*/
65-
async function executeProcessProvider(toolPath, args, providerName, t, timeout = 300000) {
66+
async function executeProcessProvider(toolPath, args, providerName, t, timeout = 300000, options = {}) {
6667
return new Promise((resolve, reject) => {
6768
const childProcess = spawn(toolPath, args, {
68-
cwd: '/tmp',
69+
cwd: options.cwd || '/tmp',
6970
stdio: ['ignore', 'pipe', 'pipe'],
7071
detached: true,
7172
windowsHide: true

installer/aiduino.vsix

569 Bytes
Binary file not shown.

installer/install_aiduino_linux.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ fi
4646
# Clean up old installations (all versions)
4747
echo "Cleaning up old installations..."
4848
rm -f "$EXTENSIONS_DIR"/aiduino*.vsix 2>/dev/null
49-
if [ -d "$DEPLOYED_DIR/aiduino" ]; then
50-
echo -e "${YELLOW}Removing old deployed extension...${NC}"
51-
rm -rf "$DEPLOYED_DIR/aiduino"
49+
if ls "$DEPLOYED_DIR"/aiduino* 1> /dev/null 2>&1; then
50+
echo -e "${YELLOW}Removing old deployed extension(s)...${NC}"
51+
rm -rf "$DEPLOYED_DIR"/aiduino*
5252
fi
5353

5454
# Copy new VSIX

installer/install_aiduino_macos.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ fi
4646
# Clean up old installations (all versions)
4747
echo "Cleaning up old installations..."
4848
rm -f "$EXTENSIONS_DIR"/aiduino*.vsix 2>/dev/null
49-
if [ -d "$DEPLOYED_DIR/aiduino" ]; then
50-
echo -e "${YELLOW}Removing old deployed extension...${NC}"
51-
rm -rf "$DEPLOYED_DIR/aiduino"
49+
if ls "$DEPLOYED_DIR"/aiduino* 1> /dev/null 2>&1; then
50+
echo -e "${YELLOW}Removing old deployed extension(s)...${NC}"
51+
rm -rf "$DEPLOYED_DIR"/aiduino*
5252
fi
5353

5454
# Copy new VSIX

installer/install_aiduino_windows.bat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ REM Remove old versions (all aiduino*.vsix files)
5050
echo Cleaning up old installations...
5151
del /q "%EXTENSIONS_DIR%\aiduino*.vsix" 2>nul
5252

53-
if exist "%DEPLOYED_DIR%\aiduino" (
54-
echo Removing old deployed extension...
55-
rmdir /s /q "%DEPLOYED_DIR%\aiduino"
53+
REM Remove old deployed extensions (all versions)
54+
for /d %%D in ("%DEPLOYED_DIR%\aiduino*") do (
55+
echo Removing old deployed extension: %%~nxD
56+
rmdir /s /q "%%D"
5657
)
5758

5859
REM Copy new file

0 commit comments

Comments
 (0)