Port an HTML5 parser from Python to JavaScript with Codex CLI
- Posted
- by Simon Willison
- Last checked
- Method:
- How we verify
Evidence: Screenshots or logsThe source shows screenshots, a transcript or the agent's output.
Outcome
Codex CLI (GPT-5.2) ran for hours largely unattended and produced about 9,000 lines of dependency-free JavaScript passing 9,200 html5lib tests, in about 4.5 hours start to finish.
Poster says:Passes 9,200 html5lib tests
This is the source's own number. We haven't measured it.
Agent
Prompt Original prompt
Exact prompt as published in the source.
We are going to create a JavaScript port of ~/dev/justhtml - an HTML parsing library that passes the full ~/dev/html5lib-tests test suite. It is going to have a similar API to the Python library but in JavaScript. It will have no dependencies other than raw JavaScript, hence it will work great in the browser and node.js and other environments. Start by reading ~/dev/justhtml and designing the user-facing API for the new library - create a spec.md containing your plan.
Try this in:
Sends the Original prompt shown above. ChatGPT and Grok open with it filled in, and ChatGPT may send it straight away. Gemini opens empty, so we copy the prompt for you to paste. Every button also copies it.
Opens in a new tab. We don't see what you send.
These links are only a shortcut. We're not affiliated with OpenAI, Google or xAI, and your results may not match the source.
Optional stronger version
Our rewrite with extra checks. The poster didn't test it.
Goal: Create a dependency-free JavaScript port of ~/dev/justhtml that passes the full html5lib-tests suite. Inputs (fill in or confirm): - Source library path (~/dev/justhtml) - Test suite path (~/dev/html5lib-tests) - Target runtimes (browser and Node.js) Rules: - Mirror the Python API and module structure so behaviour can be compared file by file. - Wire up the test runner first, then port until test counts climb; commit at milestones. - No dependencies beyond plain JavaScript. - Keep a progress log: tests passing per category after each session. - Commit after each milestone with the current pass count in the message. - Keep zero runtime dependencies; flag any place you'd want one. - Write a short README with usage for browser and Node. Checkpoint: Ask before deleting or rewriting large sections that already pass tests. If you get stuck: If a test category stalls, write down the failing cases and move on; come back after. If a login, CAPTCHA or two-step code appears, stop and ask me to handle it; never guess or store passwords. Verify before you finish: Run the full suite in Node and a quick smoke test in a browser. Output: The port, the runner, the progress log and the final pass count. Done when: the full html5lib test suite passes in Node with no dependencies.
Source
https://simonwillison.net/2025/Dec/15/porting-justhtml/
Related cases
- Port a backend to Convex in four hours with Factory's DroidRecreated promptEvidence: Described by poster
The poster reports that Factory's Droid ported their tRPC/Drizzle custom backend to Convex in about 4 hours, with some bugs left to fix.
Factory Droid · Coding · Source date:
- Automate defect remediation across C/C++ codebases with Codex CLIRecreated promptEvidence: Company case study
According to OpenAI's case study, Cisco's Codex CLI defect-repair workflow raised defect resolution throughput 10–15x, and Codex build optimization saved more than 1,500 engineering hours a month.
According to OpenAI:10–15x defect resolution throughput
OpenAI Codex CLI · Coding · Source date:
- Upgrade a plugin to a new framework alpha with Codex CLIEvidence: Screenshots or logs
A one-line `codex exec` loop read the Datasette 1.0a20 upgrade docs, fixed the failing tests, and got the datasette-checkbox plugin passing again.
OpenAI Codex CLI · Coding · Source date: