@archetypeai/ds-cli 0.3.15 → 0.3.17

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/files/AGENTS.md CHANGED
@@ -44,8 +44,22 @@ Standard Tailwind is fine for:
44
44
  - **Variants**: `tailwind-variants` (tv) for component variants
45
45
  - **Slots**: `{@render children?.()}`
46
46
 
47
+ ## Pattern Registry
48
+
49
+ Before building a new component, fetch the pattern catalog from:
50
+ `https://design-system.archetypeai.workers.dev/r/patterns.json`
51
+
52
+ Each entry includes a `name`, `title`, `description`, and `registryDependencies`. Reuse or extend existing patterns instead of rebuilding from scratch. To install a pattern:
53
+ `npx shadcn-svelte@latest add https://design-system.archetypeai.workers.dev/r/{name}.json`
54
+
47
55
  ## Skills
48
56
 
57
+ **Skill composition:** When building a demo that uses a Newton or Embedding API skill:
58
+ 1. Use `@skills/create-dashboard` for the page layout (dashboard with Menubar)
59
+ 2. Fetch `https://design-system.archetypeai.workers.dev/r/patterns.json` and reuse existing patterns before creating new components
60
+ 3. Apply `@rules/design-principles` aesthetic conventions (BackgroundCard for single-purpose cards, mono font for headers/numbers)
61
+ 4. Only include chart components if the user's request involves time-series or explicitly mentions charts
62
+
49
63
  Read these when relevant to your task:
50
64
 
51
65
  - `@skills/apply-ds` - apply DS tokens, components, and patterns to an existing demo
package/files/CLAUDE.md CHANGED
@@ -44,9 +44,21 @@ Standard Tailwind is fine for:
44
44
  - **Variants**: `tailwind-variants` (tv) for component variants
45
45
  - **Slots**: `{@render children?.()}`
46
46
 
47
+ ## Pattern Registry
48
+
49
+ Before building a new component, fetch the pattern catalog from:
50
+ `https://design-system.archetypeai.workers.dev/r/patterns.json`
51
+
52
+ Each entry includes a `name`, `title`, `description`, and `registryDependencies`. Reuse or extend existing patterns instead of rebuilding from scratch. To install a pattern:
53
+ `npx shadcn-svelte@latest add https://design-system.archetypeai.workers.dev/r/{name}.json`
54
+
47
55
  ## Skills
48
56
 
49
- **Skill composition:** When building a demo that uses a Newton or Embedding API skill, also consult `@skills/create-dashboard` for dashboard layouts and `@skills/build-pattern` for extracting components. Only include chart components (SensorChart, ScatterChart) if the user's request involves time-series or explicitly mentions charts.
57
+ **Skill composition:** When building a demo that uses a Newton or Embedding API skill:
58
+ 1. Use `@skills/create-dashboard` for the page layout (dashboard with Menubar)
59
+ 2. Fetch `https://design-system.archetypeai.workers.dev/r/patterns.json` and reuse existing patterns before creating new components
60
+ 3. Apply `@rules/design-principles` aesthetic conventions (BackgroundCard for single-purpose cards, mono font for headers/numbers)
61
+ 4. Only include chart components if the user's request involves time-series or explicitly mentions charts
50
62
 
51
63
  Read these when relevant to your task:
52
64
 
@@ -21,7 +21,7 @@ Wrap all charts in Chart.Container with a config prop:
21
21
 
22
22
  ```svelte
23
23
  <script>
24
- import * as Chart from '$lib/components/ui/chart/index.js';
24
+ import * as Chart from '$lib/components/ui/primitives/chart/index.js';
25
25
 
26
26
  const chartConfig = {
27
27
  temperature: { label: 'Temperature', color: 'var(--chart-1)' },
@@ -253,100 +253,4 @@ Manual legend below chart:
253
253
  {/if}
254
254
  ```
255
255
 
256
- ## Complete SensorChart Example
257
-
258
- ```svelte
259
- <script>
260
- import { cn } from '$lib/utils.js';
261
- import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/card/index.js';
262
- import * as Chart from '$lib/components/ui/chart/index.js';
263
- import { LineChart } from 'layerchart';
264
- import { curveNatural } from 'd3-shape';
265
- import { scaleUtc, scaleLinear } from 'd3-scale';
266
-
267
- let {
268
- title = 'SENSOR',
269
- icon: Icon = undefined,
270
- data = [],
271
- signals = {},
272
- xKey = 'timestamp',
273
- maxPoints = undefined,
274
- yMin,
275
- yMax,
276
- yTicks,
277
- class: className,
278
- ...restProps
279
- } = $props();
280
-
281
- const chartColors = [
282
- 'var(--chart-1)',
283
- 'var(--chart-2)',
284
- 'var(--chart-3)',
285
- 'var(--chart-4)',
286
- 'var(--chart-5)'
287
- ];
288
-
289
- let displayData = $derived(maxPoints && data.length > maxPoints ? data.slice(-maxPoints) : data);
290
-
291
- let indexedData = $derived(displayData.map((d, i) => ({ ...d, _index: i })));
292
-
293
- let series = $derived(
294
- Object.entries(signals).map(([key, label], i) => ({
295
- key,
296
- label,
297
- color: chartColors[i % chartColors.length]
298
- }))
299
- );
300
-
301
- let chartConfig = $derived(
302
- Object.fromEntries(series.map((s) => [s.key, { label: s.label, color: s.color }]))
303
- );
304
-
305
- let useIndexX = $derived(maxPoints !== undefined);
306
- let xDomain = $derived(useIndexX ? [0, (maxPoints || displayData.length) - 1] : undefined);
307
- </script>
308
-
309
- <Card class={cn('p-4', className)} {...restProps}>
310
- <CardHeader class="flex flex-row items-center justify-between p-0">
311
- <CardTitle class="text-foreground font-mono text-base uppercase">
312
- {title}
313
- </CardTitle>
314
- {#if Icon}
315
- <Icon strokeWidth={1.25} class="text-muted-foreground size-6" />
316
- {/if}
317
- </CardHeader>
318
-
319
- <CardContent class="flex flex-col gap-6 p-0">
320
- <Chart.Container config={chartConfig} class="aspect-auto h-[220px] w-full">
321
- <LineChart
322
- data={indexedData}
323
- x={useIndexX ? '_index' : xKey}
324
- xScale={useIndexX ? scaleLinear() : scaleUtc()}
325
- {xDomain}
326
- yScale={scaleLinear()}
327
- yDomain={[yMin, yMax]}
328
- {series}
329
- tooltip={false}
330
- props={{
331
- spline: { curve: curveNatural, strokeWidth: 1.5 },
332
- yAxis: { ticks: yTicks }
333
- }}
334
- />
335
- </Chart.Container>
336
-
337
- {#if series.length > 0}
338
- <div class="flex items-center justify-center gap-10">
339
- {#each series as s (s.key)}
340
- <div class="flex items-center gap-2">
341
- <div
342
- class="size-2 rounded-full bg-(--legend-color)"
343
- style:--legend-color={s.color}
344
- ></div>
345
- <span class="text-foreground text-sm">{s.label}</span>
346
- </div>
347
- {/each}
348
- </div>
349
- {/if}
350
- </CardContent>
351
- </Card>
352
- ```
256
+ For a complete chart pattern example, see the `sensor-chart` pattern source in `$lib/components/ui/patterns/sensor-chart/`.
@@ -75,22 +75,7 @@ When wrapping bits-ui primitives, import the primitive and wrap it:
75
75
  </SelectPrimitive.Trigger>
76
76
  ```
77
77
 
78
- Common bits-ui primitives:
79
-
80
- - `Dialog` - Dialog.Root, Dialog.Portal, Dialog.Content, Dialog.Trigger, Dialog.Close
81
- - `AlertDialog` - AlertDialog.Root, AlertDialog.Trigger, AlertDialog.Content, AlertDialog.Action, AlertDialog.Cancel
82
- - `Select` - Select.Root, Select.Trigger, Select.Content, Select.Item
83
- - `Popover` - Popover.Root, Popover.Portal, Popover.Content, Popover.Trigger
84
- - `HoverCard` - HoverCard.Root, HoverCard.Trigger, HoverCard.Content
85
- - `Tooltip` - Tooltip.Root, Tooltip.Trigger, Tooltip.Content
86
- - `DropdownMenu` - DropdownMenu.Root, DropdownMenu.Trigger, DropdownMenu.Content, DropdownMenu.Item
87
- - `ContextMenu` - ContextMenu.Root, ContextMenu.Trigger, ContextMenu.Content, ContextMenu.Item
88
- - `Accordion` - Accordion.Root, Accordion.Item, Accordion.Trigger, Accordion.Content
89
- - `Tabs` - Tabs.Root, Tabs.List, Tabs.Trigger, Tabs.Content
90
- - `Collapsible` - Collapsible.Root, Collapsible.Trigger, Collapsible.Content
91
- - `Command` - Command.Root, Command.Input, Command.List, Command.Item
92
-
93
- Additional bits-ui primitives: Calendar, RangeCalendar, Checkbox, Switch, Slider, Toggle, ToggleGroup, RadioGroup, Menubar, NavigationMenu, Pagination, InputOTP, Sidebar, Progress, Label, Separator, AspectRatio, Avatar, ScrollArea, Sheet. Check the source files for their wrapper patterns.
78
+ For the full primitives catalog with import paths, see `@skills/build-pattern`.
94
79
 
95
80
  ## tailwind-variants (tv)
96
81
 
@@ -1,3 +1,9 @@
1
+ ---
2
+ paths:
3
+ - '**/*.svelte'
4
+ - '**/+page.svelte'
5
+ ---
6
+
1
7
  # Physical AI Design Principles
2
8
 
3
9
  ## Scope
@@ -53,4 +59,13 @@ Interaction unfolds within a three-way relationship: **person, system, and physi
53
59
 
54
60
  - Default to interfaces that support perception and reasoning rather than autonomous AI action
55
61
  - Where possible, distinguish between "the system shows" (Measure) and "the system suggests" (Reason)
56
- - Prefer framing AI output as observations or suggestions rather than commands or decisions
62
+ - Prefer framing AI output as observations or suggestions rather than commands or decisions
63
+
64
+ ## Aesthetic Conventions
65
+
66
+ ### Typography
67
+ - Use mono font (`font-mono`) with careful consideration: prefer it on badges, buttons, card headers, and numeric values. Do not apply mono to body text or descriptions.
68
+
69
+ ### Card Defaults
70
+ - For single-purpose card components (status display, score, chart), use BackgroundCard as the default container.
71
+ - Status cards showing a single metric or state often do not need a CardHeader — omit when content is self-explanatory.
@@ -23,11 +23,11 @@ Common extraction candidates: media inputs, status displays, result/summary view
23
23
 
24
24
  The project includes pattern components that demonstrate these conventions. Study them before building new ones:
25
25
 
26
- - `$lib/components/ui/VideoPlayer.svelte` — media playback with controls, composes Card + AspectRatio + Button + Slider
27
- - `$lib/components/ui/ExpandableLog.svelte` — streaming log display, composes Collapsible + Item + Badge
28
- - `$lib/components/ui/StatusBadge.svelte` — health indicator with derived state, composes Badge + Avatar
29
- - `$lib/components/ui/HealthscoreCard.svelte` — score card with derived state, composes Card sub-components
30
- - `$lib/components/ui/Menubar.svelte` — branded header with snippet slots
26
+ - `$lib/components/ui/patterns/video-player/video-player.svelte` — media playback with controls, composes Card + AspectRatio + Button + Slider
27
+ - `$lib/components/ui/patterns/expandable-log/expandable-log.svelte` — streaming log display, composes Collapsible + Item + Badge
28
+ - `$lib/components/ui/patterns/status-badge/status-badge.svelte` — health indicator with derived state, composes Badge + Avatar
29
+ - `$lib/components/ui/patterns/healthscore-card/healthscore-card.svelte` — score card with derived state, composes Card sub-components
30
+ - `$lib/components/ui/patterns/menubar/menubar.svelte` — branded header with snippet slots
31
31
 
32
32
  Check if an existing pattern fits before building a new one. Use `@skills/build-pattern` to create new patterns that follow these same conventions.
33
33
 
@@ -330,50 +330,18 @@ Log when values change (removed in production builds):
330
330
 
331
331
  ### Async Code Doesn't Track Dependencies
332
332
 
333
- ```svelte
334
- <script>
335
- let color = $state('red');
336
- let size = $state(100);
337
-
338
- $effect(() => {
339
- // color is tracked (read synchronously)
340
- console.log(color);
341
-
342
- setTimeout(() => {
343
- // size is NOT tracked (read async)
344
- console.log(size);
345
- }, 100);
346
- });
347
- </script>
348
- ```
333
+ Only synchronously-read state inside `$effect` is tracked. State read inside `setTimeout`, `await`, or callbacks is not tracked.
349
334
 
350
335
  ### Exporting Reassigned State
351
336
 
352
- Can't directly export state that gets reassigned:
337
+ Can't directly export state that gets reassigned. Wrap in an object instead:
353
338
 
354
339
  ```javascript
355
340
  // state.svelte.js
356
-
357
- // BAD - won't work across modules
358
- export let count = $state(0);
359
- export function increment() {
360
- count++;
361
- }
362
-
363
- // GOOD - wrap in object
364
341
  export const counter = $state({ count: 0 });
365
342
  export function increment() {
366
343
  counter.count++;
367
344
  }
368
-
369
- // GOOD - use getters
370
- let count = $state(0);
371
- export function getCount() {
372
- return count;
373
- }
374
- export function increment() {
375
- count++;
376
- }
377
345
  ```
378
346
 
379
347
  ### Effects Only Run in Browser
@@ -6,68 +6,17 @@ paths:
6
6
 
7
7
  # Styling Rules
8
8
 
9
- ## Semantic Token Reference
10
-
11
- ### Background & Foreground Colors
12
-
13
- | Token | Usage |
14
- | ------------------------- | ---------------------------- |
15
- | `bg-background` | Page/app background |
16
- | `text-foreground` | Primary text color |
17
- | `bg-card` | Card backgrounds |
18
- | `text-card-foreground` | Text on cards |
19
- | `bg-popover` | Popover/dropdown backgrounds |
20
- | `text-popover-foreground` | Text in popovers |
21
- | `bg-muted` | Muted/subtle backgrounds |
22
- | `text-muted-foreground` | Secondary/muted text |
23
-
24
- ### Interactive Colors
25
-
26
- | Token | Usage |
27
- | --------------------------- | ----------------------------- |
28
- | `bg-primary` | Primary buttons, links |
29
- | `text-primary-foreground` | Text on primary backgrounds |
30
- | `bg-secondary` | Secondary buttons |
31
- | `text-secondary-foreground` | Text on secondary backgrounds |
32
- | `bg-accent` | Hover states, highlights |
33
- | `text-accent-foreground` | Text on accent backgrounds |
34
- | `bg-destructive` | Delete/error actions |
35
-
36
- ### Border & Input Colors
37
-
38
- | Token | Usage |
39
- | --------------- | -------------------- |
40
- | `border-border` | Default border color |
41
- | `border-input` | Input field borders |
42
- | `ring-ring` | Focus ring color |
43
-
44
- ### Chart Colors
45
-
46
- | Token | Usage |
47
- | ----------- | -------------------------------- |
48
- | `--chart-1` | First series color (purple) |
49
- | `--chart-2` | Second series color (red-orange) |
50
- | `--chart-3` | Third series color (green) |
51
- | `--chart-4` | Fourth series color (yellow) |
52
- | `--chart-5` | Fifth series color (coral) |
53
-
54
- ### ATAI Brand Colors
55
-
56
- | Token | Usage |
57
- | -------------------- | --------------------- |
58
- | `bg-atai-neutral` | Brand blue accent |
59
- | `text-atai-good` | Success/healthy state |
60
- | `text-atai-warning` | Warning state |
61
- | `text-atai-critical` | Critical/error state |
62
-
63
- ### Sidebar Colors
64
-
65
- | Token | Usage |
66
- | ------------------------- | -------------------- |
67
- | `bg-sidebar` | Sidebar background |
68
- | `text-sidebar-foreground` | Sidebar text |
69
- | `bg-sidebar-accent` | Sidebar hover/active |
70
- | `border-sidebar-border` | Sidebar borders |
9
+ ## Semantic Tokens
10
+
11
+ For the complete token reference including dark mode overrides, type scale (h1–h6, p, small), and spacing definitions, read `node_modules/@archetypeai/ds-lib-tokens/theme.css`.
12
+
13
+ Token naming pattern: `bg-{token}`, `text-{token}-foreground`, `border-{token}`.
14
+
15
+ Core tokens: `background`, `foreground`, `primary`, `secondary`, `muted`, `card`, `accent`, `destructive`, `border`, `input`, `ring`.
16
+
17
+ ATAI brand tokens: `atai-neutral`, `atai-good`, `atai-warning`, `atai-critical`.
18
+
19
+ Chart series: `--chart-1` through `--chart-5` (see `@rules/charts`).
71
20
 
72
21
  ## When to Use Semantic vs Standard Tailwind
73
22
 
@@ -126,33 +75,7 @@ For custom dark mode overrides, use the `dark:` prefix:
126
75
  <div class="bg-white dark:bg-slate-900"> <!-- custom dark override -->
127
76
  ```
128
77
 
129
- ## cn() Utility
130
-
131
- Import and use for all class composition:
132
-
133
- ```javascript
134
- import { cn } from '$lib/utils.js';
135
- ```
136
-
137
- ```svelte
138
- <div class={cn(
139
- 'base-classes here',
140
- conditional && 'conditional-classes',
141
- className
142
- )}>
143
- ```
144
-
145
- The utility:
146
-
147
- - Uses `clsx` for conditional class joining
148
- - Uses `tailwind-merge` to resolve conflicts (last wins)
149
-
150
- Example conflict resolution:
151
-
152
- ```javascript
153
- cn('p-4', 'p-2'); // → 'p-2' (later wins)
154
- cn('bg-red-500', 'bg-background'); // → 'bg-background' (later wins)
155
- ```
78
+ For class merging with `cn()`, see `@rules/components`.
156
79
 
157
80
  ## CSS Import Order
158
81
 
@@ -212,34 +135,6 @@ Prefer Tailwind classes directly in markup. Use @apply only in base layer CSS:
212
135
 
213
136
  ## Common Patterns
214
137
 
215
- ### Focus States
216
-
217
- ```svelte
218
- <button class="focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 outline-none">
219
- ```
220
-
221
- ### Disabled States
138
+ For focus ring, disabled state, and data-state animation CSS patterns, see `@rules/accessibility`.
222
139
 
223
- ```svelte
224
- <button class="disabled:pointer-events-none disabled:opacity-50">
225
- ```
226
-
227
- ### Data State Animations
228
-
229
- ```svelte
230
- <div class="data-[state=open]:animate-in data-[state=closed]:animate-out">
231
- ```
232
-
233
- ### Responsive Design
234
-
235
- ```svelte
236
- <div class="w-full max-w-[calc(100%-2rem)] sm:max-w-lg">
237
- <div class="flex flex-col sm:flex-row">
238
- ```
239
-
240
- ### Icon Sizing
241
-
242
- ```svelte
243
- <!-- Default icon sizing utility -->
244
- <button class="[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
245
- ```
140
+ For icon sizing conventions, see `@rules/components`.
@@ -68,15 +68,15 @@ Swap native HTML elements for their DS component equivalents. Add imports as nee
68
68
 
69
69
  | Native Element | DS Component | Import From |
70
70
  | --- | --- | --- |
71
- | `<button>` | `<Button>` | `$lib/components/ui/button` |
72
- | `<input>` | `<Input>` | `$lib/components/ui/input` |
73
- | `<textarea>` | `<Textarea>` | `$lib/components/ui/textarea` |
74
- | `<select>` | `<Select.Root>` + `<Select.Trigger>` + `<Select.Content>` + `<Select.Item>` | `$lib/components/ui/select` |
75
- | `<table>` | `<Table.Root>` + `<Table.Header>` + `<Table.Row>` + `<Table.Head>` + `<Table.Body>` + `<Table.Cell>` | `$lib/components/ui/table` |
76
- | `<dialog>` | `<Dialog.Root>` + `<Dialog.Content>` + `<Dialog.Header>` + `<Dialog.Title>` | `$lib/components/ui/dialog` |
77
- | `<hr>` | `<Separator>` | `$lib/components/ui/separator` |
78
- | `<label>` | `<Label>` | `$lib/components/ui/label` |
79
- | `<a>` (styled as button) | `<Button variant="link">` or `<Button>` with `href` | `$lib/components/ui/button` |
71
+ | `<button>` | `<Button>` | `$lib/components/ui/primitives/button` |
72
+ | `<input>` | `<Input>` | `$lib/components/ui/primitives/input` |
73
+ | `<textarea>` | `<Textarea>` | `$lib/components/ui/primitives/textarea` |
74
+ | `<select>` | `<Select.Root>` + `<Select.Trigger>` + `<Select.Content>` + `<Select.Item>` | `$lib/components/ui/primitives/select` |
75
+ | `<table>` | `<Table.Root>` + `<Table.Header>` + `<Table.Row>` + `<Table.Head>` + `<Table.Body>` + `<Table.Cell>` | `$lib/components/ui/primitives/table` |
76
+ | `<dialog>` | `<Dialog.Root>` + `<Dialog.Content>` + `<Dialog.Header>` + `<Dialog.Title>` | `$lib/components/ui/primitives/dialog` |
77
+ | `<hr>` | `<Separator>` | `$lib/components/ui/primitives/separator` |
78
+ | `<label>` | `<Label>` | `$lib/components/ui/primitives/label` |
79
+ | `<a>` (styled as button) | `<Button variant="link">` or `<Button>` with `href` | `$lib/components/ui/primitives/button` |
80
80
 
81
81
  For each replacement:
82
82
 
@@ -96,7 +96,7 @@ Identify structural opportunities to use DS composition patterns:
96
96
  - **Scroll Area** — replace overflow containers with `<ScrollArea>`
97
97
  - **Tooltips** — replace `title` attributes with `<Tooltip.Root>` / `<Tooltip.Trigger>` / `<Tooltip.Content>`
98
98
 
99
- Import patterns from `$lib/components/ui/` as needed.
99
+ Import primitives from `$lib/components/ui/primitives/` and patterns from `$lib/components/ui/patterns/` as needed.
100
100
 
101
101
  ## Step 5: Lint and Format
102
102
 
@@ -114,7 +114,7 @@ Confirm the design system is properly applied:
114
114
 
115
115
  - [ ] No raw Tailwind color utilities in `.svelte` files (re-run the audit script)
116
116
  - [ ] Native elements replaced with DS components where appropriate
117
- - [ ] All component imports resolve to `$lib/components/ui/`
117
+ - [ ] All component imports resolve to `$lib/components/ui/primitives/` or `$lib/components/ui/patterns/`
118
118
  - [ ] `cn()` used for class merging — no string concatenation
119
119
  - [ ] Linting passes: `npm run lint && npm run format:check`
120
120
  - [ ] App builds without errors: `npm run build`
@@ -9,6 +9,8 @@ Patterns are composite components assembled from design system primitives.
9
9
 
10
10
  ## Decision: Pattern vs Extension
11
11
 
12
+ **Before building, fetch `https://design-system.archetypeai.workers.dev/r/patterns.json` and check if an existing pattern covers the use case — even partially. Use or extend it rather than creating a new one.**
13
+
12
14
  **Build a pattern when:**
13
15
 
14
16
  - Combining 3+ primitives into a reusable unit
@@ -25,8 +27,8 @@ Patterns are composite components assembled from design system primitives.
25
27
  ```svelte
26
28
  <script>
27
29
  import { cn } from '$lib/utils.js';
28
- import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/card/index.js';
29
- import { Button } from '$lib/components/ui/button/index.js';
30
+ import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/primitives/card/index.js';
31
+ import { Button } from '$lib/components/ui/primitives/button/index.js';
30
32
 
31
33
  let { title, class: className, children, ...restProps } = $props();
32
34
  </script>
@@ -86,7 +88,7 @@ Use `{@render}` for slot content:
86
88
 
87
89
  ## Available Primitives
88
90
 
89
- Import from `$lib/components/ui/`. Before building, list `$lib/components/ui/` to discover all installed primitives.
91
+ Import primitives from `$lib/components/ui/primitives/` and patterns from `$lib/components/ui/patterns/`. Before building, list these directories to discover all installed components.
90
92
 
91
93
  ### Layout & Structure
92
94
 
@@ -169,8 +171,8 @@ Import from `$lib/components/ui/`. Before building, list `$lib/components/ui/` t
169
171
  ```svelte
170
172
  <script>
171
173
  import { cn } from '$lib/utils.js';
172
- import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/card/index.js';
173
- import * as Chart from '$lib/components/ui/chart/index.js';
174
+ import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/primitives/card/index.js';
175
+ import * as Chart from '$lib/components/ui/primitives/chart/index.js';
174
176
 
175
177
  let { title = 'SENSOR', icon: Icon, data = [], class: className, ...restProps } = $props();
176
178
  </script>
@@ -13,7 +13,7 @@ Scaffold a full-viewport dashboard with a branded menubar and panel-based conten
13
13
 
14
14
  Before building, check which components are installed in the project:
15
15
 
16
- 1. List `$lib/components/ui/` to discover available primitives (subdirectories with `index.js`) and patterns (PascalCase `.svelte` files)
16
+ 1. List `$lib/components/ui/primitives/` and `$lib/components/ui/patterns/` to discover available primitives and patterns (each in a kebab-case subdirectory with `index.js`)
17
17
  2. Only use components that actually exist in the project
18
18
  3. If a required component is missing, ask the user to install it (via `npx shadcn-svelte@latest add`) or build it (via `@skills/build-pattern`)
19
19
  4. **Never inline raw markup as a substitute for a missing component**
@@ -44,8 +44,8 @@ Use the `Menubar` pattern. It renders a branded `<header>` with the Archetype AI
44
44
 
45
45
  ```svelte
46
46
  <script>
47
- import Menubar from '$lib/components/ui/Menubar.svelte';
48
- import { Button } from '$lib/components/ui/button/index.js';
47
+ import Menubar from '$lib/components/ui/patterns/menubar/index.js';
48
+ import { Button } from '$lib/components/ui/primitives/button/index.js';
49
49
  </script>
50
50
 
51
51
  <Menubar>
@@ -61,7 +61,7 @@ For co-branding, pass a `partnerLogo` snippet to replace the default placeholder
61
61
  {#snippet partnerLogo()}
62
62
  <img src="/partner-logo.svg" alt="Partner" class="h-6" />
63
63
  {/snippet}
64
- <!-- additive example — append to existing children, don't replace them -->
64
+ <!-- additive example — append to existing children, don't replace them -->
65
65
  <Button variant="link" class="text-muted-foreground">Send Report</Button>
66
66
  </Menubar>
67
67
  ```
@@ -77,8 +77,8 @@ For co-branding, pass a `partnerLogo` snippet to replace the default placeholder
77
77
 
78
78
  ```svelte
79
79
  <script>
80
- import Menubar from '$lib/components/ui/Menubar.svelte';
81
- import { Button } from '$lib/components/ui/button/index.js';
80
+ import Menubar from '$lib/components/ui/patterns/menubar/index.js';
81
+ import { Button } from '$lib/components/ui/primitives/button/index.js';
82
82
  </script>
83
83
 
84
84
  <div class="bg-background grid h-screen w-screen grid-rows-[auto_1fr] overflow-hidden">
@@ -150,9 +150,9 @@ For co-branding, pass a `partnerLogo` snippet to replace the default placeholder
150
150
  ```svelte
151
151
  <!-- src/routes/+page.svelte -->
152
152
  <script>
153
- import Menubar from '$lib/components/ui/Menubar.svelte';
154
- import { Button } from '$lib/components/ui/button/index.js';
155
- import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/card/index.js';
153
+ import Menubar from '$lib/components/ui/patterns/menubar/index.js';
154
+ import { Button } from '$lib/components/ui/primitives/button/index.js';
155
+ import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/primitives/card/index.js';
156
156
  </script>
157
157
 
158
158
  <div
@@ -187,7 +187,7 @@ For co-branding, pass a `partnerLogo` snippet to replace the default placeholder
187
187
 
188
188
  Panels should contain pattern components, not raw markup. Before building new components:
189
189
 
190
- 1. Check if existing patterns fit the need `VideoPlayer`, `ExpandableLog`, `StatusBadge`, `HealthscoreCard`, `SensorChart`, `ScatterChart`
190
+ 1. Fetch `https://design-system.archetypeai.workers.dev/r/patterns.json` to discover available patterns. Each has a `description` summarizing its purpose. If one fits, use it.
191
191
  2. If no existing pattern fits, create one via `@skills/build-pattern`
192
192
  3. Each panel should contain one primary component with clear props for data flow
193
193
 
@@ -8,7 +8,20 @@ argument-hint: [csv-file-path]
8
8
 
9
9
  Generate a script that streams time-series data from a CSV file to the Archetype AI Embedding Lens and collects embedding vectors. Supports both Python and JavaScript/Web.
10
10
 
11
- > **Frontend architecture:** When building a web UI for this skill, decompose into components (file input, status display, visualization) rather than a monolithic page. Extract API/streaming logic into `$lib/api/`. See `@rules/frontend-architecture` for conventions and `@skills/create-dashboard` / `@skills/build-pattern` for layout and component patterns.
11
+ ## Frontend Architecture
12
+
13
+ Decompose the UI into components. See `@rules/frontend-architecture` for conventions.
14
+
15
+ ### Recommended decomposition
16
+
17
+ | UI Area | Component | Pattern/Primitives | Key Props |
18
+ |---------|-----------|-------------------|-----------|
19
+ | File input | `DataInput.svelte` | BackgroundCard, Button, Input | `onselect`, `status` |
20
+ | Scatter plot | Reuse ScatterChart pattern | BackgroundCard, Chart | `data[]`, `categories` |
21
+ | Progress | `StreamProgress.svelte` | BackgroundCard, Progress | `current`, `total` |
22
+
23
+ - Use `@skills/create-dashboard` for the page layout
24
+ - Extract streaming and session logic into `$lib/api/embeddings.js`
12
25
 
13
26
  ---
14
27
 
@@ -8,7 +8,20 @@ argument-hint: [source-type]
8
8
 
9
9
  Generate a script that streams real-time IMU sensor data to the Archetype AI Embedding Lens for live embedding extraction. Supports both Python and JavaScript/Web.
10
10
 
11
- > **Frontend architecture:** When building a web UI for this skill, decompose into components (sensor connection, status display, embedding visualization) rather than a monolithic page. Extract sensor and API logic into `$lib/api/`. See `@rules/frontend-architecture` for conventions and `@skills/create-dashboard` / `@skills/build-pattern` for layout and component patterns.
11
+ ## Frontend Architecture
12
+
13
+ Decompose the UI into components. See `@rules/frontend-architecture` for conventions.
14
+
15
+ ### Recommended decomposition
16
+
17
+ | UI Area | Component | Pattern/Primitives | Key Props |
18
+ |---------|-----------|-------------------|-----------|
19
+ | Sensor input | `DataInput.svelte` | BackgroundCard, Button, Input | `onselect`, `status` |
20
+ | Scatter plot | Reuse ScatterChart pattern | BackgroundCard, Chart | `data[]`, `categories` |
21
+ | Progress | `StreamProgress.svelte` | BackgroundCard, Progress | `current`, `total` |
22
+
23
+ - Use `@skills/create-dashboard` for the page layout
24
+ - Extract streaming and session logic into `$lib/api/embeddings.js`
12
25
 
13
26
  ---
14
27
 
@@ -8,7 +8,20 @@ argument-hint: [csv-file-path]
8
8
 
9
9
  Generate a script that uploads a CSV file to the Archetype AI platform and extracts embeddings server-side. The server reads the file directly — no local streaming loop required. Supports both Python and JavaScript/Web.
10
10
 
11
- > **Frontend architecture:** When building a web UI for this skill, decompose into components (file upload, status display, results view) rather than a monolithic page. Extract API logic into `$lib/api/`. See `@rules/frontend-architecture` for conventions and `@skills/create-dashboard` / `@skills/build-pattern` for layout and component patterns.
11
+ ## Frontend Architecture
12
+
13
+ Decompose the UI into components. See `@rules/frontend-architecture` for conventions.
14
+
15
+ ### Recommended decomposition
16
+
17
+ | UI Area | Component | Pattern/Primitives | Key Props |
18
+ |---------|-----------|-------------------|-----------|
19
+ | File upload | `DataInput.svelte` | BackgroundCard, Button, Input | `onselect`, `status` |
20
+ | Scatter plot | Reuse ScatterChart pattern | BackgroundCard, Chart | `data[]`, `categories` |
21
+ | Progress | `StreamProgress.svelte` | BackgroundCard, Progress | `current`, `total` |
22
+
23
+ - Use `@skills/create-dashboard` for the page layout
24
+ - Extract upload and session logic into `$lib/api/embeddings.js`
12
25
 
13
26
  ---
14
27
 
@@ -78,7 +78,7 @@ Decompose the UI into components rather than building a monolithic `+page.svelte
78
78
  | Video input | `VideoUpload.svelte` (or reuse VideoPlayer pattern) | Card, Button | `onupload`, `status`, `videoUrl` |
79
79
  | Status | `ProcessingStatus.svelte` | Card, Badge, Spinner | `status`, `message` |
80
80
  | Summary | `AnalysisSummary.svelte` | Card | `title`, `summary` |
81
- | Log | Reuse ExpandableLog pattern | Collapsible, Badge, Item | `title`, `logs[]`, `count` |
81
+ | Log | Use FlatLogItem pattern in ScrollArea | FlatLogItem, ScrollArea | `status`, `message`, `detail` |
82
82
 
83
83
  ### Layout and API logic
84
84
 
@@ -9,7 +9,20 @@ allowed-tools: Bash(python *), Read
9
9
 
10
10
  Capture live webcam frames, encode as base64 JPEG, and send to Newton's vision model via `model.query` (synchronous request/response). Supports Python (OpenCV) and JavaScript (getUserMedia + canvas).
11
11
 
12
- > **Frontend architecture:** When building a web UI for this skill, decompose into components (webcam input, status display, results view) rather than a monolithic page. Extract API logic into `$lib/api/`. See `@rules/frontend-architecture` for conventions and `@skills/create-dashboard` / `@skills/build-pattern` for layout and component patterns.
12
+ ## Frontend Architecture
13
+
14
+ Decompose the UI into components. See `@rules/frontend-architecture` for conventions.
15
+
16
+ ### Recommended decomposition
17
+
18
+ | UI Area | Component | Pattern/Primitives | Key Props |
19
+ |---------|-----------|-------------------|-----------|
20
+ | Camera feed | `WebcamView.svelte` | Card, AspectRatio | `stream`, `status` |
21
+ | Status | `ConnectionStatus.svelte` | StatusBadge pattern | `status`, `label` |
22
+ | Results | Use FlatLogItem pattern in ScrollArea | FlatLogItem, ScrollArea | `status`, `message`, `detail` |
23
+
24
+ - Use `@skills/create-dashboard` for the page layout
25
+ - Extract webcam capture and API logic into `$lib/api/camera-analysis.js`
13
26
 
14
27
  **This skill is for LIVE WEBCAM input only.** For analyzing uploaded video files, use `/activity-monitor-lens-on-video` instead.
15
28
 
@@ -9,6 +9,15 @@ allowed-tools: Bash(python *), Read
9
9
 
10
10
  Send a text query directly to Newton via `POST /v0.5/query`. No lens registration, no session, no SSE — just a simple request/response. Use for API testing, text Q&A, or post-processing results from other lenses.
11
11
 
12
+ ## Frontend Architecture
13
+
14
+ | UI Area | Component | Pattern/Primitives | Key Props |
15
+ |---------|-----------|-------------------|-----------|
16
+ | Query input | `QueryInput.svelte` | BackgroundCard, Input, Button | `onsubmit`, `loading` |
17
+ | Response | `QueryResponse.svelte` | BackgroundCard | `response`, `loading` |
18
+
19
+ - Use `@skills/create-dashboard` for the page layout
20
+
12
21
  ---
13
22
 
14
23
  ## API Endpoint
@@ -8,7 +8,21 @@ argument-hint: [csv-file-path]
8
8
 
9
9
  Generate a script that streams time-series data from a CSV file to the Archetype AI Machine State Lens for n-shot state classification. Supports both Python and JavaScript/Web.
10
10
 
11
- > **Frontend architecture:** When building a web UI for this skill, decompose into components (file input, status display, results view) rather than a monolithic page. Extract API/streaming logic into `$lib/api/`. See `@rules/frontend-architecture` for conventions and `@skills/create-dashboard` / `@skills/build-pattern` for layout and component patterns.
11
+ ## Frontend Architecture
12
+
13
+ Decompose the UI into components. See `@rules/frontend-architecture` for conventions.
14
+
15
+ ### Recommended decomposition
16
+
17
+ | UI Area | Component | Pattern/Primitives | Key Props |
18
+ |---------|-----------|-------------------|-----------|
19
+ | File input | `DataInput.svelte` | BackgroundCard, Button, Input | `onselect`, `status` |
20
+ | Classification | `StateDisplay.svelte` | BackgroundCard, Badge | `currentState`, `confidence` |
21
+ | Time series | Reuse SensorChart pattern | BackgroundCard, Chart | `data[]`, `signals` |
22
+ | Results | Use FlatLogItem pattern in ScrollArea | FlatLogItem, ScrollArea | `status`, `message`, `detail` |
23
+
24
+ - Use `@skills/create-dashboard` for the page layout
25
+ - Extract streaming and session logic into `$lib/api/machine-state.js`
12
26
 
13
27
  ---
14
28
 
@@ -8,7 +8,21 @@ argument-hint: [source-type]
8
8
 
9
9
  Generate a script that streams real-time IMU sensor data to the Archetype AI Machine State Lens for live n-shot state classification. Supports both Python and JavaScript/Web.
10
10
 
11
- > **Frontend architecture:** When building a web UI for this skill, decompose into components (sensor connection, status display, results view) rather than a monolithic page. Extract sensor and API logic into `$lib/api/`. See `@rules/frontend-architecture` for conventions and `@skills/create-dashboard` / `@skills/build-pattern` for layout and component patterns.
11
+ ## Frontend Architecture
12
+
13
+ Decompose the UI into components. See `@rules/frontend-architecture` for conventions.
14
+
15
+ ### Recommended decomposition
16
+
17
+ | UI Area | Component | Pattern/Primitives | Key Props |
18
+ |---------|-----------|-------------------|-----------|
19
+ | Sensor input | `DataInput.svelte` | BackgroundCard, Button, Input | `onselect`, `status` |
20
+ | Classification | `StateDisplay.svelte` | BackgroundCard, Badge | `currentState`, `confidence` |
21
+ | Time series | Reuse SensorChart pattern | BackgroundCard, Chart | `data[]`, `signals` |
22
+ | Results | Use FlatLogItem pattern in ScrollArea | FlatLogItem, ScrollArea | `status`, `message`, `detail` |
23
+
24
+ - Use `@skills/create-dashboard` for the page layout
25
+ - Extract streaming and session logic into `$lib/api/machine-state.js`
12
26
 
13
27
  ---
14
28
 
@@ -11,7 +11,7 @@ Build charts using layerchart wrapped in the Chart.Container primitive.
11
11
 
12
12
  Before building, check which components are installed in the project already:
13
13
 
14
- 1. List `$lib/components/ui/` to discover available primitives and patterns
14
+ 1. List `$lib/components/ui/primitives/` and `$lib/components/ui/patterns/` to discover available primitives and patterns
15
15
  2. Only use components that actually exist in the project
16
16
  3. Charts require at minimum: `chart`. For card-wrapped charts: `card`, `chart`
17
17
 
@@ -75,7 +75,7 @@ The `embedding.csv` contains dimensionality-reduced coordinates. To prepare it f
75
75
 
76
76
  ```svelte
77
77
  <script>
78
- import ScatterChart from '$lib/components/ui/ScatterChart.svelte';
78
+ import ScatterChart from '$lib/components/ui/patterns/scatter-chart/index.js';
79
79
  import ScatterChartIcon from '@lucide/svelte/icons/scatter-chart';
80
80
  import embeddingCsv from '$lib/data/embedding.csv?raw';
81
81
 
@@ -135,7 +135,7 @@ The `embedding.csv` contains dimensionality-reduced coordinates. To prepare it f
135
135
  ```svelte
136
136
  <script>
137
137
  import { onMount, onDestroy } from 'svelte';
138
- import ScatterChart from '$lib/components/ui/ScatterChart.svelte';
138
+ import ScatterChart from '$lib/components/ui/patterns/scatter-chart/index.js';
139
139
  import ScatterChartIcon from '@lucide/svelte/icons/scatter-chart';
140
140
 
141
141
  let streamData = $state([]);
@@ -185,7 +185,7 @@ If the `scatter-chart` pattern is not installed, use `card` + `chart` primitives
185
185
 
186
186
  ```svelte
187
187
  <script>
188
- import * as Chart from '$lib/components/ui/chart/index.js';
188
+ import * as Chart from '$lib/components/ui/primitives/chart/index.js';
189
189
  import { ScatterChart } from 'layerchart';
190
190
  import { scaleLinear } from 'd3-scale';
191
191
 
@@ -38,7 +38,7 @@ This installs `SensorChart.svelte` and its dependencies (`card`, `chart`, `utils
38
38
 
39
39
  ```svelte
40
40
  <script>
41
- import SensorChart from '$lib/components/ui/SensorChart.svelte';
41
+ import SensorChart from '$lib/components/ui/patterns/sensor-chart/index.js';
42
42
  import AudioWaveformIcon from '@lucide/svelte/icons/audio-waveform';
43
43
  import timeseriesCsv from '$lib/data/timeseries.csv?raw';
44
44
 
@@ -86,7 +86,7 @@ For real-time data with a sliding window, use the `maxPoints` prop and feed data
86
86
  ```svelte
87
87
  <script>
88
88
  import { onMount, onDestroy } from 'svelte';
89
- import SensorChart from '$lib/components/ui/SensorChart.svelte';
89
+ import SensorChart from '$lib/components/ui/patterns/sensor-chart/index.js';
90
90
  import ThermometerIcon from '@lucide/svelte/icons/thermometer';
91
91
 
92
92
  let streamingData = $state([]);
@@ -126,7 +126,7 @@ If the `sensor-chart` pattern is not installed, build the equivalent using `card
126
126
 
127
127
  ```svelte
128
128
  <script>
129
- import * as Chart from '$lib/components/ui/chart/index.js';
129
+ import * as Chart from '$lib/components/ui/primitives/chart/index.js';
130
130
  import { LineChart } from 'layerchart';
131
131
  import { scaleUtc, scaleLinear } from 'd3-scale';
132
132
  import { curveNatural } from 'd3-shape';
@@ -256,20 +256,40 @@ export async function installComponents(pm, projectPath, componentUrls) {
256
256
  }
257
257
  }
258
258
 
259
- // add a demo page with Button examples to app
259
+ // add a demo page with design system examples to app
260
260
  export function createDemoPage(projectPath) {
261
261
  const pagePath = join(projectPath, 'src/routes/+page.svelte');
262
262
  const demoContent = `<script>
263
- \timport Button from "$lib/components/ui/button/button.svelte";
263
+ \timport Menubar from '$lib/components/ui/patterns/menubar/index.js';
264
+ \timport { Button } from '$lib/components/ui/primitives/button/index.js';
265
+ \timport BackgroundCard from '$lib/components/ui/patterns/background-card/index.js';
266
+ \timport ActivityIcon from '@lucide/svelte/icons/activity';
267
+ \timport CpuIcon from '@lucide/svelte/icons/cpu';
268
+ \timport GaugeIcon from '@lucide/svelte/icons/gauge';
269
+ \timport ThermometerIcon from '@lucide/svelte/icons/thermometer';
264
270
  </script>
265
271
 
266
- <div class="flex flex-col items-center justify-center min-h-screen space-y-xl">
267
- <Button variant="default">Default</Button>
268
- <Button variant="ghost">Ghost</Button>
269
- <Button variant="outline">Outline</Button>
270
- <Button variant="secondary">Secondary</Button>
271
- <Button variant="destructive">Destructive</Button>
272
- <Button variant="link">Link</Button>
272
+ <div
273
+ \tclass="bg-background text-foreground grid h-screen w-screen grid-rows-[auto_1fr] overflow-hidden"
274
+ >
275
+ \t<Menubar>
276
+ \t\t<Button variant="link" class="text-muted-foreground">Send Report</Button>
277
+ \t</Menubar>
278
+
279
+ \t<main class="grid grid-cols-2 grid-rows-2 gap-4 overflow-hidden p-4">
280
+ \t\t<BackgroundCard title="Panel 1" icon={ActivityIcon} class="max-h-full">
281
+ \t\t\t<p class="text-muted-foreground text-sm">Placeholder content</p>
282
+ \t\t</BackgroundCard>
283
+ \t\t<BackgroundCard title="Panel 2" icon={CpuIcon} class="max-h-full">
284
+ \t\t\t<p class="text-muted-foreground text-sm">Placeholder content</p>
285
+ \t\t</BackgroundCard>
286
+ \t\t<BackgroundCard title="Panel 3" icon={GaugeIcon} class="max-h-full">
287
+ \t\t\t<p class="text-muted-foreground text-sm">Placeholder content</p>
288
+ \t\t</BackgroundCard>
289
+ \t\t<BackgroundCard title="Panel 4" icon={ThermometerIcon} class="max-h-full">
290
+ \t\t\t<p class="text-muted-foreground text-sm">Placeholder content</p>
291
+ \t\t</BackgroundCard>
292
+ \t</main>
273
293
  </div>
274
294
  `;
275
295
  writeFile(pagePath, demoContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archetypeai/ds-cli",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Archetype AI Design System CLI Tool",
5
5
  "type": "module",
6
6
  "bin": {