@foundrykit/cli 1.0.16 → 2.0.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/.turbo/turbo-build.log +20 -0
- package/.turbo/turbo-test.log +42 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/CHANGELOG.md +17 -0
- package/README.md +29 -311
- package/dist/cli.js +217 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.js +217 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/commands/add.ts +39 -13
- package/src/commands/doctor.ts +117 -1
- package/src/commands/update.ts +145 -5
- package/src/lib/constants.ts +1 -1
- package/src/lib/registry.ts +19 -6
- package/tests/dependency-resolution.test.ts +9 -9
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @foundrykit/cli@1.0.16 build /Users/isj/Desktop/work/projects/foundry/packages/cli
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: {"index":"src/index.ts","cli":"src/index.ts"}
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.0
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/isj/Desktop/work/projects/foundry/packages/cli/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: es2022
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist/cli.js [22m[32m52.51 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m52.51 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/cli.js.map [22m[32m100.57 KB[39m
|
|
16
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m100.57 KB[39m
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 447ms
|
|
18
|
+
DTS Build start
|
|
19
|
+
DTS ⚡️ Build success in 4955ms
|
|
20
|
+
DTS dist/index.d.ts 20.00 B
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
> @foundrykit/cli@1.0.16 test /Users/isj/Desktop/work/projects/foundry/packages/cli
|
|
3
|
+
> vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
RUN v1.6.1 /Users/isj/Desktop/work/projects/foundry/packages/cli
|
|
7
|
+
|
|
8
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Registry Component Fetching > should fetch regular components from registry
|
|
9
|
+
Fetching component: https://test.registry.com/registry/button
|
|
10
|
+
|
|
11
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Registry Component Fetching > should handle 404 errors for non-existent components
|
|
12
|
+
Fetching component: https://test.registry.com/registry/non-existent
|
|
13
|
+
|
|
14
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Registry Component Fetching > should handle network errors gracefully
|
|
15
|
+
Fetching component: https://test.registry.com/registry/button
|
|
16
|
+
|
|
17
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Cache Management > should cache fetched components
|
|
18
|
+
Fetching component: https://test.registry.com/registry/card
|
|
19
|
+
|
|
20
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Cache Management > should cache fetched components
|
|
21
|
+
Using cached data for component: card
|
|
22
|
+
|
|
23
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Cache Management > should clear cache when requested
|
|
24
|
+
Cache cleared successfully
|
|
25
|
+
|
|
26
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Dependency Chain Resolution > should resolve multiple dependencies in order
|
|
27
|
+
Fetching component: https://test.registry.com/registry/button
|
|
28
|
+
|
|
29
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Dependency Chain Resolution > should resolve multiple dependencies in order
|
|
30
|
+
Fetching component: https://test.registry.com/registry/card
|
|
31
|
+
|
|
32
|
+
stdout | tests/dependency-resolution.test.ts > Dependency Resolution > Dependency Chain Resolution > should continue installation when a dependency fails
|
|
33
|
+
Fetching component: https://test.registry.com/registry/non-existent
|
|
34
|
+
Fetching component: https://test.registry.com/registry/button
|
|
35
|
+
|
|
36
|
+
✓ tests/dependency-resolution.test.ts (14 tests) 32ms
|
|
37
|
+
|
|
38
|
+
Test Files 1 passed (1)
|
|
39
|
+
Tests 14 passed (14)
|
|
40
|
+
Start at 14:01:44
|
|
41
|
+
Duration 481ms (transform 58ms, setup 0ms, collect 160ms, tests 32ms, environment 0ms, prepare 47ms)
|
|
42
|
+
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @foundrykit/cli
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- changes to how the cli works with updates
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @foundrykit/types@1.1.0
|
|
13
|
+
|
|
14
|
+
## 1.1.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- c666749: mass update
|
|
19
|
+
|
|
3
20
|
## 1.0.16
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,180 +1,43 @@
|
|
|
1
1
|
# @foundrykit/cli
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## Features
|
|
7
|
-
|
|
8
|
-
- 🌐 **Live Registry** - Fetches components from the hosted registry at
|
|
9
|
-
[foundry.umiflow.com](https://foundry.umiflow.com)
|
|
10
|
-
- 🎨 **Interactive Selection** - Multi-select components with keyboard
|
|
11
|
-
navigation
|
|
12
|
-
- 📦 **Smart Dependencies** - Automatically installs required component
|
|
13
|
-
dependencies
|
|
14
|
-
- 🎯 **Tailwind CSS v4** - Full support for the latest Tailwind CSS version
|
|
15
|
-
- 🔄 **Auto-updates** - Registry automatically updates when new components are
|
|
16
|
-
released
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
### Global Installation (Recommended)
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Using pnpm (recommended)
|
|
24
|
-
pnpm add -g @foundrykit/cli
|
|
25
|
-
|
|
26
|
-
# Using npm
|
|
27
|
-
npm install -g @foundrykit/cli
|
|
28
|
-
|
|
29
|
-
# Using yarn
|
|
30
|
-
yarn global add @foundrykit/cli
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Local Installation
|
|
34
|
-
|
|
35
|
-
You can also use the CLI without installing it globally:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npx @foundrykit/cli [command]
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Quick Start
|
|
42
|
-
|
|
43
|
-
Initialize FoundryKit in your Next.js project:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
foundrykit init
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
This will:
|
|
50
|
-
|
|
51
|
-
- ✅ Detect your Next.js project
|
|
52
|
-
- ✅ Install required FoundryKit dependencies
|
|
53
|
-
- ✅ Set up Tailwind CSS v4 configuration
|
|
54
|
-
- ✅ Create necessary directories and files
|
|
55
|
-
- ✅ Add helper scripts to your package.json
|
|
3
|
+
The FoundryKit CLI initializes projects and installs components from the
|
|
4
|
+
FoundryKit registry.
|
|
56
5
|
|
|
57
6
|
## Commands
|
|
58
7
|
|
|
59
8
|
### `init`
|
|
60
9
|
|
|
61
|
-
|
|
10
|
+
Creates `foundrykit.config.json`, installs the utility helper, prepares target
|
|
11
|
+
directories, and updates package scripts for a Next.js project.
|
|
62
12
|
|
|
63
13
|
```bash
|
|
64
|
-
foundrykit init
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**Options:**
|
|
68
|
-
|
|
69
|
-
- `-f, --force` - Overwrite existing files
|
|
70
|
-
- `--skip-install` - Skip installing dependencies
|
|
71
|
-
- `--skip-prompts` - Use default paths without prompting for customization
|
|
72
|
-
|
|
73
|
-
**What it does:**
|
|
74
|
-
|
|
75
|
-
1. Validates that you're in a React-based project (Next.js, Vite, Remix)
|
|
76
|
-
2. **Detects your project structure** and suggests smart default paths
|
|
77
|
-
3. **Prompts for custom paths** - you can customize where files and folders are
|
|
78
|
-
created
|
|
79
|
-
4. Installs required dependencies (if not in a workspace)
|
|
80
|
-
5. Sets up Tailwind CSS v4 with FoundryKit styles
|
|
81
|
-
6. Creates component directories in your chosen locations
|
|
82
|
-
7. Creates utility files (`lib/utils.ts` or custom path)
|
|
83
|
-
8. Updates your layout/App file to import FoundryKit styles
|
|
84
|
-
9. Adds convenient scripts to package.json
|
|
85
|
-
|
|
86
|
-
**Path Customization:** The init command now intelligently detects your project
|
|
87
|
-
structure and offers to customize paths:
|
|
88
|
-
|
|
89
|
-
- Automatically detects if you use `src/` directory
|
|
90
|
-
- Finds existing `components/`, `lib/`, `styles/` directories
|
|
91
|
-
- Suggests appropriate defaults based on your framework (Next.js, Vite, Remix)
|
|
92
|
-
- Allows you to customize each path individually
|
|
93
|
-
|
|
94
|
-
Example prompts:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
📂 Configure installation paths:
|
|
98
|
-
Press enter to use the default value shown in parentheses
|
|
99
|
-
|
|
100
|
-
? Utils file path: (./src/lib/utils.ts)
|
|
101
|
-
? Components directory: (./src/components/components)
|
|
102
|
-
? Primitives directory: (./src/components/primitives)
|
|
103
|
-
? Blocks directory: (./src/components/blocks)
|
|
104
|
-
? Hooks directory: (./src/hooks)
|
|
105
|
-
? Animations directory: (./src/components/animations)
|
|
106
|
-
? Global styles file: (./src/app/globals.css)
|
|
107
|
-
? Lib directory: (./src/lib)
|
|
14
|
+
foundrykit init
|
|
108
15
|
```
|
|
109
16
|
|
|
110
17
|
### `list`
|
|
111
18
|
|
|
112
|
-
|
|
19
|
+
Lists available registry components.
|
|
113
20
|
|
|
114
21
|
```bash
|
|
115
|
-
foundrykit list [options]
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Options:**
|
|
119
|
-
|
|
120
|
-
- `-c, --category <category>` - Filter by category (primitives, components,
|
|
121
|
-
blocks)
|
|
122
|
-
- `-s, --search <term>` - Search components by name or description
|
|
123
|
-
|
|
124
|
-
**Examples:**
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
# List all components
|
|
128
22
|
foundrykit list
|
|
129
|
-
|
|
130
|
-
# List only blocks
|
|
131
|
-
foundrykit list -c blocks
|
|
132
|
-
|
|
133
|
-
# Search for button components
|
|
23
|
+
foundrykit list -c primitives
|
|
134
24
|
foundrykit list -s button
|
|
135
|
-
|
|
136
|
-
# Components are fetched from https://foundry.umiflow.com/registry
|
|
137
25
|
```
|
|
138
26
|
|
|
139
27
|
### `add`
|
|
140
28
|
|
|
141
|
-
|
|
142
|
-
|
|
29
|
+
Fetches a component from the registry, installs its files, installs any missing
|
|
30
|
+
package dependencies, and prints a usage hint.
|
|
143
31
|
|
|
144
32
|
```bash
|
|
145
|
-
foundrykit add <component-id> [options]
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**Options:**
|
|
149
|
-
|
|
150
|
-
- `-o, --overwrite` - Overwrite existing files
|
|
151
|
-
- `-p, --path <path>` - Custom installation path
|
|
152
|
-
|
|
153
|
-
**Examples:**
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
# Interactive mode - select from a list of all components
|
|
157
|
-
foundrykit add
|
|
158
|
-
|
|
159
|
-
# Add a specific component from the registry
|
|
160
33
|
foundrykit add hero-minimal
|
|
161
|
-
|
|
162
|
-
# Add a button component to a custom path
|
|
163
|
-
foundrykit add button -p components/custom
|
|
164
|
-
|
|
165
|
-
# Overwrite existing component
|
|
166
|
-
foundrykit add card -o
|
|
34
|
+
foundrykit add button -o
|
|
167
35
|
```
|
|
168
36
|
|
|
169
37
|
### `update`
|
|
170
38
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
foundrykit update <component-id>
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Example:**
|
|
39
|
+
Reinstalls a component with overwrite semantics using the same registry-backed
|
|
40
|
+
installation flow as `add`.
|
|
178
41
|
|
|
179
42
|
```bash
|
|
180
43
|
foundrykit update hero-minimal
|
|
@@ -182,176 +45,31 @@ foundrykit update hero-minimal
|
|
|
182
45
|
|
|
183
46
|
### `doctor`
|
|
184
47
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
foundrykit doctor
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
This command checks:
|
|
192
|
-
|
|
193
|
-
- Next.js installation
|
|
194
|
-
- FoundryKit dependencies
|
|
195
|
-
- Tailwind CSS v4 configuration
|
|
196
|
-
- Project structure
|
|
197
|
-
- Common issues and fixes
|
|
198
|
-
|
|
199
|
-
## Tailwind CSS v4 Support
|
|
200
|
-
|
|
201
|
-
FoundryKit CLI is built for Tailwind CSS v4, which uses CSS-based configuration
|
|
202
|
-
instead of JavaScript config files. The CLI will:
|
|
203
|
-
|
|
204
|
-
1. Import FoundryKit's pre-configured Tailwind CSS v4 styles
|
|
205
|
-
2. Set up proper CSS variables for theming
|
|
206
|
-
3. Configure dark mode support
|
|
207
|
-
4. Include all necessary Tailwind directives
|
|
208
|
-
|
|
209
|
-
Your `globals.css` will be updated to include:
|
|
210
|
-
|
|
211
|
-
```css
|
|
212
|
-
@import '@foundrykit/tailwind/globals.css';
|
|
213
|
-
```
|
|
48
|
+
Validates that:
|
|
214
49
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
- Dark mode configuration
|
|
220
|
-
- Component-specific styles
|
|
221
|
-
- Proper content scanning for all FoundryKit packages
|
|
222
|
-
|
|
223
|
-
## Working in a Monorepo
|
|
224
|
-
|
|
225
|
-
If you're using FoundryKit in a monorepo with workspace packages (like pnpm
|
|
226
|
-
workspaces), the CLI will:
|
|
227
|
-
|
|
228
|
-
1. Detect the workspace configuration
|
|
229
|
-
2. Skip installing dependencies (they're already linked via workspace)
|
|
230
|
-
3. Use the local workspace packages instead of npm registry
|
|
231
|
-
|
|
232
|
-
## Package.json Scripts
|
|
233
|
-
|
|
234
|
-
After initialization, you'll have these convenient scripts:
|
|
235
|
-
|
|
236
|
-
```json
|
|
237
|
-
{
|
|
238
|
-
"scripts": {
|
|
239
|
-
"foundrykit": "foundrykit",
|
|
240
|
-
"fk": "foundrykit"
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
Use them like:
|
|
50
|
+
- `package.json` exists
|
|
51
|
+
- Next.js is detected
|
|
52
|
+
- `foundrykit.config.json` exists and has the expected shape
|
|
53
|
+
- the configured registry URL is reachable
|
|
246
54
|
|
|
247
55
|
```bash
|
|
248
|
-
|
|
249
|
-
pnpm fk add hero-minimal
|
|
250
|
-
yarn fk doctor
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Project Structure
|
|
254
|
-
|
|
255
|
-
After initialization, your project will have:
|
|
256
|
-
|
|
257
|
-
```
|
|
258
|
-
your-nextjs-app/
|
|
259
|
-
├── app/
|
|
260
|
-
│ ├── layout.tsx # Updated with FoundryKit imports
|
|
261
|
-
│ └── globals.css # Tailwind CSS v4 with FoundryKit styles
|
|
262
|
-
├── components/
|
|
263
|
-
│ ├── ui/ # UI components
|
|
264
|
-
│ ├── blocks/ # Page blocks
|
|
265
|
-
│ └── providers.tsx # Theme provider setup
|
|
266
|
-
├── lib/
|
|
267
|
-
│ └── utils.ts # Utility functions (cn, etc.)
|
|
268
|
-
└── hooks/ # Custom React hooks
|
|
56
|
+
foundrykit doctor
|
|
269
57
|
```
|
|
270
58
|
|
|
271
|
-
##
|
|
272
|
-
|
|
273
|
-
- Node.js 18.0.0 or higher
|
|
274
|
-
- React 18 or 19
|
|
275
|
-
- One of the following frameworks:
|
|
276
|
-
- Next.js 14.0.0 or higher
|
|
277
|
-
- Vite 5.0.0 or higher
|
|
278
|
-
- Remix 2.0.0 or higher
|
|
279
|
-
- Tailwind CSS v4
|
|
280
|
-
|
|
281
|
-
## Troubleshooting
|
|
282
|
-
|
|
283
|
-
### Command not found
|
|
284
|
-
|
|
285
|
-
If you get `command not found: foundrykit` after global installation with pnpm:
|
|
286
|
-
|
|
287
|
-
1. Ensure your pnpm global bin directory is in your PATH:
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
export PATH="$PNPM_HOME:$PATH"
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
2. Or use the local installation method:
|
|
294
|
-
```bash
|
|
295
|
-
npx @foundrykit/cli [command]
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Workspace Detection
|
|
299
|
-
|
|
300
|
-
If you're in a monorepo and the CLI tries to install packages from npm:
|
|
301
|
-
|
|
302
|
-
1. Ensure your `pnpm-workspace.yaml` is properly configured
|
|
303
|
-
2. Check that workspace packages use `workspace:*` protocol
|
|
304
|
-
3. Use `--skip-install` flag and link packages manually if needed
|
|
305
|
-
|
|
306
|
-
### Tailwind CSS v4
|
|
307
|
-
|
|
308
|
-
If you're migrating from Tailwind CSS v3:
|
|
59
|
+
## Registry Contract
|
|
309
60
|
|
|
310
|
-
|
|
311
|
-
2. Update your CSS imports to use `@import` directives
|
|
312
|
-
3. Run `foundrykit init --force` to set up v4 configuration
|
|
61
|
+
The CLI uses the registry configured in `foundrykit.config.json`.
|
|
313
62
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
Contributions are welcome! Please see our
|
|
317
|
-
[Contributing Guide](../../CONTRIBUTING.md) for details.
|
|
318
|
-
|
|
319
|
-
## License
|
|
320
|
-
|
|
321
|
-
MIT © FoundryKit
|
|
322
|
-
|
|
323
|
-
## Registry
|
|
324
|
-
|
|
325
|
-
FoundryKit components are served from a live registry hosted at
|
|
326
|
-
[foundry.umiflow.com](https://foundry.umiflow.com). The registry automatically
|
|
327
|
-
updates when new components are released on GitHub.
|
|
328
|
-
|
|
329
|
-
### Registry Endpoints
|
|
330
|
-
|
|
331
|
-
- **Component List**: `https://foundry.umiflow.com/registry` - Returns all
|
|
332
|
-
component metadata
|
|
333
|
-
- **Individual Component**: `https://foundry.umiflow.com/registry/[id]` -
|
|
334
|
-
Returns full component data including files
|
|
335
|
-
- **Filtered List**:
|
|
336
|
-
`https://foundry.umiflow.com/registry?category=primitives&search=button` -
|
|
337
|
-
Supports filtering
|
|
338
|
-
|
|
339
|
-
### Custom Registry
|
|
340
|
-
|
|
341
|
-
To use a custom registry, set the environment variable:
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
export FOUNDRYKIT_REGISTRY_URL=https://your-registry.com
|
|
345
|
-
foundrykit list
|
|
346
|
-
```
|
|
63
|
+
Canonical endpoints:
|
|
347
64
|
|
|
348
|
-
|
|
65
|
+
- `GET {registry}/registry`
|
|
66
|
+
- `GET {registry}/registry/{id}`
|
|
349
67
|
|
|
350
|
-
|
|
351
|
-
|
|
68
|
+
Legacy `/api/components` endpoints may still exist on the host for
|
|
69
|
+
compatibility, but the CLI should be considered a `/registry` consumer.
|
|
352
70
|
|
|
353
|
-
##
|
|
71
|
+
## Notes
|
|
354
72
|
|
|
355
|
-
-
|
|
356
|
-
-
|
|
357
|
-
-
|
|
73
|
+
- The CLI currently targets Next.js projects.
|
|
74
|
+
- `test` runs in non-watch mode by default for CI friendliness.
|
|
75
|
+
- Installation paths are controlled by `foundrykit.config.json`.
|