@archetypeai/ds-cli 0.3.9 → 0.3.10

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.
@@ -1,191 +1,56 @@
1
1
  #!/bin/bash
2
2
  #
3
- # Archetype AI Design System Setup Script
3
+ # Design System Linting & Formatting Setup
4
4
  #
5
- # Sets up a SvelteKit project with @archetypeai/ds-lib-tokens and design system components.
6
- # Fully non-interactive.
5
+ # Installs and configures ESLint + Prettier for a SvelteKit project
6
+ # using the Archetype AI design system.
7
7
  #
8
- # Usage: bash setup.sh
8
+ # Usage: bash <skill-dir>/scripts/setup.sh
9
9
  #
10
10
 
11
11
  set -e
12
12
 
13
13
  echo "═══════════════════════════════════════════════════"
14
- echo " Archetype AI Design System Setup"
14
+ echo " Linting & Formatting Setup"
15
15
  echo "═══════════════════════════════════════════════════"
16
16
  echo ""
17
17
 
18
- # ─────────────────────────────────────────────────────────
19
- # Prerequisites Check
20
- # ─────────────────────────────────────────────────────────
21
-
22
- if ! command -v node &> /dev/null; then
23
- echo "✗ Error: Node.js is not installed"
24
- echo " Install Node.js 18+ and try again"
25
- exit 1
26
- fi
27
-
28
- NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
29
- if [ "$NODE_VERSION" -lt 18 ]; then
30
- echo "✗ Error: Node.js 18+ required (found v$NODE_VERSION)"
31
- exit 1
32
- fi
33
-
34
18
  if [ ! -f "package.json" ]; then
35
19
  echo "✗ Error: No package.json found"
36
20
  echo " Run this script from your project root directory"
37
21
  exit 1
38
22
  fi
39
23
 
40
- # Detect global CSS file
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
- if [ -z "$CSS_FILE" ]; then
51
- echo "✗ Error: No global CSS file found"
52
- echo " Checked: src/app.css, src/routes/layout.css, src/app.pcss"
53
- echo " Create a global CSS file and run again."
54
- exit 1
55
- fi
56
-
57
- echo "✓ Prerequisites OK (Node v$NODE_VERSION, CSS: $CSS_FILE)"
58
- echo ""
59
-
60
24
  # ─────────────────────────────────────────────────────────
61
- # Step 1: Install Tokens
25
+ # Install Dependencies
62
26
  # ─────────────────────────────────────────────────────────
63
27
 
64
- echo "Step 1/6: Installing @archetypeai/ds-lib-tokens..."
28
+ echo "Installing linting dependencies..."
65
29
 
66
- if grep -q '"@archetypeai/ds-lib-tokens"' package.json 2>/dev/null; then
67
- echo " Already installed, skipping"
68
- else
69
- npm i @archetypeai/ds-lib-tokens || {
70
- echo ""
71
- echo "✗ Installation failed."
72
- exit 1
73
- }
74
- echo " ✓ Tokens installed"
75
- fi
76
- echo ""
77
-
78
- # ─────────────────────────────────────────────────────────
79
- # Step 2: Install & Configure Tailwind CSS
80
- # ─────────────────────────────────────────────────────────
81
-
82
- echo "Step 2/6: Installing and configuring Tailwind CSS..."
83
-
84
- # Install tailwindcss + vite plugin if not present
85
- if grep -q '"tailwindcss"' package.json 2>/dev/null && grep -q '"@tailwindcss/vite"' package.json 2>/dev/null; then
86
- echo " → tailwindcss already installed, skipping"
87
- else
88
- npm i -D tailwindcss @tailwindcss/vite || {
89
- echo ""
90
- echo "✗ Failed to install tailwindcss"
91
- exit 1
92
- }
93
- echo " ✓ tailwindcss and @tailwindcss/vite installed"
94
- fi
95
-
96
- # Configure vite.config.js with @tailwindcss/vite plugin
97
- VITE_CONFIG=""
98
- if [ -f "vite.config.js" ]; then
99
- VITE_CONFIG="vite.config.js"
100
- elif [ -f "vite.config.ts" ]; then
101
- VITE_CONFIG="vite.config.ts"
102
- fi
103
-
104
- if [ -z "$VITE_CONFIG" ]; then
105
- echo " ⚠ No vite.config found — create one and add tailwindcss() to plugins manually"
106
- elif grep -q "@tailwindcss/vite" "$VITE_CONFIG" 2>/dev/null; then
107
- echo " → @tailwindcss/vite already configured in $VITE_CONFIG, skipping"
108
- else
109
- # Add import after the last import statement
110
- LAST_IMPORT_LINE=$(grep -n '^import ' "$VITE_CONFIG" | tail -1 | cut -d: -f1)
111
- if [ -n "$LAST_IMPORT_LINE" ]; then
112
- sed -i.bak "${LAST_IMPORT_LINE}a\\
113
- import tailwindcss from '@tailwindcss/vite';" "$VITE_CONFIG"
114
- else
115
- sed -i.bak "1i\\
116
- import tailwindcss from '@tailwindcss/vite';" "$VITE_CONFIG"
117
- fi
118
-
119
- # Add tailwindcss() to plugins array
120
- if grep -q 'plugins.*svelte()' "$VITE_CONFIG"; then
121
- sed -i.bak 's/svelte()/svelte(), tailwindcss()/' "$VITE_CONFIG"
122
- elif grep -q 'plugins.*\[' "$VITE_CONFIG"; then
123
- sed -i.bak 's/plugins:[[:space:]]*\[/plugins: [tailwindcss(), /' "$VITE_CONFIG"
124
- else
125
- echo " ⚠ Could not find plugins array — add tailwindcss() to plugins manually"
126
- fi
127
-
128
- rm -f "${VITE_CONFIG}.bak"
129
- echo " ✓ @tailwindcss/vite configured in $VITE_CONFIG"
130
- fi
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"
131
35
  echo ""
132
36
 
133
37
  # ─────────────────────────────────────────────────────────
134
- # Step 3: Initialize shadcn-svelte
38
+ # Detect CSS file for Prettier Tailwind plugin
135
39
  # ─────────────────────────────────────────────────────────
136
40
 
137
- echo "Step 3/6: Initializing shadcn-svelte..."
138
-
139
- if [ -f "components.json" ]; then
140
- echo " → components.json exists, skipping init"
141
- else
142
- npx shadcn-svelte@latest init \
143
- --base-color slate \
144
- --css "$CSS_FILE" \
145
- --components-alias '$lib/components' \
146
- --lib-alias '$lib' \
147
- --utils-alias '$lib/utils' \
148
- --hooks-alias '$lib/hooks' \
149
- --ui-alias '$lib/components/ui' \
150
- --skip-preflight \
151
- --no-deps
152
- echo " ✓ shadcn-svelte initialized"
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"
153
48
  fi
154
- echo ""
155
49
 
156
50
  # ─────────────────────────────────────────────────────────
157
- # Step 4: Install Components
51
+ # Create eslint.config.js
158
52
  # ─────────────────────────────────────────────────────────
159
53
 
160
- echo "Step 4/6: Installing design system components..."
161
- npx @archetypeai/ds-cli add ds-ui-svelte
162
- echo " ✓ Components installed"
163
- echo ""
164
-
165
- # ─────────────────────────────────────────────────────────
166
- # Step 5: Configure CSS Imports
167
- # ─────────────────────────────────────────────────────────
168
-
169
- echo "Step 5/6: Configuring CSS imports..."
170
-
171
- cat > "$CSS_FILE" << 'EOF'
172
- @import '@archetypeai/ds-lib-tokens/theme.css';
173
- @import 'tailwindcss';
174
- EOF
175
-
176
- echo " ✓ CSS imports written to $CSS_FILE"
177
- echo ""
178
-
179
- # ─────────────────────────────────────────────────────────
180
- # Step 6: Set Up Linting & Formatting
181
- # ─────────────────────────────────────────────────────────
182
-
183
- echo "Step 6/6: Setting up linting and formatting..."
184
-
185
- npm i -D eslint prettier eslint-plugin-svelte eslint-config-prettier prettier-plugin-svelte prettier-plugin-tailwindcss globals 2>/dev/null || true
186
- echo " ✓ Linting dependencies installed"
187
-
188
- # Create eslint.config.js if it doesn't exist
189
54
  if [ ! -f "eslint.config.js" ]; then
190
55
  cat > eslint.config.js << 'ESLINT_EOF'
191
56
  import js from '@eslint/js';
@@ -218,9 +83,13 @@ else
218
83
  echo " → eslint.config.js exists, skipping"
219
84
  fi
220
85
 
221
- # Create .prettierrc if it doesn't exist
86
+ # ─────────────────────────────────────────────────────────
87
+ # Create .prettierrc
88
+ # ─────────────────────────────────────────────────────────
89
+
222
90
  if [ ! -f ".prettierrc" ]; then
223
- cat > .prettierrc << PRETTIER_EOF
91
+ if [ -n "$CSS_FILE" ]; then
92
+ cat > .prettierrc << PRETTIER_EOF
224
93
  {
225
94
  "useTabs": true,
226
95
  "singleQuote": true,
@@ -230,12 +99,26 @@ if [ ! -f ".prettierrc" ]; then
230
99
  "tailwindStylesheet": "./$CSS_FILE"
231
100
  }
232
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
233
113
  echo " ✓ .prettierrc created"
234
114
  else
235
115
  echo " → .prettierrc exists, skipping"
236
116
  fi
237
117
 
238
- # Create .prettierignore if it doesn't exist
118
+ # ─────────────────────────────────────────────────────────
119
+ # Create .prettierignore
120
+ # ─────────────────────────────────────────────────────────
121
+
239
122
  if [ ! -f ".prettierignore" ]; then
240
123
  cat > .prettierignore << 'IGNORE_EOF'
241
124
  .svelte-kit
@@ -251,21 +134,20 @@ else
251
134
  echo " → .prettierignore exists, skipping"
252
135
  fi
253
136
 
254
- # Add lint/format scripts to package.json
137
+ # ─────────────────────────────────────────────────────────
138
+ # Add scripts to package.json
139
+ # ─────────────────────────────────────────────────────────
140
+
255
141
  npm pkg set scripts.lint="eslint ." 2>/dev/null || true
256
142
  npm pkg set scripts.lint:fix="eslint . --fix" 2>/dev/null || true
257
143
  npm pkg set scripts.format="prettier --write ." 2>/dev/null || true
258
144
  npm pkg set scripts.format:check="prettier --check ." 2>/dev/null || true
259
145
  echo " ✓ Lint/format scripts added to package.json"
260
- echo ""
261
-
262
- # ─────────────────────────────────────────────────────────
263
- # Complete
264
- # ─────────────────────────────────────────────────────────
265
146
 
147
+ echo ""
266
148
  echo "═══════════════════════════════════════════════════"
267
149
  echo " Setup Complete"
268
150
  echo "═══════════════════════════════════════════════════"
269
151
  echo ""
270
- echo " Components are in \$lib/components/ui/"
152
+ echo " Run: npm run lint:fix && npm run format"
271
153
  echo ""
@@ -7,6 +7,8 @@ description: Scaffolds a full-viewport dashboard layout with no scrolling, a bra
7
7
 
8
8
  Scaffold a full-viewport dashboard with a branded menubar and panel-based content.
9
9
 
10
+ > **Note:** This is one layout option for demos. If the user's request doesn't clearly map to a dashboard, consider the best-fit layout for their use case.
11
+
10
12
  ## Discovering Components
11
13
 
12
14
  Before building, check which components are installed in the project:
@@ -181,6 +183,16 @@ For co-branding, pass a `partnerLogo` snippet to replace the default placeholder
181
183
  </div>
182
184
  ```
183
185
 
186
+ ## Populating Panels with Pattern Components
187
+
188
+ Panels should contain pattern components, not raw markup. Before building new components:
189
+
190
+ 1. Check if existing patterns fit the need — `VideoPlayer`, `ExpandableLog`, `StatusBadge`, `HealthscoreCard`, `SensorChart`, `ScatterChart`
191
+ 2. If no existing pattern fits, create one via `@skills/build-pattern`
192
+ 3. Each panel should contain one primary component with clear props for data flow
193
+
194
+ This keeps dashboards composable and consistent with the design system.
195
+
184
196
  ## Reference
185
197
 
186
198
  See `@rules/styling.md` for: