Skip to content
Open
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
6 changes: 5 additions & 1 deletion cli/install-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ export function runNpmInstall(pluginRoot, { spawn = defaultSpawn, lockHandle } =
console.error('Installing episodic-memory dependencies (first run only)...');
console.error('This may take 30-60 seconds...');

const child = spawn(npmCommand, ['install', '--no-audit', '--no-fund'], {
// --omit=dev: the plugin runs prebuilt dist/, so dev tooling (tsx, esbuild,
// vitest, typescript) is never loaded at runtime. Skipping it makes this
// install smaller and faster, and drops native postinstall steps (esbuild's
// binary check) that can fail the whole install (#203).
const child = spawn(npmCommand, ['install', '--omit=dev', '--no-audit', '--no-fund'], {
cwd: pluginRoot,
stdio: ['ignore', 'pipe', 'pipe'],
shell: isWindows, // On Windows, we need shell: true to find npm.cmd
Expand Down
15 changes: 15 additions & 0 deletions test/mcp-install-runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ describe('install-runner — runNpmInstall termination handling (#161)', () => {
expect(process.listenerCount('exit')).toBe(beforeExit);
});

it('installs runtime dependencies only (--omit=dev) (#203)', async () => {
const child = makeFakeChild();
const fakeSpawn = vi.fn((..._args: unknown[]) => child);
const install = runNpmInstall(root, { spawn: fakeSpawn });

const [command, args, options] = fakeSpawn.mock.calls[0] as [string, string[], { cwd: string }];
expect(command).toMatch(/^npm(\.cmd)?$/);
expect(args[0]).toBe('install');
expect(args).toContain('--omit=dev');
expect(options.cwd).toBe(root);

child.emit('exit', 0);
await install.promise;
});

it('resolves and removes handlers when the child exits 0 normally (no termination)', async () => {
const beforeSigterm = process.listenerCount('SIGTERM');

Expand Down