@archetypeai/ds-cli 0.3.7
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/LICENSE +21 -0
- package/README.md +123 -0
- package/bin.js +77 -0
- package/commands/add.js +42 -0
- package/commands/create.js +238 -0
- package/commands/init.js +199 -0
- package/files/AGENTS.md +63 -0
- package/files/CLAUDE.md +63 -0
- package/files/LICENSE +21 -0
- package/files/rules/accessibility.md +219 -0
- package/files/rules/charts.md +352 -0
- package/files/rules/components.md +267 -0
- package/files/rules/design-principles.md +56 -0
- package/files/rules/linting.md +31 -0
- package/files/rules/state.md +405 -0
- package/files/rules/styling.md +245 -0
- package/files/skills/apply-ds/SKILL.md +117 -0
- package/files/skills/apply-ds/scripts/setup.sh +271 -0
- package/files/skills/build-pattern/SKILL.md +202 -0
- package/files/skills/create-dashboard/SKILL.md +189 -0
- package/files/skills/deploy-worker/SKILL.md +231 -0
- package/files/skills/deploy-worker/references/wrangler-commands.md +327 -0
- package/files/skills/fix-accessibility/SKILL.md +184 -0
- package/files/skills/fix-metadata/SKILL.md +118 -0
- package/files/skills/fix-metadata/assets/favicon.ico +0 -0
- package/files/skills/setup-chart/SKILL.md +225 -0
- package/files/skills/setup-chart/data/embedding.csv +42 -0
- package/files/skills/setup-chart/data/timeseries.csv +173 -0
- package/files/skills/setup-chart/references/scatter-chart.md +229 -0
- package/files/skills/setup-chart/references/sensor-chart.md +156 -0
- package/lib/add-ds-config-codeagent.js +154 -0
- package/lib/add-ds-ui-svelte.js +93 -0
- package/lib/scaffold-ds-svelte-project.js +272 -0
- package/lib/use-package-manager.js +65 -0
- package/lib/use-shadcn-svelte-registry.js +26 -0
- package/lib/validate-url.js +31 -0
- package/package.json +34 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-dashboard
|
|
3
|
+
description: Scaffolds a full-viewport dashboard layout with no scrolling, a branded menubar with the Archetype AI logo, and panel-based content areas. Use when creating a dashboard UI, building a full-screen layout, setting up a monitoring view, creating a control panel, or when the user asks for a "dashboard", "full-screen layout", "no-scroll UI", or "panel layout".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating a Dashboard
|
|
7
|
+
|
|
8
|
+
Scaffold a full-viewport dashboard with a branded menubar and panel-based content.
|
|
9
|
+
|
|
10
|
+
## Discovering Components
|
|
11
|
+
|
|
12
|
+
Before building, check which components are installed in the project:
|
|
13
|
+
|
|
14
|
+
1. List `$lib/components/ui/` to discover available primitives (subdirectories with `index.js`) and patterns (PascalCase `.svelte` files)
|
|
15
|
+
2. Only use components that actually exist in the project
|
|
16
|
+
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`)
|
|
17
|
+
4. **Never inline raw markup as a substitute for a missing component**
|
|
18
|
+
|
|
19
|
+
The dashboard requires at minimum: `Menubar`, `Button`. For card-based layouts: `Card`.
|
|
20
|
+
|
|
21
|
+
## Layout Requirements
|
|
22
|
+
|
|
23
|
+
Dashboards fill the entire viewport with no scrolling:
|
|
24
|
+
|
|
25
|
+
- `h-screen w-screen` — full viewport dimensions
|
|
26
|
+
- `overflow-hidden` — prevent any scrolling
|
|
27
|
+
- Grid layout: `grid grid-rows-[auto_1fr]` so the Menubar takes its natural height and content fills the rest
|
|
28
|
+
|
|
29
|
+
## Card Grid Defaults
|
|
30
|
+
|
|
31
|
+
Unless the user explicitly asks for a different layout:
|
|
32
|
+
|
|
33
|
+
- **Equal-width columns** — use `grid-cols-2`, `grid-cols-3`, etc. Never mix fixed and fluid widths for card grids (e.g., don't use `grid-cols-[300px_1fr]` for cards — that's for sidebar layouts only)
|
|
34
|
+
- **Equal-height cards** — CSS grid rows distribute height evenly. Add `max-h-full` to each Card so content stays constrained to its grid cell
|
|
35
|
+
- **Consistent spacing** — always use `gap-4` between cards and `p-4` padding around the grid
|
|
36
|
+
|
|
37
|
+
## Menubar
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
**Every dashboard Menubar must include a "Send Report" button.** Additional actions can be appended alongside it.
|
|
42
|
+
|
|
43
|
+
```svelte
|
|
44
|
+
<script>
|
|
45
|
+
import Menubar from '$lib/components/ui/Menubar.svelte';
|
|
46
|
+
import { Button } from '$lib/components/ui/button/index.js';
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<Menubar>
|
|
50
|
+
<!-- these children are additive examples — append to existing children, don't replace them, if there are no children, add them -->
|
|
51
|
+
<Button variant="link" class="text-muted-foreground">Send Report</Button>
|
|
52
|
+
</Menubar>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For co-branding, pass a `partnerLogo` snippet to replace the default placeholder:
|
|
56
|
+
|
|
57
|
+
```svelte
|
|
58
|
+
<Menubar>
|
|
59
|
+
{#snippet partnerLogo()}
|
|
60
|
+
<img src="/partner-logo.svg" alt="Partner" class="h-6" />
|
|
61
|
+
{/snippet}
|
|
62
|
+
<!-- additive example — append to existing children, don't replace them -->
|
|
63
|
+
<Button variant="link" class="text-muted-foreground">Send Report</Button>
|
|
64
|
+
</Menubar>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Preservation Rules
|
|
68
|
+
|
|
69
|
+
- **Never rewrite or replace** the Menubar component file in `$lib/components/ui/`
|
|
70
|
+
- **Never modify installed primitives/patterns** in `$lib/components/ui/` — those are design system files
|
|
71
|
+
- When a Menubar already has children (buttons, actions), **append** new actions alongside existing ones — do not replace them
|
|
72
|
+
- When a page already has content, **integrate alongside** existing markup — do not overwrite the file
|
|
73
|
+
|
|
74
|
+
## Full Layout
|
|
75
|
+
|
|
76
|
+
```svelte
|
|
77
|
+
<script>
|
|
78
|
+
import Menubar from '$lib/components/ui/Menubar.svelte';
|
|
79
|
+
import { Button } from '$lib/components/ui/button/index.js';
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<div class="bg-background grid h-screen w-screen grid-rows-[auto_1fr] overflow-hidden">
|
|
83
|
+
<Menubar>
|
|
84
|
+
<Button variant="link" class="text-muted-foreground">Send Report</Button>
|
|
85
|
+
</Menubar>
|
|
86
|
+
|
|
87
|
+
<main class="overflow-hidden">
|
|
88
|
+
<!-- panels go here -->
|
|
89
|
+
</main>
|
|
90
|
+
</div>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Panel Layouts
|
|
94
|
+
|
|
95
|
+
### Two Columns (Sidebar + Main)
|
|
96
|
+
|
|
97
|
+
```svelte
|
|
98
|
+
<main class="grid grid-cols-[300px_1fr] overflow-hidden">
|
|
99
|
+
<aside class="border-border overflow-y-auto border-r p-4">
|
|
100
|
+
<!-- sidebar content -->
|
|
101
|
+
</aside>
|
|
102
|
+
<section class="overflow-hidden p-4">
|
|
103
|
+
<!-- main content -->
|
|
104
|
+
</section>
|
|
105
|
+
</main>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Three Columns
|
|
109
|
+
|
|
110
|
+
```svelte
|
|
111
|
+
<main class="grid grid-cols-[250px_1fr_300px] overflow-hidden">
|
|
112
|
+
<aside class="border-border overflow-y-auto border-r p-4">
|
|
113
|
+
<!-- left panel -->
|
|
114
|
+
</aside>
|
|
115
|
+
<section class="overflow-hidden p-4">
|
|
116
|
+
<!-- center content -->
|
|
117
|
+
</section>
|
|
118
|
+
<aside class="border-border overflow-y-auto border-l p-4">
|
|
119
|
+
<!-- right panel -->
|
|
120
|
+
</aside>
|
|
121
|
+
</main>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Grid of Cards
|
|
125
|
+
|
|
126
|
+
```svelte
|
|
127
|
+
<main class="grid grid-cols-2 grid-rows-2 gap-4 overflow-hidden p-4">
|
|
128
|
+
<Card class="max-h-full"><!-- panel 1 --></Card>
|
|
129
|
+
<Card class="max-h-full"><!-- panel 2 --></Card>
|
|
130
|
+
<Card class="max-h-full"><!-- panel 3 --></Card>
|
|
131
|
+
<Card class="max-h-full"><!-- panel 4 --></Card>
|
|
132
|
+
</main>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Key Tailwind Classes
|
|
136
|
+
|
|
137
|
+
| Class | Purpose |
|
|
138
|
+
| ------------------------ | -------------------------------------------- |
|
|
139
|
+
| `h-screen w-screen` | Full viewport |
|
|
140
|
+
| `overflow-hidden` | Prevent scrolling (apply to root and panels) |
|
|
141
|
+
| `grid-rows-[auto_1fr]` | Menubar + fill content |
|
|
142
|
+
| `grid-cols-[300px_1fr]` | Fixed sidebar + fluid main |
|
|
143
|
+
| `border-b border-border` | Semantic border for menubar |
|
|
144
|
+
| `bg-background` | Themed background |
|
|
145
|
+
|
|
146
|
+
## Complete Example
|
|
147
|
+
|
|
148
|
+
```svelte
|
|
149
|
+
<!-- src/routes/+page.svelte -->
|
|
150
|
+
<script>
|
|
151
|
+
import Menubar from '$lib/components/ui/Menubar.svelte';
|
|
152
|
+
import { Button } from '$lib/components/ui/button/index.js';
|
|
153
|
+
import { Card, CardHeader, CardTitle, CardContent } from '$lib/components/ui/card/index.js';
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<div
|
|
157
|
+
class="bg-background text-foreground grid h-screen w-screen grid-rows-[auto_1fr] overflow-hidden"
|
|
158
|
+
>
|
|
159
|
+
<Menubar>
|
|
160
|
+
<Button variant="link" class="text-muted-foreground">Send Report</Button>
|
|
161
|
+
</Menubar>
|
|
162
|
+
|
|
163
|
+
<main class="grid grid-cols-2 grid-rows-2 gap-4 overflow-hidden p-4">
|
|
164
|
+
<Card class="max-h-full">
|
|
165
|
+
<CardHeader><CardTitle>Panel 1</CardTitle></CardHeader>
|
|
166
|
+
<CardContent><!-- content --></CardContent>
|
|
167
|
+
</Card>
|
|
168
|
+
<Card class="max-h-full">
|
|
169
|
+
<CardHeader><CardTitle>Panel 2</CardTitle></CardHeader>
|
|
170
|
+
<CardContent><!-- content --></CardContent>
|
|
171
|
+
</Card>
|
|
172
|
+
<Card class="max-h-full">
|
|
173
|
+
<CardHeader><CardTitle>Panel 3</CardTitle></CardHeader>
|
|
174
|
+
<CardContent><!-- content --></CardContent>
|
|
175
|
+
</Card>
|
|
176
|
+
<Card class="max-h-full">
|
|
177
|
+
<CardHeader><CardTitle>Panel 4</CardTitle></CardHeader>
|
|
178
|
+
<CardContent><!-- content --></CardContent>
|
|
179
|
+
</Card>
|
|
180
|
+
</main>
|
|
181
|
+
</div>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Reference
|
|
185
|
+
|
|
186
|
+
See `@rules/styling.md` for:
|
|
187
|
+
|
|
188
|
+
- Complete semantic token reference
|
|
189
|
+
- Tailwind v4 specifics and responsive patterns
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy-worker
|
|
3
|
+
description: Deploys a SvelteKit project to Cloudflare Workers with CI/CD auto-deploy on merge to main. Use when deploying a project, setting up wrangler configuration, running a local worker dev server, managing secrets, configuring environments, or when the user mentions "deploy", "cloudflare", "worker", "wrangler", or "production".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploying a Worker
|
|
7
|
+
|
|
8
|
+
Deploy SvelteKit projects built with the design system to Cloudflare Workers with GitHub Actions CI/CD that auto-deploys on merge to main.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
wrangler --version # Requires v4.x+
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
If not installed:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -D wrangler@latest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Authenticate:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
wrangler login
|
|
26
|
+
wrangler whoami # Verify
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## SvelteKit Adapter Setup
|
|
30
|
+
|
|
31
|
+
Install the Cloudflare adapter:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -D @sveltejs/adapter-cloudflare
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Update `svelte.config.js`:
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
import adapter from '@sveltejs/adapter-cloudflare';
|
|
41
|
+
|
|
42
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
43
|
+
const config = {
|
|
44
|
+
kit: {
|
|
45
|
+
adapter: adapter()
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default config;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Wrangler Configuration
|
|
53
|
+
|
|
54
|
+
Create `wrangler.jsonc` in the project root:
|
|
55
|
+
|
|
56
|
+
```jsonc
|
|
57
|
+
{
|
|
58
|
+
"$schema": "./node_modules/wrangler/config-schema.json",
|
|
59
|
+
"name": "my-app",
|
|
60
|
+
"main": ".svelte-kit/cloudflare/_worker.js",
|
|
61
|
+
"compatibility_date": "2026-01-01",
|
|
62
|
+
"compatibility_flags": ["nodejs_compat_v2"],
|
|
63
|
+
|
|
64
|
+
// Static assets from SvelteKit build
|
|
65
|
+
"assets": {
|
|
66
|
+
"directory": ".svelte-kit/cloudflare",
|
|
67
|
+
"binding": "ASSETS"
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
// Environment variables
|
|
71
|
+
"vars": {
|
|
72
|
+
"ENVIRONMENT": "production"
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
// Environments
|
|
76
|
+
"env": {
|
|
77
|
+
"staging": {
|
|
78
|
+
"name": "my-app-staging",
|
|
79
|
+
"vars": { "ENVIRONMENT": "staging" }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **Note**: Existing projects may use `wrangler.toml` instead of `wrangler.jsonc`. Both work, but JSONC is recommended for new projects as newer wrangler features are JSON-only.
|
|
86
|
+
|
|
87
|
+
## Build and Initial Deploy
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Build the SvelteKit app
|
|
91
|
+
npm run build
|
|
92
|
+
|
|
93
|
+
# Dry run first to validate
|
|
94
|
+
wrangler deploy --dry-run
|
|
95
|
+
|
|
96
|
+
# Deploy to Cloudflare
|
|
97
|
+
wrangler deploy
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## CI/CD Auto-Deploy
|
|
101
|
+
|
|
102
|
+
Always set up GitHub Actions so the project auto-deploys when changes are merged into main.
|
|
103
|
+
|
|
104
|
+
Create `.github/workflows/deploy.yml`:
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
name: Deploy
|
|
108
|
+
on:
|
|
109
|
+
push:
|
|
110
|
+
branches: [main]
|
|
111
|
+
|
|
112
|
+
jobs:
|
|
113
|
+
deploy:
|
|
114
|
+
runs-on: ubuntu-latest
|
|
115
|
+
steps:
|
|
116
|
+
- uses: actions/checkout@v4
|
|
117
|
+
- uses: actions/setup-node@v4
|
|
118
|
+
with:
|
|
119
|
+
node-version: 20
|
|
120
|
+
- run: npm ci
|
|
121
|
+
- run: npm run build
|
|
122
|
+
- run: npx wrangler deploy
|
|
123
|
+
env:
|
|
124
|
+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Required secret: `CLOUDFLARE_API_TOKEN` with Workers permissions. Remind the user to add this to their GitHub repo under Settings > Secrets and variables > Actions.
|
|
128
|
+
|
|
129
|
+
If the user has a staging environment, extend the workflow:
|
|
130
|
+
|
|
131
|
+
```yaml
|
|
132
|
+
on:
|
|
133
|
+
push:
|
|
134
|
+
branches: [main, staging]
|
|
135
|
+
|
|
136
|
+
# In the deploy step:
|
|
137
|
+
- run: npx wrangler deploy ${{ github.ref_name == 'staging' && '--env staging' || '' }}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Local Development
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# SvelteKit dev server (preferred for development)
|
|
144
|
+
npm run dev
|
|
145
|
+
|
|
146
|
+
# Worker dev server (test Cloudflare-specific behavior)
|
|
147
|
+
npm run build && wrangler dev
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Use `wrangler dev` when you need to test:
|
|
151
|
+
|
|
152
|
+
- Cloudflare bindings (KV, R2, D1)
|
|
153
|
+
- Worker-specific routing
|
|
154
|
+
- Production-like behavior
|
|
155
|
+
|
|
156
|
+
## Secrets
|
|
157
|
+
|
|
158
|
+
Never commit secrets to config. Use wrangler secrets for production and `.dev.vars` for local dev.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Set a secret
|
|
162
|
+
wrangler secret put API_KEY
|
|
163
|
+
|
|
164
|
+
# List secrets
|
|
165
|
+
wrangler secret list
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
For local development, create `.dev.vars` (gitignored):
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
API_KEY=local-dev-key
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Environments
|
|
175
|
+
|
|
176
|
+
Deploy to staging or production:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Deploy to staging
|
|
180
|
+
wrangler deploy --env staging
|
|
181
|
+
|
|
182
|
+
# Deploy to production (default)
|
|
183
|
+
wrangler deploy
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Observability
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Stream live logs
|
|
190
|
+
wrangler tail
|
|
191
|
+
|
|
192
|
+
# Filter by errors
|
|
193
|
+
wrangler tail --status error
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Enable in config:
|
|
197
|
+
|
|
198
|
+
```jsonc
|
|
199
|
+
{
|
|
200
|
+
"observability": {
|
|
201
|
+
"enabled": true,
|
|
202
|
+
"head_sampling_rate": 1
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Rollback
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# List recent versions
|
|
211
|
+
wrangler versions list
|
|
212
|
+
|
|
213
|
+
# Rollback to previous version
|
|
214
|
+
wrangler rollback
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Checklist
|
|
218
|
+
|
|
219
|
+
- [ ] `@sveltejs/adapter-cloudflare` installed
|
|
220
|
+
- [ ] `svelte.config.js` uses the Cloudflare adapter
|
|
221
|
+
- [ ] `wrangler.jsonc` exists with correct `name` and `compatibility_date`
|
|
222
|
+
- [ ] `npm run build` succeeds
|
|
223
|
+
- [ ] `wrangler deploy --dry-run` passes
|
|
224
|
+
- [ ] `.github/workflows/deploy.yml` created with auto-deploy on merge to main
|
|
225
|
+
- [ ] User reminded to set `CLOUDFLARE_API_TOKEN` in GitHub repo secrets
|
|
226
|
+
- [ ] Secrets set via `wrangler secret put` (not in config)
|
|
227
|
+
- [ ] `.dev.vars` gitignored
|
|
228
|
+
|
|
229
|
+
## Reference
|
|
230
|
+
|
|
231
|
+
See [references/wrangler-commands.md](references/wrangler-commands.md) for the full wrangler CLI reference including KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Queues, Containers, Workflows, Pipelines, and Secrets Store commands.
|