Skip to content

Finish the CLI-parsing migration; make the search index build non-blocking - #211

Merged
KubaO merged 4 commits into
twinbasic:mainfrom
KubaO:staging
Sep 27, 2026
Merged

KubaO merged 4 commits into
twinbasic:mainfrom
KubaO:staging

Conversation

@KubaO

@KubaO KubaO commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

Finishes the CLI-parsing migration on the remaining eight tools, and fixes a main-thread stall the new site search's index build left behind.

  • cli: book/render-book.mjs, all six eval/ tools, and wisdom/wisdom.mjs now parse through lib/cli.mjs, joining the 21 tools it already covered. Each tool keeps its own usage text, exit code and refusal wording (search_quality's "unrecognised argument", wisdom's "Unknown option: X", transcript's --help-without--h). check_cli.mjs gained recorded cases for all eight, bringing the suite to 218 checks (39 probes, 179 cases), plus a kit comparing 26 real invocations of the migrated and unmigrated copies byte for byte.
  • search: building the index (lunr(config), about 1.6 s) ran synchronously on the main thread, so the search box took no keystrokes while "Loading search index..." showed. buildIndexInSlices() now runs the same build (entries, then field vectors, then the token set) 25 ms at a time, yielding to the browser between slices through a MessageChannel message. Measured in headless Chrome, the longest main-thread task dropped from 1.6-1.7 s to 52-54 ms. Both the online client and offline.mjs's copy use it. test/search.test.mjs checks that the sliced index matches lunr(config)'s, and that a mid-build throw still restores lunr.idf.
  • scripts: fixed a check_cli.mjs case that only matched Node's Windows-shaped ENOENT message; Linux names the file without a leading folder. Taught the gate roster (gate-roster.mjs, check_gate_lists.mjs, check_ci_workflows.mjs) to recognize node --test test/<file>.mjs lines, named by path. test/search.test.mjs had been running in test.bat since the previous PR but never in CI; the composite action now runs it too, and test.bat is twelve steps.

build.bat, check.bat and test.bat ran clean at each commit (recorded in builder/PLAN-TOOLING-REVIEW.md).

@KubaO
KubaO merged commit c203d13 into twinbasic:main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant