Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/cli/codex-plugin-install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand All @@ -77,7 +77,7 @@ describe('Codex native plugin installation', () => {
'/d',
'/s',
'/c',
'codex.cmd',
'codex',
'plugin',
'list',
'--available',
Expand Down
2 changes: 1 addition & 1 deletion src/cli/codex-plugin-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
};
}

Expand Down
31 changes: 31 additions & 0 deletions src/cli/npx-command.test.ts
Original file line number Diff line number Diff line change
@@ -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',
],
});
});
});
2 changes: 1 addition & 1 deletion src/cli/npx-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(' ')],
};
}
14 changes: 2 additions & 12 deletions src/cli/skills.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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',
],
};

Expand Down
11 changes: 2 additions & 9 deletions src/cli/thoth-mem-install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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',
],
});
});
Expand Down
Loading