@archetypeai/ds-cli 0.9.1 → 0.10.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.
- package/README.md +3 -3
- package/commands/create.js +2 -2
- package/commands/init.js +2 -2
- package/files/AGENTS.md +128 -70
- package/files/CLAUDE.md +128 -70
- package/files/ds-manifest.json +998 -1024
- package/lib/add-ds-config-codeagent.js +3 -57
- package/package.json +2 -2
- package/files/LICENSE +0 -21
- package/files/rules/accessibility.md +0 -268
- package/files/rules/charts.md +0 -256
- package/files/rules/components.md +0 -251
- package/files/rules/design-principles.md +0 -71
- package/files/rules/frontend-architecture.md +0 -86
- package/files/rules/linting.md +0 -31
- package/files/rules/state.md +0 -373
- package/files/rules/styling.md +0 -142
- package/files/skills/apply-ds/SKILL.md +0 -121
- package/files/skills/apply-ds/scripts/audit.sh +0 -169
- package/files/skills/apply-ds/scripts/setup.sh +0 -153
- package/files/skills/build-component/SKILL.md +0 -153
- package/files/skills/create-dashboard/SKILL.md +0 -220
- package/files/skills/deploy-worker/SKILL.md +0 -231
- package/files/skills/deploy-worker/references/wrangler-commands.md +0 -327
- package/files/skills/fix-accessibility/SKILL.md +0 -232
- package/files/skills/fix-metadata/SKILL.md +0 -118
- package/files/skills/fix-metadata/assets/favicon.ico +0 -0
- package/files/skills/setup-chart/SKILL.md +0 -223
- package/files/skills/setup-chart/data/embedding.csv +0 -42
- package/files/skills/setup-chart/data/timeseries.csv +0 -173
- package/files/skills/setup-chart/references/scatter-chart.md +0 -229
- package/files/skills/setup-chart/references/sensor-chart.md +0 -156
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
# SensorChart Pattern Reference
|
|
2
|
-
|
|
3
|
-
Line charts for time series data, sensor readings, and streaming signals.
|
|
4
|
-
|
|
5
|
-
## Import
|
|
6
|
-
|
|
7
|
-
```svelte
|
|
8
|
-
import SensorChart from '@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart';
|
|
9
|
-
```
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
## Props
|
|
14
|
-
|
|
15
|
-
| Prop | Type | Default | Description |
|
|
16
|
-
| ----------- | -------------------------------------- | ------------------ | ------------------------------------------------- |
|
|
17
|
-
| `title` | string | `"UNKNOWN SENSOR"` | Card header label identifying the sensor |
|
|
18
|
-
| `icon` | Component | undefined | Lucide icon component for header |
|
|
19
|
-
| `data` | Array<Record<string, any>> | `[]` | Array of data points to chart |
|
|
20
|
-
| `signals` | Record<string, string> | `{}` | Map of data key to display label (defines series) |
|
|
21
|
-
| `xKey` | string | `"timestamp"` | Data key for x-axis values |
|
|
22
|
-
| `maxPoints` | number | undefined | Enables streaming mode with sliding window |
|
|
23
|
-
| `yMin` | number | **required** | Minimum y-axis value |
|
|
24
|
-
| `yMax` | number | **required** | Maximum y-axis value |
|
|
25
|
-
| `yTicks` | number[] | undefined | Explicit y-axis tick values |
|
|
26
|
-
| `axis` | `"both"` \| `"x"` \| `"y"` \| `"none"` | `"both"` | Which axes to display |
|
|
27
|
-
| `class` | string | undefined | Additional CSS classes |
|
|
28
|
-
|
|
29
|
-
## Key Behaviors
|
|
30
|
-
|
|
31
|
-
- **Static mode** (no `maxPoints`): Uses `scaleUtc()` for x-axis with timestamp-based positioning. X-axis shows MM:SS relative to first data point.
|
|
32
|
-
- **Streaming mode** (`maxPoints` set): Uses `scaleLinear()` with index-based x positioning (`_index`). Data window slides as new points arrive.
|
|
33
|
-
- **Series**: Derived from `signals` prop. Each entry maps a data key to a display label and auto-assigns theme colors (`--chart-1` through `--chart-5`).
|
|
34
|
-
- **Curve**: Uses `curveNatural` from d3-shape for smooth lines.
|
|
35
|
-
- **Chart type**: Uses `LineChart` from layerchart — NOT `AreaChart` (which renders with unwanted fill).
|
|
36
|
-
|
|
37
|
-
## Complete Example — Static Data
|
|
38
|
-
|
|
39
|
-
```svelte
|
|
40
|
-
<script>
|
|
41
|
-
import SensorChart from '@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart';
|
|
42
|
-
import AudioWaveformIcon from '@lucide/svelte/icons/audio-waveform';
|
|
43
|
-
import timeseriesCsv from '$lib/data/timeseries.csv?raw';
|
|
44
|
-
|
|
45
|
-
function parseCsv(csvText) {
|
|
46
|
-
const lines = csvText
|
|
47
|
-
.trim()
|
|
48
|
-
.split('\n')
|
|
49
|
-
.filter((line) => line.trim());
|
|
50
|
-
if (lines.length === 0) return [];
|
|
51
|
-
const headers = lines[0].split(',').map((h) => h.trim());
|
|
52
|
-
return lines.slice(1).map((line) => {
|
|
53
|
-
const values = line.split(',');
|
|
54
|
-
const row = {};
|
|
55
|
-
headers.forEach((header, index) => {
|
|
56
|
-
row[header] = values[index]?.trim() || '';
|
|
57
|
-
});
|
|
58
|
-
return row;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const rawRows = parseCsv(timeseriesCsv);
|
|
63
|
-
const data = rawRows.map((row) => ({
|
|
64
|
-
timestamp: new Date(row.timestamp),
|
|
65
|
-
accel_x: parseFloat(row.accel_x),
|
|
66
|
-
accel_y: parseFloat(row.accel_y),
|
|
67
|
-
accel_z: parseFloat(row.accel_z)
|
|
68
|
-
}));
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
<SensorChart
|
|
72
|
-
title="ACCELERATION SENSOR"
|
|
73
|
-
icon={AudioWaveformIcon}
|
|
74
|
-
{data}
|
|
75
|
-
signals={{ accel_x: 'Accel X', accel_y: 'Accel Y', accel_z: 'Accel Z' }}
|
|
76
|
-
yMin={-30}
|
|
77
|
-
yMax={30}
|
|
78
|
-
yTicks={[-30, -15, 0, 15, 30]}
|
|
79
|
-
/>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Complete Example — Streaming Data
|
|
83
|
-
|
|
84
|
-
For real-time data with a sliding window, use the `maxPoints` prop and feed data incrementally:
|
|
85
|
-
|
|
86
|
-
```svelte
|
|
87
|
-
<script>
|
|
88
|
-
import { onMount, onDestroy } from 'svelte';
|
|
89
|
-
import SensorChart from '@archetypeai/ds-ui-svelte-labs/primitives/sensor-chart';
|
|
90
|
-
import ThermometerIcon from '@lucide/svelte/icons/thermometer';
|
|
91
|
-
|
|
92
|
-
let streamingData = $state([]);
|
|
93
|
-
let interval;
|
|
94
|
-
|
|
95
|
-
onMount(() => {
|
|
96
|
-
interval = setInterval(() => {
|
|
97
|
-
streamingData = [
|
|
98
|
-
...streamingData,
|
|
99
|
-
{
|
|
100
|
-
timestamp: new Date(),
|
|
101
|
-
gyro_x: (Math.random() - 0.5) * 4
|
|
102
|
-
}
|
|
103
|
-
];
|
|
104
|
-
}, 120);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
onDestroy(() => clearInterval(interval));
|
|
108
|
-
</script>
|
|
109
|
-
|
|
110
|
-
<SensorChart
|
|
111
|
-
title="GYROSCOPE SENSOR"
|
|
112
|
-
icon={ThermometerIcon}
|
|
113
|
-
data={streamingData}
|
|
114
|
-
signals={{ gyro_x: 'Gyro X' }}
|
|
115
|
-
maxPoints={50}
|
|
116
|
-
yMin={-2}
|
|
117
|
-
yMax={2}
|
|
118
|
-
yTicks={[-2, -1, 0, 1, 2]}
|
|
119
|
-
axis="y"
|
|
120
|
-
/>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Building Inline (custom variant)
|
|
124
|
-
|
|
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
|
-
|
|
127
|
-
```svelte
|
|
128
|
-
<script>
|
|
129
|
-
import * as Chart from '@archetypeai/ds-ui-svelte-labs/primitives/chart';
|
|
130
|
-
import { LineChart } from 'layerchart';
|
|
131
|
-
import { scaleUtc, scaleLinear } from 'd3-scale';
|
|
132
|
-
import { curveNatural } from 'd3-shape';
|
|
133
|
-
|
|
134
|
-
let { data } = $props();
|
|
135
|
-
|
|
136
|
-
const chartConfig = {
|
|
137
|
-
value: { label: 'Value', color: 'var(--chart-1)' }
|
|
138
|
-
};
|
|
139
|
-
</script>
|
|
140
|
-
|
|
141
|
-
<Chart.Container config={chartConfig} class="h-[220px] w-full">
|
|
142
|
-
<LineChart
|
|
143
|
-
{data}
|
|
144
|
-
x="timestamp"
|
|
145
|
-
xScale={scaleUtc()}
|
|
146
|
-
yScale={scaleLinear()}
|
|
147
|
-
series={[{ key: 'value', color: 'var(--chart-1)' }]}
|
|
148
|
-
tooltip={false}
|
|
149
|
-
props={{
|
|
150
|
-
spline: { curve: curveNatural, strokeWidth: 1.5 },
|
|
151
|
-
grid: { y: true, x: false },
|
|
152
|
-
highlight: { lines: false, points: false }
|
|
153
|
-
}}
|
|
154
|
-
/>
|
|
155
|
-
</Chart.Container>
|
|
156
|
-
```
|