summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/hooks/reader/brief.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/reader/brief.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/reader/brief.ts')
-rw-r--r--plugins/code-modernization/hooks/reader/brief.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/code-modernization/hooks/reader/brief.ts b/plugins/code-modernization/hooks/reader/brief.ts
index 890aa58a..8ced2934 100644
--- a/plugins/code-modernization/hooks/reader/brief.ts
+++ b/plugins/code-modernization/hooks/reader/brief.ts
@@ -1,3 +1,5 @@
+import { linesOf } from '../text'
+
/**
* `analysis/<system>/MODERNIZATION_BRIEF.md`, read without a model: the
* target stack, the phases, which modules each phase names, the exit
@@ -67,11 +69,15 @@ export function criterionTextOf(line: string): string | null {
* its text mentions as whole words
*/
export function parseBrief(text: string, knownModules: readonly string[] = []): Brief {
- const lines = text.split('\n')
+ const lines = linesOf(text)
const titleLine = lines.find(line => /^#\s+/.test(line)) ?? ''
const arrow = /[→>]\s*(.+?)\s*$/.exec(titleLine.replace(/->/g, '→'))
- const target = arrow?.[1] !== undefined ? strip(arrow[1]) : undefined
+ // The title may hold the arrow inside a parenthesis: `(COBOL/CICS → Java/Spring)`. The close is not part of the target.
+ const fromTitle = arrow?.[1] !== undefined ? strip(arrow[1]).replace(/\)$/, m => (arrow[1]?.includes('(') === true ? m : '')) : undefined
+ // The header's own `**Target stack:** `java-spring`` is the token the commands take: it wins when it is one plain token.
+ const stackToken = /\*\*Target stack:?\*\*:?\s*`([A-Za-z0-9][\w.+/-]{0,59})`/i.exec(text)?.[1]
+ const target = stackToken ?? fromTitle
const phases: Phase[] = []
let current: { phase: Phase; body: string[]; level: number } | null = null