Skip to content

fix(cli): stop dev loop from writing to an existing source app - #30

Merged
coladarci merged 1 commit into
mainfrom
dev-loop-source-app-safety
Sep 29, 2026
Merged

coladarci merged 1 commit into
mainfrom
dev-loop-source-app-safety

Conversation

@coladarci

Copy link
Copy Markdown
Collaborator

Summary

  • peek dev/peek tunnel pushed a draft to the source app on every restart even when it already existed — unnecessary writes to a real (often production) app just to keep its test-app clone in sync. Now skipped once the app exists; the test app still gets the local manifest pushed to it directly, every run. Still bootstraps the first draft for a genuinely new app, or an existing app row with no version at all to clone from (surfaced this while debugging a registry org-scoping bug against a real production app).
  • Unlinked directory (no .peek-kit.json): dev/tunnel now prompt you to pick an existing app from the registry and link it, instead of silently deriving a slug from package.json and creating that app. Creating a brand-new app stays exclusively apps link <slug> --create / init.
  • dev defaults to an executable ./bin/server (Rails/Phoenix/Go convention) before falling back to <pm> run dev, ahead of --cmd.
  • Dropped the dead --yes/-y flag from dev/tunnel (only gated the old guess-and-create flow); added --debug to both for parity with the other registry commands.
  • Updated the cli skill, the peek platform's manifest-and-deploy skill, and recipes 02/03, which claimed dev always drafts the source app.

Test plan

  • tsc -b clean
  • vitest run — 99/99 passing (updated 2 e2e tests that passed the now-removed --yes flag; added a unit test for createTestApp returning null on "no version to clone")
  • Verified live against a real production app (pricing-schedules) that hit the "existing app with no version to clone" edge case — confirmed the fallback (push first draft, retry clone) unblocks it

🤖 Generated with Claude Code

peek dev/tunnel pushed a draft to the SOURCE app's manifest on every
restart, even when it already existed (the common case: an existing
project pointed at a real, often production, app). That's unnecessary
writing to a real app's registry record just to keep a local clone in
sync with itself, and it surfaces as unrelated 422s whenever the
source app's draft/version state is inconsistent — the test app
clone already gets the local manifest pushed onto it directly.

- serve.ts: skip the source-app draft push once the app already
  exists; go straight to cloning/updating its test app. Still
  bootstraps (pushes the first draft) for a genuinely new app, or an
  existing app row that has no version at all for test-apps to clone
  (createTestApp now signals that case instead of throwing).
- link.ts (new): shared "pick an app from the list and link to it"
  flow, used by both `apps link` and a stricter `dev`/`tunnel`
  preflight — an unlinked directory now prompts you to pick an
  existing app rather than silently guessing a slug from package.json
  and creating it. Creating a brand-new app stays exclusively `apps
  link <slug> --create` / `init`. Drops the now-dead `dev`/`tunnel`
  `--yes` flag that only gated the old guess-and-confirm; adds
  `--debug` to both for parity with the other registry commands.
- dev.ts: default to an executable `./bin/server` (Rails/Phoenix/Go
  convention) before falling back to `<pm> run dev`, ahead of `--cmd`.

Updates the `cli` skill, the peek `manifest-and-deploy` skill, and
recipes 02/03 to stop claiming dev drafts the source app every run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coladarci
coladarci merged commit f737a3e into main Sep 29, 2026
2 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.

1 participant