@astralkit/cli 4.1.1 → 4.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 CHANGED
@@ -1,212 +1,115 @@
1
1
  # @astralkit/cli
2
2
 
3
- Install and manage AstralKit UI components, boosters, and workflows in your project.
3
+ Install and manage AstralKit UI components, boosters, and workflows in your React and Next.js projects.
4
4
 
5
5
  ## Quick Start
6
6
 
7
7
  ```bash
8
- # Initialize AstralKit in your project
9
- npx @astralkit/cli init
8
+ # 1. Get your API key from https://astralkit.com/account
10
9
 
11
- # Add a component (auto-detects framework)
12
- npx @astralkit/cli add button-sizes
10
+ # 2. Initialize AstralKit in your project
11
+ npx @astralkit/cli init --api-key ak_YOUR_KEY
13
12
 
14
- # Add a booster — the CLI will prompt if flags are omitted
15
- npx @astralkit/cli add auth-system
16
-
17
- # Scaffold a workflow
18
- npx @astralkit/cli add saas-starter
19
-
20
- # Search for content
21
- npx @astralkit/cli search "pricing table"
22
- ```
23
-
24
- No flags needed — the CLI auto-detects what you're installing and which framework you're using.
25
-
26
- ## Content Types
27
-
28
- AstralKit distributes three types of content:
29
-
30
- | Type | Description | Example |
31
- |------|-------------|---------|
32
- | **Components** | Single UI elements with framework variants | Button, Card, Data Table |
33
- | **Boosters** | Drop-in feature modules (core logic + framework adapters) | Auth System, Stripe Billing, File Upload |
34
- | **Workflows** | Complete application scaffolds | AI SaaS Starter, CRM, Admin Dashboard |
35
-
36
- ## Commands
37
-
38
- ### `astralkit add <name>`
39
-
40
- Add a component, booster, or workflow to your project. The CLI is fully interactive — when you omit flags, it prompts you with arrow-key selections.
41
-
42
- #### Smart Auto-Detection
43
-
44
- The CLI automatically:
45
- - **Detects what you're installing** — searches components, boosters, and workflows for the slug. If found in multiple, prompts you to choose.
46
- - **Detects your framework** — checks for `next.config.js` (Next.js), `react` in package.json (React), or prompts if unsure.
47
- - **Detects your package manager** — reads lockfiles (`bun.lockb`, `pnpm-lock.yaml`, `yarn.lock`) and uses the right one.
48
-
49
- ```bash
50
- # Fully interactive — no flags needed
51
- astralkit add auth-system
52
-
53
- ? What are you installing?
54
- ❯ Booster (feature module)
55
- Component (UI element)
56
- Workflow (complete app)
57
-
58
- ? Detected Next.js project. Which framework? (nextjs)
59
-
60
- ✔ Added booster Authentication System (Next.js)
13
+ # 3. Add a component
14
+ npx @astralkit/cli add button-sizes --api-key ak_YOUR_KEY
61
15
  ```
62
16
 
63
- #### Adding Components
17
+ After init, your API key is saved locally — no need to pass it again:
64
18
 
65
19
  ```bash
66
- astralkit add avatar-variants
67
- astralkit add pricing-table --framework=react
68
- astralkit add data-table --overwrite
20
+ astralkit add button-variants
21
+ astralkit add sidebar-expanded-light
22
+ astralkit list
69
23
  ```
70
24
 
71
- #### Adding Boosters
72
-
73
- Boosters install framework-agnostic core files and framework-specific adapter files.
25
+ ## What Init Does
74
26
 
75
27
  ```bash
76
- astralkit add auth-system --booster
77
- astralkit add stripe-billing --booster --framework=nextjs
28
+ npx @astralkit/cli init --api-key ak_YOUR_KEY
78
29
  ```
79
30
 
80
- Core files go to `src/lib/<slug>/` and adapter files to `src/components/<slug>/` by default.
31
+ 1. **Installs `astralkit`** — design tokens, CSS utilities, and `cn()` helper as a real npm dependency
32
+ 2. **Detects your framework** — Next.js or React (auto-detected from project files)
33
+ 3. **Detects Tailwind version** — v3 or v4, writes the correct CSS imports
34
+ 4. **Detects TypeScript** — serves `.tsx` or `.jsx` accordingly
35
+ 5. **Updates your CSS** — adds `@import "astralkit/theme"` and `@import "astralkit/utilities"` to your globals.css
36
+ 6. **Creates `astralkit-ai-rules.md`** — paste into Cursor, CLAUDE.md, etc.
81
37
 
82
- After installing, the CLI offers to install npm dependencies automatically:
38
+ No config file is created. Everything is auto-detected on every command.
83
39
 
84
- ```bash
85
- ✔ Added booster Stripe Billing (Next.js)
86
- Core files → src/lib/stripe-billing/
87
- stripe.ts
88
- webhooks.ts
89
- Adapter files → src/components/stripe-billing/
90
- CheckoutButton.tsx
91
- PricingTable.tsx
92
-
93
- ? Install dependencies? (stripe, @stripe/stripe-js) (Y/n)
94
- ✔ Dependencies installed
95
-
96
- ✅ Stripe Billing installed successfully!
97
- ```
40
+ ## Commands
98
41
 
99
- #### Adding Workflows
42
+ ### `astralkit init`
100
43
 
101
- Workflows scaffold a complete application in a new directory.
44
+ Initialize AstralKit in your project.
102
45
 
103
46
  ```bash
104
- astralkit add ai-saas-starter --workflow
105
- astralkit add crm --workflow --framework=nextjs
47
+ astralkit init --api-key ak_YOUR_KEY
48
+ astralkit init --framework react
49
+ astralkit init --dir src/components/ui
106
50
  ```
107
51
 
108
- The CLI offers to install dependencies and shows clear next steps:
109
-
110
- ```bash
111
- ✔ Scaffolded workflow AI SaaS Starter (Next.js) → ai-saas-starter/
112
- 24 files written to ai-saas-starter/
113
-
114
- ? Install dependencies with npm? (Y/n)
115
- ✔ Dependencies installed
116
-
117
- ✅ Ready to go!
52
+ | Flag | Description |
53
+ |------|-------------|
54
+ | `--api-key <key>` | Your API key (from astralkit.com/account) |
55
+ | `--framework <fw>` | Override framework detection (react, nextjs) |
56
+ | `--dir <path>` | Component output directory (default: src/components/ui) |
118
57
 
119
- cd ai-saas-starter
120
- npm run dev
121
- ```
58
+ ### `astralkit add <name>`
122
59
 
123
- Use `--overlay` to merge workflow files into your current project:
60
+ Add a component, booster, or workflow to your project. The CLI **auto-detects the content type** — no flags needed.
124
61
 
125
62
  ```bash
126
- astralkit add saas-starter --workflow --overlay
63
+ # Just type the name — the CLI figures out what it is
64
+ astralkit add avatar-verified # → found as component, installs directly
65
+ astralkit add authentication-system # → found as booster, installs directly
66
+ astralkit add ai-saas-starter # → found as workflow, scaffolds directly
127
67
  ```
128
68
 
129
- #### Preview Before Installing
69
+ **Smart detection:**
70
+ - Searches all registries (components, boosters, workflows) simultaneously
71
+ - If found in one → installs directly
72
+ - If found in multiple → prompts you to choose
73
+ - If not found → suggests similar names ("Did you mean?")
130
74
 
131
- Use `--dry-run` to see what files will be created without writing anything:
75
+ You can still use explicit flags to skip detection:
132
76
 
133
77
  ```bash
134
- astralkit add auth-system --booster --dry-run
135
-
136
- 📋 Dry run — no files will be written:
137
-
138
- Core → src/lib/auth-system/
139
- + create auth.ts
140
- + create session.ts
141
- + create middleware.ts
142
- Adapter → src/components/auth-system/
143
- + create LoginForm.tsx
144
- + create SignupForm.tsx
145
-
146
- Dependencies: better-auth
78
+ astralkit add authentication-system --booster # skip detection, install as booster
79
+ astralkit add crm-project-management --workflow --overlay # merge workflow into current project
80
+ astralkit add button-variants --framework react
147
81
  ```
148
82
 
149
- #### Options
150
-
151
83
  | Flag | Description |
152
84
  |------|-------------|
153
- | `-f, --framework` | Framework version (html, react, nextjs) — auto-detected if omitted |
154
- | `--dir` | Override output directory |
85
+ | `--api-key <key>` | Your API key |
86
+ | `-f, --framework <fw>` | Framework version (react, nextjs) |
87
+ | `--dir <path>` | Override output directory |
155
88
  | `--overwrite` | Overwrite existing files |
156
- | `--booster` | Install a booster (skip type auto-detection) |
157
- | `--workflow` | Scaffold a workflow (skip type auto-detection) |
158
- | `--overlay` | Merge workflow into current project (workflow only) |
159
- | `--dry-run` | Preview what will be installed without writing files |
89
+ | `--booster` | Install a booster |
90
+ | `--workflow` | Scaffold a workflow |
91
+ | `--overlay` | Merge workflow into current project |
92
+ | `--dry-run` | Preview without writing files |
160
93
 
161
94
  ### `astralkit remove <name>`
162
95
 
163
- Remove a previously installed component, booster, or workflow. Shows what will be deleted and asks for confirmation.
164
-
165
- ```bash
166
- astralkit remove auth-system
167
-
168
- Found files for "auth-system":
169
-
170
- Booster (core): src/lib/auth-system/
171
- auth.ts
172
- session.ts
173
- Booster (adapter): src/components/auth-system/
174
- LoginForm.tsx
175
- SignupForm.tsx
176
-
177
- ? Remove 2 item(s)? (y/N)
178
- ✓ Removed src/lib/auth-system/
179
- ✓ Removed src/components/auth-system/
180
- ```
181
-
182
- Use `--force` to skip the confirmation prompt (for scripts/CI).
183
-
184
- ### `astralkit init`
185
-
186
- Initialize AstralKit in your project:
187
-
188
- 1. Installs the `astralkit` npm package (design tokens, utilities, `cn()` helper)
189
- 2. Adds required CSS imports to your stylesheet
190
- 3. Creates `astralkit.config.json`
96
+ Remove a previously installed component, booster, or workflow.
191
97
 
192
98
  ```bash
193
- astralkit init
194
- astralkit init --framework=react
195
- astralkit init --dir=src/components/ui
99
+ astralkit remove authentication-system
100
+ astralkit remove button-variants --force # skip confirmation
196
101
  ```
197
102
 
198
103
  ### `astralkit list`
199
104
 
200
- List available content.
105
+ Browse available content.
201
106
 
202
107
  ```bash
203
- astralkit list # List components
204
- astralkit list --boosters # List boosters
205
- astralkit list --workflows # List workflows
206
- astralkit list --category=forms
207
- astralkit list --framework=react
208
- astralkit list --pro
209
- astralkit list --free
108
+ astralkit list # components
109
+ astralkit list --boosters # boosters
110
+ astralkit list --workflows # workflows
111
+ astralkit list --category forms
112
+ astralkit list --pro # pro-only items
210
113
  ```
211
114
 
212
115
  ### `astralkit search <query>`
@@ -214,21 +117,19 @@ astralkit list --free
214
117
  Search by name or description.
215
118
 
216
119
  ```bash
217
- astralkit search "data table"
218
- astralkit search "pricing" --framework=react
120
+ astralkit search "pricing table"
219
121
  astralkit search "stripe" --boosters
220
- astralkit search "crm" --workflows
221
122
  ```
222
123
 
223
- ### `astralkit diff <component>`
124
+ ### `astralkit diff <name>`
224
125
 
225
- Show differences between your local component and the latest version.
126
+ Compare your local version against the latest.
226
127
 
227
128
  ```bash
228
129
  astralkit diff button-sizes
229
130
  ```
230
131
 
231
- ### `astralkit update <component>`
132
+ ### `astralkit update <name>`
232
133
 
233
134
  Update a component to the latest version.
234
135
 
@@ -237,66 +138,70 @@ astralkit update button-sizes
237
138
  astralkit update button-sizes --force
238
139
  ```
239
140
 
240
- ### `astralkit login` / `astralkit logout` / `astralkit whoami`
141
+ ### `astralkit whoami`
241
142
 
242
- Manage authentication for premium content.
143
+ Show your authentication status and plan.
243
144
 
244
145
  ```bash
245
- astralkit login # Opens browser for secure login
246
- astralkit logout # Remove stored token
247
- astralkit whoami # Show auth status and plan
146
+ astralkit whoami
248
147
  ```
249
148
 
250
- ## Premium Content
149
+ ### `astralkit login` / `astralkit logout`
251
150
 
252
- Some content requires a Pro subscription:
151
+ Browser-based authentication (alternative to `--api-key`).
253
152
 
254
153
  ```bash
255
- $ astralkit add stripe-billing --booster
256
- ✖ Pro subscription required for this component.
257
- Visit https://astralkit.com/pricing
258
-
259
- $ astralkit login
260
- ✔ Authenticated successfully!
261
- Email: you@example.com
262
- Plan: pro
263
-
264
- $ astralkit add stripe-billing --booster
265
- ✔ Added booster Stripe Billing (Next.js)
266
- ✨ Pro booster — thank you for your subscription!
154
+ astralkit login # opens browser
155
+ astralkit logout # clear stored token
267
156
  ```
268
157
 
269
- ## Configuration
158
+ ## Authentication
270
159
 
271
- ### `astralkit.config.json`
160
+ **API key (recommended):**
272
161
 
273
- Created by `astralkit init` in your project root:
162
+ Get your key from [astralkit.com/account](https://astralkit.com/account). Pass it once with `--api-key` — it's saved to `~/.astralkit/config.json` for future commands.
274
163
 
275
- ```json
276
- {
277
- "$schema": "https://astralkit.com/schema/config.json",
278
- "framework": "nextjs",
279
- "componentsDir": "src/components/ui"
280
- }
164
+ ```bash
165
+ astralkit init --api-key ak_YOUR_KEY
281
166
  ```
282
167
 
283
- ### `~/.astralkit/config.json`
168
+ **Browser login (alternative):**
284
169
 
285
- Stores your authentication token (created by `astralkit login`). This file has restricted permissions (owner read/write only).
170
+ ```bash
171
+ astralkit login
172
+ ```
286
173
 
287
- ## CI/CD Usage
174
+ **CI/CD:**
288
175
 
289
- For automated environments, set the `ASTRALKIT_TOKEN` environment variable:
176
+ Set the `ASTRALKIT_API_KEY` environment variable:
290
177
 
291
178
  ```bash
292
- export ASTRALKIT_TOKEN="your-api-token"
179
+ export ASTRALKIT_API_KEY=ak_YOUR_KEY
293
180
  astralkit add button-sizes
294
- astralkit add stripe-billing --booster
295
181
  ```
296
182
 
183
+ ## Content Types
184
+
185
+ | Type | Description | Install Location |
186
+ |------|-------------|------------------|
187
+ | **Components** | Single UI elements (Button, Card, Table) | `src/components/ui/` |
188
+ | **Boosters** | Feature modules (Auth, Stripe, File Upload) | `src/lib/<name>/` + `src/components/<name>/` |
189
+ | **Workflows** | Complete app scaffolds (SaaS Starter, CRM) | New directory or `--overlay` into current |
190
+
191
+ ## Framework Support
192
+
193
+ The CLI is for **React and Next.js** projects. HTML users copy components directly from [astralkit.com](https://astralkit.com).
194
+
195
+ | Detection | Signal |
196
+ |-----------|--------|
197
+ | Next.js | `next.config.*` found |
198
+ | React | `react` in package.json dependencies |
199
+ | TypeScript | `tsconfig.json` found → `.tsx` files |
200
+ | JavaScript | No tsconfig → `.jsx` files |
201
+
297
202
  ## Package Manager Support
298
203
 
299
- The CLI auto-detects your package manager from lockfiles:
204
+ Auto-detected from lockfiles:
300
205
 
301
206
  | Lockfile | Package Manager |
302
207
  |----------|----------------|
@@ -305,58 +210,96 @@ The CLI auto-detects your package manager from lockfiles:
305
210
  | `yarn.lock` | yarn |
306
211
  | (default) | npm |
307
212
 
308
- All install commands, dependency installs, and run commands use the detected package manager automatically.
213
+ ## What Gets Installed
309
214
 
310
- ## Environment Variables
215
+ After `astralkit init`, your project has:
311
216
 
312
- | Variable | Description |
313
- |----------|-------------|
314
- | `ASTRALKIT_TOKEN` | API token for CI/CD (skips browser login) |
315
- | `ASTRALKIT_API_URL` | Override API base URL (development only) |
316
- | `ASTRALKIT_LOGIN_PORT` | Override callback port for login (default: 9876) |
217
+ ```
218
+ node_modules/astralkit/ ← real npm dependency
219
+ ├── astralkit-theme.css ← design tokens
220
+ ├── astralkit-utilities.css ← utility classes
221
+ ├── lib/utils.js ← cn() function
222
+ └── package.json
223
+
224
+ src/components/ui/ ← components go here
225
+ astralkit-ai-rules.md ← AI coding rules
226
+ ```
317
227
 
318
- ## Security
228
+ Your `globals.css`:
229
+ ```css
230
+ @import "tailwindcss";
231
+ @import "astralkit/theme";
232
+ @import "astralkit/utilities";
233
+ ```
319
234
 
320
- - Tokens stored at `~/.astralkit/config.json` with `0600` permissions
321
- - Browser login uses CSRF state tokens
322
- - All API requests use HTTPS with 30-second timeouts
323
- - No credentials are hardcoded in the package
235
+ Teammates clone and run `npm install` — everything works. No `astralkit init` needed in CI.
324
236
 
325
- ## Troubleshooting
237
+ ## Plans
326
238
 
327
- ### Port 9876 is in use
239
+ | | Free | Pro | Plus | Lifetime |
240
+ |---|---|---|---|---|
241
+ | **Component downloads** | 10/month | Unlimited | Unlimited | Unlimited |
242
+ | **Premium components** | — | ✓ | ✓ | ✓ |
243
+ | **HTML / Tailwind** | ✓ | ✓ | ✓ | ✓ |
244
+ | **React + Next.js** | — | ✓ | ✓ | ✓ |
245
+ | **Boosters** | — | — | 5/month | Unlimited |
246
+ | **Workflows** | — | — | 1/month | Unlimited |
328
247
 
329
- ```bash
330
- ASTRALKIT_LOGIN_PORT=9877 astralkit login
331
- ```
248
+ > **CLI access starts at Pro.** The Free tier is HTML/Tailwind only and delivered by copy-paste from [astralkit.com](https://astralkit.com) — the CLI's React and Next.js output requires a paid plan. Boosters and workflows require Plus or Lifetime.
332
249
 
333
- ### Token expired
250
+ Upgrade at [astralkit.com/pricing](https://astralkit.com/pricing).
334
251
 
335
- Run `astralkit login` again.
252
+ ## Environment Variables
336
253
 
337
- ### Dependency conflicts (ERESOLVE)
254
+ | Variable | Description |
255
+ |----------|-------------|
256
+ | `ASTRALKIT_API_KEY` | Permanent API key for CI/CD (skips interactive auth). Get one at [astralkit.com/account](https://astralkit.com/account). |
257
+ | `ASTRALKIT_TOKEN` | Session JWT captured from `astralkit login`. Useful for short-lived CI contexts where you want to reuse a browser-login token rather than provisioning an API key. Checked before `ASTRALKIT_API_KEY`. |
258
+ | `ASTRALKIT_API_URL` | Override API base URL (development only). Must be `https://` unless pointing at localhost. |
259
+ | `ASTRALKIT_LOGIN_PORT` | Override the OAuth callback port for `astralkit login` (default: `9876`). Must be in `1024–65535`. |
338
260
 
339
- The CLI handles most dependency conflicts automatically. If you see an error, try:
261
+ ## Troubleshooting
340
262
 
263
+ **Port 9876 in use:**
341
264
  ```bash
342
- # npm
343
- npm install <package> --legacy-peer-deps
344
-
345
- # pnpm
346
- pnpm add <package> --force
265
+ ASTRALKIT_LOGIN_PORT=9877 astralkit login
347
266
  ```
348
267
 
349
- ### Network errors
268
+ **Token expired:**
269
+ ```bash
270
+ astralkit init --api-key ak_YOUR_NEW_KEY
271
+ ```
350
272
 
351
- Check your internet connection. The CLI requires access to `astralkit.com`.
273
+ **Dependency conflicts:**
274
+ ```bash
275
+ npm install <package> --legacy-peer-deps
276
+ ```
352
277
 
353
278
  ## Requirements
354
279
 
355
280
  - Node.js 18+
281
+ - React or Next.js project
356
282
  - An AstralKit account for premium content
357
283
 
284
+ ## Discover what's available
285
+
286
+ Two ways to browse the real inventory:
287
+
288
+ ```bash
289
+ astralkit list # components
290
+ astralkit list --boosters # feature modules
291
+ astralkit list --workflows # app scaffolds
292
+ astralkit search "stripe" # search across everything
293
+ ```
294
+
295
+ Or browse the showcase: [astralkit.com/components](https://astralkit.com/components), [/boosters](https://astralkit.com/boosters), [/workflows](https://astralkit.com/workflows). Every card shows the exact slug you pass to `astralkit add`.
296
+
297
+ > **Boosters and workflows are rolling out through 2026.** The CLI supports them today, but the registry catalog is still being populated. Check [astralkit.com/boosters](https://astralkit.com/boosters) and [/workflows](https://astralkit.com/workflows) for release dates. Components (all 156) are available now.
298
+
358
299
  ## Links
359
300
 
360
301
  - [AstralKit](https://astralkit.com)
361
- - [Documentation](https://astralkit.com/docs)
302
+ - [Components](https://astralkit.com/components)
362
303
  - [Pricing](https://astralkit.com/pricing)
304
+ - [Documentation](https://astralkit.com/documentation)
305
+ - [Support](https://astralkit.com/support)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astralkit/cli",
3
- "version": "4.1.1",
3
+ "version": "4.2.1",
4
4
  "description": "AstralKit CLI — Install and manage UI components in your project",
5
5
  "type": "module",
6
6
  "bin": {