Skip to content

Commit 7b8cc91

Browse files
committed
Add auto-update of CLIs on launch (superCli.autoUpdate, default on)
Before launching an agent, run its install command (npm reinstall for npm CLIs, or the official installer script for the others) to update it to the latest version. Controlled by the new superCli.autoUpdate setting; turn it off to launch without updating.
1 parent d92cfbc commit 7b8cc91

7 files changed

Lines changed: 45 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project are documented here. The format is based on
44
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

6+
## [0.5.0]
7+
8+
- New `superCli.autoUpdate` setting (default on): each coding agent CLI is updated to its latest
9+
version on launch — `npm install -g` for npm CLIs, or the official installer script for the others —
10+
before it starts. Turn it off to launch without updating.
11+
612
## [0.4.1]
713

814
- Claude Code no longer auto-installs its companion IDE extension when launched from Super CLI. The

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ an untrusted repository cannot inject commands.
9797
| `superCli.agents` | `[]` | Your agents (added to or overriding the built-ins). |
9898
| `superCli.useBuiltins` | `true` | Include the built-in agent presets. |
9999
| `superCli.terminalLocation` | `beside` | Open the terminal `beside` the editor or in the `panel`. |
100+
| `superCli.autoUpdate` | `true` | Update each CLI to its latest version on launch (npm reinstall or the official installer script). |
100101

101102
Run **Super CLI: Open Settings** from the sidebar or the command palette to jump straight to these
102103
settings.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Super CLI",
44
"description": "One VS Code extension to launch any coding agent CLI (Claude Code, Codex, Copilot, Antigravity, and your own) from a single side terminal.",
55
"publisher": "mikesoft",
6-
"version": "0.4.1",
6+
"version": "0.5.0",
77
"repository": {
88
"type": "git",
99
"url": "https://github.com/TheStreamCode/super-cli.git"
@@ -253,6 +253,12 @@
253253
"default": "beside",
254254
"scope": "window",
255255
"description": "Where to open the terminal that runs the coding agent."
256+
},
257+
"superCli.autoUpdate": {
258+
"type": "boolean",
259+
"default": true,
260+
"scope": "window",
261+
"description": "Update each coding agent CLI to its latest version on launch, using its install command (npm reinstall, or the official installer script). Disable to launch without updating."
256262
}
257263
}
258264
}

src/command-utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ export function resolveHomePath(p: string, homedir: string): string {
109109
return p;
110110
}
111111

112+
/** Prepends an optional update command so the CLI updates before it runs (no-op without one). */
113+
export function buildLaunchCommand(command: string, updateCommand: string | undefined): string {
114+
return updateCommand ? `${updateCommand} ; ${command}` : command;
115+
}
116+
112117
/** Adds only the keys from `defaults` that are absent in `existing`; reports whether anything changed. */
113118
export function mergeMissingDefaults(
114119
existing: Record<string, unknown>,

src/terminal.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as vscode from 'vscode';
55
import { type Agent, resolveInstallCommand } from './agents.js';
66
import {
77
buildExtensionSettingsQuery,
8+
buildLaunchCommand,
89
buildTerminalName,
910
mergeMissingDefaults,
1011
resolveHomePath,
@@ -148,10 +149,15 @@ async function handleMissingAgent(agent: Agent, context: vscode.ExtensionContext
148149
}
149150
}
150151

151-
function watchForMissingAgent(terminal: vscode.Terminal, agent: Agent, context: vscode.ExtensionContext): void {
152+
function watchForMissingAgent(
153+
terminal: vscode.Terminal,
154+
agent: Agent,
155+
context: vscode.ExtensionContext,
156+
runCommand: string,
157+
): void {
152158
executeCommandWithOptionalShellIntegration(
153159
terminal,
154-
agent.command,
160+
runCommand,
155161
context,
156162
async (endEvent, output) => {
157163
if (shouldPromptToInstall(agent.command, endEvent.exitCode, output)) {
@@ -222,7 +228,11 @@ export async function launchAgent(agent: Agent, context: vscode.ExtensionContext
222228

223229
applyEnsureConfig(agent);
224230

225-
const location = vscode.workspace.getConfiguration(SETTINGS_NAMESPACE).get<string>('terminalLocation', 'beside');
231+
const configuration = vscode.workspace.getConfiguration(SETTINGS_NAMESPACE);
232+
const location = configuration.get<string>('terminalLocation', 'beside');
233+
const autoUpdate = configuration.get<boolean>('autoUpdate', true);
234+
const updateCommand = autoUpdate ? resolveInstallCommand(agent.installCommand, process.platform) : undefined;
235+
const launchCommand = buildLaunchCommand(command, updateCommand);
226236
const cwd = resolveTerminalCwd(vscode.window.activeTextEditor, vscode.workspace);
227237

228238
const terminal = vscode.window.createTerminal({
@@ -232,6 +242,6 @@ export async function launchAgent(agent: Agent, context: vscode.ExtensionContext
232242
env: agent.env,
233243
});
234244
terminal.show();
235-
watchForMissingAgent(terminal, agent, context);
245+
watchForMissingAgent(terminal, agent, context, launchCommand);
236246
void vscode.window.setStatusBarMessage(`Started ${agent.label}`, 2500);
237247
}

test/command-utils.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
shouldPromptToInstall,
1111
resolveHomePath,
1212
mergeMissingDefaults,
13+
buildLaunchCommand,
1314
} = require('../out/command-utils.js');
1415

1516
// normalizeTerminalName
@@ -144,3 +145,12 @@ test('mergeMissingDefaults reports no change when all keys are already present',
144145
const { changed } = mergeMissingDefaults({ a: 1, b: 2 }, { a: 9 });
145146
assert.equal(changed, false);
146147
});
148+
149+
// buildLaunchCommand
150+
test('buildLaunchCommand prepends the update command before the launch command', () => {
151+
assert.equal(buildLaunchCommand('claude', 'npm install -g x'), 'npm install -g x ; claude');
152+
});
153+
154+
test('buildLaunchCommand returns the command unchanged without an update command', () => {
155+
assert.equal(buildLaunchCommand('claude', undefined), 'claude');
156+
});

0 commit comments

Comments
 (0)