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,406 +0,0 @@
|
|
|
1
|
-
# Structured Logging
|
|
2
|
-
|
|
3
|
-
JSON-formatted logs for better parsing and analysis.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Why Structured Logging?
|
|
8
|
-
|
|
9
|
-
| Unstructured | Structured |
|
|
10
|
-
|--------------|------------|
|
|
11
|
-
| `User john logged in at 2024-01-15` | `{"event":"login","user":"john","time":"2024-01-15T10:30:00Z"}` |
|
|
12
|
-
| Hard to parse | Easy to parse |
|
|
13
|
-
| Inconsistent format | Consistent schema |
|
|
14
|
-
| Limited querying | Rich querying |
|
|
15
|
-
| Manual correlation | Automatic correlation |
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Log Schema
|
|
20
|
-
|
|
21
|
-
### Standard Fields
|
|
22
|
-
|
|
23
|
-
```yaml
|
|
24
|
-
# proagents.config.yaml
|
|
25
|
-
logging:
|
|
26
|
-
structured:
|
|
27
|
-
enabled: true
|
|
28
|
-
|
|
29
|
-
# Standard fields included in every log
|
|
30
|
-
standard_fields:
|
|
31
|
-
timestamp:
|
|
32
|
-
format: "iso8601"
|
|
33
|
-
field_name: "@timestamp"
|
|
34
|
-
|
|
35
|
-
level:
|
|
36
|
-
field_name: "level"
|
|
37
|
-
include_numeric: true
|
|
38
|
-
|
|
39
|
-
message:
|
|
40
|
-
field_name: "message"
|
|
41
|
-
|
|
42
|
-
# Service identification
|
|
43
|
-
service:
|
|
44
|
-
name: "${SERVICE_NAME}"
|
|
45
|
-
version: "${SERVICE_VERSION}"
|
|
46
|
-
environment: "${NODE_ENV}"
|
|
47
|
-
instance_id: "${HOSTNAME}"
|
|
48
|
-
|
|
49
|
-
# Request context (when available)
|
|
50
|
-
request:
|
|
51
|
-
include: ["request_id", "trace_id", "span_id"]
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Log Entry Format
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
{
|
|
58
|
-
"@timestamp": "2024-01-15T10:30:00.123Z",
|
|
59
|
-
"level": "info",
|
|
60
|
-
"level_value": 30,
|
|
61
|
-
"message": "User logged in successfully",
|
|
62
|
-
"service": {
|
|
63
|
-
"name": "auth-service",
|
|
64
|
-
"version": "1.2.3",
|
|
65
|
-
"environment": "production",
|
|
66
|
-
"instance_id": "auth-service-abc123"
|
|
67
|
-
},
|
|
68
|
-
"request": {
|
|
69
|
-
"id": "req-uuid-12345",
|
|
70
|
-
"trace_id": "trace-uuid-67890",
|
|
71
|
-
"span_id": "span-uuid-11111"
|
|
72
|
-
},
|
|
73
|
-
"event": {
|
|
74
|
-
"type": "user.login",
|
|
75
|
-
"outcome": "success"
|
|
76
|
-
},
|
|
77
|
-
"user": {
|
|
78
|
-
"id": "user-123",
|
|
79
|
-
"email": "j***@example.com"
|
|
80
|
-
},
|
|
81
|
-
"http": {
|
|
82
|
-
"method": "POST",
|
|
83
|
-
"path": "/api/auth/login",
|
|
84
|
-
"status_code": 200,
|
|
85
|
-
"duration_ms": 145
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Field Configuration
|
|
93
|
-
|
|
94
|
-
### Custom Fields
|
|
95
|
-
|
|
96
|
-
```yaml
|
|
97
|
-
logging:
|
|
98
|
-
structured:
|
|
99
|
-
custom_fields:
|
|
100
|
-
# Business context
|
|
101
|
-
tenant:
|
|
102
|
-
source: "context.tenant_id"
|
|
103
|
-
always_include: true
|
|
104
|
-
|
|
105
|
-
feature_flags:
|
|
106
|
-
source: "context.active_flags"
|
|
107
|
-
include_when: "level <= info"
|
|
108
|
-
|
|
109
|
-
# Performance metrics
|
|
110
|
-
performance:
|
|
111
|
-
include:
|
|
112
|
-
- "duration_ms"
|
|
113
|
-
- "memory_used"
|
|
114
|
-
- "cpu_time"
|
|
115
|
-
|
|
116
|
-
# Error details
|
|
117
|
-
error:
|
|
118
|
-
include_when: "level >= error"
|
|
119
|
-
fields:
|
|
120
|
-
- "name"
|
|
121
|
-
- "message"
|
|
122
|
-
- "stack"
|
|
123
|
-
- "code"
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Field Naming Convention
|
|
127
|
-
|
|
128
|
-
```yaml
|
|
129
|
-
logging:
|
|
130
|
-
structured:
|
|
131
|
-
naming:
|
|
132
|
-
# Naming style
|
|
133
|
-
style: "snake_case" # or camelCase, kebab-case
|
|
134
|
-
|
|
135
|
-
# Namespace separator
|
|
136
|
-
separator: "."
|
|
137
|
-
|
|
138
|
-
# Reserved prefixes
|
|
139
|
-
reserved:
|
|
140
|
-
- "@" # Elasticsearch metadata
|
|
141
|
-
- "_" # Internal fields
|
|
142
|
-
- "ecs." # Elastic Common Schema
|
|
143
|
-
|
|
144
|
-
# Field mappings
|
|
145
|
-
mappings:
|
|
146
|
-
userId: "user.id"
|
|
147
|
-
requestId: "request.id"
|
|
148
|
-
errorMessage: "error.message"
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## Context Propagation
|
|
154
|
-
|
|
155
|
-
### Request Context
|
|
156
|
-
|
|
157
|
-
```yaml
|
|
158
|
-
logging:
|
|
159
|
-
structured:
|
|
160
|
-
context:
|
|
161
|
-
# Automatic context capture
|
|
162
|
-
auto_capture:
|
|
163
|
-
http_request:
|
|
164
|
-
include:
|
|
165
|
-
- "method"
|
|
166
|
-
- "path"
|
|
167
|
-
- "query_params"
|
|
168
|
-
- "headers.user-agent"
|
|
169
|
-
- "headers.x-request-id"
|
|
170
|
-
exclude:
|
|
171
|
-
- "headers.authorization"
|
|
172
|
-
- "headers.cookie"
|
|
173
|
-
|
|
174
|
-
user:
|
|
175
|
-
include:
|
|
176
|
-
- "id"
|
|
177
|
-
- "role"
|
|
178
|
-
exclude:
|
|
179
|
-
- "password"
|
|
180
|
-
- "api_key"
|
|
181
|
-
|
|
182
|
-
# Context propagation
|
|
183
|
-
propagation:
|
|
184
|
-
trace_id:
|
|
185
|
-
header: "x-trace-id"
|
|
186
|
-
generate_if_missing: true
|
|
187
|
-
|
|
188
|
-
span_id:
|
|
189
|
-
header: "x-span-id"
|
|
190
|
-
generate_if_missing: true
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Async Context
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
// Context management
|
|
197
|
-
import { LogContext } from '@proagents/logging';
|
|
198
|
-
|
|
199
|
-
// Set context for async operations
|
|
200
|
-
LogContext.run({ requestId: 'req-123', userId: 'user-456' }, async () => {
|
|
201
|
-
// All logs in this context include requestId and userId
|
|
202
|
-
logger.info('Processing started');
|
|
203
|
-
await processData();
|
|
204
|
-
logger.info('Processing completed');
|
|
205
|
-
});
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## Log Formatters
|
|
211
|
-
|
|
212
|
-
### JSON Formatter
|
|
213
|
-
|
|
214
|
-
```yaml
|
|
215
|
-
logging:
|
|
216
|
-
formatters:
|
|
217
|
-
json:
|
|
218
|
-
# Pretty print in development
|
|
219
|
-
pretty:
|
|
220
|
-
enabled: "${NODE_ENV !== 'production'}"
|
|
221
|
-
indent: 2
|
|
222
|
-
|
|
223
|
-
# Escape special characters
|
|
224
|
-
escape_unicode: false
|
|
225
|
-
|
|
226
|
-
# Include null fields
|
|
227
|
-
include_null: false
|
|
228
|
-
|
|
229
|
-
# Max depth for nested objects
|
|
230
|
-
max_depth: 5
|
|
231
|
-
|
|
232
|
-
# Circular reference handling
|
|
233
|
-
circular: "replace" # or "error", "ignore"
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Output Examples
|
|
237
|
-
|
|
238
|
-
```yaml
|
|
239
|
-
logging:
|
|
240
|
-
formatters:
|
|
241
|
-
# Production (compact JSON)
|
|
242
|
-
production:
|
|
243
|
-
type: "json"
|
|
244
|
-
single_line: true
|
|
245
|
-
|
|
246
|
-
# Development (readable)
|
|
247
|
-
development:
|
|
248
|
-
type: "pretty"
|
|
249
|
-
colors: true
|
|
250
|
-
timestamp_format: "HH:mm:ss.SSS"
|
|
251
|
-
|
|
252
|
-
# Debug (full details)
|
|
253
|
-
debug:
|
|
254
|
-
type: "json"
|
|
255
|
-
pretty: true
|
|
256
|
-
include_all: true
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
## Common Schemas
|
|
262
|
-
|
|
263
|
-
### ECS (Elastic Common Schema)
|
|
264
|
-
|
|
265
|
-
```yaml
|
|
266
|
-
logging:
|
|
267
|
-
structured:
|
|
268
|
-
schema: "ecs"
|
|
269
|
-
|
|
270
|
-
ecs:
|
|
271
|
-
version: "8.0"
|
|
272
|
-
|
|
273
|
-
# Field mappings to ECS
|
|
274
|
-
mappings:
|
|
275
|
-
timestamp: "@timestamp"
|
|
276
|
-
level: "log.level"
|
|
277
|
-
message: "message"
|
|
278
|
-
service_name: "service.name"
|
|
279
|
-
trace_id: "trace.id"
|
|
280
|
-
span_id: "span.id"
|
|
281
|
-
user_id: "user.id"
|
|
282
|
-
http_method: "http.request.method"
|
|
283
|
-
http_status: "http.response.status_code"
|
|
284
|
-
error_message: "error.message"
|
|
285
|
-
error_stack: "error.stack_trace"
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
### OpenTelemetry
|
|
289
|
-
|
|
290
|
-
```yaml
|
|
291
|
-
logging:
|
|
292
|
-
structured:
|
|
293
|
-
schema: "otel"
|
|
294
|
-
|
|
295
|
-
otel:
|
|
296
|
-
version: "1.0"
|
|
297
|
-
|
|
298
|
-
# Resource attributes
|
|
299
|
-
resource:
|
|
300
|
-
service.name: "${SERVICE_NAME}"
|
|
301
|
-
service.version: "${VERSION}"
|
|
302
|
-
deployment.environment: "${ENVIRONMENT}"
|
|
303
|
-
|
|
304
|
-
# Automatic context from traces
|
|
305
|
-
trace_context:
|
|
306
|
-
enabled: true
|
|
307
|
-
fields:
|
|
308
|
-
- "trace_id"
|
|
309
|
-
- "span_id"
|
|
310
|
-
- "trace_flags"
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
## Code Examples
|
|
316
|
-
|
|
317
|
-
### JavaScript/TypeScript
|
|
318
|
-
|
|
319
|
-
```typescript
|
|
320
|
-
import { createLogger } from '@proagents/logging';
|
|
321
|
-
|
|
322
|
-
const logger = createLogger({
|
|
323
|
-
name: 'my-service',
|
|
324
|
-
level: 'info',
|
|
325
|
-
format: 'json',
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
// Simple log
|
|
329
|
-
logger.info('Server started', { port: 3000 });
|
|
330
|
-
|
|
331
|
-
// With context
|
|
332
|
-
logger.info('User action', {
|
|
333
|
-
event: { type: 'purchase', outcome: 'success' },
|
|
334
|
-
user: { id: 'user-123' },
|
|
335
|
-
order: { id: 'order-456', total: 99.99 },
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
// Error logging
|
|
339
|
-
try {
|
|
340
|
-
await processOrder(order);
|
|
341
|
-
} catch (error) {
|
|
342
|
-
logger.error('Order processing failed', {
|
|
343
|
-
error: {
|
|
344
|
-
name: error.name,
|
|
345
|
-
message: error.message,
|
|
346
|
-
stack: error.stack,
|
|
347
|
-
},
|
|
348
|
-
order: { id: order.id },
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
### Express Middleware
|
|
354
|
-
|
|
355
|
-
```typescript
|
|
356
|
-
import { requestLogger } from '@proagents/logging/express';
|
|
357
|
-
|
|
358
|
-
app.use(requestLogger({
|
|
359
|
-
// Log request start
|
|
360
|
-
logStart: true,
|
|
361
|
-
|
|
362
|
-
// Log request end
|
|
363
|
-
logEnd: true,
|
|
364
|
-
|
|
365
|
-
// Include fields
|
|
366
|
-
include: ['method', 'path', 'status', 'duration'],
|
|
367
|
-
|
|
368
|
-
// Exclude paths
|
|
369
|
-
exclude: ['/health', '/metrics'],
|
|
370
|
-
|
|
371
|
-
// Custom field extraction
|
|
372
|
-
customFields: (req, res) => ({
|
|
373
|
-
user_id: req.user?.id,
|
|
374
|
-
tenant_id: req.tenant?.id,
|
|
375
|
-
}),
|
|
376
|
-
}));
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
## Commands
|
|
382
|
-
|
|
383
|
-
```bash
|
|
384
|
-
# Validate log format
|
|
385
|
-
proagents logging validate --format json
|
|
386
|
-
|
|
387
|
-
# Convert logs to structured format
|
|
388
|
-
proagents logging convert --input app.log --output app.json
|
|
389
|
-
|
|
390
|
-
# Query structured logs
|
|
391
|
-
proagents logging query --filter 'level:error AND service.name:api'
|
|
392
|
-
|
|
393
|
-
# Generate log schema
|
|
394
|
-
proagents logging schema --output schema.json
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
---
|
|
398
|
-
|
|
399
|
-
## Best Practices
|
|
400
|
-
|
|
401
|
-
1. **Consistent Schema**: Use the same field names across services
|
|
402
|
-
2. **Include Context**: Add request/trace IDs for correlation
|
|
403
|
-
3. **Avoid Nesting**: Keep structure relatively flat
|
|
404
|
-
4. **Type Consistency**: Same field should have same type
|
|
405
|
-
5. **Meaningful Events**: Use event.type for categorization
|
|
406
|
-
6. **Redact Sensitive Data**: Never log PII or secrets
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Code Metrics
|
|
2
|
-
|
|
3
|
-
This folder contains code quality metrics and reports.
|
|
4
|
-
|
|
5
|
-
## Commands
|
|
6
|
-
|
|
7
|
-
- `pa:metrics` - Show current code quality metrics
|
|
8
|
-
- `pa:metrics-history` - Show metrics over time
|
|
9
|
-
- `pa:coverage` - Show test coverage report
|
|
10
|
-
- `pa:coverage-diff` - Show coverage changes
|
|
11
|
-
|
|
12
|
-
## Files
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
metrics/
|
|
16
|
-
├── latest.json # Most recent metrics snapshot
|
|
17
|
-
├── history/ # Historical metrics
|
|
18
|
-
│ ├── 2024-03-01.json
|
|
19
|
-
│ └── 2024-03-15.json
|
|
20
|
-
└── README.md
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Metrics Format
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
{
|
|
27
|
-
"timestamp": "2024-03-06T15:00:00Z",
|
|
28
|
-
"generated_by": "Claude:opus-4",
|
|
29
|
-
"summary": {
|
|
30
|
-
"total_files": 45,
|
|
31
|
-
"total_lines": 12500,
|
|
32
|
-
"languages": {
|
|
33
|
-
"typescript": 10200,
|
|
34
|
-
"javascript": 1500,
|
|
35
|
-
"css": 800
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"quality": {
|
|
39
|
-
"complexity": {
|
|
40
|
-
"average": 4.2,
|
|
41
|
-
"max": 15,
|
|
42
|
-
"high_complexity_files": ["src/utils/parser.ts"]
|
|
43
|
-
},
|
|
44
|
-
"duplication": {
|
|
45
|
-
"percentage": 3.5,
|
|
46
|
-
"duplicated_blocks": 12
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"coverage": {
|
|
50
|
-
"overall": 82,
|
|
51
|
-
"by_module": {
|
|
52
|
-
"src/auth": 95,
|
|
53
|
-
"src/api": 78,
|
|
54
|
-
"src/utils": 65
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Thresholds
|
|
61
|
-
|
|
62
|
-
Default thresholds (customize in proagents.config.yaml):
|
|
63
|
-
|
|
64
|
-
| Metric | Warning | Error |
|
|
65
|
-
|--------|---------|-------|
|
|
66
|
-
| Coverage | < 70% | < 50% |
|
|
67
|
-
| Complexity | > 10 | > 20 |
|
|
68
|
-
| File size | > 300 lines | > 500 lines |
|
|
69
|
-
| Duplication | > 5% | > 10% |
|