teamsmith 0.2.0 → 0.3.0
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 +28 -0
- package/skills/teamsmith/SKILL.md +14 -7
- 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 +176 -19
- package/skills/teamsmith/references/troubleshooting.md +124 -7
- 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 +175 -30
- package/skills/teamsmith/scripts/lib/cmd-status.sh +226 -17
- 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 +773 -48
- package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +207 -207
- package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +11 -3
- package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
- package/skills/teamsmith/scripts/panel/src/main.tsx +33 -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/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/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
- package/skills/teamsmith/tests/config-cli.sh +160 -14
- 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-m37.sh +4 -1
- package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
- package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p210.sh +4 -1
- package/skills/teamsmith/tests/flip-p217.sh +4 -1
- package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
- package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
- package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +279 -20
- package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
- package/skills/teamsmith/tests/key-replies-ui.sh +0 -7
- package/skills/teamsmith/tests/key-replies.sh +240 -1
- 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/reply-fixture.sh +4 -9
- package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
- 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 +59 -47
- package/skills/teamsmith/tests/panel-b2.sh +106 -3
- package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
- package/skills/teamsmith/tests/panel-b3.sh +175 -19
- package/skills/teamsmith/tests/panel-choices.sh +11 -6
- package/skills/teamsmith/tests/panel-cpu.sh +2 -1
- package/skills/teamsmith/tests/panel-knobs.sh +7 -1
- package/skills/teamsmith/tests/panel-p21.sh +156 -73
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +121 -30
- package/skills/teamsmith/tests/routes.sh +327 -93
- package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-budgets.tsv +20 -10
- package/skills/teamsmith/tests/section-guard.sh +6 -1
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +19 -13
- package/skills/teamsmith/tests/section-select.sh +8 -1
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/smoke.sh +2972 -440
- package/skills/teamsmith/tests/task-model-routing.sh +507 -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-init/SKILL.md +12 -12
- package/skills/teamsmith-init/references/bootstrap.md +3 -3
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
13
13
|
import { writeSync } from 'node:fs'
|
|
14
14
|
import { Box, Text, useApp, useCursor, useInput } from 'ink'
|
|
15
|
-
import { layout, resolveFocus, focusRefOf, focusRow, rowKey, settingsRowFocusable, settingsViewRows } from './layout.js'
|
|
15
|
+
import { layout, resolveFocus, focusRefOf, focusRow, rowKey, settingsRowFocusable, settingsViewRows, boardFocusRef, rowSourceOf } from './layout.js'
|
|
16
16
|
import type { LayoutInput, SettingsRow } from './layout.js'
|
|
17
17
|
import { clockOf } from './format.js'
|
|
18
18
|
import { fill, stringsFor, type Strings } from './strings/index.js'
|
|
@@ -21,6 +21,7 @@ import type { Settings } from './settings.js'
|
|
|
21
21
|
import type {
|
|
22
22
|
Action,
|
|
23
23
|
DetailWindow,
|
|
24
|
+
DetailSource,
|
|
24
25
|
FocusRef,
|
|
25
26
|
FrameInput,
|
|
26
27
|
PageId,
|
|
@@ -81,8 +82,10 @@ function composeTrayTop(title: string, width: number): string {
|
|
|
81
82
|
/** The console's own actions, owned by main.tsx (file I/O, subprocesses, the editor relay). */
|
|
82
83
|
export interface PanelApi {
|
|
83
84
|
readDraft(): string
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
/** Persist the draft; false when the file could not be written (the settle reads this). */
|
|
86
|
+
writeDraft(text: string): boolean
|
|
87
|
+
/** Empty `state/draft.md`; false when the file could not be emptied (P249). */
|
|
88
|
+
clearDraft(): boolean
|
|
86
89
|
send(text: string): Promise<Receipt>
|
|
87
90
|
flushQueue(): Promise<{ ok: boolean; line: string }>
|
|
88
91
|
setStandby(on: boolean, reason: string): Promise<{ ok: boolean; line: string }>
|
|
@@ -115,9 +118,11 @@ export interface PanelApi {
|
|
|
115
118
|
/**
|
|
116
119
|
* Tell the cache which entry's detail view is open (null = closed). While an id is set the
|
|
117
120
|
* `detail` block joins the wanted set; `file` selects the repo-relative path to serve (the first
|
|
118
|
-
* discovered file when omitted)
|
|
121
|
+
* discovered file when omitted) and `source` the read-only preview family the id addresses
|
|
122
|
+
* (P249; absent/`entry` is the original entry-id discovery). All three are cached options, so an
|
|
123
|
+
* unchanged call rebuilds nothing.
|
|
119
124
|
*/
|
|
120
|
-
setDetail(id: string | null, file?: string | null): void
|
|
125
|
+
setDetail(id: string | null, file?: string | null, source?: DetailSource | null): void
|
|
121
126
|
/**
|
|
122
127
|
* Page 5's demand reads (pulse-key-replies): the list cursor (`before`, null = the newest page and
|
|
123
128
|
* null also drops the list from the wanted set when the page is parked) and the open viewer's
|
|
@@ -288,6 +293,7 @@ export function App({
|
|
|
288
293
|
// The open detail view's entry id (the board page's Enter / a click on the focused card), its
|
|
289
294
|
// tab and its document scroll. The view is read-only: no key of its own beyond navigation.
|
|
290
295
|
const [detailId, setDetailId] = useState<string | null>(null)
|
|
296
|
+
const [detailSource, setDetailSource] = useState<DetailSource>('entry')
|
|
291
297
|
const [detailIndex, setDetailIndex] = useState(0)
|
|
292
298
|
const [detailScroll, setDetailScroll] = useState(0)
|
|
293
299
|
// Page 5 (pulse-key-replies): the cursor chain, the stable-number focus, the open body and the
|
|
@@ -425,6 +431,7 @@ export function App({
|
|
|
425
431
|
}
|
|
426
432
|
setViewEntry(null)
|
|
427
433
|
setDetailId(null)
|
|
434
|
+
setDetailSource('entry')
|
|
428
435
|
setDetailIndex(0)
|
|
429
436
|
setDetailScroll(0)
|
|
430
437
|
api.savePage(next)
|
|
@@ -692,14 +699,24 @@ export function App({
|
|
|
692
699
|
setBusy(true)
|
|
693
700
|
try {
|
|
694
701
|
const r = await api.send(text)
|
|
695
|
-
setReceipt(r.state === 'error' ? r : { ...r, detail: '' })
|
|
696
702
|
setStatus(null)
|
|
697
|
-
if (r.state
|
|
703
|
+
if (r.state === 'error') {
|
|
704
|
+
// The error class keeps every word and stays in the editor: nothing durable holds the text,
|
|
705
|
+
// so the input line is the retry handle and the next Enter tries again (the receipt rides
|
|
706
|
+
// the hint row while the compose stays open).
|
|
707
|
+
setReceipt(r)
|
|
708
|
+
} else if (api.clearDraft()) {
|
|
709
|
+
// Settled and the file is empty: the input line may follow it (memory = disk).
|
|
698
710
|
updateDraft('', false)
|
|
699
711
|
setPoint(0)
|
|
700
|
-
|
|
712
|
+
setReceipt({ ...r, detail: '' })
|
|
713
|
+
setComposing(false)
|
|
714
|
+
} else {
|
|
715
|
+
// Settled, but `state/draft.md` could not be emptied: the memory copy must not be dropped
|
|
716
|
+
// (that was the ghost draft), so the words stay in the editor and the receipt names the
|
|
717
|
+
// file it could not empty.
|
|
718
|
+
setReceipt({ ...r, detail: fill(stringsRef.current.draftNotCleared, { file: 'state/draft.md' }) })
|
|
701
719
|
}
|
|
702
|
-
setComposing(false)
|
|
703
720
|
} finally {
|
|
704
721
|
sendingRef.current = false
|
|
705
722
|
setBusy(false)
|
|
@@ -931,8 +948,9 @@ export function App({
|
|
|
931
948
|
const cur = focusRef.current
|
|
932
949
|
let idx = -1
|
|
933
950
|
if (cur) {
|
|
934
|
-
|
|
935
|
-
|
|
951
|
+
// The row is matched by its block scope too: two blocks may draw the same id (P249).
|
|
952
|
+
idx = order.findIndex((r) => r.lane === cur.lane && r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0))
|
|
953
|
+
if (idx < 0) idx = order.findIndex((r) => r.lane === cur.lane && r.id === cur.id)
|
|
936
954
|
}
|
|
937
955
|
if (idx < 0) {
|
|
938
956
|
setFocus(order[0])
|
|
@@ -948,22 +966,27 @@ export function App({
|
|
|
948
966
|
setLaneOffset((prev) => ({ ...prev, [lane]: Math.max(0, Math.min(max, (prev[lane] ?? (win?.offset ?? 0)) + delta)) }))
|
|
949
967
|
}, [])
|
|
950
968
|
|
|
951
|
-
/** Open an entry's detail view: the first tab, from the top (the board page's Enter / a click).
|
|
952
|
-
|
|
969
|
+
/** Open an entry's detail view: the first tab, from the top (the board page's Enter / a click).
|
|
970
|
+
* The source is fixed by the surface that opened it (P249) and rides every reader request. */
|
|
971
|
+
const openDetail = useCallback((id: string, source: DetailSource = 'entry') => {
|
|
953
972
|
setDetailIndex(0)
|
|
954
973
|
setDetailScroll(0)
|
|
974
|
+
setDetailSource(source)
|
|
955
975
|
setDetailId(id)
|
|
956
976
|
}, [])
|
|
957
977
|
|
|
958
|
-
/** Enter on the work page: open the focused row (or the first drawn one, when it left the board).
|
|
978
|
+
/** Enter on the work page: open the focused row (or the first drawn one, when it left the board).
|
|
979
|
+
* The page-wide order carries each row's block scope, and the scope picks the reader's source. */
|
|
959
980
|
const openWorkFocused = useCallback(() => {
|
|
960
981
|
const order = boardOrderRef.current
|
|
961
982
|
if (!order.length) return
|
|
962
983
|
const cur = focusRef.current
|
|
963
984
|
const hit = cur
|
|
964
|
-
? order.find((r) => r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0)) ??
|
|
985
|
+
? order.find((r) => r.lane === cur.lane && r.id === cur.id && (r.nth ?? 0) === (cur.nth ?? 0)) ??
|
|
986
|
+
order.find((r) => r.lane === cur.lane && r.id === cur.id)
|
|
965
987
|
: undefined
|
|
966
|
-
|
|
988
|
+
const row = hit ?? order[0]
|
|
989
|
+
openDetail(row.id, rowSourceOf(row.lane))
|
|
967
990
|
}, [openDetail])
|
|
968
991
|
|
|
969
992
|
// ---- project settings (P22/B2): the view's focus walk, its origin and its row opening.
|
|
@@ -1399,7 +1422,10 @@ export function App({
|
|
|
1399
1422
|
const key = row.key
|
|
1400
1423
|
if (key.class === 'refuse') {
|
|
1401
1424
|
setReceipt(null)
|
|
1402
|
-
|
|
1425
|
+
// P266: the route speaks in plain language; the raw key only leads when the row has no other
|
|
1426
|
+
// name for itself (a key the schema does not know — its row's own text is that raw name).
|
|
1427
|
+
const named = key.known === false ? `${key.name} · ` : ''
|
|
1428
|
+
setStatus(`${named}${key.route || key.warning || stringsRef.current.settingsRefusedRoute}`)
|
|
1403
1429
|
return
|
|
1404
1430
|
}
|
|
1405
1431
|
// The whole-map row's editor is the categories block, never a composed pair list (P232).
|
|
@@ -1481,8 +1507,8 @@ export function App({
|
|
|
1481
1507
|
return
|
|
1482
1508
|
}
|
|
1483
1509
|
const files = detailBlockData?.files ?? []
|
|
1484
|
-
api.setDetail(detailId, files[detailIndexRef.current]?.path ?? null)
|
|
1485
|
-
}, [api, detailId, detailIndex, detailBlockData])
|
|
1510
|
+
api.setDetail(detailId, files[detailIndexRef.current]?.path ?? null, detailSource)
|
|
1511
|
+
}, [api, detailId, detailIndex, detailSource, detailBlockData])
|
|
1486
1512
|
|
|
1487
1513
|
/** Page 5's slots as the last snapshot carries them (never a re-read of the store). */
|
|
1488
1514
|
const replyEntries = useCallback((): ReplyEntry[] => dataRef.current.blocks?.reply_list?.entries ?? [], [])
|
|
@@ -1663,7 +1689,11 @@ export function App({
|
|
|
1663
1689
|
openWorkFocused()
|
|
1664
1690
|
return
|
|
1665
1691
|
}
|
|
1666
|
-
|
|
1692
|
+
// A preview row's ref (lane = a preview block's scope) is not a kanban card: no cursor is
|
|
1693
|
+
// drawn for it and Enter opens nothing; a step re-anchors to the board (P249).
|
|
1694
|
+
const focus = focusRef.current
|
|
1695
|
+
if (focus && !boardFocusRef(focus)) return
|
|
1696
|
+
const current = resolveFocus(boardRows(), focus)
|
|
1667
1697
|
if (current) openDetail(current.id)
|
|
1668
1698
|
return
|
|
1669
1699
|
}
|
|
@@ -1763,6 +1793,10 @@ export function App({
|
|
|
1763
1793
|
// command's refusal) rides the hint row *above* the input so the input line stays last
|
|
1764
1794
|
// (the IME cursor anchor rule) while the editor stays open with its draft.
|
|
1765
1795
|
...(status && (mode === 'setting' || mode === 'filter') ? [status] : []),
|
|
1796
|
+
// P249: a message send that could not settle cleanly (the error class, or a draft file the
|
|
1797
|
+
// console could not empty) keeps the compose open, so its receipt rides the same row — the
|
|
1798
|
+
// words and the reason are visible together.
|
|
1799
|
+
...(mode === 'message' && receipt ? [receiptLine(receipt, strings)] : []),
|
|
1766
1800
|
mode === 'message'
|
|
1767
1801
|
? strings.composeHint
|
|
1768
1802
|
: mode === 'reason'
|
|
@@ -2322,7 +2356,10 @@ export function App({
|
|
|
2322
2356
|
return
|
|
2323
2357
|
}
|
|
2324
2358
|
if (page === 4 && key.return) {
|
|
2325
|
-
|
|
2359
|
+
// Same rule as the click path: a preview row's ref neither draws nor opens on the kanban.
|
|
2360
|
+
const focus = focusRef.current
|
|
2361
|
+
if (focus && !boardFocusRef(focus)) return
|
|
2362
|
+
const current = resolveFocus(boardRows(), focus)
|
|
2326
2363
|
if (current) openDetail(current.id)
|
|
2327
2364
|
return
|
|
2328
2365
|
}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { randomUUID } from 'node:crypto'
|
|
10
10
|
import { spawn } from 'node:child_process'
|
|
11
11
|
import { writeFileSync } from 'node:fs'
|
|
12
|
-
import { tmpdir } from 'node:os'
|
|
13
12
|
import { join } from 'node:path'
|
|
14
13
|
|
|
15
14
|
/** One bounded subprocess: rc plus the stdout bytes; `null` = the executable does not exist. */
|
|
@@ -86,10 +85,17 @@ export async function readClipboard(run: ClipboardRunner): Promise<ClipboardRead
|
|
|
86
85
|
return null
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
88
|
+
/**
|
|
89
|
+
* The temporary path the paste writes: `<resolved temp root>/teamsmith-paste-<uuid>.<ext>`.
|
|
90
|
+
*
|
|
91
|
+
* P309: the directory is **given** by the caller — the same `team_tmp_root` answer the rest of the
|
|
92
|
+
* tool prints (`capacity.temp_root` in the panel data). Deriving it here again would be a second
|
|
93
|
+
* implementation of the resolution order (`process.env.TMPDIR || tmpdir()` was exactly that), and
|
|
94
|
+
* two answers is how the paste file ends up outside the root `--status`/`--sweep` judge.
|
|
95
|
+
*/
|
|
96
|
+
export function pasteFilePath(mime: string, dir: string | undefined, uuid?: string): string | null {
|
|
91
97
|
const ext = imageExt(mime)
|
|
92
|
-
if (!ext) return null
|
|
98
|
+
if (!ext || !dir) return null
|
|
93
99
|
return join(dir, `teamsmith-paste-${uuid ?? randomUUID()}.${ext}`)
|
|
94
100
|
}
|
|
95
101
|
|
|
@@ -97,7 +103,7 @@ export function pasteFilePath(mime: string, dir = process.env.TMPDIR || tmpdir()
|
|
|
97
103
|
* Write the clipboard image bytes to the temporary path and return it. The panel never deletes the
|
|
98
104
|
* file (the requirement) and the path is the whole edit the console makes.
|
|
99
105
|
*/
|
|
100
|
-
export function writePasteFile(bytes: Buffer, mime: string, dir
|
|
106
|
+
export function writePasteFile(bytes: Buffer, mime: string, dir: string | undefined, uuid?: string): string | null {
|
|
101
107
|
const file = pasteFilePath(mime, dir, uuid)
|
|
102
108
|
if (!file) return null
|
|
103
109
|
writeFileSync(file, bytes)
|
|
@@ -678,13 +678,16 @@ export function parseSendResult(stdout: string): { rc: number; outcome: string;
|
|
|
678
678
|
|
|
679
679
|
/** The one-line receipt shown under the frame, in the active language's voice. */
|
|
680
680
|
export function receiptLine(receipt: Receipt, s: Strings): string {
|
|
681
|
+
// A settled receipt normally shows its canonical one-liner; the App puts a non-empty detail here
|
|
682
|
+
// for the one settle that could not go through cleanly — a draft file it could not empty — so the
|
|
683
|
+
// frame names the file instead of claiming the draft is gone (P249).
|
|
681
684
|
switch (receipt.state) {
|
|
682
685
|
case 'delivered':
|
|
683
|
-
return s.receiptDelivered
|
|
686
|
+
return receipt.detail || s.receiptDelivered
|
|
684
687
|
case 'queued':
|
|
685
|
-
return s.receiptQueued
|
|
688
|
+
return receipt.detail || s.receiptQueued
|
|
686
689
|
case 'held':
|
|
687
|
-
return s.receiptHeld
|
|
690
|
+
return receipt.detail || s.receiptHeld
|
|
688
691
|
default:
|
|
689
692
|
return fill(s.receiptError, { detail: receipt.detail || s.sendUnconfirmed })
|
|
690
693
|
}
|
|
@@ -22,7 +22,7 @@ import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs
|
|
|
22
22
|
import { dirname, join, resolve } from 'node:path'
|
|
23
23
|
import { fileURLToPath } from 'node:url'
|
|
24
24
|
import { sanitizeDeep } from './sanitize.js'
|
|
25
|
-
import type { ActivityBlock, PanelBlocks, PanelData } from './types.js'
|
|
25
|
+
import type { ActivityBlock, DetailSource, PanelBlocks, PanelData } from './types.js'
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* M40 — the panel's identity is its own root (`--root`, else cwd), never an inherited `TEAM_*`.
|
|
@@ -120,6 +120,12 @@ export interface DataOptions {
|
|
|
120
120
|
blocks?: readonly BlockName[]
|
|
121
121
|
/** The detail view's entry id; while set, `detail` joins the wanted set (null/absent = parked). */
|
|
122
122
|
detailId?: string | null
|
|
123
|
+
/**
|
|
124
|
+
* The read-only preview source the open detail view addresses (change:
|
|
125
|
+
* panel-preview-and-compose). Absent/`entry` keeps the original entry-id discovery; the other
|
|
126
|
+
* three become an explicit `--source` on the reader's argv.
|
|
127
|
+
*/
|
|
128
|
+
detailSource?: DetailSource | null
|
|
123
129
|
/** True while the project-settings view is open; only then does `settings` join the wanted set. */
|
|
124
130
|
settingsOpen?: boolean
|
|
125
131
|
/** The detail file to serve with `--file` (must be one of the discovered paths). */
|
|
@@ -187,14 +193,16 @@ const BLOCK_SPECS: Record<BlockName, BlockSpec> = {
|
|
|
187
193
|
patrol: { ttlMs: 15000, timeoutMs: 10000 },
|
|
188
194
|
health: { ttlMs: 600000, timeoutMs: 30000 },
|
|
189
195
|
// The detail reader rides the open view: the App forces it on open and on a tab switch, so its TTL
|
|
190
|
-
// only covers a stale refresh while the view stays open. The `--id`/`--file` arguments
|
|
191
|
-
// the live options;
|
|
196
|
+
// only covers a stale refresh while the view stays open. The `--id`/`--source`/`--file` arguments
|
|
197
|
+
// come from the live options; all are cleared when the view closes. The `entry` source stays
|
|
198
|
+
// implicit so an existing caller's argv is byte-identical.
|
|
192
199
|
detail: {
|
|
193
200
|
ttlMs: 15000,
|
|
194
201
|
timeoutMs: 10000,
|
|
195
202
|
extraArgs: (opts) => {
|
|
196
203
|
if (!opts.detailId) return []
|
|
197
204
|
const args = ['--id', String(opts.detailId)]
|
|
205
|
+
if (opts.detailSource && opts.detailSource !== 'entry') args.push('--source', opts.detailSource)
|
|
198
206
|
if (opts.detailFile) args.push('--file', String(opts.detailFile))
|
|
199
207
|
return args
|
|
200
208
|
},
|