summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/hooks/state.ts
diff options
context:
space:
mode:
authorMorgan Lunt <morganl@anthropic.com>2026-09-24 20:52:27 -0700
committerMorgan Lunt <morganl@anthropic.com>2026-09-24 20:52:27 -0700
commit51b1ae9e20486d62b839ed9f37e1cfc7d55bf85c (patch)
treeeb31cc4964d84b4a82b8032452739fe1e9b37d3f /plugins/code-modernization/hooks/state.ts
parent5b8ec4b30f45b5e8b4c8a6efd63719730cf1a5ad (diff)
code-modernization: make the live pane work below 144 columns and show the proof
Found by exercising the pane against the real outputs of finished runs: - Below 144 columns the engine holds an unasked pane back; the pane ignored that, so it drew no pane, no show bar, and the panel command "hid" a pane that was never there. - A symlinked legacy/<name> lists as another kind of entry, so the source link that preflight now creates was never recognized as a system. - Uplift and reimagine next steps were placeholders with no button. - The refresh debounce was starved while agents ran, so the map froze. - Hostile lines in the brief, rules and baseline could take seconds to match; lines are now capped. The rule-review ledger is validated on read and merged on save, and keeps a reviewer's note. - A baseline with no row read as "the baseline had 0"; one-module baseline totals now count as that module's row. New: a verdict chip with words on every built module, a verify-first next step, and a readable palette that follows the terminal theme. 140 engine tests pass and the type check is clean.
Diffstat (limited to 'plugins/code-modernization/hooks/state.ts')
-rw-r--r--plugins/code-modernization/hooks/state.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/code-modernization/hooks/state.ts b/plugins/code-modernization/hooks/state.ts
index 2ce9b3f8..5fbf71cc 100644
--- a/plugins/code-modernization/hooks/state.ts
+++ b/plugins/code-modernization/hooks/state.ts
@@ -70,10 +70,6 @@ export type Activity = {
step: string | null
running: Map<string, RunningCall>
finished: FinishedCall[]
- /** Milliseconds the main loop spent in tool calls, and in those that ran tests. */
- toolMs: number
- testMs: number
- testRuns: number
xrays: number
xraysThisTurn: number
}
@@ -85,6 +81,11 @@ export type DeckState = {
queue: Rule[]
index: number
ledger: ReviewLedger
+ /**
+ * What this session set each rule to (null: its verdict taken back). The file is read again before it is written, and
+ * these are laid on top of it, so a verdict the other writer (the review command) put there meanwhile is not lost.
+ */
+ edits: Map<string, ReviewLedger[string] | null>
/** The source lines of the card in view, once asked for. */
source: { ruleId: string; path: string; startLine: number; text: string } | null
isSourceShown: boolean
@@ -110,7 +111,10 @@ export type State = {
isRefreshQueued: boolean
timers: Map<string, Timer>
pane: {
+ /** Open and drawn. An open the engine holds back (unasked, on a terminal too narrow to dock a pane) is not this. */
isOpen: boolean
+ /** The engine holds the pane undrawn until the person asks for it or the terminal widens. */
+ isWaiting: boolean
isClosedByPerson: boolean
bodyColumns: number
bodyRows: number
@@ -137,9 +141,6 @@ export const newActivity = (): Activity => ({
step: null,
running: new Map(),
finished: [],
- toolMs: 0,
- testMs: 0,
- testRuns: 0,
xrays: 0,
xraysThisTurn: 0,
})
@@ -156,7 +157,7 @@ export function newState(raw: PluginOptions): State {
isRefreshing: false,
isRefreshQueued: false,
timers: new Map(),
- pane: { isOpen: false, isClosedByPerson: false, bodyColumns: 48, bodyRows: 30, placement: 'dock' },
+ pane: { isOpen: false, isWaiting: false, isClosedByPerson: false, bodyColumns: 48, bodyRows: 30, placement: 'dock' },
viewport: { columns: null, isFullscreen: null },
activity: newActivity(),
touches: new Map(),
@@ -171,6 +172,7 @@ export function newState(raw: PluginOptions): State {
queue: [],
index: 0,
ledger: {},
+ edits: new Map(),
source: null,
isSourceShown: false,
},