@schandlergarcia/sf-web-components 1.9.25 → 1.9.27
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.
|
@@ -13,6 +13,10 @@ These rules are non-negotiable for all dashboard files in `src/pages/` and works
|
|
|
13
13
|
|
|
14
14
|
You MUST load the **command-center-builder** and **component-library** skills before writing or editing dashboard pages. These skills contain the full component API reference and builder rules. Do not proceed without them.
|
|
15
15
|
|
|
16
|
+
## When writing files
|
|
17
|
+
|
|
18
|
+
**Write COMPLETE files only.** Every file you write must be syntactically valid from the first import to the final closing brace. Do NOT stop writing mid-file, mid-function, or mid-line. Every opened JSX tag must be closed. Every opened string must be closed. Every className attribute must be complete. Incomplete files cause build failures.
|
|
19
|
+
|
|
16
20
|
## Critical constraints
|
|
17
21
|
|
|
18
22
|
1. **File extension MUST be `.tsx`** — This is a TypeScript project. All React components MUST use `.tsx` extension, never `.jsx`. All type definitions are available from the component library.
|
|
@@ -15,7 +15,7 @@ These rules apply when building dashboards rendered by `CommandCenter.tsx`. For
|
|
|
15
15
|
|
|
16
16
|
**Every time you build a dashboard, you MUST follow these non-negotiable rules. Violations are the #1 cause of rejected dashboards.**
|
|
17
17
|
|
|
18
|
-
1. **Actually write files to disk.** Use the file-writing tools to create `.tsx` files (NOT `.jsx`) in `src/pages/` and update `CommandCenter.tsx` to import your dashboard. This is a TypeScript project - all React components MUST use `.tsx` extension. If you only describe what you would build without creating the files, the dashboard will not render. Verify the files exist after writing them.
|
|
18
|
+
1. **Actually write COMPLETE files to disk.** Use the file-writing tools to create `.tsx` files (NOT `.jsx`) in `src/pages/` and update `CommandCenter.tsx` to import your dashboard. This is a TypeScript project - all React components MUST use `.tsx` extension. **CRITICAL: Write the ENTIRE file from import statements through the closing brace `}` of the export statement. Do NOT stop mid-file, mid-function, or mid-line. Every JSX tag you open must be closed. Every string you open must be closed. Every className attribute must be complete.** If you only describe what you would build without creating the files, the dashboard will not render. Verify the files exist after writing them.
|
|
19
19
|
|
|
20
20
|
2. **Use ONLY library components** from `@/components/library` for all cards, charts, tables, lists, and feeds. The library has 30+ components — there is no reason to hand-roll HTML. See the component table below.
|
|
21
21
|
|
package/README.md
CHANGED
|
@@ -57,13 +57,13 @@ The postinstall script automatically:
|
|
|
57
57
|
- Chat components (message UI, typing indicators, suggestions)
|
|
58
58
|
|
|
59
59
|
✅ **Installs complete routes configuration** at `src/routes.tsx`
|
|
60
|
-
- Home
|
|
60
|
+
- `/` (Home) - Renders CommandCenter (dashboard wrapper)
|
|
61
61
|
- `/accounts` - Account search with filters and sorting
|
|
62
62
|
- `/accounts/:recordId` - Account detail page
|
|
63
|
-
- NotFound page
|
|
63
|
+
- `*` (NotFound) - 404 error page
|
|
64
64
|
|
|
65
65
|
✅ **Installs 4 page templates** to `src/pages/`
|
|
66
|
-
- `Home.tsx` -
|
|
66
|
+
- `Home.tsx` - Renders CommandCenter (dashboard wrapper)
|
|
67
67
|
- `NotFound.tsx` - 404 error page
|
|
68
68
|
- `Search.tsx` - Generic search page
|
|
69
69
|
- `BlankDashboard.tsx` - Empty dashboard template
|
|
@@ -77,6 +77,63 @@ The postinstall script automatically:
|
|
|
77
77
|
✅ **Installs workspace components** to `src/components/workspace/`
|
|
78
78
|
- `CommandCenter.tsx` - Dashboard wrapper with theme and data providers
|
|
79
79
|
|
|
80
|
+
✅ **Adds npm scripts** to your `package.json`
|
|
81
|
+
- `reset:command-center` - Reset to blank dashboard state
|
|
82
|
+
- `validate:dashboard` - Validate dashboard files against rules
|
|
83
|
+
|
|
84
|
+
✅ **Copies AI assistant rules** to project root `.a4drules/`
|
|
85
|
+
- `skills/` - Step-by-step guides for AI assistants (Agentforce, Claude, etc.)
|
|
86
|
+
- `features/` - Feature-specific implementation rules
|
|
87
|
+
- Enables AI assistants to build dashboards correctly
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Building Dashboards
|
|
92
|
+
|
|
93
|
+
### With AI Assistants (Agentforce, Claude, etc.)
|
|
94
|
+
|
|
95
|
+
After installation, AI assistants can build complete dashboards for you:
|
|
96
|
+
|
|
97
|
+
**Example prompt:**
|
|
98
|
+
```
|
|
99
|
+
Build me a Fleet Management Command Center dashboard with:
|
|
100
|
+
- KPI metrics for total vehicles, active trips, maintenance alerts
|
|
101
|
+
- World map showing vehicle locations
|
|
102
|
+
- List of recent trips
|
|
103
|
+
- Status panel for vehicle health
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The AI assistant will:
|
|
107
|
+
1. ✅ Load the command-center-builder skill
|
|
108
|
+
2. ✅ Create `src/pages/FleetDashboard.tsx` (complete, valid TypeScript)
|
|
109
|
+
3. ✅ Update `CommandCenter.tsx` to import it
|
|
110
|
+
4. ✅ Update `Home.tsx` to render CommandCenter
|
|
111
|
+
5. ✅ Run `npm run validate:dashboard` and fix all errors
|
|
112
|
+
6. ✅ Report when complete
|
|
113
|
+
|
|
114
|
+
**Result:** Working dashboard at `/` using only library components.
|
|
115
|
+
|
|
116
|
+
### Manual Dashboard Development
|
|
117
|
+
|
|
118
|
+
If you prefer to build dashboards manually:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# 1. Create your dashboard file
|
|
122
|
+
touch src/pages/MyDashboard.tsx
|
|
123
|
+
|
|
124
|
+
# 2. Import and use library components
|
|
125
|
+
# (see examples below)
|
|
126
|
+
|
|
127
|
+
# 3. Wire it to CommandCenter
|
|
128
|
+
# Edit src/components/workspace/CommandCenter.tsx
|
|
129
|
+
|
|
130
|
+
# 4. Update Home to render CommandCenter
|
|
131
|
+
# Edit src/pages/Home.tsx
|
|
132
|
+
|
|
133
|
+
# 5. Validate your work
|
|
134
|
+
npm run validate:dashboard
|
|
135
|
+
```
|
|
136
|
+
|
|
80
137
|
---
|
|
81
138
|
|
|
82
139
|
## Using the Dashboard Framework
|
|
@@ -289,12 +346,12 @@ npm install
|
|
|
289
346
|
npm run build
|
|
290
347
|
```
|
|
291
348
|
|
|
292
|
-
### Reset Command Center
|
|
349
|
+
### Reset Command Center
|
|
293
350
|
|
|
294
351
|
This script resets any app back to the blank dashboard baseline state:
|
|
295
352
|
|
|
296
353
|
```bash
|
|
297
|
-
#
|
|
354
|
+
# Reset the command center to the blank dashboard template
|
|
298
355
|
npm run reset:command-center
|
|
299
356
|
|
|
300
357
|
# Or run directly:
|
|
@@ -302,15 +359,40 @@ bash node_modules/@schandlergarcia/sf-web-components/scripts/reset-command-cente
|
|
|
302
359
|
```
|
|
303
360
|
|
|
304
361
|
**What it does:**
|
|
305
|
-
- Removes custom dashboard pages
|
|
306
|
-
- Reinstalls BlankDashboard.tsx with EmptyState
|
|
307
|
-
- Resets CommandCenter.tsx (preserves theme mode)
|
|
308
|
-
- Updates Home.tsx to render search interface
|
|
309
|
-
- Creates Search.tsx for search interface
|
|
310
|
-
- Resets routes to baseline configuration
|
|
311
|
-
- Preserves: component library, authentication, all dependencies
|
|
362
|
+
- Removes custom dashboard pages from `src/pages/` (EngineDashboard.tsx, FleetDashboard.tsx, etc.)
|
|
363
|
+
- Reinstalls BlankDashboard.tsx with EmptyState ("Bespoke App Template" message)
|
|
364
|
+
- Resets CommandCenter.tsx to import BlankDashboard (preserves theme mode)
|
|
365
|
+
- Updates Home.tsx to render search interface (not CommandCenter)
|
|
366
|
+
- Creates Search.tsx for search interface
|
|
367
|
+
- Resets routes.tsx to baseline configuration
|
|
368
|
+
- Preserves: component library, workspace files, authentication, all dependencies
|
|
369
|
+
|
|
370
|
+
**Result:** Home route (`/`) displays the search interface. CommandCenter exists but is not wired to any route until you create a dashboard.
|
|
371
|
+
|
|
372
|
+
### Validate Dashboard
|
|
373
|
+
|
|
374
|
+
After building a dashboard, validate it meets all requirements:
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
# Run the dashboard validator
|
|
378
|
+
npm run validate:dashboard
|
|
379
|
+
|
|
380
|
+
# Or run directly:
|
|
381
|
+
bash node_modules/@schandlergarcia/sf-web-components/scripts/validate-dashboard.sh
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**What it checks:**
|
|
385
|
+
- Files use `.tsx` extension (not `.jsx`)
|
|
386
|
+
- CommandCenter.tsx imports a real dashboard (not BlankDashboard)
|
|
387
|
+
- No hand-rolled HTML cards (must use library components)
|
|
388
|
+
- No forbidden colors (`text-white`, `text-black`, `bg-black`)
|
|
389
|
+
- No inline `style={{}}` or `<style>` tags
|
|
390
|
+
- Dashboard uses `useDataSource` for sample/live data
|
|
391
|
+
- No navigation elements (`<nav>`) inside dashboard
|
|
392
|
+
- Max 4 metrics per row
|
|
393
|
+
- All JSX tags properly closed
|
|
312
394
|
|
|
313
|
-
**
|
|
395
|
+
**Exit codes:** 0 = pass, 1 = errors found (must fix before dashboard is complete)
|
|
314
396
|
|
|
315
397
|
---
|
|
316
398
|
|
|
@@ -378,16 +460,20 @@ Available npm scripts in the consuming application:
|
|
|
378
460
|
|
|
379
461
|
```bash
|
|
380
462
|
# Development
|
|
381
|
-
npm run dev
|
|
382
|
-
npm run build
|
|
383
|
-
npm run lint
|
|
463
|
+
npm run dev # Start Vite dev server
|
|
464
|
+
npm run build # TypeScript check + Vite build
|
|
465
|
+
npm run lint # Run ESLint
|
|
466
|
+
|
|
467
|
+
# Dashboard Development
|
|
468
|
+
npm run reset:command-center # Reset to blank dashboard state
|
|
469
|
+
npm run validate:dashboard # Validate dashboard files against rules
|
|
384
470
|
|
|
385
471
|
# GraphQL (if using)
|
|
386
|
-
npm run graphql:schema
|
|
387
|
-
npm run graphql:codegen
|
|
472
|
+
npm run graphql:schema # Fetch GraphQL schema from Salesforce org
|
|
473
|
+
npm run graphql:codegen # Generate TypeScript types from schema
|
|
388
474
|
|
|
389
475
|
# Testing
|
|
390
|
-
npm run test
|
|
476
|
+
npm run test # Run Vitest tests
|
|
391
477
|
```
|
|
392
478
|
|
|
393
479
|
---
|
|
@@ -402,50 +488,76 @@ For detailed component API documentation, see:
|
|
|
402
488
|
|
|
403
489
|
## Version History
|
|
404
490
|
|
|
405
|
-
### Latest: v1.9.
|
|
406
|
-
- Fixed
|
|
407
|
-
-
|
|
491
|
+
### Latest: v1.9.26 (2026-03-29)
|
|
492
|
+
- **Fixed:** AI assistant file truncation (explicit "write complete files" rule)
|
|
493
|
+
- Dashboard validator now requires `.tsx` files (not `.jsx`)
|
|
494
|
+
- Postinstall adds `validate:dashboard` script to package.json
|
|
495
|
+
|
|
496
|
+
### v1.9.25 (2026-03-29)
|
|
497
|
+
- **Fixed:** Dashboard validator paths (`src/pages/` not `src/components/pages/`)
|
|
498
|
+
- **Fixed:** Validator file extension check (`.tsx` required, `.jsx` is error)
|
|
499
|
+
- Postinstall adds both `reset:command-center` and `validate:dashboard` scripts
|
|
408
500
|
|
|
409
|
-
### v1.9.
|
|
410
|
-
-
|
|
411
|
-
-
|
|
501
|
+
### v1.9.24 (2026-03-29)
|
|
502
|
+
- **Fixed:** Home.tsx to render CommandCenter (not search interface)
|
|
503
|
+
- AI rules updated with explicit Step 2.5 for updating Home.tsx
|
|
504
|
+
- Strengthened rule #15 in dashboard feature rules
|
|
412
505
|
|
|
413
|
-
### v1.9.
|
|
414
|
-
- Fixed
|
|
415
|
-
-
|
|
506
|
+
### v1.9.23 (2026-03-29)
|
|
507
|
+
- **Fixed:** Postinstall now copies `.md` files (skills were being skipped)
|
|
508
|
+
- AI assistant rules now properly installed to project root `.a4drules/`
|
|
416
509
|
|
|
417
|
-
### v1.9.
|
|
418
|
-
-
|
|
419
|
-
-
|
|
510
|
+
### v1.9.22 (2026-03-29)
|
|
511
|
+
- Added automatic `.a4drules` copying to project root for AI assistant discovery
|
|
512
|
+
- Copies `skills/` and `features/` directories during postinstall
|
|
420
513
|
|
|
421
|
-
### v1.9.
|
|
422
|
-
-
|
|
423
|
-
-
|
|
514
|
+
### v1.9.21 (2026-03-29)
|
|
515
|
+
- Added automatic dashboard file migration from old location to new location
|
|
516
|
+
- Migrates `src/components/pages/*.jsx` → `src/pages/*.tsx`
|
|
517
|
+
|
|
518
|
+
### v1.9.20 (2026-03-29)
|
|
519
|
+
- **Fixed:** SKILL.md paths corrected to `src/pages/` (not `src/components/pages/`)
|
|
520
|
+
- All examples updated with correct file locations and imports
|
|
521
|
+
|
|
522
|
+
### v1.9.19 (2026-03-29)
|
|
523
|
+
- **Fixed:** File extension rule strengthened to MUST be `.tsx` (not "should")
|
|
524
|
+
- Dashboard feature rules updated with no exceptions for `.jsx`
|
|
424
525
|
|
|
425
526
|
See [CHANGELOG.md](./CHANGELOG.md) for full version history.
|
|
426
527
|
|
|
427
528
|
---
|
|
428
529
|
|
|
429
|
-
## 🤖 AI
|
|
530
|
+
## 🤖 AI Assistant Rules
|
|
531
|
+
|
|
532
|
+
This package includes comprehensive rules for AI assistants (Agentforce, Claude, etc.) to build dashboards correctly.
|
|
533
|
+
|
|
534
|
+
During postinstall, rules are copied to your **project root** at `.a4drules/`:
|
|
535
|
+
- **skills/** - Step-by-step implementation guides
|
|
536
|
+
- `command-center-builder/` - Dashboard building rules
|
|
537
|
+
- `component-library/` - Component API reference
|
|
538
|
+
- And more...
|
|
539
|
+
- **features/** - Automatic rules that apply to specific files
|
|
540
|
+
- `command-center-dashboard-rule.md` - Applies to `src/pages/*.tsx` and `CommandCenter.tsx`
|
|
430
541
|
|
|
431
|
-
|
|
542
|
+
### How AI Assistants Use These Rules
|
|
432
543
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
544
|
+
When building dashboards, AI assistants:
|
|
545
|
+
1. **Auto-load feature rules** when editing matching file paths
|
|
546
|
+
2. **Follow explicit steps** from skill guides (create file → wire CommandCenter → update Home)
|
|
547
|
+
3. **Validate** against requirements (`.tsx` only, no hand-rolled HTML, complete files)
|
|
548
|
+
4. **Self-check** with `npm run validate:dashboard` before reporting done
|
|
437
549
|
|
|
438
|
-
###
|
|
550
|
+
### Key Rules AI Assistants Follow
|
|
439
551
|
|
|
440
|
-
|
|
441
|
-
-
|
|
442
|
-
-
|
|
443
|
-
-
|
|
444
|
-
-
|
|
552
|
+
- **File location:** `src/pages/MyDashboard.tsx` (TypeScript required)
|
|
553
|
+
- **File completeness:** Write entire file from imports to closing brace (no truncation)
|
|
554
|
+
- **Components:** Use library components only (no hand-rolled `<div>` cards)
|
|
555
|
+
- **Wiring:** Update CommandCenter.tsx → Home.tsx → routes.tsx
|
|
556
|
+
- **Validation:** Run `npm run validate:dashboard` and fix all errors before done
|
|
445
557
|
|
|
446
|
-
###
|
|
558
|
+
### For Human Developers
|
|
447
559
|
|
|
448
|
-
|
|
560
|
+
You can read these same rules at `.a4drules/skills/command-center-builder/SKILL.md` for the complete dashboard building guide.
|
|
449
561
|
|
|
450
562
|
---
|
|
451
563
|
|
package/package.json
CHANGED