@paths.design/caws-cli 2.0.1 → 3.1.0
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +1463 -121
- package/package.json +3 -2
- package/templates/agents.md +820 -0
- package/templates/apps/tools/caws/COMPLETION_REPORT.md +331 -0
- package/templates/apps/tools/caws/MIGRATION_SUMMARY.md +360 -0
- package/templates/apps/tools/caws/README.md +463 -0
- package/templates/apps/tools/caws/TEST_STATUS.md +365 -0
- package/templates/apps/tools/caws/attest.js +357 -0
- package/templates/apps/tools/caws/ci-optimizer.js +642 -0
- package/templates/apps/tools/caws/config.ts +245 -0
- package/templates/apps/tools/caws/cross-functional.js +876 -0
- package/templates/apps/tools/caws/dashboard.js +1112 -0
- package/templates/apps/tools/caws/flake-detector.ts +362 -0
- package/templates/apps/tools/caws/gates.js +198 -0
- package/templates/apps/tools/caws/gates.ts +237 -0
- package/templates/apps/tools/caws/language-adapters.ts +381 -0
- package/templates/apps/tools/caws/language-support.d.ts +367 -0
- package/templates/apps/tools/caws/language-support.d.ts.map +1 -0
- package/templates/apps/tools/caws/language-support.js +585 -0
- package/templates/apps/tools/caws/legacy-assessment.ts +408 -0
- package/templates/apps/tools/caws/legacy-assessor.js +764 -0
- package/templates/apps/tools/caws/mutant-analyzer.js +734 -0
- package/templates/apps/tools/caws/perf-budgets.ts +349 -0
- package/templates/apps/tools/caws/prompt-lint.js.backup +274 -0
- package/templates/apps/tools/caws/property-testing.js +707 -0
- package/templates/apps/tools/caws/provenance.d.ts +14 -0
- package/templates/apps/tools/caws/provenance.d.ts.map +1 -0
- package/templates/apps/tools/caws/provenance.js +132 -0
- package/templates/apps/tools/caws/provenance.js.backup +73 -0
- package/templates/apps/tools/caws/provenance.ts +211 -0
- package/templates/apps/tools/caws/schemas/waivers.schema.json +30 -0
- package/templates/apps/tools/caws/schemas/working-spec.schema.json +115 -0
- package/templates/apps/tools/caws/scope-guard.js +208 -0
- package/templates/apps/tools/caws/security-provenance.ts +483 -0
- package/templates/apps/tools/caws/shared/base-tool.ts +281 -0
- package/templates/apps/tools/caws/shared/config-manager.ts +366 -0
- package/templates/apps/tools/caws/shared/gate-checker.ts +597 -0
- package/templates/apps/tools/caws/shared/types.ts +444 -0
- package/templates/apps/tools/caws/shared/validator.ts +305 -0
- package/templates/apps/tools/caws/shared/waivers-manager.ts +174 -0
- package/templates/apps/tools/caws/spec-test-mapper.ts +391 -0
- package/templates/apps/tools/caws/templates/working-spec.template.yml +60 -0
- package/templates/apps/tools/caws/test-quality.js +578 -0
- package/templates/apps/tools/caws/tools-allow.json +331 -0
- package/templates/apps/tools/caws/validate.js +76 -0
- package/templates/apps/tools/caws/validate.ts +228 -0
- package/templates/apps/tools/caws/waivers.js +344 -0
- package/templates/apps/tools/caws/waivers.yml +19 -0
- package/templates/codemod/README.md +1 -0
- package/templates/codemod/test.js +1 -0
- package/templates/docs/README.md +150 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CAWS Shared Types and Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Consolidated type definitions used across all CAWS tools
|
|
5
|
+
*
|
|
6
|
+
* @author @darianrosebrook
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// CORE INTERFACES
|
|
11
|
+
// =============================================================================
|
|
12
|
+
|
|
13
|
+
export interface ValidationDetailsSchema {
|
|
14
|
+
type: 'object';
|
|
15
|
+
properties: {
|
|
16
|
+
passed: { type: 'boolean' };
|
|
17
|
+
score: { type: 'number' };
|
|
18
|
+
details: { type: 'object' };
|
|
19
|
+
};
|
|
20
|
+
required: ['passed', 'score', 'details'];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ValidationResult {
|
|
24
|
+
passed: boolean;
|
|
25
|
+
score: number;
|
|
26
|
+
details: any;
|
|
27
|
+
errors?: string[];
|
|
28
|
+
warnings?: string[];
|
|
29
|
+
recommendations?: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface GateResult extends ValidationResult {
|
|
33
|
+
tier?: number | string;
|
|
34
|
+
tierPolicy?: TierPolicy;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface AccessibilityResult {
|
|
38
|
+
passed: boolean;
|
|
39
|
+
score: number;
|
|
40
|
+
details: any;
|
|
41
|
+
violations: Array<{
|
|
42
|
+
rule: string;
|
|
43
|
+
severity: 'error' | 'warning' | 'info';
|
|
44
|
+
message: string;
|
|
45
|
+
location?: string;
|
|
46
|
+
}>;
|
|
47
|
+
recommendations: string[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface PerformanceResult {
|
|
51
|
+
endpoint: string;
|
|
52
|
+
p95_ms: number;
|
|
53
|
+
budget_ms: number;
|
|
54
|
+
passed: boolean;
|
|
55
|
+
deviation_percent: number;
|
|
56
|
+
score: number;
|
|
57
|
+
details: any;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ContractDetails {
|
|
61
|
+
endpoint: string;
|
|
62
|
+
method: string;
|
|
63
|
+
status: 'valid' | 'invalid' | 'warning';
|
|
64
|
+
schema?: Record<string, any>;
|
|
65
|
+
examples?: Array<{
|
|
66
|
+
request?: Record<string, any>;
|
|
67
|
+
response?: Record<string, any>;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface NonFunctionalRequirements {
|
|
72
|
+
performance?: {
|
|
73
|
+
maxResponseTime?: number;
|
|
74
|
+
throughput?: number;
|
|
75
|
+
};
|
|
76
|
+
security?: {
|
|
77
|
+
authentication?: boolean;
|
|
78
|
+
authorization?: boolean;
|
|
79
|
+
encryption?: boolean;
|
|
80
|
+
};
|
|
81
|
+
reliability?: {
|
|
82
|
+
availability?: number;
|
|
83
|
+
errorRate?: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface ContractValidationResult {
|
|
88
|
+
passed: boolean;
|
|
89
|
+
score: number;
|
|
90
|
+
details: Record<string, any>;
|
|
91
|
+
risk_tier?: number;
|
|
92
|
+
acceptance?: string[];
|
|
93
|
+
contracts?: ContractDetails[];
|
|
94
|
+
non_functional?: NonFunctionalRequirements;
|
|
95
|
+
errors: Array<{
|
|
96
|
+
type: 'request' | 'response' | 'schema';
|
|
97
|
+
endpoint: string;
|
|
98
|
+
message: string;
|
|
99
|
+
details?: any;
|
|
100
|
+
}>;
|
|
101
|
+
coverage: {
|
|
102
|
+
endpointsTested: number;
|
|
103
|
+
totalEndpoints: number;
|
|
104
|
+
schemasValidated: number;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface TrustScoreComponents {
|
|
109
|
+
coverage_branch: number;
|
|
110
|
+
mutation_score: number;
|
|
111
|
+
contracts_consumer: boolean;
|
|
112
|
+
contracts_provider: boolean;
|
|
113
|
+
a11y_passed: boolean;
|
|
114
|
+
perf_within_budget: boolean;
|
|
115
|
+
flake_rate: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface TrustScoreResult {
|
|
119
|
+
total_score: number;
|
|
120
|
+
tier: string;
|
|
121
|
+
components: TrustScoreComponents;
|
|
122
|
+
breakdown: {
|
|
123
|
+
coverage: number;
|
|
124
|
+
mutation: number;
|
|
125
|
+
contracts: number;
|
|
126
|
+
a11y: number;
|
|
127
|
+
perf: number;
|
|
128
|
+
flake: number;
|
|
129
|
+
};
|
|
130
|
+
recommendations: string[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// =============================================================================
|
|
134
|
+
// FEATURE FLAG TYPES
|
|
135
|
+
// =============================================================================
|
|
136
|
+
|
|
137
|
+
export interface FeatureFlag {
|
|
138
|
+
name: string;
|
|
139
|
+
description: string;
|
|
140
|
+
enabled: boolean;
|
|
141
|
+
rolloutPercentage: number;
|
|
142
|
+
environment: string[];
|
|
143
|
+
userGroups: string[];
|
|
144
|
+
dependencies: string[];
|
|
145
|
+
createdAt: string;
|
|
146
|
+
updatedAt: string;
|
|
147
|
+
killSwitch?: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface FeatureFlagUpdate {
|
|
151
|
+
name: string;
|
|
152
|
+
enabled?: boolean;
|
|
153
|
+
rolloutPercentage?: number;
|
|
154
|
+
environment?: string[];
|
|
155
|
+
userGroups?: string[];
|
|
156
|
+
killSwitch?: boolean;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface FeatureFlagEvaluation {
|
|
160
|
+
enabled: boolean;
|
|
161
|
+
flag: FeatureFlag;
|
|
162
|
+
reason: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface FeatureContext {
|
|
166
|
+
environment: string;
|
|
167
|
+
userId?: string;
|
|
168
|
+
userGroups?: string[];
|
|
169
|
+
requestId?: string;
|
|
170
|
+
metadata?: any;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// =============================================================================
|
|
174
|
+
// CONFIGURATION TYPES
|
|
175
|
+
// =============================================================================
|
|
176
|
+
|
|
177
|
+
export interface PerformanceBudget {
|
|
178
|
+
api_p95_ms: number;
|
|
179
|
+
ingestion_rate?: number;
|
|
180
|
+
ocr_processing_ms?: number;
|
|
181
|
+
speech_processing_per_second?: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface TierPolicy {
|
|
185
|
+
min_branch: number;
|
|
186
|
+
min_coverage: number;
|
|
187
|
+
min_mutation: number;
|
|
188
|
+
requires_contracts: boolean;
|
|
189
|
+
requires_manual_review?: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// =============================================================================
|
|
193
|
+
// WAIVER AND OVERRIDE TYPES
|
|
194
|
+
// =============================================================================
|
|
195
|
+
|
|
196
|
+
export interface WaiverConfig {
|
|
197
|
+
gate: string;
|
|
198
|
+
reason: string;
|
|
199
|
+
owner: string;
|
|
200
|
+
expiry: string;
|
|
201
|
+
compensating_control?: string;
|
|
202
|
+
ticket_url?: string;
|
|
203
|
+
approved_by?: string;
|
|
204
|
+
created_at: string;
|
|
205
|
+
status: 'active' | 'expired' | 'revoked';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface HumanOverride {
|
|
209
|
+
approved_by: string;
|
|
210
|
+
reason: string;
|
|
211
|
+
waived_requirements: string[];
|
|
212
|
+
expiry_date?: string;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface AIAssessment {
|
|
216
|
+
confidence_level: number;
|
|
217
|
+
uncertainty_areas: string[];
|
|
218
|
+
recommended_pairing?: boolean;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface ExperimentConfig {
|
|
222
|
+
enabled: boolean;
|
|
223
|
+
timeboxed_hours?: number;
|
|
224
|
+
success_criteria?: string[];
|
|
225
|
+
expiry_date?: string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// =============================================================================
|
|
229
|
+
// CAWS GATE TYPES
|
|
230
|
+
// =============================================================================
|
|
231
|
+
|
|
232
|
+
export interface CoverageData {
|
|
233
|
+
branches: { pct: number };
|
|
234
|
+
functions: { pct: number };
|
|
235
|
+
lines: { pct: number };
|
|
236
|
+
statements: { pct: number };
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface MutationData {
|
|
240
|
+
metrics: {
|
|
241
|
+
killed?: number;
|
|
242
|
+
survived?: number;
|
|
243
|
+
totalDetected?: number;
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface ContractTestResults {
|
|
248
|
+
numPassed: number;
|
|
249
|
+
numTotal: number;
|
|
250
|
+
consumer?: boolean;
|
|
251
|
+
provider?: boolean;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface TierPolicyConfig {
|
|
255
|
+
[tier: number]: TierPolicy;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface GateCheckOptions {
|
|
259
|
+
tier: number;
|
|
260
|
+
workingDirectory?: string;
|
|
261
|
+
verbose?: boolean;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface GateConfig {
|
|
265
|
+
enabled: boolean;
|
|
266
|
+
threshold?: number;
|
|
267
|
+
timeout?: number;
|
|
268
|
+
retries?: number;
|
|
269
|
+
options?: Record<string, any>;
|
|
270
|
+
thresholds?: Record<string, number>;
|
|
271
|
+
required?: boolean;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface ToolConfig {
|
|
275
|
+
name?: string;
|
|
276
|
+
version?: string;
|
|
277
|
+
enabled?: boolean;
|
|
278
|
+
config?: Record<string, any>;
|
|
279
|
+
dependencies?: string[];
|
|
280
|
+
command?: string;
|
|
281
|
+
args?: string[];
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface LoggingConfig {
|
|
285
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
286
|
+
format?: 'json' | 'text';
|
|
287
|
+
output?: 'console' | 'file' | 'both';
|
|
288
|
+
filePath?: string;
|
|
289
|
+
file?: string;
|
|
290
|
+
maxSize?: number;
|
|
291
|
+
maxFiles?: number;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface FeatureConfig {
|
|
295
|
+
name?: string;
|
|
296
|
+
enabled: boolean;
|
|
297
|
+
config?: Record<string, any>;
|
|
298
|
+
dependencies?: string[];
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface CawsConfig {
|
|
302
|
+
version?: string;
|
|
303
|
+
environment?: string;
|
|
304
|
+
tiers: TierPolicyConfig;
|
|
305
|
+
defaultTier: string;
|
|
306
|
+
workingSpecPath: string;
|
|
307
|
+
provenancePath: string;
|
|
308
|
+
cawsDirectory: string;
|
|
309
|
+
waiversPath?: string;
|
|
310
|
+
paths?: Record<string, string>;
|
|
311
|
+
gates?: Record<string, GateConfig>;
|
|
312
|
+
tools?: Record<string, ToolConfig>;
|
|
313
|
+
logging?: LoggingConfig;
|
|
314
|
+
features?: Record<string, FeatureConfig | boolean>;
|
|
315
|
+
waivers?: Record<string, WaiverConfig>;
|
|
316
|
+
experiment_defaults?: ExperimentConfig;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// =============================================================================
|
|
320
|
+
// MIGRATION TYPES
|
|
321
|
+
// =============================================================================
|
|
322
|
+
|
|
323
|
+
export interface MigrationStep {
|
|
324
|
+
id: string;
|
|
325
|
+
description: string;
|
|
326
|
+
sql: string;
|
|
327
|
+
rollback_sql?: string;
|
|
328
|
+
dependencies?: string[];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// =============================================================================
|
|
332
|
+
// TEST TYPES
|
|
333
|
+
// =============================================================================
|
|
334
|
+
|
|
335
|
+
export interface TestResult {
|
|
336
|
+
title: string;
|
|
337
|
+
fullName: string;
|
|
338
|
+
status: 'passed' | 'failed' | 'pending' | 'skipped';
|
|
339
|
+
duration: number;
|
|
340
|
+
failureMessages: string[];
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface TestSuiteResult {
|
|
344
|
+
name: string;
|
|
345
|
+
status: 'passed' | 'failed';
|
|
346
|
+
testResults: TestResult[];
|
|
347
|
+
startTime: number;
|
|
348
|
+
endTime: number;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface FlakeDetectionResult {
|
|
352
|
+
flakyTests: string[];
|
|
353
|
+
varianceScore: number;
|
|
354
|
+
totalRuns: number;
|
|
355
|
+
recommendations: string[];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface HistoricalTestData {
|
|
359
|
+
runs: TestRun[];
|
|
360
|
+
quarantined: Set<string>;
|
|
361
|
+
lastUpdated: string;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export interface TestRun {
|
|
365
|
+
timestamp: number;
|
|
366
|
+
results: Map<string, TestResult>;
|
|
367
|
+
variance: number;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// =============================================================================
|
|
371
|
+
// PROVENANCE TYPES
|
|
372
|
+
// =============================================================================
|
|
373
|
+
|
|
374
|
+
export interface PerformanceMetrics {
|
|
375
|
+
p95_ms?: number;
|
|
376
|
+
p99_ms?: number;
|
|
377
|
+
average_ms?: number;
|
|
378
|
+
throughput?: number;
|
|
379
|
+
error_rate?: number;
|
|
380
|
+
budget_ms?: number;
|
|
381
|
+
deviation_percent?: number;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface ProvenanceMetadata {
|
|
385
|
+
environment?: string;
|
|
386
|
+
branch?: string;
|
|
387
|
+
pullRequest?: number;
|
|
388
|
+
buildId?: string;
|
|
389
|
+
deploymentId?: string;
|
|
390
|
+
tags?: string[];
|
|
391
|
+
custom?: Record<string, any>;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface ProvenanceData {
|
|
395
|
+
agent: string;
|
|
396
|
+
model: string;
|
|
397
|
+
commit: string;
|
|
398
|
+
artifacts: string[];
|
|
399
|
+
results: {
|
|
400
|
+
coverage_branch: number;
|
|
401
|
+
mutation_score: number;
|
|
402
|
+
tests_passed: number;
|
|
403
|
+
a11y?: string;
|
|
404
|
+
perf?: PerformanceMetrics;
|
|
405
|
+
contracts?: {
|
|
406
|
+
consumer: boolean;
|
|
407
|
+
provider: boolean;
|
|
408
|
+
};
|
|
409
|
+
flake_rate?: number;
|
|
410
|
+
};
|
|
411
|
+
approvals: Array<{
|
|
412
|
+
approver: string;
|
|
413
|
+
timestamp: string;
|
|
414
|
+
type: string;
|
|
415
|
+
}>;
|
|
416
|
+
generatedAt: string;
|
|
417
|
+
metadata?: ProvenanceMetadata;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// =============================================================================
|
|
421
|
+
// MULTI-MODAL TYPES
|
|
422
|
+
// =============================================================================
|
|
423
|
+
|
|
424
|
+
export interface MultiModalIngestionConfig {
|
|
425
|
+
batchSize?: number;
|
|
426
|
+
rateLimitMs?: number;
|
|
427
|
+
skipExisting?: boolean;
|
|
428
|
+
includePatterns?: string[];
|
|
429
|
+
excludePatterns?: string[];
|
|
430
|
+
enableOCR?: boolean;
|
|
431
|
+
enableSpeechToText?: boolean;
|
|
432
|
+
maxFileSize?: number;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface MultiModalIngestionResult {
|
|
436
|
+
totalFiles: number;
|
|
437
|
+
processedFiles: number;
|
|
438
|
+
skippedFiles: number;
|
|
439
|
+
failedFiles: number;
|
|
440
|
+
totalChunks: number;
|
|
441
|
+
processedChunks: number;
|
|
442
|
+
errors: string[];
|
|
443
|
+
contentTypeStats: Record<string, number>;
|
|
444
|
+
}
|