siesa-agents 2.1.2 → 2.1.4
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/README.md +83 -83
- package/bin/install.js +400 -400
- package/bin/prepare-publish.js +26 -26
- package/bin/restore-folders.js +26 -26
- package/bmad-core/agent-teams/team-all.yaml +15 -15
- package/bmad-core/agent-teams/team-fullstack.yaml +19 -19
- package/bmad-core/agent-teams/team-ide-minimal.yaml +11 -11
- package/bmad-core/agent-teams/team-no-ui.yaml +14 -14
- package/bmad-core/agents/analyst.md +84 -84
- package/bmad-core/agents/architect.md +94 -94
- package/bmad-core/agents/backend-agent.md +189 -189
- package/bmad-core/agents/bmad-master.md +110 -110
- package/bmad-core/agents/bmad-orchestrator.md +147 -147
- package/bmad-core/agents/dev.md +81 -81
- package/bmad-core/agents/frontend-agent.md +168 -168
- package/bmad-core/agents/pm.md +84 -84
- package/bmad-core/agents/po.md +79 -79
- package/bmad-core/agents/qa.md +91 -91
- package/bmad-core/agents/sm.md +65 -65
- package/bmad-core/agents/ux-expert.md +69 -69
- package/bmad-core/checklists/architect-checklist.md +440 -440
- package/bmad-core/checklists/backend-checklist.md +142 -142
- package/bmad-core/checklists/change-checklist.md +184 -184
- package/bmad-core/checklists/frontend-checklist.md +105 -105
- package/bmad-core/checklists/pm-checklist.md +372 -372
- package/bmad-core/checklists/po-master-checklist.md +434 -434
- package/bmad-core/checklists/story-dod-checklist.md +96 -96
- package/bmad-core/checklists/story-draft-checklist.md +155 -155
- package/bmad-core/core-config.yaml +22 -22
- package/bmad-core/data/backend-standards.md +439 -439
- package/bmad-core/data/bmad-kb.md +809 -809
- package/bmad-core/data/brainstorming-techniques.md +38 -38
- package/bmad-core/data/elicitation-methods.md +156 -156
- package/bmad-core/data/frontend-standards.md +323 -323
- package/bmad-core/data/technical-preferences.md +5 -5
- package/bmad-core/data/test-levels-framework.md +148 -148
- package/bmad-core/data/test-priorities-matrix.md +174 -174
- package/bmad-core/enhanced-ide-development-workflow.md +248 -248
- package/bmad-core/install-manifest.yaml +230 -230
- package/bmad-core/tasks/advanced-elicitation.md +119 -119
- package/bmad-core/tasks/apply-qa-fixes.md +150 -150
- package/bmad-core/tasks/brownfield-create-epic.md +162 -162
- package/bmad-core/tasks/brownfield-create-story.md +149 -149
- package/bmad-core/tasks/correct-course.md +72 -72
- package/bmad-core/tasks/create-brownfield-story.md +314 -314
- package/bmad-core/tasks/create-component.md +102 -102
- package/bmad-core/tasks/create-deep-research-prompt.md +280 -280
- package/bmad-core/tasks/create-doc.md +103 -103
- package/bmad-core/tasks/create-entity.md +132 -132
- package/bmad-core/tasks/create-feature.md +90 -90
- package/bmad-core/tasks/create-next-story.md +114 -114
- package/bmad-core/tasks/create-service.md +117 -117
- package/bmad-core/tasks/create-use-case.md +140 -140
- package/bmad-core/tasks/document-project.md +345 -345
- package/bmad-core/tasks/execute-checklist.md +88 -88
- package/bmad-core/tasks/facilitate-brainstorming-session.md +138 -138
- package/bmad-core/tasks/generate-ai-frontend-prompt.md +53 -53
- package/bmad-core/tasks/index-docs.md +175 -175
- package/bmad-core/tasks/kb-mode-interaction.md +77 -77
- package/bmad-core/tasks/nfr-assess.md +345 -345
- package/bmad-core/tasks/qa-gate.md +163 -163
- package/bmad-core/tasks/review-story.md +316 -316
- package/bmad-core/tasks/risk-profile.md +355 -355
- package/bmad-core/tasks/scaffold-backend.md +110 -110
- package/bmad-core/tasks/scaffold-frontend.md +78 -78
- package/bmad-core/tasks/shard-doc.md +187 -187
- package/bmad-core/tasks/test-design.md +176 -176
- package/bmad-core/tasks/trace-requirements.md +266 -266
- package/bmad-core/tasks/validate-next-story.md +136 -136
- package/bmad-core/templates/architecture-tmpl.yaml +662 -662
- package/bmad-core/templates/brainstorming-output-tmpl.yaml +156 -156
- package/bmad-core/templates/brownfield-architecture-tmpl.yaml +477 -477
- package/bmad-core/templates/brownfield-prd-tmpl.yaml +281 -281
- package/bmad-core/templates/competitor-analysis-tmpl.yaml +307 -307
- package/bmad-core/templates/front-end-architecture-tmpl.yaml +258 -258
- package/bmad-core/templates/front-end-spec-tmpl.yaml +350 -350
- package/bmad-core/templates/fullstack-architecture-tmpl.yaml +824 -824
- package/bmad-core/templates/market-research-tmpl.yaml +253 -253
- package/bmad-core/templates/prd-tmpl.yaml +203 -203
- package/bmad-core/templates/project-brief-tmpl.yaml +222 -222
- package/bmad-core/templates/qa-gate-tmpl.yaml +103 -103
- package/bmad-core/templates/story-tmpl.yaml +138 -138
- package/bmad-core/user-guide.md +530 -530
- package/bmad-core/utils/bmad-doc-template.md +327 -327
- package/bmad-core/utils/workflow-management.md +71 -71
- package/bmad-core/workflows/brownfield-fullstack.yaml +298 -298
- package/bmad-core/workflows/brownfield-service.yaml +188 -188
- package/bmad-core/workflows/brownfield-ui.yaml +198 -198
- package/bmad-core/workflows/greenfield-fullstack.yaml +241 -241
- package/bmad-core/workflows/greenfield-service.yaml +207 -207
- package/bmad-core/workflows/greenfield-ui.yaml +236 -236
- package/bmad-core/working-in-the-brownfield.md +606 -606
- package/claude/commands/BMad/agents/backend.md +187 -187
- package/claude/commands/BMad/agents/frontend.md +150 -150
- package/github/b-mad-expert.md +742 -742
- package/github/chatmodes/analyst.chatmode.md +89 -89
- package/github/chatmodes/architect.chatmode.md +97 -97
- package/github/chatmodes/backend.chatmode.md +194 -194
- package/github/chatmodes/bmad-master.chatmode.md +115 -115
- package/github/chatmodes/bmad-orchestrator.chatmode.md +152 -152
- package/github/chatmodes/dev.chatmode.md +86 -86
- package/github/chatmodes/frontend.chatmode.md +157 -157
- package/github/chatmodes/pm.chatmode.md +89 -89
- package/github/chatmodes/po.chatmode.md +84 -84
- package/github/chatmodes/qa.chatmode.md +96 -96
- package/github/chatmodes/sm.chatmode.md +70 -70
- package/github/chatmodes/ux-expert.chatmode.md +74 -74
- package/index.js +9 -9
- package/package.json +37 -37
- package/vscode/mcp.json +11 -11
- package/vscode/settings.json +12 -12
|
@@ -1,324 +1,324 @@
|
|
|
1
|
-
# Frontend Development Standards
|
|
2
|
-
|
|
3
|
-
## Architecture Principles
|
|
4
|
-
|
|
5
|
-
### Clean Architecture Implementation
|
|
6
|
-
- **Domain Layer**: Business entities, value objects, and business rules only
|
|
7
|
-
- **Application Layer**: Use cases, custom hooks, and state management
|
|
8
|
-
- **Infrastructure Layer**: API clients, repositories implementations, external service adapters
|
|
9
|
-
- **Presentation Layer**: React components, pages, and UI logic only
|
|
10
|
-
|
|
11
|
-
### Dependency Rules
|
|
12
|
-
- Inner layers must not know about outer layers
|
|
13
|
-
- Dependencies point inward (from outer to inner layers)
|
|
14
|
-
- Use dependency inversion for external concerns
|
|
15
|
-
|
|
16
|
-
## Technology Stack Standards
|
|
17
|
-
|
|
18
|
-
### Core Technologies
|
|
19
|
-
- **Next.js**: 14+ with App Router and TypeScript
|
|
20
|
-
- **React**: 18+ with functional components and hooks (via Next.js)
|
|
21
|
-
- **TypeScript**: Strict mode enabled, no `any` types
|
|
22
|
-
- **TailwindCSS**: Utility-first CSS framework
|
|
23
|
-
- **Shadcn/ui + Radix UI**: Component library foundation
|
|
24
|
-
|
|
25
|
-
### Framework Selection Rules
|
|
26
|
-
- **Default**: Always use Next.js 14+ with App Router
|
|
27
|
-
- **Exception**: Only use pure React + Vite when user specifically requests offline-first functionality
|
|
28
|
-
- **Reasoning**: Next.js provides better DX, built-in optimization, and easier deployment while maintaining PWA capabilities
|
|
29
|
-
|
|
30
|
-
### State Management
|
|
31
|
-
- **Zustand**: Primary state management solution
|
|
32
|
-
- Feature-based stores following DDD patterns
|
|
33
|
-
- Global state only for truly global concerns
|
|
34
|
-
- Local state for component-specific needs
|
|
35
|
-
|
|
36
|
-
### Development Tools
|
|
37
|
-
- **Next.js**: Built-in build system and development server
|
|
38
|
-
- **Vitest**: Unit and integration testing (configured with Next.js)
|
|
39
|
-
- **React Testing Library**: Component testing
|
|
40
|
-
- **MSW**: API mocking for tests
|
|
41
|
-
- **ESLint + Prettier**: Code quality and formatting (Next.js config)
|
|
42
|
-
|
|
43
|
-
## MCP Component Strategy
|
|
44
|
-
- **Always First**: Check MCP Shadcn registry before creating any component
|
|
45
|
-
- **Execute MCP**: Actively run MCP commands to search and install components
|
|
46
|
-
- **Workflow**: For buttons, forms, inputs, cards, dialogs, tables → Execute "Show me [type] components from shadcn registry" → Then execute "Add the [name] component to my project"
|
|
47
|
-
- **Error Reduction**: 90% fewer bugs using MCP vs manual creation
|
|
48
|
-
|
|
49
|
-
## Component Standards
|
|
50
|
-
|
|
51
|
-
### Component Structure
|
|
52
|
-
```typescript
|
|
53
|
-
interface ComponentProps {
|
|
54
|
-
// Required props
|
|
55
|
-
children: React.ReactNode;
|
|
56
|
-
// Optional props with defaults
|
|
57
|
-
className?: string;
|
|
58
|
-
variant?: 'default' | 'secondary';
|
|
59
|
-
'data-testid'?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const Component = memo<ComponentProps>(({
|
|
63
|
-
children,
|
|
64
|
-
className,
|
|
65
|
-
variant = 'default',
|
|
66
|
-
'data-testid': testId = 'component'
|
|
67
|
-
}) => {
|
|
68
|
-
// Component implementation
|
|
69
|
-
return (
|
|
70
|
-
<div className={cn(baseStyles, variantStyles[variant], className)} data-testid={testId}>
|
|
71
|
-
{children}
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
Component.displayName = 'Component';
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Component Naming
|
|
80
|
-
- **PascalCase** for component names
|
|
81
|
-
- **kebab-case** for file names and data-testid attributes
|
|
82
|
-
- **camelCase** for props and functions
|
|
83
|
-
- Descriptive names that indicate purpose
|
|
84
|
-
|
|
85
|
-
### Props Guidelines
|
|
86
|
-
- Always define TypeScript interfaces for props
|
|
87
|
-
- Use optional props with sensible defaults
|
|
88
|
-
- Include className for style overrides
|
|
89
|
-
- Add data-testid for testing
|
|
90
|
-
- Document complex props with JSDoc
|
|
91
|
-
|
|
92
|
-
## State Management Patterns
|
|
93
|
-
|
|
94
|
-
### Zustand Store Structure
|
|
95
|
-
```typescript
|
|
96
|
-
interface FeatureState {
|
|
97
|
-
// Domain entities
|
|
98
|
-
entities: Entity[];
|
|
99
|
-
selectedEntity: Entity | null;
|
|
100
|
-
|
|
101
|
-
// UI state
|
|
102
|
-
loading: boolean;
|
|
103
|
-
error: string | null;
|
|
104
|
-
|
|
105
|
-
// Actions (use case calls)
|
|
106
|
-
loadEntities: () => Promise<void>;
|
|
107
|
-
selectEntity: (id: string) => void;
|
|
108
|
-
updateEntity: (entity: Entity) => Promise<void>;
|
|
109
|
-
clearError: () => void;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export const useFeatureStore = create<FeatureState>()(
|
|
113
|
-
devtools(
|
|
114
|
-
(set, get) => ({
|
|
115
|
-
// Initial state
|
|
116
|
-
entities: [],
|
|
117
|
-
selectedEntity: null,
|
|
118
|
-
loading: false,
|
|
119
|
-
error: null,
|
|
120
|
-
|
|
121
|
-
// Actions implementation
|
|
122
|
-
loadEntities: async () => {
|
|
123
|
-
set({ loading: true, error: null });
|
|
124
|
-
try {
|
|
125
|
-
const entities = await loadEntitiesUseCase.execute();
|
|
126
|
-
set({ entities, loading: false });
|
|
127
|
-
} catch (error) {
|
|
128
|
-
set({ error: error.message, loading: false });
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
// Other actions...
|
|
133
|
-
}),
|
|
134
|
-
{ name: 'featureStore' }
|
|
135
|
-
)
|
|
136
|
-
);
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Testing Standards
|
|
140
|
-
|
|
141
|
-
### Testing Strategy
|
|
142
|
-
- **Unit Tests**: Domain entities, use cases, utilities
|
|
143
|
-
- **Integration Tests**: Feature workflows, API integration
|
|
144
|
-
- **Component Tests**: User interactions, accessibility
|
|
145
|
-
- **E2E Tests**: Critical user journeys (minimal)
|
|
146
|
-
|
|
147
|
-
### Test Structure
|
|
148
|
-
```typescript
|
|
149
|
-
describe('ComponentName', () => {
|
|
150
|
-
it('should render correctly with default props', () => {
|
|
151
|
-
render(<ComponentName>Test content</ComponentName>);
|
|
152
|
-
expect(screen.getByTestId('component-name')).toBeInTheDocument();
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('should handle user interactions', async () => {
|
|
156
|
-
const handleClick = jest.fn();
|
|
157
|
-
render(<ComponentName onClick={handleClick} />);
|
|
158
|
-
|
|
159
|
-
await user.click(screen.getByRole('button'));
|
|
160
|
-
expect(handleClick).toHaveBeenCalled();
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('should be accessible', async () => {
|
|
164
|
-
const { container } = render(<ComponentName />);
|
|
165
|
-
const results = await axe(container);
|
|
166
|
-
expect(results).toHaveNoViolations();
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
## Accessibility Standards
|
|
172
|
-
|
|
173
|
-
### WCAG 2.1 AA Compliance
|
|
174
|
-
- Semantic HTML elements
|
|
175
|
-
- Proper heading hierarchy
|
|
176
|
-
- Keyboard navigation support
|
|
177
|
-
- Screen reader compatibility
|
|
178
|
-
- Color contrast minimum 4.5:1
|
|
179
|
-
|
|
180
|
-
### ARIA Implementation
|
|
181
|
-
- Use semantic HTML first, ARIA second
|
|
182
|
-
- Proper labeling with aria-label or aria-labelledby
|
|
183
|
-
- Role attributes for custom components
|
|
184
|
-
- State communication with aria-expanded, aria-selected
|
|
185
|
-
- Live regions for dynamic content updates
|
|
186
|
-
|
|
187
|
-
## Performance Standards
|
|
188
|
-
|
|
189
|
-
### Bundle Optimization
|
|
190
|
-
- Code splitting by route and feature
|
|
191
|
-
- Lazy loading for non-critical components
|
|
192
|
-
- Tree shaking for unused code
|
|
193
|
-
- Bundle size budget: 500KB total
|
|
194
|
-
|
|
195
|
-
### Runtime Performance
|
|
196
|
-
- React.memo for expensive components
|
|
197
|
-
- useMemo for expensive calculations
|
|
198
|
-
- useCallback for event handlers passed to children
|
|
199
|
-
- Virtual scrolling for large lists
|
|
200
|
-
|
|
201
|
-
### Loading Performance
|
|
202
|
-
- Image optimization and lazy loading
|
|
203
|
-
- Progressive loading strategies
|
|
204
|
-
- Skeleton screens for loading states
|
|
205
|
-
- Prefetch critical resources
|
|
206
|
-
|
|
207
|
-
## Security Guidelines
|
|
208
|
-
|
|
209
|
-
### Client-Side Security
|
|
210
|
-
- No API keys or secrets in frontend code
|
|
211
|
-
- Input validation and sanitization
|
|
212
|
-
- XSS prevention measures
|
|
213
|
-
- Secure handling of user data
|
|
214
|
-
|
|
215
|
-
### Authentication
|
|
216
|
-
- Token-based authentication (JWT)
|
|
217
|
-
- Secure token storage
|
|
218
|
-
- Automatic token refresh
|
|
219
|
-
- Proper logout handling
|
|
220
|
-
|
|
221
|
-
## File Organization
|
|
222
|
-
|
|
223
|
-
### Feature Structure
|
|
224
|
-
```
|
|
225
|
-
src/
|
|
226
|
-
├── modules/
|
|
227
|
-
│ ├── sales/ # MODULE
|
|
228
|
-
│ │ ├── quotes/ # DOMAIN
|
|
229
|
-
│ │ │ ├── cart/ # FEATURE
|
|
230
|
-
│ │ │ │ ├── domain/
|
|
231
|
-
│ │ │ │ │ ├── entities/
|
|
232
|
-
│ │ │ │ │ ├── repositories/ # Interfaces
|
|
233
|
-
│ │ │ │ │ ├── services/ # Domain services
|
|
234
|
-
│ │ │ │ │ └── types/
|
|
235
|
-
│ │ │ │ ├── application/
|
|
236
|
-
│ │ │ │ │ ├── use-cases/
|
|
237
|
-
│ │ │ │ │ ├── hooks/ # Custom hooks
|
|
238
|
-
│ │ │ │ │ └── store/ # Zustand store
|
|
239
|
-
│ │ │ │ ├── infrastructure/
|
|
240
|
-
│ │ │ │ │ ├── repositories/ # Implementations
|
|
241
|
-
│ │ │ │ │ ├── api/
|
|
242
|
-
│ │ │ │ │ └── adapters/
|
|
243
|
-
│ │ │ │ └── presentation/
|
|
244
|
-
│ │ │ │ ├── components/
|
|
245
|
-
│ │ │ │ ├── pages/
|
|
246
|
-
│ │ │ │ └── styles/
|
|
247
|
-
│ │ │ └── products/ # FEATURE
|
|
248
|
-
│ │ │ ├── domain/
|
|
249
|
-
│ │ │ ├── application/
|
|
250
|
-
│ │ │ ├── infrastructure/
|
|
251
|
-
│ │ │ └── presentation/
|
|
252
|
-
│ │ └── billing/ # DOMAIN
|
|
253
|
-
│ │ ├── invoices/ # FEATURE
|
|
254
|
-
│ │ └── reports/ # FEATURE
|
|
255
|
-
│ ├── inventory/ # MODULE
|
|
256
|
-
│ │ ├── products/ # DOMAIN
|
|
257
|
-
│ │ │ ├── catalog/ # FEATURE
|
|
258
|
-
│ │ │ └── stock/ # FEATURE
|
|
259
|
-
│ │ └── warehouses/ # DOMAIN
|
|
260
|
-
│ └── users/ # MODULE
|
|
261
|
-
│ └── authentication/ # DOMAIN
|
|
262
|
-
│ ├── login/ # FEATURE
|
|
263
|
-
│ └── registration/ # FEATURE
|
|
264
|
-
├── shared/
|
|
265
|
-
│ ├── components/ # Shadcn/ui components
|
|
266
|
-
│ ├── hooks/
|
|
267
|
-
│ ├── utils/
|
|
268
|
-
│ ├── types/
|
|
269
|
-
│ └── constants/
|
|
270
|
-
├── app/
|
|
271
|
-
│ ├── store/ # Global store
|
|
272
|
-
│ ├── providers/ # Context providers
|
|
273
|
-
│ ├── router/ # Routing config
|
|
274
|
-
│ └── app.tsx
|
|
275
|
-
├── infrastructure/
|
|
276
|
-
│ ├── api/ # API configuration
|
|
277
|
-
│ ├── storage/ # IndexedDB, localStorage
|
|
278
|
-
│ └── pwa/ # PWA configuration
|
|
279
|
-
└── assets/
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Import Organization
|
|
283
|
-
```typescript
|
|
284
|
-
// External libraries
|
|
285
|
-
import React from 'react';
|
|
286
|
-
import { create } from 'zustand';
|
|
287
|
-
|
|
288
|
-
// Internal utilities
|
|
289
|
-
import { cn } from '@/lib/utils';
|
|
290
|
-
|
|
291
|
-
// Types
|
|
292
|
-
import type { User } from '../domain/types/User';
|
|
293
|
-
|
|
294
|
-
// Components
|
|
295
|
-
import { Button } from '@/components/ui/button';
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
## Error Handling
|
|
299
|
-
|
|
300
|
-
### Error Boundaries
|
|
301
|
-
- Feature-level error boundaries
|
|
302
|
-
- Graceful fallback UI
|
|
303
|
-
- Error reporting and logging
|
|
304
|
-
- User-friendly error messages
|
|
305
|
-
|
|
306
|
-
### API Error Handling
|
|
307
|
-
- Centralized error handling in HTTP client
|
|
308
|
-
- Proper error typing
|
|
309
|
-
- User-friendly error messages
|
|
310
|
-
- Retry mechanisms for transient errors
|
|
311
|
-
|
|
312
|
-
## Progressive Web App Standards
|
|
313
|
-
|
|
314
|
-
### PWA Features
|
|
315
|
-
- Service worker for caching and offline support
|
|
316
|
-
- Web app manifest for installability
|
|
317
|
-
- Push notifications (when needed)
|
|
318
|
-
- Background sync capabilities
|
|
319
|
-
|
|
320
|
-
### Offline Strategy
|
|
321
|
-
- Cache-first for static assets
|
|
322
|
-
- Network-first for dynamic data
|
|
323
|
-
- Fallback pages for offline scenarios
|
|
1
|
+
# Frontend Development Standards
|
|
2
|
+
|
|
3
|
+
## Architecture Principles
|
|
4
|
+
|
|
5
|
+
### Clean Architecture Implementation
|
|
6
|
+
- **Domain Layer**: Business entities, value objects, and business rules only
|
|
7
|
+
- **Application Layer**: Use cases, custom hooks, and state management
|
|
8
|
+
- **Infrastructure Layer**: API clients, repositories implementations, external service adapters
|
|
9
|
+
- **Presentation Layer**: React components, pages, and UI logic only
|
|
10
|
+
|
|
11
|
+
### Dependency Rules
|
|
12
|
+
- Inner layers must not know about outer layers
|
|
13
|
+
- Dependencies point inward (from outer to inner layers)
|
|
14
|
+
- Use dependency inversion for external concerns
|
|
15
|
+
|
|
16
|
+
## Technology Stack Standards
|
|
17
|
+
|
|
18
|
+
### Core Technologies
|
|
19
|
+
- **Next.js**: 14+ with App Router and TypeScript
|
|
20
|
+
- **React**: 18+ with functional components and hooks (via Next.js)
|
|
21
|
+
- **TypeScript**: Strict mode enabled, no `any` types
|
|
22
|
+
- **TailwindCSS**: Utility-first CSS framework
|
|
23
|
+
- **Shadcn/ui + Radix UI**: Component library foundation
|
|
24
|
+
|
|
25
|
+
### Framework Selection Rules
|
|
26
|
+
- **Default**: Always use Next.js 14+ with App Router
|
|
27
|
+
- **Exception**: Only use pure React + Vite when user specifically requests offline-first functionality
|
|
28
|
+
- **Reasoning**: Next.js provides better DX, built-in optimization, and easier deployment while maintaining PWA capabilities
|
|
29
|
+
|
|
30
|
+
### State Management
|
|
31
|
+
- **Zustand**: Primary state management solution
|
|
32
|
+
- Feature-based stores following DDD patterns
|
|
33
|
+
- Global state only for truly global concerns
|
|
34
|
+
- Local state for component-specific needs
|
|
35
|
+
|
|
36
|
+
### Development Tools
|
|
37
|
+
- **Next.js**: Built-in build system and development server
|
|
38
|
+
- **Vitest**: Unit and integration testing (configured with Next.js)
|
|
39
|
+
- **React Testing Library**: Component testing
|
|
40
|
+
- **MSW**: API mocking for tests
|
|
41
|
+
- **ESLint + Prettier**: Code quality and formatting (Next.js config)
|
|
42
|
+
|
|
43
|
+
## MCP Component Strategy
|
|
44
|
+
- **Always First**: Check MCP Shadcn registry before creating any component
|
|
45
|
+
- **Execute MCP**: Actively run MCP commands to search and install components
|
|
46
|
+
- **Workflow**: For buttons, forms, inputs, cards, dialogs, tables → Execute "Show me [type] components from shadcn registry" → Then execute "Add the [name] component to my project"
|
|
47
|
+
- **Error Reduction**: 90% fewer bugs using MCP vs manual creation
|
|
48
|
+
|
|
49
|
+
## Component Standards
|
|
50
|
+
|
|
51
|
+
### Component Structure
|
|
52
|
+
```typescript
|
|
53
|
+
interface ComponentProps {
|
|
54
|
+
// Required props
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
// Optional props with defaults
|
|
57
|
+
className?: string;
|
|
58
|
+
variant?: 'default' | 'secondary';
|
|
59
|
+
'data-testid'?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Component = memo<ComponentProps>(({
|
|
63
|
+
children,
|
|
64
|
+
className,
|
|
65
|
+
variant = 'default',
|
|
66
|
+
'data-testid': testId = 'component'
|
|
67
|
+
}) => {
|
|
68
|
+
// Component implementation
|
|
69
|
+
return (
|
|
70
|
+
<div className={cn(baseStyles, variantStyles[variant], className)} data-testid={testId}>
|
|
71
|
+
{children}
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
Component.displayName = 'Component';
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Component Naming
|
|
80
|
+
- **PascalCase** for component names
|
|
81
|
+
- **kebab-case** for file names and data-testid attributes
|
|
82
|
+
- **camelCase** for props and functions
|
|
83
|
+
- Descriptive names that indicate purpose
|
|
84
|
+
|
|
85
|
+
### Props Guidelines
|
|
86
|
+
- Always define TypeScript interfaces for props
|
|
87
|
+
- Use optional props with sensible defaults
|
|
88
|
+
- Include className for style overrides
|
|
89
|
+
- Add data-testid for testing
|
|
90
|
+
- Document complex props with JSDoc
|
|
91
|
+
|
|
92
|
+
## State Management Patterns
|
|
93
|
+
|
|
94
|
+
### Zustand Store Structure
|
|
95
|
+
```typescript
|
|
96
|
+
interface FeatureState {
|
|
97
|
+
// Domain entities
|
|
98
|
+
entities: Entity[];
|
|
99
|
+
selectedEntity: Entity | null;
|
|
100
|
+
|
|
101
|
+
// UI state
|
|
102
|
+
loading: boolean;
|
|
103
|
+
error: string | null;
|
|
104
|
+
|
|
105
|
+
// Actions (use case calls)
|
|
106
|
+
loadEntities: () => Promise<void>;
|
|
107
|
+
selectEntity: (id: string) => void;
|
|
108
|
+
updateEntity: (entity: Entity) => Promise<void>;
|
|
109
|
+
clearError: () => void;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const useFeatureStore = create<FeatureState>()(
|
|
113
|
+
devtools(
|
|
114
|
+
(set, get) => ({
|
|
115
|
+
// Initial state
|
|
116
|
+
entities: [],
|
|
117
|
+
selectedEntity: null,
|
|
118
|
+
loading: false,
|
|
119
|
+
error: null,
|
|
120
|
+
|
|
121
|
+
// Actions implementation
|
|
122
|
+
loadEntities: async () => {
|
|
123
|
+
set({ loading: true, error: null });
|
|
124
|
+
try {
|
|
125
|
+
const entities = await loadEntitiesUseCase.execute();
|
|
126
|
+
set({ entities, loading: false });
|
|
127
|
+
} catch (error) {
|
|
128
|
+
set({ error: error.message, loading: false });
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
// Other actions...
|
|
133
|
+
}),
|
|
134
|
+
{ name: 'featureStore' }
|
|
135
|
+
)
|
|
136
|
+
);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Testing Standards
|
|
140
|
+
|
|
141
|
+
### Testing Strategy
|
|
142
|
+
- **Unit Tests**: Domain entities, use cases, utilities
|
|
143
|
+
- **Integration Tests**: Feature workflows, API integration
|
|
144
|
+
- **Component Tests**: User interactions, accessibility
|
|
145
|
+
- **E2E Tests**: Critical user journeys (minimal)
|
|
146
|
+
|
|
147
|
+
### Test Structure
|
|
148
|
+
```typescript
|
|
149
|
+
describe('ComponentName', () => {
|
|
150
|
+
it('should render correctly with default props', () => {
|
|
151
|
+
render(<ComponentName>Test content</ComponentName>);
|
|
152
|
+
expect(screen.getByTestId('component-name')).toBeInTheDocument();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('should handle user interactions', async () => {
|
|
156
|
+
const handleClick = jest.fn();
|
|
157
|
+
render(<ComponentName onClick={handleClick} />);
|
|
158
|
+
|
|
159
|
+
await user.click(screen.getByRole('button'));
|
|
160
|
+
expect(handleClick).toHaveBeenCalled();
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('should be accessible', async () => {
|
|
164
|
+
const { container } = render(<ComponentName />);
|
|
165
|
+
const results = await axe(container);
|
|
166
|
+
expect(results).toHaveNoViolations();
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Accessibility Standards
|
|
172
|
+
|
|
173
|
+
### WCAG 2.1 AA Compliance
|
|
174
|
+
- Semantic HTML elements
|
|
175
|
+
- Proper heading hierarchy
|
|
176
|
+
- Keyboard navigation support
|
|
177
|
+
- Screen reader compatibility
|
|
178
|
+
- Color contrast minimum 4.5:1
|
|
179
|
+
|
|
180
|
+
### ARIA Implementation
|
|
181
|
+
- Use semantic HTML first, ARIA second
|
|
182
|
+
- Proper labeling with aria-label or aria-labelledby
|
|
183
|
+
- Role attributes for custom components
|
|
184
|
+
- State communication with aria-expanded, aria-selected
|
|
185
|
+
- Live regions for dynamic content updates
|
|
186
|
+
|
|
187
|
+
## Performance Standards
|
|
188
|
+
|
|
189
|
+
### Bundle Optimization
|
|
190
|
+
- Code splitting by route and feature
|
|
191
|
+
- Lazy loading for non-critical components
|
|
192
|
+
- Tree shaking for unused code
|
|
193
|
+
- Bundle size budget: 500KB total
|
|
194
|
+
|
|
195
|
+
### Runtime Performance
|
|
196
|
+
- React.memo for expensive components
|
|
197
|
+
- useMemo for expensive calculations
|
|
198
|
+
- useCallback for event handlers passed to children
|
|
199
|
+
- Virtual scrolling for large lists
|
|
200
|
+
|
|
201
|
+
### Loading Performance
|
|
202
|
+
- Image optimization and lazy loading
|
|
203
|
+
- Progressive loading strategies
|
|
204
|
+
- Skeleton screens for loading states
|
|
205
|
+
- Prefetch critical resources
|
|
206
|
+
|
|
207
|
+
## Security Guidelines
|
|
208
|
+
|
|
209
|
+
### Client-Side Security
|
|
210
|
+
- No API keys or secrets in frontend code
|
|
211
|
+
- Input validation and sanitization
|
|
212
|
+
- XSS prevention measures
|
|
213
|
+
- Secure handling of user data
|
|
214
|
+
|
|
215
|
+
### Authentication
|
|
216
|
+
- Token-based authentication (JWT)
|
|
217
|
+
- Secure token storage
|
|
218
|
+
- Automatic token refresh
|
|
219
|
+
- Proper logout handling
|
|
220
|
+
|
|
221
|
+
## File Organization
|
|
222
|
+
|
|
223
|
+
### Feature Structure
|
|
224
|
+
```
|
|
225
|
+
src/
|
|
226
|
+
├── modules/
|
|
227
|
+
│ ├── sales/ # MODULE
|
|
228
|
+
│ │ ├── quotes/ # DOMAIN
|
|
229
|
+
│ │ │ ├── cart/ # FEATURE
|
|
230
|
+
│ │ │ │ ├── domain/
|
|
231
|
+
│ │ │ │ │ ├── entities/
|
|
232
|
+
│ │ │ │ │ ├── repositories/ # Interfaces
|
|
233
|
+
│ │ │ │ │ ├── services/ # Domain services
|
|
234
|
+
│ │ │ │ │ └── types/
|
|
235
|
+
│ │ │ │ ├── application/
|
|
236
|
+
│ │ │ │ │ ├── use-cases/
|
|
237
|
+
│ │ │ │ │ ├── hooks/ # Custom hooks
|
|
238
|
+
│ │ │ │ │ └── store/ # Zustand store
|
|
239
|
+
│ │ │ │ ├── infrastructure/
|
|
240
|
+
│ │ │ │ │ ├── repositories/ # Implementations
|
|
241
|
+
│ │ │ │ │ ├── api/
|
|
242
|
+
│ │ │ │ │ └── adapters/
|
|
243
|
+
│ │ │ │ └── presentation/
|
|
244
|
+
│ │ │ │ ├── components/
|
|
245
|
+
│ │ │ │ ├── pages/
|
|
246
|
+
│ │ │ │ └── styles/
|
|
247
|
+
│ │ │ └── products/ # FEATURE
|
|
248
|
+
│ │ │ ├── domain/
|
|
249
|
+
│ │ │ ├── application/
|
|
250
|
+
│ │ │ ├── infrastructure/
|
|
251
|
+
│ │ │ └── presentation/
|
|
252
|
+
│ │ └── billing/ # DOMAIN
|
|
253
|
+
│ │ ├── invoices/ # FEATURE
|
|
254
|
+
│ │ └── reports/ # FEATURE
|
|
255
|
+
│ ├── inventory/ # MODULE
|
|
256
|
+
│ │ ├── products/ # DOMAIN
|
|
257
|
+
│ │ │ ├── catalog/ # FEATURE
|
|
258
|
+
│ │ │ └── stock/ # FEATURE
|
|
259
|
+
│ │ └── warehouses/ # DOMAIN
|
|
260
|
+
│ └── users/ # MODULE
|
|
261
|
+
│ └── authentication/ # DOMAIN
|
|
262
|
+
│ ├── login/ # FEATURE
|
|
263
|
+
│ └── registration/ # FEATURE
|
|
264
|
+
├── shared/
|
|
265
|
+
│ ├── components/ # Shadcn/ui components
|
|
266
|
+
│ ├── hooks/
|
|
267
|
+
│ ├── utils/
|
|
268
|
+
│ ├── types/
|
|
269
|
+
│ └── constants/
|
|
270
|
+
├── app/
|
|
271
|
+
│ ├── store/ # Global store
|
|
272
|
+
│ ├── providers/ # Context providers
|
|
273
|
+
│ ├── router/ # Routing config
|
|
274
|
+
│ └── app.tsx
|
|
275
|
+
├── infrastructure/
|
|
276
|
+
│ ├── api/ # API configuration
|
|
277
|
+
│ ├── storage/ # IndexedDB, localStorage
|
|
278
|
+
│ └── pwa/ # PWA configuration
|
|
279
|
+
└── assets/
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Import Organization
|
|
283
|
+
```typescript
|
|
284
|
+
// External libraries
|
|
285
|
+
import React from 'react';
|
|
286
|
+
import { create } from 'zustand';
|
|
287
|
+
|
|
288
|
+
// Internal utilities
|
|
289
|
+
import { cn } from '@/lib/utils';
|
|
290
|
+
|
|
291
|
+
// Types
|
|
292
|
+
import type { User } from '../domain/types/User';
|
|
293
|
+
|
|
294
|
+
// Components
|
|
295
|
+
import { Button } from '@/components/ui/button';
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Error Handling
|
|
299
|
+
|
|
300
|
+
### Error Boundaries
|
|
301
|
+
- Feature-level error boundaries
|
|
302
|
+
- Graceful fallback UI
|
|
303
|
+
- Error reporting and logging
|
|
304
|
+
- User-friendly error messages
|
|
305
|
+
|
|
306
|
+
### API Error Handling
|
|
307
|
+
- Centralized error handling in HTTP client
|
|
308
|
+
- Proper error typing
|
|
309
|
+
- User-friendly error messages
|
|
310
|
+
- Retry mechanisms for transient errors
|
|
311
|
+
|
|
312
|
+
## Progressive Web App Standards
|
|
313
|
+
|
|
314
|
+
### PWA Features
|
|
315
|
+
- Service worker for caching and offline support
|
|
316
|
+
- Web app manifest for installability
|
|
317
|
+
- Push notifications (when needed)
|
|
318
|
+
- Background sync capabilities
|
|
319
|
+
|
|
320
|
+
### Offline Strategy
|
|
321
|
+
- Cache-first for static assets
|
|
322
|
+
- Network-first for dynamic data
|
|
323
|
+
- Fallback pages for offline scenarios
|
|
324
324
|
- Sync when connection restored
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!-- Powered by BMAD™ Core -->
|
|
2
|
-
|
|
3
|
-
# User-Defined Preferred Patterns and Preferences
|
|
4
|
-
|
|
5
|
-
None Listed
|
|
1
|
+
<!-- Powered by BMAD™ Core -->
|
|
2
|
+
|
|
3
|
+
# User-Defined Preferred Patterns and Preferences
|
|
4
|
+
|
|
5
|
+
None Listed
|