@schandlergarcia/sf-web-components 1.9.43 → 1.9.45
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/.a4drules/RULES.md +456 -0
- package/ARCHITECTURE.md +112 -0
- package/CHANGELOG.md +424 -0
- package/CONTRIBUTING.md +247 -0
- package/QUICK-REFERENCE.md +212 -0
- package/README.md +76 -14
- package/package.json +8 -2
- package/scripts/pre-publish-check.sh +180 -0
- package/scripts/reset-command-center.sh +18 -10
- package/scripts/verify-consistency.sh +238 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
# Project Rules for sf-web-components
|
|
2
|
+
|
|
3
|
+
These rules are **MANDATORY** and must be followed by all contributors, including AI assistants.
|
|
4
|
+
|
|
5
|
+
## Rule 1: Documentation is the Source of Truth
|
|
6
|
+
|
|
7
|
+
**The `.a4drules/skills/component-library/` directory is the authoritative source for all component contracts.**
|
|
8
|
+
|
|
9
|
+
- Code MUST match documentation, not the other way around
|
|
10
|
+
- Never change component names without updating documentation FIRST
|
|
11
|
+
- If documentation says `UIButton`, the file MUST be named `UIButton.tsx`
|
|
12
|
+
- If you find a mismatch, the documentation is correct and the code is wrong
|
|
13
|
+
|
|
14
|
+
### Verification
|
|
15
|
+
```bash
|
|
16
|
+
# Check if code matches docs
|
|
17
|
+
bash scripts/verify-consistency.sh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Rule 2: CHANGELOG.md is Mandatory
|
|
23
|
+
|
|
24
|
+
**EVERY change to this package MUST be documented in CHANGELOG.md BEFORE publishing.**
|
|
25
|
+
|
|
26
|
+
### Required Changelog Entries
|
|
27
|
+
|
|
28
|
+
#### For Component Changes
|
|
29
|
+
```markdown
|
|
30
|
+
### Added
|
|
31
|
+
- UINewComponent.tsx - Description of what it does
|
|
32
|
+
- Props: list key props
|
|
33
|
+
- Usage example
|
|
34
|
+
- Documented in .a4drules/skills/component-library/xyz.md
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
- UIButton.tsx - Description of what changed
|
|
38
|
+
- Migration: How to update code
|
|
39
|
+
- Breaking: Yes/No
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- CRITICAL: Description of critical fix
|
|
43
|
+
- Issue: What was broken
|
|
44
|
+
- Cause: Why it was broken
|
|
45
|
+
- Fix: How it was fixed
|
|
46
|
+
- Affected versions: x.x.x - x.x.x
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### For Documentation Changes
|
|
50
|
+
```markdown
|
|
51
|
+
### Documentation
|
|
52
|
+
- Updated .a4drules/skills/component-library/ui-primitives.md
|
|
53
|
+
- Added UINewComponent documentation
|
|
54
|
+
- Clarified UIButton props
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### For Breaking Changes
|
|
58
|
+
```markdown
|
|
59
|
+
### Breaking Changes
|
|
60
|
+
⚠️ **ComponentName renamed from OldName to NewName**
|
|
61
|
+
- Reason: Explanation
|
|
62
|
+
- Migration:
|
|
63
|
+
\`\`\`tsx
|
|
64
|
+
// Before
|
|
65
|
+
import { OldName } from '@/components/library';
|
|
66
|
+
|
|
67
|
+
// After
|
|
68
|
+
import { NewName } from '@/components/library';
|
|
69
|
+
\`\`\`
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### When to Update CHANGELOG
|
|
73
|
+
|
|
74
|
+
**Update CHANGELOG.md in the SAME commit as the change.**
|
|
75
|
+
|
|
76
|
+
Do NOT:
|
|
77
|
+
- ❌ Make changes and forget to update CHANGELOG
|
|
78
|
+
- ❌ Update CHANGELOG in a separate commit
|
|
79
|
+
- ❌ Publish without CHANGELOG entry
|
|
80
|
+
|
|
81
|
+
Do:
|
|
82
|
+
- ✅ Update CHANGELOG in same commit as code changes
|
|
83
|
+
- ✅ Use clear, descriptive language
|
|
84
|
+
- ✅ Include version number and date
|
|
85
|
+
- ✅ Categorize changes (Added, Changed, Fixed, etc.)
|
|
86
|
+
|
|
87
|
+
### Pre-Publish Checklist
|
|
88
|
+
|
|
89
|
+
Before running `npm version` or `npm publish`:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# 1. Verify all changes are documented in CHANGELOG.md
|
|
93
|
+
git diff HEAD src/ | grep -v "index" > /tmp/changes.diff
|
|
94
|
+
echo "Have you documented all these changes in CHANGELOG.md?"
|
|
95
|
+
cat /tmp/changes.diff
|
|
96
|
+
|
|
97
|
+
# 2. Verify consistency
|
|
98
|
+
bash scripts/verify-consistency.sh
|
|
99
|
+
|
|
100
|
+
# 3. Verify build
|
|
101
|
+
npm run build
|
|
102
|
+
|
|
103
|
+
# 4. Check CHANGELOG has entry for current version
|
|
104
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
105
|
+
grep -q "## \[$VERSION\]" CHANGELOG.md || echo "ERROR: No CHANGELOG entry for version $VERSION"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Rule 3: Component Naming Convention
|
|
111
|
+
|
|
112
|
+
**Library components MUST use UI prefix to distinguish from shadcn components.**
|
|
113
|
+
|
|
114
|
+
### Correct Names (src/components/library/ui/)
|
|
115
|
+
```
|
|
116
|
+
UIButton.tsx ✅
|
|
117
|
+
UIInput.tsx ✅
|
|
118
|
+
UIText.tsx ✅
|
|
119
|
+
UICard.tsx ✅
|
|
120
|
+
UIChip.tsx ✅
|
|
121
|
+
UIContainer.tsx ✅
|
|
122
|
+
UIToggle.tsx ✅
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Incorrect Names (DO NOT USE)
|
|
126
|
+
```
|
|
127
|
+
Button.tsx ❌ (Reserved for outer app shadcn)
|
|
128
|
+
Input.tsx ❌ (Reserved for outer app shadcn)
|
|
129
|
+
Text.tsx ❌ (Use UIText.tsx)
|
|
130
|
+
Card.tsx ❌ (Use UICard.tsx)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Why This Matters
|
|
134
|
+
|
|
135
|
+
From `.a4drules/skills/component-library/common-mistakes.md`:
|
|
136
|
+
|
|
137
|
+
> "shadcn components (`Button`, `Card`, `Input`, `Select`, `Alert`, `Skeleton`, etc.) exist for the outer app only. In command center pages, use the equivalent library component (`UIButton`, `BaseCard`/`WidgetCard`, `UIInput`, `Select`, `Alert`, `Skeleton`, etc. from `@/components/library`)"
|
|
138
|
+
|
|
139
|
+
**Shadcn naming = Outer application shell**
|
|
140
|
+
**UI prefix = Command center library components**
|
|
141
|
+
|
|
142
|
+
This distinction prevents naming collisions and makes it clear which components are for which purpose.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Rule 4: Templates Must Match Documentation
|
|
147
|
+
|
|
148
|
+
**Templates in `src/templates/` MUST import components using names from `.a4drules/skills/component-library/`.**
|
|
149
|
+
|
|
150
|
+
### Correct Template Imports
|
|
151
|
+
```tsx
|
|
152
|
+
// ✅ CORRECT - Matches ui-primitives.md
|
|
153
|
+
import UIButton from '@/components/library/ui/UIButton';
|
|
154
|
+
import UIInput from '@/components/library/ui/UIInput';
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Incorrect Template Imports
|
|
158
|
+
```tsx
|
|
159
|
+
// ❌ WRONG - Does not match documentation
|
|
160
|
+
import Button from '@/components/library/ui/Button';
|
|
161
|
+
import Input from '@/components/library/ui/Input';
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Verification
|
|
165
|
+
```bash
|
|
166
|
+
# Check all templates for correct imports
|
|
167
|
+
grep -r "from '@/components/library/ui/UIButton'" src/templates/
|
|
168
|
+
grep -r "from '@/components/library/ui/UIInput'" src/templates/
|
|
169
|
+
|
|
170
|
+
# Verify no incorrect imports exist
|
|
171
|
+
! grep -r "from '@/components/library/ui/Button'" src/templates/
|
|
172
|
+
! grep -r "from '@/components/library/ui/Input'" src/templates/
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Rule 5: Never Publish Without Testing
|
|
178
|
+
|
|
179
|
+
**Every version MUST be tested with the postinstall script before publishing.**
|
|
180
|
+
|
|
181
|
+
### Test Process
|
|
182
|
+
|
|
183
|
+
1. **Build the package**
|
|
184
|
+
```bash
|
|
185
|
+
npm run build
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
2. **Pack the package**
|
|
189
|
+
```bash
|
|
190
|
+
npm pack
|
|
191
|
+
# Creates schandlergarcia-sf-web-components-1.9.x.tgz
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
3. **Test in fresh directory**
|
|
195
|
+
```bash
|
|
196
|
+
# Create test environment
|
|
197
|
+
mkdir -p /tmp/test-sf-components
|
|
198
|
+
cd /tmp/test-sf-components
|
|
199
|
+
|
|
200
|
+
# Minimal package.json
|
|
201
|
+
cat > package.json << 'EOF'
|
|
202
|
+
{
|
|
203
|
+
"name": "test-project",
|
|
204
|
+
"version": "1.0.0",
|
|
205
|
+
"type": "module"
|
|
206
|
+
}
|
|
207
|
+
EOF
|
|
208
|
+
|
|
209
|
+
# Install from tarball
|
|
210
|
+
npm install /path/to/schandlergarcia-sf-web-components-1.9.x.tgz
|
|
211
|
+
|
|
212
|
+
# Verify files copied correctly
|
|
213
|
+
ls src/components/library/ui/UIButton.tsx || echo "ERROR: UIButton not copied"
|
|
214
|
+
ls src/components/library/ui/UIInput.tsx || echo "ERROR: UIInput not copied"
|
|
215
|
+
ls src/pages/NotFound.tsx || echo "ERROR: NotFound template not copied"
|
|
216
|
+
|
|
217
|
+
# Verify imports in NotFound
|
|
218
|
+
grep "UIButton" src/pages/NotFound.tsx || echo "ERROR: NotFound doesn't import UIButton"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
4. **Only publish if test passes**
|
|
222
|
+
```bash
|
|
223
|
+
# If test passed, publish
|
|
224
|
+
npm publish
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Rule 6: File Extensions Matter
|
|
230
|
+
|
|
231
|
+
**Use TypeScript (.tsx) for all new components.**
|
|
232
|
+
|
|
233
|
+
### Preferred Extensions
|
|
234
|
+
```
|
|
235
|
+
UIButton.tsx ✅ TypeScript with JSX
|
|
236
|
+
UIInput.tsx ✅ TypeScript with JSX
|
|
237
|
+
types.ts ✅ TypeScript types
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Discouraged Extensions
|
|
241
|
+
```
|
|
242
|
+
Button.jsx ❌ JavaScript (use TypeScript)
|
|
243
|
+
utils.js ❌ JavaScript (use TypeScript)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### When to Use .jsx
|
|
247
|
+
Only when maintaining existing JavaScript components that haven't been migrated to TypeScript yet.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Rule 7: Version Control for Critical Changes
|
|
252
|
+
|
|
253
|
+
**Component renames, removals, or breaking API changes MUST be thoroughly documented.**
|
|
254
|
+
|
|
255
|
+
### Required Information
|
|
256
|
+
|
|
257
|
+
1. **What changed**
|
|
258
|
+
- Old name → New name
|
|
259
|
+
- Old API → New API
|
|
260
|
+
|
|
261
|
+
2. **Why it changed**
|
|
262
|
+
- Reason for the change
|
|
263
|
+
- Problem being solved
|
|
264
|
+
|
|
265
|
+
3. **How to migrate**
|
|
266
|
+
- Step-by-step instructions
|
|
267
|
+
- Code examples (before/after)
|
|
268
|
+
|
|
269
|
+
4. **Affected versions**
|
|
270
|
+
- First broken version
|
|
271
|
+
- First fixed version
|
|
272
|
+
|
|
273
|
+
5. **Testing evidence**
|
|
274
|
+
- Commands run to verify
|
|
275
|
+
- Output of verification scripts
|
|
276
|
+
|
|
277
|
+
### Example Documentation
|
|
278
|
+
|
|
279
|
+
```markdown
|
|
280
|
+
## Component Rename: Button → UIButton
|
|
281
|
+
|
|
282
|
+
### What Changed
|
|
283
|
+
- File renamed: Button.jsx → UIButton.tsx
|
|
284
|
+
- Import path: '@/components/library/ui/Button' → '@/components/library/ui/UIButton'
|
|
285
|
+
- Export name: Button → UIButton
|
|
286
|
+
|
|
287
|
+
### Why
|
|
288
|
+
- Shadcn component names (Button, Input) are reserved for outer app
|
|
289
|
+
- Library components need UI prefix for distinction
|
|
290
|
+
- Documented requirement in .a4drules/skills/component-library/
|
|
291
|
+
|
|
292
|
+
### Migration
|
|
293
|
+
\`\`\`tsx
|
|
294
|
+
// Before
|
|
295
|
+
import { Button } from '@/components/library';
|
|
296
|
+
|
|
297
|
+
// After
|
|
298
|
+
import { UIButton } from '@/components/library';
|
|
299
|
+
|
|
300
|
+
// Usage (unchanged)
|
|
301
|
+
<UIButton variant="primary">Click Me</UIButton>
|
|
302
|
+
\`\`\`
|
|
303
|
+
|
|
304
|
+
### Affected Versions
|
|
305
|
+
- Broken: v1.9.29 - v1.9.42
|
|
306
|
+
- Fixed: v1.9.43
|
|
307
|
+
|
|
308
|
+
### Verification
|
|
309
|
+
\`\`\`bash
|
|
310
|
+
bash scripts/verify-consistency.sh
|
|
311
|
+
npm run build
|
|
312
|
+
\`\`\`
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Rule 8: AI Assistant Guidelines
|
|
318
|
+
|
|
319
|
+
**When an AI assistant (like Claude) is working on this project:**
|
|
320
|
+
|
|
321
|
+
### Must Do
|
|
322
|
+
1. ✅ Read `.a4drules/skills/component-library/` before making any component changes
|
|
323
|
+
2. ✅ Run `bash scripts/verify-consistency.sh` before suggesting changes
|
|
324
|
+
3. ✅ Update CHANGELOG.md in the same commit as code changes
|
|
325
|
+
4. ✅ Verify templates import components correctly
|
|
326
|
+
5. ✅ Explain why a change matches the documented requirements
|
|
327
|
+
|
|
328
|
+
### Must Not Do
|
|
329
|
+
1. ❌ Rename components without checking documentation first
|
|
330
|
+
2. ❌ Use shadcn names (Button, Input) in library/ui/
|
|
331
|
+
3. ❌ Publish without updating CHANGELOG.md
|
|
332
|
+
4. ❌ Skip verification scripts
|
|
333
|
+
5. ❌ Make assumptions about naming conventions
|
|
334
|
+
|
|
335
|
+
### If Uncertain
|
|
336
|
+
1. Check `.a4drules/skills/component-library/ui-primitives.md`
|
|
337
|
+
2. Check CHANGELOG.md for historical context
|
|
338
|
+
3. Check golden version (v1.9.25-1.9.28) for reference
|
|
339
|
+
4. Ask before making breaking changes
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Rule 9: Golden Version Reference
|
|
344
|
+
|
|
345
|
+
**Versions 1.9.25-1.9.28 are the golden reference.**
|
|
346
|
+
|
|
347
|
+
When in doubt about:
|
|
348
|
+
- Component names
|
|
349
|
+
- File structure
|
|
350
|
+
- Import patterns
|
|
351
|
+
- Documentation format
|
|
352
|
+
|
|
353
|
+
Reference these versions:
|
|
354
|
+
```bash
|
|
355
|
+
# View golden version on npm
|
|
356
|
+
npm view @schandlergarcia/sf-web-components@1.9.28
|
|
357
|
+
|
|
358
|
+
# Check working example
|
|
359
|
+
ls /Users/stephan.garcia/reactapp4/src/components/library/ui/
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Rule 10: Pre-Commit Verification
|
|
365
|
+
|
|
366
|
+
**Before every commit, verify consistency.**
|
|
367
|
+
|
|
368
|
+
### Recommended Git Hook
|
|
369
|
+
|
|
370
|
+
Create `.git/hooks/pre-commit`:
|
|
371
|
+
```bash
|
|
372
|
+
#!/bin/bash
|
|
373
|
+
# Pre-commit hook to verify consistency
|
|
374
|
+
|
|
375
|
+
echo "Running consistency checks..."
|
|
376
|
+
|
|
377
|
+
# Check if verify script exists and run it
|
|
378
|
+
if [ -f "scripts/verify-consistency.sh" ]; then
|
|
379
|
+
bash scripts/verify-consistency.sh
|
|
380
|
+
if [ $? -ne 0 ]; then
|
|
381
|
+
echo "❌ Consistency checks failed. Fix errors before committing."
|
|
382
|
+
exit 1
|
|
383
|
+
fi
|
|
384
|
+
fi
|
|
385
|
+
|
|
386
|
+
# Check if CHANGELOG was updated (for src/ changes)
|
|
387
|
+
if git diff --cached --name-only | grep -q "^src/"; then
|
|
388
|
+
if ! git diff --cached --name-only | grep -q "CHANGELOG.md"; then
|
|
389
|
+
echo "⚠️ WARNING: You modified src/ but didn't update CHANGELOG.md"
|
|
390
|
+
echo "Please update CHANGELOG.md before committing."
|
|
391
|
+
exit 1
|
|
392
|
+
fi
|
|
393
|
+
fi
|
|
394
|
+
|
|
395
|
+
echo "✅ Pre-commit checks passed"
|
|
396
|
+
exit 0
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Make it executable:
|
|
400
|
+
```bash
|
|
401
|
+
chmod +x .git/hooks/pre-commit
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## Enforcement
|
|
407
|
+
|
|
408
|
+
These rules are **mandatory**, not suggestions.
|
|
409
|
+
|
|
410
|
+
**Violations will result in:**
|
|
411
|
+
- ❌ Broken consuming applications
|
|
412
|
+
- ❌ Difficult-to-debug import errors
|
|
413
|
+
- ❌ Lost development time
|
|
414
|
+
- ❌ Frustrated users
|
|
415
|
+
|
|
416
|
+
**Following these rules ensures:**
|
|
417
|
+
- ✅ Consistent, predictable behavior
|
|
418
|
+
- ✅ Easy debugging and maintenance
|
|
419
|
+
- ✅ Clear documentation trail
|
|
420
|
+
- ✅ Smooth upgrades for consumers
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Questions or Concerns?
|
|
425
|
+
|
|
426
|
+
If you believe a rule should be changed:
|
|
427
|
+
|
|
428
|
+
1. Document your reasoning in an issue or discussion
|
|
429
|
+
2. Provide evidence (examples, use cases)
|
|
430
|
+
3. Propose specific changes to the rule
|
|
431
|
+
4. Update CONTRIBUTING.md if rule is changed
|
|
432
|
+
5. Update this file (RULES.md) to reflect new rule
|
|
433
|
+
|
|
434
|
+
**Do NOT:**
|
|
435
|
+
- Ignore rules because they seem inconvenient
|
|
436
|
+
- Make exceptions without documentation
|
|
437
|
+
- Assume rules don't apply to your changes
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## Summary Checklist
|
|
442
|
+
|
|
443
|
+
Before publishing any version:
|
|
444
|
+
|
|
445
|
+
- [ ] Code matches `.a4drules/skills/component-library/` documentation
|
|
446
|
+
- [ ] CHANGELOG.md updated with all changes
|
|
447
|
+
- [ ] `bash scripts/verify-consistency.sh` passes
|
|
448
|
+
- [ ] `npm run build` succeeds
|
|
449
|
+
- [ ] Postinstall tested in fresh directory
|
|
450
|
+
- [ ] Component names use UI prefix (not shadcn names)
|
|
451
|
+
- [ ] Templates import components correctly
|
|
452
|
+
- [ ] File extensions are .tsx (TypeScript)
|
|
453
|
+
- [ ] Version number in package.json
|
|
454
|
+
- [ ] Git commit includes CHANGELOG changes
|
|
455
|
+
|
|
456
|
+
**All boxes must be checked before running `npm publish`.**
|
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Architecture & Source of Truth
|
|
2
|
+
|
|
3
|
+
This document defines the authoritative sources for all components, templates, and documentation in this package.
|
|
4
|
+
|
|
5
|
+
## Core Principle: Documentation is the Contract
|
|
6
|
+
|
|
7
|
+
**The `.a4drules/skills/component-library/` documentation is the authoritative source of truth.**
|
|
8
|
+
|
|
9
|
+
- Component names in code MUST match the names in `.a4drules/skills/component-library/ui-primitives.md`
|
|
10
|
+
- Templates MUST import components using the exact names from the documentation
|
|
11
|
+
- If documentation says `UIButton`, the file MUST be `UIButton.tsx` (not `Button.jsx` or `Button.tsx`)
|
|
12
|
+
- If documentation says `UIInput`, the file MUST be `UIInput.tsx` (not `Input.jsx` or `Input.tsx`)
|
|
13
|
+
|
|
14
|
+
**Never change component names without updating the documentation first.**
|
|
15
|
+
|
|
16
|
+
## Component Naming Convention
|
|
17
|
+
|
|
18
|
+
### Library Components (src/components/library/ui/)
|
|
19
|
+
|
|
20
|
+
Library components use the **UI prefix** to distinguish them from shadcn/outer app components:
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
// ✅ CORRECT - Library components (for command centers/dashboards)
|
|
24
|
+
UIButton.tsx // Not Button.tsx or Button.jsx
|
|
25
|
+
UIInput.tsx // Not Input.tsx or Input.jsx
|
|
26
|
+
UIText.tsx
|
|
27
|
+
UICard.tsx
|
|
28
|
+
UIChip.tsx
|
|
29
|
+
UIContainer.tsx
|
|
30
|
+
UIToggle.tsx
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Shadcn/Outer App Components
|
|
34
|
+
|
|
35
|
+
Plain names (no prefix) are reserved for the consuming application's outer shell:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
// ❌ DO NOT use these names in src/components/library/ui/
|
|
39
|
+
Button.tsx // Reserved for outer app
|
|
40
|
+
Input.tsx // Reserved for outer app
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### HeroUI Wrapper Components (src/components/library/heroui/)
|
|
44
|
+
|
|
45
|
+
HeroUI wrappers use the **HeroUI prefix** for advanced components:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
// ✅ CORRECT - HeroUI wrappers
|
|
49
|
+
HeroUIButton.tsx
|
|
50
|
+
HeroUIInput.tsx
|
|
51
|
+
HeroUIModal.tsx
|
|
52
|
+
HeroUITabs.tsx
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## File Structure Master Reference
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
sf-web-components/
|
|
59
|
+
├── .a4drules/
|
|
60
|
+
│ ├── skills/
|
|
61
|
+
│ │ └── component-library/ # 📚 SOURCE OF TRUTH for component contracts
|
|
62
|
+
│ │ ├── SKILL.md # Overview and import patterns
|
|
63
|
+
│ │ ├── ui-primitives.md # UIButton, UIInput, Avatar, etc.
|
|
64
|
+
│ │ ├── card-components.md # MetricCard, ChartCard, etc.
|
|
65
|
+
│ │ ├── charts.md
|
|
66
|
+
│ │ ├── forms-filters.md
|
|
67
|
+
│ │ ├── chat-data.md
|
|
68
|
+
│ │ ├── hero-ui.md
|
|
69
|
+
│ │ ├── common-mistakes.md # Errors to avoid
|
|
70
|
+
│ │ └── when-to-use.md
|
|
71
|
+
│ └── features/
|
|
72
|
+
│
|
|
73
|
+
├── src/
|
|
74
|
+
│ ├── components/
|
|
75
|
+
│ │ ├── library/ # 📦 IMPLEMENTATION - must match .a4drules docs
|
|
76
|
+
│ │ │ ├── index.jsx # Barrel export - exports all components
|
|
77
|
+
│ │ │ ├── ui/ # UI primitives (UIButton, UIInput, etc.)
|
|
78
|
+
│ │ │ ├── cards/ # Card components (MetricCard, etc.)
|
|
79
|
+
│ │ │ ├── charts/ # Chart components (D3Chart, GeoMap)
|
|
80
|
+
│ │ │ ├── forms/ # Form components
|
|
81
|
+
│ │ │ ├── filters/ # Filter components
|
|
82
|
+
│ │ │ ├── chat/ # Chat/AI components
|
|
83
|
+
│ │ │ ├── data/ # Data utilities
|
|
84
|
+
│ │ │ ├── layout/ # Layout components
|
|
85
|
+
│ │ │ ├── heroui/ # HeroUI wrappers
|
|
86
|
+
│ │ │ ├── theme/ # Theme provider
|
|
87
|
+
│ │ │ └── skeletons/ # Loading states
|
|
88
|
+
│ │ │
|
|
89
|
+
│ │ └── workspace/
|
|
90
|
+
│ │ └── ComponentRegistry.jsx # Auto-discovery for command center
|
|
91
|
+
│ │
|
|
92
|
+
│ ├── templates/ # 📄 TEMPLATES - must import from .a4drules-documented names
|
|
93
|
+
│ │ ├── pages/ # Page templates
|
|
94
|
+
│ │ │ ├── Home.tsx.template
|
|
95
|
+
│ │ │ ├── Search.tsx.template
|
|
96
|
+
│ │ │ ├── NotFound.tsx.template
|
|
97
|
+
│ │ │ └── BlankDashboard.tsx.template
|
|
98
|
+
│ │ ├── workspace/
|
|
99
|
+
│ │ │ └── CommandCenter.tsx.template
|
|
100
|
+
│ │ └── config/
|
|
101
|
+
│ │ └── routes.tsx.template
|
|
102
|
+
│ │
|
|
103
|
+
│ ├── lib/ # Utilities (cn, utils)
|
|
104
|
+
│ ├── types/ # TypeScript types
|
|
105
|
+
│ └── styles/ # CSS files
|
|
106
|
+
│
|
|
107
|
+
├── scripts/
|
|
108
|
+
│ ├── postinstall.mjs # 🔧 Copies components & templates to consuming projects
|
|
109
|
+
│ ├── reset-command-center.sh # Resets CommandCenter to template
|
|
110
|
+
│ └── validate-dashboard.sh # Validates dashboard compliance
|
|
111
|
+
│
|
|
112
|
+
└── data/ # Sample data for demos
|