try-pr.sh: try a pull request the cheapest way, live when it needs no build
Leo: "if you could just, hot reload and test out the f***ing fix right then and there, without much fanfare at all ... and it's still like the same kind of flow, right?"
Leo-ask: ask-ffdcb76e34
What
scripts/cmux-next/try-pr.sh <PR> is one command for trying a PR. It reads the PR's diff with git (no GitHub API), sorts it with scripts/cmux-next/live_apply.py, and takes the cheapest path:
- web-live: runs
web-overlay.sh follow <PR>, so the running app hot-reloads the PR's web UI in seconds with no build. - no-app (CI, tests, docs) and ios-only: reports that there is nothing to try in the Mac app.
- daemon, swift-live, rebuild: says why it needs a new binary (a stored property, a changed signature, a new file, a resource), and with
--buildrequests the same fleet dev build as today, taggedpr-<N>.
--dry-run prints the verdict and the command without running it. The rules come from the live-apply study of 8,315 merged PRs: 66% of NEXT-era PRs that touch the app needed no new binary, and most of those are web changes. The hot-reload doc gets a row and a section.
Not in this PR: injecting Swift into the app itself. The view shell has live code today (#35314), but the app is not linked for it yet. For a body-only Swift change the script says it is injectable later and needs a dev build for now.
Verification
python3 -m unittest scripts/cmux-next/tests/test_live_apply.py: all 10 tests pass, including a real git range.try-pr.sh N --dry-run --buildon merged PRs: #35314 → rebuild (new files, Package.swift), #35408 → no-app, #35206 and #35205 → web-live (web-overlay.sh follow).prepush-gate.py: no new violations.
Observed / Not run
Not run: web-overlay.sh follow on a Mac against a live app. That path is the existing, unchanged script. A real --build submission was not run either.
Changelog
none
🤖 Generated with Claude Code
Agent session: agent session
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Adds scripts/cmux-next/try-pr.sh <PR> and live_apply.py for trying a pull request without waiting for a build when none is needed. The script reads the PR's diff with git, classifies it with live_apply.py, and takes the cheapest path: web-only changes go straight to web-overlay.sh follow for live hot-reload, CI/tests/docs changes report nothing to try, and daemon, Swift, or resource changes say why they need a new binary (with --build requesting the fleet dev build tagged pr-<N>). --dry-run prints the verdict and command without running.
Addresses review follow-ups: lockfiles, bundled scripts, and web config (like vite.config.mjs) no longer fall into no-app—the extension rule now runs after the web, resource, and Rust rules. The hot-reload doc gives honest numbers (about half of recent NEXT-era PRs need no new binary) and stops counting swift-live as needing no build. --port with no value prints usage. All 10 tests pass, including dry runs on several merged PRs.