kira-kit 0.5.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.
- package/README.md +11 -9
- package/dist/index.mjs +249 -149
- package/package.json +1 -1
- package/templates/monorepo/kira-kit.json +21 -0
- package/templates/next/kira-kit.json +21 -0
- package/templates/tanstack-start/kira-kit.json +21 -0
- package/templates/vite/kira-kit.json +21 -0
- package/templates/monorepo/components.json +0 -23
- package/templates/next/components.json +0 -23
- package/templates/tanstack-start/components.json +0 -23
- package/templates/vite/components.json +0 -23
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ the flags supported by the installed CLI. See the
|
|
|
34
34
|
|
|
35
35
|
Set up a project for Kira Kit:
|
|
36
36
|
|
|
37
|
-
1. Writes or repairs `
|
|
37
|
+
1. Writes or repairs `kira-kit.json` (`css`, `theme`, standard aliases, the
|
|
38
38
|
`@kira-kit` registry — existing entries are never overwritten)
|
|
39
39
|
2. Enforces the React 19.2+ floor
|
|
40
40
|
3. Installs the kit's base CSS (tokens, safelists, keyframes, `@theme inline`)
|
|
@@ -162,7 +162,7 @@ Or for a whole file — the reason is mandatory in both forms:
|
|
|
162
162
|
|
|
163
163
|
### `kira-kit create [dir]`
|
|
164
164
|
|
|
165
|
-
Scaffold a new project pre-wired for Kira Kit — `
|
|
165
|
+
Scaffold a new project pre-wired for Kira Kit — `kira-kit.json` with the
|
|
166
166
|
`@kira-kit` registry, the kit's base CSS and theme tokens, the `cn` package,
|
|
167
167
|
and a welcome component.
|
|
168
168
|
|
|
@@ -178,11 +178,13 @@ Options: `-t/--template`, `--install` / `--no-install`, `--git` / `--no-git`,
|
|
|
178
178
|
|
|
179
179
|
### `kira-kit migrate`
|
|
180
180
|
|
|
181
|
-
Migrate a legacy project: converts
|
|
182
|
-
`
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
the
|
|
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.
|
|
186
188
|
|
|
187
189
|
```bash
|
|
188
190
|
kira-kit migrate
|
|
@@ -209,7 +211,7 @@ kira-kit build --skip-checks
|
|
|
209
211
|
|
|
210
212
|
## Registry configuration
|
|
211
213
|
|
|
212
|
-
Items resolve through the `registries` map in `
|
|
214
|
+
Items resolve through the `registries` map in `kira-kit.json`. The `{name}`
|
|
213
215
|
placeholder is literal; URLs, `file://` paths, and local paths all work:
|
|
214
216
|
|
|
215
217
|
```json
|
|
@@ -222,7 +224,7 @@ placeholder is literal; URLs, `file://` paths, and local paths all work:
|
|
|
222
224
|
|
|
223
225
|
The index lives at `/r/registry.json`; JSON schemas are published at
|
|
224
226
|
`/schema/registry.json`, `/schema/registry-item.json`, and
|
|
225
|
-
`/schema/
|
|
227
|
+
`/schema/kira-kit.json`.
|
|
226
228
|
|
|
227
229
|
## Deliberately not supported
|
|
228
230
|
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join, posix, relative, resolve } from "node:path";
|
|
5
|
-
import { existsSync as existsSync$1, readFileSync as readFileSync$1, writeFileSync as writeFileSync$1 } from "fs";
|
|
6
|
-
import { join as join$1 } from "path";
|
|
7
5
|
import { z } from "zod";
|
|
8
6
|
import picocolors from "picocolors";
|
|
9
7
|
import { spawn } from "node:child_process";
|
|
@@ -14,11 +12,11 @@ import ts from "typescript";
|
|
|
14
12
|
import { clampChroma, converter, formatCss, parse, wcagLuminance } from "culori";
|
|
15
13
|
import { APCAcontrast, sRGBtoY } from "apca-w3";
|
|
16
14
|
import { createTwoFilesPatch } from "diff";
|
|
17
|
-
import { dirname as dirname$1, join as join$
|
|
18
|
-
import { readFile, readdir, stat, writeFile } from "node:fs/promises";
|
|
15
|
+
import { dirname as dirname$1, join as join$1, normalize } from "node:path/posix";
|
|
16
|
+
import { readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
19
17
|
// src/version.ts
|
|
20
18
|
function getVersion() {
|
|
21
|
-
return "0.
|
|
19
|
+
return "0.6.0";
|
|
22
20
|
}
|
|
23
21
|
/**
|
|
24
22
|
* Error carrying the kira-kit exit-code contract:
|
|
@@ -60,30 +58,31 @@ function printError(error) {
|
|
|
60
58
|
// src/lib/schemas.ts
|
|
61
59
|
const KIRA_NAMESPACE = "@kira-kit";
|
|
62
60
|
const DEFAULT_REGISTRY_URL = "https://kira-kit.vercel.app/r/{name}.json";
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
style: z.string().optional(),
|
|
70
|
-
rsc: z.boolean().optional(),
|
|
71
|
-
tsx: z.boolean().optional(),
|
|
72
|
-
tailwind: z.looseObject({
|
|
73
|
-
css: z.string().optional(),
|
|
74
|
-
baseColor: z.string().optional(),
|
|
75
|
-
cssVariables: z.boolean().optional()
|
|
76
|
-
}).optional(),
|
|
77
|
-
iconLibrary: z.string().optional(),
|
|
61
|
+
const CONFIG_FILENAME = "kira-kit.json";
|
|
62
|
+
const LEGACY_CONFIG_FILENAME = "components.json";
|
|
63
|
+
const kiraThemeConfigSchema = z.looseObject({
|
|
64
|
+
preset: z.string().optional(),
|
|
65
|
+
primary: z.string().optional(),
|
|
66
|
+
baseColor: z.string().optional(),
|
|
78
67
|
font: z.string().optional(),
|
|
79
68
|
fontDisplay: z.string().optional(),
|
|
80
69
|
fontMono: z.string().optional(),
|
|
81
70
|
fontPreset: z.string().optional(),
|
|
82
71
|
radius: z.string().optional(),
|
|
83
|
-
surface: z.string().optional()
|
|
72
|
+
surface: z.string().optional()
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* kira-kit.json as written by kira-kit init. Deliberately loose so unknown
|
|
76
|
+
* user keys are preserved verbatim on write.
|
|
77
|
+
*/
|
|
78
|
+
const kiraConfigSchema = z.looseObject({
|
|
79
|
+
$schema: z.string().optional(),
|
|
80
|
+
css: z.string().optional(),
|
|
81
|
+
rsc: z.boolean().optional(),
|
|
82
|
+
iconLibrary: z.string().optional(),
|
|
83
|
+
theme: kiraThemeConfigSchema.optional(),
|
|
84
84
|
aliases: z.looseObject({
|
|
85
85
|
components: z.string().optional(),
|
|
86
|
-
utils: z.string().optional(),
|
|
87
86
|
ui: z.string().optional(),
|
|
88
87
|
lib: z.string().optional(),
|
|
89
88
|
hooks: z.string().optional()
|
|
@@ -166,31 +165,35 @@ const registryIndexSchema = z.looseObject({ items: z.array(z.looseObject({
|
|
|
166
165
|
})).optional() });
|
|
167
166
|
// src/lib/config.ts
|
|
168
167
|
function findConfigFile(cwd) {
|
|
169
|
-
const path = join
|
|
170
|
-
return existsSync
|
|
168
|
+
const path = join(cwd, CONFIG_FILENAME);
|
|
169
|
+
return existsSync(path) ? path : null;
|
|
170
|
+
}
|
|
171
|
+
function findLegacyConfigFile(cwd) {
|
|
172
|
+
const path = join(cwd, LEGACY_CONFIG_FILENAME);
|
|
173
|
+
return existsSync(path) ? path : null;
|
|
171
174
|
}
|
|
172
175
|
function readConfig(cwd) {
|
|
173
176
|
const configPath = findConfigFile(cwd);
|
|
174
177
|
if (!configPath) return null;
|
|
175
178
|
try {
|
|
176
|
-
const content = readFileSync
|
|
177
|
-
return
|
|
179
|
+
const content = readFileSync(configPath, "utf-8");
|
|
180
|
+
return kiraConfigSchema.parse(JSON.parse(content));
|
|
178
181
|
} catch {
|
|
179
182
|
return null;
|
|
180
183
|
}
|
|
181
184
|
}
|
|
182
|
-
/** Read
|
|
185
|
+
/** Read kira-kit.json without zod defaults; preserves unknown keys on write. */
|
|
183
186
|
function readRawConfig(cwd) {
|
|
184
187
|
const configPath = findConfigFile(cwd);
|
|
185
188
|
if (!configPath) return null;
|
|
186
189
|
try {
|
|
187
|
-
return JSON.parse(readFileSync
|
|
190
|
+
return JSON.parse(readFileSync(configPath, "utf-8"));
|
|
188
191
|
} catch {
|
|
189
192
|
return null;
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
/**
|
|
193
|
-
* Idempotently register the @kira-kit namespace in
|
|
196
|
+
* Idempotently register the @kira-kit namespace in kira-kit.json.
|
|
194
197
|
* Never clobbers other registries or unknown keys.
|
|
195
198
|
*/
|
|
196
199
|
function upsertKiraRegistry(cwd, url = DEFAULT_REGISTRY_URL) {
|
|
@@ -199,22 +202,24 @@ function upsertKiraRegistry(cwd, url = DEFAULT_REGISTRY_URL) {
|
|
|
199
202
|
if (registries["@kira-kit"]) return false;
|
|
200
203
|
registries[KIRA_NAMESPACE] = url;
|
|
201
204
|
next.registries = registries;
|
|
202
|
-
writeFileSync
|
|
205
|
+
writeFileSync(join(cwd, CONFIG_FILENAME), JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
203
206
|
return true;
|
|
204
207
|
}
|
|
205
|
-
/**
|
|
206
|
-
function getRegistryUrl(cwd) {
|
|
207
|
-
const url = readConfig(cwd)?.registries?.[KIRA_NAMESPACE];
|
|
208
|
-
if (!url) return DEFAULT_REGISTRY_URL.replace("/{name}.json", "");
|
|
209
|
-
return url.replace("/{name}.json", "");
|
|
210
|
-
}
|
|
211
|
-
/** Merge a patch into components.json, preserving unknown keys. */
|
|
208
|
+
/** Merge a patch into kira-kit.json, preserving unknown keys. */
|
|
212
209
|
function updateRawConfig(cwd, patch) {
|
|
213
210
|
const next = {
|
|
214
211
|
...readRawConfig(cwd),
|
|
215
212
|
...patch
|
|
216
213
|
};
|
|
217
|
-
writeFileSync
|
|
214
|
+
writeFileSync(join(cwd, CONFIG_FILENAME), JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
215
|
+
}
|
|
216
|
+
/** Merge a patch into kira-kit.json's `theme` object, preserving other fields. */
|
|
217
|
+
function updateThemeConfig(cwd, patch) {
|
|
218
|
+
const merged = {
|
|
219
|
+
...readRawConfig(cwd)?.theme,
|
|
220
|
+
...patch
|
|
221
|
+
};
|
|
222
|
+
updateRawConfig(cwd, { theme: Object.fromEntries(Object.entries(merged).filter(([, value]) => value !== void 0)) });
|
|
218
223
|
}
|
|
219
224
|
// src/lib/logger.ts
|
|
220
225
|
const colors = {
|
|
@@ -559,7 +564,7 @@ const CSS_CANDIDATES = [
|
|
|
559
564
|
];
|
|
560
565
|
const DISPLAY_HEADING_FAMILY = "font-family: var(--font-display, var(--font-sans));";
|
|
561
566
|
function detectCssPath(cwd) {
|
|
562
|
-
const configured = readRawConfig(cwd)?.
|
|
567
|
+
const configured = readRawConfig(cwd)?.css;
|
|
563
568
|
if (configured) return configured;
|
|
564
569
|
for (const candidate of CSS_CANDIDATES) if (existsSync(join(cwd, candidate))) return candidate;
|
|
565
570
|
return existsSync(join(cwd, "app")) ? "app/globals.css" : "src/index.css";
|
|
@@ -635,14 +640,14 @@ function recordFontConfig(cwd, sans, mono, options) {
|
|
|
635
640
|
};
|
|
636
641
|
if (options.display) patch.fontDisplay = options.display.name;
|
|
637
642
|
if (options.fontPreset) patch.fontPreset = options.fontPreset;
|
|
638
|
-
|
|
643
|
+
updateThemeConfig(cwd, patch);
|
|
639
644
|
}
|
|
640
645
|
function wantedFontPackages(sans, mono, display) {
|
|
641
646
|
const wanted = [sans.pkg, mono.pkg];
|
|
642
647
|
if (display && display.name !== sans.name) wanted.push(display.pkg);
|
|
643
648
|
return wanted;
|
|
644
649
|
}
|
|
645
|
-
/** Apply fonts to an existing project: CSS,
|
|
650
|
+
/** Apply fonts to an existing project: CSS, kira-kit.json, missing packages. */
|
|
646
651
|
async function applyFonts(cwd, sans, mono, options = {}) {
|
|
647
652
|
const cssRel = detectCssPath(cwd);
|
|
648
653
|
const cssPath = join(cwd, cssRel);
|
|
@@ -1097,7 +1102,7 @@ function loadItemMetaMap(repoRoot) {
|
|
|
1097
1102
|
// src/core/registry/build.ts
|
|
1098
1103
|
const REGISTRY_SCHEMA_URL = "https://kira-kit.vercel.app/schema/registry.json";
|
|
1099
1104
|
const REGISTRY_ITEM_SCHEMA_URL = "https://kira-kit.vercel.app/schema/registry-item.json";
|
|
1100
|
-
const
|
|
1105
|
+
const KIRA_CONFIG_SCHEMA_URL = "https://kira-kit.vercel.app/schema/kira-kit.json";
|
|
1101
1106
|
function itemPayload(repoRoot, item, baseDir, motion) {
|
|
1102
1107
|
const files = (item.files ?? []).map((file) => ({
|
|
1103
1108
|
path: relative(repoRoot, join(baseDir, file.path)).replaceAll("\\", "/"),
|
|
@@ -1184,7 +1189,9 @@ function writeRegistryOutputs(repoRoot, outDir, root, payloads) {
|
|
|
1184
1189
|
mkdirSync(schemaDir, { recursive: true });
|
|
1185
1190
|
writeJson(join(schemaDir, "registry.json"), z.toJSONSchema(sourceRegistrySchema));
|
|
1186
1191
|
writeJson(join(schemaDir, "registry-item.json"), z.toJSONSchema(registryItemPayloadSchema));
|
|
1187
|
-
writeJson(join(schemaDir, "
|
|
1192
|
+
writeJson(join(schemaDir, "kira-kit.json"), z.toJSONSchema(kiraConfigSchema));
|
|
1193
|
+
const legacySchemaPath = join(schemaDir, "components.json");
|
|
1194
|
+
if (existsSync(legacySchemaPath)) rmSync(legacySchemaPath);
|
|
1188
1195
|
}
|
|
1189
1196
|
// src/generated/assets.ts
|
|
1190
1197
|
const BASE_CSS = "@import \"tailwindcss\";\n@import \"tw-animate-css\";\n@import \"./kira-utilities.css\";\n@import \"@fontsource-variable/geist\";\n@import \"@fontsource-variable/geist-mono\";\n\n/* Flex */\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}flex-{row,row-reverse,col,col-reverse,nowrap,wrap,wrap-reverse}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}justify-{start,end,center,between,around,evenly}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}items-{start,end,center,baseline,stretch}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}gap-{0,1,2,3,4,5,6,8,10,12,16,20,24}\");\n\n/* Box — sizing */\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}{w,h,min-w,min-h,max-w,max-h}-{0,0.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,px,full,fit,min,max}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}w-{auto,screen,svw,lvw,dvw}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}{h,min-h,max-h}-{screen,svh,lvh,dvh}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}{h,min-w,min-h}-auto\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}{max-w,max-h}-none\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}max-w-{prose,3xs,2xs,xs,sm,md,lg,xl,2xl,3xl,4xl,5xl,6xl,7xl}\");\n\n/* Box — spacing */\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}{p,px,py,m,mx,my}-{0,1,2,3,4,5,6,8,10,12}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}{m,mx,my}-auto\");\n\n/* Box — color */\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}bg-{background,foreground,card,popover,border,input,ring}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}{bg,text}-{primary,secondary,muted,accent,destructive,success,warning,info}{,-foreground}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}bg-{primary/10,primary/20,muted/50,destructive/10,success/10,warning/10,info/10}\");\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}text-foreground\");\n\n/* Box — border */\n@source inline(\"{sm:,md:,lg:,xl:,2xl:,}border{,-2,-4,-8,-none}\");\n\n@custom-variant dark (&:is(.dark *));\n@custom-variant marked (&:is([data-checked], [data-indeterminate]));\n\n:root {\n color-scheme: light;\n --background: oklch(1 0 0);\n --foreground: oklch(0.145 0 0);\n --card: oklch(1 0 0);\n --card-foreground: oklch(0.145 0 0);\n --popover: oklch(1 0 0);\n --popover-foreground: oklch(0.145 0 0);\n --primary: oklch(0.49 0.22 1);\n --primary-foreground: oklch(0.97 0.01 343);\n --secondary: oklch(0.75 0.1 10);\n --secondary-foreground: oklch(0.2 0.03 15);\n --muted: oklch(0.95 0.02 20);\n --muted-foreground: oklch(0.5 0.03 25);\n --accent: oklch(0.92 0.04 15);\n --accent-foreground: oklch(0.3 0.04 20);\n --destructive: oklch(0.48 0.2 20);\n --destructive-foreground: oklch(0.98 0.01 20);\n --info: oklch(0.47 0.13 225);\n --info-foreground: oklch(0.98 0.01 225);\n --success: oklch(0.46 0.13 150);\n --success-foreground: oklch(0.98 0.01 150);\n --warning: oklch(0.46 0.1 80);\n --warning-foreground: oklch(0.98 0.01 80);\n --border: oklch(0.9 0.01 20);\n --input: oklch(0.6 0.01 20);\n --ring: oklch(0.58 0.12 350);\n --chart-1: oklch(0.61 0.12 185);\n --chart-2: oklch(0.64 0.16 35);\n --chart-3: oklch(0.61 0.13 95);\n --chart-4: oklch(0.61 0.12 280);\n --chart-5: oklch(0.6 0.1 160);\n --radius: 0.45rem;\n --sidebar: oklch(0.985 0 0);\n --sidebar-foreground: oklch(0.145 0 0);\n --sidebar-primary: oklch(0.54 0.22 1);\n --sidebar-primary-foreground: oklch(0.97 0.01 343);\n --sidebar-accent: oklch(0.9 0.04 15);\n --sidebar-accent-foreground: oklch(0.25 0.04 15);\n --sidebar-border: oklch(0.922 0 0);\n --sidebar-ring: oklch(0.58 0.12 350);\n --shadow-card: inset 0 1px 0 oklch(1 0 0 / 70%), 0 1px 2px oklch(0 0 0 / 5%);\n --shadow-popover:\n inset 0 1px 0 oklch(1 0 0 / 75%), 0 8px 24px -4px oklch(0 0 0 / 10%),\n 0 2px 6px oklch(0 0 0 / 5%);\n --shadow-modal:\n inset 0 1px 0 oklch(1 0 0 / 80%), 0 24px 56px -12px oklch(0 0 0 / 20%);\n}\n\n.dark {\n color-scheme: dark;\n --background: oklch(0.145 0 0);\n --foreground: oklch(0.985 0 0);\n --card: oklch(0.205 0 0);\n --card-foreground: oklch(0.985 0 0);\n --popover: oklch(0.205 0 0);\n --popover-foreground: oklch(0.985 0 0);\n --primary: oklch(0.76 0.19 354);\n /* The dark primary is a light pink, so its foreground is dark ink — the pair\n needs 4.5:1 like every other preset's does. */\n --primary-foreground: oklch(0.16 0.05 354);\n --secondary: oklch(0.69 0.08 10);\n --secondary-foreground: oklch(0.13 0.02 10);\n --muted: oklch(0.25 0.02 15);\n --muted-foreground: oklch(0.65 0.03 20);\n --accent: oklch(0.4 0.08 10);\n --accent-foreground: oklch(0.98 0.01 10);\n --destructive: oklch(0.78 0.18 15);\n --destructive-foreground: oklch(0.16 0.03 15);\n --info: oklch(0.72 0.14 220);\n --info-foreground: oklch(0.16 0.03 220);\n --success: oklch(0.72 0.15 145);\n --success-foreground: oklch(0.16 0.03 145);\n --warning: oklch(0.74 0.14 75);\n --warning-foreground: oklch(0.15 0.03 75);\n --border: oklch(1 0 0 / 15%);\n --input: oklch(1 0 0 / 48%);\n --ring: oklch(0.65 0.14 350);\n --chart-1: oklch(0.7 0.12 185);\n --chart-2: oklch(0.7 0.16 35);\n --chart-3: oklch(0.72 0.12 95);\n --chart-4: oklch(0.65 0.1 280);\n --chart-5: oklch(0.6 0.08 160);\n --sidebar: oklch(0.205 0 0);\n --sidebar-foreground: oklch(0.985 0 0);\n --sidebar-primary: oklch(0.73 0.18 350);\n --sidebar-primary-foreground: oklch(0.16 0.05 350);\n --sidebar-accent: oklch(0.45 0.08 10);\n --sidebar-accent-foreground: oklch(0.98 0.01 10);\n --sidebar-border: oklch(1 0 0 / 10%);\n --sidebar-ring: oklch(0.65 0.14 350);\n --shadow-card: inset 0 1px 0 oklch(1 0 0 / 8%), 0 1px 2px oklch(0 0 0 / 32%);\n --shadow-popover:\n inset 0 1px 0 oklch(1 0 0 / 10%), 0 12px 28px -4px oklch(0 0 0 / 48%);\n --shadow-modal:\n inset 0 1px 0 oklch(1 0 0 / 12%), 0 28px 64px -12px oklch(0 0 0 / 68%);\n}\n\n/* Strong ease-out: the built-in ease-out is too weak to read as deliberate\n motion at the 150–350ms durations the docs frame uses. */\n:root {\n --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);\n}\n\n/* Spring curve (damping 0.65, ~7% overshoot) sampled into linear() so route\n entrances get spring physics while staying composite-only CSS. Lives on\n :root, not @theme, so it is always emitted for the tokens' var() lookup. */\n:root {\n --ease-spring: linear(\n 0,\n 0.015,\n 0.0552,\n 0.1142,\n 0.1865,\n 0.2671,\n 0.352,\n 0.4379,\n 0.522,\n 0.6024,\n 0.6774,\n 0.7461,\n 0.8078,\n 0.8621,\n 0.9091,\n 0.9489,\n 0.9819,\n 1.0085,\n 1.0293,\n 1.0449,\n 1.056,\n 1.0631,\n 1.067,\n 1.0681,\n 1.067,\n 1.0642,\n 1.0601,\n 1.0552,\n 1.0497,\n 1.0439,\n 1.0381,\n 1.0324,\n 1.0269,\n 1.0218,\n 1.0171,\n 1.013,\n 1.0093,\n 1.0061,\n 1.0034,\n 1.0012,\n 0.9994,\n 0.998,\n 0.9969,\n 0.9962,\n 0.9957,\n 0.9954,\n 0.9954,\n 0.9954,\n 0.9956,\n 0.9959,\n 1\n );\n}\n\n@theme inline {\n --font-sans: \"Geist Variable\", ui-sans-serif, system-ui, sans-serif;\n --font-display: var(--font-sans);\n --tracking-kira-heading: -0.025em;\n --font-mono: \"Geist Mono Variable\", ui-monospace, monospace;\n\n /* Animation tokens for consistent motion */\n --animate-shimmer: shimmer 2s infinite;\n --animate-skeleton-wave: skeleton-wave 2s ease-in-out infinite;\n --animate-badge-pulse: badge-pulse 2s ease-in-out infinite;\n --animate-ping-once: ping-once 0.8s cubic-bezier(0, 0, 0.2, 1);\n --animate-badge-shimmer: badge-shimmer 1.75s linear infinite;\n --animate-marquee: marquee 18s linear infinite;\n --animate-shake: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);\n --animate-fade-in: fade-in 0.3s ease-out;\n --animate-route-fade: route-fade 0.15s cubic-bezier(0.23, 1, 0.32, 1) both;\n --animate-route-fade-up: route-fade-up 0.25s var(--ease-spring) both;\n --animate-route-fade-down: route-fade-down 0.25s var(--ease-spring) both;\n --animate-route-slide-left: route-slide-left 0.25s var(--ease-spring) both;\n --animate-route-slide-right: route-slide-right 0.25s var(--ease-spring) both;\n --animate-route-zoom: route-zoom 0.25s var(--ease-spring) both;\n --animate-nav-progress: nav-progress 10s ease-out forwards;\n --animate-toast-progress: toast-progress linear forwards;\n --animate-button-ripple: button-ripple 0.6s cubic-bezier(0.22, 1, 0.36, 1)\n forwards;\n --animate-checkbox-ripple: checkbox-ripple 0.3s ease-out forwards;\n --animate-toggle-pop: toggle-pop 0.3s var(--ease-spring);\n\n --color-sidebar-ring: var(--sidebar-ring);\n --color-sidebar-border: var(--sidebar-border);\n --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);\n --color-sidebar-accent: var(--sidebar-accent);\n --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);\n --color-sidebar-primary: var(--sidebar-primary);\n --color-sidebar-foreground: var(--sidebar-foreground);\n --color-sidebar: var(--sidebar);\n --color-chart-5: var(--chart-5);\n --color-chart-4: var(--chart-4);\n --color-chart-3: var(--chart-3);\n --color-chart-2: var(--chart-2);\n --color-chart-1: var(--chart-1);\n --color-ring: var(--ring);\n --color-input: var(--input);\n --color-border: var(--border);\n --color-destructive: var(--destructive);\n --color-destructive-foreground: var(--destructive-foreground);\n --color-info: var(--info);\n --color-info-foreground: var(--info-foreground);\n --color-success: var(--success);\n --color-success-foreground: var(--success-foreground);\n --color-warning: var(--warning);\n --color-warning-foreground: var(--warning-foreground);\n --color-accent-foreground: var(--accent-foreground);\n --color-accent: var(--accent);\n --color-muted-foreground: var(--muted-foreground);\n --color-muted: var(--muted);\n --color-secondary-foreground: var(--secondary-foreground);\n --color-secondary: var(--secondary);\n --color-primary-foreground: var(--primary-foreground);\n --color-primary: var(--primary);\n --color-popover-foreground: var(--popover-foreground);\n --color-popover: var(--popover);\n --color-card-foreground: var(--card-foreground);\n --color-card: var(--card);\n --color-foreground: var(--foreground);\n --color-background: var(--background);\n --radius-sm: calc(var(--radius) - 4px);\n --radius-md: calc(var(--radius) - 2px);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 4px);\n --radius-2xl: calc(var(--radius) + 8px);\n --radius-3xl: calc(var(--radius) + 12px);\n --radius-4xl: calc(var(--radius) + 16px);\n}\n\n@layer base {\n * {\n @apply border-border outline-ring;\n }\n body {\n @apply font-sans bg-background text-foreground;\n }\n html {\n @apply font-sans;\n }\n h1,\n h2,\n h3 {\n font-family: var(--font-display, var(--font-sans));\n letter-spacing: var(--tracking-kira-heading, inherit);\n }\n}\n\n/* Hide scrollbars while keeping scrollability (carousel/stack rails) */\n@utility scrollbar-hide {\n scrollbar-width: none;\n -ms-overflow-style: none;\n &::-webkit-scrollbar {\n display: none;\n }\n}\n\n/* Mac-like scrollbar styling with cross-browser support */\n@layer base {\n /* Standard scrollbar styling (Firefox) */\n * {\n scrollbar-width: thin;\n scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);\n }\n\n :root {\n --scrollbar-thumb: oklch(0.7 0 0 / 40%);\n --scrollbar-track: transparent;\n --scrollbar-thumb-hover: oklch(0.6 0 0 / 60%);\n }\n\n .dark {\n --scrollbar-thumb: oklch(0.5 0 0 / 40%);\n --scrollbar-thumb-hover: oklch(0.6 0 0 / 60%);\n }\n\n /* Webkit scrollbar styling (Chrome, Safari, Edge) */\n ::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n }\n\n ::-webkit-scrollbar-track {\n background: var(--scrollbar-track);\n border-radius: 4px;\n }\n\n ::-webkit-scrollbar-thumb {\n background: var(--scrollbar-thumb);\n border-radius: 4px;\n border: 2px solid transparent;\n background-clip: content-box;\n }\n\n ::-webkit-scrollbar-thumb:hover {\n background: var(--scrollbar-thumb-hover);\n background-clip: content-box;\n }\n\n ::-webkit-scrollbar-corner {\n background: transparent;\n }\n\n /* Accessibility: Respect user preferences for reduced motion.\n Shared gate per playbook §5 — kills keyframe animations and transitions\n kit-wide (skeleton-wave, badge-pulse, marquee, sticky-bar enter, ...). */\n @media (prefers-reduced-motion: reduce) {\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n ::-webkit-scrollbar-thumb {\n transition: none;\n }\n }\n\n /* Accessibility: High contrast mode support */\n @media (forced-colors: active) {\n ::-webkit-scrollbar-thumb {\n background: CanvasText;\n }\n ::-webkit-scrollbar-track {\n background: Canvas;\n }\n }\n}\n\n/* Shimmer animation for skeleton loading - seamless infinite loop */\n@keyframes shimmer {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(100%);\n }\n}\n\n/* Wave animation for skeleton loading - subtle opacity pulse */\n@keyframes skeleton-wave {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Badge pulse - gentle attention pulse for count/notification badges */\n@keyframes badge-pulse {\n 0%,\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n 50% {\n transform: scale(1.08);\n opacity: 0.85;\n }\n}\n\n/* Ping once - single expanding ring (for one-shot \"new\" indication) */\n@keyframes ping-once {\n 75%,\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n}\n\n/* Badge shimmer - light sweep across a badge. The keyframes own the whole\n travel (no static translate alongside them — Tailwind v4's native\n `translate` property composes with `transform` and would shift the range).\n The element is inset-0, so ±100% moves it fully off the badge: it enters\n from the left edge and exits past the right edge instead of parking in\n the middle, with a beat of stillness between passes. */\n@keyframes badge-shimmer {\n 0%,\n 20% {\n transform: translateX(-100%);\n }\n 80%,\n 100% {\n transform: translateX(100%);\n }\n}\n\n/* Marquee - continuous horizontal scroll for announcement content */\n@keyframes marquee {\n 0% {\n transform: translateX(0);\n }\n 100% {\n transform: translateX(-100%);\n }\n}\n\n/* Fade in - quick entrance for feedback overlays (short, opacity only) */\n@keyframes fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes shake {\n 0%,\n 100% {\n transform: translateX(0);\n }\n 20% {\n transform: translateX(-4px);\n }\n 40% {\n transform: translateX(4px);\n }\n 60% {\n transform: translateX(-3px);\n }\n 80% {\n transform: translateX(3px);\n }\n}\n\n/* Toast auto-dismiss countdown — composite-only scaleX bar at the bottom edge. */\n@keyframes toast-progress {\n from {\n transform: scaleX(1);\n }\n to {\n transform: scaleX(0);\n }\n}\n\n@keyframes button-ripple {\n from {\n transform: translate(-50%, -50%) scale(0);\n opacity: 0.3;\n }\n to {\n transform: translate(-50%, -50%) scale(1);\n opacity: 0;\n }\n}\n\n@keyframes checkbox-ripple {\n from {\n transform: scale(0.5);\n opacity: 0.3;\n }\n to {\n transform: scale(1.5);\n opacity: 0;\n }\n}\n\n@keyframes toggle-pop {\n from {\n transform: scale(1.25);\n }\n to {\n transform: scale(1);\n }\n}\n\n/* Progress bar animations */\n@keyframes progress-stripes {\n from {\n background-position: 1rem 0;\n }\n to {\n background-position: 0 0;\n }\n}\n\n@keyframes progress-indeterminate {\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(400%);\n }\n}\n\n/* Route entrances — short enough for tens-of-times-a-day sidebar navigation.\n Movement variants ride the spring curve for a hint of overshoot; plain fade\n stays ease-out. The native view transition crossfade replaces these while\n it is active (see below), so the two never stack. */\n@keyframes route-fade {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes route-fade-up {\n from {\n opacity: 0;\n transform: translateY(8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes route-fade-down {\n from {\n opacity: 0;\n transform: translateY(-8px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Slides travel 24px, not the full viewport — route content is read dozens of\n times a day, so direction is hinted, not performed. slide-left enters from\n the right (forward navigation); slide-right enters from the left (back). */\n@keyframes route-slide-left {\n from {\n opacity: 0;\n transform: translateX(24px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes route-slide-right {\n from {\n opacity: 0;\n transform: translateX(-24px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes route-zoom {\n from {\n opacity: 0;\n transform: scale(0.96);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n/* Navigation trickle — asymptotic scaleX so the bar keeps moving while route\n chunks load, without ever claiming completion. Composite-only: it runs off\n the main thread exactly when navigation makes the main thread busy. */\n@keyframes nav-progress {\n 0% {\n transform: scaleX(0);\n }\n 15% {\n transform: scaleX(0.4);\n }\n 40% {\n transform: scaleX(0.65);\n }\n 70% {\n transform: scaleX(0.8);\n }\n 100% {\n transform: scaleX(0.9);\n }\n}\n\n/* Native route crossfade (router defaultViewTransition) tuned to the kit's\n motion scale instead of the UA default 0.25s. Apps should render the\n RouteTransition entrance with variant=\"none\" while this API is available —\n suppressing it with :active-view-transition would restart the fade when the\n crossfade ends and read as a second blink. */\n::view-transition-old(root),\n::view-transition-new(root) {\n animation-duration: 150ms;\n animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);\n}\n\n@media (prefers-reduced-motion: reduce) {\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation-duration: 0.01ms;\n }\n}\n\n/* Camera Scan Overlay animations */\n@keyframes scan-line {\n 0% {\n transform: translateY(-100%);\n }\n 100% {\n transform: translateY(100%);\n }\n}\n\n@keyframes scan-overlay-corner-pulse {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.6;\n }\n}\n\n/* Calendar month transition (`animate` prop) — adapted from react-day-picker\n (MIT, https://github.com/gpbl/react-day-picker) style.css and namespaced so\n the kit never needs the rdp-* stylesheet. */\n@keyframes kira-calendar-slide-in-left {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes kira-calendar-slide-in-right {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes kira-calendar-slide-out-left {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-100%);\n }\n}\n\n@keyframes kira-calendar-slide-out-right {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@keyframes kira-calendar-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes kira-calendar-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.kira-calendar-weeks-before-enter {\n animation: kira-calendar-slide-in-left\n var(--kira-calendar-animation-duration, 0.3s)\n var(--kira-calendar-animation-timing, cubic-bezier(0.4, 0, 0.2, 1)) forwards;\n}\n\n.kira-calendar-weeks-before-exit {\n animation: kira-calendar-slide-out-left\n var(--kira-calendar-animation-duration, 0.3s)\n var(--kira-calendar-animation-timing, cubic-bezier(0.4, 0, 0.2, 1)) forwards;\n}\n\n.kira-calendar-weeks-after-enter {\n animation: kira-calendar-slide-in-right\n var(--kira-calendar-animation-duration, 0.3s)\n var(--kira-calendar-animation-timing, cubic-bezier(0.4, 0, 0.2, 1)) forwards;\n}\n\n.kira-calendar-weeks-after-exit {\n animation: kira-calendar-slide-out-right\n var(--kira-calendar-animation-duration, 0.3s)\n var(--kira-calendar-animation-timing, cubic-bezier(0.4, 0, 0.2, 1)) forwards;\n}\n\n[dir=\"rtl\"] .kira-calendar-weeks-after-enter {\n animation-name: kira-calendar-slide-in-left;\n}\n\n[dir=\"rtl\"] .kira-calendar-weeks-before-exit {\n animation-name: kira-calendar-slide-out-right;\n}\n\n[dir=\"rtl\"] .kira-calendar-weeks-before-enter {\n animation-name: kira-calendar-slide-in-right;\n}\n\n[dir=\"rtl\"] .kira-calendar-weeks-after-exit {\n animation-name: kira-calendar-slide-out-left;\n}\n\n.kira-calendar-caption-before-enter,\n.kira-calendar-caption-after-enter {\n animation: kira-calendar-fade-in var(--kira-calendar-animation-duration, 0.3s)\n var(--kira-calendar-animation-timing, cubic-bezier(0.4, 0, 0.2, 1)) forwards;\n}\n\n.kira-calendar-caption-before-exit,\n.kira-calendar-caption-after-exit {\n animation: kira-calendar-fade-out\n var(--kira-calendar-animation-duration, 0.3s)\n var(--kira-calendar-animation-timing, cubic-bezier(0.4, 0, 0.2, 1)) forwards;\n}\n";
|
|
@@ -1230,7 +1237,7 @@ function resolveAddress(address, ctx) {
|
|
|
1230
1237
|
const name = normalized.slice(slash + 1);
|
|
1231
1238
|
if (slash < 0 || !name) throw new ValidationError(`Invalid registry address "${address}".`, "Use @namespace/name, a URL, or a local path.");
|
|
1232
1239
|
const template = ctx.registries?.[ns] ?? (ns === "@kira-kit" ? "https://kira-kit.vercel.app/r/{name}.json" : void 0);
|
|
1233
|
-
if (!template) throw new ValidationError(`Unknown registry namespace "${ns}".`, `Add registries["${ns}"] to
|
|
1240
|
+
if (!template) throw new ValidationError(`Unknown registry namespace "${ns}".`, `Add registries["${ns}"] to kira-kit.json, or pass a full URL.`);
|
|
1234
1241
|
return fromTemplate(template, name, ctx.cwd);
|
|
1235
1242
|
}
|
|
1236
1243
|
/**
|
|
@@ -1254,13 +1261,13 @@ async function loadText(address) {
|
|
|
1254
1261
|
try {
|
|
1255
1262
|
response = await fetch(address.location);
|
|
1256
1263
|
} catch {
|
|
1257
|
-
throw new RegistryError(`Could not reach ${address.location}`, "Check your internet connection and the registry URL in
|
|
1264
|
+
throw new RegistryError(`Could not reach ${address.location}`, "Check your internet connection and the registry URL in kira-kit.json.");
|
|
1258
1265
|
}
|
|
1259
|
-
if (!response.ok) throw new RegistryError(`Registry request failed (HTTP ${response.status}) for ${address.location}`, "Verify the item name and your
|
|
1266
|
+
if (!response.ok) throw new RegistryError(`Registry request failed (HTTP ${response.status}) for ${address.location}`, "Verify the item name and your kira-kit.json registry URL.");
|
|
1260
1267
|
return response.text();
|
|
1261
1268
|
}
|
|
1262
1269
|
function loadLocalText(location) {
|
|
1263
|
-
if (!existsSync(location)) throw new RegistryError(`Registry item not found at ${location}`, "Check the item name or the registry URL in
|
|
1270
|
+
if (!existsSync(location)) throw new RegistryError(`Registry item not found at ${location}`, "Check the item name or the registry URL in kira-kit.json.");
|
|
1264
1271
|
return readFileSync(location, "utf-8");
|
|
1265
1272
|
}
|
|
1266
1273
|
function parseJsonText(text, label) {
|
|
@@ -1527,8 +1534,7 @@ const DEFAULT_ALIASES = {
|
|
|
1527
1534
|
components: "@/components",
|
|
1528
1535
|
ui: "@/components/ui",
|
|
1529
1536
|
hooks: "@/hooks",
|
|
1530
|
-
lib: "@/lib"
|
|
1531
|
-
utils: "@/lib/utils"
|
|
1537
|
+
lib: "@/lib"
|
|
1532
1538
|
};
|
|
1533
1539
|
/** Read tsconfig paths (JSONC + extends handled by the TypeScript API). */
|
|
1534
1540
|
function readPaths(cwd) {
|
|
@@ -1568,8 +1574,7 @@ function importAliases(config) {
|
|
|
1568
1574
|
components: configured.components ?? DEFAULT_ALIASES.components,
|
|
1569
1575
|
ui: configured.ui ?? DEFAULT_ALIASES.ui,
|
|
1570
1576
|
hooks: configured.hooks ?? DEFAULT_ALIASES.hooks,
|
|
1571
|
-
lib: configured.lib ?? DEFAULT_ALIASES.lib
|
|
1572
|
-
utils: configured.utils ?? DEFAULT_ALIASES.utils
|
|
1577
|
+
lib: configured.lib ?? DEFAULT_ALIASES.lib
|
|
1573
1578
|
};
|
|
1574
1579
|
}
|
|
1575
1580
|
/** Resolve alias roots from tsconfig paths; fall back to @/ → src/. */
|
|
@@ -1603,7 +1608,7 @@ const PREFIX_RULES = [
|
|
|
1603
1608
|
["@/components/", "components"]
|
|
1604
1609
|
];
|
|
1605
1610
|
function rewriteSpecifier(specifier, aliases) {
|
|
1606
|
-
if (specifier === "@/lib/utils") return aliases.utils;
|
|
1611
|
+
if (specifier === "@/lib/utils" && aliases.utils) return aliases.utils;
|
|
1607
1612
|
for (const [prefix, key] of PREFIX_RULES) if (specifier.startsWith(prefix)) return `${aliases[key]}/${specifier.slice(prefix.length)}`;
|
|
1608
1613
|
return specifier;
|
|
1609
1614
|
}
|
|
@@ -1680,7 +1685,7 @@ function transformContent(file, item, aliases, config) {
|
|
|
1680
1685
|
}
|
|
1681
1686
|
function fileTarget(file, item, roots, config, options) {
|
|
1682
1687
|
if (item.type === "registry:style") {
|
|
1683
|
-
const cssDir = dirname(resolve(options.cwd, config.
|
|
1688
|
+
const cssDir = dirname(resolve(options.cwd, config.css ?? "src/index.css"));
|
|
1684
1689
|
const base = file.path.replaceAll("\\", "/").split("/").pop() ?? file.path;
|
|
1685
1690
|
return resolve(cssDir, file.target ?? base);
|
|
1686
1691
|
}
|
|
@@ -1703,9 +1708,9 @@ function applyStyles(items, config, options) {
|
|
|
1703
1708
|
cssVarsApplied: false,
|
|
1704
1709
|
cssRulesApplied: false
|
|
1705
1710
|
};
|
|
1706
|
-
const cssPath = config.
|
|
1711
|
+
const cssPath = config.css;
|
|
1707
1712
|
if (!cssPath) {
|
|
1708
|
-
warning("No
|
|
1713
|
+
warning("No css path in kira-kit.json — skipped item styles.");
|
|
1709
1714
|
return {
|
|
1710
1715
|
cssVarsApplied: false,
|
|
1711
1716
|
cssRulesApplied: false
|
|
@@ -1716,7 +1721,10 @@ function applyStyles(items, config, options) {
|
|
|
1716
1721
|
/** Resolve the item tree and plan writes without touching disk or network installs. */
|
|
1717
1722
|
async function planInstall(input, options) {
|
|
1718
1723
|
const config = readConfig(options.cwd);
|
|
1719
|
-
if (!config)
|
|
1724
|
+
if (!config) {
|
|
1725
|
+
if (findLegacyConfigFile(options.cwd)) throw new ValidationError("No kira-kit.json found (detected legacy components.json).", "Run 'kira-kit migrate' to convert it to kira-kit.json, or 'kira-kit init' to start fresh.");
|
|
1726
|
+
throw new ValidationError("No kira-kit.json found.", "Run 'kira-kit init' first.");
|
|
1727
|
+
}
|
|
1720
1728
|
const items = input.items ?? await resolveTree(input.addresses ?? [], createClientContext(options.cwd, config.registries));
|
|
1721
1729
|
if (items.length === 0) throw new ValidationError("No registry items to install.", "Pass item names, e.g. 'kira-kit add button'.");
|
|
1722
1730
|
const npmDeps = planNpmDeps(items, readConsumerPackage(options.cwd), config.iconLibrary);
|
|
@@ -3552,26 +3560,26 @@ function resolveBaseColorOption(value) {
|
|
|
3552
3560
|
if (!isBaseColorName(trimmed)) throw new ValidationError(`Unknown base color "${value}".`, `Valid options: ${BASE_COLOR_NAMES.join(", ")}.`);
|
|
3553
3561
|
return trimmed;
|
|
3554
3562
|
}
|
|
3555
|
-
function pickFontSlots(flags,
|
|
3563
|
+
function pickFontSlots(flags, theme) {
|
|
3556
3564
|
const preset = flags.fontPreset ? resolveFontPreset(flags.fontPreset) : void 0;
|
|
3557
3565
|
return {
|
|
3558
3566
|
sans: firstDefined([
|
|
3559
3567
|
flags.font,
|
|
3560
3568
|
preset?.sans,
|
|
3561
|
-
|
|
3569
|
+
theme.font
|
|
3562
3570
|
]) ?? "geist",
|
|
3563
3571
|
mono: firstDefined([
|
|
3564
3572
|
flags.fontMono,
|
|
3565
3573
|
preset?.mono,
|
|
3566
|
-
|
|
3574
|
+
theme.fontMono
|
|
3567
3575
|
]) ?? "geist-mono",
|
|
3568
|
-
display: flags.fontDisplay ?? (preset ? preset.display :
|
|
3569
|
-
fontPreset: preset ? preset.name :
|
|
3576
|
+
display: flags.fontDisplay ?? (preset ? preset.display : theme.fontDisplay),
|
|
3577
|
+
fontPreset: preset ? preset.name : theme.fontPreset
|
|
3570
3578
|
};
|
|
3571
3579
|
}
|
|
3572
3580
|
function resolveTypographySelection(flags, raw) {
|
|
3573
|
-
const
|
|
3574
|
-
const slots = pickFontSlots(flags,
|
|
3581
|
+
const theme = raw?.theme ?? {};
|
|
3582
|
+
const slots = pickFontSlots(flags, theme);
|
|
3575
3583
|
const headingTracking = Object.values(FONT_PRESETS).find((item) => item.name === slots.fontPreset)?.headingTracking;
|
|
3576
3584
|
const fontFlags = [
|
|
3577
3585
|
flags.fontPreset,
|
|
@@ -3580,9 +3588,9 @@ function resolveTypographySelection(flags, raw) {
|
|
|
3580
3588
|
flags.fontMono
|
|
3581
3589
|
];
|
|
3582
3590
|
const configFonts = [
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3591
|
+
theme.font,
|
|
3592
|
+
theme.fontDisplay,
|
|
3593
|
+
theme.fontMono
|
|
3586
3594
|
];
|
|
3587
3595
|
return {
|
|
3588
3596
|
sans: resolveFont("sans", slots.sans),
|
|
@@ -3595,7 +3603,7 @@ function resolveTypographySelection(flags, raw) {
|
|
|
3595
3603
|
};
|
|
3596
3604
|
}
|
|
3597
3605
|
/**
|
|
3598
|
-
* Resolve theme, typography, geometry, and icon flags against `
|
|
3606
|
+
* Resolve theme, typography, geometry, and icon flags against `kira-kit.json`
|
|
3599
3607
|
* with one precedence contract shared by `init` and `theme`.
|
|
3600
3608
|
*/
|
|
3601
3609
|
function resolveThemeSelection(cwd, flags) {
|
|
@@ -3621,18 +3629,21 @@ function attachThemeConfigFields(target, selection) {
|
|
|
3621
3629
|
if (selection.radius) target.radius = selection.radius.name;
|
|
3622
3630
|
if (selection.surface) target.surface = selection.surface.name;
|
|
3623
3631
|
}
|
|
3624
|
-
function persistThemeConfig(cwd, selection,
|
|
3625
|
-
|
|
3626
|
-
if (!raw) return;
|
|
3632
|
+
function persistThemeConfig(cwd, selection, options = {}) {
|
|
3633
|
+
if (!readRawConfig(cwd)) return;
|
|
3627
3634
|
const patch = {};
|
|
3628
|
-
const nextBase = selection.baseColor ?? defaultBaseColor;
|
|
3629
|
-
if (
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
}
|
|
3635
|
+
const nextBase = selection.baseColor ?? options.defaultBaseColor;
|
|
3636
|
+
if (options.preset) {
|
|
3637
|
+
patch.preset = options.preset;
|
|
3638
|
+
patch.primary = void 0;
|
|
3639
|
+
} else if (options.primary) {
|
|
3640
|
+
patch.primary = options.primary;
|
|
3641
|
+
patch.preset = void 0;
|
|
3642
|
+
}
|
|
3643
|
+
if (nextBase) patch.baseColor = nextBase;
|
|
3633
3644
|
if (selection.radius) patch.radius = selection.radius.name;
|
|
3634
3645
|
if (selection.surface) patch.surface = selection.surface.name;
|
|
3635
|
-
if (Object.keys(patch).length > 0)
|
|
3646
|
+
if (Object.keys(patch).length > 0) updateThemeConfig(cwd, patch);
|
|
3636
3647
|
}
|
|
3637
3648
|
function buildStandaloneTokenVars(selection) {
|
|
3638
3649
|
const cssVars = {};
|
|
@@ -3897,52 +3908,52 @@ function baseDeps(selection, runtime) {
|
|
|
3897
3908
|
return [...new Set(deps)];
|
|
3898
3909
|
}
|
|
3899
3910
|
function writeFreshConfig(cwd, css, selection, runtime) {
|
|
3911
|
+
const theme = {
|
|
3912
|
+
preset: "default",
|
|
3913
|
+
baseColor: selection.baseColor ?? "neutral",
|
|
3914
|
+
font: selection.sans.name,
|
|
3915
|
+
fontMono: selection.mono.name
|
|
3916
|
+
};
|
|
3917
|
+
attachThemeConfigFields(theme, selection);
|
|
3900
3918
|
const config = {
|
|
3901
|
-
$schema:
|
|
3902
|
-
|
|
3919
|
+
$schema: KIRA_CONFIG_SCHEMA_URL,
|
|
3920
|
+
css,
|
|
3903
3921
|
rsc: runtime.isNext,
|
|
3904
|
-
tsx: true,
|
|
3905
|
-
tailwind: {
|
|
3906
|
-
css,
|
|
3907
|
-
baseColor: selection.baseColor ?? "neutral",
|
|
3908
|
-
cssVariables: true
|
|
3909
|
-
},
|
|
3910
3922
|
iconLibrary: selection.iconLibrary,
|
|
3911
|
-
|
|
3912
|
-
fontMono: selection.mono.name,
|
|
3923
|
+
theme,
|
|
3913
3924
|
aliases: { ...DEFAULT_ALIASES },
|
|
3914
3925
|
registries: { [KIRA_NAMESPACE]: DEFAULT_REGISTRY_URL }
|
|
3915
3926
|
};
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
success("Created components.json (kira style, Base UI).");
|
|
3927
|
+
writeFileSync(join(cwd, CONFIG_FILENAME), JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
3928
|
+
success("Created kira-kit.json (Base UI).");
|
|
3919
3929
|
}
|
|
3920
3930
|
function fillExistingConfig(cwd, raw, css, selection) {
|
|
3921
|
-
const
|
|
3922
|
-
...raw.
|
|
3923
|
-
|
|
3931
|
+
const theme = {
|
|
3932
|
+
...raw.theme,
|
|
3933
|
+
font: selection.sans.name,
|
|
3934
|
+
fontMono: selection.mono.name
|
|
3924
3935
|
};
|
|
3925
|
-
if (selection.baseColor)
|
|
3936
|
+
if (selection.baseColor) theme.baseColor = selection.baseColor;
|
|
3937
|
+
attachThemeConfigFields(theme, selection);
|
|
3926
3938
|
const next = {
|
|
3927
3939
|
...raw,
|
|
3940
|
+
$schema: raw.$schema ?? "https://kira-kit.vercel.app/schema/kira-kit.json",
|
|
3941
|
+
css: raw.css ?? css,
|
|
3928
3942
|
iconLibrary: selection.iconLibrary,
|
|
3929
|
-
|
|
3930
|
-
fontMono: selection.mono.name,
|
|
3943
|
+
theme,
|
|
3931
3944
|
aliases: {
|
|
3932
3945
|
...DEFAULT_ALIASES,
|
|
3933
3946
|
...raw.aliases
|
|
3934
|
-
}
|
|
3935
|
-
tailwind
|
|
3947
|
+
}
|
|
3936
3948
|
};
|
|
3937
|
-
|
|
3938
|
-
writeFileSync(join(cwd, "components.json"), JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
3949
|
+
writeFileSync(join(cwd, CONFIG_FILENAME), JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
3939
3950
|
}
|
|
3940
3951
|
function ensureKiraConfig(cwd, selection, runtime) {
|
|
3941
3952
|
const css = detectCssPath(cwd);
|
|
3942
3953
|
const raw = readRawConfig(cwd);
|
|
3943
3954
|
if (raw) fillExistingConfig(cwd, raw, css, selection);
|
|
3944
3955
|
else writeFreshConfig(cwd, css, selection, runtime);
|
|
3945
|
-
if (upsertKiraRegistry(cwd)) success("Registered the @kira-kit registry in
|
|
3956
|
+
if (upsertKiraRegistry(cwd)) success("Registered the @kira-kit registry in kira-kit.json.");
|
|
3946
3957
|
}
|
|
3947
3958
|
function reactFloor(range) {
|
|
3948
3959
|
const match = range.match(/(\d+)\.(\d+)/);
|
|
@@ -3995,6 +4006,10 @@ async function applyCustomTheme(cwd, primary, selection, force) {
|
|
|
3995
4006
|
const generated = buildCustomTheme(primary, selection);
|
|
3996
4007
|
if (!generated) return 1;
|
|
3997
4008
|
await applyThemePayload(cwd, themePayload(generated.item), force);
|
|
4009
|
+
persistThemeConfig(cwd, selection, {
|
|
4010
|
+
primary,
|
|
4011
|
+
defaultBaseColor: "neutral"
|
|
4012
|
+
});
|
|
3998
4013
|
success("Custom theme applied.");
|
|
3999
4014
|
return 0;
|
|
4000
4015
|
}
|
|
@@ -4007,6 +4022,10 @@ async function applyPreset(cwd, options, selection) {
|
|
|
4007
4022
|
radius: selection.radius?.name ?? preset.radius,
|
|
4008
4023
|
surface: selection.surface?.name ?? preset.surface
|
|
4009
4024
|
}).item), options.force);
|
|
4025
|
+
persistThemeConfig(cwd, selection, {
|
|
4026
|
+
preset: preset.name,
|
|
4027
|
+
defaultBaseColor: preset.baseColor
|
|
4028
|
+
});
|
|
4010
4029
|
success(`Theme preset "${preset.name}" applied.`);
|
|
4011
4030
|
return 0;
|
|
4012
4031
|
}
|
|
@@ -4016,19 +4035,21 @@ async function applyPreset(cwd, options, selection) {
|
|
|
4016
4035
|
overwrite: options.force,
|
|
4017
4036
|
skipDeps: true
|
|
4018
4037
|
});
|
|
4038
|
+
persistThemeConfig(cwd, selection, { preset: options.preset });
|
|
4019
4039
|
success(`Theme preset "${options.preset}" applied.`);
|
|
4020
4040
|
return 0;
|
|
4021
4041
|
}
|
|
4022
4042
|
async function promptFonts(ctx, options, raw) {
|
|
4023
4043
|
if (options.font && options.fontMono) return;
|
|
4044
|
+
const theme = raw?.theme;
|
|
4024
4045
|
if (!options.font) options.font = await select(ctx, "Sans font", Object.values(SANS_FONTS).map((font) => ({
|
|
4025
4046
|
value: font.name,
|
|
4026
4047
|
label: font.family
|
|
4027
|
-
})),
|
|
4048
|
+
})), theme?.font ?? "geist");
|
|
4028
4049
|
if (!options.fontMono) options.fontMono = await select(ctx, "Mono font", Object.values(MONO_FONTS).map((font) => ({
|
|
4029
4050
|
value: font.name,
|
|
4030
4051
|
label: font.family
|
|
4031
|
-
})),
|
|
4052
|
+
})), theme?.fontMono ?? "geist-mono");
|
|
4032
4053
|
}
|
|
4033
4054
|
async function promptIcon(ctx, options, raw) {
|
|
4034
4055
|
if (options.icon) return;
|
|
@@ -4101,7 +4122,7 @@ const INSTALLABLE_TYPES = /* @__PURE__ */ new Set([
|
|
|
4101
4122
|
]);
|
|
4102
4123
|
async function allItemAddresses(cwd) {
|
|
4103
4124
|
const names = (await fetchIndex(createClientContext(cwd))).filter((entry) => entry.type && INSTALLABLE_TYPES.has(entry.type)).map((entry) => entry.name);
|
|
4104
|
-
if (names.length === 0) throw new RegistryError("The registry index contains no installable items.", "Check the '@kira-kit' registry URL in
|
|
4125
|
+
if (names.length === 0) throw new RegistryError("The registry index contains no installable items.", "Check the '@kira-kit' registry URL in kira-kit.json.");
|
|
4105
4126
|
return names.map(toItemAddress);
|
|
4106
4127
|
}
|
|
4107
4128
|
async function resolveItems(options, cwd) {
|
|
@@ -4853,7 +4874,7 @@ const libResolution = (file, ctx) => {
|
|
|
4853
4874
|
const ownFiles = new Set(meta.files.map((path) => path.replace(/\.(tsx|ts)$/, "")));
|
|
4854
4875
|
const moduleDir = dirname$1(file.name.slice(4));
|
|
4855
4876
|
for (const entry of relative) {
|
|
4856
|
-
const resolved = normalize(join$
|
|
4877
|
+
const resolved = normalize(join$1(moduleDir, entry.specifier)).replace(/\.(tsx|ts)$/, "");
|
|
4857
4878
|
if (ownFiles.has(resolved)) continue;
|
|
4858
4879
|
findings.push({
|
|
4859
4880
|
checkId: "lib-resolution",
|
|
@@ -5122,7 +5143,10 @@ async function applyPrimaryTheme(cwd, primary, options, selection) {
|
|
|
5122
5143
|
overwrite: true,
|
|
5123
5144
|
skipDeps: true
|
|
5124
5145
|
});
|
|
5125
|
-
persistThemeConfig(cwd, selection,
|
|
5146
|
+
persistThemeConfig(cwd, selection, {
|
|
5147
|
+
primary,
|
|
5148
|
+
defaultBaseColor: "neutral"
|
|
5149
|
+
});
|
|
5126
5150
|
await applyTypography(cwd, selection, options.installer);
|
|
5127
5151
|
success("Theme applied.");
|
|
5128
5152
|
return 0;
|
|
@@ -5456,8 +5480,8 @@ function renderLlmsTxt(items, baseUrl) {
|
|
|
5456
5480
|
"",
|
|
5457
5481
|
`> Enterprise UI kit built on Base UI primitives, ${items.length} components and hooks.`,
|
|
5458
5482
|
"",
|
|
5459
|
-
"Kira Kit is a component registry
|
|
5460
|
-
"`kira-kit add @kira-kit/<name
|
|
5483
|
+
"Kira Kit is a standalone component registry with its own CLI (`kira-kit`) and `kira-kit.json` config.",
|
|
5484
|
+
"Install items with `npx kira-kit add <name>` or `bunx kira-kit add <name>` (or `kira-kit add @kira-kit/<name>`).",
|
|
5461
5485
|
"",
|
|
5462
5486
|
"Conventions:",
|
|
5463
5487
|
"- Primitives: @base-ui/react (Base UI only — no Radix, no React Aria)",
|
|
@@ -5833,21 +5857,100 @@ async function findDivergentComponents(options) {
|
|
|
5833
5857
|
}
|
|
5834
5858
|
return divergent;
|
|
5835
5859
|
}
|
|
5836
|
-
|
|
5860
|
+
const LEGACY_TOP_LEVEL_KEYS = [
|
|
5861
|
+
"tailwind",
|
|
5862
|
+
"style",
|
|
5863
|
+
"tsx",
|
|
5864
|
+
"baseColor",
|
|
5865
|
+
"font",
|
|
5866
|
+
"fontDisplay",
|
|
5867
|
+
"fontMono",
|
|
5868
|
+
"fontPreset",
|
|
5869
|
+
"radius",
|
|
5870
|
+
"surface",
|
|
5871
|
+
"menuColor",
|
|
5872
|
+
"menuAccent"
|
|
5873
|
+
];
|
|
5874
|
+
const LEGACY_THEME_KEYS = [
|
|
5875
|
+
"font",
|
|
5876
|
+
"fontDisplay",
|
|
5877
|
+
"fontMono",
|
|
5878
|
+
"fontPreset",
|
|
5879
|
+
"radius",
|
|
5880
|
+
"surface"
|
|
5881
|
+
];
|
|
5882
|
+
function hasLegacyFields(raw, aliases) {
|
|
5883
|
+
if (!raw) return false;
|
|
5884
|
+
return aliases.utils !== void 0 || LEGACY_TOP_LEVEL_KEYS.some((key) => raw[key] !== void 0);
|
|
5885
|
+
}
|
|
5886
|
+
function configFacts(raw, fromLegacyConfigFile) {
|
|
5837
5887
|
const aliases = raw?.aliases ?? {};
|
|
5838
5888
|
const schema = raw?.$schema ?? "";
|
|
5839
5889
|
return {
|
|
5890
|
+
fromLegacyConfigFile,
|
|
5840
5891
|
hadLegacyRegistryUrl: typeof raw?.registryUrl === "string",
|
|
5841
|
-
alreadyHasNamespace:
|
|
5892
|
+
alreadyHasNamespace: KIRA_NAMESPACE in (raw?.registries ?? {}),
|
|
5842
5893
|
legacyAlias: aliases.lib === "@/lib/cn",
|
|
5843
|
-
legacySchema: schema.includes("ui.shadcn.com")
|
|
5894
|
+
legacySchema: schema.includes("ui.shadcn.com") || schema.includes("/schema/components.json"),
|
|
5895
|
+
legacyFields: hasLegacyFields(raw, aliases)
|
|
5844
5896
|
};
|
|
5845
5897
|
}
|
|
5898
|
+
function resolveRegistryUrl(raw, facts) {
|
|
5899
|
+
const existing = facts.hadLegacyRegistryUrl ? raw.registryUrl : raw.registries?.[KIRA_NAMESPACE];
|
|
5900
|
+
if (!existing) return DEFAULT_REGISTRY_URL;
|
|
5901
|
+
return existing.endsWith("/{name}.json") ? existing : `${existing.replace(/\/$/, "")}/{name}.json`;
|
|
5902
|
+
}
|
|
5903
|
+
function cleanAliases(aliases, legacyAlias) {
|
|
5904
|
+
if (!aliases) return void 0;
|
|
5905
|
+
const { utils: _droppedUtils, ...rest } = aliases;
|
|
5906
|
+
if (legacyAlias) rest.lib = STANDARD_LIB_ALIAS;
|
|
5907
|
+
return Object.keys(rest).length > 0 ? rest : void 0;
|
|
5908
|
+
}
|
|
5909
|
+
function buildMigratedTheme(raw) {
|
|
5910
|
+
const merged = { ...raw.theme };
|
|
5911
|
+
const baseColor = raw.theme?.baseColor ?? raw.baseColor ?? raw.tailwind?.baseColor;
|
|
5912
|
+
if (baseColor) merged.baseColor = baseColor;
|
|
5913
|
+
for (const key of LEGACY_THEME_KEYS) {
|
|
5914
|
+
const value = raw[key];
|
|
5915
|
+
if (value && !merged[key]) merged[key] = value;
|
|
5916
|
+
}
|
|
5917
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
5918
|
+
}
|
|
5919
|
+
function buildMigratedConfig(raw, facts) {
|
|
5920
|
+
const { style: _style, tsx: _tsx, baseColor: _baseColor, font: _font, fontDisplay: _fontDisplay, fontMono: _fontMono, fontPreset: _fontPreset, radius: _radius, surface: _surface, tailwind, theme: _theme, registryUrl: _registryUrl, menuColor: _menuColor, menuAccent: _menuAccent, aliases, registries, ...rest } = raw;
|
|
5921
|
+
const next = {
|
|
5922
|
+
...rest,
|
|
5923
|
+
$schema: KIRA_CONFIG_SCHEMA_URL
|
|
5924
|
+
};
|
|
5925
|
+
const css = raw.css ?? tailwind?.css;
|
|
5926
|
+
if (css) next.css = css;
|
|
5927
|
+
const theme = buildMigratedTheme(raw);
|
|
5928
|
+
if (theme) next.theme = theme;
|
|
5929
|
+
const cleanedAliases = cleanAliases(aliases, facts.legacyAlias);
|
|
5930
|
+
if (cleanedAliases) next.aliases = cleanedAliases;
|
|
5931
|
+
next.registries = {
|
|
5932
|
+
...registries,
|
|
5933
|
+
[KIRA_NAMESPACE]: resolveRegistryUrl(raw, facts)
|
|
5934
|
+
};
|
|
5935
|
+
return next;
|
|
5936
|
+
}
|
|
5937
|
+
function isLegacyKiraConfig(raw, facts) {
|
|
5938
|
+
if (!raw) return false;
|
|
5939
|
+
const schema = raw.$schema ?? "";
|
|
5940
|
+
return raw.style === "kira" || schema.includes("kira") || facts.hadLegacyRegistryUrl || facts.alreadyHasNamespace;
|
|
5941
|
+
}
|
|
5846
5942
|
async function planMigration(options) {
|
|
5847
|
-
const
|
|
5848
|
-
|
|
5849
|
-
const
|
|
5850
|
-
|
|
5943
|
+
const kiraPath = findConfigFile(options.cwd);
|
|
5944
|
+
const legacyPath = kiraPath ? null : findLegacyConfigFile(options.cwd);
|
|
5945
|
+
const configPath = kiraPath ?? legacyPath;
|
|
5946
|
+
if (!configPath) throw new ValidationError("No kira-kit.json or legacy components.json found.", "Run `kira-kit init` first to generate kira-kit.json.");
|
|
5947
|
+
let raw = null;
|
|
5948
|
+
try {
|
|
5949
|
+
raw = JSON.parse(await readFile(configPath, "utf-8"));
|
|
5950
|
+
} catch {
|
|
5951
|
+
raw = null;
|
|
5952
|
+
}
|
|
5953
|
+
const facts = configFacts(raw, Boolean(legacyPath));
|
|
5851
5954
|
const sourceDir = resolve(options.cwd, "src");
|
|
5852
5955
|
let sourceDirExists = true;
|
|
5853
5956
|
try {
|
|
@@ -5855,41 +5958,35 @@ async function planMigration(options) {
|
|
|
5855
5958
|
} catch {
|
|
5856
5959
|
sourceDirExists = false;
|
|
5857
5960
|
}
|
|
5961
|
+
const cnRewrites = sourceDirExists ? await planCnRewrites(options.cwd, sourceDir) : [];
|
|
5858
5962
|
return {
|
|
5859
5963
|
configPath,
|
|
5860
5964
|
raw,
|
|
5861
5965
|
facts,
|
|
5862
|
-
cnRewrites
|
|
5966
|
+
cnRewrites
|
|
5863
5967
|
};
|
|
5864
5968
|
}
|
|
5865
|
-
function
|
|
5866
|
-
|
|
5867
|
-
if (facts.hadLegacyRegistryUrl) {
|
|
5868
|
-
delete updated.registryUrl;
|
|
5869
|
-
changed = true;
|
|
5870
|
-
}
|
|
5871
|
-
if (facts.legacyAlias) {
|
|
5872
|
-
updated.aliases = {
|
|
5873
|
-
...updated.aliases,
|
|
5874
|
-
lib: STANDARD_LIB_ALIAS
|
|
5875
|
-
};
|
|
5876
|
-
changed = true;
|
|
5877
|
-
}
|
|
5878
|
-
if (facts.legacySchema) {
|
|
5879
|
-
updated.$schema = COMPONENTS_SCHEMA_URL;
|
|
5880
|
-
updated.style = "kira";
|
|
5881
|
-
changed = true;
|
|
5882
|
-
}
|
|
5883
|
-
return changed;
|
|
5969
|
+
function needsConfigUpdate(facts) {
|
|
5970
|
+
return facts.fromLegacyConfigFile || facts.hadLegacyRegistryUrl || !facts.alreadyHasNamespace || facts.legacyAlias || facts.legacySchema || facts.legacyFields;
|
|
5884
5971
|
}
|
|
5885
5972
|
async function updateRegistryConfig(options, plan) {
|
|
5886
5973
|
const { configPath, raw, facts } = plan;
|
|
5887
|
-
if (!facts
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5974
|
+
if (!needsConfigUpdate(facts)) return {
|
|
5975
|
+
configUpdated: false,
|
|
5976
|
+
removedLegacyConfig: false
|
|
5977
|
+
};
|
|
5978
|
+
const migrated = buildMigratedConfig(raw ?? {}, facts);
|
|
5979
|
+
const targetPath = join(options.cwd, CONFIG_FILENAME);
|
|
5980
|
+
await writeFile(targetPath, JSON.stringify(migrated, null, 2) + "\n", "utf-8");
|
|
5981
|
+
let removedLegacyConfig = false;
|
|
5982
|
+
if (facts.fromLegacyConfigFile && isLegacyKiraConfig(raw, facts)) {
|
|
5983
|
+
await rm(configPath, { force: true });
|
|
5984
|
+
removedLegacyConfig = true;
|
|
5985
|
+
}
|
|
5986
|
+
return {
|
|
5987
|
+
configUpdated: true,
|
|
5988
|
+
removedLegacyConfig
|
|
5989
|
+
};
|
|
5893
5990
|
}
|
|
5894
5991
|
async function applyCnRewrites(options, cnRewrites) {
|
|
5895
5992
|
const uniqueFiles = [...new Set(cnRewrites.map((r) => r.file))];
|
|
@@ -5914,15 +6011,17 @@ async function runMigration(options) {
|
|
|
5914
6011
|
if (options.dryRun) return {
|
|
5915
6012
|
plan,
|
|
5916
6013
|
configUpdated: false,
|
|
6014
|
+
removedLegacyConfig: false,
|
|
5917
6015
|
rewrittenFiles: 0,
|
|
5918
6016
|
installedCn: false,
|
|
5919
6017
|
divergent: []
|
|
5920
6018
|
};
|
|
5921
|
-
const configUpdated = await updateRegistryConfig(options, plan);
|
|
6019
|
+
const { configUpdated, removedLegacyConfig } = await updateRegistryConfig(options, plan);
|
|
5922
6020
|
const { rewrittenFiles, installedCn } = await applyCnRewrites(options, plan.cnRewrites);
|
|
5923
6021
|
return {
|
|
5924
6022
|
plan,
|
|
5925
6023
|
configUpdated,
|
|
6024
|
+
removedLegacyConfig,
|
|
5926
6025
|
rewrittenFiles,
|
|
5927
6026
|
installedCn,
|
|
5928
6027
|
divergent: options.yes ? [] : await findDivergentComponents(options)
|
|
@@ -5931,12 +6030,13 @@ async function runMigration(options) {
|
|
|
5931
6030
|
// src/commands/migrate.ts
|
|
5932
6031
|
function printDryRun(facts, cnRewrites) {
|
|
5933
6032
|
console.log("Dry run — no files will be modified:\n");
|
|
5934
|
-
if (facts.
|
|
5935
|
-
|
|
5936
|
-
else console.log(
|
|
5937
|
-
if (facts.
|
|
5938
|
-
if (facts.
|
|
5939
|
-
console.log(
|
|
6033
|
+
if (facts.fromLegacyConfigFile) console.log(" components.json → kira-kit.json: convert legacy config");
|
|
6034
|
+
if (facts.hadLegacyRegistryUrl) console.log(` kira-kit.json: remove "registryUrl" (legacy), add "registries['@kira-kit']"`);
|
|
6035
|
+
else if (facts.alreadyHasNamespace && !facts.fromLegacyConfigFile) console.log(" kira-kit.json: already up to date");
|
|
6036
|
+
else if (!facts.alreadyHasNamespace) console.log(` kira-kit.json: add "registries['@kira-kit']"`);
|
|
6037
|
+
if (facts.legacyAlias) console.log(` kira-kit.json: update aliases.lib to "@/lib"`);
|
|
6038
|
+
if (facts.legacySchema || facts.legacyFields) console.log(" kira-kit.json: normalize to the kira-kit schema (flatten css/baseColor, remove legacy keys)");
|
|
6039
|
+
console.log(" rewrite cn imports and calls to the `cn` npm package");
|
|
5940
6040
|
for (const rewrite of cnRewrites) console.log(` ${rewrite.file}: "${rewrite.from}" → "${rewrite.to}"`);
|
|
5941
6041
|
console.log("\nApply with `kira-kit migrate` (no --dry-run).");
|
|
5942
6042
|
}
|
|
@@ -5956,8 +6056,8 @@ async function migrateProject(options) {
|
|
|
5956
6056
|
printDryRun(outcome.plan.facts, outcome.plan.cnRewrites);
|
|
5957
6057
|
return 0;
|
|
5958
6058
|
}
|
|
5959
|
-
if (outcome.configUpdated) success("components.json
|
|
5960
|
-
else info("
|
|
6059
|
+
if (outcome.configUpdated) success(`kira-kit.json updated${outcome.removedLegacyConfig ? " (migrated from components.json)" : " (@kira-kit registry namespace)"}`);
|
|
6060
|
+
else info("kira-kit.json is already up to date (nothing to do)");
|
|
5961
6061
|
if (outcome.rewrittenFiles > 0) success(`Rewrote ${outcome.rewrittenFiles} file${outcome.rewrittenFiles === 1 ? "" : "s"} to the cn package`);
|
|
5962
6062
|
else info("No legacy cn imports found");
|
|
5963
6063
|
if (!options.yes) printDivergence(outcome.divergent);
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kira-kit.vercel.app/schema/kira-kit.json",
|
|
3
|
+
"css": "packages/ui/src/index.css",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"iconLibrary": "tabler",
|
|
6
|
+
"theme": {
|
|
7
|
+
"preset": "default",
|
|
8
|
+
"baseColor": "neutral",
|
|
9
|
+
"font": "geist",
|
|
10
|
+
"fontMono": "geist-mono"
|
|
11
|
+
},
|
|
12
|
+
"aliases": {
|
|
13
|
+
"components": "@/components",
|
|
14
|
+
"ui": "@/components/ui",
|
|
15
|
+
"hooks": "@/hooks",
|
|
16
|
+
"lib": "@/lib"
|
|
17
|
+
},
|
|
18
|
+
"registries": {
|
|
19
|
+
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kira-kit.vercel.app/schema/kira-kit.json",
|
|
3
|
+
"css": "app/globals.css",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"iconLibrary": "tabler",
|
|
6
|
+
"theme": {
|
|
7
|
+
"preset": "default",
|
|
8
|
+
"baseColor": "neutral",
|
|
9
|
+
"font": "geist",
|
|
10
|
+
"fontMono": "geist-mono"
|
|
11
|
+
},
|
|
12
|
+
"aliases": {
|
|
13
|
+
"components": "@/components",
|
|
14
|
+
"ui": "@/components/ui",
|
|
15
|
+
"hooks": "@/hooks",
|
|
16
|
+
"lib": "@/lib"
|
|
17
|
+
},
|
|
18
|
+
"registries": {
|
|
19
|
+
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kira-kit.vercel.app/schema/kira-kit.json",
|
|
3
|
+
"css": "src/index.css",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"iconLibrary": "tabler",
|
|
6
|
+
"theme": {
|
|
7
|
+
"preset": "default",
|
|
8
|
+
"baseColor": "neutral",
|
|
9
|
+
"font": "geist",
|
|
10
|
+
"fontMono": "geist-mono"
|
|
11
|
+
},
|
|
12
|
+
"aliases": {
|
|
13
|
+
"components": "@/components",
|
|
14
|
+
"ui": "@/components/ui",
|
|
15
|
+
"hooks": "@/hooks",
|
|
16
|
+
"lib": "@/lib"
|
|
17
|
+
},
|
|
18
|
+
"registries": {
|
|
19
|
+
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kira-kit.vercel.app/schema/kira-kit.json",
|
|
3
|
+
"css": "src/index.css",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"iconLibrary": "tabler",
|
|
6
|
+
"theme": {
|
|
7
|
+
"preset": "default",
|
|
8
|
+
"baseColor": "neutral",
|
|
9
|
+
"font": "geist",
|
|
10
|
+
"fontMono": "geist-mono"
|
|
11
|
+
},
|
|
12
|
+
"aliases": {
|
|
13
|
+
"components": "@/components",
|
|
14
|
+
"ui": "@/components/ui",
|
|
15
|
+
"hooks": "@/hooks",
|
|
16
|
+
"lib": "@/lib"
|
|
17
|
+
},
|
|
18
|
+
"registries": {
|
|
19
|
+
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://kira-kit.vercel.app/schema/components.json",
|
|
3
|
-
"style": "kira",
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "packages/ui/src/index.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true
|
|
11
|
-
},
|
|
12
|
-
"iconLibrary": "tabler",
|
|
13
|
-
"aliases": {
|
|
14
|
-
"components": "@/components",
|
|
15
|
-
"utils": "@/lib/utils",
|
|
16
|
-
"ui": "@/components/ui",
|
|
17
|
-
"lib": "@/lib",
|
|
18
|
-
"hooks": "@/hooks"
|
|
19
|
-
},
|
|
20
|
-
"registries": {
|
|
21
|
-
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://kira-kit.vercel.app/schema/components.json",
|
|
3
|
-
"style": "kira",
|
|
4
|
-
"rsc": true,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "app/globals.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true
|
|
11
|
-
},
|
|
12
|
-
"aliases": {
|
|
13
|
-
"components": "@/components",
|
|
14
|
-
"utils": "@/lib/utils",
|
|
15
|
-
"ui": "@/components/ui",
|
|
16
|
-
"lib": "@/lib",
|
|
17
|
-
"hooks": "@/hooks"
|
|
18
|
-
},
|
|
19
|
-
"iconLibrary": "tabler",
|
|
20
|
-
"registries": {
|
|
21
|
-
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://kira-kit.vercel.app/schema/components.json",
|
|
3
|
-
"style": "kira",
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "src/index.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true
|
|
11
|
-
},
|
|
12
|
-
"iconLibrary": "tabler",
|
|
13
|
-
"aliases": {
|
|
14
|
-
"components": "@/components",
|
|
15
|
-
"utils": "@/lib/utils",
|
|
16
|
-
"ui": "@/components/ui",
|
|
17
|
-
"lib": "@/lib",
|
|
18
|
-
"hooks": "@/hooks"
|
|
19
|
-
},
|
|
20
|
-
"registries": {
|
|
21
|
-
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://kira-kit.vercel.app/schema/components.json",
|
|
3
|
-
"style": "kira",
|
|
4
|
-
"rsc": false,
|
|
5
|
-
"tsx": true,
|
|
6
|
-
"tailwind": {
|
|
7
|
-
"config": "",
|
|
8
|
-
"css": "src/index.css",
|
|
9
|
-
"baseColor": "neutral",
|
|
10
|
-
"cssVariables": true
|
|
11
|
-
},
|
|
12
|
-
"aliases": {
|
|
13
|
-
"components": "@/components",
|
|
14
|
-
"utils": "@/lib/utils",
|
|
15
|
-
"ui": "@/components/ui",
|
|
16
|
-
"lib": "@/lib",
|
|
17
|
-
"hooks": "@/hooks"
|
|
18
|
-
},
|
|
19
|
-
"iconLibrary": "tabler",
|
|
20
|
-
"registries": {
|
|
21
|
-
"@kira-kit": "https://kira-kit.vercel.app/r/{name}.json"
|
|
22
|
-
}
|
|
23
|
-
}
|