@paths.design/caws-cli 4.0.0 → 5.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/commands/archive.js +353 -0
- package/dist/commands/iterate.js +12 -13
- package/dist/commands/mode.js +259 -0
- package/dist/commands/plan.js +448 -0
- package/dist/commands/quality-gates.js +490 -0
- package/dist/commands/specs.js +735 -0
- package/dist/commands/status.js +552 -22
- package/dist/commands/tutorial.js +481 -0
- package/dist/commands/validate.js +137 -54
- package/dist/commands/waivers.js +101 -26
- package/dist/config/modes.js +321 -0
- package/dist/constants/spec-types.js +42 -0
- package/dist/index.js +225 -10
- package/dist/scaffold/git-hooks.js +32 -44
- package/dist/scaffold/index.js +19 -0
- package/dist/utils/quality-gates-errors.js +520 -0
- package/dist/utils/quality-gates.js +361 -0
- package/dist/utils/spec-resolver.js +602 -0
- package/dist/waivers-manager.js +49 -4
- package/package.json +6 -5
- package/templates/.cursor/hooks/caws-scope-guard.sh +64 -8
- package/templates/.cursor/hooks/validate-spec.sh +22 -12
- package/templates/.cursor/rules/{01-claims-verification.mdc → 00-claims-verification.mdc} +1 -1
- package/templates/.cursor/rules/01-working-style.mdc +50 -0
- package/templates/.cursor/rules/{02-testing-standards.mdc → 02-quality-gates.mdc} +84 -29
- package/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
- package/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
- package/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
- package/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
- package/templates/.cursor/rules/07-process-ops.mdc +20 -0
- package/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
- package/templates/.cursor/rules/09-docstrings.mdc +89 -0
- package/templates/.cursor/rules/10-authorship-and-attribution.mdc +15 -0
- package/templates/.cursor/rules/11-documentation-quality-standards.mdc +390 -0
- package/templates/.cursor/rules/12-scope-management-waivers.mdc +385 -0
- package/templates/.cursor/rules/13-implementation-completeness.mdc +516 -0
- package/templates/.cursor/rules/14-language-agnostic-standards.mdc +588 -0
- package/templates/.cursor/rules/15-sophisticated-todo-detection.mdc +425 -0
- package/templates/.cursor/rules/README.md +93 -7
- package/templates/scripts/quality-gates/check-god-objects.js +146 -0
- package/templates/scripts/quality-gates/run-quality-gates.js +50 -0
- package/templates/scripts/v3/analysis/todo_analyzer.py +1950 -0
- package/dist/budget-derivation.d.ts +0 -74
- package/dist/budget-derivation.d.ts.map +0 -1
- package/dist/cicd-optimizer.d.ts +0 -142
- package/dist/cicd-optimizer.d.ts.map +0 -1
- package/dist/commands/burnup.d.ts +0 -6
- package/dist/commands/burnup.d.ts.map +0 -1
- package/dist/commands/diagnose.d.ts +0 -52
- package/dist/commands/diagnose.d.ts.map +0 -1
- package/dist/commands/evaluate.d.ts +0 -8
- package/dist/commands/evaluate.d.ts.map +0 -1
- package/dist/commands/init.d.ts +0 -5
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/iterate.d.ts +0 -8
- package/dist/commands/iterate.d.ts.map +0 -1
- package/dist/commands/provenance.d.ts +0 -32
- package/dist/commands/provenance.d.ts.map +0 -1
- package/dist/commands/quality-monitor.d.ts +0 -17
- package/dist/commands/quality-monitor.d.ts.map +0 -1
- package/dist/commands/status.d.ts +0 -43
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/templates.d.ts +0 -74
- package/dist/commands/templates.d.ts.map +0 -1
- package/dist/commands/tool.d.ts +0 -13
- package/dist/commands/tool.d.ts.map +0 -1
- package/dist/commands/troubleshoot.d.ts +0 -8
- package/dist/commands/troubleshoot.d.ts.map +0 -1
- package/dist/commands/validate.d.ts +0 -8
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/waivers.d.ts +0 -8
- package/dist/commands/waivers.d.ts.map +0 -1
- package/dist/commands/workflow.d.ts +0 -85
- package/dist/commands/workflow.d.ts.map +0 -1
- package/dist/config/index.d.ts +0 -29
- package/dist/config/index.d.ts.map +0 -1
- package/dist/error-handler.d.ts +0 -164
- package/dist/error-handler.d.ts.map +0 -1
- package/dist/generators/jest-config.d.ts +0 -32
- package/dist/generators/jest-config.d.ts.map +0 -1
- package/dist/generators/working-spec.d.ts +0 -13
- package/dist/generators/working-spec.d.ts.map +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/minimal-cli.d.ts +0 -3
- package/dist/minimal-cli.d.ts.map +0 -1
- package/dist/policy/PolicyManager.d.ts +0 -104
- package/dist/policy/PolicyManager.d.ts.map +0 -1
- package/dist/scaffold/cursor-hooks.d.ts +0 -7
- package/dist/scaffold/cursor-hooks.d.ts.map +0 -1
- package/dist/scaffold/git-hooks.d.ts +0 -20
- package/dist/scaffold/git-hooks.d.ts.map +0 -1
- package/dist/scaffold/index.d.ts +0 -20
- package/dist/scaffold/index.d.ts.map +0 -1
- package/dist/spec/SpecFileManager.d.ts +0 -146
- package/dist/spec/SpecFileManager.d.ts.map +0 -1
- package/dist/test-analysis.d.ts +0 -182
- package/dist/test-analysis.d.ts.map +0 -1
- package/dist/tool-interface.d.ts +0 -236
- package/dist/tool-interface.d.ts.map +0 -1
- package/dist/tool-loader.d.ts +0 -77
- package/dist/tool-loader.d.ts.map +0 -1
- package/dist/tool-validator.d.ts +0 -72
- package/dist/tool-validator.d.ts.map +0 -1
- package/dist/utils/detection.d.ts +0 -7
- package/dist/utils/detection.d.ts.map +0 -1
- package/dist/utils/finalization.d.ts +0 -17
- package/dist/utils/finalization.d.ts.map +0 -1
- package/dist/utils/project-analysis.d.ts +0 -14
- package/dist/utils/project-analysis.d.ts.map +0 -1
- package/dist/utils/typescript-detector.d.ts +0 -63
- package/dist/utils/typescript-detector.d.ts.map +0 -1
- package/dist/validation/spec-validation.d.ts +0 -43
- package/dist/validation/spec-validation.d.ts.map +0 -1
- package/dist/waivers-manager.d.ts +0 -167
- package/dist/waivers-manager.d.ts.map +0 -1
- package/templates/.cursor/rules/03-infrastructure-standards.mdc +0 -251
- package/templates/.cursor/rules/04-documentation-integrity.mdc +0 -291
- package/templates/.cursor/rules/05-production-readiness-checklist.mdc +0 -214
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview CAWS Complexity Modes Configuration
|
|
3
|
+
* Defines different tiers of CAWS complexity for different project needs
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* CAWS Complexity Tiers
|
|
11
|
+
*/
|
|
12
|
+
const COMPLEXITY_TIERS = {
|
|
13
|
+
simple: {
|
|
14
|
+
name: 'Simple',
|
|
15
|
+
description: 'Minimal CAWS for small projects and quick prototyping',
|
|
16
|
+
color: chalk.green,
|
|
17
|
+
icon: '🟢',
|
|
18
|
+
features: {
|
|
19
|
+
workingSpec: true,
|
|
20
|
+
basicValidation: true,
|
|
21
|
+
statusDisplay: true,
|
|
22
|
+
noQualityGates: true,
|
|
23
|
+
noProvenance: true,
|
|
24
|
+
noWaivers: true,
|
|
25
|
+
noChangeBudgets: true,
|
|
26
|
+
noMultiSpec: false, // Can use multi-spec but simplified
|
|
27
|
+
},
|
|
28
|
+
qualityRequirements: {
|
|
29
|
+
testCoverage: 70,
|
|
30
|
+
mutationScore: 30,
|
|
31
|
+
contracts: 'optional',
|
|
32
|
+
},
|
|
33
|
+
riskTiers: ['T3'], // Only T3 supported
|
|
34
|
+
commands: {
|
|
35
|
+
init: true,
|
|
36
|
+
validate: true,
|
|
37
|
+
status: true,
|
|
38
|
+
specs: true, // Basic specs support
|
|
39
|
+
// No: diagnose, evaluate, iterate, provenance, waivers, hooks, archive
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
standard: {
|
|
44
|
+
name: 'Standard',
|
|
45
|
+
description: 'Balanced CAWS with change management and quality gates',
|
|
46
|
+
color: chalk.yellow,
|
|
47
|
+
icon: '🟡',
|
|
48
|
+
features: {
|
|
49
|
+
workingSpec: true,
|
|
50
|
+
fullValidation: true,
|
|
51
|
+
statusDisplay: true,
|
|
52
|
+
qualityGates: true,
|
|
53
|
+
provenance: true,
|
|
54
|
+
waivers: true,
|
|
55
|
+
changeBudgets: true,
|
|
56
|
+
multiSpec: true,
|
|
57
|
+
changeFolders: true,
|
|
58
|
+
},
|
|
59
|
+
qualityRequirements: {
|
|
60
|
+
testCoverage: 80,
|
|
61
|
+
mutationScore: 50,
|
|
62
|
+
contracts: 'required',
|
|
63
|
+
},
|
|
64
|
+
riskTiers: ['T1', 'T2', 'T3'],
|
|
65
|
+
commands: {
|
|
66
|
+
init: true,
|
|
67
|
+
validate: true,
|
|
68
|
+
status: true,
|
|
69
|
+
specs: true,
|
|
70
|
+
diagnose: true,
|
|
71
|
+
evaluate: true,
|
|
72
|
+
iterate: true,
|
|
73
|
+
provenance: true,
|
|
74
|
+
waivers: true,
|
|
75
|
+
hooks: true,
|
|
76
|
+
archive: true,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
enterprise: {
|
|
81
|
+
name: 'Enterprise',
|
|
82
|
+
description: 'Full CAWS with comprehensive audit trails and compliance',
|
|
83
|
+
color: chalk.red,
|
|
84
|
+
icon: '🔴',
|
|
85
|
+
features: {
|
|
86
|
+
workingSpec: true,
|
|
87
|
+
fullValidation: true,
|
|
88
|
+
statusDisplay: true,
|
|
89
|
+
qualityGates: true,
|
|
90
|
+
provenance: true,
|
|
91
|
+
waivers: true,
|
|
92
|
+
changeBudgets: true,
|
|
93
|
+
multiSpec: true,
|
|
94
|
+
changeFolders: true,
|
|
95
|
+
auditTrails: true,
|
|
96
|
+
compliance: true,
|
|
97
|
+
advancedMonitoring: true,
|
|
98
|
+
},
|
|
99
|
+
qualityRequirements: {
|
|
100
|
+
testCoverage: 90,
|
|
101
|
+
mutationScore: 70,
|
|
102
|
+
contracts: 'required',
|
|
103
|
+
},
|
|
104
|
+
riskTiers: ['T1', 'T2', 'T3'],
|
|
105
|
+
commands: {
|
|
106
|
+
init: true,
|
|
107
|
+
validate: true,
|
|
108
|
+
status: true,
|
|
109
|
+
specs: true,
|
|
110
|
+
diagnose: true,
|
|
111
|
+
evaluate: true,
|
|
112
|
+
iterate: true,
|
|
113
|
+
provenance: true,
|
|
114
|
+
waivers: true,
|
|
115
|
+
hooks: true,
|
|
116
|
+
archive: true,
|
|
117
|
+
troubleshoot: true,
|
|
118
|
+
testAnalysis: true,
|
|
119
|
+
qualityMonitor: true,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get tier information
|
|
126
|
+
* @param {string} tier - Tier name
|
|
127
|
+
* @returns {Object} Tier configuration
|
|
128
|
+
*/
|
|
129
|
+
function getTier(tier) {
|
|
130
|
+
return COMPLEXITY_TIERS[tier] || COMPLEXITY_TIERS.standard;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get available tiers
|
|
135
|
+
* @returns {string[]} Array of tier names
|
|
136
|
+
*/
|
|
137
|
+
function getAvailableTiers() {
|
|
138
|
+
return Object.keys(COMPLEXITY_TIERS);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Check if a command is available in the current tier
|
|
143
|
+
* @param {string} command - Command name
|
|
144
|
+
* @param {string} tier - Tier name
|
|
145
|
+
* @returns {boolean} Whether command is available
|
|
146
|
+
*/
|
|
147
|
+
function isCommandAvailable(command, tier = 'standard') {
|
|
148
|
+
const tierConfig = getTier(tier);
|
|
149
|
+
return tierConfig.commands[command] === true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Check if a feature is enabled in the current tier
|
|
154
|
+
* @param {string} feature - Feature name
|
|
155
|
+
* @param {string} tier - Tier name
|
|
156
|
+
* @returns {boolean} Whether feature is enabled
|
|
157
|
+
*/
|
|
158
|
+
function isFeatureEnabled(feature, tier = 'standard') {
|
|
159
|
+
const tierConfig = getTier(tier);
|
|
160
|
+
return tierConfig.features[feature] === true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Get quality requirements for a tier
|
|
165
|
+
* @param {string} tier - Tier name
|
|
166
|
+
* @returns {Object} Quality requirements
|
|
167
|
+
*/
|
|
168
|
+
function getQualityRequirements(tier = 'standard') {
|
|
169
|
+
const tierConfig = getTier(tier);
|
|
170
|
+
return tierConfig.qualityRequirements;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Get supported risk tiers for a complexity tier
|
|
175
|
+
* @param {string} tier - Tier name
|
|
176
|
+
* @returns {string[]} Supported risk tiers
|
|
177
|
+
*/
|
|
178
|
+
function getSupportedRiskTiers(tier = 'standard') {
|
|
179
|
+
const tierConfig = getTier(tier);
|
|
180
|
+
return tierConfig.riskTiers;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Validate if a risk tier is supported in the current complexity tier
|
|
185
|
+
* @param {string} riskTier - Risk tier to validate
|
|
186
|
+
* @param {string} complexityTier - Complexity tier
|
|
187
|
+
* @returns {boolean} Whether risk tier is supported
|
|
188
|
+
*/
|
|
189
|
+
function isRiskTierSupported(riskTier, complexityTier = 'standard') {
|
|
190
|
+
const supportedTiers = getSupportedRiskTiers(complexityTier);
|
|
191
|
+
return supportedTiers.includes(riskTier);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Display tier comparison
|
|
196
|
+
*/
|
|
197
|
+
function displayTierComparison() {
|
|
198
|
+
console.log(chalk.bold.cyan('\n📊 CAWS Complexity Tiers'));
|
|
199
|
+
console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
200
|
+
|
|
201
|
+
// Header
|
|
202
|
+
console.log(
|
|
203
|
+
chalk.bold(
|
|
204
|
+
'Tier'.padEnd(12) +
|
|
205
|
+
'Features'.padEnd(15) +
|
|
206
|
+
'Coverage'.padEnd(10) +
|
|
207
|
+
'Commands'.padEnd(12) +
|
|
208
|
+
'Use Case'
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
console.log(chalk.gray('─'.repeat(90)));
|
|
212
|
+
|
|
213
|
+
Object.entries(COMPLEXITY_TIERS).forEach(([tierName, tier]) => {
|
|
214
|
+
const tierColor = tier.color;
|
|
215
|
+
const icon = tier.icon;
|
|
216
|
+
|
|
217
|
+
const features = Object.entries(tier.features)
|
|
218
|
+
.filter(([, enabled]) => enabled)
|
|
219
|
+
.map(([feature]) => feature.replace(/([A-Z])/g, ' $1').toLowerCase())
|
|
220
|
+
.slice(0, 3)
|
|
221
|
+
.join(', ');
|
|
222
|
+
|
|
223
|
+
const commands = Object.keys(tier.commands).filter((cmd) => tier.commands[cmd]).length;
|
|
224
|
+
|
|
225
|
+
console.log(
|
|
226
|
+
`${icon} ${tierColor(tierName.padEnd(10))} ${features.padEnd(13)} ${tier.qualityRequirements.testCoverage}%${' '.padEnd(8)}${commands}${' '.padEnd(10)}${tier.description}`
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
console.log('');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Get current mode from configuration
|
|
235
|
+
* @returns {Promise<string>} Current mode
|
|
236
|
+
*/
|
|
237
|
+
async function getCurrentMode() {
|
|
238
|
+
const fs = require('fs-extra');
|
|
239
|
+
const MODE_CONFIG = '.caws/mode.json';
|
|
240
|
+
|
|
241
|
+
try {
|
|
242
|
+
if (!(await fs.pathExists(MODE_CONFIG))) {
|
|
243
|
+
return 'standard'; // Default to standard mode
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const config = JSON.parse(await fs.readFile(MODE_CONFIG, 'utf8'));
|
|
247
|
+
return config.current || 'standard';
|
|
248
|
+
} catch (error) {
|
|
249
|
+
return 'standard'; // Default to standard mode on error
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Set current mode in configuration
|
|
255
|
+
* @param {string} mode - Mode to set
|
|
256
|
+
* @returns {Promise<boolean>} Success status
|
|
257
|
+
*/
|
|
258
|
+
async function setCurrentMode(mode) {
|
|
259
|
+
const fs = require('fs-extra');
|
|
260
|
+
const path = require('path');
|
|
261
|
+
const MODE_CONFIG = '.caws/mode.json';
|
|
262
|
+
|
|
263
|
+
if (!getAvailableTiers().includes(mode)) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
try {
|
|
268
|
+
await fs.ensureDir(path.dirname(MODE_CONFIG));
|
|
269
|
+
const config = {
|
|
270
|
+
current: mode,
|
|
271
|
+
initialized: true,
|
|
272
|
+
lastChanged: new Date().toISOString(),
|
|
273
|
+
};
|
|
274
|
+
await fs.writeFile(MODE_CONFIG, JSON.stringify(config, null, 2));
|
|
275
|
+
return true;
|
|
276
|
+
} catch (error) {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Get tier recommendation based on project characteristics
|
|
283
|
+
* @param {Object} projectInfo - Project information
|
|
284
|
+
* @returns {string} Recommended tier
|
|
285
|
+
*/
|
|
286
|
+
function getTierRecommendation(projectInfo = {}) {
|
|
287
|
+
const { size = 'medium', teamSize = 1, compliance = false, auditRequired = false } = projectInfo;
|
|
288
|
+
|
|
289
|
+
// Enterprise tier for compliance/audit requirements
|
|
290
|
+
if (compliance || auditRequired) {
|
|
291
|
+
return 'enterprise';
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Enterprise for large teams or projects
|
|
295
|
+
if (teamSize > 5 || size === 'large') {
|
|
296
|
+
return 'enterprise';
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Standard for medium teams/projects
|
|
300
|
+
if (teamSize > 1 || size === 'medium') {
|
|
301
|
+
return 'standard';
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Simple for solo/small projects
|
|
305
|
+
return 'simple';
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
module.exports = {
|
|
309
|
+
COMPLEXITY_TIERS,
|
|
310
|
+
getTier,
|
|
311
|
+
getAvailableTiers,
|
|
312
|
+
getCurrentMode,
|
|
313
|
+
setCurrentMode,
|
|
314
|
+
isCommandAvailable,
|
|
315
|
+
isFeatureEnabled,
|
|
316
|
+
getQualityRequirements,
|
|
317
|
+
getSupportedRiskTiers,
|
|
318
|
+
isRiskTierSupported,
|
|
319
|
+
displayTierComparison,
|
|
320
|
+
getTierRecommendation,
|
|
321
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Spec Types Constants
|
|
3
|
+
* Defines spec types and their metadata for consistent display
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Spec types and their metadata
|
|
11
|
+
*/
|
|
12
|
+
const SPEC_TYPES = {
|
|
13
|
+
feature: {
|
|
14
|
+
color: chalk.green,
|
|
15
|
+
icon: '🚀',
|
|
16
|
+
description: 'New feature development',
|
|
17
|
+
},
|
|
18
|
+
fix: {
|
|
19
|
+
color: chalk.red,
|
|
20
|
+
icon: '🔧',
|
|
21
|
+
description: 'Bug fixes and patches',
|
|
22
|
+
},
|
|
23
|
+
refactor: {
|
|
24
|
+
color: chalk.blue,
|
|
25
|
+
icon: '♻️',
|
|
26
|
+
description: 'Code refactoring and improvements',
|
|
27
|
+
},
|
|
28
|
+
chore: {
|
|
29
|
+
color: chalk.gray,
|
|
30
|
+
icon: '🧹',
|
|
31
|
+
description: 'Maintenance and cleanup',
|
|
32
|
+
},
|
|
33
|
+
docs: {
|
|
34
|
+
color: chalk.cyan,
|
|
35
|
+
icon: '📚',
|
|
36
|
+
description: 'Documentation updates',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
module.exports = {
|
|
41
|
+
SPEC_TYPES,
|
|
42
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,13 @@ const { iterateCommand } = require('./commands/iterate');
|
|
|
41
41
|
const { waiversCommand } = require('./commands/waivers');
|
|
42
42
|
const { workflowCommand } = require('./commands/workflow');
|
|
43
43
|
const { qualityMonitorCommand } = require('./commands/quality-monitor');
|
|
44
|
+
const { qualityGatesCommand } = require('./commands/quality-gates');
|
|
44
45
|
const { troubleshootCommand } = require('./commands/troubleshoot');
|
|
46
|
+
const { archiveCommand } = require('./commands/archive');
|
|
47
|
+
const { specsCommand } = require('./commands/specs');
|
|
48
|
+
const { modeCommand } = require('./commands/mode');
|
|
49
|
+
const { tutorialCommand } = require('./commands/tutorial');
|
|
50
|
+
const { planCommand } = require('./commands/plan');
|
|
45
51
|
|
|
46
52
|
// Import scaffold functionality
|
|
47
53
|
const { scaffoldProject, setScaffoldDependencies } = require('./scaffold');
|
|
@@ -113,22 +119,216 @@ program
|
|
|
113
119
|
// Validate command
|
|
114
120
|
program
|
|
115
121
|
.command('validate')
|
|
116
|
-
.description('Validate CAWS
|
|
117
|
-
.argument('[spec-file]', 'Path to
|
|
122
|
+
.description('Validate CAWS spec with suggestions')
|
|
123
|
+
.argument('[spec-file]', 'Path to spec file (optional, uses spec resolution)')
|
|
124
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth, FEAT-001)')
|
|
125
|
+
.option('-i, --interactive', 'Interactive spec selection when multiple specs exist', false)
|
|
118
126
|
.option('-q, --quiet', 'Suppress suggestions and warnings', false)
|
|
119
127
|
.option('--auto-fix', 'Automatically fix safe validation issues', false)
|
|
120
128
|
.option('--dry-run', 'Preview auto-fixes without applying them', false)
|
|
121
129
|
.option('--format <format>', 'Output format (text, json)', 'text')
|
|
122
130
|
.action(validateCommand);
|
|
123
131
|
|
|
132
|
+
// Quality Gates command
|
|
133
|
+
program
|
|
134
|
+
.command('quality-gates')
|
|
135
|
+
.description('Run comprehensive quality gates (naming, duplication, god objects, documentation)')
|
|
136
|
+
.option('--ci', 'CI mode - exit with error code if violations found', false)
|
|
137
|
+
.option('--json', 'Output machine-readable JSON to stdout', false)
|
|
138
|
+
.option(
|
|
139
|
+
'--gates <gates>',
|
|
140
|
+
'Run only specific gates (comma-separated: naming,code_freeze,duplication,god_objects,documentation)',
|
|
141
|
+
''
|
|
142
|
+
)
|
|
143
|
+
.option('--fix', 'Attempt automatic fixes (experimental)', false)
|
|
144
|
+
.option('--help', 'Show detailed help and usage examples', false)
|
|
145
|
+
.action(async (options) => {
|
|
146
|
+
// Handle --help flag
|
|
147
|
+
if (options.help) {
|
|
148
|
+
console.log(`
|
|
149
|
+
CAWS Quality Gates - Enterprise Code Quality Enforcement
|
|
150
|
+
|
|
151
|
+
USAGE:
|
|
152
|
+
caws quality-gates [options]
|
|
153
|
+
|
|
154
|
+
DESCRIPTION:
|
|
155
|
+
Runs comprehensive quality gates to maintain code quality standards.
|
|
156
|
+
Supports selective gate execution, JSON output, and CI/CD integration.
|
|
157
|
+
|
|
158
|
+
OPTIONS:
|
|
159
|
+
--ci CI mode - exit with error code if violations found
|
|
160
|
+
--json Output machine-readable JSON to stdout
|
|
161
|
+
--gates=<gates> Run only specific gates (comma-separated)
|
|
162
|
+
--fix Attempt automatic fixes (experimental)
|
|
163
|
+
--help Show this help message
|
|
164
|
+
|
|
165
|
+
VALID GATES:
|
|
166
|
+
naming Check naming conventions and banned modifiers
|
|
167
|
+
code_freeze Enforce code freeze compliance
|
|
168
|
+
duplication Detect functional duplication
|
|
169
|
+
god_objects Prevent oversized files
|
|
170
|
+
documentation Check documentation quality
|
|
171
|
+
|
|
172
|
+
EXAMPLES:
|
|
173
|
+
# Run all gates in development mode
|
|
174
|
+
caws quality-gates
|
|
175
|
+
|
|
176
|
+
# Run only specific gates
|
|
177
|
+
caws quality-gates --gates=naming,duplication
|
|
178
|
+
|
|
179
|
+
# CI mode with JSON output
|
|
180
|
+
caws quality-gates --ci --json
|
|
181
|
+
|
|
182
|
+
# Show detailed help
|
|
183
|
+
caws quality-gates --help
|
|
184
|
+
|
|
185
|
+
OUTPUT:
|
|
186
|
+
- Console: Human-readable results with enforcement levels
|
|
187
|
+
- JSON: Machine-readable structured data (--json flag)
|
|
188
|
+
- Artifacts: docs-status/quality-gates-report.json
|
|
189
|
+
- GitHub Actions: Automatic step summaries when GITHUB_STEP_SUMMARY is set
|
|
190
|
+
|
|
191
|
+
For more information, see: packages/quality-gates/README.md
|
|
192
|
+
`);
|
|
193
|
+
process.exit(0);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Call the actual quality gates runner
|
|
197
|
+
await qualityGatesCommand(options);
|
|
198
|
+
});
|
|
199
|
+
|
|
124
200
|
// Status command
|
|
125
201
|
program
|
|
126
202
|
.command('status')
|
|
127
203
|
.description('Show project health overview')
|
|
128
|
-
.option('
|
|
129
|
-
.option('--
|
|
204
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth)')
|
|
205
|
+
.option('-s, --spec <path>', 'Path to spec file (explicit override)')
|
|
206
|
+
.option('--visual', 'Enhanced visual output with progress bars', false)
|
|
207
|
+
.option('--json', 'Output in JSON format for automation', false)
|
|
130
208
|
.action(statusCommand);
|
|
131
209
|
|
|
210
|
+
// Archive command
|
|
211
|
+
program
|
|
212
|
+
.command('archive <change-id>')
|
|
213
|
+
.description('Archive completed change')
|
|
214
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth)')
|
|
215
|
+
.option('-f, --force', 'Force archive even if criteria not met', false)
|
|
216
|
+
.option('--dry-run', 'Preview archive without performing it', false)
|
|
217
|
+
.action(archiveCommand);
|
|
218
|
+
|
|
219
|
+
// Specs command group
|
|
220
|
+
const specsCmd = program.command('specs').description('Manage multiple CAWS spec files');
|
|
221
|
+
|
|
222
|
+
// Specs subcommands
|
|
223
|
+
specsCmd
|
|
224
|
+
.command('list')
|
|
225
|
+
.description('List all available specs')
|
|
226
|
+
.action(() => specsCommand('list', {}));
|
|
227
|
+
|
|
228
|
+
specsCmd
|
|
229
|
+
.command('create <id>')
|
|
230
|
+
.description('Create a new spec (with conflict resolution)')
|
|
231
|
+
.option('-t, --type <type>', 'Spec type (feature, fix, refactor, chore, docs)', 'feature')
|
|
232
|
+
.option('--title <title>', 'Spec title')
|
|
233
|
+
.option('--tier <tier>', 'Risk tier (T1, T2, T3)', 'T3')
|
|
234
|
+
.option('--mode <mode>', 'Development mode', 'development')
|
|
235
|
+
.option('-f, --force', 'Override existing specs without confirmation', false)
|
|
236
|
+
.option('-i, --interactive', 'Ask for confirmation on conflicts', false)
|
|
237
|
+
.action((id, options) => specsCommand('create', { id, ...options }));
|
|
238
|
+
|
|
239
|
+
specsCmd
|
|
240
|
+
.command('show <id>')
|
|
241
|
+
.description('Show detailed spec information')
|
|
242
|
+
.action((id) => specsCommand('show', { id }));
|
|
243
|
+
|
|
244
|
+
specsCmd
|
|
245
|
+
.command('update <id>')
|
|
246
|
+
.description('Update spec properties')
|
|
247
|
+
.option('-s, --status <status>', 'Spec status (draft, active, completed)')
|
|
248
|
+
.option('--title <title>', 'Spec title')
|
|
249
|
+
.option('--description <desc>', 'Spec description')
|
|
250
|
+
.action((id, options) => specsCommand('update', { id, ...options }));
|
|
251
|
+
|
|
252
|
+
specsCmd
|
|
253
|
+
.command('delete <id>')
|
|
254
|
+
.description('Delete a spec')
|
|
255
|
+
.action((id) => specsCommand('delete', { id }));
|
|
256
|
+
|
|
257
|
+
specsCmd
|
|
258
|
+
.command('conflicts')
|
|
259
|
+
.description('Check for scope conflicts between specs')
|
|
260
|
+
.action(() => specsCommand('conflicts', {}));
|
|
261
|
+
|
|
262
|
+
specsCmd
|
|
263
|
+
.command('migrate')
|
|
264
|
+
.description('Migrate from legacy working-spec.yaml to feature-specific specs')
|
|
265
|
+
.option('-i, --interactive', 'Interactive feature selection', false)
|
|
266
|
+
.option('-f, --features <features>', 'Comma-separated list of features to migrate', (value) =>
|
|
267
|
+
value.split(',')
|
|
268
|
+
)
|
|
269
|
+
.action((options) => specsCommand('migrate', options));
|
|
270
|
+
|
|
271
|
+
specsCmd
|
|
272
|
+
.command('types')
|
|
273
|
+
.description('Show available spec types')
|
|
274
|
+
.action(() => specsCommand('types', {}));
|
|
275
|
+
|
|
276
|
+
// Mode command group
|
|
277
|
+
const modeCmd = program.command('mode').description('Manage CAWS complexity tiers');
|
|
278
|
+
|
|
279
|
+
// Mode subcommands
|
|
280
|
+
modeCmd
|
|
281
|
+
.command('current')
|
|
282
|
+
.description('Show current CAWS mode')
|
|
283
|
+
.action(() => modeCommand('current', {}));
|
|
284
|
+
|
|
285
|
+
modeCmd
|
|
286
|
+
.command('set <mode>')
|
|
287
|
+
.description('Set CAWS complexity tier')
|
|
288
|
+
.action((mode) => modeCommand('set', { mode }));
|
|
289
|
+
|
|
290
|
+
modeCmd
|
|
291
|
+
.command('set')
|
|
292
|
+
.description('Set CAWS complexity tier (interactive)')
|
|
293
|
+
.option('-i, --interactive', 'Interactive mode selection', false)
|
|
294
|
+
.option('-m, --mode <mode>', 'Specific mode to set')
|
|
295
|
+
.action((options) => modeCommand('set', options));
|
|
296
|
+
|
|
297
|
+
modeCmd
|
|
298
|
+
.command('compare')
|
|
299
|
+
.description('Compare all available tiers')
|
|
300
|
+
.action(() => modeCommand('compare', {}));
|
|
301
|
+
|
|
302
|
+
modeCmd
|
|
303
|
+
.command('recommend')
|
|
304
|
+
.description('Get tier recommendation for your project')
|
|
305
|
+
.option('--size <size>', 'Project size (small, medium, large)', 'medium')
|
|
306
|
+
.option('--team-size <size>', 'Team size (number)', '1')
|
|
307
|
+
.option('--compliance <required>', 'Compliance requirements (true/false)', 'false')
|
|
308
|
+
.option('--audit <required>', 'Audit requirements (true/false)', 'false')
|
|
309
|
+
.option('--details', 'Show detailed recommendation', false)
|
|
310
|
+
.action((options) => modeCommand('recommend', options));
|
|
311
|
+
|
|
312
|
+
modeCmd
|
|
313
|
+
.command('details <mode>')
|
|
314
|
+
.description('Show detailed information about a specific tier')
|
|
315
|
+
.action((mode) => modeCommand('details', { mode }));
|
|
316
|
+
|
|
317
|
+
// Tutorial command
|
|
318
|
+
program
|
|
319
|
+
.command('tutorial [type]')
|
|
320
|
+
.description('Interactive guided learning for CAWS')
|
|
321
|
+
.action(tutorialCommand);
|
|
322
|
+
|
|
323
|
+
// Plan command
|
|
324
|
+
program
|
|
325
|
+
.command('plan <action>')
|
|
326
|
+
.description('Generate implementation plans')
|
|
327
|
+
.option('--spec-id <id>', 'Spec ID to generate plan for')
|
|
328
|
+
.option('--spec <id>', 'Alias for --spec-id')
|
|
329
|
+
.option('--output <path>', 'Output file path for the plan')
|
|
330
|
+
.action((action, options) => planCommand(action, options));
|
|
331
|
+
|
|
132
332
|
// Templates command
|
|
133
333
|
program
|
|
134
334
|
.command('templates [subcommand]')
|
|
@@ -140,6 +340,7 @@ program
|
|
|
140
340
|
program
|
|
141
341
|
.command('diagnose')
|
|
142
342
|
.description('Run health checks and suggest fixes')
|
|
343
|
+
.option('--spec-id <id>', 'Feature-specific spec ID')
|
|
143
344
|
.option('--fix', 'Apply automatic fixes', false)
|
|
144
345
|
.action(diagnoseCommand);
|
|
145
346
|
|
|
@@ -147,13 +348,15 @@ program
|
|
|
147
348
|
program
|
|
148
349
|
.command('evaluate [spec-file]')
|
|
149
350
|
.description('Evaluate work against CAWS quality standards')
|
|
351
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth)')
|
|
150
352
|
.option('-v, --verbose', 'Show detailed error information', false)
|
|
151
353
|
.action(evaluateCommand);
|
|
152
354
|
|
|
153
355
|
// Iterate command
|
|
154
356
|
program
|
|
155
357
|
.command('iterate [spec-file]')
|
|
156
|
-
.description('Get iterative development guidance
|
|
358
|
+
.description('Get iterative development guidance')
|
|
359
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth)')
|
|
157
360
|
.option('--current-state <json>', 'Current implementation state as JSON', '{}')
|
|
158
361
|
.option('-v, --verbose', 'Show detailed error information', false)
|
|
159
362
|
.action(iterateCommand);
|
|
@@ -202,7 +405,8 @@ waiversCmd
|
|
|
202
405
|
// Workflow command group
|
|
203
406
|
const workflowCmd = program
|
|
204
407
|
.command('workflow <type>')
|
|
205
|
-
.description('Get workflow-specific guidance
|
|
408
|
+
.description('Get workflow-specific guidance')
|
|
409
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth)')
|
|
206
410
|
.option('--step <number>', 'Current step in workflow', '1')
|
|
207
411
|
.option('--current-state <json>', 'Current implementation state as JSON', '{}')
|
|
208
412
|
.option('-v, --verbose', 'Show detailed error information', false)
|
|
@@ -212,6 +416,7 @@ const workflowCmd = program
|
|
|
212
416
|
program
|
|
213
417
|
.command('quality-monitor <action>')
|
|
214
418
|
.description('Monitor code quality impact in real-time')
|
|
419
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth)')
|
|
215
420
|
.option('--files <files>', 'Files affected (comma-separated)')
|
|
216
421
|
.option('--context <json>', 'Additional context as JSON', '{}')
|
|
217
422
|
.option('-v, --verbose', 'Show detailed error information', false)
|
|
@@ -236,13 +441,12 @@ program
|
|
|
236
441
|
// Test Analysis command
|
|
237
442
|
program
|
|
238
443
|
.command('test-analysis <subcommand> [options...]')
|
|
239
|
-
.description('Statistical analysis for budget prediction
|
|
444
|
+
.description('Statistical analysis for budget prediction')
|
|
445
|
+
.option('--spec-id <id>', 'Feature-specific spec ID (e.g., user-auth)')
|
|
240
446
|
.action(testAnalysisCommand);
|
|
241
447
|
|
|
242
448
|
// Provenance command group
|
|
243
|
-
const provenanceCmd = program
|
|
244
|
-
.command('provenance')
|
|
245
|
-
.description('Manage CAWS provenance tracking and audit trails');
|
|
449
|
+
const provenanceCmd = program.command('provenance').description('Manage CAWS provenance tracking');
|
|
246
450
|
|
|
247
451
|
// Subcommands
|
|
248
452
|
provenanceCmd
|
|
@@ -380,6 +584,11 @@ program.exitOverride((err) => {
|
|
|
380
584
|
'validate',
|
|
381
585
|
'scaffold',
|
|
382
586
|
'status',
|
|
587
|
+
'archive',
|
|
588
|
+
'specs',
|
|
589
|
+
'mode',
|
|
590
|
+
'tutorial',
|
|
591
|
+
'plan',
|
|
383
592
|
'templates',
|
|
384
593
|
'diagnose',
|
|
385
594
|
'evaluate',
|
|
@@ -475,6 +684,12 @@ if (require.main === module) {
|
|
|
475
684
|
'init',
|
|
476
685
|
'validate',
|
|
477
686
|
'scaffold',
|
|
687
|
+
'status',
|
|
688
|
+
'archive',
|
|
689
|
+
'specs',
|
|
690
|
+
'mode',
|
|
691
|
+
'tutorial',
|
|
692
|
+
'plan',
|
|
478
693
|
'provenance',
|
|
479
694
|
'hooks',
|
|
480
695
|
'burnup',
|