@colbymchenry/codegraph-win32-arm64 1.4.0 → 1.5.0

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.
Files changed (202) hide show
  1. package/bin/codegraph.cmd +1 -1
  2. package/lib/dist/bin/codegraph.js +106 -19
  3. package/lib/dist/bin/codegraph.js.map +1 -1
  4. package/lib/dist/bin/command-supervision.d.ts +38 -1
  5. package/lib/dist/bin/command-supervision.d.ts.map +1 -1
  6. package/lib/dist/bin/command-supervision.js +8 -2
  7. package/lib/dist/bin/command-supervision.js.map +1 -1
  8. package/lib/dist/context/index.d.ts.map +1 -1
  9. package/lib/dist/context/index.js +41 -11
  10. package/lib/dist/context/index.js.map +1 -1
  11. package/lib/dist/db/index.d.ts +142 -0
  12. package/lib/dist/db/index.d.ts.map +1 -1
  13. package/lib/dist/db/index.js +267 -6
  14. package/lib/dist/db/index.js.map +1 -1
  15. package/lib/dist/db/migrations.d.ts +1 -1
  16. package/lib/dist/db/migrations.d.ts.map +1 -1
  17. package/lib/dist/db/migrations.js +31 -1
  18. package/lib/dist/db/migrations.js.map +1 -1
  19. package/lib/dist/db/queries.d.ts +113 -4
  20. package/lib/dist/db/queries.d.ts.map +1 -1
  21. package/lib/dist/db/queries.js +398 -24
  22. package/lib/dist/db/queries.js.map +1 -1
  23. package/lib/dist/db/schema.sql +13 -1
  24. package/lib/dist/db/sqlite-adapter.d.ts +3 -1
  25. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  26. package/lib/dist/db/sqlite-adapter.js +22 -4
  27. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  28. package/lib/dist/db/wal-valve.d.ts +15 -2
  29. package/lib/dist/db/wal-valve.d.ts.map +1 -1
  30. package/lib/dist/db/wal-valve.js +88 -6
  31. package/lib/dist/db/wal-valve.js.map +1 -1
  32. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  33. package/lib/dist/extraction/grammars.js +63 -0
  34. package/lib/dist/extraction/grammars.js.map +1 -1
  35. package/lib/dist/extraction/index.d.ts +32 -3
  36. package/lib/dist/extraction/index.d.ts.map +1 -1
  37. package/lib/dist/extraction/index.js +313 -56
  38. package/lib/dist/extraction/index.js.map +1 -1
  39. package/lib/dist/extraction/kernel/decode.d.ts +9 -0
  40. package/lib/dist/extraction/kernel/decode.d.ts.map +1 -0
  41. package/lib/dist/extraction/kernel/decode.js +162 -0
  42. package/lib/dist/extraction/kernel/decode.js.map +1 -0
  43. package/lib/dist/extraction/kernel/index.d.ts +64 -0
  44. package/lib/dist/extraction/kernel/index.d.ts.map +1 -0
  45. package/lib/dist/extraction/kernel/index.js +279 -0
  46. package/lib/dist/extraction/kernel/index.js.map +1 -0
  47. package/lib/dist/extraction/kernel/layout.d.ts +101 -0
  48. package/lib/dist/extraction/kernel/layout.d.ts.map +1 -0
  49. package/lib/dist/extraction/kernel/layout.js +104 -0
  50. package/lib/dist/extraction/kernel/layout.js.map +1 -0
  51. package/lib/dist/extraction/kernel/loader.d.ts +103 -0
  52. package/lib/dist/extraction/kernel/loader.d.ts.map +1 -0
  53. package/lib/dist/extraction/kernel/loader.js +146 -0
  54. package/lib/dist/extraction/kernel/loader.js.map +1 -0
  55. package/lib/dist/extraction/languages/c-cpp.d.ts +14 -0
  56. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  57. package/lib/dist/extraction/languages/c-cpp.js +849 -12
  58. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  59. package/lib/dist/extraction/parse-pool.d.ts +8 -0
  60. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  61. package/lib/dist/extraction/parse-pool.js +15 -0
  62. package/lib/dist/extraction/parse-pool.js.map +1 -1
  63. package/lib/dist/extraction/parse-worker.js +35 -1
  64. package/lib/dist/extraction/parse-worker.js.map +1 -1
  65. package/lib/dist/extraction/store-worker.d.ts +24 -0
  66. package/lib/dist/extraction/store-worker.d.ts.map +1 -0
  67. package/lib/dist/extraction/store-worker.js +139 -0
  68. package/lib/dist/extraction/store-worker.js.map +1 -0
  69. package/lib/dist/extraction/store-writer.d.ts +63 -0
  70. package/lib/dist/extraction/store-writer.d.ts.map +1 -0
  71. package/lib/dist/extraction/store-writer.js +174 -0
  72. package/lib/dist/extraction/store-writer.js.map +1 -0
  73. package/lib/dist/extraction/tree-sitter.d.ts +22 -4
  74. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  75. package/lib/dist/extraction/tree-sitter.js +151 -6
  76. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  77. package/lib/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  78. package/lib/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  79. package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  80. package/lib/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  81. package/lib/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  82. package/lib/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  83. package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  84. package/lib/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  85. package/lib/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  86. package/lib/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  87. package/lib/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  88. package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  89. package/lib/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  90. package/lib/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  91. package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
  92. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  93. package/lib/dist/extraction/wasm-runtime-flags.js +27 -3
  94. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  95. package/lib/dist/index.d.ts +19 -6
  96. package/lib/dist/index.d.ts.map +1 -1
  97. package/lib/dist/index.js +233 -17
  98. package/lib/dist/index.js.map +1 -1
  99. package/lib/dist/installer/beta-signup.d.ts +54 -0
  100. package/lib/dist/installer/beta-signup.d.ts.map +1 -0
  101. package/lib/dist/installer/beta-signup.js +178 -0
  102. package/lib/dist/installer/beta-signup.js.map +1 -0
  103. package/lib/dist/installer/index.d.ts +42 -0
  104. package/lib/dist/installer/index.d.ts.map +1 -1
  105. package/lib/dist/installer/index.js +105 -1
  106. package/lib/dist/installer/index.js.map +1 -1
  107. package/lib/dist/mcp/index.d.ts.map +1 -1
  108. package/lib/dist/mcp/index.js +8 -0
  109. package/lib/dist/mcp/index.js.map +1 -1
  110. package/lib/dist/mcp/liveness-watchdog.d.ts +18 -1
  111. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  112. package/lib/dist/mcp/liveness-watchdog.js +73 -13
  113. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  114. package/lib/dist/mcp/proxy.js +1 -1
  115. package/lib/dist/mcp/proxy.js.map +1 -1
  116. package/lib/dist/mcp/session.d.ts +14 -0
  117. package/lib/dist/mcp/session.d.ts.map +1 -1
  118. package/lib/dist/mcp/session.js +22 -1
  119. package/lib/dist/mcp/session.js.map +1 -1
  120. package/lib/dist/mcp/tools.d.ts.map +1 -1
  121. package/lib/dist/mcp/tools.js +76 -1
  122. package/lib/dist/mcp/tools.js.map +1 -1
  123. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +1 -1
  124. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  125. package/lib/dist/resolution/c-fnptr-synthesizer.js +574 -132
  126. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  127. package/lib/dist/resolution/callback-synthesizer.d.ts +54 -10
  128. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  129. package/lib/dist/resolution/callback-synthesizer.js +249 -157
  130. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  131. package/lib/dist/resolution/cooperative-yield.d.ts +10 -2
  132. package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -1
  133. package/lib/dist/resolution/cooperative-yield.js +6 -4
  134. package/lib/dist/resolution/cooperative-yield.js.map +1 -1
  135. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  136. package/lib/dist/resolution/frameworks/go.js +29 -6
  137. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  138. package/lib/dist/resolution/import-resolver.d.ts +2 -3
  139. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  140. package/lib/dist/resolution/import-resolver.js +166 -7
  141. package/lib/dist/resolution/import-resolver.js.map +1 -1
  142. package/lib/dist/resolution/index.d.ts +97 -2
  143. package/lib/dist/resolution/index.d.ts.map +1 -1
  144. package/lib/dist/resolution/index.js +783 -124
  145. package/lib/dist/resolution/index.js.map +1 -1
  146. package/lib/dist/resolution/memory-budget.d.ts +48 -0
  147. package/lib/dist/resolution/memory-budget.d.ts.map +1 -0
  148. package/lib/dist/resolution/memory-budget.js +162 -0
  149. package/lib/dist/resolution/memory-budget.js.map +1 -0
  150. package/lib/dist/resolution/name-matcher.d.ts +12 -1
  151. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  152. package/lib/dist/resolution/name-matcher.js +517 -96
  153. package/lib/dist/resolution/name-matcher.js.map +1 -1
  154. package/lib/dist/resolution/resolver-pool.d.ts +106 -0
  155. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -0
  156. package/lib/dist/resolution/resolver-pool.js +344 -0
  157. package/lib/dist/resolution/resolver-pool.js.map +1 -0
  158. package/lib/dist/resolution/resolver-worker.d.ts +17 -0
  159. package/lib/dist/resolution/resolver-worker.d.ts.map +1 -0
  160. package/lib/dist/resolution/resolver-worker.js +141 -0
  161. package/lib/dist/resolution/resolver-worker.js.map +1 -0
  162. package/lib/dist/resolution/types.d.ts +3 -0
  163. package/lib/dist/resolution/types.d.ts.map +1 -1
  164. package/lib/dist/sync/watcher.d.ts +25 -1
  165. package/lib/dist/sync/watcher.d.ts.map +1 -1
  166. package/lib/dist/sync/watcher.js +76 -3
  167. package/lib/dist/sync/watcher.js.map +1 -1
  168. package/lib/dist/types.d.ts +41 -2
  169. package/lib/dist/types.d.ts.map +1 -1
  170. package/lib/dist/types.js +26 -1
  171. package/lib/dist/types.js.map +1 -1
  172. package/lib/dist/ui/color.d.ts +21 -0
  173. package/lib/dist/ui/color.d.ts.map +1 -0
  174. package/lib/dist/ui/color.js +42 -0
  175. package/lib/dist/ui/color.js.map +1 -0
  176. package/lib/dist/ui/glyphs.d.ts +35 -10
  177. package/lib/dist/ui/glyphs.d.ts.map +1 -1
  178. package/lib/dist/ui/glyphs.js +59 -12
  179. package/lib/dist/ui/glyphs.js.map +1 -1
  180. package/lib/dist/ui/shimmer-progress.d.ts.map +1 -1
  181. package/lib/dist/ui/shimmer-progress.js +78 -4
  182. package/lib/dist/ui/shimmer-progress.js.map +1 -1
  183. package/lib/dist/ui/shimmer-worker.js +25 -17
  184. package/lib/dist/ui/shimmer-worker.js.map +1 -1
  185. package/lib/dist/ui/types.d.ts +0 -2
  186. package/lib/dist/ui/types.d.ts.map +1 -1
  187. package/lib/dist/upgrade/index.d.ts +39 -0
  188. package/lib/dist/upgrade/index.d.ts.map +1 -1
  189. package/lib/dist/upgrade/index.js +180 -19
  190. package/lib/dist/upgrade/index.js.map +1 -1
  191. package/lib/dist/upgrade/remove-binary.d.ts +87 -0
  192. package/lib/dist/upgrade/remove-binary.d.ts.map +1 -0
  193. package/lib/dist/upgrade/remove-binary.js +289 -0
  194. package/lib/dist/upgrade/remove-binary.js.map +1 -0
  195. package/lib/dist/upgrade/update-check.d.ts +92 -0
  196. package/lib/dist/upgrade/update-check.d.ts.map +1 -0
  197. package/lib/dist/upgrade/update-check.js +258 -0
  198. package/lib/dist/upgrade/update-check.js.map +1 -0
  199. package/lib/kernel/codegraph-kernel.node +0 -0
  200. package/lib/node_modules/.package-lock.json +1 -1
  201. package/lib/package.json +6 -1
  202. package/package.json +6 -2
@@ -36,25 +36,67 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.createShimmerProgress = createShimmerProgress;
37
37
  const worker_threads_1 = require("worker_threads");
38
38
  const path = __importStar(require("path"));
39
+ const color_1 = require("./color");
40
+ const glyphs_1 = require("./glyphs");
39
41
  const PHASE_NAMES = {
40
42
  scanning: 'Scanning files',
41
43
  parsing: 'Parsing code',
42
44
  storing: 'Storing data',
43
45
  resolving: 'Resolving refs',
46
+ linking: 'Linking dynamic dispatch',
44
47
  };
45
48
  function createShimmerProgress() {
49
+ // Piped/redirected stdout: `\r`-rewriting animation frames are garbage in a
50
+ // log file — emit one plain line per phase instead (#1281).
51
+ if (process.stdout.isTTY !== true) {
52
+ return createPlainProgress();
53
+ }
54
+ const useColor = (0, color_1.ansiColorsEnabled)();
55
+ const G = (0, glyphs_1.getGlyphs)();
56
+ const DM = useColor ? '\x1b[2m' : '';
57
+ const GRN = useColor ? '\x1b[32m' : '';
58
+ const RST = useColor ? '\x1b[0m' : '';
46
59
  let lastPhase = '';
60
+ let lastPhaseName = '';
61
+ let lastPercent = -1;
62
+ let lastCount = 0;
63
+ // The persistent "phase done" lines — the ones that stay in scrollback —
64
+ // are printed HERE, on the main thread, not by the worker. process.stdout
65
+ // reaches a Windows console through the wide-char API, so these lines can
66
+ // carry the same Unicode glyphs @clack/prompts draws around them (#398);
67
+ // the worker's raw fs.writeSync path can't (codepage mojibake, #168) and is
68
+ // now used only for the transient, self-erasing animation frames. The main
69
+ // thread is guaranteed alive here: phase changes arrive via its own
70
+ // progress callback.
71
+ const printPhaseDone = () => {
72
+ if (!lastPhaseName)
73
+ return;
74
+ let detail = '';
75
+ if (lastPercent >= 0)
76
+ detail = ` ${G.dash} done`;
77
+ else if (lastCount > 0)
78
+ detail = ` ${G.dash} ${lastCount.toLocaleString()} found`;
79
+ // Leading \r + erase clears the worker's in-flight animation line; one
80
+ // atomic write so a worker frame can't interleave mid-line.
81
+ process.stdout.write(`\r\x1b[K${DM}${G.rail}${RST} ${GRN}${G.phaseDone}${RST} ${lastPhaseName}${detail}\n`);
82
+ lastPhaseName = '';
83
+ lastPercent = -1;
84
+ lastCount = 0;
85
+ };
47
86
  const workerPath = path.join(__dirname, 'shimmer-worker.js');
48
87
  const worker = new worker_threads_1.Worker(workerPath, {
49
- workerData: { startTime: Date.now() },
88
+ // colors:false keeps the animation (still an interactive TTY) but drops
89
+ // the ANSI color codes, honoring NO_COLOR / --no-color (#1281).
90
+ workerData: { startTime: Date.now(), colors: useColor },
50
91
  });
51
92
  return {
52
93
  onProgress(progress) {
53
94
  const phaseName = PHASE_NAMES[progress.phase] || progress.phase;
54
95
  if (progress.phase !== lastPhase && lastPhase) {
55
- worker.postMessage({ type: 'finish-phase' });
96
+ printPhaseDone();
56
97
  }
57
98
  lastPhase = progress.phase;
99
+ lastPhaseName = phaseName;
58
100
  let percent = -1;
59
101
  let count = 0;
60
102
  if (progress.total > 0) {
@@ -63,6 +105,8 @@ function createShimmerProgress() {
63
105
  else if (progress.current > 0) {
64
106
  count = progress.current;
65
107
  }
108
+ lastPercent = percent;
109
+ lastCount = count;
66
110
  worker.postMessage({
67
111
  type: 'update',
68
112
  phase: progress.phase,
@@ -73,13 +117,23 @@ function createShimmerProgress() {
73
117
  },
74
118
  stop() {
75
119
  return new Promise((resolve) => {
120
+ let settled = false;
121
+ const finish = () => {
122
+ if (settled)
123
+ return;
124
+ settled = true;
125
+ // Worker has cleared (or been terminated off) the animation line;
126
+ // persist the final phase's done-line from the main thread.
127
+ printPhaseDone();
128
+ resolve();
129
+ };
76
130
  const timeout = setTimeout(() => {
77
- worker.terminate().then(() => resolve());
131
+ worker.terminate().then(finish);
78
132
  }, 2000);
79
133
  worker.on('message', (msg) => {
80
134
  if (msg.type === 'stopped') {
81
135
  clearTimeout(timeout);
82
- worker.terminate().then(() => resolve());
136
+ worker.terminate().then(finish);
83
137
  }
84
138
  });
85
139
  worker.postMessage({ type: 'stop' });
@@ -87,4 +141,24 @@ function createShimmerProgress() {
87
141
  },
88
142
  };
89
143
  }
144
+ /**
145
+ * Non-TTY fallback: one plain line per phase, no rewrites, no ANSI.
146
+ * Completion details (counts, timings) are printed by the caller's result
147
+ * summary, so phase starts are all that's worth logging here.
148
+ */
149
+ function createPlainProgress() {
150
+ let lastPhase = '';
151
+ return {
152
+ onProgress(progress) {
153
+ if (progress.phase === lastPhase)
154
+ return;
155
+ lastPhase = progress.phase;
156
+ const phaseName = PHASE_NAMES[progress.phase] || progress.phase;
157
+ process.stdout.write(`${phaseName}...\n`);
158
+ },
159
+ stop() {
160
+ return Promise.resolve();
161
+ },
162
+ };
163
+ }
90
164
  //# sourceMappingURL=shimmer-progress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shimmer-progress.js","sourceRoot":"","sources":["../../src/ui/shimmer-progress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,sDAmDC;AAxED,mDAAwC;AACxC,2CAA6B;AAE7B,MAAM,WAAW,GAA2B;IAC1C,QAAQ,EAAE,gBAAgB;IAC1B,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AAaF,SAAgB,qBAAqB;IACnC,IAAI,SAAS,GAAG,EAAE,CAAC;IAEnB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,IAAI,uBAAM,CAAC,UAAU,EAAE;QACpC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;KACtC,CAAC,CAAC;IAEH,OAAO;QACL,UAAU,CAAC,QAAuB;YAChC,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC;YAEhE,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,IAAI,SAAS,EAAE,CAAC;gBAC9C,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,c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IAAI,CAAC,MAAM,CAAC,CAAC;oBAClC,CAAC;gBACH,CAAC,CAAC,CAAC;gBAEH,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB;IAC1B,IAAI,SAAS,GAAG,EAAE,CAAC;IAEnB,OAAO;QACL,UAAU,CAAC,QAAuB;YAChC,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS;gBAAE,OAAO;YACzC,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC;YAC3B,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC;YAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS,OAAO,CAAC,CAAC;QAC5C,CAAC;QAED,IAAI;YACF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -11,18 +11,26 @@ const glyphs_1 = require("./glyphs");
11
11
  //
12
12
  // Side effect: bypasses Node's TTY-aware encoding conversion on Windows,
13
13
  // so UTF-8 bytes hit the console raw and mojibake on OEM codepages.
14
- // `getGlyphs()` returns ASCII fallbacks on Windows to avoid this (#168).
14
+ // `getRawWriteGlyphs()` therefore always falls back to ASCII on Windows
15
+ // (#168). Everything this worker writes is transient — erased by the next
16
+ // frame or by the parent's phase-done line — so ASCII here never shows up
17
+ // in scrollback (#398); the persistent lines are printed by the parent
18
+ // through the codepage-immune process.stdout path.
15
19
  function writeStdout(s) {
16
20
  (0, fs_1.writeSync)(1, s);
17
21
  }
18
- const G = (0, glyphs_1.getGlyphs)();
22
+ const G = (0, glyphs_1.getRawWriteGlyphs)();
19
23
  const SPINNER_GLYPHS = G.spinner;
20
24
  const ANIM_INTERVAL = 150;
21
25
  const FRAMES_PER_GLYPH = 3;
22
- const RST = '\x1b[0m';
23
- const DM = '\x1b[2m';
24
- const GRN = '\x1b[32m';
25
- const BOLD = '\x1b[1m';
26
+ // colors:false (NO_COLOR / --no-color on an interactive TTY, #1281) keeps the
27
+ // animation but drops every color/style code. `\r\x1b[K` line rewrites stay —
28
+ // they're cursor control, not color, and the parent only spawns this worker
29
+ // when stdout is a real TTY.
30
+ const COLORS = worker_threads_1.workerData.colors !== false;
31
+ const RST = COLORS ? '\x1b[0m' : '';
32
+ const DM = COLORS ? '\x1b[2m' : '';
33
+ const BOLD = COLORS ? '\x1b[1m' : '';
26
34
  const startTime = worker_threads_1.workerData.startTime;
27
35
  function animFrame() {
28
36
  return Math.floor((Date.now() - startTime) / ANIM_INTERVAL);
@@ -31,6 +39,8 @@ function lerp(a, b, t) {
31
39
  return Math.round(a + (b - a) * t);
32
40
  }
33
41
  function shimmerColor(frame) {
42
+ if (!COLORS)
43
+ return '';
34
44
  const t = (Math.sin(frame * 2 * Math.PI / 13) + 1) / 2;
35
45
  const r = lerp(160, 251, t);
36
46
  const g = lerp(100, 191, t);
@@ -48,6 +58,10 @@ function renderBar(frame, filled, empty) {
48
58
  const shimmerWidth = 3;
49
59
  let bar = '';
50
60
  for (let i = 0; i < filled; i++) {
61
+ if (!COLORS) {
62
+ bar += G.barFilled;
63
+ continue;
64
+ }
51
65
  const dist = Math.abs(i - shimmerPos);
52
66
  const t = Math.max(0, 1 - dist / shimmerWidth);
53
67
  const r = lerp(160, 251, t);
@@ -84,16 +98,13 @@ function render() {
84
98
  }
85
99
  writeStdout(`\r\x1b[K${line}`);
86
100
  }
87
- function finishPhase() {
101
+ // Clear the in-flight animation line. The persistent "phase done" line is
102
+ // printed by the PARENT on the main thread (TTY-aware, codepage-immune) —
103
+ // this worker's raw-byte path must never leave bytes in scrollback (#398).
104
+ function clearLine() {
88
105
  if (!currentMessage)
89
106
  return;
90
107
  writeStdout(`\r\x1b[K`);
91
- let detail = '';
92
- if (currentPercent >= 0)
93
- detail = ` ${G.dash} done`;
94
- else if (currentCount > 0)
95
- detail = ` ${G.dash} ${formatNumber(currentCount)} found`;
96
- writeStdout(`${DM}${G.rail}${RST} ${GRN}${G.phaseDone}${RST} ${currentMessage}${detail}\n`);
97
108
  currentMessage = '';
98
109
  currentPercent = -1;
99
110
  currentCount = 0;
@@ -106,12 +117,9 @@ worker_threads_1.parentPort.on('message', (msg) => {
106
117
  currentPercent = msg.percent;
107
118
  currentCount = msg.count;
108
119
  }
109
- else if (msg.type === 'finish-phase') {
110
- finishPhase();
111
- }
112
120
  else if (msg.type === 'stop') {
113
121
  clearInterval(tickInterval);
114
- finishPhase();
122
+ clearLine();
115
123
  worker_threads_1.parentPort.postMessage({ type: 'stopped' });
116
124
  }
117
125
  });
@@ -1 +1 @@
1
- {"version":3,"file":"shimmer-worker.js","sourceRoot":"","sources":["../../src/ui/shimmer-worker.ts"],"names":[],"mappings":";;AAAA,mDAAwD;AACxD,2BAA+B;AAC/B,qCAAqC;AAGrC,4DAA4D;AAC5D,wEAAwE;AACxE,wEAAwE;AACxE,oEAAoE;AACpE,sEAAsE;AACtE,EAAE;AACF,yEAAyE;AACzE,oEAAoE;AACpE,yEAAyE;AACzE,SAAS,WAAW,CAAC,CAAS;IAC5B,IAAA,cAAS,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,GAAG,IAAA,kBAAS,GAAE,CAAC;AACtB,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,CAAC;AACjC,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,MAAM,EAAE,GAAG,SAAS,CAAC;AACrB,MAAM,GAAG,GAAG,UAAU,CAAC;AACvB,MAAM,IAAI,GAAG,SAAS,CAAC;AAEvB,MAAM,SAAS,GAAW,2BAAU,CAAC,SAAS,CAAC;AAE/C,SAAS,SAAS;IAChB,OAAO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B,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC;IAC3B,CAAC;SAAM,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC/B,aAAa,CAAC,YAAY,CAAC,CAAC;QAC5B,SAAS,EAAE,CAAC;QACZ,2BAAW,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -5,8 +5,6 @@ export type ShimmerWorkerMessage = {
5
5
  phaseName: string;
6
6
  percent: number;
7
7
  count: number;
8
- } | {
9
- type: 'finish-phase';
10
8
  } | {
11
9
  type: 'stop';
12
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ui/types.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpF;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,0CAA0C;AAC1C,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ui/types.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpF;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,0CAA0C;AAC1C,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC"}
@@ -106,11 +106,23 @@ export interface UpgradeDeps {
106
106
  resolveLatest: (pin?: string) => Promise<string>;
107
107
  /** Run a command inheriting stdio; returns its exit code (-1 = spawn failed). */
108
108
  run: (cmd: string, args: string[], env?: NodeJS.ProcessEnv) => number;
109
+ /** Run a command capturing stdout (nothing reaches the terminal); null = spawn failed. */
110
+ capture: (cmd: string, args: string[]) => {
111
+ code: number;
112
+ stdout: string;
113
+ } | null;
109
114
  hasCommand: (cmd: string) => boolean;
110
115
  log: (msg: string) => void;
111
116
  warn: (msg: string) => void;
112
117
  error: (msg: string) => void;
113
118
  platform: NodeJS.Platform;
119
+ /**
120
+ * Offer the one-time CodeGraph Pro beta opt-in after a successful update
121
+ * (see installer/beta-signup — self-gating: TTY only, and silent forever
122
+ * once any install/upgrade ask was answered). Optional so unit tests and
123
+ * embedded callers stay prompt-free; never fatal to the upgrade.
124
+ */
125
+ offerBetaSignup?: () => Promise<void>;
114
126
  }
115
127
  /** The honest, additive re-index reminder shown after a successful upgrade. */
116
128
  export declare function reindexAdvisory(): string;
@@ -118,8 +130,30 @@ export declare function reindexAdvisory(): string;
118
130
  * Returns the process exit code (0 = success / nothing to do, 1 = failure).
119
131
  */
120
132
  export declare function runUpgrade(opts: UpgradeOptions, deps: UpgradeDeps): Promise<number>;
133
+ type VersionProbe = 'match' | 'mismatch' | 'inconclusive';
134
+ /**
135
+ * Prove the upgrade actually took: spawn the `codegraph` this terminal's PATH
136
+ * resolves and compare its reported version to the target. Catches the silent
137
+ * failure mode where ANOTHER install shadows the one we just upgraded (issue
138
+ * #1071 — e.g. a stale `npm i -g` copy earlier on PATH than the bundle
139
+ * launcher): the upgrade "succeeds" but `codegraph -v` — in this terminal and
140
+ * every future one — keeps serving the old version. Exported for unit tests.
141
+ */
142
+ export declare function verifyResolvedVersion(latest: string, deps: UpgradeDeps): VersionProbe;
121
143
  /** Build the in-place Windows upgrade script (exported for unit-testing). */
122
144
  export declare function buildWindowsUpgradeScript(bundleRoot: string, version: string, arch: string): string;
145
+ /**
146
+ * How to invoke npm. On Windows npm is a .cmd batch file, which Node refuses
147
+ * to spawn without a shell (EINVAL since the CVE-2024-27980 hardening) — a
148
+ * direct `npm.cmd` spawn fails on every current Node, so route it through
149
+ * cmd.exe, the same way the surface-refresh step invokes the .cmd launcher.
150
+ * (Verified live on the Windows VM: `spawnSync('npm.cmd')` → EINVAL;
151
+ * `cmd.exe /d /s /c npm …` → works.)
152
+ */
153
+ export declare function npmInvocation(platform: NodeJS.Platform, npmArgs: string[]): {
154
+ cmd: string;
155
+ args: string[];
156
+ };
123
157
  /**
124
158
  * True if `cmd` resolves to an executable on PATH. A pure-Node PATH scan — NOT
125
159
  * a spawned `command -v`/`which`: `command` is a shell builtin (no standalone
@@ -129,4 +163,9 @@ export declare function buildWindowsUpgradeScript(bundleRoot: string, version: s
129
163
  */
130
164
  export declare function hasCommand(cmd: string): boolean;
131
165
  export declare function defaultRun(cmd: string, args: string[], env?: NodeJS.ProcessEnv): number;
166
+ export declare function defaultCapture(cmd: string, args: string[]): {
167
+ code: number;
168
+ stdout: string;
169
+ } | null;
170
+ export {};
132
171
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/upgrade/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,eAAO,MAAM,IAAI,2BAA2B,CAAC;AAC7C,eAAO,MAAM,WAAW,4BAA4B,CAAC;AAErD,eAAO,MAAM,cAAc,6EAA2B,CAAC;AAMvD,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACzF;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AG,UAAU,GAAG,cAAc,CAAC;AAE1D;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,YAAY,CAarF;AAiHD,6EAA6E;AAC7E,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA6BnG;AA2BD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAK3G;AA+BD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAkB/C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAIvF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOnG"}
@@ -70,13 +70,17 @@ exports.parseLatestTagFromLocation = parseLatestTagFromLocation;
70
70
  exports.resolveLatestVersion = resolveLatestVersion;
71
71
  exports.reindexAdvisory = reindexAdvisory;
72
72
  exports.runUpgrade = runUpgrade;
73
+ exports.verifyResolvedVersion = verifyResolvedVersion;
73
74
  exports.buildWindowsUpgradeScript = buildWindowsUpgradeScript;
75
+ exports.npmInvocation = npmInvocation;
74
76
  exports.hasCommand = hasCommand;
75
77
  exports.defaultRun = defaultRun;
78
+ exports.defaultCapture = defaultCapture;
76
79
  const fs = __importStar(require("fs"));
77
80
  const path = __importStar(require("path"));
78
81
  const https = __importStar(require("https"));
79
82
  const child_process_1 = require("child_process");
83
+ const color_1 = require("../ui/color");
80
84
  exports.REPO = 'colbymchenry/codegraph';
81
85
  exports.NPM_PACKAGE = '@colbymchenry/codegraph';
82
86
  const RAW_BASE = `https://raw.githubusercontent.com/${exports.REPO}/main`;
@@ -119,17 +123,18 @@ function detectInstallMethod(input) {
119
123
  // (a Windows layout resolves correctly even when unit-tested on macOS/Linux).
120
124
  const P = isWin ? path.win32 : path.posix;
121
125
  const binDir = P.dirname(input.filename); // <…>/bin
122
- // Bundle: <root>/lib/dist/bin/codegraph.js → <root> is up 3 from bin/.
123
- // A bundle has a vendored node + a launcher script as siblings of lib/.
124
- const bundleRoot = P.resolve(binDir, '..', '..', '..');
125
- const vendoredNode = P.join(bundleRoot, isWin ? 'node.exe' : 'node');
126
- const launcher = P.join(bundleRoot, 'bin', isWin ? 'codegraph.cmd' : 'codegraph');
127
- if (exists(vendoredNode) && exists(launcher)) {
128
- const os = isWin ? 'windows' : 'unix';
129
- return { kind: 'bundle', os, bundleRoot, installDir: deriveInstallDir(bundleRoot, os, exists) };
130
- }
131
126
  const norm = toPosix(input.filename);
127
+ // Path-based checks come FIRST. The npm thin-installer's per-platform
128
+ // package (@colbymchenry/codegraph-<platform>-<arch>) is itself a complete
129
+ // bundle — vendored node + bin/ launcher — living inside node_modules, so
130
+ // the layout sniff below would misread every npm install as a standalone
131
+ // bundle. `upgrade` would then curl install.sh into ~/.codegraph: a SECOND
132
+ // install that never wins the PATH race against npm's shim, leaving
133
+ // `codegraph -v` permanently on the old version (the #1071 shadow,
134
+ // self-inflicted). A path under node_modules is authoritative about HOW the
135
+ // user installed, whatever the artifact inside looks like.
132
136
  // npx cache: <…>/_npx/<hash>/node_modules/@colbymchenry/codegraph/…
137
+ // (checked before npm — the npx cache path also contains /node_modules/).
133
138
  if (norm.includes('/_npx/')) {
134
139
  return { kind: 'npx' };
135
140
  }
@@ -138,6 +143,15 @@ function detectInstallMethod(input) {
138
143
  const underCwd = norm.startsWith(toPosix(P.resolve(input.cwd)) + '/');
139
144
  return { kind: 'npm', scope: underCwd ? 'local' : 'global' };
140
145
  }
146
+ // Bundle: <root>/lib/dist/bin/codegraph.js → <root> is up 3 from bin/.
147
+ // A bundle has a vendored node + a launcher script as siblings of lib/.
148
+ const bundleRoot = P.resolve(binDir, '..', '..', '..');
149
+ const vendoredNode = P.join(bundleRoot, isWin ? 'node.exe' : 'node');
150
+ const launcher = P.join(bundleRoot, 'bin', isWin ? 'codegraph.cmd' : 'codegraph');
151
+ if (exists(vendoredNode) && exists(launcher)) {
152
+ const os = isWin ? 'windows' : 'unix';
153
+ return { kind: 'bundle', os, bundleRoot, installDir: deriveInstallDir(bundleRoot, os, exists) };
154
+ }
141
155
  // Source checkout: running <repo>/dist/bin/codegraph.js with a sibling .git.
142
156
  const repoRoot = P.resolve(binDir, '..', '..');
143
157
  if (exists(P.join(repoRoot, 'package.json')) && exists(P.join(repoRoot, '.git'))) {
@@ -252,12 +266,14 @@ async function resolveLatestVersion(repo = exports.REPO, timeoutMs = 12000) {
252
266
  }
253
267
  throw new Error('could not resolve the latest version from GitHub. Check your network, or pin a version: `codegraph upgrade <version>`.');
254
268
  }
269
+ // Colors off when piped / NO_COLOR / --no-color (#1281).
270
+ const useColor = (0, color_1.ansiColorsEnabled)();
255
271
  const c = {
256
- bold: (s) => `\x1b[1m${s}\x1b[0m`,
257
- dim: (s) => `\x1b[2m${s}\x1b[0m`,
258
- green: (s) => `\x1b[32m${s}\x1b[0m`,
259
- yellow: (s) => `\x1b[33m${s}\x1b[0m`,
260
- cyan: (s) => `\x1b[36m${s}\x1b[0m`,
272
+ bold: (s) => (useColor ? `\x1b[1m${s}\x1b[0m` : s),
273
+ dim: (s) => (useColor ? `\x1b[2m${s}\x1b[0m` : s),
274
+ green: (s) => (useColor ? `\x1b[32m${s}\x1b[0m` : s),
275
+ yellow: (s) => (useColor ? `\x1b[33m${s}\x1b[0m` : s),
276
+ cyan: (s) => (useColor ? `\x1b[36m${s}\x1b[0m` : s),
261
277
  };
262
278
  /** The honest, additive re-index reminder shown after a successful upgrade. */
263
279
  function reindexAdvisory() {
@@ -336,15 +352,133 @@ async function runUpgrade(opts, deps) {
336
352
  // an existing Claude config, and skipped entirely by the kill-switch. Never
337
353
  // fatal to the upgrade.
338
354
  if (code === 0) {
355
+ let probe = 'inconclusive';
356
+ try {
357
+ probe = reportResolvedVersion(latest, deps);
358
+ }
359
+ catch {
360
+ /* an inconclusive probe must not fail the upgrade */
361
+ }
339
362
  try {
340
363
  await selfHealPromptHook(deps);
341
364
  }
342
365
  catch {
343
366
  /* a hook-wiring hiccup must not fail the upgrade */
344
367
  }
368
+ // The refresh executes whatever `codegraph` PATH resolves. If the probe
369
+ // just proved that's a stale shadowed install, spawning it would rewrite
370
+ // the agent surfaces with the very templates the refresh exists to heal —
371
+ // skip, and point at the manual command for after the PATH is fixed.
372
+ if (probe !== 'mismatch') {
373
+ try {
374
+ selfHealInstalledSurfaces(deps);
375
+ }
376
+ catch {
377
+ /* a refresh hiccup must not fail the upgrade */
378
+ }
379
+ }
380
+ else {
381
+ deps.log(c.dim('Skipped refreshing agent instructions/config — run `codegraph install --refresh` once the PATH is fixed.'));
382
+ }
383
+ // Reached only after a real binary update (check/up-to-date/npx/source
384
+ // all returned earlier) — the one place the upgrade path may offer the
385
+ // beta opt-in. The hook self-gates on TTY + the stored once-per-machine
386
+ // choice, so an already-answered user never sees it again.
387
+ try {
388
+ await deps.offerBetaSignup?.();
389
+ }
390
+ catch {
391
+ /* a marketing question must never fail the upgrade */
392
+ }
345
393
  }
346
394
  return code;
347
395
  }
396
+ /**
397
+ * Prove the upgrade actually took: spawn the `codegraph` this terminal's PATH
398
+ * resolves and compare its reported version to the target. Catches the silent
399
+ * failure mode where ANOTHER install shadows the one we just upgraded (issue
400
+ * #1071 — e.g. a stale `npm i -g` copy earlier on PATH than the bundle
401
+ * launcher): the upgrade "succeeds" but `codegraph -v` — in this terminal and
402
+ * every future one — keeps serving the old version. Exported for unit tests.
403
+ */
404
+ function verifyResolvedVersion(latest, deps) {
405
+ if (!deps.hasCommand('codegraph'))
406
+ return 'inconclusive';
407
+ // Windows installs expose codegraph through a .cmd launcher; Node can't
408
+ // spawn .cmd files without a shell, so route through cmd.exe there.
409
+ const probe = deps.platform === 'win32'
410
+ ? deps.capture('cmd.exe', ['/d', '/s', '/c', 'codegraph --version'])
411
+ : deps.capture('codegraph', ['--version']);
412
+ if (!probe || probe.code !== 0)
413
+ return 'inconclusive';
414
+ // `codegraph --version` prints the bare version; take the last non-empty
415
+ // line so a stray runtime warning above it can't spoil the parse.
416
+ const reported = probe.stdout.trim().split(/\r?\n/).pop()?.trim() ?? '';
417
+ if (!parseSemver(reported))
418
+ return 'inconclusive';
419
+ return compareVersions(reported, latest) === 0 ? 'match' : 'mismatch';
420
+ }
421
+ /**
422
+ * Log the outcome of the post-upgrade version probe. On a match the user
423
+ * knows the current terminal is already serving the new version; on a
424
+ * mismatch they get told exactly which stale install is hijacking their PATH
425
+ * instead of discovering it via a mysteriously unchanged `codegraph -v`.
426
+ * Inconclusive probes fall back to the old soft hint — never a scare on
427
+ * setups we can't inspect (no `codegraph` on PATH yet, exotic wrappers).
428
+ * Returns the probe result so the caller can gate the post-upgrade refresh
429
+ * (which spawns the PATH-resolved binary) on it.
430
+ */
431
+ function reportResolvedVersion(latest, deps) {
432
+ const { method } = deps;
433
+ // A project-local npm install isn't served by PATH's `codegraph` (that
434
+ // would be some other install) — a probe could only false-alarm.
435
+ if (method.kind === 'npm' && method.scope === 'local')
436
+ return 'inconclusive';
437
+ const probe = verifyResolvedVersion(latest, deps);
438
+ switch (probe) {
439
+ case 'match':
440
+ deps.log(c.green(`✓ \`codegraph\` on your PATH now reports ${latest} — this terminal is already using it.`));
441
+ break;
442
+ case 'mismatch':
443
+ deps.warn(`Installed ${latest}, but the \`codegraph\` this terminal resolves still reports an older version.`);
444
+ deps.log(c.dim('Another CodeGraph install earlier on your PATH is shadowing the one just upgraded.'));
445
+ deps.log(c.dim('Find every copy with `which -a codegraph` (Windows: `where codegraph`) and remove or upgrade the stale one.'));
446
+ break;
447
+ case 'inconclusive':
448
+ deps.log(c.dim('Open a new terminal if `codegraph --version` looks unchanged (PATH cache).'));
449
+ break;
450
+ }
451
+ return probe;
452
+ }
453
+ /**
454
+ * Refresh the agent surfaces previous installs wrote — the marker-fenced
455
+ * instructions sections (CLAUDE.md / AGENTS.md / GEMINI.md), MCP entries,
456
+ * legacy-hook cleanups — so they match the version that will serve them.
457
+ * Unlike the prompt hook above, this content is NOT version-agnostic: the
458
+ * templates are baked into the binary, so the still-running old process
459
+ * would only rewrite its own stale copy — the exact staleness this heals.
460
+ * We therefore spawn the freshly-installed binary (`codegraph install
461
+ * --refresh`), which is refresh-only: agents never configured stay
462
+ * untouched, and permission / prompt-hook choices are preserved. Gated on
463
+ * `codegraph` being resolvable on PATH (an npm-local install isn't) and on
464
+ * the kill-switch; never fatal to the upgrade.
465
+ */
466
+ function selfHealInstalledSurfaces(deps) {
467
+ if (process.env.CODEGRAPH_NO_INSTALL_REFRESH === '1')
468
+ return;
469
+ if (!deps.hasCommand('codegraph'))
470
+ return;
471
+ deps.log(c.dim('Refreshing agent instruction sections and config written by previous versions…'));
472
+ // Windows installs expose codegraph through a .cmd launcher. Node cannot
473
+ // spawn .cmd files directly without a shell, so route the constant command
474
+ // through cmd.exe there (the same launcher a terminal would resolve).
475
+ const code = deps.platform === 'win32'
476
+ ? deps.run('cmd.exe', ['/d', '/s', '/c', 'codegraph install --refresh'])
477
+ : deps.run('codegraph', ['install', '--refresh']);
478
+ if (code !== 0) {
479
+ deps.warn('Could not refresh the installed agent surfaces — run `codegraph install --refresh` manually.');
480
+ }
481
+ }
348
482
  /**
349
483
  * Wire the Claude `UserPromptSubmit` front-load hook on upgrade for an
350
484
  * already-configured global Claude install. No-op when Claude isn't configured,
@@ -384,7 +518,9 @@ function upgradeUnixBundle(method, pinned, deps) {
384
518
  return 1;
385
519
  }
386
520
  deps.log('');
387
- deps.log(c.green('✓ Upgrade complete.') + c.dim(' Open a new terminal if the version looks unchanged (PATH cache).'));
521
+ // No "open a new terminal" hedge here — after the swap, runUpgrade probes
522
+ // the PATH-resolved `codegraph --version` and reports the real outcome.
523
+ deps.log(c.green('✓ Upgrade complete.'));
388
524
  deps.log(reindexAdvisory());
389
525
  return 0;
390
526
  }
@@ -433,17 +569,33 @@ function upgradeWindowsBundle(method, latest, deps) {
433
569
  return 1;
434
570
  }
435
571
  deps.log('');
436
- deps.log(c.green('✓ Upgrade complete.') + c.dim(' Open a new terminal to be safe (PATH/version cache).'));
572
+ // The running node.exe was renamed aside, so the version probe in
573
+ // runUpgrade already exercises the NEW binary — no terminal hedge needed.
574
+ deps.log(c.green('✓ Upgrade complete.'));
437
575
  deps.log(reindexAdvisory());
438
576
  return 0;
439
577
  }
578
+ /**
579
+ * How to invoke npm. On Windows npm is a .cmd batch file, which Node refuses
580
+ * to spawn without a shell (EINVAL since the CVE-2024-27980 hardening) — a
581
+ * direct `npm.cmd` spawn fails on every current Node, so route it through
582
+ * cmd.exe, the same way the surface-refresh step invokes the .cmd launcher.
583
+ * (Verified live on the Windows VM: `spawnSync('npm.cmd')` → EINVAL;
584
+ * `cmd.exe /d /s /c npm …` → works.)
585
+ */
586
+ function npmInvocation(platform, npmArgs) {
587
+ if (platform === 'win32') {
588
+ return { cmd: 'cmd.exe', args: ['/d', '/s', '/c', ['npm', ...npmArgs].join(' ')] };
589
+ }
590
+ return { cmd: 'npm', args: npmArgs };
591
+ }
440
592
  function upgradeNpm(method, versionSpec, deps) {
441
- const npm = deps.platform === 'win32' ? 'npm.cmd' : 'npm';
442
593
  const args = method.scope === 'global'
443
594
  ? ['install', '-g', `${exports.NPM_PACKAGE}@${versionSpec}`]
444
595
  : ['install', `${exports.NPM_PACKAGE}@${versionSpec}`];
445
- deps.log(c.dim(`Running: ${npm} ${args.join(' ')}`));
446
- const code = deps.run(npm, args, process.env);
596
+ deps.log(c.dim(`Running: npm ${args.join(' ')}`));
597
+ const inv = npmInvocation(deps.platform, args);
598
+ const code = deps.run(inv.cmd, inv.args, process.env);
447
599
  if (code !== 0) {
448
600
  deps.error(`npm exited with code ${code}.`);
449
601
  if (method.scope === 'global') {
@@ -495,4 +647,13 @@ function defaultRun(cmd, args, env) {
495
647
  return -1;
496
648
  return r.status ?? -1;
497
649
  }
650
+ function defaultCapture(cmd, args) {
651
+ // stdio is piped (the default with `encoding`), so nothing the probed
652
+ // command prints reaches the user's terminal. The timeout keeps a wedged
653
+ // probe from hanging the upgrade's last step.
654
+ const r = (0, child_process_1.spawnSync)(cmd, args, { encoding: 'utf-8', windowsHide: true, timeout: 30_000 });
655
+ if (r.error)
656
+ return null;
657
+ return { code: r.status ?? -1, stdout: r.stdout ?? '' };
658
+ }
498
659
  //# sourceMappingURL=index.js.map