Skip to content

fix(preview): make words.mjs answer --help and stop early on bad input (#269) - #286

Merged
juancguerrerodev merged 1 commit into
DojoCodingLabs:mainfrom
saurabhbhoir456:fix/preview-words-help-269
Dec 6, 2026
Merged

juancguerrerodev merged 1 commit into
DojoCodingLabs:mainfrom
saurabhbhoir456:fix/preview-words-help-269

Conversation

@saurabhbhoir456

Copy link
Copy Markdown
Contributor

What and why

Closes #269.

apps/mobile/preview/words.mjs now answers --help and -h with its usage line on stdout and exit 0; with no arguments, or only one, it prints the usage line to stderr and exits 1; and a dist folder with no index.html stops before the server starts and before Chromium launches, naming the folder and saying to run pnpm build. No stack traces in any of these cases. The checks run before the existing server and reading flow, which is unchanged: only the command line changed. words.test.mjs covers all three cases by spawning the script (no Chromium needed, since every case stops before it), and the preview test script now includes it.

Vision fit

Principle 7, small, typed and tested, and the contributor-tools side of it: a rough command line that stack-traces on --help now refuses bad input with a short message, like its siblings in scripts/devices, and the behavior is pinned by tests.

Non-negotiables

  • This keeps every non-negotiable in AGENTS.md as it is.
  • Or it changes one, and this is the accepted RFC: n/a

Checklist

  • It closes one issue, linked above, or it's a small fix (a typo, a broken link, a wrong comment). A feature has an accepted proposal.
  • I wrote the failing test first. It fails without this change and passes with it. words.test.mjs was written and run first (0 pass, 3 fail against the old throw), then the checks were added to words.mjs (3 pass).
  • These pass: pnpm check:privacy, pnpm typecheck, pnpm lint, pnpm test and node scripts/guard/check.mjs --patterns scripts/guard/patterns.txt. Run locally: node --test words.test.mjs (3/3), the full preview suite pnpm test in apps/mobile/preview (29/29, after pnpm install --ignore-workspace), the PR guard (ok), and manual node words.mjs --help (exit 0) and node words.mjs (exit 1) checks. The happy path after pnpm build was not run here (it needs a preview build and Chromium); only the early checks changed, ahead of the untouched server and reading flow. CI runs the full root gates.
  • No new network call, telemetry, analytics, ads or crash reporting. (A new request in an app adapter is explained below, with its host, skill and risk.)
  • No new dependency, or the reason for each one is below.
  • Every UI string is in packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes. n/a: dev-only CLI messages in plain English, no UI string changed, no em or en dashes.
  • Tests, fixtures and screenshots use made-up data only. The tests use an empty temp folder only.

Model path

  • This doesn't touch the model path: packages/model, agent, skills or eval, the prompt, the router, tool descriptions, normalizers, examples or the model file.
  • It does. The eval numbers from before and after are below, run as docs/evals.md says. No held-out case was tuned on.

Screenshots

  • No UI change.
  • UI change. Each changed screen is below, in both themes and both languages, with made-up data.
Light Deep sea
es-419
en

New dependencies and network calls

None. No dependency added (the preview lockfile is unchanged); the only network code is the existing localhost preview server, untouched.

AI agents

  • No AI agent wrote any part of this.
  • An AI agent helped. Which one, and what it did: Tinsel Alpha, an AI coding agent running in OpenCode, wrote the failing tests first, then the early checks in words.mjs, and ran the preview suites and manual exit-code checks above, in a session directed by the author.
  • I read and ran everything in this pull request, and I can explain it.

@juancguerrerodev
juancguerrerodev force-pushed the fix/preview-words-help-269 branch from e79d233 to 821b5cf Compare December 6, 2026 09:18
@juancguerrerodev
juancguerrerodev merged commit 821b5cf into DojoCodingLabs:main Dec 6, 2026
4 checks 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.

Preview: make words.mjs answer --help and stop early on bad input

2 participants