teamsmith 0.2.0 → 0.3.1
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/README.md +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +69 -0
- package/skills/teamsmith/SKILL.md +20 -13
- package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/config.md +39 -6
- package/skills/teamsmith/references/migration.md +197 -47
- package/skills/teamsmith/references/protocol.md +201 -30
- package/skills/teamsmith/references/troubleshooting.md +130 -10
- package/skills/teamsmith/references/workflows.md +36 -2
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
- package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
- package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
- package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
- package/skills/teamsmith/scripts/lib/common.sh +1004 -245
- package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +211 -211
- package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
- package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
- package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
- package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
- package/skills/teamsmith/scripts/replies.mjs +4 -1
- package/skills/teamsmith/scripts/shim/killall +10 -0
- package/skills/teamsmith/scripts/shim/pgrep +10 -0
- package/skills/teamsmith/scripts/shim/pidof +10 -0
- package/skills/teamsmith/scripts/shim/pkill +10 -0
- package/skills/teamsmith/scripts/shim/signal-gate +108 -31
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +19 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
- package/skills/teamsmith/templates/config.sh.tmpl +20 -1
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
- package/skills/teamsmith/tests/README.md +31 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
- package/skills/teamsmith/tests/config-cli.sh +184 -32
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/gate-guard.sh +52 -79
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +359 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
- package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
- package/skills/teamsmith/tests/key-replies.sh +281 -28
- package/skills/teamsmith/tests/ledger-ban.sh +5 -4
- package/skills/teamsmith/tests/ledger-claim.sh +2 -1
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
- package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
- package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
- package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
- package/skills/teamsmith/tests/panel-b2.sh +430 -352
- package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
- package/skills/teamsmith/tests/panel-b3.sh +314 -62
- package/skills/teamsmith/tests/panel-choices.sh +11 -6
- package/skills/teamsmith/tests/panel-cpu.sh +43 -130
- package/skills/teamsmith/tests/panel-p21.sh +251 -265
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +187 -396
- package/skills/teamsmith/tests/routes.sh +440 -117
- package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-guard.sh +13 -102
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +32 -18
- package/skills/teamsmith/tests/section-select.sh +371 -19
- package/skills/teamsmith/tests/signal-gate.sh +249 -27
- package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/slice-coverage.sh +206 -0
- package/skills/teamsmith/tests/smoke.sh +3595 -788
- package/skills/teamsmith/tests/task-model-routing.sh +530 -15
- package/skills/teamsmith/tests/team-bg-stop.sh +18 -10
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith/tests/workflow-entry.sh +207 -0
- package/skills/teamsmith-init/SKILL.md +12 -12
- package/skills/teamsmith-init/references/bootstrap.md +3 -3
- package/skills/teamsmith/tests/flip-glue.sh +0 -162
- package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
- package/skills/teamsmith/tests/flip-m12.sh +0 -185
- package/skills/teamsmith/tests/flip-m16.sh +0 -166
- package/skills/teamsmith/tests/flip-m17.sh +0 -204
- package/skills/teamsmith/tests/flip-m34.sh +0 -96
- package/skills/teamsmith/tests/flip-m37.sh +0 -185
- package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
- package/skills/teamsmith/tests/flip-m43.sh +0 -128
- package/skills/teamsmith/tests/flip-m45.sh +0 -244
- package/skills/teamsmith/tests/flip-m46.sh +0 -238
- package/skills/teamsmith/tests/flip-m48.sh +0 -304
- package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
- package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
- package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
- package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
- package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
- package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
- package/skills/teamsmith/tests/flip-p144.sh +0 -112
- package/skills/teamsmith/tests/flip-p156.sh +0 -133
- package/skills/teamsmith/tests/flip-p160.sh +0 -182
- package/skills/teamsmith/tests/flip-p171.sh +0 -249
- package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
- package/skills/teamsmith/tests/flip-p20.sh +0 -286
- package/skills/teamsmith/tests/flip-p201.sh +0 -249
- package/skills/teamsmith/tests/flip-p210.sh +0 -239
- package/skills/teamsmith/tests/flip-p211.sh +0 -152
- package/skills/teamsmith/tests/flip-p217.sh +0 -288
- package/skills/teamsmith/tests/flip-p22.sh +0 -123
- package/skills/teamsmith/tests/flip-p23.sh +0 -239
- package/skills/teamsmith/tests/flip-p25.sh +0 -165
- package/skills/teamsmith/tests/flip-p71.sh +0 -184
- package/skills/teamsmith/tests/flip-p72.sh +0 -202
- package/skills/teamsmith/tests/load-experiment.sh +0 -290
- package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
- package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
- package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
- package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
- package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
- package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
- package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
- package/skills/teamsmith/tests/panel-knobs.sh +0 -83
- package/skills/teamsmith/tests/section-budgets.tsv +0 -154
- package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
- package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
|
@@ -31,6 +31,7 @@ import type {
|
|
|
31
31
|
ChangeRow,
|
|
32
32
|
Density,
|
|
33
33
|
DetailBlock,
|
|
34
|
+
DetailSource,
|
|
34
35
|
DetailWindow,
|
|
35
36
|
FocusRef,
|
|
36
37
|
Frame,
|
|
@@ -742,8 +743,12 @@ function boardBlock(ctx: Ctx): Block | null {
|
|
|
742
743
|
// M48: the focus names a **row**, not a bare id — two rows may share one id, and matching by id
|
|
743
744
|
// highlights both at once and freezes the `↑`/`↓` walk on the first of them.
|
|
744
745
|
const ordinals = dupOrdinals(rows)
|
|
745
|
-
const
|
|
746
|
-
const
|
|
746
|
+
const scoped = boardFocusRef(ctx.view.focus)
|
|
747
|
+
const named = scoped ? focusRow(rows, scoped) : null
|
|
748
|
+
// P249: a preview row's ref never lights a board row — the page's one cursor belongs to that
|
|
749
|
+
// block; the board only draws its default (first rendered row) when nothing is focused at all.
|
|
750
|
+
const focusedRow =
|
|
751
|
+
ctx.view.focus && !scoped ? null : named && rendered.includes(named) ? named : (rendered[0] ?? null)
|
|
747
752
|
const order = rendered.map((r) => refFor(r, ordinals))
|
|
748
753
|
for (const r of rendered) {
|
|
749
754
|
const focused = r === focusedRow
|
|
@@ -958,6 +963,15 @@ function resolveFocusWith(
|
|
|
958
963
|
return null
|
|
959
964
|
}
|
|
960
965
|
|
|
966
|
+
/**
|
|
967
|
+
* The board-scoped part of a focus ref (P249): a preview row's ref (lane = a preview block's scope) never
|
|
968
|
+
* names a kanban card, so the board page neither draws a cursor for it nor opens anything from it. A
|
|
969
|
+
* missing ref keeps the board's own default (the first card of the first non-empty lane).
|
|
970
|
+
*/
|
|
971
|
+
export function boardFocusRef(focus?: FocusRef | null): FocusRef | null {
|
|
972
|
+
return focus && LANES.includes(focus.lane) ? focus : null
|
|
973
|
+
}
|
|
974
|
+
|
|
961
975
|
/**
|
|
962
976
|
* One lane's visible window. `size` is the number of card rows the frame can spend, the offset is
|
|
963
977
|
* clamped to the lane, and the focused card (when it lives in this lane) always stays inside — the
|
|
@@ -1178,7 +1192,10 @@ function kanbanBlock(ctx: Ctx): Block | null {
|
|
|
1178
1192
|
const rows = board.rows ?? []
|
|
1179
1193
|
if (!rows.length) return one([{ line: truncLine(ln(seg(` ${s.boardEmpty}`, 'dim')), ctx.width) }])
|
|
1180
1194
|
const ordinals = dupOrdinals(rows)
|
|
1181
|
-
|
|
1195
|
+
// P249: only a ref that names one of the six lanes (or no ref at all, which keeps the board's own
|
|
1196
|
+
// default cursor) resolves here; a preview row's ref puts no cursor on the kanban.
|
|
1197
|
+
const focus =
|
|
1198
|
+
ctx.view.focus && !LANES.includes(ctx.view.focus.lane) ? null : resolveFocusWith(rows, ordinals, ctx.view.focus)
|
|
1182
1199
|
// M48: one row object is the focus; every `card === target` below is O(1) and two rows sharing an
|
|
1183
1200
|
// id never both light up. The duplicate ordinals are built once per frame and shared by the
|
|
1184
1201
|
// focus/actions (no per-lane or per-card rescan of the board).
|
|
@@ -1278,11 +1295,19 @@ function detailBlock(ctx: Ctx): Block | null {
|
|
|
1278
1295
|
return one([{ line: truncLine(ln(seg(` ${s.detailLoading}`, 'dim')), width) }], { index: 0, total: 0, visible: 0, offset: 0 })
|
|
1279
1296
|
}
|
|
1280
1297
|
const files = data.files ?? []
|
|
1281
|
-
if (!files.length)
|
|
1298
|
+
if (!files.length) {
|
|
1299
|
+
// A missing target is not an error: the reader's reason names it, so the view says the source is
|
|
1300
|
+
// unavailable instead of rendering an empty document as a successful read (P249).
|
|
1301
|
+
const line = data.reason ? fill(s.detailUnavailable, { reason: data.reason }) : s.detailNoFiles
|
|
1302
|
+
return one([{ line: truncLine(ln(seg(` ${line}`, 'dim')), width) }])
|
|
1303
|
+
}
|
|
1282
1304
|
const detail = data as DetailBlock
|
|
1283
1305
|
const index = Math.max(0, Math.min(files.length - 1, Math.floor(ctx.view.detailIndex ?? 0) || 0))
|
|
1284
1306
|
const active = files[index]
|
|
1285
1307
|
const rows: PlacedLine[] = [detailTabs(ctx, files, index, width)]
|
|
1308
|
+
// The reader refused a discovery (a symbolic link): the other files still open, and the reason
|
|
1309
|
+
// names what was refused (P249).
|
|
1310
|
+
if (data.reason) rows.push({ line: truncLine(ln(seg(` ${data.reason}`, 'warn')), width) })
|
|
1286
1311
|
if (active.truncated) rows.push({ line: truncLine(ln(seg(` ${s.detailTruncated}`, 'warn')), width) })
|
|
1287
1312
|
if (detail.file !== active.path) {
|
|
1288
1313
|
// The tab was switched and its text has not arrived yet: the tabs stay live, the body says why.
|
|
@@ -1339,9 +1364,10 @@ function replyNavLine(ctx: Ctx, innerW: number): PlacedLine {
|
|
|
1339
1364
|
}
|
|
1340
1365
|
|
|
1341
1366
|
/**
|
|
1342
|
-
* Page 5's list block. It draws the nav row, the
|
|
1343
|
-
*
|
|
1344
|
-
* the
|
|
1367
|
+
* Page 5's list block. It draws the nav row, the page's one-line self-description (what this page
|
|
1368
|
+
* holds and who publishes into it), the slot count (never a claim about readable replies), the tail
|
|
1369
|
+
* warning when the reader reported one, and the windowed rows. The returned window is what the App
|
|
1370
|
+
* clamps `↑`/`↓` against; `focus` is the focused slot's number.
|
|
1345
1371
|
*/
|
|
1346
1372
|
function replyListBlock(ctx: Ctx): Block | null {
|
|
1347
1373
|
const { s, blocks, deg, view } = ctx
|
|
@@ -1358,7 +1384,10 @@ function replyListBlock(ctx: Ctx): Block | null {
|
|
|
1358
1384
|
replyList: win,
|
|
1359
1385
|
summary: { line: truncLine(ln(seg(` ${s.replyHeading}`, 'heading')), ctx.width) },
|
|
1360
1386
|
})
|
|
1361
|
-
const lines: PlacedLine[] = [
|
|
1387
|
+
const lines: PlacedLine[] = [
|
|
1388
|
+
replyNavLine(ctx, innerW),
|
|
1389
|
+
{ line: truncLine(ln(seg(` ${s.replyPageNote}`, 'dim')), innerW) },
|
|
1390
|
+
]
|
|
1362
1391
|
if (!data || deg.has('reply_list')) {
|
|
1363
1392
|
lines.push({ line: truncLine(ln(seg(` ${data ? s.dash : s.replyLoading}`, 'dim')), innerW) })
|
|
1364
1393
|
return build(lines, { focus: 0, offset: 0, visible: 0, count: 0 })
|
|
@@ -1526,18 +1555,18 @@ function replySummaryBlock(ctx: Ctx): Block | null {
|
|
|
1526
1555
|
// sentences, so the column only has to hold the longest of them (zh is the wide language here;
|
|
1527
1556
|
// a longer en label is cut by `cell()`, the same rule the key names followed).
|
|
1528
1557
|
const SETTINGS_LABEL_W = 22
|
|
1529
|
-
const SETTINGS_AUDIT_LINES = 3
|
|
1530
1558
|
/** P232: the policy migration diagnosis is shown above the audit tail; the rest is counted. */
|
|
1531
1559
|
const SETTINGS_DIAG_LINES = 2
|
|
1532
1560
|
/** P232: how many frame lines one diagnosis line may wrap to before it is cut with an ellipsis. */
|
|
1533
1561
|
const SETTINGS_DIAG_WRAP = 2
|
|
1534
|
-
// The tail the block draws under its row window: the CLI hint,
|
|
1535
|
-
//
|
|
1536
|
-
//
|
|
1537
|
-
//
|
|
1538
|
-
//
|
|
1539
|
-
//
|
|
1540
|
-
//
|
|
1562
|
+
// The tail the block draws under its row window: the focused row's CLI hint and, when the command
|
|
1563
|
+
// reports one, the policy migration diagnosis (P266: the audit tail is no longer drawn here — the
|
|
1564
|
+
// log stays readable through `team config list`'s own footer and `team config log`, and the console
|
|
1565
|
+
// is deliberately not one of its readers), plus `SETTINGS_COUNT_ROWS`, the pessimistic reservation
|
|
1566
|
+
// for the two hidden-row counts (`↑n`/`↓n`). Reserving **both** counts is what keeps the block inside
|
|
1567
|
+
// the frame once the list is longer than the window: with only the tail reserved, a full window
|
|
1568
|
+
// plus a full tail overflowed and the whole view degraded to its one-line summary (measured in
|
|
1569
|
+
// M55's pairlist route: the seats block the route had just focused disappeared from the frame).
|
|
1541
1570
|
//
|
|
1542
1571
|
// P32 (the user's second report, 2026-09-22): the reservation is a *ceiling*, not a fixed cost. The
|
|
1543
1572
|
// window spends what the tail does not need (a count line is only drawn when the window really
|
|
@@ -1546,14 +1575,13 @@ const SETTINGS_DIAG_WRAP = 2
|
|
|
1546
1575
|
const SETTINGS_COUNT_ROWS = 2
|
|
1547
1576
|
|
|
1548
1577
|
/**
|
|
1549
|
-
* The
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1552
|
-
*
|
|
1553
|
-
*
|
|
1554
|
-
* records against. Their cards still fill (the pad below), so the key band stays the frame's last row.
|
|
1578
|
+
* The two pickers' *paged* list bound (M55's calibrated value, kept: a picker covers the row list, so
|
|
1579
|
+
* this reservation is its own chrome — title + interval + the two hidden-count lines + blank + hint).
|
|
1580
|
+
* A long vocabulary shows a `↑n`/`↓n` window that scrolls instead of flooding the pane, which is what
|
|
1581
|
+
* the archived `choices` fixture calibrates its twenty-eight model records against. Their cards still
|
|
1582
|
+
* fill (the pad below), so the key band stays the frame's last row.
|
|
1555
1583
|
*/
|
|
1556
|
-
const SETTINGS_TAIL_ROWS = SETTINGS_COUNT_ROWS +
|
|
1584
|
+
const SETTINGS_TAIL_ROWS = SETTINGS_COUNT_ROWS + 6
|
|
1557
1585
|
|
|
1558
1586
|
/** One drawn row of the project-settings view (group headings are not focusable). */
|
|
1559
1587
|
export type SettingsRow =
|
|
@@ -1575,6 +1603,18 @@ export function settingsClassLabel(s: Strings, cls: string): string {
|
|
|
1575
1603
|
* shout in green while the user's question is "does this need a restart?". Colour is never the only
|
|
1576
1604
|
* channel: the badge's word always carries the class (the panel's standing rule).
|
|
1577
1605
|
*/
|
|
1606
|
+
/**
|
|
1607
|
+
* The declared marker the owning command puts at the start of a fixture-only key's note
|
|
1608
|
+
* (`memory-and-deps` owns the marker). The hiding rule reads the read's data and nothing else: no
|
|
1609
|
+
* key list is baked into the bundle, so a fixture key added to the schema stays hidden and one whose
|
|
1610
|
+
* marker is removed comes back without rebuilding `panel.js`.
|
|
1611
|
+
*/
|
|
1612
|
+
const SETTINGS_FIXTURE_ONLY_MARKER = 'fixture-only: '
|
|
1613
|
+
|
|
1614
|
+
function settingsKeyHidden(k: SettingsKey): boolean {
|
|
1615
|
+
return String(k.route ?? '').startsWith(SETTINGS_FIXTURE_ONLY_MARKER)
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1578
1618
|
function settingsClassTone(cls: string): Tone {
|
|
1579
1619
|
if (cls === 'restart') return 'warn'
|
|
1580
1620
|
if (cls === 'refuse') return 'dim'
|
|
@@ -1631,8 +1671,12 @@ export function settingsViewRows(block: SettingsBlock | undefined, filter: strin
|
|
|
1631
1671
|
needle === '' || parts.some((p) => String(p ?? '').toLowerCase().includes(needle))
|
|
1632
1672
|
// The label first (what the row shows), then the raw key and the value — the three inputs a
|
|
1633
1673
|
// user may type into `/` (the label's words, `TEAM_…`, or the value on screen).
|
|
1634
|
-
|
|
1635
|
-
|
|
1674
|
+
// P266: a key the read marks fixture-only is not a row at all — no row, no heading of its own and
|
|
1675
|
+
// no `/` hit (it is dropped before the match, so not even its label or raw name can reach it).
|
|
1676
|
+
const shown = block.keys.filter(
|
|
1677
|
+
(k) =>
|
|
1678
|
+
!settingsKeyHidden(k) &&
|
|
1679
|
+
match(keyLabel(s, k.name), k.name, k.value, k.default, k.comment, k.warning, k.route ?? ''),
|
|
1636
1680
|
)
|
|
1637
1681
|
const ungrouped: SettingsKey[] = []
|
|
1638
1682
|
let openToken: string | null = null
|
|
@@ -1659,8 +1703,10 @@ export function settingsViewRows(block: SettingsBlock | undefined, filter: strin
|
|
|
1659
1703
|
out.push({ kind: 'group', label: s.settingsGroupCategories, tone: 'heading' })
|
|
1660
1704
|
for (const c of categories) out.push({ kind: 'category', category: c })
|
|
1661
1705
|
}
|
|
1706
|
+
// P266: the command's diagnostic is deliberately not searchable here — it never reaches the
|
|
1707
|
+
// screen, so `/` must not find a row for a string the user cannot see anywhere.
|
|
1662
1708
|
const assignments = (block.models?.assignments ?? []).filter((a) =>
|
|
1663
|
-
match(a.agent, a.task, a.category, a.model, a.sid, a.selected_via, a.launch_via
|
|
1709
|
+
match(a.agent, a.task, a.category, a.model, a.sid, a.selected_via, a.launch_via),
|
|
1664
1710
|
)
|
|
1665
1711
|
const launch = block.models?.pm_launch ?? {}
|
|
1666
1712
|
const launchShown =
|
|
@@ -1804,6 +1850,9 @@ function settingsAssignmentLine(ctx: Ctx, a: SettingsAssignment, focused: boolea
|
|
|
1804
1850
|
innerW,
|
|
1805
1851
|
).map((x) => x),
|
|
1806
1852
|
)
|
|
1853
|
+
// P266: the command's diagnostic string never reaches the screen. The two plain reasons are chosen
|
|
1854
|
+
// from the read's own fact (`record_present`): no record file at all vs. a record that exists but
|
|
1855
|
+
// cannot be read — a seat that was used is never told it never was.
|
|
1807
1856
|
const note = a.assigned
|
|
1808
1857
|
? fill(s.settingsAssignmentNote, {
|
|
1809
1858
|
task: a.task || s.dash,
|
|
@@ -1812,7 +1861,9 @@ function settingsAssignmentLine(ctx: Ctx, a: SettingsAssignment, focused: boolea
|
|
|
1812
1861
|
selected: settingsSourceLabel(s, a.selected_via),
|
|
1813
1862
|
launch: settingsSourceLabel(s, a.launch_via),
|
|
1814
1863
|
})
|
|
1815
|
-
:
|
|
1864
|
+
: a.record_present === false
|
|
1865
|
+
? s.settingsAssignmentNone
|
|
1866
|
+
: s.settingsAssignmentUnreadable
|
|
1816
1867
|
line.push(seg(` ${truncateW(note, Math.max(8, innerW - dispWidth(textOf(line)) - 2))}`, a.assigned ? 'dim' : 'warn'))
|
|
1817
1868
|
return { line }
|
|
1818
1869
|
}
|
|
@@ -1851,7 +1902,7 @@ function settingsCliHint(s: Strings, rows: SettingsRow[], focus: number): string
|
|
|
1851
1902
|
if (row.kind === 'pm-launch') return s.settingsPmLaunchHint
|
|
1852
1903
|
const key = row.key
|
|
1853
1904
|
if (key.known === false) return fill(s.settingsUnknownHint, { key: key.name })
|
|
1854
|
-
if (key.class === 'refuse') return
|
|
1905
|
+
if (key.class === 'refuse') return s.settingsRefusedHint
|
|
1855
1906
|
// The whole-map row is not composed here: its editor is the categories block, and the command
|
|
1856
1907
|
// line the requirement names is the per-category one (P232).
|
|
1857
1908
|
if (String(key.kind ?? '') === 'task-model-map') return s.settingsCategoryMapHint
|
|
@@ -1898,9 +1949,6 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1898
1949
|
const room = Math.max(3, ctx.settingsRows ?? 12)
|
|
1899
1950
|
const focus = Math.max(0, Math.min(Math.max(0, count - 1), ctx.view.settingsFocus ?? 0))
|
|
1900
1951
|
const explicitOffset = ctx.view.settingsOffset
|
|
1901
|
-
// The tail under the window: the CLI hint, a blank, the audit heading and its tail (the heading
|
|
1902
|
-
// always has one line under it — a dash when the command's log is empty).
|
|
1903
|
-
const audit = (block.audit ?? []).slice(-SETTINGS_AUDIT_LINES)
|
|
1904
1952
|
// P232: the command's own policy diagnosis (missing/retired keys, an unmapped category map) is
|
|
1905
1953
|
// part of the view: a legacy contract must say so, with the CLI route the command itself names.
|
|
1906
1954
|
const diagnosis = String(block.models?.diagnostic ?? '')
|
|
@@ -1911,7 +1959,9 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
1911
1959
|
const diagRest = diagnosis.length - diagShown.length
|
|
1912
1960
|
const diagChunks = diagShown.map((d) => diagnoseChunks(d, Math.max(8, width - 3), SETTINGS_DIAG_WRAP))
|
|
1913
1961
|
const diagLines = diagChunks.length ? diagChunks.reduce((n, c) => n + c.length, 0) + 1 + (diagRest > 0 ? 1 : 0) : 0
|
|
1914
|
-
|
|
1962
|
+
// P266: the tail is the focused row's CLI hint plus the diagnosis when there is one; the audit
|
|
1963
|
+
// tail that used to sit here is no longer drawn (and no longer reads the log).
|
|
1964
|
+
const tailLines = 1 + diagLines
|
|
1915
1965
|
// The row cap: each row costs at least its own line, and the tail is already spoken for.
|
|
1916
1966
|
const desired = Math.max(1, Math.min(Math.max(1, count), Math.max(1, room - tailLines)))
|
|
1917
1967
|
const maxOffset = Math.max(0, count - desired)
|
|
@@ -2114,12 +2164,6 @@ function settingsBlock(ctx: Ctx): Block | null {
|
|
|
2114
2164
|
if (diagRest > 0) put(ln(seg(` ${fill(s.laneHiddenBelow, { n: String(diagRest) })}`, 'dim')))
|
|
2115
2165
|
}
|
|
2116
2166
|
|
|
2117
|
-
// The audit footer: at most three lines, newest last (the CLI's own tail).
|
|
2118
|
-
put(ln(seg('')))
|
|
2119
|
-
put(ln(seg(` ${s.settingsAuditHeading}`, 'heading')))
|
|
2120
|
-
if (!audit.length) put(ln(seg(` ${s.dash}`, 'dim')))
|
|
2121
|
-
for (const a of audit) put(ln(seg(` ${a}`, 'dim')))
|
|
2122
|
-
|
|
2123
2167
|
// P32 (the bounded-frame rule's last resort, the detail view's own): the space the rows did not
|
|
2124
2168
|
// use stays **inside** the card, so the card fills the pane it was handed and the key band stays
|
|
2125
2169
|
// the frame's last row. With a full list that is nothing; with a filter, the tail of the list or
|
|
@@ -2148,6 +2192,91 @@ function changeTasksLine(ch: ChangeRow, width: number): PlacedLine | null {
|
|
|
2148
2192
|
return widthOf(line) <= width ? { line } : null
|
|
2149
2193
|
}
|
|
2150
2194
|
|
|
2195
|
+
/**
|
|
2196
|
+
* P249 · the work page's preview blocks: the changes/specs/decisions rows are focusable on the same
|
|
2197
|
+
* terms as the board rows (one cursor, a two-stage click, a stop in the page-wide drawn order), and
|
|
2198
|
+
* the source a row hands to the detail view is fixed by the block it was drawn in.
|
|
2199
|
+
*/
|
|
2200
|
+
|
|
2201
|
+
/** The duplicate ordinal of each focusable key in a preview block (the board's `dupOrdinals` twin). */
|
|
2202
|
+
function previewOrdinals(keys: string[]): number[] {
|
|
2203
|
+
const seen = new Map<string, number>()
|
|
2204
|
+
return keys.map((key) => {
|
|
2205
|
+
const nth = seen.get(key) ?? 0
|
|
2206
|
+
seen.set(key, nth + 1)
|
|
2207
|
+
return nth
|
|
2208
|
+
})
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* The focused key's index: the exact (id, nth) when it names one of this block's rows, the id's first
|
|
2213
|
+
* row when the duplicate it named left, else the first drawn row. A ref scoped to another block (or to
|
|
2214
|
+
* a board lane) never lights a row here — each block only draws its own focus.
|
|
2215
|
+
*/
|
|
2216
|
+
function previewFocusIndex(ctx: Ctx, scope: string, keys: string[], ordinals: number[]): number {
|
|
2217
|
+
const f = ctx.view.focus
|
|
2218
|
+
if (f && f.lane === scope) {
|
|
2219
|
+
const nth = Math.max(0, f.nth ?? 0)
|
|
2220
|
+
const exact = keys.findIndex((id, i) => id === f.id && ordinals[i] === nth)
|
|
2221
|
+
if (exact >= 0) return exact
|
|
2222
|
+
const first = keys.indexOf(f.id)
|
|
2223
|
+
if (first >= 0) return first
|
|
2224
|
+
return 0
|
|
2225
|
+
}
|
|
2226
|
+
// No focus, or a focus the board owns: this block draws no cursor (the page has exactly one).
|
|
2227
|
+
return -1
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
/** The detail source a work-page focus lane addresses (P249); a board lane stays the entry source. */
|
|
2231
|
+
export function rowSourceOf(lane: string): DetailSource {
|
|
2232
|
+
if (lane === 'changes') return 'change'
|
|
2233
|
+
if (lane === 'specs') return 'spec'
|
|
2234
|
+
if (lane === 'decisions') return 'decision'
|
|
2235
|
+
return 'entry'
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* One preview block's drawn rows with the P249 focus kit: a row whose `key` is a string is a stop —
|
|
2240
|
+
* drawn with the cursor and the `selected` tone when focused, one `open-focused`/`focus` target, and
|
|
2241
|
+
* one entry in the block's drawn-row order (the assembly concatenates the blocks' orders into the
|
|
2242
|
+
* page order); a row whose key is null is drawn but is not a stop (there is nothing to open).
|
|
2243
|
+
*/
|
|
2244
|
+
function previewLines(
|
|
2245
|
+
ctx: Ctx,
|
|
2246
|
+
scope: string,
|
|
2247
|
+
drawn: { key: string | null; content: Line }[],
|
|
2248
|
+
width: number,
|
|
2249
|
+
): { lines: PlacedLine[]; order: FocusRef[] } {
|
|
2250
|
+
const keys = drawn.filter((d) => d.key !== null).map((d) => d.key as string)
|
|
2251
|
+
const ordinals = previewOrdinals(keys)
|
|
2252
|
+
const focusIdx = keys.length ? previewFocusIndex(ctx, scope, keys, ordinals) : -1
|
|
2253
|
+
const lines: PlacedLine[] = []
|
|
2254
|
+
const order: FocusRef[] = []
|
|
2255
|
+
let k = -1
|
|
2256
|
+
for (const d of drawn) {
|
|
2257
|
+
if (d.key === null) {
|
|
2258
|
+
lines.push({ line: truncLine(d.content, width) })
|
|
2259
|
+
continue
|
|
2260
|
+
}
|
|
2261
|
+
k++
|
|
2262
|
+
const nth = ordinals[k]
|
|
2263
|
+
const focused = k === focusIdx
|
|
2264
|
+
order.push({ lane: scope, id: d.key, nth })
|
|
2265
|
+
const line = ln(focused ? seg(`${FOCUS_CURSOR} `, 'selected') : seg(' '), ...d.content)
|
|
2266
|
+
const action: Action = focused
|
|
2267
|
+
? { kind: 'open-focused', lane: scope }
|
|
2268
|
+
: { kind: 'focus', lane: scope, id: d.key, nth }
|
|
2269
|
+
lines.push(placedWithHits(line, ctx.view.tui ? [{ start: 0, end: widthOf(line), action }] : undefined, width))
|
|
2270
|
+
}
|
|
2271
|
+
return { lines, order }
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
/** The `D<n>` a decision heading names; a heading without one is drawn but not openable. */
|
|
2275
|
+
function decisionIdOf(title: string): string | null {
|
|
2276
|
+
const m = /^D([0-9]+)(?![0-9])/.exec(String(title).trim())
|
|
2277
|
+
return m ? `D${m[1]}` : null
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2151
2280
|
function changesBlock(ctx: Ctx): Block | null {
|
|
2152
2281
|
const { s, blocks, deg, width } = ctx
|
|
2153
2282
|
const c = blocks.changes
|
|
@@ -2156,22 +2285,20 @@ function changesBlock(ctx: Ctx): Block | null {
|
|
|
2156
2285
|
return { id: 'changes', title: s.changesHeading, right: true, priority: 11, lines: [{ line: ln(seg(` ${s.dash}`, 'dim')) }] }
|
|
2157
2286
|
}
|
|
2158
2287
|
if (!c.changes.length) return null // an empty block collapses and yields its space
|
|
2159
|
-
const
|
|
2288
|
+
const drawn: { key: string | null; content: Line }[] = []
|
|
2160
2289
|
for (const ch of c.changes as ChangeRow[]) {
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
),
|
|
2168
|
-
width,
|
|
2169
|
-
),
|
|
2290
|
+
drawn.push({
|
|
2291
|
+
key: ch.id,
|
|
2292
|
+
content: [
|
|
2293
|
+
seg(cell(ch.id, 18), 'accent'),
|
|
2294
|
+
seg(fill(s.changeLine, { done: ch.done, total: ch.total, phase: changePhaseText(ch.phase, s) })),
|
|
2295
|
+
],
|
|
2170
2296
|
})
|
|
2171
2297
|
const toks = changeTasksLine(ch, width)
|
|
2172
|
-
if (toks)
|
|
2298
|
+
if (toks) drawn.push({ key: null, content: toks.line })
|
|
2173
2299
|
}
|
|
2174
|
-
|
|
2300
|
+
const { lines, order } = previewLines(ctx, 'changes', drawn, width)
|
|
2301
|
+
return { id: 'changes', title: fill(s.changesHeadingCount, { n: c.count }), right: true, priority: 11, lines, order, summary: { line: truncLine(ln(seg(` ${fill(s.changesHeadingCount, { n: c.count })}`, 'heading')), width) } }
|
|
2175
2302
|
}
|
|
2176
2303
|
|
|
2177
2304
|
function specsBlock(ctx: Ctx): Block | null {
|
|
@@ -2181,13 +2308,16 @@ function specsBlock(ctx: Ctx): Block | null {
|
|
|
2181
2308
|
if (deg.has('specs') || !sp.available) {
|
|
2182
2309
|
return { id: 'specs', title: s.specsHeading, right: true, priority: 13, lines: [{ line: ln(seg(` ${s.dash}`, 'dim')) }] }
|
|
2183
2310
|
}
|
|
2311
|
+
const drawn = (sp.specs ?? []).slice(0, 6).map((row) => ({
|
|
2312
|
+
key: row.name,
|
|
2313
|
+
content: [seg(cell(row.name, Math.max(8, width - 10)), 'text'), seg(` ${row.requirements}`, 'dim')],
|
|
2314
|
+
}))
|
|
2315
|
+
const { lines: rows, order } = previewLines(ctx, 'specs', drawn, width)
|
|
2184
2316
|
const lines: PlacedLine[] = [
|
|
2185
2317
|
{ line: truncLine(ln(seg(fill(s.specsCount, { specs: sp.count, reqs: sp.requirements }), 'dim')), width) },
|
|
2318
|
+
...rows,
|
|
2186
2319
|
]
|
|
2187
|
-
|
|
2188
|
-
lines.push({ line: truncLine(ln(seg(' '), seg(cell(row.name, Math.max(8, width - 10)), 'text'), seg(` ${row.requirements}`, 'dim')), width) })
|
|
2189
|
-
}
|
|
2190
|
-
return { id: 'specs', title: s.specsHeading, right: true, priority: 13, lines, summary: { line: truncLine(ln(seg(` ${s.specsHeading}`, 'heading')), width) } }
|
|
2320
|
+
return { id: 'specs', title: s.specsHeading, right: true, priority: 13, lines, order, summary: { line: truncLine(ln(seg(` ${s.specsHeading}`, 'heading')), width) } }
|
|
2191
2321
|
}
|
|
2192
2322
|
|
|
2193
2323
|
function decisionsBlock(ctx: Ctx): Block | null {
|
|
@@ -2197,12 +2327,16 @@ function decisionsBlock(ctx: Ctx): Block | null {
|
|
|
2197
2327
|
if (deg.has('decisions')) {
|
|
2198
2328
|
return { id: 'decisions', title: s.decisionsHeading, right: true, priority: 14, lines: [{ line: ln(seg(` ${s.dash}`, 'dim')) }] }
|
|
2199
2329
|
}
|
|
2330
|
+
const drawn: { key: string | null; content: Line }[] = d.recent
|
|
2331
|
+
.slice(0, 3)
|
|
2332
|
+
.map((r) => ({ key: decisionIdOf(r), content: [seg(r, 'dim')] }))
|
|
2333
|
+
const { lines: rows, order } = previewLines(ctx, 'decisions', drawn, width)
|
|
2200
2334
|
const lines: PlacedLine[] = [
|
|
2201
2335
|
{ line: truncLine(ln(seg(fill(s.decisionsCountSuffix, { n: d.count }), 'dim')), width) },
|
|
2202
2336
|
]
|
|
2203
2337
|
if (!d.recent.length) lines.push({ line: ln(seg(` ${s.decisionsEmpty}`, 'dim')) })
|
|
2204
|
-
|
|
2205
|
-
return { id: 'decisions', title: s.decisionsHeading, right: true, priority: 14, lines, summary: { line: truncLine(ln(seg(` ${s.decisionsHeading}`, 'heading')), width) } }
|
|
2338
|
+
lines.push(...rows)
|
|
2339
|
+
return { id: 'decisions', title: s.decisionsHeading, right: true, priority: 14, lines, order, summary: { line: truncLine(ln(seg(` ${s.decisionsHeading}`, 'heading')), width) } }
|
|
2206
2340
|
}
|
|
2207
2341
|
|
|
2208
2342
|
// ------------------------------------------------------------------ body blocks (page 3)
|
|
@@ -2737,14 +2871,16 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2737
2871
|
const rightBlocks = middle.filter((b) => !b.full && b.right)
|
|
2738
2872
|
|
|
2739
2873
|
const framed = isFramed(ctx)
|
|
2740
|
-
|
|
2741
|
-
|
|
2874
|
+
// P249: the work page's drawn-row order is **page-wide** — each block that really draws its rows
|
|
2875
|
+
// reports them in the order it drew them and the assembly concatenates the blocks in placement
|
|
2876
|
+
// order (left column top-to-bottom, then the right column). A block degraded to its summary line
|
|
2877
|
+
// draws no row and contributes nothing.
|
|
2878
|
+
let pageOrder: FocusRef[] = []
|
|
2879
|
+
const place = (block: Block, remaining: number, colWidth: number, sink: FocusRef[] | null): PlacedLine[] => {
|
|
2742
2880
|
const kind = pickChrome(block, remaining, framed)
|
|
2743
2881
|
if (kind === null) return []
|
|
2744
2882
|
if (kind === 'summary') return [summaryLine(block, colWidth)]
|
|
2745
|
-
|
|
2746
|
-
// summary line has no row to focus (P20/B5).
|
|
2747
|
-
if (block.order) boardOrder = block.order
|
|
2883
|
+
if (block.order && sink) sink.push(...block.order)
|
|
2748
2884
|
return wrapBlock(block, colWidth, kind)
|
|
2749
2885
|
}
|
|
2750
2886
|
|
|
@@ -2778,7 +2914,7 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2778
2914
|
if (block.id === 'settings' && block.settings) settingsWindow = block.settings
|
|
2779
2915
|
if (block.id === 'reply_list' && block.replyList) replyListWindow = block.replyList
|
|
2780
2916
|
if (block.id === 'reply_viewer' && block.replyDoc) replyDocWindow = block.replyDoc
|
|
2781
|
-
const chunk = place(block, budget - fullRows.length, width)
|
|
2917
|
+
const chunk = place(block, budget - fullRows.length, width, null)
|
|
2782
2918
|
for (const l of chunk) fullRows.push(l)
|
|
2783
2919
|
}
|
|
2784
2920
|
add(fullRows)
|
|
@@ -2791,6 +2927,8 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2791
2927
|
// One placement pass over the page's body blocks; `cards` is re-derived so pass 2 can carry a
|
|
2792
2928
|
// board with more history visible.
|
|
2793
2929
|
const placeColumns = (cards: Block[]): [PlacedLine[], PlacedLine[]] => {
|
|
2930
|
+
// Each pass starts a fresh page order; the final pass is the one whose rows are rendered.
|
|
2931
|
+
pageOrder = []
|
|
2794
2932
|
const columns: [PlacedLine[], PlacedLine[]] = [[], []]
|
|
2795
2933
|
const ordered = [
|
|
2796
2934
|
...cards.filter((b) => !b.right).map((b) => ({ b, slot: 0 as 0 | 1 })),
|
|
@@ -2804,7 +2942,7 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2804
2942
|
// had a full column of empty width. `pickChrome` keeps every column within `bodyBudget`, so
|
|
2805
2943
|
// the flush below still ends both columns on the same row.
|
|
2806
2944
|
const used = columns[slot].length
|
|
2807
|
-
const chunk = place(b, bodyBudget - used, colW)
|
|
2945
|
+
const chunk = place(b, bodyBudget - used, colW, pageOrder)
|
|
2808
2946
|
for (const l of chunk) columns[slot].push(l)
|
|
2809
2947
|
}
|
|
2810
2948
|
return columns
|
|
@@ -2865,9 +3003,10 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2865
3003
|
} else {
|
|
2866
3004
|
const columnW = width
|
|
2867
3005
|
let used = 0
|
|
3006
|
+
pageOrder = []
|
|
2868
3007
|
const ordered = [...leftBlocks, ...rightBlocks].sort((x, y) => x.priority - y.priority)
|
|
2869
3008
|
for (const b of ordered) {
|
|
2870
|
-
const chunk = place(b, bodyBudget - used, columnW)
|
|
3009
|
+
const chunk = place(b, bodyBudget - used, columnW, pageOrder)
|
|
2871
3010
|
for (const l of chunk) rows.push({ line: truncLine(l.line, columnW), hits: l.hits })
|
|
2872
3011
|
used += chunk.length
|
|
2873
3012
|
}
|
|
@@ -2886,11 +3025,12 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2886
3025
|
}
|
|
2887
3026
|
}
|
|
2888
3027
|
|
|
2889
|
-
// The work page's row chips are rebuilt after placement: they exist only while
|
|
2890
|
-
// really draws
|
|
2891
|
-
// (P20/B5). Both variants are one line, so the
|
|
3028
|
+
// The work page's row chips are rebuilt after placement: they exist only while at least one block
|
|
3029
|
+
// really draws a focusable row, so a degraded work page has no clickable row key that cannot open
|
|
3030
|
+
// anything (P20/B5, generalised to the preview blocks in P249). Both variants are one line, so the
|
|
3031
|
+
// budget above is unaffected.
|
|
2892
3032
|
const footerShown =
|
|
2893
|
-
ctx.view.page === 2 && !ctx.view.detail && !ctx.view.overlay && !
|
|
3033
|
+
ctx.view.page === 2 && !ctx.view.detail && !ctx.view.overlay && !pageOrder.length ? keyBandBlock(ctx, false) : footer
|
|
2894
3034
|
|
|
2895
3035
|
// The footer is the last row; when the height cannot even hold it, it is the only row kept.
|
|
2896
3036
|
if (height > 0 && rows.length + footerShown.lines.length > height) {
|
|
@@ -2931,7 +3071,7 @@ export function layout(input: LayoutInput): Frame {
|
|
|
2931
3071
|
...(replyListWindow ? { replyList: replyListWindow } : {}),
|
|
2932
3072
|
...(replyDocWindow ? { replyDoc: replyDocWindow } : {}),
|
|
2933
3073
|
...(settingsWindow ? { settings: settingsWindow } : {}),
|
|
2934
|
-
...(
|
|
3074
|
+
...(pageOrder.length ? { boardOrder: pageOrder } : {}),
|
|
2935
3075
|
}
|
|
2936
3076
|
}
|
|
2937
3077
|
|
|
@@ -54,7 +54,7 @@ import { fill, stringsFor } from './strings/index.js'
|
|
|
54
54
|
import { PANEL_CONF_FILE, PANEL_PAGE_FILE, readPage, readSettings, writePage, writeSettings } from './settings.js'
|
|
55
55
|
import type { Settings } from './settings.js'
|
|
56
56
|
import { contrastPairs, PALETTES, resolveTheme } from './theme.js'
|
|
57
|
-
import type { FrameInput, PageId, ViewState } from './types.js'
|
|
57
|
+
import type { FrameInput, PageId, ViewState, DetailSource } from './types.js'
|
|
58
58
|
|
|
59
59
|
/** The Kitty keyboard protocol's pop/push pair, written around the editor handoff (design §6). */
|
|
60
60
|
const KITTY_POP = '\u001b[<u'
|
|
@@ -168,6 +168,14 @@ const pageArg = argOf('page')
|
|
|
168
168
|
const langArg = argOf('lang')
|
|
169
169
|
/** `--detail <ID>`: render the read-only detail view in a snapshot (the overlay's sibling exit). */
|
|
170
170
|
const detailArg = argOf('detail') || ''
|
|
171
|
+
/**
|
|
172
|
+
* `--detail-source entry|spec|change|decision`: the source the snapshot's detail view addresses.
|
|
173
|
+
* Read-only and snapshot-only — the live console passes its source through `api.setDetail`. An
|
|
174
|
+
* unrecognised value is ignored (entry), so the argument cannot open a way out of the closed set.
|
|
175
|
+
*/
|
|
176
|
+
const detailSourceRaw = argOf('detail-source') || ''
|
|
177
|
+
const detailSourceArg =
|
|
178
|
+
detailSourceRaw === 'spec' || detailSourceRaw === 'change' || detailSourceRaw === 'decision' ? detailSourceRaw : 'entry'
|
|
171
179
|
/**
|
|
172
180
|
* Page 5's snapshot/demand knobs (pulse-key-replies). `--reply-no N` opens that number's viewer,
|
|
173
181
|
* `--reply-before N` pins the list cursor and `--reply-focus N` pins the focused slot, so the
|
|
@@ -186,7 +194,7 @@ if (has('help')) {
|
|
|
186
194
|
out(
|
|
187
195
|
'usage: panel.js [--root DIR] [--state-dir DIR] [--print|--json|--once|--headless|--snapshot|--palette]\n' +
|
|
188
196
|
' [--width N] [--height N] [--activity|--no-activity] [--events N] [--refresh N]\n' +
|
|
189
|
-
' [--no-pulse] [--theme dark|light] [--page 1|2|3|4|5] [--lang zh|en] [--overlay] [--detail ID]\n' +
|
|
197
|
+
' [--no-pulse] [--theme dark|light] [--page 1|2|3|4|5] [--lang zh|en] [--overlay] [--detail ID] [--detail-source entry|spec|change|decision]\n' +
|
|
190
198
|
' [--reply-no N] [--reply-before N] [--reply-focus N] [--version]\n',
|
|
191
199
|
)
|
|
192
200
|
process.exit(0)
|
|
@@ -346,6 +354,7 @@ async function main(): Promise<void> {
|
|
|
346
354
|
activity: rawActivityOn,
|
|
347
355
|
events,
|
|
348
356
|
detailId: detailArg || null,
|
|
357
|
+
detailSource: detailArg ? detailSourceArg : null,
|
|
349
358
|
replyListOpen: page === 5 && !replyNoArg,
|
|
350
359
|
replyBefore: replyBeforeArg || null,
|
|
351
360
|
replyNo: page === 5 && replyNoArg ? replyNoArg : null,
|
|
@@ -491,12 +500,19 @@ async function main(): Promise<void> {
|
|
|
491
500
|
return ''
|
|
492
501
|
}
|
|
493
502
|
}
|
|
494
|
-
|
|
503
|
+
/**
|
|
504
|
+
* Write `state/draft.md`. Returns whether the write landed: the send settle empties the file first
|
|
505
|
+
* and must know the result before it may drop the in-memory draft (change
|
|
506
|
+
* panel-preview-and-compose — memory and disk never disagree about the draft).
|
|
507
|
+
*/
|
|
508
|
+
function writeDraft(text: string): boolean {
|
|
495
509
|
try {
|
|
496
510
|
mkdirSync(stateDir, { recursive: true })
|
|
497
511
|
writeFileSync(draftFile, String(text ?? ''))
|
|
512
|
+
return true
|
|
498
513
|
} catch {
|
|
499
514
|
/* a state directory the console cannot write must not kill the panel */
|
|
515
|
+
return false
|
|
500
516
|
}
|
|
501
517
|
}
|
|
502
518
|
|
|
@@ -784,7 +800,7 @@ async function main(): Promise<void> {
|
|
|
784
800
|
const api: PanelApi = {
|
|
785
801
|
readDraft,
|
|
786
802
|
writeDraft,
|
|
787
|
-
clearDraft: () => writeDraft(''),
|
|
803
|
+
clearDraft: (): boolean => writeDraft(''),
|
|
788
804
|
send,
|
|
789
805
|
flushQueue,
|
|
790
806
|
setStandby,
|
|
@@ -797,7 +813,12 @@ async function main(): Promise<void> {
|
|
|
797
813
|
const read = await readClipboard(clipRunner)
|
|
798
814
|
if (!read) return { kind: 'none' as const, value: '' }
|
|
799
815
|
if (read.kind === 'text') return { kind: 'text' as const, value: read.text }
|
|
800
|
-
|
|
816
|
+
// P309: the paste path uses the resolved temp root the data layer reports (no second resolution).
|
|
817
|
+
// P331: `tempRoot` also carries the root a **degraded** capacity block printed — that block
|
|
818
|
+
// renders `—` while the project has no `capacity.log` yet, which is every fresh `team init`
|
|
819
|
+
// project (the log is history written by patrol ticks). The root is not a capacity figure, so
|
|
820
|
+
// losing the figure must not lose the paste.
|
|
821
|
+
const file = writePasteFile(read.bytes, read.mime, cache.snapshot().tempRoot)
|
|
801
822
|
if (!file) return { kind: 'none' as const, value: '' }
|
|
802
823
|
return { kind: 'path' as const, value: file }
|
|
803
824
|
},
|
|
@@ -819,16 +840,24 @@ async function main(): Promise<void> {
|
|
|
819
840
|
opts.activity = on
|
|
820
841
|
refreshNow()
|
|
821
842
|
},
|
|
822
|
-
setDetail: (id: string | null, file?: string | null) => {
|
|
843
|
+
setDetail: (id: string | null, file?: string | null, source?: DetailSource | null) => {
|
|
823
844
|
const nextId = id ?? null
|
|
824
845
|
const nextFile = nextId ? file ?? null : null
|
|
825
|
-
|
|
846
|
+
const nextSource: DetailSource = nextId ? source ?? 'entry' : 'entry'
|
|
847
|
+
if (
|
|
848
|
+
(opts.detailId ?? null) === nextId &&
|
|
849
|
+
(opts.detailFile ?? null) === nextFile &&
|
|
850
|
+
(opts.detailSource ?? 'entry') === nextSource
|
|
851
|
+
)
|
|
852
|
+
return
|
|
826
853
|
opts.detailId = nextId
|
|
827
854
|
opts.detailFile = nextFile
|
|
855
|
+
opts.detailSource = nextSource
|
|
828
856
|
// The detail block is off the tick path: only the view's own open/tab-switch forces a build.
|
|
829
857
|
if (!nextId) return
|
|
830
858
|
// The cached block already serves this file (the open returns the first file without
|
|
831
|
-
// `--file`): record the option and rebuild nothing, so the effect can stay idempotent.
|
|
859
|
+
// `--file`): record the option and rebuild nothing, so the effect can stay idempotent. The
|
|
860
|
+
// source is part of the identity — the same id from two sources is two different reads.
|
|
832
861
|
const cached = cache.snapshot().blocks?.detail
|
|
833
862
|
if (cached?.id === nextId && nextFile && cached.file === nextFile) return
|
|
834
863
|
void cache.refresh({ force: true, only: ['detail'] }).then(adopt)
|