WORK-446
ID:WORK-446Status:done

Multi-site --site targeting and config read/write helpers

Multi-site projects currently make theme install hard-error ("cannot pick a target automatically"). SPEC-110 §3 replaces that with a --site selector and extends the config read/write helpers. The flag's existence rules differ by apply-mode (select an existing site vs. name a new one), so the helpers must support both.

Priority:highComplexity:moderateMilestone:v0.25.0Source:SPEC-110
changeset-release/main View source

Criteria completion

Criteria completion: 5 of 5 (100%) checked; tracking started on Jun 24, no incremental history yet0%25%50%75%100%Jun 24Jul 11

Tracking started Jun 24 — check back for trends.

Branches 3
History 3
  1. 2264093
    Created (done)by github-actions[bot]
  2. f2c6cb8
    Content editedby Claude
    feat(cli): shared install resolver, multi-site --site, framework-aware v
  3. a6bdcba
    Content editedby Claude
    plan(v0.25.0): accept specs/ADRs and decompose into 21 work items

Acceptance Criteria

  • --site <name> selects the target site; inferred when exactly one site exists; when multiple exist and --site is absent, list the site names and exit cleanly (no dead end)
  • readThemeFromConfig / writeThemeIntoConfig accept an explicit site key and can create a new site entry, not only update an existing one
  • Adding a second site to a singular site: config rewrites it to plural sites: { default, <new> }
  • Helpers are shared so the theme / template / preset apply-modes reuse them
  • Tests cover single-site infer, multi-site select, missing-flag listing, and singular→plural rewrite

Approach

Extend the helpers in packages/cli/src/commands/theme.ts / config-file.ts to take a site key and to distinguish "update existing" from "create new" (the latter is what full-site template install needs). Normalise singular↔plural config shapes in one place.

References

  • SPEC-110 §3
  • packages/cli/src/commands/theme.ts, packages/cli/src/config-file.ts, packages/types/src/theme.ts

Resolution

Completed: 2026-06-23

Branch: claude/v0.25.0-impl

What was done

  • install.ts site helpers: listSiteKeys, resolveTargetSite(raw, --site, 'existing'|'new'), setSiteTheme(key), appendSitePreset(key), createSite(key) (migrates singular site: → plural sites:{default,<new>}).
  • themeInstallCommand/themeInfoCommand take --site; ambiguous multi-site lists keys and exits cleanly instead of the old hard error.
  • bin.ts parses --site/--registry for the theme subcommand.
  • Tests cover single-site infer, multi-site select, missing-flag listing, collision on new-site, and singular→plural rewrite.

Notes

  • Helpers live in the shared install module so template (new-site) and preset (append) apply-modes reuse them.