@mrclrchtr/supi-code-intelligence 11.2.0 → 11.4.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.
- package/CHANGELOG.md +30 -0
- package/README.md +19 -9
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +40 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +30 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/trim-comparator-whitespace.js +438 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-collection.ts +11 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +77 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-input-admission.ts +149 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-typescript-project.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +151 -44
- package/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-typescript-coverage.ts +118 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +157 -23
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +318 -58
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/typescript-file-local.ts +87 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +22 -17
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +68 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +2 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +3 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/declaration-level.ts +34 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/query-result.ts +9 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +13 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/child-web-tools.ts +110 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/session.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +9 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +9 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +40 -25
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/call-context.ts +44 -0
- package/package.json +6 -5
- package/src/analysis/health/server-status.ts +6 -2
- package/src/analysis/helpers.ts +0 -7
- package/src/analysis/relations/implementations.ts +5 -0
- package/src/analysis/relations/references.ts +5 -0
- package/src/analysis/search/exclusions.ts +47 -0
- package/src/analysis/search/paths.ts +32 -9
- package/src/analysis/target/anchored-structural.ts +3 -8
- package/src/analysis/target/anchored.ts +4 -20
- package/src/analysis/target/file-merge.ts +162 -0
- package/src/analysis/target/file-outline-omissions.ts +146 -0
- package/src/analysis/target/file-refinement.ts +7 -7
- package/src/analysis/target/file.ts +44 -156
- package/src/analysis/target/identity.ts +1 -1
- package/src/analysis/target/latex-label-container.ts +6 -6
- package/src/analysis/target/latex-section-anchor.ts +6 -6
- package/src/analysis/target/resolution.ts +18 -0
- package/src/analysis/target/symbol.ts +44 -12
- package/src/analysis/target/types.ts +38 -7
- package/src/api.ts +1 -1
- package/src/app/app.ts +9 -3
- package/src/extension.ts +17 -11
- package/src/session/graph/collect.ts +3 -10
- package/src/session/graph-types.ts +5 -1
- package/src/session/graph-workflow.ts +6 -4
- package/src/session/inspect/collect.ts +8 -2
- package/src/session/inspect/file-point.ts +2 -3
- package/src/session/inspect-workflow.ts +1 -1
- package/src/session/orientation/collect.ts +54 -16
- package/src/session/orientation/context-sections.ts +2 -3
- package/src/session/orientation/facts.ts +9 -1
- package/src/session/orientation/workspace-context.ts +3 -0
- package/src/session/orientation-types.ts +3 -0
- package/src/session/orientation-workflow.ts +24 -8
- package/src/session/refactor-identity.ts +76 -0
- package/src/session/refactor-workflow.ts +14 -16
- package/src/session/session.ts +87 -12
- package/src/session/target-store.ts +3 -18
- package/src/session/target-workflow.ts +56 -37
- package/src/substrate/lsp/recovery.ts +5 -5
- package/src/tool/code_find/render.ts +8 -4
- package/src/tool/code_find/result.ts +78 -6
- package/src/tool/code_find/spec.ts +4 -3
- package/src/tool/code_find/structured.ts +25 -9
- package/src/tool/code_graph/details.ts +1 -0
- package/src/tool/code_graph/display.ts +1 -1
- package/src/tool/code_graph/guidance.ts +1 -1
- package/src/tool/code_graph/markdown.ts +11 -6
- package/src/tool/code_graph/read-next.ts +38 -9
- package/src/tool/code_graph/reference-selection.ts +30 -0
- package/src/tool/code_graph/result.ts +25 -118
- package/src/tool/code_graph/section.ts +137 -0
- package/src/tool/code_graph/spec.ts +3 -3
- package/src/tool/code_graph/structured.ts +17 -6
- package/src/tool/code_health/display-paths.ts +92 -0
- package/src/tool/code_health/file-scope-markdown.ts +3 -2
- package/src/tool/code_health/result.ts +4 -2
- package/src/tool/code_health/spec.ts +3 -3
- package/src/tool/code_health/structured-schema.ts +44 -44
- package/src/tool/code_inspect/spec.ts +5 -1
- package/src/tool/code_inspect/structured.ts +1 -2
- package/src/tool/code_orientation/directory-navigation.ts +20 -31
- package/src/tool/code_orientation/execute.ts +1 -1
- package/src/tool/code_orientation/result.ts +22 -5
- package/src/tool/code_orientation/structured-schema.ts +46 -36
- package/src/tool/code_orientation/structured-workspace.ts +2 -1
- package/src/tool/code_orientation/structured.ts +6 -12
- package/src/tool/code_orientation/workspace-format.ts +2 -5
- package/src/tool/code_orientation/workspace-output.ts +40 -13
- package/src/tool/code_orientation/workspace-sections.ts +48 -4
- package/src/tool/code_refactor_apply/result.ts +1 -1
- package/src/tool/code_refactor_plan/result.ts +2 -1
- package/src/tool/code_refactor_plan/structured.ts +2 -3
- package/src/tool/code_resolve/guidance.ts +1 -1
- package/src/tool/code_resolve/markdown.ts +127 -64
- package/src/tool/code_resolve/result.ts +41 -25
- package/src/tool/code_resolve/structured.ts +49 -18
- package/src/tool/result/model-budget.ts +2 -2
- package/src/tool/result/refactor.ts +8 -5
- package/src/tool/result/structured.ts +8 -5
- package/src/tool/result/types.ts +31 -24
- package/src/tool/schemas.ts +5 -5
- package/src/ui/status-command.ts +37 -1
- package/src/ui/status-overlay.ts +70 -51
- package/src/ui/status-presentation.ts +108 -0
- package/src/ui/tui/common.ts +10 -10
package/src/ui/status-overlay.ts
CHANGED
|
@@ -12,7 +12,11 @@ import {
|
|
|
12
12
|
truncateToWidth,
|
|
13
13
|
} from "@earendil-works/pi-tui";
|
|
14
14
|
import { BRAILLE_SPINNER_FRAMES } from "@mrclrchtr/supi-core/spinner-frames";
|
|
15
|
-
import type {
|
|
15
|
+
import type {
|
|
16
|
+
Diagnostic,
|
|
17
|
+
DiagnosticEvidenceSummary,
|
|
18
|
+
ProjectServerInfo,
|
|
19
|
+
} from "@mrclrchtr/supi-lsp/api";
|
|
16
20
|
import type {
|
|
17
21
|
DiagnosticCheckFile,
|
|
18
22
|
WorkspaceDiagnosticCheckReport,
|
|
@@ -26,16 +30,23 @@ import {
|
|
|
26
30
|
import type { WorkspaceStatusSnapshot } from "../analysis/health/status.ts";
|
|
27
31
|
import type { HealthDiagnosticEntry } from "../session/health-types.ts";
|
|
28
32
|
import { diagnosticMessageString } from "../substrate/lsp/utils.ts";
|
|
33
|
+
import {
|
|
34
|
+
CiHealthRefreshError,
|
|
35
|
+
presentDiagnosticDetails,
|
|
36
|
+
presentDiagnosticEvidence,
|
|
37
|
+
} from "./status-presentation.ts";
|
|
29
38
|
|
|
30
39
|
/** Passive health facts plus the session's active tool surface. */
|
|
31
40
|
export interface CiStatusData extends WorkspaceStatusSnapshot {
|
|
32
41
|
readonly activeTools: readonly string[];
|
|
33
42
|
readonly diagnosticCheck?: WorkspaceDiagnosticCheckReport;
|
|
43
|
+
/** Compact outcome of the latest health action, never a source of current evidence. */
|
|
44
|
+
readonly healthRefresh?: readonly string[];
|
|
34
45
|
}
|
|
35
46
|
|
|
36
|
-
/** Full
|
|
47
|
+
/** Full messages and file-specific evidence from one passive diagnostic snapshot. */
|
|
37
48
|
export interface CiDiagnosticDetails {
|
|
38
|
-
readonly
|
|
49
|
+
readonly evidence: DiagnosticEvidenceSummary;
|
|
39
50
|
readonly entries: readonly {
|
|
40
51
|
readonly file: string;
|
|
41
52
|
readonly diagnostics: readonly Diagnostic[];
|
|
@@ -51,17 +62,23 @@ export interface CiStatusDialogDeps {
|
|
|
51
62
|
fetchDetailedDiagnostics?: () => CiDiagnosticDetails | Promise<CiDiagnosticDetails>;
|
|
52
63
|
onRefresh?: (signal: AbortSignal) => Promise<CiStatusData>;
|
|
53
64
|
onCheck?: (signal: AbortSignal) => Promise<CiStatusData>;
|
|
65
|
+
onHealth?: (signal: AbortSignal) => Promise<CiStatusData>;
|
|
54
66
|
}
|
|
55
67
|
|
|
56
68
|
type DiagnosticFile = DiagnosticCheckFile & HealthDiagnosticEntry;
|
|
57
69
|
|
|
58
70
|
type DetailState =
|
|
59
71
|
| { kind: "loading" }
|
|
60
|
-
| { kind: "ready"; diagnostics: readonly Diagnostic[];
|
|
72
|
+
| { kind: "ready"; diagnostics: readonly Diagnostic[]; evidenceLabel: string }
|
|
61
73
|
| { kind: "error"; message: string };
|
|
62
74
|
const MAX_INLINE_MESSAGES = 5;
|
|
63
75
|
const MAX_OPEN_FILES_SHOWN = 3;
|
|
64
76
|
const FRAME_ROWS = 6;
|
|
77
|
+
const ACTION_LABELS = {
|
|
78
|
+
reload: { name: "Reload", progress: "reloading" },
|
|
79
|
+
check: { name: "Check", progress: "checking" },
|
|
80
|
+
health: { name: "Refresh health", progress: "refreshing health" },
|
|
81
|
+
};
|
|
65
82
|
const STATUS_ACTIONS = [
|
|
66
83
|
"tui.select.cancel",
|
|
67
84
|
"tui.select.up",
|
|
@@ -82,7 +99,8 @@ export class CiStatusDialog {
|
|
|
82
99
|
private refreshGeneration = 0;
|
|
83
100
|
private refreshing = false;
|
|
84
101
|
private refreshError: string | undefined;
|
|
85
|
-
private
|
|
102
|
+
private healthRefresh: readonly string[] | undefined;
|
|
103
|
+
private refreshAction: "reload" | "check" | "health" = "reload";
|
|
86
104
|
private refreshController: AbortController | undefined;
|
|
87
105
|
private disposed = false;
|
|
88
106
|
private spinner: ReturnType<typeof setInterval> | undefined;
|
|
@@ -105,6 +123,7 @@ export class CiStatusDialog {
|
|
|
105
123
|
private readonly deps: CiStatusDialogDeps,
|
|
106
124
|
) {
|
|
107
125
|
this.files = diagnosticFiles(data);
|
|
126
|
+
this.healthRefresh = data.healthRefresh;
|
|
108
127
|
this.selectedFile = this.files[0]?.file;
|
|
109
128
|
this.keybindings = deps.keybindings ?? getKeybindings();
|
|
110
129
|
}
|
|
@@ -179,19 +198,23 @@ export class CiStatusDialog {
|
|
|
179
198
|
return (
|
|
180
199
|
this.handleScrollInput(input) ||
|
|
181
200
|
this.handleFileInput(input) ||
|
|
201
|
+
this.handleDiagnosticActionInput(input) ||
|
|
182
202
|
this.handleShortcutInput(input)
|
|
183
203
|
);
|
|
184
204
|
}
|
|
185
205
|
|
|
206
|
+
private handleDiagnosticActionInput(input: string): boolean {
|
|
207
|
+
if (this.hasConfiguredAction(input)) return false;
|
|
208
|
+
let action: "check" | "health";
|
|
209
|
+
if (input === "c" || matchesKey(input, "f5")) action = "check";
|
|
210
|
+
else if (input === "h" || matchesKey(input, "f6")) action = "health";
|
|
211
|
+
else return false;
|
|
212
|
+
if (!(action === "check" ? this.deps.onCheck : this.deps.onHealth)) return false;
|
|
213
|
+
void this.reload(action);
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
|
|
186
217
|
private handleShortcutInput(input: string): boolean {
|
|
187
|
-
if (
|
|
188
|
-
this.deps.onCheck &&
|
|
189
|
-
(input === "c" || matchesKey(input, "f5")) &&
|
|
190
|
-
!this.hasConfiguredAction(input)
|
|
191
|
-
) {
|
|
192
|
-
void this.reload(true);
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
218
|
if (input === "r" && this.deps.onRefresh) {
|
|
196
219
|
void this.reload();
|
|
197
220
|
return true;
|
|
@@ -292,7 +315,7 @@ export class CiStatusDialog {
|
|
|
292
315
|
this.details = {
|
|
293
316
|
kind: "ready",
|
|
294
317
|
diagnostics: entry?.diagnostics ?? [],
|
|
295
|
-
|
|
318
|
+
evidenceLabel: presentDiagnosticDetails(result.evidence, this.data.workspaceRoot, file),
|
|
296
319
|
};
|
|
297
320
|
} catch (error) {
|
|
298
321
|
if (this.disposed || generation !== this.detailGeneration) return;
|
|
@@ -301,24 +324,30 @@ export class CiStatusDialog {
|
|
|
301
324
|
if (!this.disposed && generation === this.detailGeneration) this.changed();
|
|
302
325
|
}
|
|
303
326
|
|
|
304
|
-
private async reload(check =
|
|
305
|
-
const collect =
|
|
327
|
+
private async reload(action: "reload" | "check" | "health" = "reload"): Promise<void> {
|
|
328
|
+
const collect = {
|
|
329
|
+
check: this.deps.onCheck,
|
|
330
|
+
health: this.deps.onHealth,
|
|
331
|
+
reload: this.deps.onRefresh,
|
|
332
|
+
}[action];
|
|
306
333
|
if (this.refreshing || !collect) return;
|
|
307
334
|
const generation = ++this.refreshGeneration;
|
|
308
335
|
const navigation = this.navigationGeneration;
|
|
309
336
|
this.refreshController = new AbortController();
|
|
310
|
-
this.refreshAction =
|
|
337
|
+
this.refreshAction = action;
|
|
311
338
|
this.refreshing = true;
|
|
312
339
|
this.refreshError = undefined;
|
|
340
|
+
this.healthRefresh = undefined;
|
|
313
341
|
this.collapse();
|
|
314
342
|
this.changed();
|
|
315
343
|
try {
|
|
316
344
|
const data = await collect(this.refreshController.signal);
|
|
317
345
|
if (this.disposed || generation !== this.refreshGeneration) return;
|
|
318
|
-
this.acceptSnapshot(data, check && navigation === this.navigationGeneration);
|
|
346
|
+
this.acceptSnapshot(data, action === "check" && navigation === this.navigationGeneration);
|
|
319
347
|
} catch (error) {
|
|
320
348
|
if (this.disposed || generation !== this.refreshGeneration) return;
|
|
321
349
|
this.refreshError = errorText(error);
|
|
350
|
+
if (error instanceof CiHealthRefreshError) this.healthRefresh = error.healthRefresh;
|
|
322
351
|
}
|
|
323
352
|
if (!this.disposed && generation === this.refreshGeneration) {
|
|
324
353
|
this.refreshing = false;
|
|
@@ -329,6 +358,7 @@ export class CiStatusDialog {
|
|
|
329
358
|
|
|
330
359
|
private acceptSnapshot(data: CiStatusData, check: boolean): void {
|
|
331
360
|
this.data = data;
|
|
361
|
+
this.healthRefresh = data.healthRefresh;
|
|
332
362
|
this.files = diagnosticFiles(data);
|
|
333
363
|
if (!this.files.some((entry) => entry.file === this.selectedFile))
|
|
334
364
|
this.selectedFile = this.files[0]?.file;
|
|
@@ -399,10 +429,7 @@ export class CiStatusDialog {
|
|
|
399
429
|
counts.unavailable ? t.fg("warning", `${counts.unavailable} routes unavailable`) : "",
|
|
400
430
|
this.data.diagnostics.kind === "partial" ? t.fg("warning", "partial snapshot") : "",
|
|
401
431
|
this.refreshing
|
|
402
|
-
? t.fg(
|
|
403
|
-
"accent",
|
|
404
|
-
`${this.frame()} ${this.refreshAction === "check" ? "checking" : "reloading"}…`,
|
|
405
|
-
)
|
|
432
|
+
? t.fg("accent", `${this.frame()} ${ACTION_LABELS[this.refreshAction].progress}…`)
|
|
406
433
|
: "",
|
|
407
434
|
]
|
|
408
435
|
.filter(Boolean)
|
|
@@ -417,6 +444,11 @@ export class CiStatusDialog {
|
|
|
417
444
|
heading("Capabilities");
|
|
418
445
|
this.addCapabilities(text);
|
|
419
446
|
body.addChild(new Spacer(1));
|
|
447
|
+
if (this.healthRefresh) {
|
|
448
|
+
heading("Health action outcome");
|
|
449
|
+
for (const line of this.healthRefresh) text(` ${line}`);
|
|
450
|
+
body.addChild(new Spacer(1));
|
|
451
|
+
}
|
|
420
452
|
heading("Diagnostic files · tracked-file snapshot (not a workspace-wide check)");
|
|
421
453
|
this.addProblems(body, width, text);
|
|
422
454
|
body.addChild(new Spacer(1));
|
|
@@ -480,11 +512,7 @@ export class CiStatusDialog {
|
|
|
480
512
|
).replaceAll("\\", "/");
|
|
481
513
|
const counts = problemCounts(entry);
|
|
482
514
|
const status =
|
|
483
|
-
entry.status === "confirmed" &&
|
|
484
|
-
? counts
|
|
485
|
-
? ""
|
|
486
|
-
: "no errors or warnings (confirmed)"
|
|
487
|
-
: entry.status;
|
|
515
|
+
entry.status === "confirmed" && !counts ? "no errors or warnings (confirmed)" : entry.status;
|
|
488
516
|
text(`${indicator} ${label} ${[counts, status, entry.reason].filter(Boolean).join(" · ")}`);
|
|
489
517
|
if (entry.file === this.selectedFile)
|
|
490
518
|
this.expandedRows = body.render(width).length - this.selectedRow;
|
|
@@ -521,29 +549,10 @@ export class CiStatusDialog {
|
|
|
521
549
|
}
|
|
522
550
|
|
|
523
551
|
private addDiagnosticEvidence(text: (value: string) => void): void {
|
|
524
|
-
const
|
|
552
|
+
const presentation = presentDiagnosticEvidence(this.data.diagnostics);
|
|
525
553
|
const t = this.deps.theme;
|
|
526
|
-
if (
|
|
527
|
-
|
|
528
|
-
text(
|
|
529
|
-
t.fg(
|
|
530
|
-
"dim",
|
|
531
|
-
` ${evidence.confirmed}/${evidence.requested} confirmed tracked files · ${evidence.unconfirmed} unconfirmed · ${evidence.failed} failed · ${evidence.removed} removed`,
|
|
532
|
-
),
|
|
533
|
-
);
|
|
534
|
-
if (observation.kind === "unavailable")
|
|
535
|
-
text(t.fg("warning", ` diagnostics unavailable — ${observation.reason}`));
|
|
536
|
-
else if (observation.kind === "partial")
|
|
537
|
-
text(t.fg("warning", ` diagnostic snapshot is stale or incomplete — ${observation.reason}`));
|
|
538
|
-
else if (evidence.confirmed === 0)
|
|
539
|
-
text(
|
|
540
|
-
t.fg(
|
|
541
|
-
"dim",
|
|
542
|
-
` No confirmed tracked files; an empty result does not establish a clean workspace.${this.deps.onCheck ? ` Use ${this.checkShortcut()?.label ?? "the check action"} to check diagnostics.` : ""}`,
|
|
543
|
-
),
|
|
544
|
-
);
|
|
545
|
-
else if (!observation.entries.length)
|
|
546
|
-
text(t.fg("success", ` ✓ no issues in ${evidence.confirmed} confirmed tracked files`));
|
|
554
|
+
if (presentation.counts) text(t.fg("dim", ` ${presentation.counts}`));
|
|
555
|
+
text(t.fg(presentation.tone, ` ${presentation.summary}`));
|
|
547
556
|
}
|
|
548
557
|
|
|
549
558
|
private addDetails(text: (value: string) => void): void {
|
|
@@ -558,7 +567,7 @@ export class CiStatusDialog {
|
|
|
558
567
|
text(t.fg("error", ` Details unavailable: ${details.message}`));
|
|
559
568
|
return;
|
|
560
569
|
}
|
|
561
|
-
|
|
570
|
+
text(t.fg("dim", ` Details: ${details.evidenceLabel}`));
|
|
562
571
|
if (!details.diagnostics.length)
|
|
563
572
|
text(t.fg("dim", " No error or warning messages in this snapshot"));
|
|
564
573
|
for (const diagnostic of details.diagnostics.slice(0, MAX_INLINE_MESSAGES)) {
|
|
@@ -633,8 +642,17 @@ export class CiStatusDialog {
|
|
|
633
642
|
).find(({ input }) => !this.hasConfiguredAction(input));
|
|
634
643
|
}
|
|
635
644
|
|
|
645
|
+
private healthShortcut() {
|
|
646
|
+
return (
|
|
647
|
+
[
|
|
648
|
+
{ input: "h", label: "h" },
|
|
649
|
+
{ input: "\x1b[17~", label: "F6" },
|
|
650
|
+
] as const
|
|
651
|
+
).find(({ input }) => !this.hasConfiguredAction(input));
|
|
652
|
+
}
|
|
653
|
+
|
|
636
654
|
private refreshFailure(): string {
|
|
637
|
-
return `${this.refreshAction
|
|
655
|
+
return `${ACTION_LABELS[this.refreshAction].name} failed: ${this.refreshError}`;
|
|
638
656
|
}
|
|
639
657
|
|
|
640
658
|
private controlHints(): string {
|
|
@@ -642,6 +660,7 @@ export class CiStatusDialog {
|
|
|
642
660
|
return [
|
|
643
661
|
`${this.keyLabel("tui.select.cancel")} close`,
|
|
644
662
|
this.deps.onCheck ? `${checkKey?.label ?? "unbound"} check` : "",
|
|
663
|
+
this.deps.onHealth ? `${this.healthShortcut()?.label ?? "unbound"} Refresh health` : "",
|
|
645
664
|
`${this.keyLabel("tui.select.confirm")} expand`,
|
|
646
665
|
this.deps.onRefresh && !this.hasConfiguredAction("r") ? "r reload" : "",
|
|
647
666
|
!this.hasConfiguredAction("a") ? "a collapse" : "",
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import type { DiagnosticEvidenceSummary } from "@mrclrchtr/supi-lsp/api";
|
|
3
|
+
import type {
|
|
4
|
+
HealthDiagnosticObservation,
|
|
5
|
+
HealthWorkflowOutcome,
|
|
6
|
+
} from "../session/health-types.ts";
|
|
7
|
+
import { displayHealthPaths } from "../tool/code_health/display-paths.ts";
|
|
8
|
+
import {
|
|
9
|
+
formatProcessCrashRecovery,
|
|
10
|
+
formatSourceTracking,
|
|
11
|
+
formatStartupRetry,
|
|
12
|
+
} from "../tool/code_health/refresh-outcome.ts";
|
|
13
|
+
|
|
14
|
+
/** Inspector-only wording derived from existing diagnostic evidence, not cache freshness. */
|
|
15
|
+
export function presentDiagnosticEvidence(observation: HealthDiagnosticObservation): {
|
|
16
|
+
counts?: string;
|
|
17
|
+
summary: string;
|
|
18
|
+
tone: "dim" | "warning" | "success";
|
|
19
|
+
} {
|
|
20
|
+
if (observation.kind === "not-requested")
|
|
21
|
+
return { summary: "Diagnostics not requested.", tone: "dim" };
|
|
22
|
+
const evidence = observation.evidence;
|
|
23
|
+
const counts = `${evidence.confirmed}/${evidence.requested} confirmed tracked files · ${evidence.unconfirmed} unconfirmed · ${evidence.failed} failed · ${evidence.removed} removed`;
|
|
24
|
+
if (observation.kind === "unavailable")
|
|
25
|
+
return { counts, summary: `Diagnostics unavailable — ${observation.reason}`, tone: "warning" };
|
|
26
|
+
if (evidence.requested === 0)
|
|
27
|
+
return { counts, summary: "No tracked diagnostic evidence.", tone: "dim" };
|
|
28
|
+
const confirmed =
|
|
29
|
+
evidence.confirmed === evidence.requested &&
|
|
30
|
+
evidence.unconfirmed === 0 &&
|
|
31
|
+
evidence.failed === 0 &&
|
|
32
|
+
evidence.removed === 0;
|
|
33
|
+
if (!confirmed)
|
|
34
|
+
return {
|
|
35
|
+
counts,
|
|
36
|
+
summary: `Diagnostic evidence is incomplete${observation.kind === "partial" ? ` — ${observation.reason}` : "."}`,
|
|
37
|
+
tone: "warning",
|
|
38
|
+
};
|
|
39
|
+
const problems = observation.entries.some((entry) => entry.errors > 0 || entry.warnings > 0);
|
|
40
|
+
const files = `${evidence.confirmed} confirmed tracked file${evidence.confirmed === 1 ? "" : "s"}`;
|
|
41
|
+
return {
|
|
42
|
+
counts,
|
|
43
|
+
summary: problems ? `Errors or warnings reported in ${files}.` : `✓ no issues in ${files}`,
|
|
44
|
+
tone: problems ? "warning" : "success",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Select only the expanded file's evidence from the same snapshot as its messages. */
|
|
49
|
+
export function presentDiagnosticDetails(
|
|
50
|
+
evidence: DiagnosticEvidenceSummary,
|
|
51
|
+
cwd: string,
|
|
52
|
+
file: string,
|
|
53
|
+
): string {
|
|
54
|
+
const document = evidence.documents.find(
|
|
55
|
+
(entry) => resolve(cwd, entry.file) === resolve(cwd, file),
|
|
56
|
+
);
|
|
57
|
+
return document?.status ?? "unconfirmed — no file-specific confirmation evidence";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A failed collection retains action facts separately from the previous coherent evidence view. */
|
|
61
|
+
export class CiHealthRefreshError extends Error {
|
|
62
|
+
readonly healthRefresh: readonly string[] | undefined;
|
|
63
|
+
|
|
64
|
+
constructor(
|
|
65
|
+
stage: string,
|
|
66
|
+
options: { cause: unknown; elapsedMs: number; healthRefresh?: readonly string[] },
|
|
67
|
+
) {
|
|
68
|
+
const reason = options.cause instanceof Error ? options.cause.message : String(options.cause);
|
|
69
|
+
const elapsed = (Math.max(0, options.elapsedMs) / 1_000).toFixed(1);
|
|
70
|
+
super(`${stage}: ${reason} (${elapsed}s elapsed; previous view retained)`, options);
|
|
71
|
+
this.healthRefresh = options.healthRefresh;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Present this interaction's action outcome without retaining its diagnostic evidence or history. */
|
|
76
|
+
export function presentHealthRefresh(
|
|
77
|
+
outcome: HealthWorkflowOutcome,
|
|
78
|
+
elapsedMs: number,
|
|
79
|
+
cwd: string,
|
|
80
|
+
): string[] {
|
|
81
|
+
const elapsed = `${(Math.max(0, elapsedMs) / 1_000).toFixed(1)}s`;
|
|
82
|
+
const prefix = "Refresh health";
|
|
83
|
+
if (outcome.kind !== "completed")
|
|
84
|
+
return [
|
|
85
|
+
`${prefix}: ${outcome.kind === "unavailable" ? "unavailable" : "failed"} (${elapsed}) — ${outcome.kind === "unavailable" ? outcome.reason : outcome.message}`,
|
|
86
|
+
];
|
|
87
|
+
const attempt = displayHealthPaths(outcome.data, cwd).refresh;
|
|
88
|
+
const status =
|
|
89
|
+
attempt.kind === "completed"
|
|
90
|
+
? "completed"
|
|
91
|
+
: attempt.kind === "failed"
|
|
92
|
+
? "failed"
|
|
93
|
+
: "unavailable";
|
|
94
|
+
return [
|
|
95
|
+
`${prefix}: ${status} (${elapsed})${"reason" in attempt ? ` — ${attempt.reason}` : ""}`,
|
|
96
|
+
"Action completion is not diagnostic confirmation.",
|
|
97
|
+
...(attempt.kind === "completed" || attempt.kind === "failed"
|
|
98
|
+
? [
|
|
99
|
+
formatProcessCrashRecovery(attempt.processCrashRecovery),
|
|
100
|
+
formatStartupRetry(attempt.startupRetry),
|
|
101
|
+
attempt.restartedClients
|
|
102
|
+
? `${attempt.restartedClients} diagnostic recovery client(s) restarted`
|
|
103
|
+
: null,
|
|
104
|
+
formatSourceTracking(attempt.sourceTracking),
|
|
105
|
+
].filter((line): line is string => line !== null)
|
|
106
|
+
: []),
|
|
107
|
+
];
|
|
108
|
+
}
|
package/src/ui/tui/common.ts
CHANGED
|
@@ -310,13 +310,13 @@ export function buildSimpleCompact(data: Record<string, unknown> | undefined, th
|
|
|
310
310
|
const confidence = typeof data.confidence === "string" ? data.confidence : "";
|
|
311
311
|
const dot = theme.fg("dim", "·");
|
|
312
312
|
const segments = badges.map((badge) => theme.fg("success", theme.bold(badge)));
|
|
313
|
-
const
|
|
313
|
+
const unknownLevelCount = data.outlineUnknownLevelCount;
|
|
314
314
|
if (
|
|
315
|
-
typeof
|
|
316
|
-
Number.isInteger(
|
|
317
|
-
|
|
315
|
+
typeof unknownLevelCount === "number" &&
|
|
316
|
+
Number.isInteger(unknownLevelCount) &&
|
|
317
|
+
unknownLevelCount > 0
|
|
318
318
|
) {
|
|
319
|
-
segments.push(theme.fg("warning", `${
|
|
319
|
+
segments.push(theme.fg("warning", `${unknownLevelCount} position unknown`));
|
|
320
320
|
}
|
|
321
321
|
if (confidence) {
|
|
322
322
|
segments.push(`${theme.fg("dim", "confidence")} ${theme.fg("muted", confidence)}`);
|
|
@@ -349,13 +349,13 @@ function structuredDetailLines(data: Record<string, unknown>): string[] {
|
|
|
349
349
|
|
|
350
350
|
lines.push(...inspectSectionStatusLines(data.sections));
|
|
351
351
|
|
|
352
|
-
const
|
|
352
|
+
const unknownLevelCount = data.outlineUnknownLevelCount;
|
|
353
353
|
if (
|
|
354
|
-
typeof
|
|
355
|
-
Number.isInteger(
|
|
356
|
-
|
|
354
|
+
typeof unknownLevelCount === "number" &&
|
|
355
|
+
Number.isInteger(unknownLevelCount) &&
|
|
356
|
+
unknownLevelCount > 0
|
|
357
357
|
) {
|
|
358
|
-
lines.push(`
|
|
358
|
+
lines.push(`position unknown: ${unknownLevelCount}`);
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
const checkNext = data.checkNext;
|