@paths.design/caws-cli 7.0.2 → 7.0.3

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.
Files changed (117) hide show
  1. package/dist/budget-derivation.js +5 -4
  2. package/dist/commands/diagnose.js +24 -19
  3. package/dist/commands/init.js +51 -4
  4. package/dist/commands/specs.js +40 -1
  5. package/dist/commands/status.js +2 -2
  6. package/dist/commands/tool.js +2 -3
  7. package/dist/config/index.js +17 -8
  8. package/dist/generators/working-spec.js +19 -6
  9. package/dist/scaffold/git-hooks.js +127 -29
  10. package/dist/scaffold/index.js +53 -7
  11. package/dist/templates/.caws/tools/README.md +20 -0
  12. package/dist/templates/.cursor/README.md +311 -0
  13. package/dist/templates/.cursor/hooks/audit.sh +55 -0
  14. package/dist/templates/.cursor/hooks/block-dangerous.sh +83 -0
  15. package/dist/templates/.cursor/hooks/caws-quality-check.sh +52 -0
  16. package/dist/templates/.cursor/hooks/caws-scope-guard.sh +130 -0
  17. package/dist/templates/.cursor/hooks/caws-tool-validation.sh +121 -0
  18. package/dist/templates/.cursor/hooks/format.sh +38 -0
  19. package/dist/templates/.cursor/hooks/naming-check.sh +64 -0
  20. package/dist/templates/.cursor/hooks/scan-secrets.sh +46 -0
  21. package/dist/templates/.cursor/hooks/scope-guard.sh +52 -0
  22. package/dist/templates/.cursor/hooks/validate-spec.sh +83 -0
  23. package/dist/templates/.cursor/hooks.json +59 -0
  24. package/dist/templates/.cursor/rules/00-claims-verification.mdc +144 -0
  25. package/dist/templates/.cursor/rules/01-working-style.mdc +50 -0
  26. package/dist/templates/.cursor/rules/02-quality-gates.mdc +370 -0
  27. package/dist/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
  28. package/dist/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
  29. package/dist/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
  30. package/dist/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
  31. package/dist/templates/.cursor/rules/07-process-ops.mdc +20 -0
  32. package/dist/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
  33. package/dist/templates/.cursor/rules/09-docstrings.mdc +89 -0
  34. package/dist/templates/.cursor/rules/10-documentation-quality-standards.mdc +390 -0
  35. package/dist/templates/.cursor/rules/11-scope-management-waivers.mdc +385 -0
  36. package/dist/templates/.cursor/rules/12-implementation-completeness.mdc +516 -0
  37. package/dist/templates/.cursor/rules/13-language-agnostic-standards.mdc +588 -0
  38. package/dist/templates/.cursor/rules/README.md +148 -0
  39. package/dist/templates/.github/copilot/instructions.md +311 -0
  40. package/dist/templates/.idea/runConfigurations/CAWS_Evaluate.xml +5 -0
  41. package/dist/templates/.idea/runConfigurations/CAWS_Validate.xml +5 -0
  42. package/dist/templates/.vscode/launch.json +56 -0
  43. package/dist/templates/.vscode/settings.json +93 -0
  44. package/dist/templates/.windsurf/workflows/caws-guided-development.md +92 -0
  45. package/dist/templates/COMMIT_CONVENTIONS.md +86 -0
  46. package/dist/templates/OIDC_SETUP.md +300 -0
  47. package/dist/templates/agents.md +1047 -0
  48. package/dist/templates/codemod/README.md +1 -0
  49. package/dist/templates/codemod/test.js +93 -0
  50. package/dist/templates/docs/README.md +150 -0
  51. package/dist/templates/scripts/quality-gates/check-god-objects.js +146 -0
  52. package/dist/templates/scripts/quality-gates/run-quality-gates.js +50 -0
  53. package/dist/templates/scripts/v3/analysis/todo_analyzer.py +1997 -0
  54. package/dist/tool-loader.js +6 -1
  55. package/dist/tool-validator.js +8 -2
  56. package/dist/utils/detection.js +4 -3
  57. package/dist/utils/git-lock.js +118 -0
  58. package/dist/utils/gitignore-updater.js +148 -0
  59. package/dist/utils/quality-gates.js +47 -7
  60. package/dist/utils/spec-resolver.js +23 -3
  61. package/dist/utils/yaml-validation.js +155 -0
  62. package/dist/validation/spec-validation.js +81 -2
  63. package/package.json +2 -2
  64. package/templates/.caws/schemas/waivers.schema.json +30 -0
  65. package/templates/.caws/schemas/working-spec.schema.json +133 -0
  66. package/templates/.caws/templates/working-spec.template.yml +74 -0
  67. package/templates/.caws/tools/README.md +20 -0
  68. package/templates/.caws/tools/scope-guard.js +208 -0
  69. package/templates/.caws/tools-allow.json +331 -0
  70. package/templates/.caws/waivers.yml +19 -0
  71. package/templates/.cursor/hooks/scope-guard.sh +2 -2
  72. package/templates/.cursor/hooks/validate-spec.sh +42 -7
  73. package/templates/apps/tools/caws/COMPLETION_REPORT.md +0 -331
  74. package/templates/apps/tools/caws/MIGRATION_SUMMARY.md +0 -360
  75. package/templates/apps/tools/caws/README.md +0 -463
  76. package/templates/apps/tools/caws/TEST_STATUS.md +0 -365
  77. package/templates/apps/tools/caws/attest.js +0 -357
  78. package/templates/apps/tools/caws/ci-optimizer.js +0 -642
  79. package/templates/apps/tools/caws/config.ts +0 -245
  80. package/templates/apps/tools/caws/cross-functional.js +0 -876
  81. package/templates/apps/tools/caws/dashboard.js +0 -1112
  82. package/templates/apps/tools/caws/flake-detector.ts +0 -362
  83. package/templates/apps/tools/caws/gates.js +0 -198
  84. package/templates/apps/tools/caws/gates.ts +0 -271
  85. package/templates/apps/tools/caws/language-adapters.ts +0 -381
  86. package/templates/apps/tools/caws/language-support.d.ts +0 -367
  87. package/templates/apps/tools/caws/language-support.d.ts.map +0 -1
  88. package/templates/apps/tools/caws/language-support.js +0 -585
  89. package/templates/apps/tools/caws/legacy-assessment.ts +0 -408
  90. package/templates/apps/tools/caws/legacy-assessor.js +0 -764
  91. package/templates/apps/tools/caws/mutant-analyzer.js +0 -734
  92. package/templates/apps/tools/caws/perf-budgets.ts +0 -349
  93. package/templates/apps/tools/caws/prompt-lint.js.backup +0 -274
  94. package/templates/apps/tools/caws/property-testing.js +0 -707
  95. package/templates/apps/tools/caws/provenance.d.ts +0 -14
  96. package/templates/apps/tools/caws/provenance.d.ts.map +0 -1
  97. package/templates/apps/tools/caws/provenance.js +0 -132
  98. package/templates/apps/tools/caws/provenance.js.backup +0 -73
  99. package/templates/apps/tools/caws/provenance.ts +0 -211
  100. package/templates/apps/tools/caws/security-provenance.ts +0 -483
  101. package/templates/apps/tools/caws/shared/base-tool.ts +0 -281
  102. package/templates/apps/tools/caws/shared/config-manager.ts +0 -366
  103. package/templates/apps/tools/caws/shared/gate-checker.ts +0 -849
  104. package/templates/apps/tools/caws/shared/types.ts +0 -444
  105. package/templates/apps/tools/caws/shared/validator.ts +0 -305
  106. package/templates/apps/tools/caws/shared/waivers-manager.ts +0 -174
  107. package/templates/apps/tools/caws/spec-test-mapper.ts +0 -391
  108. package/templates/apps/tools/caws/test-quality.js +0 -578
  109. package/templates/apps/tools/caws/validate.js +0 -76
  110. package/templates/apps/tools/caws/validate.ts +0 -228
  111. package/templates/apps/tools/caws/waivers.js +0 -344
  112. /package/{templates/apps/tools/caws → dist/templates/.caws}/schemas/waivers.schema.json +0 -0
  113. /package/{templates/apps/tools/caws → dist/templates/.caws}/schemas/working-spec.schema.json +0 -0
  114. /package/{templates/apps/tools/caws → dist/templates/.caws}/templates/working-spec.template.yml +0 -0
  115. /package/{templates/apps/tools/caws → dist/templates/.caws/tools}/scope-guard.js +0 -0
  116. /package/{templates/apps/tools/caws → dist/templates/.caws}/tools-allow.json +0 -0
  117. /package/{templates/apps/tools/caws → dist/templates/.caws}/waivers.yml +0 -0
@@ -1,444 +0,0 @@
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
- }