Setting up your dashboard0 entities found · 9/32 branches scanned
ID:WORK-164Status:draft
Add --site flag to site-scoped CLI commands
Site-scoped commands (inspect, contracts, validate, scaffold-css, package validate) need to know which site they are operating on when the project declares multiple. Add a --site <name> flag that selects an entry from the normalized sites map; for single-site projects the flag is optional and resolves to the lone entry.
plan(v0.11.0): scaffold milestone and 17 work items
Acceptance Criteria
--site <name> flag accepted on refrakt inspect, refrakt contracts, refrakt validate, refrakt scaffold-css, and refrakt package validate
When the project declares exactly one site, the flag is optional and defaults to that site
When multiple sites are declared and --site is omitted, the command errors with a list of available site names
When --site <name> references an undeclared site, the command errors with the available names and a "did you mean?" suggestion
When no sites are declared at all (planning-only repo), site-scoped commands error with a clear "no site configured" message and a hint about adding a site section to refrakt.config.json
--help for each affected command documents the flag
Tests cover: single-site default, multi-site with explicit flag, multi-site without flag (error), unknown site name (error with suggestion), planning-only repo (error)
Approach
Add a resolveSite(config, requested?: string) helper in packages/cli/src/lib/sites.ts that returns { name, site } or throws a structured error.
Each site-scoped command parses --site and calls resolveSite() before doing its work.
Reuse the Levenshtein helper from WORK-162 for "did you mean?" suggestions.