HarperFast / HarperFast/studio
Support dev:local (Local Studio) mode in the worktree preview config
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 4
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 40
Description
## Idea
Let the worktree preview run **Local Studio** mode (`dev:local`), not just Fabric mode (`dev`), through the sanctioned `preview_start` flow. This is handy when central-manager is unavailable or when you want to preview a worktree against a **local Harper instance** (`VITE_LOCAL_STUDIO_DEV_URL`) instead of the cluster backend.
These are two small, backward-compatible tweaks to the `.claude/` preview tooling that were prototyped locally while building #1637 (the custom API explorer) and deliberately kept **out of that PR** to keep it focused. Filing so they aren't lost; tackle if/when desired.
## Proposed changes
1. **`.claude/preview-worktree.sh`** — accept an optional dev-script argument (default `dev`), so the wrapper can run `dev:local` (or any script) instead of hardcoding `dev`. Fully backward-compatible: the existing `studio (worktree)` config keeps working unchanged.
2. **`.claude/launch.json`** — add a `studio local (worktree)` config that runs `preview-worktree.sh dev:local` on port 5173.
`dev:local` layers `.github/deploy-public-env/.env.dev-local` (`VITE_LOCAL_STUDIO=true`) on top of `.env.local`, so it just needs `VITE_LOCAL_STUDIO_DEV_URL` pointed at a running local Harper instance.
## Diff (as prototyped)
```diff
diff --git a/.claude/launch.json b/.claude/launch.json
@@
"runtimeExecutable": "bash",
"runtimeArgs": [".claude/preview-worktree.sh"],
"port": 5173
+ },
+ {
+ "name": "studio local (worktree)",
+ "runtimeExecutable": "bash",
+ "runtimeArgs": [".claude/preview-worktree.sh", "dev:local"],
+ "port": 5173
}
]
}
diff --git a/.claude/preview-worktree.sh b/.claude/preview-worktree.sh
@@
-echo "[preview] Serving $(pwd) on port 5173" >&2
+# The dev script to run is the first argument (e.g. `dev:local` for Local Studio mode), and
+# defaults to `dev` so the existing "studio (worktree)" config keeps working unchanged.
+dev_script="${1:-dev}"
+echo "[preview] Serving $(pwd) on port 5173 via 'pnpm run $dev_script'" >&2
# node_modules is symlinked from the main checkout; skip pnpm's pre-run deps check ...
-exec pnpm --config.verify-deps-before-run=false run dev
+exec pnpm --config.verify-deps-before-run=false run "$dev_script"
```
## Notes / considerations
- Both files are committed/tracked, so this is a real (if tiny) repo change, not local-only config.
- Both `studio (worktree)` and `studio local (worktree)` bind port **5173**; only run one at a time.
- Nice-to-have follow-up: source the dev-script from a gitignored file (like `.claude/preview-cwd`) instead of a launch-config arg, if per-worktree mode selection is preferred over two named configs.
_Prototyped alongside #1637; not committed there._
Contributor guide
Research direction
Read .claude/preview-worktree.sh and .claude/launch.json, then inspect the existing studio (worktree) configuration and preview_start flow. Add the optional dev-script support and the studio local (worktree) entry described in the issue; done means both configs can launch on port 5173, with the existing configuration still defaulting to dev.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100