diff options
| author | Morgan Lunt <morganl@anthropic.com> | 2026-09-24 21:07:24 -0700 |
|---|---|---|
| committer | Morgan Lunt <morganl@anthropic.com> | 2026-09-24 21:07:24 -0700 |
| commit | caac6735d95bddeb8c8bbe3ddc9d6c01787fc8e1 (patch) | |
| tree | 132ff3f8b1404f56f5dd2051ff1c2761064b746c /plugins/code-modernization/hooks/views | |
| parent | d6af0c04d89ad7b0c75e21b8ae7f15585e805b08 (diff) | |
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.
Diffstat (limited to 'plugins/code-modernization/hooks/views')
| -rw-r--r-- | plugins/code-modernization/hooks/views/pane.tsx | 41 |
1 files changed, 22 insertions, 19 deletions
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 ( <Box flexDirection="column"> @@ -502,18 +504,19 @@ function nextBlock( ) : ( <Text dimColor>{' nothing to suggest'}</Text> )} - <Box marginTop={1} flexWrap="wrap" columnGap={1}> - {next !== null && !next.isByHand ? ( - <Button key="next" onPress={actions.next}>put in prompt</Button> - ) : null} - {next?.action === 'sign' ? <Button key="sign" onPress={actions.sign}>sign the brief</Button> : null} - {hasRules ? <Button key="review" onPress={actions.review}>review rules</Button> : null} - {state.activity.isWorking && state.fleet.seen > 0 ? ( - <Button key="stop" onPress={actions.stop}>stop the run</Button> - ) : null} - <Button key="refresh" dimColor onPress={actions.refresh}>refresh</Button> - </Box> - {hasHint ? <Text dimColor wrap="truncate-end">{clip('click a button, or ctrl+x tab then Tab, Enter', width)}</Text> : null} + {hasButtons ? ( + <Box marginTop={1} flexWrap="wrap" columnGap={1}> + {next !== null && !next.isByHand ? ( + <Button key="next" onPress={actions.next}>put in prompt</Button> + ) : null} + {next?.action === 'sign' ? <Button key="sign" onPress={actions.sign}>sign the brief</Button> : null} + {hasRules ? <Button key="review" onPress={actions.review}>review rules</Button> : null} + {state.activity.isWorking && state.fleet.seen > 0 ? ( + <Button key="stop" onPress={actions.stop}>stop the run</Button> + ) : null} + </Box> + ) : null} + {hasHint && hasButtons ? <Text dimColor wrap="truncate-end">{clip('click a button, or ctrl+x tab then Tab, Enter', width)}</Text> : null} </Box> ) } @@ -673,7 +676,7 @@ export function showBar( return ( // The band draws its own `[-]` collapse control at its right edge: leave it room. <Box justifyContent="space-between" paddingRight={5}> - <Text dimColor wrap="truncate-end">{clip(line, Math.max(8, width - 24))}</Text> + <Text dimColor wrap="truncate-end">{clip(line, Math.max(8, width - 20))}</Text> <Button key="show-pane" hotkey="m" onPress={onShow}>show pane</Button> </Box> ) |
