arloui 0.1.3

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.
@@ -0,0 +1,323 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const CONFIG_FILE = "arlo.json";
4
+ declare const arloConfigSchema: z.ZodObject<{
5
+ $schema: z.ZodString;
6
+ /** URL of the registry index — defaults to the public CDN. */
7
+ registry: z.ZodString;
8
+ /** Where to write component files (relative to project root). */
9
+ aliases: z.ZodObject<{
10
+ components: z.ZodString;
11
+ tokens: z.ZodString;
12
+ theme: z.ZodString;
13
+ lib: z.ZodString;
14
+ }, "strict", z.ZodTypeAny, {
15
+ components: string;
16
+ tokens: string;
17
+ theme: string;
18
+ lib: string;
19
+ }, {
20
+ components: string;
21
+ tokens: string;
22
+ theme: string;
23
+ lib: string;
24
+ }>;
25
+ /** Style preference. Reserved for future variants (e.g. `compact`). */
26
+ style: z.ZodLiteral<"default">;
27
+ }, "strict", z.ZodTypeAny, {
28
+ $schema: string;
29
+ registry: string;
30
+ aliases: {
31
+ components: string;
32
+ tokens: string;
33
+ theme: string;
34
+ lib: string;
35
+ };
36
+ style: "default";
37
+ }, {
38
+ $schema: string;
39
+ registry: string;
40
+ aliases: {
41
+ components: string;
42
+ tokens: string;
43
+ theme: string;
44
+ lib: string;
45
+ };
46
+ style: "default";
47
+ }>;
48
+ type ArloConfig = z.infer<typeof arloConfigSchema>;
49
+ declare const DEFAULT_CONFIG: ArloConfig;
50
+ declare function loadConfig(cwd: string): Promise<ArloConfig | null>;
51
+ declare function saveConfig(cwd: string, config: ArloConfig): Promise<void>;
52
+
53
+ /**
54
+ * Runtime validation for everything the CLI fetches from a registry.
55
+ *
56
+ * The registry is a *remote*, user-configurable URL — `add.ts` turns whatever
57
+ * comes back into files written onto the user's disk. We therefore never trust
58
+ * the shape of that JSON: every payload is parsed through these zod schemas
59
+ * before it is used, so a malformed (or malicious) registry produces a clear
60
+ * error instead of a confusing crash or an unsafe write.
61
+ *
62
+ * The shapes mirror `@arloui/registry`'s `schema.ts` and the output of
63
+ * `tooling/build-registry`.
64
+ */
65
+
66
+ /** A fully-resolved entry as served at `<base>/<name>.json`. */
67
+ declare const resolvedRegistryEntrySchema: z.ZodObject<{
68
+ files: z.ZodArray<z.ZodObject<{
69
+ target: z.ZodString;
70
+ source: z.ZodOptional<z.ZodString>;
71
+ type: z.ZodOptional<z.ZodEnum<["component", "utility", "theme", "tokens", "example"]>>;
72
+ content: z.ZodString;
73
+ }, "strict", z.ZodTypeAny, {
74
+ target: string;
75
+ content: string;
76
+ type?: "tokens" | "theme" | "utility" | "component" | "example" | undefined;
77
+ source?: string | undefined;
78
+ }, {
79
+ target: string;
80
+ content: string;
81
+ type?: "tokens" | "theme" | "utility" | "component" | "example" | undefined;
82
+ source?: string | undefined;
83
+ }>, "many">;
84
+ hash: z.ZodString;
85
+ name: z.ZodString;
86
+ kind: z.ZodEnum<["primitive", "pattern", "foundation", "icon"]>;
87
+ title: z.ZodString;
88
+ description: z.ZodString;
89
+ registryDependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
90
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
91
+ nativeDeps: z.ZodOptional<z.ZodArray<z.ZodObject<{
92
+ name: z.ZodString;
93
+ setup: z.ZodString;
94
+ }, "strip", z.ZodTypeAny, {
95
+ name: string;
96
+ setup: string;
97
+ }, {
98
+ name: string;
99
+ setup: string;
100
+ }>, "many">>;
101
+ meta: z.ZodOptional<z.ZodObject<{
102
+ figma: z.ZodOptional<z.ZodString>;
103
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
104
+ }, "strip", z.ZodTypeAny, {
105
+ figma?: string | undefined;
106
+ tags?: string[] | undefined;
107
+ }, {
108
+ figma?: string | undefined;
109
+ tags?: string[] | undefined;
110
+ }>>;
111
+ }, "strict", z.ZodTypeAny, {
112
+ name: string;
113
+ kind: "primitive" | "pattern" | "foundation" | "icon";
114
+ title: string;
115
+ description: string;
116
+ files: {
117
+ target: string;
118
+ content: string;
119
+ type?: "tokens" | "theme" | "utility" | "component" | "example" | undefined;
120
+ source?: string | undefined;
121
+ }[];
122
+ hash: string;
123
+ registryDependencies?: string[] | undefined;
124
+ dependencies?: string[] | undefined;
125
+ nativeDeps?: {
126
+ name: string;
127
+ setup: string;
128
+ }[] | undefined;
129
+ meta?: {
130
+ figma?: string | undefined;
131
+ tags?: string[] | undefined;
132
+ } | undefined;
133
+ }, {
134
+ name: string;
135
+ kind: "primitive" | "pattern" | "foundation" | "icon";
136
+ title: string;
137
+ description: string;
138
+ files: {
139
+ target: string;
140
+ content: string;
141
+ type?: "tokens" | "theme" | "utility" | "component" | "example" | undefined;
142
+ source?: string | undefined;
143
+ }[];
144
+ hash: string;
145
+ registryDependencies?: string[] | undefined;
146
+ dependencies?: string[] | undefined;
147
+ nativeDeps?: {
148
+ name: string;
149
+ setup: string;
150
+ }[] | undefined;
151
+ meta?: {
152
+ figma?: string | undefined;
153
+ tags?: string[] | undefined;
154
+ } | undefined;
155
+ }>;
156
+ declare const registryIndexSchema: z.ZodObject<{
157
+ $schema: z.ZodOptional<z.ZodString>;
158
+ version: z.ZodString;
159
+ generatedAt: z.ZodOptional<z.ZodString>;
160
+ items: z.ZodArray<z.ZodObject<{
161
+ name: z.ZodString;
162
+ kind: z.ZodEnum<["primitive", "pattern", "foundation", "icon"]>;
163
+ title: z.ZodString;
164
+ description: z.ZodString;
165
+ registryDependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
166
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
167
+ nativeDeps: z.ZodOptional<z.ZodArray<z.ZodObject<{
168
+ name: z.ZodString;
169
+ setup: z.ZodString;
170
+ }, "strip", z.ZodTypeAny, {
171
+ name: string;
172
+ setup: string;
173
+ }, {
174
+ name: string;
175
+ setup: string;
176
+ }>, "many">>;
177
+ meta: z.ZodOptional<z.ZodObject<{
178
+ figma: z.ZodOptional<z.ZodString>;
179
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ figma?: string | undefined;
182
+ tags?: string[] | undefined;
183
+ }, {
184
+ figma?: string | undefined;
185
+ tags?: string[] | undefined;
186
+ }>>;
187
+ }, "strict", z.ZodTypeAny, {
188
+ name: string;
189
+ kind: "primitive" | "pattern" | "foundation" | "icon";
190
+ title: string;
191
+ description: string;
192
+ registryDependencies?: string[] | undefined;
193
+ dependencies?: string[] | undefined;
194
+ nativeDeps?: {
195
+ name: string;
196
+ setup: string;
197
+ }[] | undefined;
198
+ meta?: {
199
+ figma?: string | undefined;
200
+ tags?: string[] | undefined;
201
+ } | undefined;
202
+ }, {
203
+ name: string;
204
+ kind: "primitive" | "pattern" | "foundation" | "icon";
205
+ title: string;
206
+ description: string;
207
+ registryDependencies?: string[] | undefined;
208
+ dependencies?: string[] | undefined;
209
+ nativeDeps?: {
210
+ name: string;
211
+ setup: string;
212
+ }[] | undefined;
213
+ meta?: {
214
+ figma?: string | undefined;
215
+ tags?: string[] | undefined;
216
+ } | undefined;
217
+ }>, "many">;
218
+ }, "strict", z.ZodTypeAny, {
219
+ version: string;
220
+ items: {
221
+ name: string;
222
+ kind: "primitive" | "pattern" | "foundation" | "icon";
223
+ title: string;
224
+ description: string;
225
+ registryDependencies?: string[] | undefined;
226
+ dependencies?: string[] | undefined;
227
+ nativeDeps?: {
228
+ name: string;
229
+ setup: string;
230
+ }[] | undefined;
231
+ meta?: {
232
+ figma?: string | undefined;
233
+ tags?: string[] | undefined;
234
+ } | undefined;
235
+ }[];
236
+ $schema?: string | undefined;
237
+ generatedAt?: string | undefined;
238
+ }, {
239
+ version: string;
240
+ items: {
241
+ name: string;
242
+ kind: "primitive" | "pattern" | "foundation" | "icon";
243
+ title: string;
244
+ description: string;
245
+ registryDependencies?: string[] | undefined;
246
+ dependencies?: string[] | undefined;
247
+ nativeDeps?: {
248
+ name: string;
249
+ setup: string;
250
+ }[] | undefined;
251
+ meta?: {
252
+ figma?: string | undefined;
253
+ tags?: string[] | undefined;
254
+ } | undefined;
255
+ }[];
256
+ $schema?: string | undefined;
257
+ generatedAt?: string | undefined;
258
+ }>;
259
+ type ResolvedRegistryEntry = z.infer<typeof resolvedRegistryEntrySchema>;
260
+ type RegistryIndex = z.infer<typeof registryIndexSchema>;
261
+
262
+ /** Subset of the global `fetch` we depend on — injectable so tests can stub it. */
263
+ type FetchLike = (input: string, init?: {
264
+ signal?: AbortSignal;
265
+ }) => Promise<{
266
+ ok: boolean;
267
+ status: number;
268
+ statusText: string;
269
+ json: () => Promise<unknown>;
270
+ }>;
271
+ type RegistryClientOptions = {
272
+ /** Abort a request that takes longer than this (ms). Default 15s. */
273
+ timeoutMs?: number;
274
+ /** Override the fetch implementation (tests / custom transports). */
275
+ fetch?: FetchLike;
276
+ };
277
+ declare class RegistryClient {
278
+ private readonly base;
279
+ private readonly timeoutMs;
280
+ private readonly fetchImpl;
281
+ constructor(base: string, options?: RegistryClientOptions);
282
+ index(): Promise<RegistryIndex>;
283
+ get(name: string): Promise<ResolvedRegistryEntry>;
284
+ /**
285
+ * Returns the entry plus all transitive registry dependencies, deduped and
286
+ * ordered foundation → primitive → pattern → icon so dependencies are written
287
+ * before the components that rely on them. Safe against dependency cycles.
288
+ */
289
+ resolve(name: string): Promise<ResolvedRegistryEntry[]>;
290
+ private fetchJson;
291
+ }
292
+
293
+ type Options$3 = {
294
+ cwd: string;
295
+ names: string[];
296
+ yes?: boolean;
297
+ overwrite?: boolean;
298
+ };
299
+ declare function add({ cwd, names, yes, overwrite }: Options$3): Promise<void>;
300
+
301
+ type Options$2 = {
302
+ cwd: string;
303
+ name?: string;
304
+ };
305
+ /**
306
+ * Compare locally-installed component files to the latest registry version.
307
+ * This is the equivalent of `shadcn diff` — it does NOT modify files. It just
308
+ * surfaces drift so the user can decide whether to re-run `add --overwrite`.
309
+ */
310
+ declare function diff({ cwd, name }: Options$2): Promise<void>;
311
+
312
+ type Options$1 = {
313
+ cwd: string;
314
+ yes?: boolean;
315
+ };
316
+ declare function init({ cwd, yes }: Options$1): Promise<void>;
317
+
318
+ type Options = {
319
+ cwd: string;
320
+ };
321
+ declare function list({ cwd }: Options): Promise<void>;
322
+
323
+ export { type ArloConfig, CONFIG_FILE, DEFAULT_CONFIG, RegistryClient, add, diff, init, list, loadConfig, saveConfig };
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "arloui",
3
+ "version": "0.1.3",
4
+ "description": "Arlo UI CLI — copy-paste React Native components, tokens, and patterns into your Expo or bare RN app.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.cjs",
9
+ "types": "./dist/index.d.cts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.cts",
13
+ "import": "./dist/index.cjs",
14
+ "require": "./dist/index.cjs",
15
+ "default": "./dist/index.cjs"
16
+ }
17
+ },
18
+ "bin": {
19
+ "arloui": "dist/cli.cjs"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "homepage": "https://arloui.dev",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/Base16-Labs/arloui.git",
28
+ "directory": "packages/cli"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "provenance": false
33
+ },
34
+ "keywords": [
35
+ "react-native",
36
+ "expo",
37
+ "ui",
38
+ "components",
39
+ "design-system",
40
+ "shadcn",
41
+ "tailwind-ui"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "dev": "tsup --watch",
46
+ "typecheck": "tsc --noEmit",
47
+ "lint": "eslint src",
48
+ "test": "vitest run --coverage",
49
+ "test:watch": "vitest",
50
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
51
+ "clean": "rm -rf dist .turbo",
52
+ "start": "node dist/cli.cjs"
53
+ },
54
+ "dependencies": {
55
+ "@clack/prompts": "^0.7.0",
56
+ "commander": "^12.1.0",
57
+ "kleur": "^4.1.5",
58
+ "ora": "^8.1.0",
59
+ "zod": "^3.25.76"
60
+ },
61
+ "devDependencies": {
62
+ "@arloui/eslint-config": "file:../eslint-config",
63
+ "@arloui/registry": "file:../registry",
64
+ "@arloui/tsconfig": "file:../tsconfig",
65
+ "@types/node": "^20.16.10",
66
+ "tsup": "^8.3.0",
67
+ "typescript": "^5.6.2",
68
+ "vitest": "^2.1.9"
69
+ }
70
+ }