@cortexkit/aft-opencode 0.50.3 → 0.51.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/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +386 -154
- package/dist/shared/status.d.ts +15 -18
- package/dist/shared/status.d.ts.map +1 -1
- package/dist/tools/_shared.d.ts.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/inspect.d.ts +28 -0
- package/dist/tools/inspect.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/shared/status.ts +79 -50
- package/src/tui/index.tsx +55 -45
- package/src/tui/sidebar.tsx +79 -55
- package/src/tui-compiled/index.tsx +87 -69
- package/src/tui-compiled/sidebar.tsx +102 -84
- package/dist/status-bar-inject.d.ts +0 -11
- package/dist/status-bar-inject.d.ts.map +0 -1
package/dist/shared/status.d.ts
CHANGED
|
@@ -9,21 +9,18 @@ export interface StatusCompression {
|
|
|
9
9
|
session: StatusCompressionAggregate;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* from the last completed background scan. `tier2_stale` marks those Tier-2
|
|
16
|
-
* counts as predating the latest edit. Null in the snapshot until the Tier-2
|
|
17
|
-
* cache is populated at least once (no fabricated zeros).
|
|
12
|
+
* Human health categories from the status snapshot. Each category is optional:
|
|
13
|
+
* a missing value was not proven, so renderers must omit it instead of treating
|
|
14
|
+
* absence as a clean zero.
|
|
18
15
|
*/
|
|
19
16
|
export interface StatusBar {
|
|
20
|
-
errors
|
|
21
|
-
warnings
|
|
22
|
-
dead_code
|
|
23
|
-
unused_exports
|
|
24
|
-
duplicates
|
|
25
|
-
todos
|
|
26
|
-
tier2_stale
|
|
17
|
+
errors?: number;
|
|
18
|
+
warnings?: number;
|
|
19
|
+
dead_code?: number;
|
|
20
|
+
unused_exports?: number;
|
|
21
|
+
duplicates?: number;
|
|
22
|
+
todos?: number;
|
|
23
|
+
tier2_stale?: boolean;
|
|
27
24
|
}
|
|
28
25
|
export interface AftStatusSnapshot {
|
|
29
26
|
version: string;
|
|
@@ -92,11 +89,7 @@ export interface AftStatusSnapshot {
|
|
|
92
89
|
};
|
|
93
90
|
/** Compression aggregate passthrough; rendering is added separately. */
|
|
94
91
|
compression?: StatusCompression;
|
|
95
|
-
/**
|
|
96
|
-
* Agent status-bar counts (E/W/D/U/C/T). Undefined until the Tier-2 cache
|
|
97
|
-
* is populated at least once — the sidebar hides the Code Health section
|
|
98
|
-
* until then so it never shows fabricated zeros.
|
|
99
|
-
*/
|
|
92
|
+
/** Human health counts. Each unproven category stays absent rather than zero. */
|
|
100
93
|
status_bar?: StatusBar;
|
|
101
94
|
/**
|
|
102
95
|
* Human-readable explanation for a synthetic snapshot (e.g.
|
|
@@ -107,6 +100,10 @@ export interface AftStatusSnapshot {
|
|
|
107
100
|
*/
|
|
108
101
|
message: string;
|
|
109
102
|
}
|
|
103
|
+
/** Neutral label for cache_role. Worktree/read_only borrow the shared repo index; they are not a failure. */
|
|
104
|
+
export declare function formatCacheRoleLabel(role: string): string;
|
|
105
|
+
/** One-liner for the sidebar. Worktree mode only; other roles stay silent. */
|
|
106
|
+
export declare function worktreeCacheRoleNote(role: string | undefined): string | null;
|
|
110
107
|
export declare function formatSemanticIndexStatus(status: string, stage?: string | null): string;
|
|
111
108
|
export declare function formatSemanticRefreshing(refreshingCount: number): string | null;
|
|
112
109
|
export declare function formatBytes(bytes: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/shared/status.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM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AAC,EAAE,iBAAiB,CAAC;IAChC,iFAAiF;IACjF,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAmFD,6GAA6G;AAC7G,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQzD;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAK7E;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAKvF;AAED,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI/E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAajD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CA2EpF;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA2F3E;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA8FtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACf,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACf,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;;;;;;;;;;;;GAcG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAqClC;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CA2BzB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACpC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAMlC"}
|
package/dist/tools/bash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA+DjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,OAAO,EAC5B,aAAa,EAAE,OAAO,EACtB,YAAY,EAAE,OAAO,GACpB,MAAM,CAaR;AAwGD,wBAAgB,cAAc,CAC5B,GAAG,EAAE,aAAa,EAClB,2BAA2B,CAAC,EAAE,OAAO,GACpC,cAAc,CAsQhB;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CA2BvE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,cAAc,CAwBrE"}
|
package/dist/tools/inspect.d.ts
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import type { ToolDefinition } from "@opencode-ai/plugin";
|
|
2
2
|
import type { PluginContext } from "../types.js";
|
|
3
|
+
export type InspectTerminalKind = "FRESH" | "INTERRUPTED" | "PHASE-FAILED";
|
|
4
|
+
/** A completed inspect phase, normalized once for every terminal outcome. */
|
|
5
|
+
export interface InspectPhaseEntry {
|
|
6
|
+
id: string;
|
|
7
|
+
producer?: string;
|
|
8
|
+
category?: string;
|
|
9
|
+
alsoSatisfied: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface InspectTerminal {
|
|
12
|
+
kind: InspectTerminalKind;
|
|
13
|
+
phases: InspectPhaseEntry[];
|
|
14
|
+
waitStampText?: string;
|
|
15
|
+
failedPhase?: InspectPhaseEntry;
|
|
16
|
+
failureReason?: string;
|
|
17
|
+
failureDetail?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parse phase entries shared by all terminal outcomes. If also_satisfied is
|
|
21
|
+
* omitted, store it as an empty list so callers can always treat it as a list.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseInspectPhaseEntries(value: unknown): InspectPhaseEntry[];
|
|
24
|
+
/**
|
|
25
|
+
* Use the same phase parser for every terminal outcome. Alternate discriminator
|
|
26
|
+
* spellings keep older payload encodings compatible with the canonical shape.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseInspectTerminal(payload: unknown): InspectTerminal | undefined;
|
|
29
|
+
/** Render every taxonomy field instead of reducing non-fresh terminals to an error. */
|
|
30
|
+
export declare function renderInspectTerminal(terminal: InspectTerminal, serverText?: string): string;
|
|
3
31
|
export interface InspectToolConfig {
|
|
4
32
|
tool_surface?: "minimal" | "recommended" | "all";
|
|
5
33
|
disabled_tools?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/tools/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../src/tools/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,aAAa,GAAG,cAAc,CAAC;AAE3E,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA2ED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,EAAE,CAmB5E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAwDlF;AAaD,uF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
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Agent File Tools (AFT) — tree-sitter and lsp powered code analysis",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@clack/prompts": "^1.6.0",
|
|
37
|
-
"@cortexkit/aft-bridge": "0.
|
|
37
|
+
"@cortexkit/aft-bridge": "0.51.0",
|
|
38
38
|
"@opentui/core": "0.4.3",
|
|
39
39
|
"@opentui/solid": "0.4.3",
|
|
40
40
|
"comment-json": "^4.6.2",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"zod": "^4.4.3"
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
47
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
48
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
49
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
50
|
-
"@cortexkit/aft-win32-arm64": "0.
|
|
51
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
46
|
+
"@cortexkit/aft-darwin-arm64": "0.51.0",
|
|
47
|
+
"@cortexkit/aft-darwin-x64": "0.51.0",
|
|
48
|
+
"@cortexkit/aft-linux-arm64": "0.51.0",
|
|
49
|
+
"@cortexkit/aft-linux-x64": "0.51.0",
|
|
50
|
+
"@cortexkit/aft-win32-arm64": "0.51.0",
|
|
51
|
+
"@cortexkit/aft-win32-x64": "0.51.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@opencode-ai/plugin": "^1.17.11",
|
package/src/shared/status.ts
CHANGED
|
@@ -11,21 +11,18 @@ export interface StatusCompression {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* from the last completed background scan. `tier2_stale` marks those Tier-2
|
|
18
|
-
* counts as predating the latest edit. Null in the snapshot until the Tier-2
|
|
19
|
-
* cache is populated at least once (no fabricated zeros).
|
|
14
|
+
* Human health categories from the status snapshot. Each category is optional:
|
|
15
|
+
* a missing value was not proven, so renderers must omit it instead of treating
|
|
16
|
+
* absence as a clean zero.
|
|
20
17
|
*/
|
|
21
18
|
export interface StatusBar {
|
|
22
|
-
errors
|
|
23
|
-
warnings
|
|
24
|
-
dead_code
|
|
25
|
-
unused_exports
|
|
26
|
-
duplicates
|
|
27
|
-
todos
|
|
28
|
-
tier2_stale
|
|
19
|
+
errors?: number;
|
|
20
|
+
warnings?: number;
|
|
21
|
+
dead_code?: number;
|
|
22
|
+
unused_exports?: number;
|
|
23
|
+
duplicates?: number;
|
|
24
|
+
todos?: number;
|
|
25
|
+
tier2_stale?: boolean;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
export interface AftStatusSnapshot {
|
|
@@ -95,11 +92,7 @@ export interface AftStatusSnapshot {
|
|
|
95
92
|
};
|
|
96
93
|
/** Compression aggregate passthrough; rendering is added separately. */
|
|
97
94
|
compression?: StatusCompression;
|
|
98
|
-
/**
|
|
99
|
-
* Agent status-bar counts (E/W/D/U/C/T). Undefined until the Tier-2 cache
|
|
100
|
-
* is populated at least once — the sidebar hides the Code Health section
|
|
101
|
-
* until then so it never shows fabricated zeros.
|
|
102
|
-
*/
|
|
95
|
+
/** Human health counts. Each unproven category stays absent rather than zero. */
|
|
103
96
|
status_bar?: StatusBar;
|
|
104
97
|
/**
|
|
105
98
|
* Human-readable explanation for a synthetic snapshot (e.g.
|
|
@@ -155,19 +148,32 @@ function readCompression(value: unknown): StatusCompression | undefined {
|
|
|
155
148
|
}
|
|
156
149
|
|
|
157
150
|
function readStatusBar(value: unknown): StatusBar | undefined {
|
|
158
|
-
// Null until Tier-2 is populated — the Rust snapshot emits JSON null, which
|
|
159
|
-
// is not an object, so this returns undefined and the sidebar hides the
|
|
160
|
-
// Code Health section (no fabricated zeros).
|
|
161
151
|
if (typeof value !== "object" || value === null) return undefined;
|
|
162
152
|
const bar = asRecord(value);
|
|
153
|
+
const errors = readOptionalNumber(bar.errors);
|
|
154
|
+
const warnings = readOptionalNumber(bar.warnings);
|
|
155
|
+
const deadCode = readOptionalNumber(bar.dead_code);
|
|
156
|
+
const unusedExports = readOptionalNumber(bar.unused_exports);
|
|
157
|
+
const duplicates = readOptionalNumber(bar.duplicates);
|
|
158
|
+
const todos = readOptionalNumber(bar.todos);
|
|
159
|
+
if (
|
|
160
|
+
errors === null &&
|
|
161
|
+
warnings === null &&
|
|
162
|
+
deadCode === null &&
|
|
163
|
+
unusedExports === null &&
|
|
164
|
+
duplicates === null &&
|
|
165
|
+
todos === null
|
|
166
|
+
) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
163
169
|
return {
|
|
164
|
-
errors:
|
|
165
|
-
warnings:
|
|
166
|
-
dead_code:
|
|
167
|
-
unused_exports:
|
|
168
|
-
duplicates:
|
|
169
|
-
todos:
|
|
170
|
-
|
|
170
|
+
...(errors !== null ? { errors } : {}),
|
|
171
|
+
...(warnings !== null ? { warnings } : {}),
|
|
172
|
+
...(deadCode !== null ? { dead_code: deadCode } : {}),
|
|
173
|
+
...(unusedExports !== null ? { unused_exports: unusedExports } : {}),
|
|
174
|
+
...(duplicates !== null ? { duplicates } : {}),
|
|
175
|
+
...(todos !== null ? { todos } : {}),
|
|
176
|
+
...(bar.tier2_stale === true ? { tier2_stale: true } : {}),
|
|
171
177
|
};
|
|
172
178
|
}
|
|
173
179
|
|
|
@@ -179,6 +185,25 @@ function formatCount(value: number | null): string {
|
|
|
179
185
|
return value == null ? "—" : value.toLocaleString("en-US");
|
|
180
186
|
}
|
|
181
187
|
|
|
188
|
+
/** Neutral label for cache_role. Worktree/read_only borrow the shared repo index; they are not a failure. */
|
|
189
|
+
export function formatCacheRoleLabel(role: string): string {
|
|
190
|
+
if (role === "worktree") {
|
|
191
|
+
return "worktree — shared repo index (built by the main checkout)";
|
|
192
|
+
}
|
|
193
|
+
if (role === "read_only") {
|
|
194
|
+
return "read_only — sharing the repo index family (read-only borrow)";
|
|
195
|
+
}
|
|
196
|
+
return role;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** One-liner for the sidebar. Worktree mode only; other roles stay silent. */
|
|
200
|
+
export function worktreeCacheRoleNote(role: string | undefined): string | null {
|
|
201
|
+
if (role === "worktree") {
|
|
202
|
+
return "shared repo index (built by the main checkout)";
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
|
|
182
207
|
export function formatSemanticIndexStatus(status: string, stage?: string | null): string {
|
|
183
208
|
if ((status === "loading" || status === "building") && stage === "fingerprint_change") {
|
|
184
209
|
return "Rebuilding (model changed)";
|
|
@@ -296,7 +321,7 @@ export function formatStatusDialogMessage(status: AftStatusSnapshot): string {
|
|
|
296
321
|
`AFT version: ${status.version}`,
|
|
297
322
|
`Project root: ${status.project_root ?? "(not configured)"}`,
|
|
298
323
|
`Canonical root: ${status.canonical_root ?? "(not configured)"}`,
|
|
299
|
-
`Cache role: ${status.cache_role}`,
|
|
324
|
+
`Cache role: ${formatCacheRoleLabel(status.cache_role)}`,
|
|
300
325
|
"",
|
|
301
326
|
"Enabled features",
|
|
302
327
|
`- format_on_edit: ${formatFlag(status.features.format_on_edit)}`,
|
|
@@ -343,16 +368,18 @@ export function formatStatusDialogMessage(status: AftStatusSnapshot): string {
|
|
|
343
368
|
|
|
344
369
|
if (status.status_bar) {
|
|
345
370
|
const sb = status.status_bar;
|
|
346
|
-
|
|
347
|
-
"",
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
371
|
+
const rows = [
|
|
372
|
+
["errors", sb.errors],
|
|
373
|
+
["warnings", sb.warnings],
|
|
374
|
+
["dead code", sb.dead_code],
|
|
375
|
+
["unused exports", sb.unused_exports],
|
|
376
|
+
["duplicates", sb.duplicates],
|
|
377
|
+
["todos", sb.todos],
|
|
378
|
+
].filter((row): row is [string, number] => typeof row[1] === "number");
|
|
379
|
+
if (rows.length > 0) {
|
|
380
|
+
lines.push("", `Code Health${sb.tier2_stale ? " (~ stale)" : ""}`);
|
|
381
|
+
for (const [label, value] of rows) lines.push(`- ${label}: ${formatCount(value)}`);
|
|
382
|
+
}
|
|
356
383
|
}
|
|
357
384
|
|
|
358
385
|
lines.push(
|
|
@@ -389,7 +416,7 @@ export function formatStatusMarkdown(status: AftStatusSnapshot): string {
|
|
|
389
416
|
`- **Version:** \`${status.version}\``,
|
|
390
417
|
`- **Project root:** \`${status.project_root ?? "(not configured)"}\``,
|
|
391
418
|
`- **Canonical root:** \`${status.canonical_root ?? "(not configured)"}\``,
|
|
392
|
-
`- **Cache role:** \`${status.cache_role}\``,
|
|
419
|
+
`- **Cache role:** \`${formatCacheRoleLabel(status.cache_role)}\``,
|
|
393
420
|
"",
|
|
394
421
|
"### Enabled features",
|
|
395
422
|
`- \`format_on_edit\`: ${formatFlag(status.features.format_on_edit)}`,
|
|
@@ -452,16 +479,18 @@ export function formatStatusMarkdown(status: AftStatusSnapshot): string {
|
|
|
452
479
|
|
|
453
480
|
if (status.status_bar) {
|
|
454
481
|
const sb = status.status_bar;
|
|
455
|
-
|
|
456
|
-
"",
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
482
|
+
const rows = [
|
|
483
|
+
["Errors", sb.errors],
|
|
484
|
+
["Warnings", sb.warnings],
|
|
485
|
+
["Dead code", sb.dead_code],
|
|
486
|
+
["Unused exports", sb.unused_exports],
|
|
487
|
+
["Duplicates", sb.duplicates],
|
|
488
|
+
["TODOs", sb.todos],
|
|
489
|
+
].filter((row): row is [string, number] => typeof row[1] === "number");
|
|
490
|
+
if (rows.length > 0) {
|
|
491
|
+
lines.push("", `### Code Health${sb.tier2_stale ? " (~ stale)" : ""}`);
|
|
492
|
+
for (const [label, value] of rows) lines.push(`- **${label}:** ${formatCount(value)}`);
|
|
493
|
+
}
|
|
465
494
|
}
|
|
466
495
|
|
|
467
496
|
lines.push(
|
package/src/tui/index.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type AftStatusSnapshot,
|
|
11
11
|
coerceAftStatus,
|
|
12
12
|
formatBytes,
|
|
13
|
+
formatCacheRoleLabel,
|
|
13
14
|
formatSemanticIndexStatus,
|
|
14
15
|
formatSemanticRefreshing,
|
|
15
16
|
} from "../shared/status";
|
|
@@ -218,10 +219,10 @@ const StatusDialog = (props: StatusDialogProps) => {
|
|
|
218
219
|
}
|
|
219
220
|
});
|
|
220
221
|
|
|
221
|
-
// Visual cache-role badge: main is accent
|
|
222
|
-
//
|
|
222
|
+
// Visual cache-role badge: main is accent. Worktree/read_only borrow the
|
|
223
|
+
// shared repo index — muted, not warning, so it is not read as a failure.
|
|
223
224
|
const cacheRoleTone = (role: string): "accent" | "warn" | "muted" =>
|
|
224
|
-
role === "main" ? "accent" :
|
|
225
|
+
role === "main" ? "accent" : "muted";
|
|
225
226
|
// Reuse the sidebar's label/value formatter so the dialog and sidebar
|
|
226
227
|
// render identical text (e.g. "Session" / "-174,489 tokens, 59% reduction").
|
|
227
228
|
// The earlier `formatCompressionDialogRows` returned padded strings that
|
|
@@ -286,7 +287,7 @@ const StatusDialog = (props: StatusDialogProps) => {
|
|
|
286
287
|
<R
|
|
287
288
|
theme={t()}
|
|
288
289
|
label="Cache role"
|
|
289
|
-
value={status()!.cache_role}
|
|
290
|
+
value={formatCacheRoleLabel(status()!.cache_role)}
|
|
290
291
|
tone={cacheRoleTone(status()!.cache_role)}
|
|
291
292
|
/>
|
|
292
293
|
</box>
|
|
@@ -487,52 +488,61 @@ const StatusDialog = (props: StatusDialogProps) => {
|
|
|
487
488
|
</box>
|
|
488
489
|
) : null}
|
|
489
490
|
|
|
490
|
-
{/*
|
|
491
|
-
|
|
492
|
-
populated (status_bar undefined) so it never shows fabricated zeros.
|
|
493
|
-
A `~` on the header flags the Tier-2 counts as predating the latest
|
|
494
|
-
edit. */}
|
|
491
|
+
{/* Human health values are optional. Omit a category until the server
|
|
492
|
+
proves it rather than displaying an unproven zero as clean. */}
|
|
495
493
|
{status()?.status_bar ? (
|
|
496
494
|
<box flexDirection="column" width="100%" marginTop={1}>
|
|
497
495
|
<text fg={t().text}>
|
|
498
496
|
<b>{status()!.status_bar!.tier2_stale ? "Code Health ~" : "Code Health"}</b>
|
|
499
497
|
</text>
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
498
|
+
{status()!.status_bar!.errors !== undefined ? (
|
|
499
|
+
<R
|
|
500
|
+
theme={t()}
|
|
501
|
+
label="Errors"
|
|
502
|
+
value={formatCountShort(status()!.status_bar!.errors)}
|
|
503
|
+
tone={status()!.status_bar!.errors! > 0 ? "err" : "muted"}
|
|
504
|
+
/>
|
|
505
|
+
) : null}
|
|
506
|
+
{status()!.status_bar!.warnings !== undefined ? (
|
|
507
|
+
<R
|
|
508
|
+
theme={t()}
|
|
509
|
+
label="Warnings"
|
|
510
|
+
value={formatCountShort(status()!.status_bar!.warnings)}
|
|
511
|
+
tone={status()!.status_bar!.warnings! > 0 ? "warn" : "muted"}
|
|
512
|
+
/>
|
|
513
|
+
) : null}
|
|
514
|
+
{status()!.status_bar!.dead_code !== undefined ? (
|
|
515
|
+
<R
|
|
516
|
+
theme={t()}
|
|
517
|
+
label="Dead Code"
|
|
518
|
+
value={formatCountShort(status()!.status_bar!.dead_code)}
|
|
519
|
+
tone="muted"
|
|
520
|
+
/>
|
|
521
|
+
) : null}
|
|
522
|
+
{status()!.status_bar!.unused_exports !== undefined ? (
|
|
523
|
+
<R
|
|
524
|
+
theme={t()}
|
|
525
|
+
label="Unused Exports"
|
|
526
|
+
value={formatCountShort(status()!.status_bar!.unused_exports)}
|
|
527
|
+
tone="muted"
|
|
528
|
+
/>
|
|
529
|
+
) : null}
|
|
530
|
+
{status()!.status_bar!.duplicates !== undefined ? (
|
|
531
|
+
<R
|
|
532
|
+
theme={t()}
|
|
533
|
+
label="Duplicates"
|
|
534
|
+
value={formatCountShort(status()!.status_bar!.duplicates)}
|
|
535
|
+
tone="muted"
|
|
536
|
+
/>
|
|
537
|
+
) : null}
|
|
538
|
+
{status()!.status_bar!.todos !== undefined ? (
|
|
539
|
+
<R
|
|
540
|
+
theme={t()}
|
|
541
|
+
label="TODOs"
|
|
542
|
+
value={formatCountShort(status()!.status_bar!.todos)}
|
|
543
|
+
tone="muted"
|
|
544
|
+
/>
|
|
545
|
+
) : null}
|
|
536
546
|
</box>
|
|
537
547
|
) : null}
|
|
538
548
|
|