@paths.design/caws-cli 4.0.0 → 4.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.
Files changed (76) hide show
  1. package/dist/commands/archive.d.ts +50 -0
  2. package/dist/commands/archive.d.ts.map +1 -0
  3. package/dist/commands/archive.js +353 -0
  4. package/dist/commands/iterate.d.ts.map +1 -1
  5. package/dist/commands/iterate.js +12 -13
  6. package/dist/commands/mode.d.ts +24 -0
  7. package/dist/commands/mode.d.ts.map +1 -0
  8. package/dist/commands/mode.js +259 -0
  9. package/dist/commands/plan.d.ts +49 -0
  10. package/dist/commands/plan.d.ts.map +1 -0
  11. package/dist/commands/plan.js +448 -0
  12. package/dist/commands/quality-gates.d.ts +52 -0
  13. package/dist/commands/quality-gates.d.ts.map +1 -0
  14. package/dist/commands/quality-gates.js +490 -0
  15. package/dist/commands/specs.d.ts +71 -0
  16. package/dist/commands/specs.d.ts.map +1 -0
  17. package/dist/commands/specs.js +735 -0
  18. package/dist/commands/status.d.ts +4 -3
  19. package/dist/commands/status.d.ts.map +1 -1
  20. package/dist/commands/status.js +552 -22
  21. package/dist/commands/tutorial.d.ts +55 -0
  22. package/dist/commands/tutorial.d.ts.map +1 -0
  23. package/dist/commands/tutorial.js +481 -0
  24. package/dist/commands/validate.d.ts +10 -3
  25. package/dist/commands/validate.d.ts.map +1 -1
  26. package/dist/commands/validate.js +137 -54
  27. package/dist/config/modes.d.ts +225 -0
  28. package/dist/config/modes.d.ts.map +1 -0
  29. package/dist/config/modes.js +321 -0
  30. package/dist/constants/spec-types.d.ts +41 -0
  31. package/dist/constants/spec-types.d.ts.map +1 -0
  32. package/dist/constants/spec-types.js +42 -0
  33. package/dist/index-new.d.ts +5 -0
  34. package/dist/index-new.d.ts.map +1 -0
  35. package/dist/index-new.js +317 -0
  36. package/dist/index.js +225 -10
  37. package/dist/index.js.backup +4711 -0
  38. package/dist/scaffold/git-hooks.d.ts.map +1 -1
  39. package/dist/scaffold/git-hooks.js +32 -44
  40. package/dist/scaffold/index.d.ts.map +1 -1
  41. package/dist/scaffold/index.js +19 -0
  42. package/dist/utils/quality-gates-errors.js +520 -0
  43. package/dist/utils/quality-gates.d.ts +49 -0
  44. package/dist/utils/quality-gates.d.ts.map +1 -0
  45. package/dist/utils/quality-gates.js +361 -0
  46. package/dist/utils/spec-resolver.d.ts +88 -0
  47. package/dist/utils/spec-resolver.d.ts.map +1 -0
  48. package/dist/utils/spec-resolver.js +602 -0
  49. package/package.json +6 -5
  50. package/templates/.cursor/hooks/caws-scope-guard.sh +64 -8
  51. package/templates/.cursor/hooks/validate-spec.sh +22 -12
  52. package/templates/.cursor/rules/{01-claims-verification.mdc → 00-claims-verification.mdc} +1 -1
  53. package/templates/.cursor/rules/01-working-style.mdc +50 -0
  54. package/templates/.cursor/rules/{02-testing-standards.mdc → 02-quality-gates.mdc} +84 -29
  55. package/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
  56. package/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
  57. package/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
  58. package/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
  59. package/templates/.cursor/rules/07-process-ops.mdc +20 -0
  60. package/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
  61. package/templates/.cursor/rules/09-docstrings.mdc +89 -0
  62. package/templates/.cursor/rules/10-authorship-and-attribution.mdc +15 -0
  63. package/templates/.cursor/rules/11-documentation-quality-standards.mdc +390 -0
  64. package/templates/.cursor/rules/12-scope-management-waivers.mdc +385 -0
  65. package/templates/.cursor/rules/13-implementation-completeness.mdc +516 -0
  66. package/templates/.cursor/rules/14-language-agnostic-standards.mdc +588 -0
  67. package/templates/.cursor/rules/15-sophisticated-todo-detection.mdc +425 -0
  68. package/templates/.cursor/rules/README.md +93 -7
  69. package/templates/apps/tools/caws/prompt-lint.js.backup +274 -0
  70. package/templates/apps/tools/caws/provenance.js.backup +73 -0
  71. package/templates/scripts/quality-gates/check-god-objects.js +146 -0
  72. package/templates/scripts/quality-gates/run-quality-gates.js +50 -0
  73. package/templates/scripts/v3/analysis/todo_analyzer.py +1950 -0
  74. package/templates/.cursor/rules/03-infrastructure-standards.mdc +0 -251
  75. package/templates/.cursor/rules/04-documentation-integrity.mdc +0 -291
  76. 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,41 @@
1
+ export namespace SPEC_TYPES {
2
+ namespace feature {
3
+ let color: chalk.Chalk;
4
+ let icon: string;
5
+ let description: string;
6
+ }
7
+ namespace fix {
8
+ let color_1: chalk.Chalk;
9
+ export { color_1 as color };
10
+ let icon_1: string;
11
+ export { icon_1 as icon };
12
+ let description_1: string;
13
+ export { description_1 as description };
14
+ }
15
+ namespace refactor {
16
+ let color_2: chalk.Chalk;
17
+ export { color_2 as color };
18
+ let icon_2: string;
19
+ export { icon_2 as icon };
20
+ let description_2: string;
21
+ export { description_2 as description };
22
+ }
23
+ namespace chore {
24
+ let color_3: chalk.Chalk;
25
+ export { color_3 as color };
26
+ let icon_3: string;
27
+ export { icon_3 as icon };
28
+ let description_3: string;
29
+ export { description_3 as description };
30
+ }
31
+ namespace docs {
32
+ let color_4: chalk.Chalk;
33
+ export { color_4 as color };
34
+ let icon_4: string;
35
+ export { icon_4 as icon };
36
+ let description_4: string;
37
+ export { description_4 as description };
38
+ }
39
+ }
40
+ import chalk = require("chalk");
41
+ //# sourceMappingURL=spec-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-types.d.ts","sourceRoot":"","sources":["../../src/constants/spec-types.js"],"names":[],"mappings":""}
@@ -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
+ };
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import { generateWorkingSpec } from "./generators/working-spec";
3
+ import { validateGeneratedSpec } from "./generators/working-spec";
4
+ export { generateWorkingSpec, validateGeneratedSpec };
5
+ //# sourceMappingURL=index-new.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-new.d.ts","sourceRoot":"","sources":["../src/index-new.js"],"names":[],"mappings":""}