Skip to content

Respect --path in pull-reprint to overwrite or create a site at that location#3842

Draft
epeicher wants to merge 1 commit into
trunkfrom
stu-1828-when-passed-a-path-option-the-pull-reprint-command-should
Draft

Respect --path in pull-reprint to overwrite or create a site at that location#3842
epeicher wants to merge 1 commit into
trunkfrom
stu-1828-when-passed-a-path-option-the-pull-reprint-command-should

Conversation

@epeicher

@epeicher epeicher commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude Code (Opus 4.8) wrote the --path handling and its tests; I drove the design decisions (when to overwrite vs. create, the PR base), reviewed the diff, and verified each routing mode live. Lint, typecheck, and the pull-reprint unit tests pass.

Proposed Changes

studio pull-reprint ignored --path and always created a new site under ~/Studio/<name-from-url>, so there was no way to pull into a chosen location or refresh an existing local site.

The resolved path — an explicit --path, or the current directory by default — now decides the target:

Situation Result
A Studio site is registered at the path Overwrite it, like studio pull — the site keeps its identity (same id, port, URL, settings) rather than becoming a new entry
Explicit --path, no site there Create the new site at that path, named after the folder
No --path, current dir isn't a site Unchanged — create under ~/Studio/<name-from-url>

Overwriting replaces a site's files and database, so it asks for confirmation first (honoring --yes and non-interactive callers) and leaves everything untouched if you decline.

Testing Instructions

Needs a built CLI and STUDIO_ENABLE_PULL_REPRINT=true. The path routing below is observable from the early Site directory: / prompt output; a full pull additionally needs a packaged build that bundles reprint.phar.

  1. Create at an explicit path… pull-reprint --url <site> --path ~/Studio/my-new-site --verboseSite directory: ~/Studio/my-new-site, site named my-new-site (not the URL default).
  2. Overwrite by path — point --path at a registered site's folder → prompt reads "This will overwrite the local site …"; declining leaves the site and cli.json untouched.
  3. Overwrite the current site — run with no --path from inside a registered site's directory → same overwrite prompt.
  4. Default create — run with no --path from a non-site directory → new site under ~/Studio/<name-from-url>.
  5. Unit testsnpm test -- apps/cli/commands/tests/pull-reprint.test.ts

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

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