Public: anyone can read this; the crew can change it.

Main is green again: the forge pill's script fits its 24 KB budget #10876

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The forge pill's script, served from `/__forge/toolbar-*.js`, is now 22,255 bytes. It was 24,802, over the 24,576 limit, and the limit stays as it is. Both tests that had turned main red pass again.

shipped production is serving it deploy 7bd4f86

opened this

The forge pill's script, served from /__forge/toolbar-*.js, is now 22,255 bytes. It was 24,802, over the 24,576 limit, and the limit stays as it is. Both tests that had turned main red pass again.

What changed:

  • src/apps/toolbar.ts: the script's source is now kept in toolbarSource, with its comments left in for readers.
  • toolbarJs: this is what gets served. It is that source with every line that holds only a // comment removed, which saves about 2.5 KB. No code changes, so the keyboard behaviour from #10846 is untouched: arrow keys move the pill to another corner, Tab stays inside the open panel, and Escape closes it and puts focus back on the pill.
  • test/apps-toolbar.test.ts: the "served … small, and plain" test now also fails if a comment-only line ever ships again.

Choices:

  • Only lines that are entirely a comment are removed. The one comment that sits at the end of a code line stays, and so does the indentation, so there is no risk of cutting into a string.
  • I didn't add a minifier or any new dependency. About 2.3 KB is left before the limit.

How to check: run bun test test/apps-toolbar.test.ts test/apps-crew-pill.test.ts test/toolbar-keyboard.test.ts. The 17 test files that use the pill script all pass here: 187 passed, 4 skipped, 0 failed. bun scripts/gate.ts and bun x tsc --noEmit are clean.

🤖 Generated with Claude Code

Closes #10869

commented

The forge pill's script, served from /__forge/toolbar-*.js, is now 22,255 bytes. It was 24,802, over the 24,576 limit, and the limit stays as it is. Both tests that had turned main red pass again.

What changed:

  • src/apps/toolbar.ts: the script's source is now kept in toolbarSource, with its comments left in for readers.
  • toolbarJs: this is what gets served. It is that source with every line that holds only a // comment removed, which saves about 2.5 KB. No code changes, so the keyboard behaviour from #10846 is untouched: arrow keys move the pill to another corner, Tab stays inside the open panel, and Escape closes it and puts focus back on the pill.
  • test/apps-toolbar.test.ts: the "served … small, and plain" test now also fails if a comment-only line ever ships again.

Choices:

  • Only lines that are entirely a comment are removed. The one comment that sits at the end of a code line stays, and so does the indentation, so there is no risk of cutting into a string.
  • I didn't add a minifier or any new dependency. About 2.3 KB is left before the limit.

How to check: run bun test test/apps-toolbar.test.ts test/apps-crew-pill.test.ts test/toolbar-keyboard.test.ts. The 17 test files that use the pill script all pass here: 187 passed, 4 skipped, 0 failed. bun scripts/gate.ts and bun x tsc --noEmit are clean.

🤖 Generated with Claude Code

Approved

Verified by applying the same regex to the base source: 24802 -> 22255 bytes, still parses as JS. Only whole-line comments are dropped, so the keyboard behaviour of #10846 is untouched, and no dependency or ceiling change. The test guards both size and comment-free output. Next two things: (1) the remaining ~2.3 KB headroom will vanish with the next pill feature, so track a real split of the pill script (keyboard module vs. panel) before it goes red again; (2) the strip regex would eat a line starting with // inside a multi-line template string in the source, so keep such text off line starts or have the test assert on a known-sensitive snippet.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs