inai-react-components 0.1.6 → 1.2.1
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 +80 -0
- package/dist/commands/add.d.ts +39 -5
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +415 -81
- package/dist/commands/diff.d.ts +6 -0
- package/dist/commands/diff.d.ts.map +1 -1
- package/dist/commands/diff.js +92 -20
- package/dist/commands/init.d.ts +6 -3
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +33 -26
- package/dist/commands/mcp.d.ts +123 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +289 -0
- package/dist/commands/migrate.d.ts +41 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +139 -0
- package/dist/commands/registries.d.ts +46 -0
- package/dist/commands/registries.d.ts.map +1 -0
- package/dist/commands/registries.js +152 -0
- package/dist/commands/remove.d.ts +11 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +170 -0
- package/dist/commands/schema.d.ts +16 -0
- package/dist/commands/schema.d.ts.map +1 -0
- package/dist/commands/schema.js +32 -0
- package/dist/commands/status.d.ts +32 -3
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +148 -25
- package/dist/commands/theme.d.ts.map +1 -1
- package/dist/commands/theme.js +3 -17
- package/dist/commands/update.d.ts +18 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +195 -5
- package/dist/index.js +76 -5
- package/dist/schemas/registry-config.schema.json +62 -0
- package/dist/schemas/registry-item.schema.json +63 -0
- package/dist/schemas/registry.schema.json +15 -0
- package/dist/types/registry.d.ts +50 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/types/registry.js +10 -0
- package/dist/utils/auto-install.d.ts +11 -0
- package/dist/utils/auto-install.d.ts.map +1 -0
- package/dist/utils/auto-install.js +29 -0
- package/dist/utils/framework-detect.d.ts +15 -0
- package/dist/utils/framework-detect.d.ts.map +1 -0
- package/dist/utils/framework-detect.js +90 -0
- package/dist/utils/fuzzy-search.d.ts +16 -0
- package/dist/utils/fuzzy-search.d.ts.map +1 -0
- package/dist/utils/fuzzy-search.js +67 -0
- package/dist/utils/registry-config.d.ts +27 -0
- package/dist/utils/registry-config.d.ts.map +1 -0
- package/dist/utils/registry-config.js +94 -0
- package/dist/utils/registry-resolver.d.ts +26 -0
- package/dist/utils/registry-resolver.d.ts.map +1 -1
- package/dist/utils/registry-resolver.js +134 -10
- package/dist/utils/snapshot.d.ts +20 -0
- package/dist/utils/snapshot.d.ts.map +1 -0
- package/dist/utils/snapshot.js +32 -0
- package/dist/utils/themes.d.ts +17 -0
- package/dist/utils/themes.d.ts.map +1 -0
- package/dist/utils/themes.js +49 -0
- package/package.json +12 -3
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# inai-react-components
|
|
2
|
+
|
|
3
|
+
CLI for the InAI UI component library. Installs components, blocks, and templates from a private registry into your React project following the shadcn/ui copy-paste philosophy.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx inai-react-components init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
| Command | Description |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `inai-ui init [repo-url]` | Initialize InAI UI in the current project (detects framework, writes `components.json`, copies tokens). |
|
|
16
|
+
| `inai-ui add [component]` | Install a component/block/template. Flags: `-a/--all`, `-f/--force`, `--dry-run`, `--skip-existing`. Transitive `registryDependencies` are installed automatically. |
|
|
17
|
+
| `inai-ui sync` | Pull the latest registry cache from the remote repository. |
|
|
18
|
+
| `inai-ui list` | List all available components. Flag: `-c/--category`. |
|
|
19
|
+
| `inai-ui status` | Report component health: `HEALTHY` / `DRIFT` / `OUTDATED` / `MISSING`. Flag: `--json`. |
|
|
20
|
+
| `inai-ui diff <component>` | Unified LCS-based diff between the local component and the registry version. |
|
|
21
|
+
| `inai-ui update <component>` | Update a component with a 3-way merge against the snapshot captured at install time. |
|
|
22
|
+
| `inai-ui theme create` | Create a custom theme based on an existing one. |
|
|
23
|
+
| `inai-ui mcp` | Start the MCP server so AI assistants can drive the CLI. |
|
|
24
|
+
| `inai-ui mcp init` | Print the JSON config fragment for Claude Desktop / Cursor. |
|
|
25
|
+
|
|
26
|
+
## Framework detection
|
|
27
|
+
|
|
28
|
+
`inai-ui init` auto-detects the host framework and picks a sensible CSS entry point:
|
|
29
|
+
|
|
30
|
+
| Framework | CSS entry point |
|
|
31
|
+
|---|---|
|
|
32
|
+
| Next.js (App Router) | `app/globals.css` |
|
|
33
|
+
| Next.js (Pages Router) | `styles/globals.css` |
|
|
34
|
+
| Vite | `src/index.css` |
|
|
35
|
+
| Remix | `app/styles/globals.css` |
|
|
36
|
+
| Astro | `src/styles/globals.css` |
|
|
37
|
+
| TanStack Start | `src/styles/app.css` |
|
|
38
|
+
|
|
39
|
+
## Snapshots & 3-way merge
|
|
40
|
+
|
|
41
|
+
Every `inai-ui add` captures an original-content snapshot at `.inai-ui/snapshots/<name>.json`. `inai-ui update` uses this snapshot as the common ancestor of a 3-way merge (local vs registry), so local edits survive upgrades. Overlapping edits produce standard git-style conflict markers (`<<<<<<<` / `=======` / `>>>>>>>`) that you resolve in your editor.
|
|
42
|
+
|
|
43
|
+
`inai-ui status` uses the same snapshot hashes to report whether a component has drifted from its installed baseline.
|
|
44
|
+
|
|
45
|
+
## MCP server
|
|
46
|
+
|
|
47
|
+
The CLI ships an MCP (Model Context Protocol) server so AI assistants (Claude Desktop, Cursor, any MCP-compatible host) can browse and install components on your behalf.
|
|
48
|
+
|
|
49
|
+
### Register with Claude Desktop / Cursor
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
inai-ui mcp init
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This prints a JSON fragment — drop it into your MCP host's `mcpServers` config:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"inai-ui": {
|
|
61
|
+
"command": "inai-ui",
|
|
62
|
+
"args": ["mcp"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Exposed tools
|
|
69
|
+
|
|
70
|
+
| Tool | Purpose |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `list_components` | List the full registry. Optional `category` filter. |
|
|
73
|
+
| `view_component` | Return the source of a single component (files wrapped in fenced blocks). |
|
|
74
|
+
| `add_component` | Install a component and its transitive deps into the current project. |
|
|
75
|
+
| `diff_component` | Unified diff between local and registry. |
|
|
76
|
+
| `update_component` | Non-interactive update via 3-way merge. |
|
|
77
|
+
| `list_themes` | Enumerate the 34 built-in themes with categories. |
|
|
78
|
+
| `project_status` | JSON status report (`HEALTHY` / `DRIFT` / `OUTDATED` / `MISSING` per component). |
|
|
79
|
+
|
|
80
|
+
The server talks stdio — your MCP host spawns `inai-ui mcp` and communicates with it over stdin/stdout.
|
package/dist/commands/add.d.ts
CHANGED
|
@@ -1,16 +1,47 @@
|
|
|
1
1
|
import { type RegistryComponent } from "./status.js";
|
|
2
|
+
export interface AddOptions {
|
|
3
|
+
/** Overwrite existing files without prompting. */
|
|
4
|
+
force?: boolean;
|
|
5
|
+
/** Print actions without writing files. */
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
/** If a file already exists, skip it silently. */
|
|
8
|
+
skipExisting?: boolean;
|
|
9
|
+
/** Use cached registries without network access. */
|
|
10
|
+
offline?: boolean;
|
|
11
|
+
/** Skip automatic npm dependency installation. */
|
|
12
|
+
skipInstall?: boolean;
|
|
13
|
+
}
|
|
2
14
|
export interface AddResult {
|
|
3
15
|
added: boolean;
|
|
4
16
|
message: string;
|
|
5
17
|
files: string[];
|
|
6
18
|
npmDeps: string[];
|
|
7
19
|
internalDeps: string[];
|
|
20
|
+
/** Registry deps resolved transitively (empty if none). */
|
|
21
|
+
resolvedDeps?: string[];
|
|
22
|
+
/** Files that were skipped because they already existed. */
|
|
23
|
+
skipped?: string[];
|
|
24
|
+
/** Fuzzy search suggestions when component name was not found. */
|
|
25
|
+
suggestions?: {
|
|
26
|
+
name: string;
|
|
27
|
+
score: number;
|
|
28
|
+
}[];
|
|
8
29
|
}
|
|
9
30
|
/**
|
|
10
|
-
* Parse a component spec
|
|
11
|
-
*
|
|
31
|
+
* Parse a component spec into its registry namespace, type prefix and name.
|
|
32
|
+
*
|
|
33
|
+
* Supported forms:
|
|
34
|
+
* - `button` → { registry: null, prefix: null, name: "button" }
|
|
35
|
+
* - `block/auth-login` → { registry: null, prefix: "block", name: "auth-login" }
|
|
36
|
+
* - `template/admin-dashboard` → { registry: null, prefix: "template", name: "admin-dashboard" }
|
|
37
|
+
* - `@acme/custom-button` → { registry: "acme", prefix: null, name: "custom-button" }
|
|
38
|
+
* - `@acme/block/hero` → { registry: "acme", prefix: "block", name: "hero" }
|
|
39
|
+
*
|
|
40
|
+
* `registry` is null when the caller did not specify a `@namespace/` — the
|
|
41
|
+
* default registry (from `components.json`) should then be used.
|
|
12
42
|
*/
|
|
13
43
|
export declare function parseComponentSpec(spec: string): {
|
|
44
|
+
registry: string | null;
|
|
14
45
|
prefix: string | null;
|
|
15
46
|
name: string;
|
|
16
47
|
};
|
|
@@ -28,9 +59,12 @@ export declare function findInRegistry(registry: {
|
|
|
28
59
|
export declare function getTargetDir(component: RegistryComponent, aliases: {
|
|
29
60
|
components: string;
|
|
30
61
|
blocks: string;
|
|
62
|
+
templates?: string;
|
|
31
63
|
}): string;
|
|
32
|
-
export declare function runAdd(componentSpec: string, rootDir: string): Promise<AddResult>;
|
|
33
|
-
export
|
|
64
|
+
export declare function runAdd(componentSpec: string, rootDir: string, options?: AddOptions): Promise<AddResult>;
|
|
65
|
+
export interface AddCommandOptions extends AddOptions {
|
|
34
66
|
all?: boolean;
|
|
35
|
-
|
|
67
|
+
skipInstall?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare function addCommand(componentSpec?: string, options?: AddCommandOptions): Promise<void>;
|
|
36
70
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,iBAAiB,EAIvB,MAAM,aAAa,CAAC;AAmBrB,MAAM,WAAW,UAAU;IACzB,kDAAkD;IAClD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,kEAAkE;IAClE,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAChD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACx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