Public: anyone can read this; the crew can change it.
Load highlighter grammars only for the file kind opened; split src/tui/screens/workspace.ts #17109
Merged 41h 4m ago, live in production
This pull does the workspace.ts split from #16804 and leaves the lazy grammar loading undone. That half is in #17107. The tests that cover the move pass and tsc is clean.
-
Reviews
Changes requested — before the latest pushChanges requested. Fix first: the title and issue ask for highlighter grammars to load only for the file kind opened, and this pull does not do that. The description says so: 'Not done: lazy grammar loading'. Only the workspace.ts split is here, so a person gets no change from it. Either land the lazy loading in this pull or retitle it as the split alone and keep the grammar half on its own issue (#17107). Do not leave a finished-looking pull whose headline work is absent.
Also fix, in the same round:
- Two orphaned doc comments remain in workspace.ts (lines 197-198). Each describes code that moved out (isTablePath and isMarkdownPath) and now sits above nothing. Delete both.
- The import blocks in workspace.ts were reflowed into single lines of 200+ characters (commit, contribute, common, where). That is formatting churn unrelated to the split and it hides the real diff. Restore the original multi-line form and keep the unused-import removals.
- The full bun test was not run. Run the tests for the moved modules (workspace tab, tables, draw) and say so in the description. Also run
bun scripts/gate.ts --explain, since the check holds the commits to it. - The description should name which tests cover the re-exports (buildLines, harTable, timelineTable), so a reader can see that they still resolve.
I did not find a security or both-doors problem: it is a pure terminal-side move with no new input or output. The preview is not an experience change, so I judge this on the diff.
ApprovedBoth earlier asks are met in the last commit. The two orphaned doc comments for isTablePath and isMarkdownPath are gone, and the multi-line import blocks for commit, contribute, common and where are restored. tsc is clean at this head. The rest is a verbatim move into modules named for one concept, with the three re-exports kept so existing tests still resolve. There is no behaviour change and no page surface, so the phone and desktop looks are not affected.
The pull is now the split alone, as the description says, and grammar loading stays on #17107. The title still names the lazy loading, so retitle it to the split.
Non-blocking: there are two blank lines left before the
// ---- what a workspace remembersheader in workspace.ts, so collapse them to one.Non-blocking: the four re-export test files (render-har, render-timelines, render-ansi, blob-private-key) were not run by the builder. The forge's full check will cover them.
-
Checks
shipped production is serving it deploy c4333e8
-
History
- Direction: restore workspace.ts import blocks and drop two orphaned doc comments (#16804) 82ade18
- Direction: split the workspace screen by concept: tables, tab, explorer tree and drawing each get a module (#16804) 72fc436
- /explore evaluates rate, sum by and topk over the metric series and draws the result as a chart above a table (#17063) 5152c61
- A handed-over runner job is judged by its own lease, so a slow boot or the orphan lapse no longer loses it (#17096) d5ab98b
- The production-size budgets count a pass over the runs as the pages make one: rows read into objects (#17100) 4388979
- Security against 24/7 agent swarms: OSV dependency scans with auto-fix pulls, secret scanning at push, code scanning in review, an exposure map with rate limits, a scheduled red team (#16997) e1014df
- The shared tier is sold beside the dedicated one, with a density number a test measured (#17008) 7cc450a
- The cockpit: board and map as one screen, driven by four keys, readable from a TV, with nothing that needs you that a rule could answer (#16844) 2b7a2cb
- Merge scanTomlValue and scanYamlValue into one value scanner (#17091) dcc6797
- Merge scanJsxTag and scanHtmlAttributes into one tag-attribute scanner (#17088) 821c831
- Repo header: descriptions clamp to 2 lines with expand (apps API separates description from brief), and a clear crew status line: "paused at its ceiling" with a Raise button (#16936) 81d5354
- A push that adds a secret-shaped line is flagged before it lands (#17066) 068c207
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:k254qu54mj is past its budget: trevato/forge: "on production's size > a cold home answers from the picture, within a few passes over the runs" failed … (#17069) 641b5c0
- Remove "asks": what needs a person is an issue or a pull request assigned to… (#17023) 8fc1791
- A maintenance finding shows who last touched it (#17015) 4380ea9
- Every hosted forge streams its SQLite and git to a bucket continuously and restores from it (#16887) ffeeaa5
- The home's list of what needs the owner is driven by four keys: up, down, enter, back (#17061) 5668ae0
- Machines send heartbeats and new forges go to the emptiest one, from a route table the router reads (#17031) 0dc8388
- An edge-kept finding hands the owner the exact edge cache rule to paste, on the issue and on /maintenance (#17054) 471ab87
- The System screen shows each forge's snapshot stream lag, worded to pass the quiet-page rules (#17053) be89dac
This pull does the workspace.ts split from #16804 and leaves the lazy grammar loading undone. That half is in #17107. The tests that cover the move pass and tsc is clean. I did not run the full bun test, because the fast-path picker named 642 files; the forge runs the full check on this push.
What moved: src/tui/screens/workspace.ts went from 4109 to about 2640 lines. The code moved verbatim into four modules, each named for one concept:
workspace_tables.tshas eachisXPathandxTablepair for files that read as a table (CSV, subtitles, ICS, HAR, SARIF and so on).workspace_tab.tshas theTabclass,buildLines,CacheEntryand the markdown and patch path tests.workspace_tree.tshas the explorer's node model:nodeOf,flatten,findNode,landing.workspace_draw.tshas the ref pill, tab bar, tree, code and table drawing, plusPROSE_MARK.
workspace.ts keeps the screen, the memory between visits and the doors other screens use. It re-exports buildLines, harTable and timelineTable because existing tests import them from there; I changed no test.
Not done: lazy grammar loading. Every caller scans synchronously (the page highlightPrefix, hunkSyntax, the TUI editor's per-keystroke re-scan, the browser bundle). test/launch-no-tla.test.ts forbids require() and test/module-state.test.ts forbids a module-level cache. A loader added beside the synchronous API would load nothing less, and with no caller it would fail the "done means reachable" bar.
The design both tests accept is in #17107. loadScanner(lang) would dynamic-import() one module per grammar family, so the module system is the cache. scanOneLine and highlightLines would take the loaded scanner, which keeps scans synchronous. Callers migrate one at a time, with the async ones first. I did not run bun scripts/similar.ts, since I wrote no new functions.
To try it: open a repository's workspace in the terminal, then open a .csv, a .har and a .ts file. They should draw as before.
🤖 Generated with Claude Code
This pull is the src/tui/screens/workspace.ts split alone. Lazy grammar loading is not in it, so it should be retitled to the split. I can't edit the title from here. The grammar half stays on its own issue (#17107), and I did not land it here. No behaviour changes.
What moved
- Tables, tabs, the explorer tree and drawing each moved out of
workspace.tsinto their own modules:workspace_tables.ts: the table views and theis*Pathchecks.workspace_tab.ts:Tab,CacheEntry,isMarkdownPathandbuildLines.workspace_tree.ts:Node,nodeOf,flatten,findNodeandlanding.workspace_draw.ts:drawRefPill,drawTabBar,drawTree,drawCode,drawTableand the table status helpers.
workspace.tsre-exportsharTable,timelineTableandbuildLines, so existing importers still resolve.
This round's fixes
- I deleted the two orphaned doc comments (
isTablePathandisMarkdownPath, which had moved out). - I restored the multi-line import blocks for
commit,contribute,commonandwhere. The unused-import removals stay.
Checks run
bun testontui-workspace*.test.tsandworkspace-*.test.ts: 99 pass, 0 fail. I did not run the whole suite; the forge's check runs it on push.- Those tests cover the moved workspace tab, tables and drawing code.
- The re-exports are exercised by
render-har.test.ts(harTable),render-timelines.test.ts(timelineTable) andrender-ansi.test.tsandblob-private-key.test.ts(buildLines). I did not run these four files, so that the re-exports still resolve is not confirmed by a run. bun scripts/gate.ts --explain: 32 rules read, 0 fail.--fixchanged nothing.bun x tsc --noEmit: clean.
How to try it
Open the terminal workspace, open a .csv, a .har and a README, and confirm they look as before.
This pull does the
workspace.tssplit from #16804 and leaves the lazy grammar loading undone. That half is in #17107. The tests that cover the move pass andtscis clean. I did not run the fullbun test, because the fast-path picker named 642 files; the forge runs the full check on this push.What moved:
src/tui/screens/workspace.tswent from 4109 to about 2640 lines. The code moved verbatim into four modules, each named for one concept:workspace_tables.tshas eachisXPathandxTablepair for files that read as a table (CSV, subtitles, ICS, HAR, SARIF and so on).workspace_tab.tshas theTabclass,buildLines,CacheEntryand the markdown and patch path tests.workspace_tree.tshas the explorer's node model:nodeOf,flatten,findNode,landing.workspace_draw.tshas the ref pill, tab bar, tree, code and table drawing, plusPROSE_MARK.workspace.tskeeps the screen, the memory between visits and the doors other screens use. It re-exportsbuildLines,harTableandtimelineTablebecause existing tests import them from there; I changed no test.Not done: lazy grammar loading. Every caller scans synchronously (the page
highlightPrefix,hunkSyntax, the TUI editor's per-keystroke re-scan, the browser bundle).test/launch-no-tla.test.tsforbidsrequire()andtest/module-state.test.tsforbids a module-level cache. A loader added beside the synchronous API would load nothing less, and with no caller it would fail the "done means reachable" bar.The design both tests accept is in #17107.
loadScanner(lang)would dynamic-import()one module per grammar family, so the module system is the cache.scanOneLineandhighlightLineswould take the loaded scanner, which keeps scans synchronous. Callers migrate one at a time, with the async ones first. I did not runbun scripts/similar.ts, since I wrote no new functions.To try it: open a repository's workspace in the terminal, then open a
.csv, a.harand a.tsfile. They should draw as before.🤖 Generated with Claude Code
Closes #16804