Repository navigation
chore(preview): add a Local Studio (dev:local) worktree preview config - #1796
dawsontoth wants to merge 1 commit into
Conversation
preview-worktree.sh now takes an optional first argument naming the package.json script to run, defaulting to `dev`, so the existing "studio (worktree)" config behaves exactly as before. A new "studio local (worktree)" launch config passes `dev:local`, which serves the worktree in Local Studio mode against the Harper instance at VITE_LOCAL_STUDIO_DEV_URL. Also corrects the script's comments: with no .claude/preview-cwd it serves the checkout it was launched from ($CLAUDE_PROJECT_DIR), not necessarily the main checkout. Closes #1638 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'studio local (worktree)' launch configuration and updates the '.claude/preview-worktree.sh' script to accept a custom dev script argument (defaulting to 'dev'), enabling support for Local Studio mode via 'dev:local'. The feedback suggests enhancing the script's flexibility by forwarding any additional command-line arguments to the underlying 'pnpm run' command.
| # try to reinstall/purge it (the workspace state won't match, and a purge would mutate the | ||
| # shared checkout). We just want to run the dev script against the already-installed modules. | ||
| exec pnpm --config.verify-deps-before-run=false run dev | ||
| exec pnpm --config.verify-deps-before-run=false run "$dev_script" |
There was a problem hiding this comment.
To make the preview script more flexible, consider forwarding any additional arguments passed to the script (such as --force or other Vite flags) to the underlying pnpm run command. This can be achieved cleanly by appending "${@:2}" to the pnpm run command, which safely expands to all arguments starting from the second one (or nothing if none are provided).
| exec pnpm --config.verify-deps-before-run=false run "$dev_script" | |
| exec pnpm --config.verify-deps-before-run=false run "$dev_script" "${@:2}" |
Coverage Report
File CoverageNo changed files found. |
⊙ Problem
The worktree preview launcher (
.claude/preview-worktree.sh) always ranpnpm run dev(Fabric mode), sopreview_startcould not serve a worktree in Local Studio mode (dev:local) against a local Harper instance — useful when central-manager is unavailable or when testing Local Studio itself. Closes #1638.💡 Solution
.claude/preview-worktree.shnow takes an optional first argument naming the package.json script to run, defaulting todev, and passes it quoted topnpm run(the[preview] Serving …line now names the script too). The existingstudio (worktree)config passes no argument, so it behaves exactly as before. In.claude/launch.json, a newstudio local (worktree)config passesdev:local, and the script's usage header names it. Both bind port 5173, so only one can run at a time.dev:locallayers.github/deploy-public-env/.env.dev-local(VITE_LOCAL_STUDIO=true) over.env.local, so it only needsVITE_LOCAL_STUDIO_DEV_URLpointing at a running Harper instance (.env.local.exampledefaults it tohttp://localhost:9925).Also fixed: the script's comments (header, inline) said it falls back to the main checkout when
.claude/preview-cwdis absent. It actually falls back to$root($CLAUDE_PROJECT_DIR, i.e. the checkout it was launched from, which is the worktree itself when a session runs in one). Comment-only.✅ Verification
Route: live smoke of the launcher, without touching port 5173 (other sessions may hold it).
npmfirst onPATHso nothing binds a port: no argument and an empty argument both ranpnpm run dev→npm run dev:fabricwithVITE_LOCAL_STUDIOunset;dev:localran the realdotenv -e .github/deploy-public-env/.env.dev-local -e .env.local -- npm run vite-hostwithVITE_LOCAL_STUDIO=trueandVITE_LOCAL_STUDIO_DEV_URL=http://localhost:9925; an unknown name (nope) failed fast with pnpm'sMissing script: nope, exit 1. Re-run on the final commit for the default anddev:localcases.npmshim that only appends--port 5199 --strictPorttovite-host:bash .claude/preview-worktree.sh dev:localstarted Vite 8.3.2 on 5199,/returned 200, and the servedsrc/config/constants.tscarried"VITE_LOCAL_STUDIO": "true". Server stopped afterwards; 5199 confirmed free.jqparses.claude/launch.json(3 configurations);bash -nclean (shellcheck is not installed here).npx dprint checkexit 0 (coverslaunch.json;.shis outside dprint's scope),npx oxlintexit 0. The pre-commit hook ran the full vitest suite (395 files, 3,663 passed, 11 skipped), lint, format and commitlint. No TypeScript changed, sotsc -bis unaffected. One hook run hit a 30s timeout in the unrelatedsrc/lib/monaco/editorApi.test.tsunder machine load; it passed alone in 2.6s and the retried hook was green.no-receipt(1Password SSH agent refused to sign itsgit fetch) and the Harper domain adjudicator failedauth(expired Claude OAuth session), so outside findings were not adjudicated — an environment gap, not an open finding.🤖 Generated with Claude Code
🤖 Generated by Claude Code (Claude Opus 5.5); posted via @dawsontoth.
Related PRs: none found
Complexity: easy
Review-Coverage: authored=claude; ran=gemini,codex; blocked=cursor-composer(no-receipt),domain(auth); declined=cursor-grok,cursor-kimi,cursor-muse; rounds=1; full=1 @ cb254e7
Review-Attention: read ~3m (raised: degraded review) @ cb254e7