proagents 1.6.16 → 1.6.18
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/.claude/settings.local.json +169 -0
- package/COMMANDS.md +595 -0
- package/README.md +22 -64
- package/bin/proagents.js +0 -2
- package/lib/commands/init.js +4 -174
- package/package.json +2 -7
- package/.proagents/ai-models/README.md +0 -141
- package/.proagents/ai-models/cost-management.md +0 -362
- package/.proagents/ai-models/fallbacks.md +0 -342
- package/.proagents/ai-models/model-config.md +0 -318
- package/.proagents/ai-models/task-routing.md +0 -503
- package/.proagents/ai-training/README.md +0 -155
- package/.proagents/ai-training/continuous-learning.md +0 -413
- package/.proagents/ai-training/domain-knowledge.md +0 -378
- package/.proagents/ai-training/pattern-learning.md +0 -455
- package/.proagents/ai-training/training-data.md +0 -337
- package/.proagents/ai-training/user-preferences.md +0 -346
- package/.proagents/approval-workflows/README.md +0 -146
- package/.proagents/approval-workflows/approval-config.md +0 -332
- package/.proagents/approval-workflows/approval-stages.md +0 -503
- package/.proagents/approval-workflows/emergency-bypass.md +0 -351
- package/.proagents/approval-workflows/examples.md +0 -859
- package/.proagents/approval-workflows/notifications.md +0 -320
- package/.proagents/compliance/README.md +0 -206
- package/.proagents/compliance/access-control.md +0 -310
- package/.proagents/compliance/audit-logging.md +0 -444
- package/.proagents/compliance/compliance-frameworks.md +0 -429
- package/.proagents/compliance/reports.md +0 -491
- package/.proagents/compliance/retention-policies.md +0 -454
- package/.proagents/config-versioning/README.md +0 -120
- package/.proagents/config-versioning/changelog.md +0 -300
- package/.proagents/config-versioning/rollback.md +0 -283
- package/.proagents/config-versioning/versioning.md +0 -330
- package/.proagents/contract-testing/README.md +0 -223
- package/.proagents/contract-testing/contract-testing.md +0 -614
- package/.proagents/contract-testing/pact-integration.md +0 -507
- package/.proagents/contract-testing/schema-validation.md +0 -565
- package/.proagents/dependency-management/README.md +0 -140
- package/.proagents/dependency-management/automation.md +0 -363
- package/.proagents/dependency-management/compatibility.md +0 -319
- package/.proagents/dependency-management/security-scanning.md +0 -413
- package/.proagents/dependency-management/update-policies.md +0 -374
- package/.proagents/disaster-recovery/README.md +0 -247
- package/.proagents/disaster-recovery/automation.md +0 -366
- package/.proagents/disaster-recovery/backup-recovery.md +0 -571
- package/.proagents/disaster-recovery/incident-response.md +0 -565
- package/.proagents/disaster-recovery/rollback-procedures.md +0 -499
- package/.proagents/disaster-recovery/runbooks.md +0 -603
- package/.proagents/disaster-recovery/scenarios.md +0 -892
- package/.proagents/disaster-recovery/testing.md +0 -438
- package/.proagents/environments/README.md +0 -244
- package/.proagents/environments/configuration.md +0 -437
- package/.proagents/environments/promotion.md +0 -434
- package/.proagents/environments/setup.md +0 -420
- package/.proagents/examples/README.md +0 -55
- package/.proagents/examples/backend-nodejs/README.md +0 -188
- package/.proagents/examples/backend-nodejs/complete-conversation.md +0 -601
- package/.proagents/examples/backend-nodejs/proagents.config.yaml +0 -415
- package/.proagents/examples/backend-nodejs/workflow-example.md +0 -909
- package/.proagents/examples/fullstack-nextjs/README.md +0 -155
- package/.proagents/examples/fullstack-nextjs/complete-conversation.md +0 -604
- package/.proagents/examples/fullstack-nextjs/proagents.config.yaml +0 -287
- package/.proagents/examples/fullstack-nextjs/workflow-example.md +0 -553
- package/.proagents/examples/mobile-react-native/README.md +0 -171
- package/.proagents/examples/mobile-react-native/complete-conversation.md +0 -825
- package/.proagents/examples/mobile-react-native/proagents.config.yaml +0 -330
- package/.proagents/examples/mobile-react-native/workflow-example.md +0 -723
- package/.proagents/examples/web-frontend-react/README.md +0 -125
- package/.proagents/examples/web-frontend-react/complete-conversation.md +0 -556
- package/.proagents/examples/web-frontend-react/proagents.config.yaml +0 -183
- package/.proagents/examples/web-frontend-react/workflow-example.md +0 -603
- package/.proagents/existing-projects/README.md +0 -65
- package/.proagents/existing-projects/challenges.md +0 -861
- package/.proagents/existing-projects/coexistence-mode.md +0 -483
- package/.proagents/existing-projects/compatibility-assessment.md +0 -541
- package/.proagents/existing-projects/gradual-adoption.md +0 -515
- package/.proagents/existing-projects/migration-strategies.md +0 -788
- package/.proagents/existing-projects/pattern-reconciliation.md +0 -489
- package/.proagents/existing-projects/team-onboarding.md +0 -617
- package/.proagents/existing-projects/technical-debt-handling.md +0 -644
- package/.proagents/feature-flags/README.md +0 -263
- package/.proagents/feature-flags/ab-testing.md +0 -413
- package/.proagents/feature-flags/configuration.md +0 -420
- package/.proagents/feature-flags/kill-switches.md +0 -444
- package/.proagents/feature-flags/rollout-strategies.md +0 -392
- package/.proagents/history.log +0 -12
- package/.proagents/i18n/README.md +0 -133
- package/.proagents/i18n/extraction.md +0 -433
- package/.proagents/i18n/tms-integration.md +0 -332
- package/.proagents/i18n/translation-workflow.md +0 -413
- package/.proagents/i18n/validation.md +0 -355
- package/.proagents/logging/README.md +0 -276
- package/.proagents/logging/aggregation.md +0 -475
- package/.proagents/logging/log-levels.md +0 -376
- package/.proagents/logging/sensitive-data.md +0 -423
- package/.proagents/logging/structured-logging.md +0 -406
- package/.proagents/metrics/README.md +0 -69
- package/.proagents/metrics/code-quality-kpis.md +0 -461
- package/.proagents/metrics/deployment-metrics.md +0 -517
- package/.proagents/metrics/developer-productivity.md +0 -368
- package/.proagents/metrics/learning-effectiveness.md +0 -478
- package/.proagents/migrations/README.md +0 -77
- package/.proagents/migrations/from-claude-projects.md +0 -313
- package/.proagents/migrations/from-cursor-rules.md +0 -345
- package/.proagents/migrations/from-custom-workflows.md +0 -410
- package/.proagents/monitoring/README.md +0 -308
- package/.proagents/monitoring/alerting.md +0 -449
- package/.proagents/monitoring/dashboards.md +0 -454
- package/.proagents/monitoring/health-checks.md +0 -436
- package/.proagents/monitoring/metrics.md +0 -434
- package/.proagents/multi-project/README.md +0 -170
- package/.proagents/multi-project/coordinated-deploy.md +0 -510
- package/.proagents/multi-project/cross-project-deps.md +0 -395
- package/.proagents/multi-project/unified-changelog.md +0 -477
- package/.proagents/multi-project/walkthroughs/monorepo-setup.md +0 -787
- package/.proagents/multi-project/workspace-config.md +0 -408
- package/.proagents/notifications/README.md +0 -151
- package/.proagents/notifications/channels.md +0 -457
- package/.proagents/notifications/preferences.md +0 -415
- package/.proagents/notifications/routing.md +0 -449
- package/.proagents/notifications/scheduling.md +0 -425
- package/.proagents/notifications/templates.md +0 -446
- package/.proagents/offline-mode/README.md +0 -145
- package/.proagents/offline-mode/caching.md +0 -344
- package/.proagents/offline-mode/offline-operations.md +0 -312
- package/.proagents/offline-mode/queue-specifications.md +0 -679
- package/.proagents/offline-mode/sync.md +0 -475
- package/.proagents/parallel-features/README.md +0 -85
- package/.proagents/parallel-features/conflict-detection.md +0 -226
- package/.proagents/parallel-features/dependency-management.md +0 -392
- package/.proagents/parallel-features/merge-coordination.md +0 -506
- package/.proagents/parallel-features/tracking-system.md +0 -416
- package/.proagents/performance/README.md +0 -59
- package/.proagents/performance/bundle-analysis.md +0 -375
- package/.proagents/performance/load-testing.md +0 -563
- package/.proagents/performance/runtime-metrics.md +0 -489
- package/.proagents/performance/web-vitals.md +0 -425
- package/.proagents/plugins/README.md +0 -139
- package/.proagents/plugins/creating-plugins.md +0 -504
- package/.proagents/plugins/plugin-api.md +0 -467
- package/.proagents/plugins/plugin-registry.md +0 -276
- package/.proagents/reporting/README.md +0 -158
- package/.proagents/reporting/dashboards.md +0 -366
- package/.proagents/reporting/exports.md +0 -524
- package/.proagents/reporting/quality-metrics.md +0 -385
- package/.proagents/reporting/templates/README.md +0 -56
- package/.proagents/reporting/templates/dashboard-config.json +0 -187
- package/.proagents/reporting/templates/metrics-queries.md +0 -427
- package/.proagents/reporting/templates/react-dashboard.tsx +0 -544
- package/.proagents/reporting/templates/widgets.md +0 -451
- package/.proagents/reporting/velocity-metrics.md +0 -340
- package/.proagents/reverse-engineering/README.md +0 -151
- package/.proagents/reverse-engineering/architecture-extraction.md +0 -325
- package/.proagents/reverse-engineering/code-analysis.md +0 -377
- package/.proagents/reverse-engineering/dependency-mapping.md +0 -567
- package/.proagents/reverse-engineering/diagram-generation.md +0 -586
- package/.proagents/reverse-engineering/documentation-generation.md +0 -468
- package/.proagents/reverse-engineering/pattern-detection.md +0 -569
- package/.proagents/reverse-engineering/quality-assessment.md +0 -733
- package/.proagents/secrets/README.md +0 -278
- package/.proagents/secrets/access-control.md +0 -443
- package/.proagents/secrets/rotation.md +0 -403
- package/.proagents/secrets/scanning.md +0 -487
- package/.proagents/secrets/storage.md +0 -394
- package/.proagents/webhooks/README.md +0 -126
- package/.proagents/webhooks/endpoints.md +0 -298
- package/.proagents/webhooks/events.md +0 -316
- package/.proagents/webhooks/payloads.md +0 -325
- package/.proagents/webhooks/reliability.md +0 -363
- package/.proagents/webhooks/security.md +0 -380
|
@@ -1,569 +0,0 @@
|
|
|
1
|
-
# Pattern Detection
|
|
2
|
-
|
|
3
|
-
Automatically detect design patterns, coding conventions, and architectural decisions from existing code.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Pattern detection helps:
|
|
10
|
-
- Understand how a codebase is built
|
|
11
|
-
- Ensure new code follows existing conventions
|
|
12
|
-
- Document implicit decisions
|
|
13
|
-
- Identify inconsistencies and tech debt
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Detection Categories
|
|
18
|
-
|
|
19
|
-
### 1. Architectural Patterns
|
|
20
|
-
|
|
21
|
-
```yaml
|
|
22
|
-
architecture_detection:
|
|
23
|
-
detected_pattern: "Feature-Based Architecture"
|
|
24
|
-
confidence: 0.92
|
|
25
|
-
|
|
26
|
-
evidence:
|
|
27
|
-
- "src/features/ directory exists"
|
|
28
|
-
- "Each feature has components/, hooks/, services/"
|
|
29
|
-
- "Shared code in src/shared/"
|
|
30
|
-
- "Clear module boundaries with index.ts exports"
|
|
31
|
-
|
|
32
|
-
structure:
|
|
33
|
-
features:
|
|
34
|
-
- name: "auth"
|
|
35
|
-
path: "src/features/auth/"
|
|
36
|
-
components: ["LoginForm", "RegisterForm", "AuthProvider"]
|
|
37
|
-
hooks: ["useAuth", "useSession"]
|
|
38
|
-
services: ["authService"]
|
|
39
|
-
|
|
40
|
-
- name: "dashboard"
|
|
41
|
-
path: "src/features/dashboard/"
|
|
42
|
-
components: ["DashboardPage", "StatsWidget"]
|
|
43
|
-
hooks: ["useDashboardData"]
|
|
44
|
-
services: ["dashboardService"]
|
|
45
|
-
|
|
46
|
-
recommendation: "Continue using feature-based architecture for new features"
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**Common Patterns Detected:**
|
|
50
|
-
|
|
51
|
-
| Pattern | Detection Signals |
|
|
52
|
-
|---------|-------------------|
|
|
53
|
-
| **Feature-Based** | `features/[name]/` with components, hooks, services |
|
|
54
|
-
| **Atomic Design** | `atoms/`, `molecules/`, `organisms/`, `templates/`, `pages/` |
|
|
55
|
-
| **MVC** | `controllers/`, `models/`, `views/` |
|
|
56
|
-
| **Clean Architecture** | `domain/`, `application/`, `infrastructure/` |
|
|
57
|
-
| **Layered** | `presentation/`, `business/`, `data/` |
|
|
58
|
-
| **Hexagonal** | `ports/`, `adapters/`, `core/` |
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
### 2. Component Patterns
|
|
63
|
-
|
|
64
|
-
```yaml
|
|
65
|
-
component_patterns:
|
|
66
|
-
detected:
|
|
67
|
-
- pattern: "Functional Components with Hooks"
|
|
68
|
-
usage: "100%"
|
|
69
|
-
evidence:
|
|
70
|
-
- "No class components found"
|
|
71
|
-
- "useState/useEffect in all stateful components"
|
|
72
|
-
- "Custom hooks for shared logic"
|
|
73
|
-
|
|
74
|
-
- pattern: "Props Interface Above Component"
|
|
75
|
-
usage: "95%"
|
|
76
|
-
evidence:
|
|
77
|
-
- "interface [Component]Props defined before export"
|
|
78
|
-
- "TypeScript strict mode enabled"
|
|
79
|
-
example: |
|
|
80
|
-
interface UserCardProps {
|
|
81
|
-
user: User;
|
|
82
|
-
onSelect?: (user: User) => void;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export const UserCard: FC<UserCardProps> = ({ user, onSelect }) => {
|
|
86
|
-
// ...
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
- pattern: "Memo for Performance"
|
|
90
|
-
usage: "40%"
|
|
91
|
-
locations:
|
|
92
|
-
- "src/components/DataTable.tsx"
|
|
93
|
-
- "src/components/VirtualList.tsx"
|
|
94
|
-
context: "Used for expensive renders"
|
|
95
|
-
|
|
96
|
-
- pattern: "Compound Components"
|
|
97
|
-
usage: "15%"
|
|
98
|
-
locations:
|
|
99
|
-
- "src/components/ui/Tabs/"
|
|
100
|
-
- "src/components/ui/Accordion/"
|
|
101
|
-
structure: |
|
|
102
|
-
<Tabs>
|
|
103
|
-
<Tabs.List>
|
|
104
|
-
<Tabs.Trigger>...</Tabs.Trigger>
|
|
105
|
-
</Tabs.List>
|
|
106
|
-
<Tabs.Content>...</Tabs.Content>
|
|
107
|
-
</Tabs>
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
### 3. State Management Patterns
|
|
113
|
-
|
|
114
|
-
```yaml
|
|
115
|
-
state_patterns:
|
|
116
|
-
global_state:
|
|
117
|
-
pattern: "Zustand Stores"
|
|
118
|
-
usage: "Primary"
|
|
119
|
-
stores_found:
|
|
120
|
-
- name: "useAuthStore"
|
|
121
|
-
path: "src/stores/authStore.ts"
|
|
122
|
-
state: ["user", "token", "isAuthenticated"]
|
|
123
|
-
actions: ["login", "logout", "setUser"]
|
|
124
|
-
|
|
125
|
-
- name: "useUIStore"
|
|
126
|
-
path: "src/stores/uiStore.ts"
|
|
127
|
-
state: ["theme", "sidebarOpen", "notifications"]
|
|
128
|
-
actions: ["setTheme", "toggleSidebar", "addNotification"]
|
|
129
|
-
|
|
130
|
-
server_state:
|
|
131
|
-
pattern: "React Query"
|
|
132
|
-
usage: "All API calls"
|
|
133
|
-
queries_found: 45
|
|
134
|
-
mutations_found: 28
|
|
135
|
-
example: |
|
|
136
|
-
const { data, isLoading } = useQuery({
|
|
137
|
-
queryKey: ['users', filters],
|
|
138
|
-
queryFn: () => userService.getUsers(filters)
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
local_state:
|
|
142
|
-
pattern: "useState for simple, useReducer for complex"
|
|
143
|
-
simple_state:
|
|
144
|
-
- "isOpen", "isLoading", "activeTab"
|
|
145
|
-
complex_state:
|
|
146
|
-
- "formState with useReducer"
|
|
147
|
-
- "multiStepWizard with useReducer"
|
|
148
|
-
|
|
149
|
-
context_usage:
|
|
150
|
-
pattern: "Context for dependency injection"
|
|
151
|
-
contexts:
|
|
152
|
-
- "ThemeContext"
|
|
153
|
-
- "AuthContext"
|
|
154
|
-
- "ToastContext"
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
### 4. API/Data Patterns
|
|
160
|
-
|
|
161
|
-
```yaml
|
|
162
|
-
api_patterns:
|
|
163
|
-
client:
|
|
164
|
-
pattern: "Axios with interceptors"
|
|
165
|
-
path: "src/lib/api.ts"
|
|
166
|
-
features:
|
|
167
|
-
- "Base URL configuration"
|
|
168
|
-
- "Auth token injection"
|
|
169
|
-
- "Error interceptor"
|
|
170
|
-
- "Request/response logging"
|
|
171
|
-
|
|
172
|
-
service_layer:
|
|
173
|
-
pattern: "Service objects"
|
|
174
|
-
structure: |
|
|
175
|
-
// Typical service pattern found
|
|
176
|
-
export const userService = {
|
|
177
|
-
getAll: (params) => api.get('/users', { params }),
|
|
178
|
-
getById: (id) => api.get(`/users/${id}`),
|
|
179
|
-
create: (data) => api.post('/users', data),
|
|
180
|
-
update: (id, data) => api.put(`/users/${id}`, data),
|
|
181
|
-
delete: (id) => api.delete(`/users/${id}`),
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
error_handling:
|
|
185
|
-
pattern: "Centralized error handling"
|
|
186
|
-
approach:
|
|
187
|
-
- "API interceptor catches errors"
|
|
188
|
-
- "Custom error classes (ApiError, ValidationError)"
|
|
189
|
-
- "Toast notifications for user feedback"
|
|
190
|
-
- "Error boundaries for React components"
|
|
191
|
-
|
|
192
|
-
data_fetching:
|
|
193
|
-
pattern: "React Query + Custom Hooks"
|
|
194
|
-
example: |
|
|
195
|
-
// Custom hook wrapping React Query
|
|
196
|
-
export function useUsers(filters: UserFilters) {
|
|
197
|
-
return useQuery({
|
|
198
|
-
queryKey: ['users', filters],
|
|
199
|
-
queryFn: () => userService.getUsers(filters),
|
|
200
|
-
staleTime: 5 * 60 * 1000,
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
### 5. Form Patterns
|
|
208
|
-
|
|
209
|
-
```yaml
|
|
210
|
-
form_patterns:
|
|
211
|
-
library: "React Hook Form"
|
|
212
|
-
validation: "Zod"
|
|
213
|
-
|
|
214
|
-
structure:
|
|
215
|
-
pattern: "Form + Schema + Component"
|
|
216
|
-
example: |
|
|
217
|
-
// 1. Schema (validation)
|
|
218
|
-
const loginSchema = z.object({
|
|
219
|
-
email: z.string().email(),
|
|
220
|
-
password: z.string().min(8),
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
// 2. Form hook
|
|
224
|
-
const form = useForm({
|
|
225
|
-
resolver: zodResolver(loginSchema),
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// 3. Component
|
|
229
|
-
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
230
|
-
<Input {...form.register('email')} />
|
|
231
|
-
<Input {...form.register('password')} />
|
|
232
|
-
</form>
|
|
233
|
-
|
|
234
|
-
field_components:
|
|
235
|
-
- "FormField" - wrapper with label/error
|
|
236
|
-
- "Input", "Select", "Checkbox" - controlled inputs
|
|
237
|
-
- "FormMessage" - error display
|
|
238
|
-
|
|
239
|
-
submission_pattern:
|
|
240
|
-
pattern: "React Query mutations"
|
|
241
|
-
example: |
|
|
242
|
-
const mutation = useMutation({
|
|
243
|
-
mutationFn: authService.login,
|
|
244
|
-
onSuccess: () => router.push('/dashboard'),
|
|
245
|
-
onError: (error) => toast.error(error.message),
|
|
246
|
-
});
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
### 6. Styling Patterns
|
|
252
|
-
|
|
253
|
-
```yaml
|
|
254
|
-
styling_patterns:
|
|
255
|
-
primary:
|
|
256
|
-
approach: "Tailwind CSS"
|
|
257
|
-
usage: "95%"
|
|
258
|
-
features:
|
|
259
|
-
- "Utility-first classes"
|
|
260
|
-
- "Custom theme in tailwind.config"
|
|
261
|
-
- "Component variants with CVA"
|
|
262
|
-
|
|
263
|
-
component_styling:
|
|
264
|
-
pattern: "CVA (Class Variance Authority)"
|
|
265
|
-
example: |
|
|
266
|
-
const buttonVariants = cva(
|
|
267
|
-
"inline-flex items-center justify-center rounded-md",
|
|
268
|
-
{
|
|
269
|
-
variants: {
|
|
270
|
-
variant: {
|
|
271
|
-
default: "bg-primary text-primary-foreground",
|
|
272
|
-
destructive: "bg-destructive text-destructive-foreground",
|
|
273
|
-
outline: "border border-input bg-background",
|
|
274
|
-
},
|
|
275
|
-
size: {
|
|
276
|
-
default: "h-10 px-4 py-2",
|
|
277
|
-
sm: "h-9 px-3",
|
|
278
|
-
lg: "h-11 px-8",
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
defaultVariants: {
|
|
282
|
-
variant: "default",
|
|
283
|
-
size: "default",
|
|
284
|
-
},
|
|
285
|
-
}
|
|
286
|
-
);
|
|
287
|
-
|
|
288
|
-
design_system:
|
|
289
|
-
tokens:
|
|
290
|
-
colors: "CSS variables in globals.css"
|
|
291
|
-
spacing: "Tailwind default scale"
|
|
292
|
-
typography: "Custom font in tailwind.config"
|
|
293
|
-
components:
|
|
294
|
-
library: "shadcn/ui pattern"
|
|
295
|
-
location: "src/components/ui/"
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
---
|
|
299
|
-
|
|
300
|
-
### 7. Testing Patterns
|
|
301
|
-
|
|
302
|
-
```yaml
|
|
303
|
-
testing_patterns:
|
|
304
|
-
unit_tests:
|
|
305
|
-
framework: "Vitest"
|
|
306
|
-
pattern: "AAA (Arrange-Act-Assert)"
|
|
307
|
-
naming: "should [expected behavior] when [condition]"
|
|
308
|
-
example: |
|
|
309
|
-
describe('UserService', () => {
|
|
310
|
-
it('should return user when valid id provided', async () => {
|
|
311
|
-
// Arrange
|
|
312
|
-
const userId = 'user-123';
|
|
313
|
-
mockApi.get.mockResolvedValue({ data: mockUser });
|
|
314
|
-
|
|
315
|
-
// Act
|
|
316
|
-
const result = await userService.getById(userId);
|
|
317
|
-
|
|
318
|
-
// Assert
|
|
319
|
-
expect(result).toEqual(mockUser);
|
|
320
|
-
expect(mockApi.get).toHaveBeenCalledWith(`/users/${userId}`);
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
component_tests:
|
|
325
|
-
framework: "Testing Library"
|
|
326
|
-
pattern: "User-centric testing"
|
|
327
|
-
queries_preferred:
|
|
328
|
-
- "getByRole"
|
|
329
|
-
- "getByLabelText"
|
|
330
|
-
- "getByText"
|
|
331
|
-
example: |
|
|
332
|
-
it('should submit form with valid data', async () => {
|
|
333
|
-
render(<LoginForm onSubmit={mockSubmit} />);
|
|
334
|
-
|
|
335
|
-
await userEvent.type(screen.getByLabelText('Email'), 'test@example.com');
|
|
336
|
-
await userEvent.type(screen.getByLabelText('Password'), 'password123');
|
|
337
|
-
await userEvent.click(screen.getByRole('button', { name: 'Login' }));
|
|
338
|
-
|
|
339
|
-
expect(mockSubmit).toHaveBeenCalledWith({
|
|
340
|
-
email: 'test@example.com',
|
|
341
|
-
password: 'password123',
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
e2e_tests:
|
|
346
|
-
framework: "Playwright"
|
|
347
|
-
pattern: "Page Object Model"
|
|
348
|
-
structure: |
|
|
349
|
-
// Page object
|
|
350
|
-
class LoginPage {
|
|
351
|
-
constructor(page) {
|
|
352
|
-
this.page = page;
|
|
353
|
-
this.emailInput = page.getByLabel('Email');
|
|
354
|
-
this.passwordInput = page.getByLabel('Password');
|
|
355
|
-
this.submitButton = page.getByRole('button', { name: 'Login' });
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
async login(email, password) {
|
|
359
|
-
await this.emailInput.fill(email);
|
|
360
|
-
await this.passwordInput.fill(password);
|
|
361
|
-
await this.submitButton.click();
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
|
|
368
|
-
### 8. Error Handling Patterns
|
|
369
|
-
|
|
370
|
-
```yaml
|
|
371
|
-
error_patterns:
|
|
372
|
-
api_errors:
|
|
373
|
-
pattern: "Custom Error Classes"
|
|
374
|
-
hierarchy:
|
|
375
|
-
- "AppError (base)"
|
|
376
|
-
- "ApiError extends AppError"
|
|
377
|
-
- "ValidationError extends AppError"
|
|
378
|
-
- "AuthError extends AppError"
|
|
379
|
-
example: |
|
|
380
|
-
class ApiError extends AppError {
|
|
381
|
-
constructor(message, status, code) {
|
|
382
|
-
super(message);
|
|
383
|
-
this.status = status;
|
|
384
|
-
this.code = code;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
react_errors:
|
|
389
|
-
pattern: "Error Boundaries"
|
|
390
|
-
usage:
|
|
391
|
-
- "Global error boundary at app level"
|
|
392
|
-
- "Feature-level boundaries for isolation"
|
|
393
|
-
fallback: "Custom error UI with retry"
|
|
394
|
-
|
|
395
|
-
async_errors:
|
|
396
|
-
pattern: "Try-catch with typed errors"
|
|
397
|
-
example: |
|
|
398
|
-
try {
|
|
399
|
-
await userService.update(id, data);
|
|
400
|
-
} catch (error) {
|
|
401
|
-
if (error instanceof ValidationError) {
|
|
402
|
-
setFieldErrors(error.fields);
|
|
403
|
-
} else if (error instanceof AuthError) {
|
|
404
|
-
router.push('/login');
|
|
405
|
-
} else {
|
|
406
|
-
toast.error('An unexpected error occurred');
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
---
|
|
412
|
-
|
|
413
|
-
### 9. File/Naming Conventions
|
|
414
|
-
|
|
415
|
-
```yaml
|
|
416
|
-
naming_conventions:
|
|
417
|
-
files:
|
|
418
|
-
components: "PascalCase.tsx"
|
|
419
|
-
hooks: "use[Name].ts"
|
|
420
|
-
services: "[name]Service.ts"
|
|
421
|
-
types: "[name].types.ts"
|
|
422
|
-
utils: "camelCase.ts"
|
|
423
|
-
constants: "UPPER_SNAKE_CASE or camelCase"
|
|
424
|
-
tests: "[name].test.ts or [name].spec.ts"
|
|
425
|
-
|
|
426
|
-
code:
|
|
427
|
-
variables: "camelCase"
|
|
428
|
-
constants: "UPPER_SNAKE_CASE"
|
|
429
|
-
functions: "camelCase"
|
|
430
|
-
classes: "PascalCase"
|
|
431
|
-
interfaces: "PascalCase (no I prefix)"
|
|
432
|
-
types: "PascalCase"
|
|
433
|
-
enums: "PascalCase with UPPER_SNAKE members"
|
|
434
|
-
|
|
435
|
-
directories:
|
|
436
|
-
features: "kebab-case"
|
|
437
|
-
components: "PascalCase"
|
|
438
|
-
utilities: "kebab-case"
|
|
439
|
-
|
|
440
|
-
examples:
|
|
441
|
-
good:
|
|
442
|
-
- "UserProfile.tsx"
|
|
443
|
-
- "useUserData.ts"
|
|
444
|
-
- "userService.ts"
|
|
445
|
-
- "MAX_RETRY_COUNT"
|
|
446
|
-
bad:
|
|
447
|
-
- "userprofile.tsx" # Should be PascalCase
|
|
448
|
-
- "UserData.ts" # Hook should have 'use' prefix
|
|
449
|
-
- "UserService.ts" # Services are camelCase
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
---
|
|
453
|
-
|
|
454
|
-
## Pattern Report
|
|
455
|
-
|
|
456
|
-
```markdown
|
|
457
|
-
# Pattern Detection Report
|
|
458
|
-
|
|
459
|
-
## Project: MyApp
|
|
460
|
-
## Analyzed: 2024-01-15
|
|
461
|
-
|
|
462
|
-
---
|
|
463
|
-
|
|
464
|
-
## Architecture
|
|
465
|
-
**Pattern:** Feature-Based Architecture
|
|
466
|
-
**Confidence:** 92%
|
|
467
|
-
**Status:** Consistently Applied
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
|
-
## Component Patterns
|
|
472
|
-
|
|
473
|
-
| Pattern | Usage | Consistency |
|
|
474
|
-
|---------|-------|-------------|
|
|
475
|
-
| Functional Components | 100% | High |
|
|
476
|
-
| Props Interface First | 95% | High |
|
|
477
|
-
| Custom Hooks | 85% | High |
|
|
478
|
-
| Memo for Performance | 40% | Medium |
|
|
479
|
-
|
|
480
|
-
---
|
|
481
|
-
|
|
482
|
-
## State Management
|
|
483
|
-
|
|
484
|
-
| Scope | Solution | Adoption |
|
|
485
|
-
|-------|----------|----------|
|
|
486
|
-
| Global State | Zustand | 100% |
|
|
487
|
-
| Server State | React Query | 100% |
|
|
488
|
-
| Form State | React Hook Form | 100% |
|
|
489
|
-
| Local State | useState/useReducer | 100% |
|
|
490
|
-
|
|
491
|
-
---
|
|
492
|
-
|
|
493
|
-
## API Patterns
|
|
494
|
-
- **Client:** Axios with interceptors
|
|
495
|
-
- **Services:** Object method pattern
|
|
496
|
-
- **Error Handling:** Custom error classes
|
|
497
|
-
|
|
498
|
-
---
|
|
499
|
-
|
|
500
|
-
## Inconsistencies Found
|
|
501
|
-
|
|
502
|
-
1. **Naming inconsistency in `/src/utils/`**
|
|
503
|
-
- `formatDate.ts` vs `StringHelpers.ts`
|
|
504
|
-
- Recommendation: Use camelCase for all utils
|
|
505
|
-
|
|
506
|
-
2. **Mixed error handling in forms**
|
|
507
|
-
- Some use try-catch, some use onError
|
|
508
|
-
- Recommendation: Standardize on mutation onError
|
|
509
|
-
|
|
510
|
-
3. **Test naming variations**
|
|
511
|
-
- `.test.ts` and `.spec.ts` both used
|
|
512
|
-
- Recommendation: Standardize on `.test.ts`
|
|
513
|
-
|
|
514
|
-
---
|
|
515
|
-
|
|
516
|
-
## Recommendations
|
|
517
|
-
|
|
518
|
-
1. Create a CONVENTIONS.md documenting detected patterns
|
|
519
|
-
2. Add ESLint rules to enforce naming conventions
|
|
520
|
-
3. Standardize error handling approach
|
|
521
|
-
4. Consider adding more Memo usage for list items
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
---
|
|
525
|
-
|
|
526
|
-
## Configuration
|
|
527
|
-
|
|
528
|
-
```yaml
|
|
529
|
-
# proagents.config.yaml
|
|
530
|
-
|
|
531
|
-
reverse_engineering:
|
|
532
|
-
pattern_detection:
|
|
533
|
-
enabled: true
|
|
534
|
-
|
|
535
|
-
detect:
|
|
536
|
-
- architecture_patterns
|
|
537
|
-
- component_patterns
|
|
538
|
-
- state_patterns
|
|
539
|
-
- api_patterns
|
|
540
|
-
- form_patterns
|
|
541
|
-
- styling_patterns
|
|
542
|
-
- testing_patterns
|
|
543
|
-
- error_patterns
|
|
544
|
-
- naming_conventions
|
|
545
|
-
|
|
546
|
-
report:
|
|
547
|
-
generate: true
|
|
548
|
-
format: "markdown"
|
|
549
|
-
include_examples: true
|
|
550
|
-
include_recommendations: true
|
|
551
|
-
|
|
552
|
-
learning:
|
|
553
|
-
store_patterns: true
|
|
554
|
-
apply_to_new_code: true
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
---
|
|
558
|
-
|
|
559
|
-
## Commands
|
|
560
|
-
|
|
561
|
-
| Command | Description |
|
|
562
|
-
|---------|-------------|
|
|
563
|
-
| `pa:re-patterns` | Detect all patterns |
|
|
564
|
-
| `pa:re-patterns --type architecture` | Architecture patterns only |
|
|
565
|
-
| `pa:re-patterns --type components` | Component patterns only |
|
|
566
|
-
| `pa:re-patterns --type state` | State management patterns |
|
|
567
|
-
| `pa:re-patterns --type naming` | Naming conventions only |
|
|
568
|
-
| `pa:re-patterns --report` | Generate full report |
|
|
569
|
-
| `pa:re-patterns --inconsistencies` | Show inconsistencies only |
|