diff --git a/docs/installation.md b/docs/installation.md index 71cf1a0..e81c8ac 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -21,9 +21,10 @@ invokes thoth-mem's public setup command. Once installed, SDD phases load local contracts and provider guidance without consuming either CLI or the network. Nested package installation is non-interactive: the CLI confirms both `npx` -package acquisition and the `skills` operation explicitly. On Windows it routes -npm's `npx.cmd` shim and Codex's `codex.cmd` shim through `cmd.exe`; Linux and -macOS execute those commands directly. +package acquisition and the `skills` operation explicitly. On Windows it passes +each complete `npx` command as one `cmd.exe /c` payload and invokes the +extension-neutral `codex` command, supporting both standalone `codex.exe` and +npm's `codex.cmd` shim. Linux and macOS execute those commands directly. ## Supported flow diff --git a/src/cli/codex-plugin-install.test.ts b/src/cli/codex-plugin-install.test.ts index ed239d8..a94a3db 100644 --- a/src/cli/codex-plugin-install.test.ts +++ b/src/cli/codex-plugin-install.test.ts @@ -65,7 +65,7 @@ function executor(state: ManagerState): CodexCommandExecutor { } describe('Codex native plugin installation', () => { - test('routes the Codex npm shim through cmd.exe on Windows', () => { + test('routes Codex through an extension-neutral command on Windows', () => { const invocation = getCodexCommand( ['plugin', 'list', '--available', '--json'], { platform: 'win32', commandShell: 'C:\\Windows\\System32\\cmd.exe' }, @@ -77,7 +77,7 @@ describe('Codex native plugin installation', () => { '/d', '/s', '/c', - 'codex.cmd', + 'codex', 'plugin', 'list', '--available', diff --git a/src/cli/codex-plugin-install.ts b/src/cli/codex-plugin-install.ts index b89642d..c2b4a97 100644 --- a/src/cli/codex-plugin-install.ts +++ b/src/cli/codex-plugin-install.ts @@ -84,7 +84,7 @@ export function getCodexCommand( return { command: options.commandShell ?? process.env.ComSpec ?? 'cmd.exe', - args: ['/d', '/s', '/c', 'codex.cmd', ...args], + args: ['/d', '/s', '/c', 'codex', ...args], }; } diff --git a/src/cli/npx-command.test.ts b/src/cli/npx-command.test.ts new file mode 100644 index 0000000..cac0374 --- /dev/null +++ b/src/cli/npx-command.test.ts @@ -0,0 +1,31 @@ +import { describe, expect, test } from 'vitest'; +import { getNpxCommand } from './npx-command'; + +describe('npx command invocation', () => { + test('passes the complete npx command string to cmd.exe on Windows', () => { + const commandShell = 'C:\\Windows\\System32\\cmd.exe'; + + expect( + getNpxCommand( + [ + '-y', + 'thoth-mem@latest', + 'setup', + 'codex', + '--scope', + 'global', + '--json', + ], + { platform: 'win32', commandShell }, + ), + ).toEqual({ + command: commandShell, + args: [ + '/d', + '/s', + '/c', + 'npx -y thoth-mem@latest setup codex --scope global --json', + ], + }); + }); +}); diff --git a/src/cli/npx-command.ts b/src/cli/npx-command.ts index 2c52f0a..1694c38 100644 --- a/src/cli/npx-command.ts +++ b/src/cli/npx-command.ts @@ -18,6 +18,6 @@ export function getNpxCommand( return { command: options.commandShell ?? process.env.ComSpec ?? 'cmd.exe', - args: ['/d', '/s', '/c', 'npx.cmd', ...args], + args: ['/d', '/s', '/c', ['npx', ...args].join(' ')], }; } diff --git a/src/cli/skills.test.ts b/src/cli/skills.test.ts index aaa0138..7fab147 100644 --- a/src/cli/skills.test.ts +++ b/src/cli/skills.test.ts @@ -154,7 +154,7 @@ describe('required skill install helper', () => { ); }); - test('routes the npx package shim through cmd.exe on Windows', () => { + test('routes the complete npx command through cmd.exe on Windows', () => { const homeDir = mkdtempSync(join(tmpdir(), 'thoth-skill-home-')); const commandShell = 'C:\\Windows\\System32\\cmd.exe'; vi.mocked(spawnSync).mockReturnValueOnce({ @@ -173,17 +173,7 @@ describe('required skill install helper', () => { '/d', '/s', '/c', - 'npx.cmd', - '--yes', - 'skills', - 'add', - testSkill.repo, - '--skill', - testSkill.skillName, - '--global', - '--agent', - 'codex', - '--yes', + 'npx --yes skills add https://example.test/simplify --skill simplify --global --agent codex --yes', ], }; diff --git a/src/cli/thoth-mem-install.test.ts b/src/cli/thoth-mem-install.test.ts index da41078..1fdf53b 100644 --- a/src/cli/thoth-mem-install.test.ts +++ b/src/cli/thoth-mem-install.test.ts @@ -83,7 +83,7 @@ describe('thoth-mem setup adapter', () => { expect(applied.args).not.toContain('--force'); }); - test('routes the provider npx package shim through cmd.exe on Windows', () => { + test('routes the complete provider command through cmd.exe on Windows', () => { const commandShell = 'C:\\Windows\\System32\\cmd.exe'; expect( @@ -97,14 +97,7 @@ describe('thoth-mem setup adapter', () => { '/d', '/s', '/c', - 'npx.cmd', - '-y', - 'thoth-mem@latest', - 'setup', - 'codex', - '--scope', - 'global', - '--json', + 'npx -y thoth-mem@latest setup codex --scope global --json', ], }); });