dsh-gitnexus-plus 0.1.3 → 0.1.4

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 (56) hide show
  1. package/README-CN.md +22 -7
  2. package/README.md +41 -8
  3. package/lib/bin/graph-helper.d.ts +21 -0
  4. package/lib/bin/graph-helper.d.ts.map +1 -0
  5. package/lib/bin/graph-helper.js +71 -0
  6. package/lib/bin/graph-helper.js.map +1 -0
  7. package/lib/client.js +4081 -2370
  8. package/lib/gitnexus/analyze.d.ts +48 -8
  9. package/lib/gitnexus/analyze.d.ts.map +1 -1
  10. package/lib/gitnexus/analyze.js +345 -84
  11. package/lib/gitnexus/analyze.js.map +1 -1
  12. package/lib/gitnexus/commands.d.ts +8 -1
  13. package/lib/gitnexus/commands.d.ts.map +1 -1
  14. package/lib/gitnexus/commands.js +19 -0
  15. package/lib/gitnexus/commands.js.map +1 -1
  16. package/lib/gitnexus/delta.d.ts +144 -0
  17. package/lib/gitnexus/delta.d.ts.map +1 -0
  18. package/lib/gitnexus/delta.js +347 -0
  19. package/lib/gitnexus/delta.js.map +1 -0
  20. package/lib/gitnexus/git-activity.d.ts +13 -21
  21. package/lib/gitnexus/git-activity.d.ts.map +1 -1
  22. package/lib/gitnexus/git-activity.js +60 -26
  23. package/lib/gitnexus/git-activity.js.map +1 -1
  24. package/lib/gitnexus/graph.d.ts +126 -0
  25. package/lib/gitnexus/graph.d.ts.map +1 -0
  26. package/lib/gitnexus/graph.js +472 -0
  27. package/lib/gitnexus/graph.js.map +1 -0
  28. package/lib/gitnexus/root.d.ts +0 -3
  29. package/lib/gitnexus/root.d.ts.map +1 -1
  30. package/lib/gitnexus/root.js +64 -5
  31. package/lib/gitnexus/root.js.map +1 -1
  32. package/lib/gitnexus/search.d.ts +21 -8
  33. package/lib/gitnexus/search.d.ts.map +1 -1
  34. package/lib/gitnexus/search.js +87 -13
  35. package/lib/gitnexus/search.js.map +1 -1
  36. package/lib/index.d.ts +6 -0
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +165 -3
  39. package/lib/index.js.map +1 -1
  40. package/lib/routes/analyze.d.ts +3 -2
  41. package/lib/routes/analyze.d.ts.map +1 -1
  42. package/lib/routes/analyze.js +8 -2
  43. package/lib/routes/analyze.js.map +1 -1
  44. package/lib/routes/delta.d.ts +22 -0
  45. package/lib/routes/delta.d.ts.map +1 -0
  46. package/lib/routes/delta.js +50 -0
  47. package/lib/routes/delta.js.map +1 -0
  48. package/lib/routes/file-diff.d.ts +19 -0
  49. package/lib/routes/file-diff.d.ts.map +1 -0
  50. package/lib/routes/file-diff.js +69 -0
  51. package/lib/routes/file-diff.js.map +1 -0
  52. package/lib/routes/graph.d.ts +22 -0
  53. package/lib/routes/graph.d.ts.map +1 -0
  54. package/lib/routes/graph.js +71 -0
  55. package/lib/routes/graph.js.map +1 -0
  56. package/package.json +2 -2
@@ -21,13 +21,20 @@
21
21
  *
22
22
  * THE ONE RULE THAT MATTERS
23
23
  * -------------------------
24
- * `sandboxPolicy` is never set here, and must never be. Passing it would be this
25
- * plugin choosing its own confinement — the escalation the approval service exists to
26
- * gate, requested through a door that cannot ask. Leaving it undefined takes the
27
- * deployment's decision. A denial is then reported as a denial, not retried wider:
28
- * the same rule the subagent prompt states, for the same reason.
24
+ * This runner never **constructs** a sandbox policy and never chooses a mode. It may
25
+ * forward a policy the host resolved (`options.sandboxPolicy`), and the host may only
26
+ * fill in the workspace root — see `src/index.ts`. The reason is measured, not
27
+ * theoretical: an agentless route has no session, so `sandboxPolicy.resolve()` falls
28
+ * back to `config.workspaceRoot ?? process.cwd()` and the sandbox derives its write
29
+ * capability SID from *that* path. The repository's own grant then never applies, and
30
+ * every write inside `.gitnexus` is refused — the failure this plugin reported as
31
+ * "sandbox denies .gitnexus". Supplying the workspace root is not escalation: the mode
32
+ * still comes from the deployment, and a read-only deployment stays read-only.
33
+ *
34
+ * A denial is reported as a denial, not retried wider: the same rule the subagent
35
+ * prompt states, for the same reason.
29
36
  */
30
- import { existsSync, mkdirSync } from 'node:fs';
37
+ import { existsSync, mkdirSync, readFileSync, rmSync } from 'node:fs';
31
38
  import path from 'node:path';
32
39
  import { defaultGitnexusHome, effectiveSkipFts } from './commands.js';
33
40
  import { findGitnexusCli } from './toolchain.js';
@@ -74,9 +81,16 @@ export function analyzeCommandLine(cliPath, repoPath, options = {}) {
74
81
  // is spawned through `node`. This is the better shape when available: no shim, no
75
82
  // `.cmd`/`.ps1` selection, and therefore no reliance on the shell's call operator.
76
83
  const viaNode = options.viaNode === true;
84
+ // Repair and skip are contradictory, and both flags are accepted by the CLI without
85
+ // complaining: `--skip-fts --repair-fts` exits 0 having done nothing. Guard here
86
+ // rather than trusting callers to keep them apart.
87
+ const repairFts = options.repairFts === true;
88
+ const skipFts = options.skipFts === true && !repairFts;
89
+ const force = options.force === true && !repairFts;
77
90
  const args = `analyze --index-only` +
78
- `${options.skipFts === true ? ' --skip-fts' : ''}` +
79
- `${options.force === true ? ' --force' : ''} ` +
91
+ `${repairFts ? ' --repair-fts' : ''}` +
92
+ `${skipFts ? ' --skip-fts' : ''}` +
93
+ `${force ? ' --force' : ''} ` +
80
94
  quoteFor(flavor, repoPath);
81
95
  const head = viaNode ? `node ${quoteFor(flavor, cliPath)}` : quoteFor(flavor, cliPath);
82
96
  // On Windows a `.cmd` or `.ps1` reached by absolute path needs `&`. POSIX needs none,
@@ -98,27 +112,151 @@ export function analyzeCommandLine(cliPath, repoPath, options = {}) {
98
112
  /**
99
113
  * A sandbox refusal, recognised from the marker DSH writes into the output.
100
114
  *
101
- * Tested before the generic non-zero path because a denial is not a failure of
102
- * GitNexus — retrying it, or reporting it as "analyze failed", both mislead.
115
+ * The marker is the only reliable signal. It used to also match a bare `EPERM`, which
116
+ * is how a transient Windows file lock got reported as "the sandbox refused this
117
+ * write" — and the operator was told to stop trying, when retrying was the answer.
103
118
  */
104
119
  function looksDenied(text) {
105
- return /\[sandbox:[^\]]*denied/i.test(text) || /access is denied|permission denied|EPERM/i.test(text);
120
+ return /\[sandbox:[^\]]*denied/i.test(text) || /access is denied/i.test(text);
121
+ }
122
+ /** Delay before the single transient-lock retry. Long enough for a scanner to let go. */
123
+ const RETRY_DELAY_MS = 1500;
124
+ /**
125
+ * Whether a failure looks like a transient file lock rather than a policy refusal.
126
+ *
127
+ * Measured on GitNexus 1.6.12: the first write inside `.gitnexus` is
128
+ * `lbug.init.lock`, opened with `O_CREAT | O_EXCL`, and Windows can refuse it with
129
+ * `EPERM` while another scanner or a previous process holds the directory. The same
130
+ * class produces `unable to acquire init lock` when a crashed run left the file behind.
131
+ * Both are worth one retry; a sandbox marker never is, and neither is a denied
132
+ * directory creation — see {@link isSandboxStoreDenied}.
133
+ */
134
+ function isTransientLock(text) {
135
+ if (/\[sandbox:[^\]]*denied/i.test(text))
136
+ return false;
137
+ // The parse store is a directory the analyzer must create; a retry cannot grant a
138
+ // right the confined token does not have, so that class is handled separately.
139
+ if (isSandboxStoreDenied(text))
140
+ return false;
141
+ // A refused `spawn` is the sandbox blocking a child process (the FTS installer), not a
142
+ // held file: waiting and retrying changes nothing.
143
+ if (/spawn EPERM/i.test(text))
144
+ return false;
145
+ if (/unable to acquire init lock/i.test(text))
146
+ return true;
147
+ return /(EPERM|EBUSY|resource busy)/i.test(text) && /\.gitnexus|init\.lock|lbug/i.test(text);
148
+ }
149
+ /**
150
+ * Whether GitNexus tried to start a child process and the sandbox refused.
151
+ *
152
+ * Measured on a `--repair-fts` run: `Analysis failed: spawn EPERM`. The FTS extension is
153
+ * installed/loaded out of process, which a confined shell denies. This is the same class
154
+ * as the respawn problem `GITNEXUS_MEMORY=off` was added for — but this one is a child
155
+ * the analyzer starts deliberately, and no flag suppresses it.
156
+ */
157
+ function looksSpawnDenied(text) {
158
+ return /spawn EPERM/i.test(text);
159
+ }
160
+ /**
161
+ * Whether the FTS extension was found and still could not be loaded.
162
+ *
163
+ * That is an upstream runtime problem, not a sandbox refusal and not something a retry
164
+ * can fix: on Windows it usually names a missing DLL (`找不到指定的模块`), which the
165
+ * upstream message traces to the VC++ 2015-2022 x64 redistributable or OpenSSL 3.
166
+ */
167
+ function looksFtsUnloadable(text) {
168
+ return (/FTS extension file was found but could not be loaded/i.test(text) ||
169
+ (/failed to load library/i.test(text) && /fts/i.test(text)));
170
+ }
171
+ /**
172
+ * Whether the parse worker was refused permission to create its cache directories.
173
+ *
174
+ * Measured in a confined DSH profile: the token can create **files** under `.gitnexus`
175
+ * (`lbug.init.lock` succeeds) but not **directories**, so `persistParsedFileShardSync`
176
+ * dies at `mkdir .gitnexus/parsedfile-store` and the pool trips its circuit breaker.
177
+ * Pre-creating the directory does not help either — GitNexus deletes it at the start of
178
+ * every parse, and that delete is refused for the same reason (0.1.3 shipped exactly
179
+ * that workaround and produced `EPERM … rmdir`). This is a property of the deployment,
180
+ * so the honest answer is one precise message pointing at the terminal, not a retry.
181
+ */
182
+ function isSandboxStoreDenied(text) {
183
+ return (/EPERM[^\n]*mkdir[^\n]*\.gitnexus[\\/](parsedfile-store|parsedfile-cache|parse-cache)/i.test(text) ||
184
+ /mkdir[^\n]*\.gitnexus[\\/](parsedfile-store|parsedfile-cache|parse-cache)[^\n]*EPERM/i.test(text));
185
+ }
186
+ /**
187
+ * Remove the init lock a crashed run left behind, so the retry can take it.
188
+ *
189
+ * Safe by construction: this runner holds one run per repository, so no other analyze
190
+ * started by this plugin can be inside the window. A live lock from another tool is
191
+ * left to GitNexus's own staleness detection — this only clears the file, it does not
192
+ * decide who owns it.
193
+ */
194
+ function clearStaleLock(repoPath) {
195
+ try {
196
+ rmSync(path.join(repoPath, '.gitnexus', 'lbug.init.lock'), { force: true });
197
+ }
198
+ catch {
199
+ /* the retry may still succeed once a scanner releases it */
200
+ }
106
201
  }
107
202
  /**
108
- * GitNexus 1.6.12 creates these cache directories from the parse worker.
203
+ * Whether the manifest on disk records no commit.
109
204
  *
110
- * A worker running under a restricted host token can be denied `mkdir` on the
111
- * project's inherited `.gitnexus` ACL even though it can write files there. The
112
- * failure is EPERM at the first shard write and takes the whole parse phase down
113
- * with it. Creating the directories from the host, before the shell starts, makes
114
- * the worker use the directories that already exist. Returns an actionable error
115
- * instead of letting the worker fail on a path the panel then has to explain.
205
+ * In a confined shell the analyzer cannot start `git`, so it writes an empty
206
+ * `lastCommit` even on a successful run. The index itself is fine — the baseline is not
207
+ * — and that is what makes the refresh gate answer "无法确认" instead of "已是最新".
208
+ * Reported to the operator rather than repaired here: the manifest belongs to GitNexus,
209
+ * and writing a commit into it is the analyzer's decision, not this plugin's.
116
210
  */
117
- const ANALYZE_CACHE_DIRS = ['parsedfile-store', 'parsedfile-cache', 'parse-cache'];
211
+ function lacksCommitBaseline(repoPath) {
212
+ try {
213
+ const raw = JSON.parse(readFileSync(path.join(repoPath, '.gitnexus', 'gitnexus.json'), 'utf8'));
214
+ return typeof raw.lastCommit !== 'string' || raw.lastCommit === '';
215
+ }
216
+ catch {
217
+ return false;
218
+ }
219
+ }
220
+ /**
221
+ * The **durable** caches, created from the host before the shell starts.
222
+ *
223
+ * A worker running under a restricted host token can be denied `mkdir` on the project's
224
+ * inherited `.gitnexus` ACL even though it can write files there. The failure is EPERM
225
+ * at the first shard write and takes the whole parse phase down with it. Creating these
226
+ * two from the host, before the shell starts, makes the worker use directories that
227
+ * already exist. They are never cleared between runs, so a pre-created one is inert.
228
+ */
229
+ const ANALYZE_CACHE_DIRS = ['parsedfile-cache', 'parse-cache'];
230
+ /**
231
+ * GitNexus's **run-scoped** parsed-file store. Deliberately not pre-created.
232
+ *
233
+ * `parse-impl` calls `clearParsedFileStore()` unconditionally at the start of parsing,
234
+ * which is `fs.rm(dir, { recursive: true, force: true })`. `force` only forgives a
235
+ * missing directory — not a refusal or a lock. So a directory that exists there must be
236
+ * deleted before every parse, and 0.1.3 pre-created exactly that: it fixed a worker
237
+ * `mkdir` and introduced a delete the restricted process has to perform on a directory
238
+ * the **host** created. When that delete is denied or briefly locked, the parse dies
239
+ * with `EPERM … rmdir '<repo>\\.gitnexus\\parsedfile-store'` — the failure reported
240
+ * against 0.1.3.
241
+ *
242
+ * Measured against GitNexus 1.6.12: with the directory absent, a cold `--force` parse
243
+ * succeeds and never creates it, while the durable chunk directories it does create
244
+ * show the confined process can `mkdir`. So the store is left to GitNexus, and a
245
+ * leftover from an older plugin version is removed before spawning instead.
246
+ */
247
+ const RUN_SCOPED_STORE = 'parsedfile-store';
118
248
  function prepareAnalyzeCacheDirs(repoPath) {
119
249
  const indexDir = path.join(repoPath, '.gitnexus');
120
250
  if (!existsSync(indexDir))
121
251
  return null;
252
+ // Best effort. If this cannot be removed, GitNexus's own clear gets the next attempt;
253
+ // failing the run here would only replace one EPERM with a less accurate one.
254
+ try {
255
+ rmSync(path.join(indexDir, RUN_SCOPED_STORE), { recursive: true, force: true });
256
+ }
257
+ catch {
258
+ /* the analyzer's clear is the next attempt; do not pre-empt it */
259
+ }
122
260
  for (const name of ANALYZE_CACHE_DIRS) {
123
261
  const target = path.join(indexDir, name);
124
262
  try {
@@ -146,14 +284,35 @@ export function createAnalyzeRunner(options) {
146
284
  const outputLimit = options.outputLimit ?? DEFAULT_OUTPUT_LIMIT;
147
285
  const tailLimit = options.tailLimit ?? DEFAULT_TAIL_LIMIT;
148
286
  const now = options.now ?? (() => Date.now());
287
+ const retryDelayMs = options.retryDelayMs ?? RETRY_DELAY_MS;
149
288
  const shellFlavor = process.platform === 'win32' ? 'win32' : 'posix';
150
289
  const runs = new Map();
151
290
  const inFlight = new Map();
291
+ // One status per repository, and a long session can touch many. The map used to grow
292
+ // with every repository ever visited, each entry holding a 4 KB output tail; an idle
293
+ // panel never needs more than the repositories it can still show.
294
+ const RUNS_MAX = 32;
295
+ /** Store the latest status, evicting finished entries beyond the cap, oldest first. */
296
+ const rememberRun = (key, status) => {
297
+ runs.delete(key);
298
+ runs.set(key, status);
299
+ if (runs.size <= RUNS_MAX)
300
+ return;
301
+ for (const [other, entry] of runs) {
302
+ if (entry.state === 'running')
303
+ continue;
304
+ runs.delete(other);
305
+ if (runs.size <= RUNS_MAX)
306
+ break;
307
+ }
308
+ };
152
309
  /** The shape a status starts from, before any run has touched it. */
153
310
  const BLANK = {
154
311
  state: 'failed',
155
312
  force: false,
313
+ repairFts: false,
156
314
  command: '',
315
+ attempts: 0,
157
316
  startedAt: 0,
158
317
  finishedAt: null,
159
318
  exitCode: null,
@@ -171,7 +330,7 @@ export function createAnalyzeRunner(options) {
171
330
  // silent no-op. The spread above cannot express that.
172
331
  finishedAt: patch.finishedAt ?? now(),
173
332
  };
174
- runs.set(repoPath, next);
333
+ rememberRun(repoPath, next);
175
334
  inFlight.delete(repoPath);
176
335
  return next;
177
336
  };
@@ -180,11 +339,18 @@ export function createAnalyzeRunner(options) {
180
339
  // Named `request`, not `options`: the runner's own configuration is the outer
181
340
  // `options`, and shadowing it silently dropped `toolchain`, `memoryOff` and
182
341
  // `heapMb` from every run built after the force argument was added.
183
- const force = request.force === true;
342
+ //
343
+ // Repair wins over force: a caller asking for both wants the smaller, more targeted
344
+ // operation, and running a full rebuild to fix FTS would be a much larger change
345
+ // than the button said. `analyzeCommandLine` enforces the same precedence so the
346
+ // displayed command cannot disagree with the one executed.
347
+ const repairFts = request.repairFts === true;
348
+ const force = repairFts ? false : request.force === true;
184
349
  // Both decisions are per repository, not per plugin: the skip-fts policy depends
185
350
  // on the index's own FTS capability, and the registry redirect belongs beside the
186
- // index so it stays inside the workspace the host was granted.
187
- const skipFts = effectiveSkipFts(key, options.skipFts === true);
351
+ // index so it stays inside the workspace the host was granted. A repair run never
352
+ // skips FTS — that would be the one flag combination that does nothing at all.
353
+ const skipFts = repairFts ? false : effectiveSkipFts(key, options.skipFts === true);
188
354
  const gitnexusHome = options.gitnexusHome ?? defaultGitnexusHome(key);
189
355
  // One run per repository. Two concurrent `analyze` processes would contend for the
190
356
  // same store, and the second would report a failure that says nothing about the
@@ -192,11 +358,18 @@ export function createAnalyzeRunner(options) {
192
358
  const running = runs.get(key);
193
359
  if (running !== undefined && running.state === 'running')
194
360
  return running;
361
+ // The command as a human would type it, for the states that never reach a real
362
+ // invocation. Kept in one place so an early return cannot describe a different
363
+ // operation than the one the request asked for.
364
+ const previewCommand = `gitnexus analyze --index-only` +
365
+ `${repairFts ? ' --repair-fts' : ''}` +
366
+ `${force ? ' --force' : ''}`;
195
367
  if (shell === null) {
196
368
  return finish(key, {
197
369
  state: 'unavailable',
198
370
  force,
199
- command: `gitnexus analyze --index-only${force ? ' --force' : ''}`,
371
+ repairFts,
372
+ command: previewCommand,
200
373
  startedAt: now(),
201
374
  output: '',
202
375
  message: '当前部署没有提供 shell 执行器(ctx.shell 未挂载),无法运行命令。' +
@@ -211,7 +384,8 @@ export function createAnalyzeRunner(options) {
211
384
  return finish(key, {
212
385
  state: 'unavailable',
213
386
  force,
214
- command: `gitnexus analyze --index-only${force ? ' --force' : ''}`,
387
+ repairFts,
388
+ command: previewCommand,
215
389
  startedAt: now(),
216
390
  output: '',
217
391
  message: '本机没有找到 gitnexus 命令,无法执行。安装后重试:`npm i -g gitnexus`。' +
@@ -227,6 +401,7 @@ export function createAnalyzeRunner(options) {
227
401
  heapMb: options.heapMb,
228
402
  viaNode: cli.viaNode,
229
403
  force,
404
+ repairFts,
230
405
  skipFts,
231
406
  gitnexusHome,
232
407
  });
@@ -235,6 +410,7 @@ export function createAnalyzeRunner(options) {
235
410
  return finish(key, {
236
411
  state: 'failed',
237
412
  force,
413
+ repairFts,
238
414
  command,
239
415
  startedAt: now(),
240
416
  output: '',
@@ -247,14 +423,20 @@ export function createAnalyzeRunner(options) {
247
423
  repoPath: key,
248
424
  state: 'running',
249
425
  force,
426
+ repairFts,
250
427
  command,
428
+ attempts: 1,
251
429
  startedAt: now(),
252
430
  finishedAt: null,
253
431
  exitCode: null,
254
432
  message: null,
255
433
  output: '',
256
434
  };
257
- runs.set(key, started);
435
+ rememberRun(key, started);
436
+ // The host resolves the policy; this runner only carries it. Absent when the
437
+ // deployment has no `sandboxPolicy` service, and then the executor's own default
438
+ // applies — exactly as before.
439
+ const sandboxPolicy = options.sandboxPolicy?.(key);
258
440
  const spec = shell.resolve({
259
441
  command,
260
442
  workdir: key,
@@ -262,68 +444,147 @@ export function createAnalyzeRunner(options) {
262
444
  onExpiry: 'kill',
263
445
  stdoutMaxBytes: outputLimit,
264
446
  signal: controller.signal,
265
- // `sandboxPolicy` is deliberately absent. See the module comment.
447
+ ...(sandboxPolicy === undefined ? {} : { sandboxPolicy }),
266
448
  });
267
449
  void (async () => {
268
- let execution;
269
- try {
270
- execution = await shell.execute(spec);
271
- }
272
- catch (cause) {
273
- // `execute` rejects only for infrastructure failures — an unusable workdir, no
274
- // shell. A cancellation rejects here too, before a handle exists.
275
- const aborted = controller.signal.aborted;
276
- finish(key, {
277
- state: aborted ? 'cancelled' : 'failed',
278
- message: aborted ? '已取消。' : `无法启动命令:${String(cause?.message ?? cause)}`,
279
- });
280
- return;
281
- }
282
- let result;
283
- try {
284
- result = await execution.result();
285
- }
286
- catch (cause) {
287
- finish(key, { state: 'failed', message: `执行失败:${String(cause?.message ?? cause)}` });
450
+ // A single retry, and only for one class of failure.
451
+ //
452
+ // Measured: GitNexus's first write inside `.gitnexus` is the init lock, and on
453
+ // Windows that `open` can fail with `EPERM` while a virus scanner or the indexer
454
+ // holds the directory — a transient refusal, not a policy one. The ACL for that
455
+ // path was verified healthy (`WRITE_DAC`/`WRITE_OWNER` present, no foreign
456
+ // entries), so retrying once after clearing a stale lock is the response, not an
457
+ // escalation. Anything carrying the sandbox's own marker is never retried.
458
+ for (let attempt = 1; attempt <= 2; attempt += 1) {
459
+ let execution;
460
+ try {
461
+ execution = await shell.execute(spec);
462
+ }
463
+ catch (cause) {
464
+ // `execute` rejects only for infrastructure failures — an unusable workdir, no
465
+ // shell. A cancellation rejects here too, before a handle exists.
466
+ const aborted = controller.signal.aborted;
467
+ finish(key, {
468
+ state: aborted ? 'cancelled' : 'failed',
469
+ attempts: attempt,
470
+ message: aborted ? '已取消。' : `无法启动命令:${String(cause?.message ?? cause)}`,
471
+ });
472
+ return;
473
+ }
474
+ let result;
475
+ try {
476
+ result = await execution.result();
477
+ }
478
+ catch (cause) {
479
+ finish(key, {
480
+ state: 'failed',
481
+ attempts: attempt,
482
+ message: `执行失败:${String(cause?.message ?? cause)}`,
483
+ });
484
+ return;
485
+ }
486
+ const combined = `${result.stdout?.text ?? ''}${result.stderr?.text ?? ''}`;
487
+ const body = tail(combined, tailLimit);
488
+ const exitCode = typeof result.exitCode === 'number' ? result.exitCode : null;
489
+ if (attempt === 1 &&
490
+ result.timedOut !== true &&
491
+ !controller.signal.aborted &&
492
+ isTransientLock(combined)) {
493
+ clearStaleLock(key);
494
+ await new Promise((resolve) => setTimeout(resolve, retryDelayMs));
495
+ if (controller.signal.aborted) {
496
+ finish(key, { state: 'cancelled', attempts: attempt, exitCode, output: body, message: '已取消。' });
497
+ return;
498
+ }
499
+ continue;
500
+ }
501
+ // Order matters. A denial can also be a non-zero exit, and reporting it as a
502
+ // generic failure sends the operator looking for a GitNexus bug that is not
503
+ // there. Cancellation is checked before timeout because a kill from `cancel()`
504
+ // and a kill from the deadline both surface as a killed process.
505
+ if (controller.signal.aborted) {
506
+ finish(key, { state: 'cancelled', attempts: attempt, exitCode, output: body, message: '已取消。' });
507
+ }
508
+ else if (result.timedOut === true) {
509
+ finish(key, {
510
+ state: 'timed-out',
511
+ attempts: attempt,
512
+ exitCode,
513
+ output: body,
514
+ message: `超过 ${Math.round(timeoutMs / 1000)} 秒上限已终止。大仓库的全量重建可能需要更长时间。`,
515
+ });
516
+ }
517
+ else if (looksFtsUnloadable(combined)) {
518
+ // The extension is present and still cannot load: an upstream runtime gap, not
519
+ // a sandbox refusal and not a retry candidate.
520
+ finish(key, {
521
+ state: 'failed',
522
+ attempts: attempt,
523
+ exitCode,
524
+ output: body,
525
+ message: 'FTS 扩展文件存在但加载失败 —— 通常是 Windows 缺少原生运行时(VC++ 2015-2022 x64 与 OpenSSL 3),' +
526
+ '不是索引损坏,也不是本插件能修的。装好运行时后再试;在此之前搜索仍按名称/路径匹配。',
527
+ });
528
+ }
529
+ else if (looksSpawnDenied(combined)) {
530
+ finish(key, {
531
+ state: 'denied',
532
+ attempts: attempt,
533
+ exitCode,
534
+ output: body,
535
+ message: '分析器要启动一个子进程(FTS 扩展的安装/加载),当前沙箱不允许 spawn。请在普通终端执行下面的命令;' +
536
+ '若终端里仍报扩展无法加载,那是缺少原生运行时。',
537
+ });
538
+ }
539
+ else if (isSandboxStoreDenied(combined)) {
540
+ // Deterministic, not transient: the confined token may create files in
541
+ // `.gitnexus` but not directories, and the parse worker needs a directory.
542
+ // Retrying would only spend another parse; say what to do instead.
543
+ finish(key, {
544
+ state: 'denied',
545
+ attempts: attempt,
546
+ exitCode,
547
+ output: body,
548
+ message: '分析器的解析阶段要在 .gitnexus 下创建缓存目录,当前沙箱不允许(可以建文件、不能建目录),' +
549
+ '预建目录也会被 GitNexus 在解析开始时删除。请在普通终端执行下面的命令,再回到面板刷新。',
550
+ });
551
+ }
552
+ else if (looksDenied(combined)) {
553
+ finish(key, {
554
+ state: 'denied',
555
+ attempts: attempt,
556
+ exitCode,
557
+ output: body,
558
+ message: '沙箱拒绝了这次写入。本插件不会申请扩权 —— 需要在终端里手动执行这条命令。',
559
+ });
560
+ }
561
+ else if (exitCode === 0) {
562
+ finish(key, {
563
+ state: 'done',
564
+ attempts: attempt,
565
+ exitCode,
566
+ output: body,
567
+ // A confined shell cannot start `git`, so GitNexus cannot record the commit
568
+ // it indexed. The index is still correct; only the baseline is missing, and
569
+ // the gate will honestly say "无法确认" until a terminal run fills it in.
570
+ message: lacksCommitBaseline(key)
571
+ ? '刷新完成。但沙箱里分析器读不到 git,索引没有记录提交基线 —— 想让门禁给出"已是最新",在普通终端再跑一次下面的命令。'
572
+ : null,
573
+ });
574
+ }
575
+ else {
576
+ finish(key, {
577
+ state: 'failed',
578
+ attempts: attempt,
579
+ exitCode,
580
+ output: body,
581
+ message: attempt > 1 && isTransientLock(combined)
582
+ ? '缓存或锁文件被临时占用(EPERM/EBUSY),已自动重试一次仍失败。稍后重试;若持续出现,把下面的命令放到普通终端执行。'
583
+ : `gitnexus 以退出码 ${exitCode ?? '未知'} 结束。`,
584
+ });
585
+ }
288
586
  return;
289
587
  }
290
- const combined = `${result.stdout?.text ?? ''}${result.stderr?.text ?? ''}`;
291
- const body = tail(combined, tailLimit);
292
- const exitCode = typeof result.exitCode === 'number' ? result.exitCode : null;
293
- // Order matters. A denial can also be a non-zero exit, and reporting it as a
294
- // generic failure sends the operator looking for a GitNexus bug that is not
295
- // there. Cancellation is checked before timeout because a kill from `cancel()`
296
- // and a kill from the deadline both surface as a killed process.
297
- if (controller.signal.aborted) {
298
- finish(key, { state: 'cancelled', exitCode, output: body, message: '已取消。' });
299
- }
300
- else if (result.timedOut === true) {
301
- finish(key, {
302
- state: 'timed-out',
303
- exitCode,
304
- output: body,
305
- message: `超过 ${Math.round(timeoutMs / 1000)} 秒上限已终止。大仓库的全量重建可能需要更长时间。`,
306
- });
307
- }
308
- else if (looksDenied(combined)) {
309
- finish(key, {
310
- state: 'denied',
311
- exitCode,
312
- output: body,
313
- message: '沙箱拒绝了这次写入。本插件不会申请扩权 —— 需要在终端里手动执行这条命令。',
314
- });
315
- }
316
- else if (exitCode === 0) {
317
- finish(key, { state: 'done', exitCode, output: body, message: null });
318
- }
319
- else {
320
- finish(key, {
321
- state: 'failed',
322
- exitCode,
323
- output: body,
324
- message: `gitnexus 以退出码 ${exitCode ?? '未知'} 结束。`,
325
- });
326
- }
327
588
  })();
328
589
  return started;
329
590
  };
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../src/gitnexus/analyze.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAA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,CAAC;QAEL,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO;QACL,KAAK;QACL,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI;QAC9D,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE;YACnB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrC,IAAI,UAAU,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;YAC3C,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,MAAM,EAAE;gBAAE,UAAU,CAAC,KAAK,EAAE,CAAC;YAC/D,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -61,7 +61,7 @@ export declare function ftsAvailable(repoPath: string): boolean;
61
61
  * refresh fail with `spawn EPERM` on an index that does not.
62
62
  */
63
63
  export declare function effectiveSkipFts(repoPath: string, configured: boolean): boolean;
64
- export type MaintenanceMode = 'init' | 'full';
64
+ export type MaintenanceMode = 'init' | 'full' | 'repair-fts';
65
65
  export interface MaintenanceCommand {
66
66
  mode: MaintenanceMode;
67
67
  label: string;
@@ -84,6 +84,13 @@ export interface MaintenanceOptions {
84
84
  skipFts?: boolean;
85
85
  memoryOff?: boolean;
86
86
  gitnexusHome?: string | null;
87
+ /**
88
+ * Offer the FTS repair command. The caller decides from the index's own
89
+ * `capabilities.fts.status`, because this module is deliberately filesystem-free:
90
+ * the exact command text is what a test asserts on, and a hidden manifest read
91
+ * would make the output depend on whatever repository happened to be on disk.
92
+ */
93
+ includeRepair?: boolean;
87
94
  }
88
95
  /** The resolved form of {@link MaintenanceOptions}, after defaults are applied. */
89
96
  interface ResolvedOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/gitnexus/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAQH;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAetD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAE/E;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,mFAAmF;AACnF,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAA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