@astralkit/cli 2.2.0 → 3.0.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,270 +1,362 @@
1
- # @astralkit/cli
2
-
3
- Install and manage AstralKit UI components, boosters, and workflows in your project.
4
-
5
- ## Quick Start
6
-
7
- ```bash
8
- # Initialize AstralKit in your project
9
- npx @astralkit/cli init
10
-
11
- # Add a component
12
- npx @astralkit/cli add button-sizes
13
-
14
- # Add a booster (feature module)
15
- npx @astralkit/cli add stripe-payments --booster
16
-
17
- # Scaffold a workflow (complete app)
18
- npx @astralkit/cli add saas-starter --workflow
19
-
20
- # Search for components
21
- npx @astralkit/cli search "pricing table"
22
- ```
23
-
24
- ## Content Types
25
-
26
- AstralKit distributes three types of content:
27
-
28
- | Type | Description | Example |
29
- |------|-------------|---------|
30
- | **Components** | Single UI elements with framework variants | Button, Card, Data Table |
31
- | **Boosters** | Drop-in feature modules (core logic + framework adapters) | Stripe Payments, Auth System |
32
- | **Workflows** | Complete application scaffolds | SaaS Starter, CRM, Admin Dashboard |
33
-
34
- ## Commands
35
-
36
- ### `astralkit init`
37
-
38
- Initialize AstralKit in your project. This command:
39
-
40
- 1. Installs the `astralkit` npm package (design tokens, utilities, and `cn()` helper)
41
- 2. Adds required CSS imports to your stylesheet (`@import "tailwindcss"`, `@import "astralkit/theme"`, `@import "astralkit/utilities"`)
42
- 3. Creates `astralkit.config.json` with your framework and component directory
43
-
44
- ```bash
45
- astralkit init
46
- astralkit init --framework=react
47
- astralkit init --dir=src/components/ui
48
- ```
49
-
50
- ### `astralkit add <name>`
51
-
52
- Add a component, booster, or workflow to your project.
53
-
54
- #### Adding Components
55
-
56
- ```bash
57
- astralkit add avatar-variants
58
- astralkit add pricing-table --framework=react
59
- astralkit add data-table --overwrite
60
- ```
61
-
62
- #### Adding Boosters
63
-
64
- Boosters install framework-agnostic core files (API routes, webhooks, utilities) and framework-specific adapter files (UI components, hooks).
65
-
66
- ```bash
67
- astralkit add stripe-payments --booster
68
- astralkit add auth-system --booster --framework=nextjs
69
- astralkit add stripe-payments --booster --overwrite
70
- ```
71
-
72
- Core files are written to `src/lib/<booster-slug>/` and adapter files to `src/components/<booster-slug>/` by default. Boosters may specify custom install paths.
73
-
74
- #### Adding Workflows
75
-
76
- Workflows scaffold a complete application. By default, files are created in a new `./<slug>/` directory.
77
-
78
- ```bash
79
- astralkit add saas-starter --workflow
80
- astralkit add crm --workflow --framework=nextjs
81
- ```
82
-
83
- Use `--overlay` to merge workflow files into your current project instead of creating a new directory:
84
-
85
- ```bash
86
- astralkit add saas-starter --workflow --overlay
87
- astralkit add saas-starter --workflow --overlay --overwrite
88
- ```
89
-
90
- #### Options
91
-
92
- - `-f, --framework` — Framework version (html, react, nextjs)
93
- - `--dir` — Override output directory
94
- - `--overwrite` — Overwrite existing files
95
- - `--booster` — Install a booster (feature module)
96
- - `--workflow` — Scaffold a workflow (complete app template)
97
- - `--overlay` — Merge workflow into current project (workflow only)
98
-
99
- ### `astralkit list`
100
-
101
- List available content.
102
-
103
- ```bash
104
- astralkit list # List components
105
- astralkit list --boosters # List boosters
106
- astralkit list --workflows # List workflows
107
- astralkit list --category=forms
108
- astralkit list --framework=react
109
- astralkit list --pro
110
- astralkit list --free
111
- ```
112
-
113
- ### `astralkit search <query>`
114
-
115
- Search by name or description.
116
-
117
- ```bash
118
- astralkit search "data table"
119
- astralkit search "pricing" --framework=react
120
- astralkit search "stripe" --boosters
121
- astralkit search "crm" --workflows
122
- ```
123
-
124
- ### `astralkit diff <component>`
125
-
126
- Show differences between your local component and the latest version.
127
-
128
- ```bash
129
- astralkit diff button-sizes
130
- ```
131
-
132
- ### `astralkit update <component>`
133
-
134
- Update a component to the latest version from AstralKit.
135
-
136
- ```bash
137
- astralkit update button-sizes
138
- astralkit update button-sizes --force
139
- ```
140
-
141
- ### `astralkit login`
142
-
143
- Authenticate with AstralKit to access premium content. Opens your browser for secure login.
144
-
145
- ```bash
146
- astralkit login
147
- ```
148
-
149
- ### `astralkit logout`
150
-
151
- Remove stored authentication.
152
-
153
- ### `astralkit whoami`
154
-
155
- Show current authentication status and subscription plan. Verifies your token with the server.
156
-
157
- ## Premium Content
158
-
159
- Some components, boosters, and workflows require a Pro subscription. When you try to add pro content without authentication:
160
-
161
- ```bash
162
- $ astralkit add pro-data-table
163
- ✖ Failed to add component.
164
- Authentication required. Run `astralkit login` to authenticate.
165
- ```
166
-
167
- After logging in, pro content installs normally:
168
-
169
- ```bash
170
- $ astralkit login
171
- ✔ Authenticated successfully!
172
- Email: you@example.com
173
- Plan: pro
174
-
175
- $ astralkit add stripe-payments --booster
176
- ✔ Added booster Stripe Payments (nextjs)
177
- Core files → src/lib/stripe-payments/
178
- lib/stripe.ts
179
- api/webhooks/stripe/route.ts
180
- Adapter files → src/components/stripe-payments/
181
- components/checkout-button.tsx
182
- hooks/use-subscription.ts
183
-
184
- Install required dependencies:
185
- npm install stripe @stripe/stripe-js
186
-
187
- Add these environment variables to your .env:
188
- STRIPE_SECRET_KEY=
189
- STRIPE_PUBLISHABLE_KEY=
190
- STRIPE_WEBHOOK_SECRET=
191
- ```
192
-
193
- ## Configuration
194
-
195
- ### `astralkit.config.json`
196
-
197
- Created by `astralkit init` in your project root:
198
-
199
- ```json
200
- {
201
- "$schema": "https://astralkit.com/schema/config.json",
202
- "framework": "nextjs",
203
- "componentsDir": "src/components/ui"
204
- }
205
- ```
206
-
207
- ### `~/.astralkit/config.json`
208
-
209
- Stores your authentication token (created by `astralkit login`). This file is created with restricted permissions (owner read/write only).
210
-
211
- ## CI/CD Usage
212
-
213
- For automated environments (CI/CD pipelines, Docker builds), set the `ASTRALKIT_TOKEN` environment variable instead of using browser login:
214
-
215
- ```bash
216
- # Set token from your AstralKit dashboard
217
- export ASTRALKIT_TOKEN="your-api-token"
218
-
219
- # Commands automatically use the env var
220
- astralkit add button-sizes
221
- astralkit add stripe-payments --booster
222
- astralkit whoami
223
- ```
224
-
225
- ## Environment Variables
226
-
227
- | Variable | Description |
228
- |----------|-------------|
229
- | `ASTRALKIT_TOKEN` | API token for CI/CD (skips browser login) |
230
- | `ASTRALKIT_API_URL` | Override API base URL (development only) |
231
- | `ASTRALKIT_LOGIN_PORT` | Override callback port for login (default: 9876) |
232
-
233
- ## Security
234
-
235
- - Authentication tokens are stored at `~/.astralkit/config.json` with `0600` permissions (owner read/write only)
236
- - The config directory is created with `0700` permissions
237
- - Browser login uses CSRF state tokens to prevent cross-site attacks
238
- - CORS is restricted to `astralkit.com` during authentication
239
- - All API requests use HTTPS with 30-second timeouts
240
- - No tokens, secrets, or credentials are ever hardcoded in the package
241
-
242
- ## Troubleshooting
243
-
244
- ### Port 9876 is in use
245
-
246
- If `astralkit login` fails because the port is busy:
247
-
248
- ```bash
249
- # Use a different port
250
- ASTRALKIT_LOGIN_PORT=9877 astralkit login
251
- ```
252
-
253
- ### Token expired
254
-
255
- If you see "Session expired", run `astralkit login` again to get a fresh token.
256
-
257
- ### Network errors
258
-
259
- If you see timeout or connection errors, check your internet connection. The CLI requires access to `astralkit.com`.
260
-
261
- ## Requirements
262
-
263
- - Node.js 18+
264
- - An AstralKit account for premium content
265
-
266
- ## Links
267
-
268
- - [AstralKit](https://astralkit.com)
269
- - [Documentation](https://astralkit.com/docs)
270
- - [Pricing](https://astralkit.com/pricing)
1
+ # @astralkit/cli
2
+
3
+ Install and manage AstralKit UI components, boosters, and workflows in your project.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Initialize AstralKit in your project
9
+ npx @astralkit/cli init
10
+
11
+ # Add a component (auto-detects framework)
12
+ npx @astralkit/cli add button-sizes
13
+
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)
61
+ ```
62
+
63
+ #### Adding Components
64
+
65
+ ```bash
66
+ astralkit add avatar-variants
67
+ astralkit add pricing-table --framework=react
68
+ astralkit add data-table --overwrite
69
+ ```
70
+
71
+ #### Adding Boosters
72
+
73
+ Boosters install framework-agnostic core files and framework-specific adapter files.
74
+
75
+ ```bash
76
+ astralkit add auth-system --booster
77
+ astralkit add stripe-billing --booster --framework=nextjs
78
+ ```
79
+
80
+ Core files go to `src/lib/<slug>/` and adapter files to `src/components/<slug>/` by default.
81
+
82
+ After installing, the CLI offers to install npm dependencies automatically:
83
+
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
+ ```
98
+
99
+ #### Adding Workflows
100
+
101
+ Workflows scaffold a complete application in a new directory.
102
+
103
+ ```bash
104
+ astralkit add ai-saas-starter --workflow
105
+ astralkit add crm --workflow --framework=nextjs
106
+ ```
107
+
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!
118
+
119
+ cd ai-saas-starter
120
+ npm run dev
121
+ ```
122
+
123
+ Use `--overlay` to merge workflow files into your current project:
124
+
125
+ ```bash
126
+ astralkit add saas-starter --workflow --overlay
127
+ ```
128
+
129
+ #### Preview Before Installing
130
+
131
+ Use `--dry-run` to see what files will be created without writing anything:
132
+
133
+ ```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
147
+ ```
148
+
149
+ #### Options
150
+
151
+ | Flag | Description |
152
+ |------|-------------|
153
+ | `-f, --framework` | Framework version (html, react, nextjs) — auto-detected if omitted |
154
+ | `--dir` | Override output directory |
155
+ | `--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 |
160
+
161
+ ### `astralkit remove <name>`
162
+
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`
191
+
192
+ ```bash
193
+ astralkit init
194
+ astralkit init --framework=react
195
+ astralkit init --dir=src/components/ui
196
+ ```
197
+
198
+ ### `astralkit list`
199
+
200
+ List available content.
201
+
202
+ ```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
210
+ ```
211
+
212
+ ### `astralkit search <query>`
213
+
214
+ Search by name or description.
215
+
216
+ ```bash
217
+ astralkit search "data table"
218
+ astralkit search "pricing" --framework=react
219
+ astralkit search "stripe" --boosters
220
+ astralkit search "crm" --workflows
221
+ ```
222
+
223
+ ### `astralkit diff <component>`
224
+
225
+ Show differences between your local component and the latest version.
226
+
227
+ ```bash
228
+ astralkit diff button-sizes
229
+ ```
230
+
231
+ ### `astralkit update <component>`
232
+
233
+ Update a component to the latest version.
234
+
235
+ ```bash
236
+ astralkit update button-sizes
237
+ astralkit update button-sizes --force
238
+ ```
239
+
240
+ ### `astralkit login` / `astralkit logout` / `astralkit whoami`
241
+
242
+ Manage authentication for premium content.
243
+
244
+ ```bash
245
+ astralkit login # Opens browser for secure login
246
+ astralkit logout # Remove stored token
247
+ astralkit whoami # Show auth status and plan
248
+ ```
249
+
250
+ ## Premium Content
251
+
252
+ Some content requires a Pro subscription:
253
+
254
+ ```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!
267
+ ```
268
+
269
+ ## Configuration
270
+
271
+ ### `astralkit.config.json`
272
+
273
+ Created by `astralkit init` in your project root:
274
+
275
+ ```json
276
+ {
277
+ "$schema": "https://astralkit.com/schema/config.json",
278
+ "framework": "nextjs",
279
+ "componentsDir": "src/components/ui"
280
+ }
281
+ ```
282
+
283
+ ### `~/.astralkit/config.json`
284
+
285
+ Stores your authentication token (created by `astralkit login`). This file has restricted permissions (owner read/write only).
286
+
287
+ ## CI/CD Usage
288
+
289
+ For automated environments, set the `ASTRALKIT_TOKEN` environment variable:
290
+
291
+ ```bash
292
+ export ASTRALKIT_TOKEN="your-api-token"
293
+ astralkit add button-sizes
294
+ astralkit add stripe-billing --booster
295
+ ```
296
+
297
+ ## Package Manager Support
298
+
299
+ The CLI auto-detects your package manager from lockfiles:
300
+
301
+ | Lockfile | Package Manager |
302
+ |----------|----------------|
303
+ | `bun.lockb` / `bun.lock` | bun |
304
+ | `pnpm-lock.yaml` | pnpm |
305
+ | `yarn.lock` | yarn |
306
+ | (default) | npm |
307
+
308
+ All install commands, dependency installs, and run commands use the detected package manager automatically.
309
+
310
+ ## Environment Variables
311
+
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) |
317
+
318
+ ## Security
319
+
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
324
+
325
+ ## Troubleshooting
326
+
327
+ ### Port 9876 is in use
328
+
329
+ ```bash
330
+ ASTRALKIT_LOGIN_PORT=9877 astralkit login
331
+ ```
332
+
333
+ ### Token expired
334
+
335
+ Run `astralkit login` again.
336
+
337
+ ### Dependency conflicts (ERESOLVE)
338
+
339
+ The CLI handles most dependency conflicts automatically. If you see an error, try:
340
+
341
+ ```bash
342
+ # npm
343
+ npm install <package> --legacy-peer-deps
344
+
345
+ # pnpm
346
+ pnpm add <package> --force
347
+ ```
348
+
349
+ ### Network errors
350
+
351
+ Check your internet connection. The CLI requires access to `astralkit.com`.
352
+
353
+ ## Requirements
354
+
355
+ - Node.js 18+
356
+ - An AstralKit account for premium content
357
+
358
+ ## Links
359
+
360
+ - [AstralKit](https://astralkit.com)
361
+ - [Documentation](https://astralkit.com/docs)
362
+ - [Pricing](https://astralkit.com/pricing)
package/bin/index.js CHANGED
@@ -8,6 +8,7 @@ const pkg = require(path.join(__dirname, '..', 'package.json'));
8
8
 
9
9
  const { initCommand } = require('../src/commands/init');
10
10
  const { addCommand } = require('../src/commands/add');
11
+ const { removeCommand } = require('../src/commands/remove');
11
12
  const { loginCommand } = require('../src/commands/login');
12
13
  const { listCommand } = require('../src/commands/list');
13
14
  const { searchCommand } = require('../src/commands/search');
@@ -39,8 +40,16 @@ program
39
40
  .option('--booster', 'Install a booster (feature module)')
40
41
  .option('--workflow', 'Scaffold a workflow (complete app template)')
41
42
  .option('--overlay', 'Merge workflow into current project (workflow only)')
43
+ .option('--dry-run', 'Preview what will be installed without writing files', false)
42
44
  .action(addCommand);
43
45
 
46
+ // ─── remove ──────────────────────────────────────────
47
+ program
48
+ .command('remove <name>')
49
+ .description('Remove a previously installed component, booster, or workflow')
50
+ .option('--force', 'Skip confirmation prompt', false)
51
+ .action(removeCommand);
52
+
44
53
  // ─── login ───────────────────────────────────────────
45
54
  program
46
55
  .command('login')
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@astralkit/cli",
3
- "version": "2.2.0",
3
+ "version": "3.0.1",
4
4
  "description": "AstralKit CLI — Install and manage UI components in your project",
5
- "license": "MIT",
5
+ "license": "SEE LICENSE IN LICENSE",
6
6
  "bin": {
7
7
  "astralkit": "bin/index.js"
8
8
  },