From caac6735d95bddeb8c8bbe3ddc9d6c01787fc8e1 Mon Sep 17 00:00:00 2001 From: Morgan Lunt Date: Thu, 24 Sep 2026 21:07:24 -0700 Subject: code-modernization: pane wording, attention items and docs that match the code The pane's button reads "put in prompt" (it never runs the command), the refresh button is gone (the pane already refreshes after writes, at turn end and every 20 seconds while idle), the summary line fits a 120-column bar, and the next-step reasons are short enough to read. A P0 rule under discussion is listed under Attention ("the build waits"), and a module that is not proven shows its first reason there. In an uplift, finished modules list before merely edited ones. hooks/README.md now names every button and label as the code does, documents the plugin's /code-modernization:modernize-review command (which writes the same ledger for people without the pane) and how it differs from the pane's own /modernize-review, and says which pictures use sample text. 141 engine tests pass and the type check is clean. --- plugins/code-modernization/hooks/views/pane.tsx | 41 +++++++++++++------------ 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'plugins/code-modernization/hooks/views') diff --git a/plugins/code-modernization/hooks/views/pane.tsx b/plugins/code-modernization/hooks/views/pane.tsx index dfc75f87..fe569d3b 100644 --- a/plugins/code-modernization/hooks/views/pane.tsx +++ b/plugins/code-modernization/hooks/views/pane.tsx @@ -19,7 +19,6 @@ export type PaneActions = { /** Follow the workspace's next system, when it holds more than one. */ system: () => void next: () => void - refresh: () => void review: () => void sign: () => void close: () => void @@ -222,13 +221,14 @@ function phases(kit: Kit, snapshot: Snapshot, width: number, max: number): Rende ) } -/** Units of work in the order that helps most: problems first in an uplift, the newest first in a rewrite. */ +/** Units of work in the order that helps most: problems, then finished work first in an uplift; the newest first in a rewrite. */ function orderOf(snapshot: Snapshot): Snapshot['modules'] { if (snapshot.track !== 'uplift') { return [...snapshot.modules].sort((a, b) => b.mtimeMs - a.mtimeMs) } - const rank = (state: string) => (state === 'tests-red' || state === 'tests-failing' ? 0 : state === 'scaffolded' ? 1 : state === 'tests-green' ? 2 : 3) + // Problems first, then what is finished, then what is tested, then what is only edited so far. + const rank = (state: string) => (state === 'tests-red' || state === 'tests-failing' ? 0 : state === 'reviewed' ? 1 : state === 'tests-green' ? 2 : state === 'scaffolded' ? 3 : 4) return [...snapshot.modules].sort((a, b) => rank(a.state) - rank(b.state) || (b.tests?.tests ?? 0) - (a.tests?.tests ?? 0)) } @@ -416,7 +416,6 @@ function buttonsOf(snapshot: Snapshot, state: State): string[] { ...(next?.action === 'sign' ? ['sign the brief'] : []), ...((snapshot.rules?.rules.length ?? 0) > 0 ? ['review rules'] : []), ...(state.activity.isWorking && state.fleet.seen > 0 ? ['stop the run'] : []), - 'refresh', ] } @@ -472,9 +471,11 @@ export function nextRowsOf(snapshot: Snapshot | null, state: State, width: numbe const next = snapshot.next const command = next === null ? 1 : Math.max(1, Math.ceil((next.text.length + (next.isByHand && next.action === undefined ? 12 : 0) + 2) / Math.max(10, width))) - const buttons = Math.max(1, Math.ceil(buttonsOf(snapshot, state).reduce((sum, label) => sum + label.length + 5, 0) / Math.max(10, width + 1))) + const labels = buttonsOf(snapshot, state) + // A blank row and the buttons, when there is any button to press. + const buttons = labels.length === 0 ? 0 : 1 + Math.max(1, Math.ceil(labels.reduce((sum, label) => sum + label.length + 5, 0) / Math.max(10, width + 1))) - return 1 + command + 1 + 1 + buttons + return 1 + command + 1 + buttons } function nextBlock( @@ -488,6 +489,7 @@ function nextBlock( const { Box, Text, Button } = kit const next = snapshot.next const hasRules = (snapshot.rules?.rules.length ?? 0) > 0 + const hasButtons = buttonsOf(snapshot, state).length > 0 return ( @@ -502,18 +504,19 @@ function nextBlock( ) : ( {' nothing to suggest'} )} - - {next !== null && !next.isByHand ? ( - - ) : null} - {next?.action === 'sign' ? : null} - {hasRules ? : null} - {state.activity.isWorking && state.fleet.seen > 0 ? ( - - ) : null} - - - {hasHint ? {clip('click a button, or ctrl+x tab then Tab, Enter', width)} : null} + {hasButtons ? ( + + {next !== null && !next.isByHand ? ( + + ) : null} + {next?.action === 'sign' ? : null} + {hasRules ? : null} + {state.activity.isWorking && state.fleet.seen > 0 ? ( + + ) : null} + + ) : null} + {hasHint && hasButtons ? {clip('click a button, or ctrl+x tab then Tab, Enter', width)} : null} ) } @@ -673,7 +676,7 @@ export function showBar( return ( // The band draws its own `[-]` collapse control at its right edge: leave it room. - {clip(line, Math.max(8, width - 24))} + {clip(line, Math.max(8, width - 20))} ) -- cgit