@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.
Files changed (32) hide show
  1. package/README.md +3 -3
  2. package/commands/create.js +2 -2
  3. package/commands/init.js +2 -2
  4. package/files/AGENTS.md +128 -70
  5. package/files/CLAUDE.md +128 -70
  6. package/files/ds-manifest.json +998 -1024
  7. package/lib/add-ds-config-codeagent.js +3 -57
  8. package/package.json +2 -2
  9. package/files/LICENSE +0 -21
  10. package/files/rules/accessibility.md +0 -268
  11. package/files/rules/charts.md +0 -256
  12. package/files/rules/components.md +0 -251
  13. package/files/rules/design-principles.md +0 -71
  14. package/files/rules/frontend-architecture.md +0 -86
  15. package/files/rules/linting.md +0 -31
  16. package/files/rules/state.md +0 -373
  17. package/files/rules/styling.md +0 -142
  18. package/files/skills/apply-ds/SKILL.md +0 -121
  19. package/files/skills/apply-ds/scripts/audit.sh +0 -169
  20. package/files/skills/apply-ds/scripts/setup.sh +0 -153
  21. package/files/skills/build-component/SKILL.md +0 -153
  22. package/files/skills/create-dashboard/SKILL.md +0 -220
  23. package/files/skills/deploy-worker/SKILL.md +0 -231
  24. package/files/skills/deploy-worker/references/wrangler-commands.md +0 -327
  25. package/files/skills/fix-accessibility/SKILL.md +0 -232
  26. package/files/skills/fix-metadata/SKILL.md +0 -118
  27. package/files/skills/fix-metadata/assets/favicon.ico +0 -0
  28. package/files/skills/setup-chart/SKILL.md +0 -223
  29. package/files/skills/setup-chart/data/embedding.csv +0 -42
  30. package/files/skills/setup-chart/data/timeseries.csv +0 -173
  31. package/files/skills/setup-chart/references/scatter-chart.md +0 -229
  32. package/files/skills/setup-chart/references/sensor-chart.md +0 -156
@@ -1,169 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Design System Audit Script
4
- #
5
- # Scans .svelte files for non-DS patterns that should be migrated:
6
- # - Raw Tailwind color utilities (should be semantic tokens)
7
- # - Native HTML elements (should be DS components)
8
- # - Hardcoded inline color styles
9
- # - Class string concatenation (should use cn())
10
- #
11
- # Usage: bash <skill-dir>/scripts/audit.sh
12
- #
13
-
14
- set -e
15
-
16
- # Colors for output
17
- RED='\033[0;31m'
18
- YELLOW='\033[0;33m'
19
- CYAN='\033[0;36m'
20
- NC='\033[0m'
21
-
22
- echo "═══════════════════════════════════════════════════"
23
- echo " Design System Audit"
24
- echo "═══════════════════════════════════════════════════"
25
- echo ""
26
-
27
- if [ ! -d "src" ]; then
28
- echo "✗ Error: No src/ directory found"
29
- echo " Run this script from your project root directory"
30
- exit 1
31
- fi
32
-
33
- SVELTE_FILES=$(find src -name "*.svelte" -not -path "*/node_modules/*" -not -path "*/.svelte-kit/*" 2>/dev/null)
34
-
35
- if [ -z "$SVELTE_FILES" ]; then
36
- echo "✗ No .svelte files found in src/"
37
- exit 1
38
- fi
39
-
40
- FILE_COUNT=$(echo "$SVELTE_FILES" | wc -l | tr -d ' ')
41
- echo "Scanning $FILE_COUNT .svelte files..."
42
- echo ""
43
-
44
- ISSUES=0
45
-
46
- # ─────────────────────────────────────────────────────────
47
- # 1. Raw Tailwind color utilities
48
- # ─────────────────────────────────────────────────────────
49
-
50
- echo -e "${CYAN}── Raw Tailwind Colors ──${NC}"
51
- echo ""
52
-
53
- RAW_COLOR_PATTERN='\b(bg|text|border|ring|outline|shadow|from|to|via)-(red|blue|green|yellow|orange|purple|pink|indigo|violet|teal|cyan|emerald|amber|lime|rose|fuchsia|sky|stone|zinc|neutral|slate|gray|grey|white|black)-[0-9]'
54
-
55
- RAW_MATCHES=$(grep -rn --include="*.svelte" -E "$RAW_COLOR_PATTERN" src/ 2>/dev/null || true)
56
-
57
- if [ -n "$RAW_MATCHES" ]; then
58
- echo "$RAW_MATCHES" | while IFS= read -r line; do
59
- echo -e " ${YELLOW}$line${NC}"
60
- done
61
- RAW_COUNT=$(echo "$RAW_MATCHES" | wc -l | tr -d ' ')
62
- ISSUES=$((ISSUES + RAW_COUNT))
63
- echo ""
64
- echo " Found $RAW_COUNT raw color utilities → replace with semantic tokens"
65
- else
66
- echo " ✓ No raw Tailwind color utilities found"
67
- fi
68
-
69
- # Also check bg-white, bg-black, text-white, text-black without shade numbers
70
- BW_PATTERN='\b(bg-white|bg-black|text-white|text-black)\b'
71
- BW_MATCHES=$(grep -rn --include="*.svelte" -E "$BW_PATTERN" src/ 2>/dev/null || true)
72
-
73
- if [ -n "$BW_MATCHES" ]; then
74
- echo ""
75
- echo "$BW_MATCHES" | while IFS= read -r line; do
76
- echo -e " ${YELLOW}$line${NC}"
77
- done
78
- BW_COUNT=$(echo "$BW_MATCHES" | wc -l | tr -d ' ')
79
- echo ""
80
- echo " Found $BW_COUNT black/white utilities → replace with bg-background, text-foreground, etc."
81
- fi
82
-
83
- echo ""
84
-
85
- # ─────────────────────────────────────────────────────────
86
- # 2. Native HTML elements with DS equivalents
87
- # ─────────────────────────────────────────────────────────
88
-
89
- echo -e "${CYAN}── Native HTML Elements ──${NC}"
90
- echo ""
91
-
92
- # Search in template sections only (outside <script> blocks)
93
- NATIVE_ELEMENTS="<button[> ]|<input[> /]|<textarea[> /]|<select[> ]|<table[> ]|<dialog[> ]|<hr[> /]|<hr>"
94
-
95
- NATIVE_MATCHES=$(grep -rn --include="*.svelte" -E "$NATIVE_ELEMENTS" src/ 2>/dev/null | grep -v '<script' | grep -v 'import ' || true)
96
-
97
- if [ -n "$NATIVE_MATCHES" ]; then
98
- echo "$NATIVE_MATCHES" | while IFS= read -r line; do
99
- echo -e " ${YELLOW}$line${NC}"
100
- done
101
- NATIVE_COUNT=$(echo "$NATIVE_MATCHES" | wc -l | tr -d ' ')
102
- ISSUES=$((ISSUES + NATIVE_COUNT))
103
- echo ""
104
- echo " Found $NATIVE_COUNT native elements → replace with DS components"
105
- else
106
- echo " ✓ No native HTML elements with DS equivalents found"
107
- fi
108
-
109
- echo ""
110
-
111
- # ─────────────────────────────────────────────────────────
112
- # 3. Hardcoded inline color styles
113
- # ─────────────────────────────────────────────────────────
114
-
115
- echo -e "${CYAN}── Hardcoded Inline Colors ──${NC}"
116
- echo ""
117
-
118
- INLINE_PATTERN='style="[^"]*\b(color|background|background-color|border-color)\s*:'
119
-
120
- INLINE_MATCHES=$(grep -rn --include="*.svelte" -E "$INLINE_PATTERN" src/ 2>/dev/null || true)
121
-
122
- if [ -n "$INLINE_MATCHES" ]; then
123
- echo "$INLINE_MATCHES" | while IFS= read -r line; do
124
- echo -e " ${YELLOW}$line${NC}"
125
- done
126
- INLINE_COUNT=$(echo "$INLINE_MATCHES" | wc -l | tr -d ' ')
127
- ISSUES=$((ISSUES + INLINE_COUNT))
128
- echo ""
129
- echo " Found $INLINE_COUNT hardcoded inline colors → use semantic token classes"
130
- else
131
- echo " ✓ No hardcoded inline colors found"
132
- fi
133
-
134
- echo ""
135
-
136
- # ─────────────────────────────────────────────────────────
137
- # 4. Class string concatenation (should use cn())
138
- # ─────────────────────────────────────────────────────────
139
-
140
- echo -e "${CYAN}── Class Concatenation ──${NC}"
141
- echo ""
142
-
143
- # Look for class={`...`} or class={something + "..."} patterns
144
- CONCAT_PATTERN='class=\{`|class=\{[^}]*\+'
145
-
146
- CONCAT_MATCHES=$(grep -rn --include="*.svelte" -E "$CONCAT_PATTERN" src/ 2>/dev/null | grep -v 'cn(' || true)
147
-
148
- if [ -n "$CONCAT_MATCHES" ]; then
149
- echo "$CONCAT_MATCHES" | while IFS= read -r line; do
150
- echo -e " ${YELLOW}$line${NC}"
151
- done
152
- CONCAT_COUNT=$(echo "$CONCAT_MATCHES" | wc -l | tr -d ' ')
153
- ISSUES=$((ISSUES + CONCAT_COUNT))
154
- echo ""
155
- echo " Found $CONCAT_COUNT class concatenations → use cn() from \$lib/utils.js"
156
- else
157
- echo " ✓ No class string concatenation found"
158
- fi
159
-
160
- echo ""
161
-
162
- # ─────────────────────────────────────────────────────────
163
- # Summary
164
- # ─────────────────────────────────────────────────────────
165
-
166
- echo "═══════════════════════════════════════════════════"
167
- echo " Audit Complete"
168
- echo "═══════════════════════════════════════════════════"
169
- echo ""
@@ -1,153 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Design System Linting & Formatting Setup
4
- #
5
- # Installs and configures ESLint + Prettier for a SvelteKit project
6
- # using the Archetype AI design system.
7
- #
8
- # Usage: bash <skill-dir>/scripts/setup.sh
9
- #
10
-
11
- set -e
12
-
13
- echo "═══════════════════════════════════════════════════"
14
- echo " Linting & Formatting Setup"
15
- echo "═══════════════════════════════════════════════════"
16
- echo ""
17
-
18
- if [ ! -f "package.json" ]; then
19
- echo "✗ Error: No package.json found"
20
- echo " Run this script from your project root directory"
21
- exit 1
22
- fi
23
-
24
- # ─────────────────────────────────────────────────────────
25
- # Install Dependencies
26
- # ─────────────────────────────────────────────────────────
27
-
28
- echo "Installing linting dependencies..."
29
-
30
- npm i -D eslint prettier eslint-plugin-svelte eslint-config-prettier prettier-plugin-svelte prettier-plugin-tailwindcss globals 2>/dev/null || {
31
- echo "✗ Failed to install dependencies"
32
- exit 1
33
- }
34
- echo " ✓ Dependencies installed"
35
- echo ""
36
-
37
- # ─────────────────────────────────────────────────────────
38
- # Detect CSS file for Prettier Tailwind plugin
39
- # ─────────────────────────────────────────────────────────
40
-
41
- CSS_FILE=""
42
- if [ -f "src/app.css" ]; then
43
- CSS_FILE="src/app.css"
44
- elif [ -f "src/routes/layout.css" ]; then
45
- CSS_FILE="src/routes/layout.css"
46
- elif [ -f "src/app.pcss" ]; then
47
- CSS_FILE="src/app.pcss"
48
- fi
49
-
50
- # ─────────────────────────────────────────────────────────
51
- # Create eslint.config.js
52
- # ─────────────────────────────────────────────────────────
53
-
54
- if [ ! -f "eslint.config.js" ]; then
55
- cat > eslint.config.js << 'ESLINT_EOF'
56
- import js from '@eslint/js';
57
- import svelte from 'eslint-plugin-svelte';
58
- import globals from 'globals';
59
- import svelteConfig from './svelte.config.js';
60
-
61
- export default [
62
- js.configs.recommended,
63
- ...svelte.configs.recommended,
64
- ...svelte.configs['flat/prettier'],
65
- {
66
- languageOptions: {
67
- globals: { ...globals.browser, ...globals.node }
68
- }
69
- },
70
- {
71
- files: ['**/*.svelte', '**/*.svelte.js'],
72
- languageOptions: {
73
- parserOptions: { svelteConfig }
74
- }
75
- },
76
- {
77
- ignores: ['.svelte-kit/', 'build/', 'dist/', 'node_modules/']
78
- }
79
- ];
80
- ESLINT_EOF
81
- echo " ✓ eslint.config.js created"
82
- else
83
- echo " → eslint.config.js exists, skipping"
84
- fi
85
-
86
- # ─────────────────────────────────────────────────────────
87
- # Create .prettierrc
88
- # ─────────────────────────────────────────────────────────
89
-
90
- if [ ! -f ".prettierrc" ]; then
91
- if [ -n "$CSS_FILE" ]; then
92
- cat > .prettierrc << PRETTIER_EOF
93
- {
94
- "useTabs": true,
95
- "singleQuote": true,
96
- "trailingComma": "none",
97
- "printWidth": 100,
98
- "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
99
- "tailwindStylesheet": "./$CSS_FILE"
100
- }
101
- PRETTIER_EOF
102
- else
103
- cat > .prettierrc << 'PRETTIER_EOF'
104
- {
105
- "useTabs": true,
106
- "singleQuote": true,
107
- "trailingComma": "none",
108
- "printWidth": 100,
109
- "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"]
110
- }
111
- PRETTIER_EOF
112
- fi
113
- echo " ✓ .prettierrc created"
114
- else
115
- echo " → .prettierrc exists, skipping"
116
- fi
117
-
118
- # ─────────────────────────────────────────────────────────
119
- # Create .prettierignore
120
- # ─────────────────────────────────────────────────────────
121
-
122
- if [ ! -f ".prettierignore" ]; then
123
- cat > .prettierignore << 'IGNORE_EOF'
124
- .svelte-kit
125
- .claude
126
- .cursor
127
- build
128
- dist
129
- node_modules
130
- package-lock.json
131
- IGNORE_EOF
132
- echo " ✓ .prettierignore created"
133
- else
134
- echo " → .prettierignore exists, skipping"
135
- fi
136
-
137
- # ─────────────────────────────────────────────────────────
138
- # Add scripts to package.json
139
- # ─────────────────────────────────────────────────────────
140
-
141
- npm pkg set scripts.lint="eslint ." 2>/dev/null || true
142
- npm pkg set scripts.lint:fix="eslint . --fix" 2>/dev/null || true
143
- npm pkg set scripts.format="prettier --write ." 2>/dev/null || true
144
- npm pkg set scripts.format:check="prettier --check ." 2>/dev/null || true
145
- echo " ✓ Lint/format scripts added to package.json"
146
-
147
- echo ""
148
- echo "═══════════════════════════════════════════════════"
149
- echo " Setup Complete"
150
- echo "═══════════════════════════════════════════════════"
151
- echo ""
152
- echo " Run: npm run lint:fix && npm run format"
153
- echo ""
@@ -1,153 +0,0 @@
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