patties add --view / patties view
shadcn lets you preview a registry item's source before installing (view /
Purpose
shadcn lets you preview a registry item's source before installing (view / add --view). patties has no pre-install preview — --dry-run shows the file and dep plan but not the source (matrix §1 view, §2 --view — gap). The matrix rates this cheap to add on top of --dry-run and a clean win for the "see before you stamp" gap ("Gaps worth an RFC" #4).
Usage
patties add --view <component> # print the component's source + metadata
patties view <component> # alias of the above
patties add --view --dry-run <c> # --view implies read-only; --dry-run is redundant but allowed
--view never writes. It is a strict superset of --dry-run's information: the plan plus the actual source that would be stamped.
Behavior
- Load the catalog and resolve the named component (reuse
resolveNames,add.ts:78). Unknown name →EXIT.USAGE, same message asadd. - Print a metadata header: name, phase,
kind,island,status, declaredpeerDeps,internalHelpers,tokens— the same fields--dry-runsurfaces (add.ts:100,118). - For each file in
entry.files, read the template fromtemplatesDirand print its full source, fenced with the destination path as a heading so the user sees exactly what lands where. - With a TTY, apply lightweight syntax styling via the ANSI helpers; when piped, emit plain text so
patties view button > button.tsxis a usable escape hatch. --viewis read-only; never patchespackage.json, never merges tokens.
Relationship to --dry-run and --diff
--dry-run(shipped,add.ts:107): plan only — which files are new/exist, dep diff, token/helper plan. No source.--view(this spec): plan + source of the catalog template.--diff([[cli/12-add-update-diff]]): catalog source vs the user's stamped file — only meaningful once stamped.
--view answers "what will I get?"; --diff answers "how did mine drift?".
Acceptance criteria
patties add --view buttonprints the metadata header and the full source of every file in the button entry, writes nothing, exitsEXIT.OK.patties view buttonbehaves identically (alias).patties add --view nonexistentexitsEXIT.USAGEwith the unknown-component message.- Output is syntax-styled on a TTY and plain when piped; piping a single-file component yields valid
.tsxsource. - No
package.json,tokens.css, or_internal/writes occur during--view.