Plan: copy components into your app (npx ember-joinery add)
Joinery ships only as npm add-ons today. This plan adds the same copy path with Joinery's own CLI, and npm stays the default.
Summary
Status: built (2026-11-19) on feature/joe/copy-cli, for 1.1, after 1.0 merged to main.
Decision 2 is recorded as changed in JOINERY_PLAN.md. Where the build differs from the
steps below:
- TypeScript only. The copies are
.gts, so an app needs TypeScript in its Babel config. The CLI warns whenpackage.jsonhas notypescript. A JS mode (shadcn'stsx: false, stripping the types to.gjs) is later work. - End to end in
test-app, not the examples. The examples are plain JS.test-app'spnpm copyrunsember-joinery add --allbefore it typechecks and tests, andtests/integration/copied-components-test.gtsdrives a copied Dialog withDialogHarness. The update path is covered by the CLI's unit tests. - The manifest builder is
packages/cli/lib/build-registry.mjs(step 2'sscripts/copy-manifest.mjs). Its tests arescripts/cli-registry.test.mjs, and the CLI's arescripts/cli.test.mjs, so the existing gate runs them. - Reference test.
scripts/api-docs.test.mjsnow asks a Reference page only of Ember add-ons, and checks that the CLI is documented on the Copy components page. - Updates know what they wrote (beyond shadcn).
joinery.jsonalso records a hash of each fileaddwrote, so an untouched older copy is updated without asking (updatein--dry-run). Only a copy you've edited prompts, or is kept under--yes. Without this,--yesand CI kept every old file, and a stale shared file (messages.ts) could break the build. - No
--no-install. shadcn has no such flag. An@ember-joinery/*package is bumped only when the app's range is older, and aworkspace:orfile:spec is left alone.
Glossary
Not recorded in the original plan.
Problem and context
Not recorded in the original plan.
Goals and non-goals
The idea
shadcn/ui's main selling point is that you own the code: you run one command and the component's source is copied into your app. Joinery ships only as npm add-ons today. This plan adds the same copy path with Joinery's own CLI, and npm stays the default.
npx ember-joinery add dialog
That command writes dialog.gts into app/joinery/, along with button.gts, icon.gts and the
-private files that dialog.gts imports. It then prints, or runs, the install for the npm
packages the copy still needs: @ember-joinery/primitives and lucide.
The copy keeps its jn-* classes and its data-test-jn-* attributes. That means joinery.css
still styles it and @ember-joinery/test-support still drives it. You own the markup and the
behaviour, and your tests don't change.
The feature has three deliverables, and all three land in one PR:
- the CLI (steps 2–4);
- the guide (step 5), covering a new "Copy components" page and a copy command on every component page;
- the marketing site (step 6), covering the hero, Why, Install and the package table.
The CLI is plain Node, with no shadcn or React tooling involved. It ships in the unscoped
ember-joinery package, a name setup-ember-joinery.sh already reserves on npm.
Customers
Not recorded in the original plan.
Internal stakeholders
Not recorded in the original plan.
Users and scenarios
Not recorded in the original plan.
Landscape and constraints
Not recorded in the original plan.
Proposed design
Not recorded in the original plan.
User interface and prior art
Not recorded in the original plan.
Requirements
Not recorded in the original plan.
Data model and API changes
Commands (v1): shadcn's add, flag for flag
Adding and updating are both done with add, as in shadcn. shadcn has no update command:
you update a copy by running add again, and its flags let you look before anything is
written. Joinery keeps shadcn's names, short forms and defaults, so shadcn's docs and habits
carry over unchanged.
npx ember-joinery add dialog # add (and whatever it imports)
npx ember-joinery add dialog --dry-run # update, step 1: which files would change
npx ember-joinery add dialog --diff # step 2: your copy against this version
npx ember-joinery add dialog --diff dialog.gts
npx ember-joinery add dialog --overwrite # step 3: take this version's files
| Flag | Short | Does | Default |
|---|---|---|---|
--yes |
-y |
Skip the confirmation prompt | false |
--overwrite |
-o |
Overwrite existing files | false |
--cwd <cwd> |
-c |
Working directory | current |
--all |
-a |
Add every core component | false |
--path <path> |
-p |
Where the files go | see below |
--silent |
-s |
Mute output | false |
--dry-run |
List what would be written, created, overwritten or skipped (unchanged); write nothing | false |
|
--diff [path] |
Unified diff of your copy against this version: the first 5 changed files, or that one file. Implies --dry-run |
— | |
--view [path] |
Print this version's file: the first 5, or that one. Implies --dry-run |
— |
Behaviour, as shadcn's:
- Existing files. Without
--overwrite, a file that already exists and differs prompts "already exists, overwrite?". With--yes, or when there is no TTY (CI), the file is skipped, and the CLI says which files it skipped. A file identical to this version's is left alone silently. - Dependencies. Components the requested one imports are added too, under the same rules.
So
add dialog --overwritealso updatesbutton.gtsif it changed.--dry-runlists them. - npm packages. It installs the missing ones with the app's package manager, detected from
the lockfile. An update that needs a newer
@ember-joinery/primitivesbumps it. - Where files go. Joinery's counterpart to
components.json'saliases.uiisjoinery.json, holding{ "$schema": …, "path": "app/joinery" }. The firstaddwrites it, with--pathor the default. Later runs read it, so an update goes to the same place without repeating--path. That's the one piece of config. There's noinitcommand; the firstadddoesinit's job. listprints the components this version can add.- Not copied from shadcn: registry names, URLs and namespaces (
@acme/x). The source is this package's own, at its own version.
Security and permissions
Not recorded in the original plan.
Observability and success metrics
Not recorded in the original plan.
Rollout and migration
Not recorded in the original plan.
Work items
Steps (TDD: each script's test first, red, then green)
1. Record the decision
- In
JOINERY_PLAN.md:- add a deviation bullet at the top;
- rewrite decision 2's row to read "npm v2 add-ons, plus
npx ember-joinery addto copy a component's source in"; - add
packages/cli/(ember-joinery) to "Target layout".
- In
CLAUDE.md, add one line to "A component ships whole": a component is copyable, which a test checks.
2. The manifest: scripts/copy-manifest.mjs (+ test)
- Walk
packages/ember/src/components/*.gtsand follow each file's relative imports (./icon.gts,../-private/*.gts). Reuse the import parsing ingen-barrels.mjsandentrypoints.mjs. - Emit
manifest.json, with one entry per public component:- its files;
- the components it needs;
- the npm packages it imports, with their ranges from
packages/ember/package.json(@ember-joinery/primitivespinned to the release version).
- Copy the sources into the CLI package at
prepack.
The copies keep the package's folder layout (components/, -private/), so relative imports
need no rewriting. app/joinery/ sits outside app/components/, so the classic resolver ignores
it. Apps import the copied files by path.
The tests check that:
- every export in
index.tshas an entry; - every relative import is covered;
- no copied file imports
@ember-joinery/ember; - a snapshot of
dialog's entry still matches.
3. The CLI: packages/cli/ (ember-joinery, with a bin)
- Write it in plain Node ESM using only built-ins (
node:fs,node:utilparseArgs). It adds no dependencies. - Its logic is
addandlistover the manifest, plus package-manager detection from the lockfile andjoinery.json. - The diffs come from
node:util'sdiffwhere the Node version has it; otherwise a small line diff is written. No dependency is added for it. - Unit tests in
packages/cli/test/*.test.mjs(node:test) cover:- the dependency closure;
- each flag in the table above, and the existing-file rules (prompt, skip under
--yesand without a TTY, replace with--overwrite, leave identical files alone); - that
--dry-run,--diffand--viewwrite nothing; --diff's five-file limit and its one-file form;- that
joinery.jsonis written on the firstaddand read after; - that an update bumps
@ember-joinery/primitives; - that an unknown name is an error that lists the near matches.
- It is wired up as the other packages are:
files,prepack,legal-files, the.changeset/config.jsonfixed group (it is unscoped, so it has to be added by name),publish.mjs/publish-plan.mjs,release-workflows.test.mjs, andbootstrap-publish.ymlfor its first release.
4. Prove it end to end (CI)
A new CI job:
- packs the CLI;
- runs
npx ./ember-joinery-*.tgz add --all --no-installinto a copy ofexamples/ember-vite-basic, and intoexamples/ember-classic; - runs each example's typecheck and build;
- runs a test that renders the copied
Dialog, drives it withDialogHarness, and ends with an axe audit; - tests the update path: it edits a copied file, then checks that
add dialog --diffshows the edit andadd dialog --yeskeeps it.
That test backs the claim that harnesses work on copies. The harnesses already import nothing
from @ember-joinery/ember, because they work from DOM attributes only.
5. Guide (docs-app/), in the same PR as the CLI
CLAUDE.md requires a public API change to update its guide page in the same PR, and the CLI
is public API. The guide has three parts to change.
a. A new Getting started page: docs-app/app/templates/getting-started/copy.md, "Copy
components".
Add "copy" to getting-started/meta.json's order, after "installation". The page has
these sections:
- Install or copy. npm add-ons get fixes with
pnpm update. Copies are yours to change, and get fixes only when you runaddagain. Most apps install; copy when you need to change a component's markup or behaviour. - Add a component.
npx ember-joinery add dialog, showing the CLI's real output: which files were created and which npm packages were installed. Then where the files land (app/joinery/components/,app/joinery/-private/) and how to import one:import { Dialog } from 'my-app/joinery/components/dialog'. - What stays from npm.
@ember-joinery/primitives,lucide, and Joinery's CSS (thejn-*classes are unchanged, so the import inapp/app.tsstays). Also@ember-joinery/test-support:DialogHarnessdrives a copy as it drives the package's Dialog, so the page shows a test written against the copy. joinery.json. What it holds, and that the firstaddwrites it.- Update a component. shadcn's flow, step by step:
--dry-run, to see which files would change;--diff dialog.gts, to see what's new against your edits;- merge by hand, or
--overwrite; - and that
--yesnever overwrites a file you've changed.
- Options. The flag table from "Commands" above.
- What can't be copied yet. The add-on packages, the primitives and the blocks (for blocks, the example frame's Copy button already copies them).
b. installation.md.
- Under the intro, one paragraph: "or copy the components' source in with
npx ember-joinery add", linking to the new page. - The "Not on npm yet" callout covers the CLI too, until 1.0 publishes.
c. Every component page's ## Installation.
Today each page shows only pnpm add @ember-joinery/ember lucide. Each page shows two
labelled blocks, as ui.shadcn.com's CLI and Manual tabs do:
## Installation
Install the package:
```bash
pnpm add @ember-joinery/ember lucide
```
Or copy the component's source into your app ([Copy components](/getting-started/copy.md)):
```bash
npx ember-joinery add dialog
```
- These are plain code blocks, not a
<Tabs>. The Template tab's copy button already works on code blocks, and the acceptance test renders them with nothing new. - The command names the manifest entry. For a page whose component imports others (Dialog
imports Button), add one line saying
addbrings those along. - About 67 pages change, so a one-off script (not committed) inserts the block.
docs-app/tests/unit/copy-commands-test.tskeeps the pages honest. It fails when:- a page under
templates/components/for a core component has nonpx ember-joinery add <name>; - a page names a component that isn't in the manifest;
- a page for an add-on package has one.
- a page under
- Add-on pages (Chart, Carousel, Data Table, Code Block, File Upload, Tiptap, Power Calendar, Maskito, Formwright) get a line instead: "Copying is not available for add-on packages yet; install the package."
d. The Testing page (testing.md). One sentence: harnesses work on copied components too,
because they look elements up by data-test-jn-*, which a copy keeps.
6. Marketing site (docs/site/index.html) and README, in the same PR
CLAUDE.md requires the hand-written site to change in the same PR, and scripts/site.test.mjs
holds it to the repository. Five places on the page change.
a. Hero (.install, around line 190).
- Keep the one-line
pnpm add @ember-joinery/ember. - Below it, a second
.installline, in the same markup:npx ember-joinery add button. - The
install-notegains a few words: "or copy the source in and own it."
b. #why, "shadcn's design, the Ember way".
Add a short paragraph and a .pair after the existing React-against-Ember pair: "Own the code,
as with shadcn." The pair shows, on one side, npx ember-joinery add dialog and its output, and
on the other, the copied file's first lines and the harness test that still passes against it.
This is the section that says Joinery is shadcn for Ember, so the copy story belongs here and
not only under Install.
c. #install, "Vite or classic, Tailwind or not".
- After the first
.pair(pnpm addand the CSS imports), add a subheading, "Or copy the source in", and a.pair:- on the left,
npx ember-joinery add dialogand an update with--diff/--overwrite; - on the right,
app/joinery/components/dialog.gtsandjoinery.json.
- on the left,
- Then one paragraph: copies keep Joinery's CSS and harnesses, and here's how to update them.
It links to
guide/getting-started/copy.md. - Add a row for
ember-joineryto the package table: "The CLI: copies a component's source into your app, and updates it."
d. #guide.
Add one clause saying each component page shows its copy command beside its install command.
e. scripts/site.test.mjs.
- The existing "names every published package in #install" test fails until
ember-joinery's row is added. That is the red step. - New assertions:
- the hero and
#installboth shownpx ember-joinery add; #installlinks toguide/getting-started/copy.md, and that page exists indocs-app/app/templates;- every component named in an
ember-joinery addsnippet on the page is in the manifest.
- the hero and
f. Screenshots and social card. No change. The component grid's screenshots are unaffected.
g. README.md and packages/cli/README.md.
- The root README's install section gets the same two options as the site's
#install, with the same link. - The CLI's own README (the npm page) holds:
- the command and the flag table;
- the update flow;
- a link to the guide page.
7. Contributor docs and release
CONTRIBUTING.md:- "Porting a component": nothing to do, because the manifest is generated and checked;
- the gate: add the CLI's tests;
- "Releasing": add the new package.
- A changeset for
ember-joinery.
Future work and research
Not in v1 (later)
- Copying from add-on packages (chart, carousel, data-table and the others).
- Copying blocks (the guide's Copy button already covers them).
--css, to own a component's styles (decision 1 above).- Copying primitives.
- An
initcommand. The firstaddwritesjoinery.json. - shadcn's
search,viewandmigratecommands.
Alternatives considered
Decisions to confirm (Joe's call)
- Styles stay in
joinery.css(recommended). Copies render the samejn-*classes, and the app keeps importing Joinery's CSS, which is what decision 13 says. Owning the styles too would mean emitting each component's@applyrules for each style, and that needs Tailwind in the app. Treat that as a later flag (--css, for Tailwind apps). - When it lands: after 1.0 (recommended). The alternative is a unit on the
build/joinery-1.0stacked PR. That PR is otherwise finished, and this feature is a new package with its own release. - Where the source comes from: inside the CLI's own tarball (recommended). The alternative is
fetching from the site. Decision 37 versions all packages together. So
npx ember-joinery@1.2.0 add dialogcopies exactly 1.2.0's source and pins@ember-joinery/primitives@^1.2.0. That works offline and needs no hosting or registry. - Installing dependencies. Option A: detect the package manager from the lockfile and run
the install (
--no-installskips it). Option B: print the command. The recommendation is to run it, since that is what users expect from this kind of tool.
Risks
- Copies drift. Users own their copies, so fixes reach them only when they run
addagain. The guide page says so and shows the--diffflow. - The manifest falls behind the components. A new import or a new component could be missed. The manifest test and the CI job in step 4 catch that.
Open questions
Not recorded in the original plan.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file COPY_PLAN.md at commit a289065. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: COPY_PLAN.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-11-20 | Joe Gaudet | Commit ca6e3e3: feat(cli): copy components into your app with `npx ember-joinery add` (#13) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from COPY_PLAN.md to this page. The text is the text of the Markdown file. |
| 2026-12-04 | Joe Gaudet (agent) | Status Shipped: the CLI package ember-joinery 1.1.0 is on npm. The Markdown file says "Status: built (2026-11-19)". |
The prd skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.