@archetypeai/ds-cli 0.7.8 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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/primitives/chart/index.js';
24
+ import * as Chart from '@archetypeai/ds-ui-svelte-labs/primitives/chart';
25
25
 
26
26
  const chartConfig = {
27
27
  temperature: { label: 'Temperature', color: 'var(--chart-1)' },
@@ -253,4 +253,4 @@ Manual legend below chart:
253
253
  {/if}
254
254
  ```
255
255
 
256
- For a complete chart pattern example, see the `sensor-chart` pattern source in `$lib/components/ui/patterns/sensor-chart/`.
256
+ For a complete chart example, see the `sensor-chart` component (import from `@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart`; editable source at https://design-system-labs.archetypeai.workers.dev/r/sensor-chart.json).
@@ -2,8 +2,7 @@
2
2
  paths:
3
3
  - '**/components/**/*.svelte'
4
4
  - '$lib/**/*.svelte'
5
- - '**/primitives/**/*.svelte'
6
- - '**/patterns/**/*.svelte'
5
+ - '**/custom/**/*.svelte'
7
6
  ---
8
7
 
9
8
  # Component Authoring Rules
@@ -75,7 +74,7 @@ When wrapping bits-ui primitives, import the primitive and wrap it:
75
74
  </SelectPrimitive.Trigger>
76
75
  ```
77
76
 
78
- For the full primitives catalog with import paths, see `@skills/build-pattern`.
77
+ For the full component catalog with import paths, read `ds-manifest.json` at the project root (see `@skills/build-component`).
79
78
 
80
79
  ## tailwind-variants (tv)
81
80
 
@@ -21,26 +21,25 @@ Common extraction candidates: media inputs, status displays, result/summary view
21
21
 
22
22
  ## Gold-standard references
23
23
 
24
- The project includes pattern components that demonstrate these conventions. Study them before building new ones:
24
+ The labs package ships composite components that demonstrate these conventions. Study their source (registry URLs in `ds-manifest.json`) before building new ones:
25
25
 
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
26
+ - `video-player` (labs) — media playback with controls, composes console Card + Button with labs AspectRatio + Slider
27
+ - `menubar` (labs) branded header with snippet slots, composes console Button + the theme `darkMode` store
28
+ - `sensor-chart` / `scatter-chart` (labs) chart cards with typed data/axis config
31
29
 
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.
30
+ Check `ds-manifest.json` for an existing component that fits before building a new one. Use `@skills/build-component` to create new components that follow these same conventions.
33
31
 
34
32
  ## Directory structure
35
33
 
34
+ Components come from the npm packages by default — most projects need no local copies at all.
35
+
36
36
  ```
37
37
  $lib/components/ui/
38
- primitives/ DS registry primitives (Card, Badge, Button, etc.)
39
- patterns/ DS registry patterns (BackgroundCard, FlatLogItem, etc.)
40
- custom/ — Project-specific components not from the registry
38
+ custom/ project-specific components composed from the packages
39
+ <name>/ — registry-installed editable source (only for deliberately modified components)
41
40
  ```
42
41
 
43
- Place custom components (ones you create for this project that are not installed from the registry) in `$lib/components/ui/custom/`. Never put custom components directly in `ui/` next to `primitives/` and `patterns/`.
42
+ Place custom components (ones you create for this project) in `$lib/components/ui/custom/`. Never edit anything in `node_modules`, and never put custom components next to registry-installed source.
44
43
 
45
44
  ## Component conventions
46
45
 
@@ -50,7 +49,7 @@ Follow `@rules/components` for the full conventions. The essentials:
50
49
  - `cn()` for all class merging — never raw string concatenation
51
50
  - `$derived` for computed state
52
51
  - Spread `...restProps` on the root element
53
- - Compose from DS primitives (Card, Badge, Button, etc.) — not raw HTML
52
+ - Compose from DS package components (Card, Badge, Button, etc.) — not raw HTML
54
53
 
55
54
  ## Page-level orchestration
56
55
 
@@ -80,7 +79,7 @@ For skills that stream results (SSE, polling), prefer:
80
79
 
81
80
  - Progressive rendering — show results as they arrive, don't wait for completion
82
81
  - Live counters or progress indicators
83
- - Auto-scrolling log views (reference ExpandableLog pattern)
82
+ - Auto-scrolling log views
84
83
 
85
84
  ## Override clause
86
85
 
@@ -82,23 +82,15 @@ For class merging with `cn()`, see `@rules/components`.
82
82
  In your global CSS file:
83
83
 
84
84
  ```css
85
+ @import 'tailwindcss';
86
+ @import 'tw-animate-css';
85
87
  @import '@archetypeai/ds-lib-tokens/fonts.css';
86
88
  @import '@archetypeai/ds-lib-tokens/theme.css';
87
- @import 'tailwindcss';
88
- @import 'tw-animate-css'; /* optional, for animations */
89
+ @source '../../node_modules/@archetypeai/ds-ui-svelte-console/dist';
90
+ @source '../../node_modules/@archetypeai/ds-ui-svelte-labs/dist';
89
91
  ```
90
92
 
91
- Order matters - tokens must come before Tailwind.
92
-
93
- ### Hide Scrollbars
94
-
95
- Always add this rule to the root layout CSS (`src/app.css` or `src/routes/layout.css`) to hide visible scrollbars in ScrollArea components:
96
-
97
- ```css
98
- [data-slot='scroll-area-scrollbar'] {
99
- display: none !important;
100
- }
101
- ```
93
+ Order matters `tailwindcss` first, then the tokens theme, then the package `@source` directives (they make Tailwind emit classes used inside the package dists).
102
94
 
103
95
  ## Tailwind v4 Specifics
104
96
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: apply-ds
3
- description: Apply DS tokens, components, and patterns to an existing demo initialized with ds-cli init.
3
+ description: Apply DS tokens and components to an existing demo initialized with ds-cli init.
4
4
  allowed-tools: Read, Edit, Grep, Bash
5
5
  ---
6
6
 
7
7
  # Applying the Design System to a Demo
8
8
 
9
- This skill assumes `npx @archetypeai/ds-cli init` has already been run. The project has tokens, Tailwind v4, shadcn-svelte, and DS components installed. The goal is to migrate the demo's existing UI to use DS primitives and semantic tokens.
9
+ This skill assumes `npx @archetypeai/ds-cli init` has already been run. The project has tokens, Tailwind v4, and both design system packages (`@archetypeai/ds-ui-svelte-console`, `@archetypeai/ds-ui-svelte-labs`) installed. The goal is to migrate the demo's existing UI to use DS components and semantic tokens. Read `ds-manifest.json` at the project root for the full component catalog.
10
10
 
11
11
  ## Steps
12
12
 
@@ -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/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` |
71
+ | `<button>` | `<Button>` | `@archetypeai/ds-ui-svelte-console/primitives/button` |
72
+ | `<input>` | `<Input>` | `@archetypeai/ds-ui-svelte-console/primitives/input` |
73
+ | `<textarea>` | `<Textarea>` | `@archetypeai/ds-ui-svelte-console/primitives/textarea` |
74
+ | `<select>` | `<Select.Root>` + `<Select.Trigger>` + `<Select.Content>` + `<Select.Item>` | `@archetypeai/ds-ui-svelte-console/primitives/select` |
75
+ | `<table>` | `<Table.Root>` + `<Table.Header>` + `<Table.Row>` + `<Table.Head>` + `<Table.Body>` + `<Table.Cell>` | `@archetypeai/ds-ui-svelte-console/primitives/table` |
76
+ | `<dialog>` | `<Dialog.Root>` + `<Dialog.Content>` + `<Dialog.Header>` + `<Dialog.Title>` | `@archetypeai/ds-ui-svelte-console/primitives/dialog` |
77
+ | `<hr>` | `<Separator>` | `@archetypeai/ds-ui-svelte-console/primitives/separator` |
78
+ | `<label>` | `<Label>` | `@archetypeai/ds-ui-svelte-console/primitives/label` |
79
+ | `<a>` (styled as button) | `<Button variant="link">` or `<Button>` with `href` | `@archetypeai/ds-ui-svelte-console/primitives/button` |
80
80
 
81
81
  For each replacement:
82
82
 
@@ -92,11 +92,11 @@ Identify structural opportunities to use DS composition patterns:
92
92
  - **Cards** — wrap content sections in `<Card.Root>` / `<Card.Header>` / `<Card.Content>` instead of raw `<div>` with border/shadow classes
93
93
  - **Separators** — replace `<hr>` or border-bottom hacks with `<Separator>`
94
94
  - **Badges** — replace styled `<span>` status indicators with `<Badge>`
95
- - **Skeleton** — replace loading placeholders with `<Skeleton>`
96
- - **Scroll Area** — replace overflow containers with `<ScrollArea>`
95
+ - **Spinners** — replace loading placeholders with `<Spinner>`
96
+ - **Empty states** — replace ad-hoc "no data" markup with `<EmptyState>`
97
97
  - **Tooltips** — replace `title` attributes with `<Tooltip.Root>` / `<Tooltip.Trigger>` / `<Tooltip.Content>`
98
98
 
99
- Import primitives from `$lib/components/ui/primitives/` and patterns from `$lib/components/ui/patterns/` as needed.
99
+ Import console components from `@archetypeai/ds-ui-svelte-console/primitives/<name>` and labs components (menubar, charts, slider, switch, ...) from `@archetypeai/ds-ui-svelte-labs/primitives/<name>` see `ds-manifest.json` for the catalog.
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/primitives/` or `$lib/components/ui/patterns/`
117
+ - [ ] Component imports resolve to the design system packages (`@archetypeai/ds-ui-svelte-console`, `@archetypeai/ds-ui-svelte-labs`) or `$lib/components/ui/` only for deliberately modified registry source
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`
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: build-component
3
+ description: Creates composite UI components by assembling design system package primitives. Use when building reusable components that combine multiple primitives (Card, Button, Input, etc.), creating dashboard widgets, form groups, sensor cards, data displays, or any complex component from existing design system components. Also use when the user asks to create a "component", "widget", or "pattern" that should follow design system conventions.
4
+ ---
5
+
6
+ # Building Components
7
+
8
+ Custom components are composed from the design system packages and live in
9
+ `$lib/components/ui/custom/` — never next to registry-installed source and never
10
+ inside `node_modules`.
11
+
12
+ ## Decision: compose vs extend vs modify
13
+
14
+ **Before building, read `ds-manifest.json` at the project root.** It lists every
15
+ component in both tiers (console = stable base, labs = experimental) with import
16
+ subpaths, variant axes, and registry source URLs. If an existing component
17
+ covers the use case — even partially — use it rather than creating a new one.
18
+
19
+ **Compose a custom component when:**
20
+
21
+ - Combining 3+ package components into a reusable unit
22
+ - The combination will be used in multiple places
23
+ - The component has its own props/state logic
24
+
25
+ **Use variants instead when:**
26
+
27
+ - The design space is already covered by a component's variant axes (check the
28
+ manifest's `variants` entry before adding wrappers)
29
+
30
+ **Modify via the registry only when:**
31
+
32
+ - A component's internals must diverge from the package. Install its editable
33
+ source (`npx shadcn-svelte@latest add <source URL from ds-manifest.json>`) and
34
+ import the copy from `$lib/components/ui/`.
35
+
36
+ ## Component Structure
37
+
38
+ ```svelte
39
+ <script>
40
+ import { cn } from '$lib/utils.js';
41
+ import * as Card from '@archetypeai/ds-ui-svelte-console/primitives/card';
42
+ import { Button } from '@archetypeai/ds-ui-svelte-console/primitives/button';
43
+
44
+ let { title, class: className, children, ...restProps } = $props();
45
+ </script>
46
+
47
+ <Card.Root class={cn('p-4', className)} {...restProps}>
48
+ <Card.Header>
49
+ <Card.Title>{title}</Card.Title>
50
+ </Card.Header>
51
+ <Card.Content>
52
+ {@render children?.()}
53
+ </Card.Content>
54
+ </Card.Root>
55
+ ```
56
+
57
+ ## Key Conventions
58
+
59
+ ### Props Pattern
60
+
61
+ Always use this structure:
62
+
63
+ ```javascript
64
+ let {
65
+ ref = $bindable(null), // optional DOM reference
66
+ class: className, // rename to avoid reserved word
67
+ children, // snippet for slot content
68
+ ...restProps // pass-through attributes
69
+ } = $props();
70
+ ```
71
+
72
+ ### Class Merging
73
+
74
+ Always use `cn()` for classes:
75
+
76
+ ```svelte
77
+ <div class={cn('bg-card p-4', className)}>
78
+ ```
79
+
80
+ Never concatenate strings directly.
81
+
82
+ ### Spreading restProps
83
+
84
+ Always spread on the root element:
85
+
86
+ ```svelte
87
+ <Card.Root class={cn('p-4', className)} {...restProps}>
88
+ ```
89
+
90
+ This ensures aria attributes, data attributes, and event handlers pass through.
91
+
92
+ ### Rendering Children
93
+
94
+ Use `{@render}` for slot content:
95
+
96
+ ```svelte
97
+ {@render children?.()}
98
+ ```
99
+
100
+ ## Available Components
101
+
102
+ Do not rely on a memorized catalog — read `ds-manifest.json` for the current
103
+ component list. The shape per tier:
104
+
105
+ - **console** (`@archetypeai/ds-ui-svelte-console/primitives/<name>`): stable
106
+ base primitives — alert, badge, button, card, checkbox, codeblock,
107
+ collapsible, dialog, dropdown-menu, dropzone, empty-state, input, input-group,
108
+ item, label, progress, select, separator, sonner, spinner, table, tabs, theme,
109
+ textarea, tooltip
110
+ - **labs** (`@archetypeai/ds-ui-svelte-labs/primitives/<name>`): experimental
111
+ components — aspect-ratio, chart, kbd, logo, menubar, scatter-chart,
112
+ sensor-chart, slider, switch, toggle, video-player
113
+
114
+ The manifest is generated from the registries; trust it over this list if they
115
+ disagree. Variant values flagged `consoleProductOnly` (e.g. `runSession`,
116
+ `topNav*`) must not be used outside the console product.
117
+
118
+ ## Example: Sensor Card Component
119
+
120
+ ```svelte
121
+ <script>
122
+ import { cn } from '$lib/utils.js';
123
+ import * as Card from '@archetypeai/ds-ui-svelte-console/primitives/card';
124
+ import * as Chart from '@archetypeai/ds-ui-svelte-labs/primitives/chart';
125
+
126
+ let { title = 'Sensor', icon: Icon, data = [], class: className, ...restProps } = $props();
127
+ </script>
128
+
129
+ <Card.Root class={cn('p-4', className)} {...restProps}>
130
+ <Card.Header class="flex flex-row items-center justify-between p-0">
131
+ <Card.Title class="text-foreground font-mono text-base uppercase">
132
+ {title}
133
+ </Card.Title>
134
+ {#if Icon}
135
+ <Icon class="text-muted-foreground size-6" aria-hidden="true" />
136
+ {/if}
137
+ </Card.Header>
138
+ <Card.Content class="p-0">
139
+ <Chart.Container config={{}} class="h-[220px] w-full">
140
+ <!-- chart content -->
141
+ </Chart.Container>
142
+ </Card.Content>
143
+ </Card.Root>
144
+ ```
145
+
146
+ ## Detailed Conventions
147
+
148
+ See `@rules/components.md` for:
149
+
150
+ - bits-ui wrapper patterns
151
+ - tailwind-variants (tv) usage
152
+ - Conditional rendering patterns
153
+ - Icon handling
@@ -13,9 +13,9 @@ 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/primitives/` and `$lib/components/ui/patterns/` to discover available primitives and patterns (each in a kebab-case subdirectory with `index.js`)
17
- 2. Only use components that actually exist in the project
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`)
16
+ 1. Read `ds-manifest.json` at the project root it lists every component in both packages (console + labs) with import subpaths and variant axes
17
+ 2. Components come from the npm packages (`@archetypeai/ds-ui-svelte-console`, `@archetypeai/ds-ui-svelte-labs`); also check `$lib/components/ui/` for registry-installed (modified) copies and prefer those when present
18
+ 3. If a required component does not exist in either tier, build it via `@skills/build-component`
19
19
  4. **Never inline raw markup as a substitute for a missing component**
20
20
 
21
21
  The dashboard requires at minimum: `Menubar`, `Button`. For card-based layouts: `Card`.
@@ -38,14 +38,14 @@ Unless the user explicitly asks for a different layout:
38
38
 
39
39
  ## Menubar
40
40
 
41
- Use the `Menubar` pattern. It renders a branded `<header>` with the Archetype AI Logo on the left and a partner logo placeholder. Pass action content as children. The Menubar includes a built-in dark mode toggle on the far right that detects system preference and defaults to dark. To disable it, pass `darkToggle={false}`.
41
+ Use the labs `Menubar` component. It renders a branded `<header>` with the Archetype AI Logo on the left. Pass action content as children. The Menubar includes a built-in dark mode toggle on the far right that toggles the host app's dark class (via the console `darkMode` store). To disable it, pass `darkToggle={false}`.
42
42
 
43
43
  **Every dashboard Menubar must include a "Send Report" button.** Additional actions can be appended alongside it.
44
44
 
45
45
  ```svelte
46
46
  <script>
47
- import Menubar from '$lib/components/ui/patterns/menubar/index.js';
48
- import { Button } from '$lib/components/ui/primitives/button/index.js';
47
+ import Menubar from '@archetypeai/ds-ui-svelte-labs/primitives/menubar';
48
+ import { Button } from '@archetypeai/ds-ui-svelte-console/primitives/button';
49
49
  </script>
50
50
 
51
51
  <Menubar>
@@ -54,7 +54,7 @@ Use the `Menubar` pattern. It renders a branded `<header>` with the Archetype AI
54
54
  </Menubar>
55
55
  ```
56
56
 
57
- For co-branding, pass a `partnerLogo` snippet to replace the default placeholder:
57
+ For co-branding, pass a `partnerLogo` snippet to add a separator and partner logo beside the Archetype AI Logo:
58
58
 
59
59
  ```svelte
60
60
  <Menubar>
@@ -68,8 +68,8 @@ For co-branding, pass a `partnerLogo` snippet to replace the default placeholder
68
68
 
69
69
  ## Preservation Rules
70
70
 
71
- - **Never rewrite or replace** the Menubar component file in `$lib/components/ui/`
72
- - **Never modify installed primitives/patterns** in `$lib/components/ui/` those are design system files
71
+ - **Never edit design system files in `node_modules`** compose and override via props/`class`
72
+ - **Never rewrite or replace** registry-installed component source in `$lib/components/ui/` unless the user asked you to modify that component
73
73
  - When a Menubar already has children (buttons, actions), **append** new actions alongside existing ones — do not replace them
74
74
  - When a page already has content, **integrate alongside** existing markup — do not overwrite the file
75
75
 
@@ -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/patterns/menubar/index.js';
81
- import { Button } from '$lib/components/ui/primitives/button/index.js';
80
+ import Menubar from '@archetypeai/ds-ui-svelte-labs/primitives/menubar';
81
+ import { Button } from '@archetypeai/ds-ui-svelte-console/primitives/button';
82
82
  </script>
83
83
 
84
84
  <div class="bg-background grid h-screen w-screen grid-rows-[auto_1fr] overflow-hidden">
@@ -169,9 +169,9 @@ The `flex-1` on the last left-column card makes it grow to fill remaining vertic
169
169
  ```svelte
170
170
  <!-- src/routes/+page.svelte -->
171
171
  <script>
172
- import Menubar from '$lib/components/ui/patterns/menubar/index.js';
173
- import { Button } from '$lib/components/ui/primitives/button/index.js';
174
- import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/primitives/card/index.js';
172
+ import Menubar from '@archetypeai/ds-ui-svelte-labs/primitives/menubar';
173
+ import { Button } from '@archetypeai/ds-ui-svelte-console/primitives/button';
174
+ import { Card, CardHeader, CardTitle, CardContent } from '@archetypeai/ds-ui-svelte-console/primitives/card';
175
175
  </script>
176
176
 
177
177
  <div
@@ -202,12 +202,12 @@ The `flex-1` on the last left-column card makes it grow to fill remaining vertic
202
202
  </div>
203
203
  ```
204
204
 
205
- ## Populating Panels with Pattern Components
205
+ ## Populating Panels
206
206
 
207
- Panels should contain pattern components, not raw markup. Before building new components:
207
+ Panels should contain components, not raw markup. Before building new components:
208
208
 
209
- 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.
210
- 2. If no existing pattern fits, create one via `@skills/build-pattern`
209
+ 1. Read `ds-manifest.json` to discover available components in both tiers. Each has a `description` summarizing its purpose. If one fits, use it.
210
+ 2. If no existing component fits, create one via `@skills/build-component`
211
211
  3. Each panel should contain one primary component with clear props for data flow
212
212
 
213
213
  This keeps dashboards composable and consistent with the design system.
@@ -7,25 +7,23 @@ description: Sets up data visualizations using layerchart and the Chart primitiv
7
7
 
8
8
  Build charts using layerchart wrapped in the Chart.Container primitive.
9
9
 
10
- ## Discovering Components
10
+ ## Where Charts Come From
11
11
 
12
- Before building, check which components are installed in the project already:
12
+ The chart components live in the labs package — import them, do not create chart files by hand:
13
13
 
14
- 1. List `$lib/components/ui/primitives/` and `$lib/components/ui/patterns/` to discover available primitives and patterns
15
- 2. Only use components that actually exist in the project
16
- 3. Charts require at minimum: `chart`. For card-wrapped charts: `card`, `chart`
17
-
18
- ## Chart Primitive Installation
19
-
20
- The `chart` primitive is a multi-file package (chart-container, chart-style, chart-tooltip, scatter-tooltip, chart-utils, index). These files use relative imports between each other (e.g., `./chart-utils.js`).
14
+ ```svelte
15
+ <script>
16
+ import * as Chart from '@archetypeai/ds-ui-svelte-labs/primitives/chart';
17
+ import ScatterChart from '@archetypeai/ds-ui-svelte-labs/primitives/scatter-chart';
18
+ import SensorChart from '@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart';
19
+ </script>
20
+ ```
21
21
 
22
- **NEVER manually create chart primitive files.** Always install via the registry:
22
+ `ds-manifest.json` at the project root lists the full catalog (both tiers) with import subpaths. For card-wrapped charts compose with `@archetypeai/ds-ui-svelte-console/primitives/card`.
23
23
 
24
- ```bash
25
- npx shadcn-svelte@latest add --registry https://design-system.archetypeai.workers.dev/r chart
26
- ```
24
+ Only if a chart must diverge from the package, install its editable source via the registry (URL in the manifest), e.g. `npx shadcn-svelte@latest add https://design-system-labs.archetypeai.workers.dev/r/chart.json`. **NEVER manually create chart primitive files** — the multi-file chart source uses relative imports that break when files are hand-written.
27
25
 
28
- If you create individual files by hand, relative imports will break and the chart will fail to render.
26
+ `layerchart` is installed at an exact pinned prerelease; newer prereleases break the chart components. Never loosen the pin.
29
27
 
30
28
  ## Choosing a Chart Type
31
29
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Scatter plots for cluster visualizations, embedding data, and 2D point clouds.
4
4
 
5
- ## Installation
5
+ ## Import
6
6
 
7
- ```bash
8
- npx shadcn-svelte@latest add --registry https://design-system.archetypeai.workers.dev/r scatter-chart
7
+ ```svelte
8
+ import ScatterChart from '@archetypeai/ds-ui-svelte-labs/primitives/scatter-chart';
9
9
  ```
10
10
 
11
- This installs `ScatterChart.svelte` and its dependencies (`card`, `chart`, `utils`, `layerchart`, `d3-scale`).
11
+ No install needed — the labs package ships it. Only to modify the component, pull its editable source instead: `npx shadcn-svelte@latest add https://design-system-labs.archetypeai.workers.dev/r/scatter-chart.json` (also installs its chart/utils source dependencies).
12
12
 
13
13
  ## Props
14
14
 
@@ -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/patterns/scatter-chart/index.js';
78
+ import ScatterChart from '@archetypeai/ds-ui-svelte-labs/primitives/scatter-chart';
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/patterns/scatter-chart/index.js';
138
+ import ScatterChart from '@archetypeai/ds-ui-svelte-labs/primitives/scatter-chart';
139
139
  import ScatterChartIcon from '@lucide/svelte/icons/scatter-chart';
140
140
 
141
141
  let streamData = $state([]);
@@ -179,13 +179,13 @@ The `embedding.csv` contains dimensionality-reduced coordinates. To prepare it f
179
179
  />
180
180
  ```
181
181
 
182
- ## Building Inline (Without Pattern)
182
+ ## Building Inline (custom variant)
183
183
 
184
- If the `scatter-chart` pattern is not installed, use `card` + `chart` primitives with `ScatterChart` from layerchart:
184
+ If `scatter-chart` doesn't fit and a custom chart is required, compose the console `card` and labs `chart` components with `ScatterChart` from layerchart:
185
185
 
186
186
  ```svelte
187
187
  <script>
188
- import * as Chart from '$lib/components/ui/primitives/chart/index.js';
188
+ import * as Chart from '@archetypeai/ds-ui-svelte-labs/primitives/chart';
189
189
  import { ScatterChart } from 'layerchart';
190
190
  import { scaleLinear } from 'd3-scale';
191
191
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Line charts for time series data, sensor readings, and streaming signals.
4
4
 
5
- ## Installation
5
+ ## Import
6
6
 
7
- ```bash
8
- npx shadcn-svelte@latest add --registry https://design-system.archetypeai.workers.dev/r sensor-chart
7
+ ```svelte
8
+ import SensorChart from '@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart';
9
9
  ```
10
10
 
11
- This installs `SensorChart.svelte` and its dependencies (`card`, `chart`, `utils`, `layerchart`, `d3-scale`, `d3-shape`).
11
+ No install needed — the labs package ships it. Only to modify the component, pull its editable source instead: `npx shadcn-svelte@latest add https://design-system-labs.archetypeai.workers.dev/r/sensor-chart.json` (also installs its chart/utils source dependencies).
12
12
 
13
13
  ## Props
14
14
 
@@ -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/patterns/sensor-chart/index.js';
41
+ import SensorChart from '@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart';
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/patterns/sensor-chart/index.js';
89
+ import SensorChart from '@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart';
90
90
  import ThermometerIcon from '@lucide/svelte/icons/thermometer';
91
91
 
92
92
  let streamingData = $state([]);
@@ -120,13 +120,13 @@ For real-time data with a sliding window, use the `maxPoints` prop and feed data
120
120
  />
121
121
  ```
122
122
 
123
- ## Building Inline (Without Pattern)
123
+ ## Building Inline (custom variant)
124
124
 
125
- If the `sensor-chart` pattern is not installed, build the equivalent using `card` + `chart` primitives with `LineChart` from layerchart:
125
+ If `sensor-chart` doesn't fit and a custom chart is required, compose the console `card` and labs `chart` components with `LineChart` from layerchart:
126
126
 
127
127
  ```svelte
128
128
  <script>
129
- import * as Chart from '$lib/components/ui/primitives/chart/index.js';
129
+ import * as Chart from '@archetypeai/ds-ui-svelte-labs/primitives/chart';
130
130
  import { LineChart } from 'layerchart';
131
131
  import { scaleUtc, scaleLinear } from 'd3-scale';
132
132
  import { curveNatural } from 'd3-shape';
@@ -48,8 +48,9 @@ function copyFile(src, dest) {
48
48
  export function setupCursor(projectDir) {
49
49
  p.log.step('Setting up for Cursor IDE');
50
50
 
51
- // copy AGENTS.md to root
51
+ // copy AGENTS.md + machine-readable component manifest to root
52
52
  copyFile(join(FILES_DIR, 'AGENTS.md'), join(projectDir, 'AGENTS.md'));
53
+ copyFile(join(FILES_DIR, 'ds-manifest.json'), join(projectDir, 'ds-manifest.json'));
53
54
 
54
55
  // copy skills to .cursor/skills/
55
56
  const skillsSrc = join(FILES_DIR, 'skills');
@@ -73,8 +74,9 @@ export function setupCursor(projectDir) {
73
74
  export function setupClaude(projectDir) {
74
75
  p.log.step('Setting up for Claude Code');
75
76
 
76
- // copy CLAUDE.md to root
77
+ // copy CLAUDE.md + machine-readable component manifest to root
77
78
  copyFile(join(FILES_DIR, 'CLAUDE.md'), join(projectDir, 'CLAUDE.md'));
79
+ copyFile(join(FILES_DIR, 'ds-manifest.json'), join(projectDir, 'ds-manifest.json'));
78
80
 
79
81
  // copy skills to .claude/skills/
80
82
  const skillsSrc = join(FILES_DIR, 'skills');