kira-kit 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +275 -176
  2. package/dist/index.mjs +4795 -1216
  3. package/package.json +71 -64
  4. package/templates/monorepo/kira-kit.json +21 -0
  5. package/templates/monorepo/packages/ui/package.json +37 -32
  6. package/templates/monorepo/packages/ui/src/components/ui/welcome.tsx +52 -52
  7. package/templates/monorepo/packages/ui/src/index.css +738 -89
  8. package/templates/monorepo/packages/ui/src/styles/kira-utilities.css +649 -0
  9. package/templates/monorepo/packages/ui/tsconfig.json +8 -7
  10. package/templates/next/app/globals.css +731 -83
  11. package/templates/next/app/kira-utilities.css +649 -0
  12. package/templates/next/components/ui/welcome.tsx +62 -62
  13. package/templates/next/kira-kit.json +21 -0
  14. package/templates/next/package.json +31 -28
  15. package/templates/next/types/import-meta.d.ts +11 -0
  16. package/templates/tanstack-start/README.md +16 -16
  17. package/templates/tanstack-start/kira-kit.json +21 -0
  18. package/templates/tanstack-start/package.json +33 -30
  19. package/templates/tanstack-start/src/components/ui/route-transition.tsx +116 -0
  20. package/templates/tanstack-start/src/components/ui/welcome.tsx +52 -52
  21. package/templates/tanstack-start/src/index.css +738 -89
  22. package/templates/tanstack-start/src/lib/view-transition.ts +35 -0
  23. package/templates/tanstack-start/src/router.tsx +23 -15
  24. package/templates/tanstack-start/src/routes/__root.tsx +70 -41
  25. package/templates/tanstack-start/src/styles/kira-utilities.css +649 -0
  26. package/templates/tanstack-start/tsconfig.json +22 -21
  27. package/templates/vite/kira-kit.json +21 -0
  28. package/templates/vite/package.json +31 -28
  29. package/templates/vite/src/components/ui/welcome.tsx +60 -60
  30. package/templates/vite/src/index.css +731 -83
  31. package/templates/vite/src/styles/kira-utilities.css +649 -0
  32. package/templates/vite/tsconfig.node.json +25 -22
  33. package/templates/monorepo/components.json +0 -23
  34. package/templates/next/components.json +0 -23
  35. package/templates/tanstack-start/components.json +0 -23
  36. package/templates/vite/components.json +0 -23
package/README.md CHANGED
@@ -1,176 +1,275 @@
1
- # kira-kit
2
-
3
- The CLI for [Kira Kit](../../#readme) — a shadcn-compatible registry of Base UI
4
- components. Kira Kit is registry-first: installation is delegated entirely to
5
- the pinned `shadcn` CLI (4.22.1), so what you add is exactly what shadcn would
6
- add. The `kira-kit` CLI covers the parts shadcn doesn't:
7
-
8
- - **OKLCH theme generation** from any primary color, with WCAG 2.2 AA verified
9
- contrast
10
- - **Quality checks** over component sources (12 parser-based checks)
11
- - **Project scaffolding** with four embedded templates
12
- - **`migrate`** from the pre-1.0 `registryUrl` setup
13
- - **`build`** for maintainers: the full registry → validate → JSON → docs
14
- pipeline
15
-
16
- ## Requirements
17
-
18
- - Node.js 22+ (or Bun 1.x)
19
- - The `shadcn` CLI is bundled as a pinned dependency — no separate install
20
-
21
- ## Usage
22
-
23
- ### `kira-kit init`
24
-
25
- Set up a project for Kira Kit: delegates base setup to shadcn, registers the
26
- `@kira-kit` namespace in `components.json` (never overwriting an existing
27
- entry), and optionally applies a theme.
28
-
29
- ```bash
30
- kira-kit init
31
- kira-kit init --preset ember-press # one of the 9 curated presets
32
- kira-kit init --primary "#0B7F79" # generate a custom theme
33
- kira-kit init --base-color stone --yes
34
- ```
35
-
36
- Options: `--base`, `--preset`, `--primary`, `--base-color`, `--force`, `-y/--yes`, `-c/--cwd`.
37
-
38
- ### `kira-kit add [items...]`
39
-
40
- Add component(s) via the pinned shadcn CLI. Transitive registry dependencies
41
- are resolved by shadcn automatically.
42
-
43
- ```bash
44
- kira-kit add button
45
- kira-kit add button card dialog --overwrite
46
- kira-kit add --all
47
- ```
48
-
49
- Options: `-o/--overwrite`, `-y/--yes`, `-a/--all`, `-p/--path`, `--dry-run`,
50
- `--diff`, `--view`, `-c/--cwd`.
51
-
52
- ### `kira-kit list` / `view` / `search`
53
-
54
- Registry inspection commands, all delegating to shadcn:
55
-
56
- ```bash
57
- kira-kit list # every available item
58
- kira-kit list --json
59
- kira-kit view button # show item contents
60
- kira-kit search table --json
61
- ```
62
-
63
- ### `kira-kit theme`
64
-
65
- Generate an OKLCH theme palette from a primary color. Produces a
66
- `registry:theme` item with light/dark schemes, chart hues, and APCA-verified
67
- contrast; every token lands in the 4.5:1 (text) / 3:1 (UI) range.
68
-
69
- ```bash
70
- kira-kit theme --primary "#0B7F79" # print the palette
71
- kira-kit theme --primary "#0B7F79" --apply # install into the project
72
- kira-kit theme --primary "#0B7F79" --out my-theme.json
73
- ```
74
-
75
- Options: `--primary`, `--base-color` (neutral, stone, zinc, slate, gray, plus
76
- mauve, olive, mist, taupe), `--out`, `--apply`, `-c/--cwd`.
77
-
78
- ### `kira-kit check [paths...]`
79
-
80
- Run the quality checks over component sources (defaults to
81
- `src/components/ui` + `src/hooks`). Errors fail the run; warnings are advisory
82
- unless `--ci` is passed.
83
-
84
- ```bash
85
- kira-kit check
86
- kira-kit check --format github # GitHub Actions annotations
87
- kira-kit check --ci # strict: every finding fails
88
- kira-kit check src/components/ui/button.tsx
89
- ```
90
-
91
- Checks include: imports-vs-declared-deps, dead animation utilities,
92
- `data-slot`/cva exports, reduced-motion gating, 24×24 target sizes, raw colors,
93
- layout-property transitions, arbitrary Tailwind values, registry metadata,
94
- Base-UI-only primitives, `cn` import source, and suppression hygiene.
95
-
96
- Suppress a false positive with a reason (unused suppressions are themselves
97
- flagged):
98
-
99
- ```tsx
100
- // kira-kit-ignore target-size: decorative icon, no pointer target needed
101
- ```
102
-
103
- Or for a whole file:
104
-
105
- ```tsx
106
- /* kira-kit-ignore-file */
107
- ```
108
-
109
- ### `kira-kit create [dir]`
110
-
111
- Scaffold a new project pre-wired for Kira Kit — `components.json` with the
112
- `@kira-kit` registry, OKLCH theme tokens, the `cn` package, and a welcome
113
- component.
114
-
115
- ```bash
116
- kira-kit create my-app
117
- kira-kit create my-app --template next --install --git
118
- ```
119
-
120
- Templates: `vite`, `next`, `tanstack-start`, `monorepo` (app + ui packages).
121
-
122
- ### `kira-kit migrate`
123
-
124
- Migrate a pre-1.0 project: converts the legacy `registryUrl` field to the
125
- `registries` map, runs `shadcn migrate cn` to switch `clsx`/`tailwind-merge`
126
- imports to the `cn` package, and reports components that have diverged from
127
- the published registry (read-only — it never overwrites your work).
128
-
129
- ```bash
130
- kira-kit migrate
131
- kira-kit migrate --dry-run
132
- ```
133
-
134
- ### `kira-kit build` (maintainers)
135
-
136
- The full registry pipeline, run from the repository root:
137
-
138
- 1. Quality checks (errors block, warnings advise)
139
- 2. Regenerate the 9 theme presets into `src/themes/registry.json`
140
- 3. `shadcn registry validate` over every source registry
141
- 4. `shadcn build` → `public/r/*.json`
142
- 5. Prune stale `public/r` outputs
143
- 6. Generate `public/llms.txt` + per-item markdown docs
144
-
145
- ```bash
146
- kira-kit build
147
- kira-kit build --skip-checks
148
- ```
149
-
150
- ## Exit codes
151
-
152
- | Code | Meaning |
153
- | ---- | -------------------------------------------------- |
154
- | 0 | Success |
155
- | 1 | User error (bad input, validation failure) |
156
- | 2 | Registry problem (invalid/malformed registry data) |
157
- | 3 | Quality checks failed |
158
-
159
- ## Development
160
-
161
- ```bash
162
- bun install
163
- bun run test # vitest
164
- bun run typecheck
165
- bun run build # tsdown → dist/index.mjs
166
- ```
167
-
168
- When source registries change, refresh dependency/file facts with
169
- `bun run scripts/scaffold-sources.ts` (curated titles/descriptions/categories
170
- in `scripts/registry-metadata.json` are preserved).
171
-
172
- Releases use [Changesets](https://changesets.js.org) scoped to this package.
173
-
174
- ## License
175
-
176
- MIT
1
+ # kira-kit
2
+
3
+ The CLI for [Kira Kit](../../#readme) — a source registry of Base UI components.
4
+ `kira-kit` is a self-contained registry client: it resolves items and their
5
+ transitive dependencies, rewrites import aliases to your project layout,
6
+ installs missing npm packages with your detected package manager, and merges
7
+ theme tokens into your global CSS. No other CLI is involved.
8
+
9
+ - **Native install engine** — `init` and `add` work offline against the embedded
10
+ kit assets and any registry reachable by URL or local path
11
+ - **OKLCH theme generation** from any primary color, with WCAG 2.2 AA verified
12
+ contrast
13
+ - **Font & icon options** — six sans and three mono variable fonts, Tabler or
14
+ Lucide icons (install-time import rewrite)
15
+ - **Quality checks** over component sources (13 parser-based checks)
16
+ - **Project scaffolding** with four embedded templates
17
+ - **`migrate`** from legacy `registryUrl` / `clsx` / `tailwind-merge` setups
18
+ - **`build`** for maintainers: the full registry → validate → JSON → docs
19
+ pipeline
20
+
21
+ ## Requirements
22
+
23
+ - Node.js 22.12.0 or later (or Bun 1.x)
24
+ - Consumer projects: React 19.2+ (components use `useEffectEvent`), Tailwind
25
+ CSS v4, TypeScript path aliases (`@/*`)
26
+
27
+ ## Usage
28
+
29
+ The notes below cover common commands. Run `kira-kit <command> --help` for
30
+ the flags supported by the installed CLI. See the
31
+ [CLI documentation](https://kira-kit.vercel.app/docs/cli) for more examples.
32
+
33
+ ### `kira-kit init`
34
+
35
+ Set up a project for Kira Kit:
36
+
37
+ 1. Writes or repairs `kira-kit.json` (`css`, `theme`, standard aliases, the
38
+ `@kira-kit` registry — existing entries are never overwritten)
39
+ 2. Enforces the React 19.2+ floor
40
+ 3. Installs the kit's base CSS (tokens, safelists, keyframes, `@theme inline`)
41
+ and the vendored `kira-utilities.css` — unless a theme already exists
42
+ 4. Installs the base dependencies (`@base-ui/react`, `cn`,
43
+ `class-variance-authority`, the chosen icon library, `tailwindcss`,
44
+ `tw-animate-css`, and the chosen `@fontsource-variable` fonts)
45
+ 5. Applies the kit's default theme — no prompt, no network. `--preset` and
46
+ `--primary` override it.
47
+ 6. With `--icon lucide`, rewrites Tabler icon imports across project sources
48
+ to aliased `lucide-react` imports (local names never change).
49
+
50
+ ```bash
51
+ kira-kit init
52
+ kira-kit init --preset ember-press # one of the 9 curated presets
53
+ kira-kit init --primary "#0B7F79" # generate a custom theme
54
+ kira-kit init --font inter --font-mono jetbrains-mono --icon lucide
55
+ kira-kit init --primary "#0B7F79" --base-color stone --yes
56
+ ```
57
+
58
+ In an interactive terminal (no `--yes`), `init` also prompts for the sans
59
+ font, mono font, and icon library before the theme choice.
60
+
61
+ Options: `--preset`, `--primary`, `--base-color`, `--font` (geist, inter,
62
+ manrope, plus-jakarta-sans, space-grotesk, dm-sans), `--font-mono`
63
+ (geist-mono, jetbrains-mono, fira-code), `--icon` (tabler, lucide), `--force`,
64
+ `-y/--yes`, `-c/--cwd`.
65
+
66
+ ### `kira-kit add [items...]`
67
+
68
+ Add components, hooks, and lib modules. Transitive `registryDependencies` are
69
+ resolved automatically (cycles included), imports are rewritten to your
70
+ aliases, and missing npm deps are installed with pinned ranges where majors
71
+ matter.
72
+
73
+ ```bash
74
+ kira-kit add button
75
+ kira-kit add button card dialog --overwrite
76
+ kira-kit add --all # every ui/hook/lib item
77
+ kira-kit add color-picker --dry-run --diff
78
+ ```
79
+
80
+ `--all` installs components, hooks, and lib modules only — themes and styles
81
+ are excluded (install those explicitly, e.g. `kira-kit add theme-ember-press`).
82
+
83
+ Options: `-o/--overwrite`, `-y/--yes`, `-a/--all`, `-p/--path`, `--dry-run`,
84
+ `--diff`, `--view`, `-c/--cwd`.
85
+
86
+ ### `kira-kit list` / `view` / `search`
87
+
88
+ Registry inspection:
89
+
90
+ ```bash
91
+ kira-kit list # every available item
92
+ kira-kit list --json
93
+ kira-kit view button # show item contents
94
+ kira-kit search table --json
95
+ ```
96
+
97
+ Options: `--json` (list/search), `-c/--cwd`.
98
+
99
+ ### `kira-kit theme`
100
+
101
+ Generate an OKLCH theme palette from a primary color. Produces a
102
+ `registry:theme` item with light/dark schemes, chart hues, and APCA-verified
103
+ contrast; every token lands in the 4.5:1 (text) / 3:1 (UI) range. Font and
104
+ icon options apply on their own too — at least one of `--primary`, `--font`,
105
+ `--font-mono`, or `--icon` is required.
106
+
107
+ ```bash
108
+ kira-kit theme --primary "#0B7F79" # print the palette
109
+ kira-kit theme --primary "#0B7F79" --apply # install into the project
110
+ kira-kit theme --primary "#0B7F79" --out my-theme.json
111
+ kira-kit theme --font manrope --font-mono fira-code --apply
112
+ kira-kit theme --icon lucide --apply
113
+ ```
114
+
115
+ Font application rewrites the `@fontsource-variable` imports and the
116
+ `--font-sans` / `--font-mono` tokens in your global CSS — color tokens are
117
+ never touched and `--force` is not required. `--icon lucide` installs
118
+ `lucide-react` and rewrites every Tabler import in your project sources,
119
+ keeping local names aliased (`import { Check as IconCheck } from
120
+ "lucide-react"`). Filled Tabler icons get `fill="currentColor"` injected and
121
+ Tabler `stroke` width props become `strokeWidth`; a few names map to
122
+ approximate Lucide equivalents. The CLI never removes
123
+ `@tabler/icons-react` from package.json — it prints a hint instead. To
124
+ convert already-installed registry components after switching, run
125
+ `kira-kit add --all --overwrite`.
126
+
127
+ Options: `--primary`, `--base-color` (neutral, stone, zinc, slate, gray, plus
128
+ mauve, olive, mist, taupe), `--font`, `--font-mono`, `--icon`, `--out`,
129
+ `--apply`, `-c/--cwd`.
130
+
131
+ ### `kira-kit check [paths...]`
132
+
133
+ Run the quality checks over component sources (defaults to
134
+ `src/components/ui` + `src/hooks` + `src/lib`). Errors fail the run; warnings
135
+ are advisory unless `--ci` is passed.
136
+
137
+ ```bash
138
+ kira-kit check
139
+ kira-kit check --format github # GitHub Actions annotations
140
+ kira-kit check --ci # strict: every finding fails
141
+ kira-kit check src/components/ui # directories only, not file paths
142
+ ```
143
+
144
+ Checks include: imports-vs-declared-deps, lib resolution, dead animation
145
+ utilities, `data-slot`/cva exports, reduced-motion gating, 24×24 target sizes,
146
+ raw colors, layout-property transitions, arbitrary Tailwind values, spacing
147
+ scale, registry metadata, Base-UI-only primitives, `cn` import source, and
148
+ suppression hygiene.
149
+
150
+ Suppress a false positive with a reason (unused suppressions are themselves
151
+ flagged):
152
+
153
+ ```tsx
154
+ // kira-kit-ignore target-size: decorative icon, no pointer target needed
155
+ ```
156
+
157
+ Or for a whole file — the reason is mandatory in both forms:
158
+
159
+ ```tsx
160
+ /* kira-kit-ignore-file raw-colors: this file defines the raw palette itself */
161
+ ```
162
+
163
+ ### `kira-kit create [dir]`
164
+
165
+ Scaffold a new project pre-wired for Kira Kit — `kira-kit.json` with the
166
+ `@kira-kit` registry, the kit's base CSS and theme tokens, the `cn` package,
167
+ and a welcome component.
168
+
169
+ ```bash
170
+ kira-kit create my-app
171
+ kira-kit create my-app --template next --install --git
172
+ ```
173
+
174
+ Templates: `vite`, `next`, `tanstack-start`, `monorepo` (app + ui packages).
175
+
176
+ Options: `-t/--template`, `--install` / `--no-install`, `--git` / `--no-git`,
177
+ `-y/--yes`.
178
+
179
+ ### `kira-kit migrate`
180
+
181
+ Migrate a legacy project: converts legacy `components.json` configs to the
182
+ `kira-kit.json` schema (mapping `tailwind.css` → `css`, grouping theme/font
183
+ options under `theme`, converting `registryUrl` → `registries["@kira-kit"]`,
184
+ dropping obsolete keys), rewrites `clsx`/`tailwind-merge`/`@/lib/cn` imports to
185
+ the `cn` package (including `twMerge(clsx(…))` → `cn(…)`), and reports
186
+ components that have diverged from the published registry. Your component files
187
+ are never overwritten.
188
+
189
+ ```bash
190
+ kira-kit migrate
191
+ kira-kit migrate --dry-run
192
+ ```
193
+
194
+ Options: `--dry-run`, `-y/--yes`, `-c/--cwd`.
195
+
196
+ ### `kira-kit build` (maintainers)
197
+
198
+ The full registry pipeline, run from the repository root:
199
+
200
+ 1. Quality checks (errors block, warnings advise)
201
+ 2. Regenerate the theme presets + `theme-default` into `src/themes/registry.json`
202
+ 3. Validate every source registry, including full import-graph resolution
203
+ 4. Build `public/r/*.json` (file contents inlined) + `public/schema/*.json`
204
+ 5. Prune stale `public/r` outputs
205
+ 6. Generate `public/llms.txt` + per-item markdown docs
206
+
207
+ ```bash
208
+ kira-kit build
209
+ kira-kit build --skip-checks
210
+ ```
211
+
212
+ ## Registry configuration
213
+
214
+ Items resolve through the `registries` map in `kira-kit.json`. The `{name}`
215
+ placeholder is literal; URLs, `file://` paths, and local paths all work:
216
+
217
+ ```json
218
+ {
219
+ "registries": {
220
+ "@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
221
+ }
222
+ }
223
+ ```
224
+
225
+ The index lives at `/r/registry.json`; JSON schemas are published at
226
+ `/schema/registry.json`, `/schema/registry-item.json`, and
227
+ `/schema/kira-kit.json`.
228
+
229
+ ## Deliberately not supported
230
+
231
+ Features the old shadcn-delegating CLI exposed that the native engine does
232
+ not implement:
233
+
234
+ - Tailwind prefix support and Tailwind v3 / JavaScript output
235
+ - Base-library pickers (Radix / React Aria) and base-color theme pickers —
236
+ the kit is Base UI-only and ships one default theme plus curated presets
237
+ - Registry authentication and env-var interpolation beyond `{name}`
238
+ - Per-file AST `"use client"` detection (the `rsc` config flag drives it)
239
+ - Framework scaffolding inside `init` — use `kira-kit create`
240
+
241
+ ## Exit codes
242
+
243
+ | Code | Meaning |
244
+ | ---- | -------------------------------------------------- |
245
+ | 0 | Success |
246
+ | 1 | User error (bad input, validation failure) |
247
+ | 2 | Registry problem (invalid/malformed registry data) |
248
+ | 3 | Quality checks failed |
249
+
250
+ ## Development
251
+
252
+ ```bash
253
+ bun install
254
+ bun run test # vitest
255
+ bun run typecheck
256
+ bun run build # embed-assets + tsdown → dist/index.mjs
257
+ ```
258
+
259
+ `bun run build` first runs `scripts/embed-assets.ts`, which embeds the kit's
260
+ base CSS, vendored utilities, and default theme tokens into
261
+ `src/generated/assets.ts` and syncs the same CSS into the bundled templates.
262
+ A drift-guard test fails if the embedded assets fall out of sync with
263
+ `src/index.css`.
264
+
265
+ When source registries change, refresh dependency/file facts with
266
+ `bun run scripts/scaffold-sources.ts` (curated titles/descriptions/categories
267
+ in `scripts/registry-metadata.json` are preserved).
268
+
269
+ Releases use [Changesets](https://changesets.js.org) scoped to this package.
270
+
271
+ ## License
272
+
273
+ MIT. The vendored utilities CSS (`src/styles/kira-utilities.css` in the kit,
274
+ embedded as `UTILITIES_CSS`) is derived from shadcn's MIT-licensed Tailwind
275
+ CSS — Copyright (c) 2023 shadcn.