@archetypeai/ds-cli 0.3.7 → 0.3.9

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,123 +1,81 @@
1
1
  ## @archetypeai/ds-cli
2
2
 
3
- `@archetypeai/ds-cli` is the CLI for the **Archetype AI Design System**. It provides commands for creating, configuring, and managing projects that use the design system.
3
+ CLI for the **Archetype AI Design System**. Scaffold new projects, add the design system to existing ones, and manage components and agent configurations.
4
4
 
5
5
  ---
6
6
 
7
- ## Commands
8
-
9
- ### `create` — Scaffold a new project
7
+ Run directly with `npx`:
10
8
 
11
9
  ```bash
12
10
  npx @archetypeai/ds-cli create my-app
13
11
  ```
14
12
 
15
- Scaffolds a full SvelteKit + Tailwind v4 + shadcn-svelte project:
13
+ ---
14
+
15
+ ## Commands
16
+
17
+ ### `create` → Scaffold a new project
16
18
 
17
- 1. Creates a SvelteKit project via `sv create`
18
- 2. Installs design tokens (`@archetypeai/ds-lib-tokens`)
19
- 3. Optionally installs internal fonts (`@archetypeai/ds-lib-fonts-internal`)
20
- 4. Initializes shadcn-svelte (`components.json`, `utils.js`, dependencies)
21
- 5. Configures CSS (`layout.css` with design tokens and optional fonts import)
22
- 6. Installs all components from the design system registry
23
- 7. Optionally installs AI agent configuration (Cursor or Claude Code)
24
- 8. Creates a demo page with Button examples
19
+ ```bash
20
+ npx @archetypeai/ds-cli create my-app
21
+ ```
25
22
 
26
- #### Create flags
23
+ Sets up a SvelteKit + Tailwind v4 + shadcn-svelte project with design tokens, components, and an optional demo page.
27
24
 
28
25
  | Flag | Values | Default |
29
26
  |------|--------|---------|
30
27
  | `--framework` | `svelte` | prompt |
31
28
  | `--pm` | `npm`, `pnpm`, `bun`, `yarn` | prompt |
32
- | `--fonts` / `--no-fonts` | boolean | prompt (default: yes) |
33
- | `--no-components` | skip component installation | install all |
29
+ | `--no-components` | skip component install | install all |
34
30
  | `--codeagent` | `cursor`, `claude`, `none` | prompt |
35
31
 
36
32
  ```bash
37
- npx @archetypeai/ds-cli create my-app --framework svelte --pm pnpm --no-fonts --codeagent none
33
+ npx @archetypeai/ds-cli create my-app --framework svelte --pm pnpm --codeagent none
38
34
  ```
39
35
 
40
36
  ---
41
37
 
42
- ### `init` Add DS to an existing project
38
+ ### `init` Add DS to an existing project
43
39
 
44
40
  ```bash
45
41
  cd my-existing-app
46
42
  npx @archetypeai/ds-cli init
47
43
  ```
48
44
 
49
- Run from an existing SvelteKit project root. Detects your package manager from the lockfile and installs the design system without creating a new project:
50
-
51
- 1. Detects project (verifies `package.json` and `svelte.config.js`)
52
- 2. Auto-detects package manager from lockfile
53
- 3. Installs Tailwind CSS v4 if not already present
54
- 4. Installs design tokens
55
- 5. Optionally installs internal fonts
56
- 6. Initializes shadcn-svelte
57
- 7. Prepends DS imports to existing `layout.css` (preserves your styles)
58
- 8. Installs all components from the registry
59
- 9. Optionally installs AI agent configuration
60
-
61
- #### Init flags
45
+ Run from a SvelteKit project root. Auto-detects your package manager, installs tokens, shadcn-svelte, and components, and prepends DS imports to your `layout.css` (preserving existing styles).
62
46
 
63
47
  | Flag | Values | Default |
64
48
  |------|--------|---------|
65
- | `--pm` | `npm`, `pnpm`, `bun`, `yarn` | auto-detect from lockfile |
66
- | `--fonts` / `--no-fonts` | boolean | prompt (default: yes) |
67
- | `--no-components` | skip component installation | install all |
49
+ | `--pm` | `npm`, `pnpm`, `bun`, `yarn` | auto-detect |
50
+ | `--no-components` | skip component install | install all |
68
51
  | `--codeagent` | `cursor`, `claude`, `none` | prompt |
69
52
 
70
53
  ```bash
71
- npx @archetypeai/ds-cli init --pm npm --no-fonts --codeagent none
54
+ npx @archetypeai/ds-cli init --pm npm --codeagent none
72
55
  ```
73
56
 
74
57
  ---
75
58
 
76
- ### `add` Add components or agent configurations
59
+ ### `add` Add components or agent config
77
60
 
78
- #### `add ds-ui-svelte` — Install all design system components
61
+ #### `add ds-ui-svelte`
79
62
 
80
63
  ```bash
81
64
  npx @archetypeai/ds-cli add ds-ui-svelte
82
65
  ```
83
66
 
84
- Installs all components from the design system registry into your project. Requires shadcn-svelte to be initialized (`components.json` must exist).
67
+ Installs all components from the registry. Requires shadcn-svelte (`components.json` must exist).
85
68
 
86
- #### `add ds-config-codeagent` — Install agent configuration
69
+ #### `add ds-config-codeagent`
87
70
 
88
71
  ```bash
89
72
  npx @archetypeai/ds-cli add ds-config-codeagent --cursor
90
73
  npx @archetypeai/ds-cli add ds-config-codeagent --claude
91
74
  ```
92
75
 
93
- Installs agent configuration files (AGENTS.md/CLAUDE.md, skills, and rules) for the specified IDE. If no flag is provided, an interactive prompt will ask which IDE to configure.
94
-
95
76
  | Flag | Effect |
96
77
  |------|--------|
97
- | `--cursor` | Copies AGENTS.md, skills, and rules to `.cursor/` |
98
- | `--claude` | Copies CLAUDE.md, skills, and rules to `.claude/` |
99
-
100
- ---
101
-
102
- ## Environment Variables
103
-
104
- | Variable | Default | Description |
105
- |----------|---------|-------------|
106
- | `REGISTRY_URL` | `https://design-system.archetypeai.workers.dev` | Override the component registry URL for testing or private registries |
107
-
108
- ---
109
-
110
- ## Security
111
-
112
- The CLI validates all data from external sources before use:
113
-
114
- - **Registry URLs** are validated against an HTTPS + `/r/<name>.json` pattern before being passed to any shell command
115
- - **Shell commands** use `execFileSync` (no shell interpolation) to prevent injection even if validation is bypassed
116
- - **Package manager** and **framework** flag values are validated against known allowlists
117
- - **Fetch requests** have a 15-second timeout to prevent hanging on unresponsive registries
118
-
119
- ---
120
-
121
- ## Fonts
78
+ | `--cursor` | Installs AGENTS.md, skills, and rules to `.cursor/` |
79
+ | `--claude` | Installs CLAUDE.md, skills, and rules to `.claude/` |
122
80
 
123
- The internal fonts package (`@archetypeai/ds-lib-fonts-internal`) is not yet published. When available, it will be on npmjs.org. If omitted, the theme falls back to system fonts.
81
+ Without a flag, an interactive prompt asks which IDE to configure.
@@ -6,7 +6,6 @@ import { fetchComponents } from '../lib/use-shadcn-svelte-registry.js';
6
6
  import {
7
7
  runSvCreate,
8
8
  installTokens,
9
- installFonts,
10
9
  initShadcn,
11
10
  configureCss,
12
11
  installComponents,
@@ -20,7 +19,6 @@ export function parseFlags(args) {
20
19
  name: null,
21
20
  framework: null,
22
21
  pm: null,
23
- fonts: null,
24
22
  components: true,
25
23
  agent: null
26
24
  };
@@ -31,10 +29,6 @@ export function parseFlags(args) {
31
29
  flags.framework = args[++i];
32
30
  } else if (arg === '--pm' && args[i + 1]) {
33
31
  flags.pm = args[++i];
34
- } else if (arg === '--fonts') {
35
- flags.fonts = true;
36
- } else if (arg === '--no-fonts') {
37
- flags.fonts = false;
38
32
  } else if (arg === '--no-components') {
39
33
  flags.components = false;
40
34
  } else if (arg === '--codeagent' && args[i + 1]) {
@@ -139,38 +133,22 @@ export async function create(args) {
139
133
  }
140
134
 
141
135
  // create SvelteKit project
142
- const created = runSvCreate(pm, name, targetDir);
136
+ const created = await runSvCreate(pm, name, targetDir);
143
137
  if (!created) {
144
138
  process.exit(1);
145
139
  }
146
140
 
147
- // specify fonts
148
- let includeFonts = flags.fonts;
149
- if (includeFonts === null) {
150
- includeFonts = await p.confirm({
151
- message: 'Install internal fonts package?',
152
- initialValue: true
153
- });
154
- if (p.isCancel(includeFonts)) {
155
- p.cancel('Setup cancelled.');
156
- process.exit(0);
157
- }
158
- }
159
-
160
141
  // install packages
161
- const tokensOk = installTokens(pm, projectPath);
142
+ const tokensOk = await installTokens(pm, projectPath);
162
143
  if (!tokensOk) {
163
144
  process.exit(1);
164
145
  }
165
146
 
166
- if (includeFonts) {
167
- installFonts(pm, projectPath);
168
- }
169
-
170
147
  // init shadcn-svelte
171
- initShadcn(pm, projectPath);
148
+ await initShadcn(pm, projectPath);
172
149
 
173
150
  // configure CSS
151
+ const includeFonts = false;
174
152
  configureCss(projectPath, includeFonts);
175
153
 
176
154
  // install components
@@ -180,7 +158,7 @@ export async function create(args) {
180
158
  s.start('Fetching component list');
181
159
  const components = await fetchComponents();
182
160
  s.stop(`Found ${components.length} components`);
183
- installComponents(pm, projectPath, components);
161
+ await installComponents(pm, projectPath, components);
184
162
  } catch (error) {
185
163
  p.log.warn(`Component installation skipped: ${error.message}`);
186
164
  }
package/commands/init.js CHANGED
@@ -6,7 +6,6 @@ import { fetchComponents } from '../lib/use-shadcn-svelte-registry.js';
6
6
  import {
7
7
  installTailwind,
8
8
  installTokens,
9
- installFonts,
10
9
  initShadcn,
11
10
  prependCss,
12
11
  installComponents,
@@ -17,7 +16,6 @@ import {
17
16
  export function parseFlags(args) {
18
17
  const flags = {
19
18
  pm: null,
20
- fonts: null,
21
19
  components: true,
22
20
  agent: null
23
21
  };
@@ -26,10 +24,6 @@ export function parseFlags(args) {
26
24
  const arg = args[i];
27
25
  if (arg === '--pm' && args[i + 1]) {
28
26
  flags.pm = args[++i];
29
- } else if (arg === '--fonts') {
30
- flags.fonts = true;
31
- } else if (arg === '--no-fonts') {
32
- flags.fonts = false;
33
27
  } else if (arg === '--no-components') {
34
28
  flags.components = false;
35
29
  } else if (arg === '--codeagent' && args[i + 1]) {
@@ -107,39 +101,23 @@ export async function init(args) {
107
101
  // detect and install Tailwind if missing
108
102
  if (!hasTailwind(projectPath)) {
109
103
  p.log.info('Tailwind CSS not found in dependencies.');
110
- const tailwindOk = installTailwind(pm, projectPath);
104
+ const tailwindOk = await installTailwind(pm, projectPath);
111
105
  if (!tailwindOk) {
112
106
  process.exit(1);
113
107
  }
114
108
  }
115
109
 
116
- // specify fonts
117
- let includeFonts = flags.fonts;
118
- if (includeFonts === null) {
119
- includeFonts = await p.confirm({
120
- message: 'Install internal fonts package?',
121
- initialValue: true
122
- });
123
- if (p.isCancel(includeFonts)) {
124
- p.cancel('Setup cancelled.');
125
- process.exit(0);
126
- }
127
- }
128
-
129
110
  // install packages
130
- const tokensOk = installTokens(pm, projectPath);
111
+ const tokensOk = await installTokens(pm, projectPath);
131
112
  if (!tokensOk) {
132
113
  process.exit(1);
133
114
  }
134
115
 
135
- if (includeFonts) {
136
- installFonts(pm, projectPath);
137
- }
138
-
139
116
  // init shadcn-svelte
140
- initShadcn(pm, projectPath);
117
+ await initShadcn(pm, projectPath);
141
118
 
142
119
  // configure CSS (prepend to existing)
120
+ const includeFonts = false;
143
121
  prependCss(projectPath, includeFonts);
144
122
 
145
123
  // install components
@@ -149,7 +127,7 @@ export async function init(args) {
149
127
  s.start('Fetching component list');
150
128
  const components = await fetchComponents();
151
129
  s.stop(`Found ${components.length} components`);
152
- installComponents(pm, projectPath, components);
130
+ await installComponents(pm, projectPath, components);
153
131
  } catch (error) {
154
132
  p.log.warn(`Component installation skipped: ${error.message}`);
155
133
  }
@@ -1,4 +1,5 @@
1
- import { execFileSync } from 'child_process';
1
+ import { execFile } from 'child_process';
2
+ import { promisify } from 'util';
2
3
  import { existsSync, readFileSync, writeFileSync } from 'fs';
3
4
  import { join, dirname } from 'path';
4
5
  import { fileURLToPath } from 'url';
@@ -6,6 +7,8 @@ import * as p from '@clack/prompts';
6
7
  import { validateRegistryUrl } from './validate-url.js';
7
8
  import { detectPm, getPm } from './use-package-manager.js';
8
9
 
10
+ const execFileAsync = promisify(execFile);
11
+
9
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
10
13
  const REGISTRY_URL = process.env.REGISTRY_URL || 'https://design-system.archetypeai.workers.dev';
11
14
  const ALL_COMPONENTS_URL = `${REGISTRY_URL}/r/all.json`;
@@ -53,7 +56,7 @@ export async function addDsUiSvelte() {
53
56
  installSpinner.start('Installing components');
54
57
 
55
58
  const [dlxCmd, ...dlxArgs] = pm.dlx.split(/\s+/);
56
- execFileSync(
59
+ await execFileAsync(
57
60
  dlxCmd,
58
61
  [...dlxArgs, 'shadcn-svelte@latest', 'add', ...componentUrls, '--yes', '--overwrite'],
59
62
  { stdio: 'pipe', cwd: projectDir }
@@ -1,12 +1,15 @@
1
- import { execFileSync } from 'child_process';
1
+ import { execFile } from 'child_process';
2
+ import { promisify } from 'util';
2
3
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
3
4
  import { join } from 'path';
4
5
  import * as p from '@clack/prompts';
5
6
  import { setupCursor, setupClaude } from './add-ds-config-codeagent.js';
6
7
 
8
+ const execFileAsync = promisify(execFile);
9
+
7
10
  // run a command without a shell to prevent injection
8
- function run(command, args, opts) {
9
- execFileSync(command, args, { stdio: 'pipe', ...opts });
11
+ async function run(command, args, opts) {
12
+ await execFileAsync(command, args, { stdio: 'pipe', ...opts });
10
13
  }
11
14
 
12
15
  // write a file
@@ -24,7 +27,7 @@ function splitCmd(cmdString) {
24
27
  }
25
28
 
26
29
  // run sveltekit create
27
- export function runSvCreate(pm, name, targetDir) {
30
+ export async function runSvCreate(pm, name, targetDir) {
28
31
  const [cmd, ...baseArgs] = splitCmd(pm.dlx);
29
32
  const args = [
30
33
  ...baseArgs,
@@ -41,7 +44,7 @@ export function runSvCreate(pm, name, targetDir) {
41
44
  const s = p.spinner();
42
45
  s.start('Creating SvelteKit project');
43
46
  try {
44
- run(cmd, args, { cwd: targetDir });
47
+ await run(cmd, args, { cwd: targetDir });
45
48
  s.stop('SvelteKit project created');
46
49
  return true;
47
50
  } catch (error) {
@@ -52,13 +55,13 @@ export function runSvCreate(pm, name, targetDir) {
52
55
  }
53
56
 
54
57
  // install design tokens
55
- export function installTokens(pm, projectPath) {
58
+ export async function installTokens(pm, projectPath) {
56
59
  const [cmd, ...baseArgs] = splitCmd(pm.install);
57
60
  const args = [...baseArgs, '@archetypeai/ds-lib-tokens'];
58
61
  const s = p.spinner();
59
62
  s.start('Installing design tokens');
60
63
  try {
61
- run(cmd, args, { cwd: projectPath });
64
+ await run(cmd, args, { cwd: projectPath });
62
65
  s.stop('Design tokens installed');
63
66
  return true;
64
67
  } catch (error) {
@@ -69,13 +72,13 @@ export function installTokens(pm, projectPath) {
69
72
  }
70
73
 
71
74
  // install internal fonts package
72
- export function installFonts(pm, projectPath) {
75
+ export async function installFonts(pm, projectPath) {
73
76
  const [cmd, ...baseArgs] = splitCmd(pm.install);
74
77
  const args = [...baseArgs, '@archetypeai/ds-lib-fonts-internal'];
75
78
  const s = p.spinner();
76
79
  s.start('Installing internal fonts');
77
80
  try {
78
- run(cmd, args, { cwd: projectPath });
81
+ await run(cmd, args, { cwd: projectPath });
79
82
  s.stop('Internal fonts installed');
80
83
  return true;
81
84
  } catch {
@@ -86,7 +89,7 @@ export function installFonts(pm, projectPath) {
86
89
  }
87
90
 
88
91
  // init shadcn-svelte
89
- export function initShadcn(pm, projectPath) {
92
+ export async function initShadcn(pm, projectPath) {
90
93
  const s = p.spinner();
91
94
  s.start('Setting up shadcn-svelte');
92
95
  try {
@@ -131,7 +134,7 @@ export function cn(...inputs) {
131
134
  }
132
135
 
133
136
  const [cmd, ...baseArgs] = splitCmd(pm.install);
134
- run(cmd, [...baseArgs, 'clsx', 'tailwind-merge', 'tw-animate-css'], { cwd: projectPath });
137
+ await run(cmd, [...baseArgs, 'clsx', 'tailwind-merge', 'tw-animate-css'], { cwd: projectPath });
135
138
 
136
139
  s.stop('shadcn-svelte ready');
137
140
  return true;
@@ -158,13 +161,13 @@ export function configureCss(projectPath, includeFonts) {
158
161
  }
159
162
 
160
163
  // install Tailwind CSS v4
161
- export function installTailwind(pm, projectPath) {
164
+ export async function installTailwind(pm, projectPath) {
162
165
  const [cmd, ...baseArgs] = splitCmd(pm.install);
163
166
  const args = [...baseArgs, 'tailwindcss@latest'];
164
167
  const s = p.spinner();
165
168
  s.start('Installing Tailwind CSS v4');
166
169
  try {
167
- run(cmd, args, { cwd: projectPath });
170
+ await run(cmd, args, { cwd: projectPath });
168
171
  s.stop('Tailwind CSS installed');
169
172
  return true;
170
173
  } catch (error) {
@@ -206,18 +209,22 @@ export function prependCss(projectPath, includeFonts) {
206
209
  }
207
210
 
208
211
  // install components from shadcn-svelte registry
209
- export function installComponents(pm, projectPath, componentUrls) {
212
+ export async function installComponents(pm, projectPath, componentUrls) {
210
213
  const s = p.spinner();
211
214
  s.start(`Installing ${componentUrls.length} components`);
212
215
  try {
213
216
  const urls = componentUrls.map((c) => c.url);
214
217
  const [dlxCmd, ...dlxArgs] = splitCmd(pm.dlx);
215
- run(dlxCmd, [...dlxArgs, 'shadcn-svelte@latest', 'add', ...urls, '--yes', '--overwrite'], {
216
- cwd: projectPath
217
- });
218
+ await run(
219
+ dlxCmd,
220
+ [...dlxArgs, 'shadcn-svelte@latest', 'add', ...urls, '--yes', '--overwrite'],
221
+ {
222
+ cwd: projectPath
223
+ }
224
+ );
218
225
 
219
226
  const [installCmd, ...installArgs] = splitCmd(pm.install);
220
- run(
227
+ await run(
221
228
  installCmd,
222
229
  [...installArgs, 'tailwind-variants', 'bits-ui', '@lucide/svelte', 'layerchart', 'paneforge'],
223
230
  { cwd: projectPath }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@archetypeai/ds-cli",
3
- "version": "0.3.7",
4
- "description": "Archetype AI Design System CLI",
3
+ "version": "0.3.9",
4
+ "description": "Archetype AI Design System CLI Tool",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "ds": "./bin.js"
@@ -30,5 +30,16 @@
30
30
  "publishConfig": {
31
31
  "registry": "https://registry.npmjs.org"
32
32
  },
33
+ "keywords": [
34
+ "design-system",
35
+ "cli",
36
+ "sveltekit",
37
+ "tailwindcss",
38
+ "shadcn-svelte",
39
+ "scaffolding",
40
+ "components",
41
+ "archetypeai",
42
+ "physicalai"
43
+ ],
33
44
  "license": "MIT"
34
45
  }