@paths.design/caws-cli 2.0.1 → 3.0.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 +101 -96
- 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/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.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,344 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview CAWS Waivers Management Tool
|
|
5
|
+
* Manages time-boxed waivers for quality gates
|
|
6
|
+
* @author @darianrosebrook
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const yaml = require('js-yaml');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Waiver reasons enum
|
|
14
|
+
*/
|
|
15
|
+
const WAIVER_REASONS = {
|
|
16
|
+
URGENT_FIX: 'urgent_fix',
|
|
17
|
+
EXPERIMENTAL: 'experimental',
|
|
18
|
+
LEGACY_CODE: 'legacy_code',
|
|
19
|
+
RESOURCE_CONSTRAINTS: 'resource_constraints',
|
|
20
|
+
OTHER: 'other',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Waivable gates
|
|
25
|
+
*/
|
|
26
|
+
const WAIVABLE_GATES = ['coverage', 'mutation', 'contracts', 'manual_review', 'trust_score'];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Load waivers configuration
|
|
30
|
+
* @param {string} waiversPath - Path to waivers.yml file
|
|
31
|
+
* @returns {Object} Parsed waivers configuration
|
|
32
|
+
*/
|
|
33
|
+
function loadWaiversConfig(waiversPath = '.caws/waivers.yml') {
|
|
34
|
+
try {
|
|
35
|
+
if (!fs.existsSync(waiversPath)) {
|
|
36
|
+
return { waivers: [] };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const content = fs.readFileSync(waiversPath, 'utf8');
|
|
40
|
+
return yaml.load(content);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error('❌ Error loading waivers config:', error.message);
|
|
43
|
+
return { waivers: [] };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Save waivers configuration
|
|
49
|
+
* @param {Object} config - Waivers configuration
|
|
50
|
+
* @param {string} waiversPath - Path to save waivers.yml file
|
|
51
|
+
*/
|
|
52
|
+
function saveWaiversConfig(config, waiversPath = '.caws/waivers.yml') {
|
|
53
|
+
try {
|
|
54
|
+
const yamlContent = yaml.dump(config, { indent: 2 });
|
|
55
|
+
fs.writeFileSync(waiversPath, yamlContent);
|
|
56
|
+
console.log(`✅ Waivers configuration saved to ${waiversPath}`);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error('❌ Error saving waivers config:', error.message);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Find active waivers for a project and gate
|
|
65
|
+
* @param {string} projectId - Project identifier
|
|
66
|
+
* @param {string} gate - Gate to check
|
|
67
|
+
* @param {string} waiversPath - Path to waivers.yml file
|
|
68
|
+
* @returns {Array} Active waivers
|
|
69
|
+
*/
|
|
70
|
+
function findActiveWaivers(projectId, gate, waiversPath = '.caws/waivers.yml') {
|
|
71
|
+
const config = loadWaiversConfig(waiversPath);
|
|
72
|
+
const now = new Date();
|
|
73
|
+
|
|
74
|
+
return config.waivers.filter((waiver) => {
|
|
75
|
+
const expiresAt = new Date(waiver.expires_at);
|
|
76
|
+
|
|
77
|
+
// Filter out expired waivers
|
|
78
|
+
if (now > expiresAt) {
|
|
79
|
+
console.warn(`⚠️ Waiver ${waiver.id} has expired (${waiver.expires_at})`);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Check if project specific
|
|
84
|
+
if (waiver.projects && waiver.projects.length > 0) {
|
|
85
|
+
if (!waiver.projects.includes(projectId)) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Check if gate is waived
|
|
91
|
+
return waiver.gates.includes(gate);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Create a new waiver
|
|
97
|
+
* @param {Object} options - Waiver options
|
|
98
|
+
*/
|
|
99
|
+
function createWaiver(options) {
|
|
100
|
+
const {
|
|
101
|
+
id,
|
|
102
|
+
description,
|
|
103
|
+
gates,
|
|
104
|
+
reason,
|
|
105
|
+
approver,
|
|
106
|
+
expiresInDays = 7,
|
|
107
|
+
projects = [],
|
|
108
|
+
maxTrustScore = 79,
|
|
109
|
+
} = options;
|
|
110
|
+
|
|
111
|
+
// Validate inputs
|
|
112
|
+
if (!id || !description || !gates || !reason || !approver) {
|
|
113
|
+
console.error('❌ Missing required waiver fields');
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Validate gates
|
|
118
|
+
const invalidGates = gates.filter((gate) => !WAIVABLE_GATES.includes(gate));
|
|
119
|
+
if (invalidGates.length > 0) {
|
|
120
|
+
console.error(`❌ Invalid gates: ${invalidGates.join(', ')}`);
|
|
121
|
+
console.error(`💡 Valid gates: ${WAIVABLE_GATES.join(', ')}`);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Validate reason
|
|
126
|
+
if (!Object.values(WAIVER_REASONS).includes(reason)) {
|
|
127
|
+
console.error(`❌ Invalid reason: ${reason}`);
|
|
128
|
+
console.error(`💡 Valid reasons: ${Object.values(WAIVER_REASONS).join(', ')}`);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const expiresAt = new Date();
|
|
133
|
+
expiresAt.setDate(expiresAt.getDate() + expiresInDays);
|
|
134
|
+
|
|
135
|
+
const waiver = {
|
|
136
|
+
id,
|
|
137
|
+
description,
|
|
138
|
+
gates,
|
|
139
|
+
reason,
|
|
140
|
+
approver,
|
|
141
|
+
expires_at: expiresAt.toISOString(),
|
|
142
|
+
projects,
|
|
143
|
+
max_trust_score: maxTrustScore,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Load existing waivers
|
|
147
|
+
const config = loadWaiversConfig();
|
|
148
|
+
|
|
149
|
+
// Check for duplicate ID
|
|
150
|
+
const existingWaiver = config.waivers.find((w) => w.id === id);
|
|
151
|
+
if (existingWaiver) {
|
|
152
|
+
console.error(`❌ Waiver with ID ${id} already exists`);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Add new waiver
|
|
157
|
+
config.waivers.push(waiver);
|
|
158
|
+
|
|
159
|
+
// Save configuration
|
|
160
|
+
saveWaiversConfig(config);
|
|
161
|
+
|
|
162
|
+
console.log(`✅ Created waiver ${id}`);
|
|
163
|
+
console.log(` Description: ${description}`);
|
|
164
|
+
console.log(` Gates: ${gates.join(', ')}`);
|
|
165
|
+
console.log(` Reason: ${reason}`);
|
|
166
|
+
console.log(` Expires: ${expiresAt.toISOString()}`);
|
|
167
|
+
if (projects.length > 0) {
|
|
168
|
+
console.log(` Projects: ${projects.join(', ')}`);
|
|
169
|
+
}
|
|
170
|
+
console.log(` Max Trust Score: ${maxTrustScore}`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* List all waivers
|
|
175
|
+
* @param {string} waiversPath - Path to waivers.yml file
|
|
176
|
+
*/
|
|
177
|
+
function listWaivers(waiversPath = '.caws/waivers.yml') {
|
|
178
|
+
const config = loadWaiversConfig(waiversPath);
|
|
179
|
+
|
|
180
|
+
if (config.waivers.length === 0) {
|
|
181
|
+
console.log('ℹ️ No waivers configured');
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
console.log('📋 Active Waivers:');
|
|
186
|
+
const now = new Date();
|
|
187
|
+
|
|
188
|
+
config.waivers.forEach((waiver) => {
|
|
189
|
+
const expiresAt = new Date(waiver.expires_at);
|
|
190
|
+
const isExpired = now > expiresAt;
|
|
191
|
+
const status = isExpired ? '🔴 EXPIRED' : '🟢 ACTIVE';
|
|
192
|
+
const daysLeft = Math.ceil((expiresAt - now) / (1000 * 60 * 60 * 24));
|
|
193
|
+
|
|
194
|
+
console.log(`\n${status} Waiver: ${waiver.id}`);
|
|
195
|
+
console.log(` Description: ${waiver.description}`);
|
|
196
|
+
console.log(` Gates: ${waiver.gates.join(', ')}`);
|
|
197
|
+
console.log(` Reason: ${waiver.reason}`);
|
|
198
|
+
console.log(` Approver: ${waiver.approver}`);
|
|
199
|
+
console.log(` Expires: ${waiver.expires_at} (${daysLeft} days)`);
|
|
200
|
+
if (waiver.projects && waiver.projects.length > 0) {
|
|
201
|
+
console.log(` Projects: ${waiver.projects.join(', ')}`);
|
|
202
|
+
}
|
|
203
|
+
if (waiver.max_trust_score) {
|
|
204
|
+
console.log(` Max Trust Score: ${waiver.max_trust_score}`);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Remove expired waivers
|
|
211
|
+
* @param {string} waiversPath - Path to waivers.yml file
|
|
212
|
+
*/
|
|
213
|
+
function cleanupExpiredWaivers(waiversPath = '.caws/waivers.yml') {
|
|
214
|
+
const config = loadWaiversConfig(waiversPath);
|
|
215
|
+
const now = new Date();
|
|
216
|
+
|
|
217
|
+
const activeWaivers = config.waivers.filter((waiver) => {
|
|
218
|
+
const expiresAt = new Date(waiver.expires_at);
|
|
219
|
+
return now <= expiresAt;
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const removedCount = config.waivers.length - activeWaivers.length;
|
|
223
|
+
|
|
224
|
+
if (removedCount > 0) {
|
|
225
|
+
config.waivers = activeWaivers;
|
|
226
|
+
saveWaiversConfig(config);
|
|
227
|
+
console.log(`✅ Cleaned up ${removedCount} expired waiver(s)`);
|
|
228
|
+
} else {
|
|
229
|
+
console.log('ℹ️ No expired waivers to clean up');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Check if a specific gate is waived for a project
|
|
235
|
+
* @param {string} projectId - Project identifier
|
|
236
|
+
* @param {string} gate - Gate to check
|
|
237
|
+
* @param {string} waiversPath - Path to waivers.yml file
|
|
238
|
+
* @returns {Object} Waiver status information
|
|
239
|
+
*/
|
|
240
|
+
function checkWaiverStatus(projectId, gate, waiversPath = '.caws/waivers.yml') {
|
|
241
|
+
const activeWaivers = findActiveWaivers(projectId, gate, waiversPath);
|
|
242
|
+
|
|
243
|
+
if (activeWaivers.length === 0) {
|
|
244
|
+
return {
|
|
245
|
+
waived: false,
|
|
246
|
+
reason: null,
|
|
247
|
+
maxTrustScore: 100,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Find the most restrictive waiver (lowest max trust score)
|
|
252
|
+
const applicableWaiver = activeWaivers.reduce((mostRestrictive, waiver) => {
|
|
253
|
+
if (
|
|
254
|
+
!mostRestrictive ||
|
|
255
|
+
(waiver.max_trust_score && waiver.max_trust_score < mostRestrictive.max_trust_score)
|
|
256
|
+
) {
|
|
257
|
+
return waiver;
|
|
258
|
+
}
|
|
259
|
+
return mostRestrictive;
|
|
260
|
+
}, null);
|
|
261
|
+
|
|
262
|
+
return {
|
|
263
|
+
waived: true,
|
|
264
|
+
reason: applicableWaiver.reason,
|
|
265
|
+
maxTrustScore: applicableWaiver.max_trust_score || 79,
|
|
266
|
+
waiverId: applicableWaiver.id,
|
|
267
|
+
expiresAt: applicableWaiver.expires_at,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// CLI interface
|
|
272
|
+
if (require.main === module) {
|
|
273
|
+
const command = process.argv[2];
|
|
274
|
+
|
|
275
|
+
switch (command) {
|
|
276
|
+
case 'create':
|
|
277
|
+
createWaiver({
|
|
278
|
+
id: process.argv[3],
|
|
279
|
+
description: process.argv[4],
|
|
280
|
+
gates: process.argv[5]?.split(',') || [],
|
|
281
|
+
reason: process.argv[6],
|
|
282
|
+
approver: process.argv[7],
|
|
283
|
+
expiresInDays: parseInt(process.argv[8]) || 7,
|
|
284
|
+
projects: process.argv[9]?.split(',') || [],
|
|
285
|
+
maxTrustScore: parseInt(process.argv[10]) || 79,
|
|
286
|
+
});
|
|
287
|
+
break;
|
|
288
|
+
|
|
289
|
+
case 'list':
|
|
290
|
+
listWaivers();
|
|
291
|
+
break;
|
|
292
|
+
|
|
293
|
+
case 'cleanup':
|
|
294
|
+
cleanupExpiredWaivers();
|
|
295
|
+
break;
|
|
296
|
+
|
|
297
|
+
case 'check':
|
|
298
|
+
const projectId = process.argv[3];
|
|
299
|
+
const gate = process.argv[4];
|
|
300
|
+
if (!projectId || !gate) {
|
|
301
|
+
console.error('❌ Usage: node waivers.js check <project-id> <gate>');
|
|
302
|
+
process.exit(1);
|
|
303
|
+
}
|
|
304
|
+
const status = checkWaiverStatus(projectId, gate);
|
|
305
|
+
console.log(`Waiver status for ${gate} on project ${projectId}:`);
|
|
306
|
+
console.log(` Waived: ${status.waived}`);
|
|
307
|
+
if (status.waived) {
|
|
308
|
+
console.log(` Reason: ${status.reason}`);
|
|
309
|
+
console.log(` Max Trust Score: ${status.maxTrustScore}`);
|
|
310
|
+
console.log(` Waiver ID: ${status.waiverId}`);
|
|
311
|
+
console.log(` Expires: ${status.expiresAt}`);
|
|
312
|
+
}
|
|
313
|
+
break;
|
|
314
|
+
|
|
315
|
+
default:
|
|
316
|
+
console.log('CAWS Waivers Management Tool');
|
|
317
|
+
console.log('Usage:');
|
|
318
|
+
console.log(
|
|
319
|
+
' node waivers.js create <id> <description> <gates> <reason> <approver> [expires-days] [projects] [max-trust-score]'
|
|
320
|
+
);
|
|
321
|
+
console.log(' node waivers.js list');
|
|
322
|
+
console.log(' node waivers.js cleanup');
|
|
323
|
+
console.log(' node waivers.js check <project-id> <gate>');
|
|
324
|
+
console.log('');
|
|
325
|
+
console.log('Examples:');
|
|
326
|
+
console.log(
|
|
327
|
+
' node waivers.js create HOTFIX-001 "Urgent security fix" "mutation,coverage" urgent_fix "senior-dev" 3'
|
|
328
|
+
);
|
|
329
|
+
console.log(' node waivers.js check FEAT-1234 mutation');
|
|
330
|
+
process.exit(1);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
module.exports = {
|
|
335
|
+
loadWaiversConfig,
|
|
336
|
+
saveWaiversConfig,
|
|
337
|
+
findActiveWaivers,
|
|
338
|
+
checkWaiverStatus,
|
|
339
|
+
createWaiver,
|
|
340
|
+
listWaivers,
|
|
341
|
+
cleanupExpiredWaivers,
|
|
342
|
+
WAIVER_REASONS,
|
|
343
|
+
WAIVABLE_GATES,
|
|
344
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
waivers:
|
|
2
|
+
# Example waiver for urgent fixes
|
|
3
|
+
# - id: "HOTFIX-001"
|
|
4
|
+
# description: "Urgent security fix - mutation testing waived"
|
|
5
|
+
# gates: ["mutation", "coverage"]
|
|
6
|
+
# reason: "urgent_fix"
|
|
7
|
+
# approver: "senior-dev"
|
|
8
|
+
# expires_at: "2025-10-07T10:00:00.000Z"
|
|
9
|
+
# projects: ["FEAT-1234"]
|
|
10
|
+
# max_trust_score: 79
|
|
11
|
+
|
|
12
|
+
# Example waiver for experimental features
|
|
13
|
+
# - id: "EXP-001"
|
|
14
|
+
# description: "Experimental feature - relaxed testing"
|
|
15
|
+
# gates: ["mutation", "contracts"]
|
|
16
|
+
# reason: "experimental"
|
|
17
|
+
# approver: "tech-lead"
|
|
18
|
+
# expires_at: "2025-10-14T10:00:00.000Z"
|
|
19
|
+
# max_trust_score: 75
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Codemod Scripts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('mock codemod');
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# CAWS Project Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This project is built with the **Coding Agent Workflow System (CAWS)** - an engineering-grade framework that ensures quality, reliability, and maintainability in AI-assisted development.
|
|
5
|
+
|
|
6
|
+
## Key Features
|
|
7
|
+
- 🔒 **Quality Gates**: Automated validation of scope, budget, and standards
|
|
8
|
+
- 🧪 **Comprehensive Testing**: Unit, contract, integration, and mutation testing
|
|
9
|
+
- 📊 **Observability**: Structured logging, metrics, and tracing
|
|
10
|
+
- 🔄 **Rollback Ready**: Feature flags and migration support
|
|
11
|
+
- 📦 **Provenance Tracking**: SBOM and SLSA attestation generation
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
### 1. Project Setup
|
|
16
|
+
The project is already scaffolded with CAWS. Review and customize:
|
|
17
|
+
- `.caws/working-spec.yaml` - Project specification and requirements
|
|
18
|
+
- `.caws/policy/tier-policy.json` - Risk tier definitions
|
|
19
|
+
- `.github/workflows/caws.yml` - CI/CD quality gates
|
|
20
|
+
|
|
21
|
+
### 2. Development Workflow
|
|
22
|
+
1. **Plan**: Update working spec with requirements and scope
|
|
23
|
+
2. **Implement**: Follow agent conduct rules and mode constraints
|
|
24
|
+
3. **Verify**: Run tests and quality gates locally
|
|
25
|
+
4. **Document**: Update documentation and generate provenance
|
|
26
|
+
|
|
27
|
+
### 3. Quality Assurance
|
|
28
|
+
- Run `npm run test` for all tests
|
|
29
|
+
- Check trust score with CAWS tools
|
|
30
|
+
- Validate against working specification
|
|
31
|
+
- Ensure rollback capabilities
|
|
32
|
+
|
|
33
|
+
## Architecture
|
|
34
|
+
|
|
35
|
+
### Directory Structure
|
|
36
|
+
```
|
|
37
|
+
src/ # Source code
|
|
38
|
+
├── core/ # Core business logic
|
|
39
|
+
├── api/ # API endpoints
|
|
40
|
+
├── models/ # Data models
|
|
41
|
+
└── utils/ # Utilities
|
|
42
|
+
|
|
43
|
+
tests/ # Test suites
|
|
44
|
+
├── unit/ # Unit tests
|
|
45
|
+
├── contract/ # Contract tests
|
|
46
|
+
├── integration/ # Integration tests
|
|
47
|
+
└── e2e/ # End-to-end tests
|
|
48
|
+
|
|
49
|
+
apps/tools/caws/ # CAWS utilities
|
|
50
|
+
└── prompt-lint.js # Prompt validation
|
|
51
|
+
└── attest.js # SBOM/attestation generation
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Key Patterns
|
|
55
|
+
- **Dependency Injection**: For testability and determinism
|
|
56
|
+
- **Interface Segregation**: Clean boundaries and contracts
|
|
57
|
+
- **Observability**: Structured logging and metrics
|
|
58
|
+
- **Property Testing**: Edge cases and invariants
|
|
59
|
+
|
|
60
|
+
## Development Guidelines
|
|
61
|
+
|
|
62
|
+
### Agent Conduct Rules
|
|
63
|
+
1. **Spec Adherence**: Stay within declared scope and mode
|
|
64
|
+
2. **Determinism**: Inject time, UUID, and random dependencies
|
|
65
|
+
3. **Comprehensive Testing**: Unit + property + integration tests
|
|
66
|
+
4. **Observability**: Log, metric, and trace key operations
|
|
67
|
+
5. **Rollback Ready**: Feature flags and migration support
|
|
68
|
+
|
|
69
|
+
### Code Quality
|
|
70
|
+
- **Type Safety**: Full TypeScript coverage
|
|
71
|
+
- **Test Coverage**: 80%+ branch coverage, 50%+ mutation score
|
|
72
|
+
- **Performance**: API p95 < 250ms, accessibility compliance
|
|
73
|
+
- **Security**: Input validation, rate limiting, secret scanning
|
|
74
|
+
|
|
75
|
+
## Deployment
|
|
76
|
+
|
|
77
|
+
### CI/CD Pipeline
|
|
78
|
+
The project includes automated quality gates:
|
|
79
|
+
- Static analysis and security scanning
|
|
80
|
+
- Unit and integration testing
|
|
81
|
+
- Performance and accessibility validation
|
|
82
|
+
- Provenance and attestation generation
|
|
83
|
+
|
|
84
|
+
### Environment Setup
|
|
85
|
+
1. Configure environment variables
|
|
86
|
+
2. Set up monitoring and alerting
|
|
87
|
+
3. Establish rollback procedures
|
|
88
|
+
4. Document operational runbooks
|
|
89
|
+
|
|
90
|
+
## Monitoring & Observability
|
|
91
|
+
|
|
92
|
+
### Metrics
|
|
93
|
+
- Request latency and throughput
|
|
94
|
+
- Error rates and types
|
|
95
|
+
- Resource utilization
|
|
96
|
+
- Business metrics
|
|
97
|
+
|
|
98
|
+
### Logging
|
|
99
|
+
- Structured logs with correlation IDs
|
|
100
|
+
- Error tracking and alerting
|
|
101
|
+
- Performance monitoring
|
|
102
|
+
- Security event logging
|
|
103
|
+
|
|
104
|
+
### Tracing
|
|
105
|
+
- Distributed request tracing
|
|
106
|
+
- Performance profiling
|
|
107
|
+
- Dependency analysis
|
|
108
|
+
- Root cause identification
|
|
109
|
+
|
|
110
|
+
## Troubleshooting
|
|
111
|
+
|
|
112
|
+
### Common Issues
|
|
113
|
+
1. **Trust Score Low**: Check test coverage and quality gates
|
|
114
|
+
2. **Scope Violations**: Ensure changes align with working spec
|
|
115
|
+
3. **Budget Exceeded**: Review change size and complexity
|
|
116
|
+
4. **Flaky Tests**: Use property testing and proper mocking
|
|
117
|
+
|
|
118
|
+
### Support
|
|
119
|
+
- Check `agents.md` for comprehensive documentation
|
|
120
|
+
- Review CI/CD logs for quality gate failures
|
|
121
|
+
- Use CAWS tools for validation and debugging
|
|
122
|
+
- Follow agent conduct rules for collaboration
|
|
123
|
+
|
|
124
|
+
## Contributing
|
|
125
|
+
|
|
126
|
+
### Development Process
|
|
127
|
+
1. Update working specification
|
|
128
|
+
2. Create comprehensive tests
|
|
129
|
+
3. Implement with quality gates
|
|
130
|
+
4. Generate provenance artifacts
|
|
131
|
+
5. Document changes thoroughly
|
|
132
|
+
|
|
133
|
+
### Code Review
|
|
134
|
+
- Review against working specification
|
|
135
|
+
- Check trust score and quality gates
|
|
136
|
+
- Validate observability and rollback
|
|
137
|
+
- Ensure documentation completeness
|
|
138
|
+
|
|
139
|
+
## Resources
|
|
140
|
+
|
|
141
|
+
- **[CAWS Framework](agents.md)**: Complete system documentation
|
|
142
|
+
- **[Working Specification](.caws/working-spec.yaml)**: Project requirements
|
|
143
|
+
- **[Quality Gates](.github/workflows/caws.yml)**: CI/CD pipeline
|
|
144
|
+
- **[Tools](apps/tools/caws/)**: Development utilities
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
**Maintainer**: @darianrosebrook
|
|
149
|
+
**Framework**: CAWS v1.0
|
|
150
|
+
**Updated**: $(date)
|