claude-dev-env 8.107.0 → 8.107.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -201,15 +201,20 @@ export function shouldInstallMarketplacePlugin(
201
201
  return environment[spec.optOutVariable] !== '0';
202
202
  }
203
203
 
204
+ const BARE_COMMAND_NAME_PATTERN = /^[A-Za-z0-9_][\w.-]*$/;
205
+
204
206
  /**
205
207
  * Build the process launch one platform needs to run a host command.
206
208
  *
207
- * Both hosts ship on Windows as a `.cmd` shim, and Node's synchronous spawn
208
- * rejects a batch file with `EINVAL` unless a shell runs it, so Windows goes
209
- * through `cmd.exe /d /s /c` with the whole command line as one verbatim
210
- * argument. The executable carries its own quotes inside that line, which is
211
- * why the line is passed verbatim rather than quoted again by Node. Every
212
- * other platform launches the executable directly.
209
+ * The hosts, `claude`, `codex` and the `npm` that installs Pele, ship on
210
+ * Windows as a `.cmd` shim. Node's synchronous spawn rejects a batch file with
211
+ * `EINVAL` unless a shell runs it, so Windows goes through `cmd.exe /d /s /c`
212
+ * with the whole command line as one verbatim argument. A path carries its own
213
+ * quotes inside that line, which is why the line is passed verbatim rather than
214
+ * quoted again by Node. A bare name stays unquoted because `cmd.exe` hands a
215
+ * quoted bare name to a shim as `%0`, and the shim then resolves `%~dp0`
216
+ * against the working directory instead of its own folder. Every other
217
+ * platform launches the executable directly.
213
218
  *
214
219
  * @param {string} executable The host command, a bare name or a path.
215
220
  * @param {string[]} commandArguments The arguments after the executable.
@@ -226,7 +231,8 @@ export function hostCommandInvocation(
226
231
  if (platform !== 'win32') {
227
232
  return { file: executable, args: [...commandArguments], windowsVerbatimArguments: false };
228
233
  }
229
- const commandLine = [`"${executable}"`, ...commandArguments].join(' ');
234
+ const launchedExecutable = BARE_COMMAND_NAME_PATTERN.test(executable) ? executable : `"${executable}"`;
235
+ const commandLine = [launchedExecutable, ...commandArguments].join(' ');
230
236
  return {
231
237
  file: environment.ComSpec || 'cmd.exe',
232
238
  args: ['/d', '/s', '/c', `"${commandLine}"`],
@@ -19,6 +19,7 @@ import {
19
19
  removeStaleMarketplaceClone,
20
20
  removeRetiredMarketplacePlugins,
21
21
  restartNotice,
22
+ runHostCommand,
22
23
  shouldInstallMarketplacePlugin,
23
24
  } from './install-pstack-plugin.mjs';
24
25
 
@@ -265,11 +266,37 @@ test('Windows launches the host command through cmd.exe, which alone can run a .
265
266
  '/d',
266
267
  '/s',
267
268
  '/c',
268
- `""claude" plugin install ${PSTACK_PLUGIN_IDENTIFIER}"`,
269
+ `"claude plugin install ${PSTACK_PLUGIN_IDENTIFIER}"`,
269
270
  ]);
270
271
  assert.equal(invocation.windowsVerbatimArguments, true);
271
272
  });
272
273
 
274
+ test('a bare Windows command name stays unquoted so a .cmd shim finds its own folder through %~dp0', () => {
275
+ const invocation = hostCommandInvocation('npm', ['view', 'pele', 'version'], 'win32', WINDOWS_ENVIRONMENT);
276
+ assert.equal(invocation.args.at(-1), '"npm view pele version"');
277
+ });
278
+
279
+ test('npm runs from a folder away from its own install on Windows', { skip: process.platform !== 'win32' }, () => {
280
+ const workingDirectory = mkdtempSync(join(tmpdir(), 'cde-npm-launch-'));
281
+ try {
282
+ const outcome = runHostCommand('npm', ['--version'], { cwd: workingDirectory });
283
+ assert.equal(outcome.status, 0, outcome.stderr);
284
+ assert.match(outcome.stdout, /^\d+\.\d+\.\d+/);
285
+ } finally {
286
+ rmSync(workingDirectory, { recursive: true, force: true });
287
+ }
288
+ });
289
+
290
+ test('a Windows executable name with a shell metacharacter stays quoted', () => {
291
+ const invocation = hostCommandInvocation('npm&calc', ['view'], 'win32', WINDOWS_ENVIRONMENT);
292
+ assert.equal(invocation.args.at(-1), '""npm&calc" view"');
293
+ });
294
+
295
+ test('a Windows executable name that is a dot path or starts with a dash stays quoted', () => {
296
+ assert.equal(hostCommandInvocation('..', ['view'], 'win32', WINDOWS_ENVIRONMENT).args.at(-1), '"".." view"');
297
+ assert.equal(hostCommandInvocation('-npm', ['view'], 'win32', WINDOWS_ENVIRONMENT).args.at(-1), '""-npm" view"');
298
+ });
299
+
273
300
  test('a Windows executable path holding a space stays one quoted token', () => {
274
301
  const invocation = hostCommandInvocation(
275
302
  'C:\\Program Files\\nodejs\\claude.cmd',
@@ -285,8 +285,8 @@ test('package settings.json publishes the session agent, advisor model, auto-com
285
285
  assert.equal(settingsDefaults.autoCompactWindow, 350000);
286
286
  assert.deepEqual(settingsDefaults.env, { CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS: '100000', PYTHONUTF8: '1' });
287
287
  assert.deepEqual(settingsDefaults.modelSettings, {
288
- 'claude-haiku-5-5': { autoCompactWindow: 100000 },
289
- 'claude-haiku-4-5': { autoCompactWindow: 100000 },
288
+ 'claude-haiku-5-5': { autoCompactWindow: 250000 },
289
+ 'claude-haiku-4-5': { autoCompactWindow: 250000 },
290
290
  });
291
291
  assert.equal(settingsDefaults.agent, 'dev-env-session');
292
292
  assert.ok(
@@ -53,8 +53,8 @@ test('mergeMissingSettingsDefaults should add a missing model entry and a missin
53
53
  assert.deepEqual(
54
54
  mergeMissingSettingsDefaults(targetSettings, {
55
55
  modelSettings: {
56
- 'claude-haiku-5-5': { autoCompactWindow: 100000 },
57
- 'claude-haiku-4-5': { autoCompactWindow: 100000 },
56
+ 'claude-haiku-5-5': { autoCompactWindow: 250000 },
57
+ 'claude-haiku-4-5': { autoCompactWindow: 250000 },
58
58
  },
59
59
  }),
60
60
  {
@@ -66,13 +66,13 @@ test('mergeMissingSettingsDefaults should add a missing model entry and a missin
66
66
  );
67
67
  assert.deepEqual(targetSettings.modelSettings, {
68
68
  'claude-opus-5-5': { effortLevel: 'medium' },
69
- 'claude-haiku-4-5': { effortLevel: 'low', autoCompactWindow: 100000 },
70
- 'claude-haiku-5-5': { autoCompactWindow: 100000 },
69
+ 'claude-haiku-4-5': { effortLevel: 'low', autoCompactWindow: 250000 },
70
+ 'claude-haiku-5-5': { autoCompactWindow: 250000 },
71
71
  });
72
72
  });
73
73
 
74
74
  test('mergeMissingSettingsDefaults should give each target its own copy of an added default', () => {
75
- const settingsDefaults = { modelSettings: { 'claude-haiku-5-5': { autoCompactWindow: 100000 } } };
75
+ const settingsDefaults = { modelSettings: { 'claude-haiku-5-5': { autoCompactWindow: 250000 } } };
76
76
  const firstTarget = {};
77
77
  const secondTarget = {};
78
78
 
@@ -80,7 +80,7 @@ test('mergeMissingSettingsDefaults should give each target its own copy of an ad
80
80
  firstTarget.modelSettings['claude-haiku-5-5'].autoCompactWindow = 200000;
81
81
  mergeMissingSettingsDefaults(secondTarget, settingsDefaults);
82
82
 
83
- assert.deepEqual(secondTarget.modelSettings, { 'claude-haiku-5-5': { autoCompactWindow: 100000 } });
83
+ assert.deepEqual(secondTarget.modelSettings, { 'claude-haiku-5-5': { autoCompactWindow: 250000 } });
84
84
  });
85
85
 
86
86
  test('mergeMissingSettingsDefaults should keep a per-model value the user already set', () => {
@@ -88,7 +88,7 @@ test('mergeMissingSettingsDefaults should keep a per-model value the user alread
88
88
 
89
89
  assert.deepEqual(
90
90
  mergeMissingSettingsDefaults(targetSettings, {
91
- modelSettings: { 'claude-haiku-5-5': { autoCompactWindow: 100000 } },
91
+ modelSettings: { 'claude-haiku-5-5': { autoCompactWindow: 250000 } },
92
92
  }),
93
93
  { addedKeys: [] },
94
94
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "8.107.0",
3
+ "version": "8.107.2",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {
package/settings.json CHANGED
@@ -15,10 +15,10 @@
15
15
  "autoCompactWindow": 350000,
16
16
  "modelSettings": {
17
17
  "claude-haiku-5-5": {
18
- "autoCompactWindow": 100000
18
+ "autoCompactWindow": 250000
19
19
  },
20
20
  "claude-haiku-4-5": {
21
- "autoCompactWindow": 100000
21
+ "autoCompactWindow": 250000
22
22
  }
23
23
  },
24
24
  "autoMode": {