Skip to content

Commit 15f11ed

Browse files
committed
fix(embed): pass --no-save to interactive TTY install
The non-TTY auto-install path already passes `--no-save`. The TTY path did not, which was fine when `cwd` defaulted to `process.cwd()` because that already polluted the user's working dir (a separate, original bug). Now that `cwd` is pinned to codegraph's host directory, omitting `--no-save` would silently add `@huggingface/transformers` to the `package.json` sitting next to codegraph's `node_modules` (the user's project root when codegraph is a local dep, or the npm global prefix when global-installed). Match the non-TTY path so installs stay ephemeral regardless of code path. Updates the corresponding assertion in tests/unit/prompt-install.test.ts.
1 parent f4d5a87 commit 15f11ed

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/domain/search/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function promptInstall(packageName: string): Promise<boolean> {
160160
rl.close();
161161
if (answer.trim().toLowerCase() !== 'y') return resolve(false);
162162
try {
163-
execFileSync(NPM_BIN, ['install', packageName], {
163+
execFileSync(NPM_BIN, ['install', '--no-save', packageName], {
164164
stdio: 'inherit',
165165
timeout: 300_000,
166166
cwd: installCwd,

tests/unit/prompt-install.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('loadTransformers install prompt', () => {
151151
});
152152
expect(execMock).toHaveBeenCalledWith(
153153
expectedNpmBin,
154-
['install', '@huggingface/transformers'],
154+
['install', '--no-save', '@huggingface/transformers'],
155155
expect.objectContaining({ stdio: 'inherit', timeout: 300_000 }),
156156
);
157157
});

0 commit comments

Comments
 (0)