claude-flow 3.63.4 → 3.63.6

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.
@@ -73,7 +73,8 @@ export declare const missionRecordSchema: z.ZodObject<{
73
73
  createdAt: z.ZodString;
74
74
  updatedAt: z.ZodString;
75
75
  }, "strict", z.ZodTypeAny, {
76
- state: "draft" | "planned" | "awaitingAuthorization" | "queued" | "running" | "pauseRequested" | "paused" | "blocked" | "verifying" | "completed" | "failed" | "cancelRequested" | "cancelled";
76
+ createdAt: string;
77
+ updatedAt: string;
77
78
  objective: string;
78
79
  schemaVersion: 1;
79
80
  missionId: string;
@@ -89,17 +90,17 @@ export declare const missionRecordSchema: z.ZodObject<{
89
90
  policyRef: string;
90
91
  budgetRef: string;
91
92
  executionMode: "durable-executor" | "session-bound";
93
+ state: "completed" | "running" | "failed" | "queued" | "cancelled" | "draft" | "planned" | "awaitingAuthorization" | "pauseRequested" | "paused" | "blocked" | "verifying" | "cancelRequested";
92
94
  evidenceRefs: string[];
93
95
  acceptance: {
94
96
  revision: number;
95
97
  criteriaDigest: string;
96
98
  };
97
99
  lastEventSequence: number;
98
- createdAt: string;
99
- updatedAt: string;
100
100
  authorizationRef?: string | undefined;
101
101
  }, {
102
- state: "draft" | "planned" | "awaitingAuthorization" | "queued" | "running" | "pauseRequested" | "paused" | "blocked" | "verifying" | "completed" | "failed" | "cancelRequested" | "cancelled";
102
+ createdAt: string;
103
+ updatedAt: string;
103
104
  objective: string;
104
105
  schemaVersion: 1;
105
106
  missionId: string;
@@ -115,14 +116,13 @@ export declare const missionRecordSchema: z.ZodObject<{
115
116
  policyRef: string;
116
117
  budgetRef: string;
117
118
  executionMode: "durable-executor" | "session-bound";
119
+ state: "completed" | "running" | "failed" | "queued" | "cancelled" | "draft" | "planned" | "awaitingAuthorization" | "pauseRequested" | "paused" | "blocked" | "verifying" | "cancelRequested";
118
120
  evidenceRefs: string[];
119
121
  acceptance: {
120
122
  revision: number;
121
123
  criteriaDigest: string;
122
124
  };
123
125
  lastEventSequence: number;
124
- createdAt: string;
125
- updatedAt: string;
126
126
  authorizationRef?: string | undefined;
127
127
  }>;
128
128
  export type MissionRecord = z.infer<typeof missionRecordSchema>;
@@ -145,8 +145,8 @@ export declare const taskSpecSchema: z.ZodObject<{
145
145
  checkpoint: z.ZodOptional<z.ZodString>;
146
146
  acceptanceEvidence: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
147
147
  }, "strict", z.ZodTypeAny, {
148
- id: string;
149
148
  title: string;
149
+ id: string;
150
150
  dependsOn: string[];
151
151
  executor: {
152
152
  mode: "durable-executor" | "session-bound";
@@ -157,8 +157,8 @@ export declare const taskSpecSchema: z.ZodObject<{
157
157
  acceptanceEvidence: string[];
158
158
  checkpoint?: string | undefined;
159
159
  }, {
160
- id: string;
161
160
  title: string;
161
+ id: string;
162
162
  executor: {
163
163
  mode: "durable-executor" | "session-bound";
164
164
  requirement: string;
@@ -185,15 +185,15 @@ export declare const acceptanceCriterionSchema: z.ZodObject<{
185
185
  producer: string;
186
186
  independent: boolean;
187
187
  mandatory: boolean;
188
- baseline?: string | undefined;
189
188
  threshold?: string | undefined;
189
+ baseline?: string | undefined;
190
190
  }, {
191
191
  id: string;
192
192
  check: string;
193
193
  producer: string;
194
+ threshold?: string | undefined;
194
195
  inputs?: string[] | undefined;
195
196
  baseline?: string | undefined;
196
- threshold?: string | undefined;
197
197
  independent?: boolean | undefined;
198
198
  mandatory?: boolean | undefined;
199
199
  }>;
@@ -208,15 +208,15 @@ export declare const budgetSpecSchema: z.ZodObject<{
208
208
  currency: string;
209
209
  ceilingMinor: number;
210
210
  tokens?: number | undefined;
211
- concurrency?: number | undefined;
212
211
  wallTimeSeconds?: number | undefined;
212
+ concurrency?: number | undefined;
213
213
  retries?: number | undefined;
214
214
  }, {
215
215
  currency: string;
216
216
  ceilingMinor: number;
217
217
  tokens?: number | undefined;
218
- concurrency?: number | undefined;
219
218
  wallTimeSeconds?: number | undefined;
219
+ concurrency?: number | undefined;
220
220
  retries?: number | undefined;
221
221
  }>;
222
222
  export declare const planBodySchema: z.ZodObject<{
@@ -239,8 +239,8 @@ export declare const planBodySchema: z.ZodObject<{
239
239
  checkpoint: z.ZodOptional<z.ZodString>;
240
240
  acceptanceEvidence: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
241
241
  }, "strict", z.ZodTypeAny, {
242
- id: string;
243
242
  title: string;
243
+ id: string;
244
244
  dependsOn: string[];
245
245
  executor: {
246
246
  mode: "durable-executor" | "session-bound";
@@ -251,8 +251,8 @@ export declare const planBodySchema: z.ZodObject<{
251
251
  acceptanceEvidence: string[];
252
252
  checkpoint?: string | undefined;
253
253
  }, {
254
- id: string;
255
254
  title: string;
255
+ id: string;
256
256
  executor: {
257
257
  mode: "durable-executor" | "session-bound";
258
258
  requirement: string;
@@ -279,15 +279,15 @@ export declare const planBodySchema: z.ZodObject<{
279
279
  producer: string;
280
280
  independent: boolean;
281
281
  mandatory: boolean;
282
- baseline?: string | undefined;
283
282
  threshold?: string | undefined;
283
+ baseline?: string | undefined;
284
284
  }, {
285
285
  id: string;
286
286
  check: string;
287
287
  producer: string;
288
+ threshold?: string | undefined;
288
289
  inputs?: string[] | undefined;
289
290
  baseline?: string | undefined;
290
- threshold?: string | undefined;
291
291
  independent?: boolean | undefined;
292
292
  mandatory?: boolean | undefined;
293
293
  }>, "many">;
@@ -302,15 +302,15 @@ export declare const planBodySchema: z.ZodObject<{
302
302
  currency: string;
303
303
  ceilingMinor: number;
304
304
  tokens?: number | undefined;
305
- concurrency?: number | undefined;
306
305
  wallTimeSeconds?: number | undefined;
306
+ concurrency?: number | undefined;
307
307
  retries?: number | undefined;
308
308
  }, {
309
309
  currency: string;
310
310
  ceilingMinor: number;
311
311
  tokens?: number | undefined;
312
- concurrency?: number | undefined;
313
312
  wallTimeSeconds?: number | undefined;
313
+ concurrency?: number | undefined;
314
314
  retries?: number | undefined;
315
315
  }>;
316
316
  scope: z.ZodDefault<z.ZodObject<{
@@ -322,8 +322,8 @@ export declare const planBodySchema: z.ZodObject<{
322
322
  }>>;
323
323
  }, "strict", z.ZodTypeAny, {
324
324
  tasks: {
325
- id: string;
326
325
  title: string;
326
+ id: string;
327
327
  dependsOn: string[];
328
328
  executor: {
329
329
  mode: "durable-executor" | "session-bound";
@@ -341,15 +341,15 @@ export declare const planBodySchema: z.ZodObject<{
341
341
  producer: string;
342
342
  independent: boolean;
343
343
  mandatory: boolean;
344
- baseline?: string | undefined;
345
344
  threshold?: string | undefined;
345
+ baseline?: string | undefined;
346
346
  }[];
347
347
  budget: {
348
348
  currency: string;
349
349
  ceilingMinor: number;
350
350
  tokens?: number | undefined;
351
- concurrency?: number | undefined;
352
351
  wallTimeSeconds?: number | undefined;
352
+ concurrency?: number | undefined;
353
353
  retries?: number | undefined;
354
354
  };
355
355
  scope: {
@@ -357,8 +357,8 @@ export declare const planBodySchema: z.ZodObject<{
357
357
  };
358
358
  }, {
359
359
  tasks: {
360
- id: string;
361
360
  title: string;
361
+ id: string;
362
362
  executor: {
363
363
  mode: "durable-executor" | "session-bound";
364
364
  requirement: string;
@@ -373,9 +373,9 @@ export declare const planBodySchema: z.ZodObject<{
373
373
  id: string;
374
374
  check: string;
375
375
  producer: string;
376
+ threshold?: string | undefined;
376
377
  inputs?: string[] | undefined;
377
378
  baseline?: string | undefined;
378
- threshold?: string | undefined;
379
379
  independent?: boolean | undefined;
380
380
  mandatory?: boolean | undefined;
381
381
  }[];
@@ -383,8 +383,8 @@ export declare const planBodySchema: z.ZodObject<{
383
383
  currency: string;
384
384
  ceilingMinor: number;
385
385
  tokens?: number | undefined;
386
- concurrency?: number | undefined;
387
386
  wallTimeSeconds?: number | undefined;
387
+ concurrency?: number | undefined;
388
388
  retries?: number | undefined;
389
389
  };
390
390
  scope?: {
@@ -427,8 +427,8 @@ export declare const planInputSchema: z.ZodObject<{
427
427
  checkpoint: z.ZodOptional<z.ZodString>;
428
428
  acceptanceEvidence: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
429
429
  }, "strict", z.ZodTypeAny, {
430
- id: string;
431
430
  title: string;
431
+ id: string;
432
432
  dependsOn: string[];
433
433
  executor: {
434
434
  mode: "durable-executor" | "session-bound";
@@ -439,8 +439,8 @@ export declare const planInputSchema: z.ZodObject<{
439
439
  acceptanceEvidence: string[];
440
440
  checkpoint?: string | undefined;
441
441
  }, {
442
- id: string;
443
442
  title: string;
443
+ id: string;
444
444
  executor: {
445
445
  mode: "durable-executor" | "session-bound";
446
446
  requirement: string;
@@ -467,15 +467,15 @@ export declare const planInputSchema: z.ZodObject<{
467
467
  producer: string;
468
468
  independent: boolean;
469
469
  mandatory: boolean;
470
- baseline?: string | undefined;
471
470
  threshold?: string | undefined;
471
+ baseline?: string | undefined;
472
472
  }, {
473
473
  id: string;
474
474
  check: string;
475
475
  producer: string;
476
+ threshold?: string | undefined;
476
477
  inputs?: string[] | undefined;
477
478
  baseline?: string | undefined;
478
- threshold?: string | undefined;
479
479
  independent?: boolean | undefined;
480
480
  mandatory?: boolean | undefined;
481
481
  }>, "many">;
@@ -490,15 +490,15 @@ export declare const planInputSchema: z.ZodObject<{
490
490
  currency: string;
491
491
  ceilingMinor: number;
492
492
  tokens?: number | undefined;
493
- concurrency?: number | undefined;
494
493
  wallTimeSeconds?: number | undefined;
494
+ concurrency?: number | undefined;
495
495
  retries?: number | undefined;
496
496
  }, {
497
497
  currency: string;
498
498
  ceilingMinor: number;
499
499
  tokens?: number | undefined;
500
- concurrency?: number | undefined;
501
500
  wallTimeSeconds?: number | undefined;
501
+ concurrency?: number | undefined;
502
502
  retries?: number | undefined;
503
503
  }>;
504
504
  scope: z.ZodDefault<z.ZodObject<{
@@ -510,8 +510,8 @@ export declare const planInputSchema: z.ZodObject<{
510
510
  }>>;
511
511
  }, "strict", z.ZodTypeAny, {
512
512
  tasks: {
513
- id: string;
514
513
  title: string;
514
+ id: string;
515
515
  dependsOn: string[];
516
516
  executor: {
517
517
  mode: "durable-executor" | "session-bound";
@@ -529,15 +529,15 @@ export declare const planInputSchema: z.ZodObject<{
529
529
  producer: string;
530
530
  independent: boolean;
531
531
  mandatory: boolean;
532
- baseline?: string | undefined;
533
532
  threshold?: string | undefined;
533
+ baseline?: string | undefined;
534
534
  }[];
535
535
  budget: {
536
536
  currency: string;
537
537
  ceilingMinor: number;
538
538
  tokens?: number | undefined;
539
- concurrency?: number | undefined;
540
539
  wallTimeSeconds?: number | undefined;
540
+ concurrency?: number | undefined;
541
541
  retries?: number | undefined;
542
542
  };
543
543
  scope: {
@@ -545,8 +545,8 @@ export declare const planInputSchema: z.ZodObject<{
545
545
  };
546
546
  }, {
547
547
  tasks: {
548
- id: string;
549
548
  title: string;
549
+ id: string;
550
550
  executor: {
551
551
  mode: "durable-executor" | "session-bound";
552
552
  requirement: string;
@@ -561,9 +561,9 @@ export declare const planInputSchema: z.ZodObject<{
561
561
  id: string;
562
562
  check: string;
563
563
  producer: string;
564
+ threshold?: string | undefined;
564
565
  inputs?: string[] | undefined;
565
566
  baseline?: string | undefined;
566
- threshold?: string | undefined;
567
567
  independent?: boolean | undefined;
568
568
  mandatory?: boolean | undefined;
569
569
  }[];
@@ -571,8 +571,8 @@ export declare const planInputSchema: z.ZodObject<{
571
571
  currency: string;
572
572
  ceilingMinor: number;
573
573
  tokens?: number | undefined;
574
- concurrency?: number | undefined;
575
574
  wallTimeSeconds?: number | undefined;
575
+ concurrency?: number | undefined;
576
576
  retries?: number | undefined;
577
577
  };
578
578
  scope?: {
@@ -584,8 +584,8 @@ export declare const planInputSchema: z.ZodObject<{
584
584
  missionId: string;
585
585
  plan: {
586
586
  tasks: {
587
- id: string;
588
587
  title: string;
588
+ id: string;
589
589
  dependsOn: string[];
590
590
  executor: {
591
591
  mode: "durable-executor" | "session-bound";
@@ -603,15 +603,15 @@ export declare const planInputSchema: z.ZodObject<{
603
603
  producer: string;
604
604
  independent: boolean;
605
605
  mandatory: boolean;
606
- baseline?: string | undefined;
607
606
  threshold?: string | undefined;
607
+ baseline?: string | undefined;
608
608
  }[];
609
609
  budget: {
610
610
  currency: string;
611
611
  ceilingMinor: number;
612
612
  tokens?: number | undefined;
613
- concurrency?: number | undefined;
614
613
  wallTimeSeconds?: number | undefined;
614
+ concurrency?: number | undefined;
615
615
  retries?: number | undefined;
616
616
  };
617
617
  scope: {
@@ -624,8 +624,8 @@ export declare const planInputSchema: z.ZodObject<{
624
624
  missionId: string;
625
625
  plan: {
626
626
  tasks: {
627
- id: string;
628
627
  title: string;
628
+ id: string;
629
629
  executor: {
630
630
  mode: "durable-executor" | "session-bound";
631
631
  requirement: string;
@@ -640,9 +640,9 @@ export declare const planInputSchema: z.ZodObject<{
640
640
  id: string;
641
641
  check: string;
642
642
  producer: string;
643
+ threshold?: string | undefined;
643
644
  inputs?: string[] | undefined;
644
645
  baseline?: string | undefined;
645
- threshold?: string | undefined;
646
646
  independent?: boolean | undefined;
647
647
  mandatory?: boolean | undefined;
648
648
  }[];
@@ -650,8 +650,8 @@ export declare const planInputSchema: z.ZodObject<{
650
650
  currency: string;
651
651
  ceilingMinor: number;
652
652
  tokens?: number | undefined;
653
- concurrency?: number | undefined;
654
653
  wallTimeSeconds?: number | undefined;
654
+ concurrency?: number | undefined;
655
655
  retries?: number | undefined;
656
656
  };
657
657
  scope?: {
@@ -672,13 +672,13 @@ export declare const eventsInputSchema: z.ZodObject<{
672
672
  afterSequence: z.ZodDefault<z.ZodNumber>;
673
673
  limit: z.ZodDefault<z.ZodNumber>;
674
674
  }, "strict", z.ZodTypeAny, {
675
+ limit: number;
675
676
  missionId: string;
676
677
  afterSequence: number;
677
- limit: number;
678
678
  }, {
679
679
  missionId: string;
680
- afterSequence?: number | undefined;
681
680
  limit?: number | undefined;
681
+ afterSequence?: number | undefined;
682
682
  }>;
683
683
  export declare const requestActionInputSchema: z.ZodObject<{
684
684
  requestId: z.ZodString;
@@ -687,16 +687,16 @@ export declare const requestActionInputSchema: z.ZodObject<{
687
687
  action: z.ZodEnum<["pause", "resume", "cancel", "requestAuthorization", "admit"]>;
688
688
  reason: z.ZodOptional<z.ZodString>;
689
689
  }, "strict", z.ZodTypeAny, {
690
+ action: "pause" | "resume" | "cancel" | "requestAuthorization" | "admit";
690
691
  requestId: string;
691
692
  missionId: string;
692
693
  expectedRevision: number;
693
- action: "pause" | "resume" | "cancel" | "requestAuthorization" | "admit";
694
694
  reason?: string | undefined;
695
695
  }, {
696
+ action: "pause" | "resume" | "cancel" | "requestAuthorization" | "admit";
696
697
  requestId: string;
697
698
  missionId: string;
698
699
  expectedRevision: number;
699
- action: "pause" | "resume" | "cancel" | "requestAuthorization" | "admit";
700
700
  reason?: string | undefined;
701
701
  }>;
702
702
  export type CreateInput = z.infer<typeof createInputSchema>;
@@ -7,8 +7,8 @@
7
7
  * (a 2.1.107 npm-global beside a current native one, say) silently decides.
8
8
  */
9
9
  import { execFileSync } from 'node:child_process';
10
- import { existsSync, realpathSync, statSync } from 'node:fs';
11
- import { delimiter, join } from 'node:path';
10
+ import { closeSync, existsSync, fstatSync, openSync, readSync, realpathSync, statSync } from 'node:fs';
11
+ import { delimiter, dirname, join, resolve } from 'node:path';
12
12
  export const MODS_DEFAULT_ON = '2.1.287';
13
13
  export const MODS_FIRST = '2.1.277';
14
14
  const parse = (v) => v.split('.').map((n) => Number(n));
@@ -52,6 +52,98 @@ export const defaultVersionOf = (path) => {
52
52
  return null;
53
53
  }
54
54
  };
55
+ /** Known npm/cmd-shim Node launcher forms (legacy basedir and basedir_win).
56
+ * Match the whole template, not comments or arbitrary shell code. Unknown npm
57
+ * versions/formats simply keep the independent probe result. Never execute it.
58
+ */
59
+ const npmCmdShim = (entry, modern) => [
60
+ '@ECHO off', 'GOTO start', ':find_dp0', 'SET dp0=%~dp0', 'EXIT /b', ':start',
61
+ 'SETLOCAL', 'CALL :find_dp0', '', 'IF EXIST "%dp0%\\node.exe" (',
62
+ ' SET "_prog=%dp0%\\node.exe"', ') ELSE (', ' SET "_prog=node"',
63
+ ...(!modern ? [' SET PATHEXT=%PATHEXT:;.JS;=;%'] : []), ')', '',
64
+ 'endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & '
65
+ + (modern ? 'set PATHEXT=%PATHEXT:;.JS;=;% & ' : '')
66
+ + `"%_prog%" "%dp0%\\${entry.replaceAll('/', '\\')}" %*`, '',
67
+ ].join('\r\n');
68
+ const npmPosixShim = (entry, modern) => [
69
+ '#!/bin/sh', 'basedir=$(dirname "$(echo "$0" | sed -e \'s,\\\\,/,g\')")',
70
+ ...(modern ? ['basedir_win="$basedir"'] : []), '',
71
+ modern ? 'case `uname -a` in' : 'case `uname` in',
72
+ ...(modern ? [
73
+ ' *CYGWIN*|*MINGW*|*MSYS*)', ' if command -v cygpath > /dev/null 2>&1; then',
74
+ ' basedir_win=`cygpath -w "$basedir"`', ' fi', ' ;;', ' *WSL2*)',
75
+ ' if command -v wslpath > /dev/null 2>&1; then',
76
+ ' basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"',
77
+ ' if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then',
78
+ ' echo "Error: wslpath failed to convert path. WSL environment may be misconfigured." >&2',
79
+ ' exit 1', ' fi', ' fi', ' ;;',
80
+ ] : [
81
+ ' *CYGWIN*|*MINGW*|*MSYS*)', ' if command -v cygpath > /dev/null 2>&1; then',
82
+ ' basedir=`cygpath -w "$basedir"`', ' fi', ' ;;',
83
+ ]), 'esac', '',
84
+ ...(modern ? [
85
+ 'PROG_EXE="$basedir/node.exe"', 'if ! [ -x "$PROG_EXE" ]; then',
86
+ ' PROG_EXE="$basedir/node"', ' if ! [ -x "$PROG_EXE" ]; then',
87
+ ' PROG_EXE=node', ' if ! [ -x "$PROG_EXE" ]; then', ' PROG_EXE=node.exe',
88
+ ' fi', ' fi', 'fi', '', `exec "$PROG_EXE" "$basedir_win/${entry}" "$@"`,
89
+ ] : [
90
+ 'if [ -x "$basedir/node" ]; then', ` exec "$basedir/node" "$basedir/${entry}" "$@"`,
91
+ 'else ', ` exec node "$basedir/${entry}" "$@"`, 'fi',
92
+ ]), '',
93
+ ].join('\n');
94
+ // A no-shebang/native bin uses npm's direct-exec forms, not a Node wrapper.
95
+ const npmDirectCmdShim = (entry) => [
96
+ '@ECHO off', 'GOTO start', ':find_dp0', 'SET dp0=%~dp0', 'EXIT /b', ':start',
97
+ 'SETLOCAL', 'CALL :find_dp0', `"%dp0%\\${entry.replaceAll('/', '\\')}" %*`, '',
98
+ ].join('\r\n');
99
+ const npmDirectPosixShim = (entry, modern) => {
100
+ const nodeShim = npmPosixShim(entry, modern);
101
+ const preamble = nodeShim.slice(0, nodeShim.indexOf(modern ? 'PROG_EXE=' : 'if [ -x'));
102
+ return preamble + `exec "$basedir/${entry}" "$@"\n`;
103
+ };
104
+ function npmShimTarget(path, cmd) {
105
+ let fd;
106
+ try {
107
+ fd = openSync(path, 'r');
108
+ const stat = fstatSync(fd);
109
+ if (!stat.isFile() || stat.size > 64 * 1024)
110
+ return null;
111
+ // Also cap the actual read if a file grows after stat.
112
+ const bytes = Buffer.alloc(64 * 1024 + 1);
113
+ let size = 0;
114
+ while (size < bytes.length) {
115
+ const n = readSync(fd, bytes, size, bytes.length - size, null);
116
+ if (!n)
117
+ break;
118
+ size += n;
119
+ }
120
+ if (size > 64 * 1024)
121
+ return null;
122
+ const text = bytes.subarray(0, size).toString('utf8').replace(/\r\n/g, '\n').trimEnd();
123
+ const targets = cmd
124
+ ? [...text.matchAll(/"%dp0%\\([^"\r\n]+)" +%\*$/gm)].map(m => m[1].replaceAll('\\', '/'))
125
+ : [...text.matchAll(/^\s*exec (?:[^\r\n]* )?"\$basedir(?:_win)?\/([^"\r\n]+)" +"\$@"$/gm)].map(m => m[1]);
126
+ const entry = targets[0];
127
+ if (!entry || targets.some(t => t !== entry) || !/^[a-zA-Z0-9@._ /-]+$/.test(entry) || entry.startsWith('/'))
128
+ return null;
129
+ const template = cmd ? npmCmdShim : npmPosixShim;
130
+ const normalize = (value) => value.replace(/\r\n/g, '\n').trimEnd();
131
+ const node = [false, true].some(modern => normalize(template(entry, modern)) === text);
132
+ const direct = cmd ? normalize(npmDirectCmdShim(entry)) === text
133
+ : [false, true].some(modern => normalize(npmDirectPosixShim(entry, modern)) === text);
134
+ if (!node && !direct)
135
+ return null;
136
+ const target = realpathSync(resolve(dirname(path), entry));
137
+ return statSync(target).isFile() ? { path: target, mode: node ? 'node' : 'direct' } : null;
138
+ }
139
+ catch {
140
+ return null;
141
+ }
142
+ finally {
143
+ if (fd !== undefined)
144
+ closeSync(fd);
145
+ }
146
+ }
55
147
  /** Every `claude` on PATH, in PATH order (the first is what runs), plus ~/.local/bin. */
56
148
  export function findClaudeInstalls(env, home, versionOf = defaultVersionOf) {
57
149
  const names = process.platform === 'win32' ? ['claude.exe', 'claude.cmd', 'claude'] : ['claude'];
@@ -59,6 +151,7 @@ export function findClaudeInstalls(env, home, versionOf = defaultVersionOf) {
59
151
  const seen = new Set();
60
152
  const installs = [];
61
153
  for (const dir of dirs) {
154
+ let cmd;
62
155
  for (const name of names) {
63
156
  const path = join(dir, name);
64
157
  let real;
@@ -73,7 +166,19 @@ export function findClaudeInstalls(env, home, versionOf = defaultVersionOf) {
73
166
  if (seen.has(real))
74
167
  continue;
75
168
  seen.add(real);
76
- installs.push({ path, version: versionOf(path) });
169
+ let version = versionOf(path);
170
+ if (process.platform === 'win32' && name === 'claude' && version === null && cmd?.version) {
171
+ const target = npmShimTarget(path, false);
172
+ const cmdTarget = npmShimTarget(cmd.path, true);
173
+ if (target && cmdTarget && target.path === cmdTarget.path && target.mode === cmdTarget.mode)
174
+ version = cmd.version;
175
+ }
176
+ const install = { path, version };
177
+ installs.push(install);
178
+ // Only a .cmd actually probed in this directory can supply a version.
179
+ // A realpath-deduplicated alias in another directory proves nothing here.
180
+ if (name === 'claude.cmd')
181
+ cmd = install;
77
182
  }
78
183
  }
79
184
  return installs;