Skip to content

feat(cli): add 'appkit add' and 'appkit registry' commands#462

Draft
MarioCadenas wants to merge 13 commits into
mainfrom
feat/registry-cli
Draft

feat(cli): add 'appkit add' and 'appkit registry' commands#462
MarioCadenas wants to merge 13 commits into
mainfrom
feat/registry-cli

Conversation

@MarioCadenas

Copy link
Copy Markdown
Collaborator

Add a shadcn-namespaced component registry workflow to the AppKit CLI:

  • 'appkit add <component...>' ensures the @AppKit registry namespace in the consumer's components.json, then delegates to 'shadcn add @appkit/'.
  • 'appkit registry list' enumerates components from the registry index.

Registry components import primitives from @databricks/appkit-ui (npm peer), so they stay in sync with the installed AppKit version and design tokens.

Add a shadcn-namespaced component registry workflow to the AppKit CLI:

- 'appkit add <component...>' ensures the @AppKit registry namespace in the
  consumer's components.json, then delegates to 'shadcn add @appkit/<name>'.
- 'appkit registry list' enumerates components from the registry index.

Registry components import primitives from @databricks/appkit-ui (npm peer),
so they stay in sync with the installed AppKit version and design tokens.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Serve the registry directly from the public GitHub repo over
raw.githubusercontent.com instead of a placeholder host — no separate
hosting infra needed.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🔬  Run evals on this PR  ·  Go to Evals Monitor →

Fetch registry items ourselves (token-aware) and hand a local file to
'shadcn add', rather than relying on a shadcn namespace — so we control
the auth headers and the internal/private repo works today.

- Token resolved from gh auth token, then APPKIT_REGISTRY_TOKEN /
  GITHUB_TOKEN / GH_TOKEN.
- Private fetch uses the GitHub Contents API (Accept: raw); falls back to
  raw.githubusercontent.com when no token / once the repo is public.
- 'appkit registry list' is token-aware too.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
AppKit registry items are self-contained (import from @databricks/appkit-ui,
no shadcn @/ aliases or registryDependencies), so shadcn's alias resolution
isn't needed. Write item files to their target path directly and install npm
deps with the detected package manager — no components.json required.

- Targets resolved under src/ when present.
- --force to overwrite existing files (refuses by default).
- Warns on any registryDependency rather than silently dropping it.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
'appkit add' is typically run from the repo root, where the frontend lives
in a client/ subdir. Detect the frontend root (dir with components.json or
src/, including common client/frontend/web/app subdirs) and write components
under <frontend>/src/<target>. Install deps into the nearest package.json
(single root package.json in the AppKit app layout). Add --cwd to override.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Server plugins can now be distributed through the same registry as UI
components. 'appkit plugin add <name>' fetches a plugin item, writes it to
plugins/<name>/ (verbatim targets, not under client/src), installs npm deps,
runs 'plugin sync' to register it, and prints the createApp snippet plus any
required env vars.

- Extract shared fetch into registry/client.ts (reused by add + plugin add).
- Detect plugin items by the presence of manifest.json.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
…server/plugins

Remove the separate 'appkit plugin add' command. 'appkit add' now detects the
item kind (plugin = has manifest.json) and routes:
  • UI components → <frontend>/src/components/appkit/
  • server plugins → <server>/plugins/<name>/ (server/ subdir detected)
then installs deps, runs plugin sync for plugins, and prints next steps.
A single call can mix components and plugins.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
After placing a plugin and running sync, 'appkit add' edits the server entry
(server/index.ts etc.) to add the import and insert the plugin into the
createApp({ plugins: [...] }) array, reusing the ast-grep machinery from
'plugin sync'. Best-effort and safe:
  • idempotent — skips if the plugin is already registered
  • only edits the standard plugins:[...] array literal; otherwise falls back
    to printing the manual snippet
  • --no-register opts out of the server edit

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
toPlugin exports are factories, so register as `hello()` (matching server(),
analytics()), not a bare identifier. Insert before the first array element with
its indentation so multi-line plugins arrays keep their formatting instead of
jamming onto the opening-bracket line.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
- 'appkit registry list' shows a VERIFIED ✓ column (from item meta.verified)
  with a --verified filter; JSON output gains a top-level verified field.
- Colorize list + add output with picocolors (green created/registered/✓,
  yellow updated/warnings, red errors, dim hints). Padding is applied before
  coloring so columns stay aligned; picocolors no-ops on non-TTY/NO_COLOR.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Derive a friendly kind per item: a manifest.json marks a plugin; otherwise map
the shadcn registry:* type (component/hook/lib/theme/...). Adds a colorized TYPE
column to the table and a 'kind' field to --json output.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Adds a search subcommand so agents (and people) can match intent to items:
matches all query terms against name, title, description, derived kind, and
item categories. Shares the token-aware index fetch + table/JSON rendering
with 'registry list'. --verified and --json supported.

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle size report

Compared against bundle-size-baseline.json (main).

@databricks/appkit

npm tarball (packed): 658 KB — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 686 KB 240 KB
Type declarations 268 KB 91 KB
Source maps 1.3 MB 445 KB
Other 11 KB 3.7 KB
Total 2.3 MB 779 KB
Per-entry composition (own code — deps external (as shipped))
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
. 74 KB 2.5 KB 76 KB external 243 KB
./beta 39 KB 231 B 39 KB external 117 KB
./type-generator 18 KB 0 B 18 KB external 53 KB

Chunks:

Entry Chunk Load Size (gz)
. index.js initial 70 KB
. utils.js initial 4.0 KB
. remote-tunnel-manager.js lazy 2.5 KB
./beta beta.js initial 30 KB
./beta databricks.js initial 5.7 KB
./beta service-context.js initial 3.1 KB
./beta client-options.js initial 220 B
./beta databricks.js lazy 128 B
./beta index.js lazy 103 B
./type-generator index.js initial 18 KB

@databricks/appkit-ui

npm tarball (packed): 298 KB (+4 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).

dist raw gzip
JS (runtime) 354 KB 117 KB
Type declarations 204 KB 73 KB (+2 B)
Source maps 676 KB 220 KB
CSS 16 KB 3.3 KB
Total 1.2 MB 413 KB (+2 B)
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
Entry Initial (gz) Lazy (gz) Total (gz) node_modules (min) Own code (min)
./js 4.2 KB 49 KB 54 KB 208 KB 11 KB
./js/beta 20 B 0 B 20 B 0 B 0 B
./react 429 KB 49 KB 477 KB 1.3 MB 166 KB
./react/beta 20 B 0 B 20 B 0 B 0 B

Chunks:

Entry Chunk Load Size (gz)
./js index.js initial 4.1 KB
./js chunk initial 120 B
./js apache-arrow lazy 49 KB
./js/beta beta.js initial 20 B
./react index.js initial 427 KB
./react tslib initial 2.1 KB
./react apache-arrow lazy 49 KB
./react/beta beta.js initial 20 B

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