Merge main into release/3.56.10 (#4160 tui default size)

This commit is contained in:
r committed 2026-10-14 10:58:59 -04:00
commit b91ebff16e
3 files changed
+28 -10

No files matched your search

+6 -5
View File
@@ -71,7 +71,12 @@ jobs:
# 60s (was timing out at 151s before SIGKILL). Most plugins
# still complete in <5s; 300s protects against a genuinely-hung
# smoke while letting the metaharness fleet finish.
run: node scripts/smoke-all-plugins.mjs --timeout 300
# Save the report from the same execution. Re-running the whole fleet
# solely to obtain JSON can exceed this job's ten-minute deadline.
# pipefail preserves the smoke runner's failure exit through tee.
run: |
set -o pipefail
node scripts/smoke-all-plugins.mjs --timeout 300 --format json | tee /tmp/smoke-all-plugins.json
- name: Mod secret screen — every copy matches the origin (ADR-445)
run: node scripts/sync-mod-screen.mjs --check
@@ -147,10 +152,6 @@ jobs:
# verification/skill-mcp-tool-baseline.json; a new one fails. After
# fixing some, run with --update-baseline to lower the floor.
- name: Upload machine-readable report
if: always()
run: node scripts/smoke-all-plugins.mjs --format json > /tmp/smoke-all-plugins.json
- uses: actions/upload-artifact@v4
if: always()
with:
@@ -158,6 +158,20 @@ describe('every page, on a host with no Claude session and no mouse', () => {
})
describe('the terminal loop', () => {
it('a terminal that reports 0 columns draws the page at the default width, not a repeated "T" (#4115)', async () => {
const t = terminal(0, 0)
const running = runTui({ cwd: project, home: join(root, 'home') }, t.io)
await settle()
t.press('q')
await expect(running).resolves.toBe(0)
const text = plain(t.out.join(''))
expect(text).toMatch(/1 Overview {1,3}2 Cost/)
expect(text).not.toContain('Too narrow')
})
it('jumps to a page on a digit, cycles with tab and shift-tab, and the page bar follows', async () => {
const t = terminal()
const running = runTui({ look: 'plain', fps: 0, cwd: project, home: join(root, 'home') }, t.io)
+8 -5
View File
@@ -162,6 +162,9 @@ export function keyOf(chunk: string): Key {
}
}
/** A terminal that reports 0 (or nothing) does not know its size; some `docker exec` without -t and CI `script` wrappers do. Use the default rather than calling it too narrow (#4115). */
const sized = (value: number | undefined, fallback: number): number => (value !== undefined && Number.isFinite(value) && value > 0 ? value : fallback)
/** What the last frame put on the screen, so the next one rewrites only the rows that changed (a moving picture then costs its own rows, not a whole redraw). */
type Memory = { lines: string[]; columns: number; rows: number }
@@ -191,8 +194,8 @@ function writeTick(io: TuiIO, screen: string[], memory: Memory, columns: number,
function paint(session: Session, io: TuiIO, depth: Depth, scroll: number, memory: Memory, clear = false, tick = false, line = ''): number {
const ai = session.page === 'ai' ? session.ai : null
const raw = io.stdout.columns ?? 100
const rows = Math.max(5, io.stdout.rows ?? 30)
const raw = sized(io.stdout.columns, 100)
const rows = Math.max(5, sized(io.stdout.rows, 30))
// Too narrow for a page: say so in a line that fits, rather than a squeezed frame of broken cards.
if (raw < MIN_COLUMNS) {
@@ -238,7 +241,7 @@ function paint(session: Session, io: TuiIO, depth: Depth, scroll: number, memory
async function once(session: Session, io: TuiIO, view: Page): Promise<number> {
session.show(view)
await session.refresh()
const columns = Math.max(MIN_COLUMNS, Math.min(200, io.stdout.columns ?? 100))
const columns = Math.max(MIN_COLUMNS, Math.min(200, sized(io.stdout.columns, 100)))
io.stdout.write(`${navLine(view, columns, 'none')}\n${session.frame(columns, 'none').join('\n')}\n`)
@@ -312,7 +315,7 @@ export async function runTui(options: TuiOptions, io: TuiIO): Promise<number> {
if (button === 64) scroll = Math.max(0, scroll - 3)
else if (button === 65) scroll += 3
else if (button === 0 && y === 1) {
const page = navHit(x, Math.min(200, io.stdout.columns ?? 100))
const page = navHit(x, Math.min(200, sized(io.stdout.columns, 100)))
if (page !== null) open(page)
}
@@ -365,7 +368,7 @@ export async function runTui(options: TuiOptions, io: TuiIO): Promise<number> {
}
const key = keyOf(text)
const page = Math.max(1, (io.stdout.rows ?? 30) - 2)
const page = Math.max(1, (sized(io.stdout.rows, 30)) - 2)
if (key === 'quit') return finish()
if (typeof key === 'object' && key !== null) open(key.page)