@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,259 @@
1
+ /**
2
+ * @fileoverview CAWS Mode Command
3
+ * Manage CAWS complexity tiers and switch between modes
4
+ * @author @darianrosebrook
5
+ */
6
+
7
+ const chalk = require('chalk');
8
+ const { safeAsync, outputResult } = require('../error-handler');
9
+
10
+ const {
11
+ getTier,
12
+ getAvailableTiers,
13
+ getCurrentMode,
14
+ setCurrentMode,
15
+ displayTierComparison,
16
+ getTierRecommendation,
17
+ } = require('../config/modes');
18
+
19
+ /**
20
+ * Display current mode status
21
+ */
22
+ function displayCurrentMode() {
23
+ console.log(chalk.bold.cyan('\n🔧 CAWS Current Mode'));
24
+ console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
25
+
26
+ // This will be implemented when we load the current mode
27
+ console.log(chalk.yellow('Mode display will be implemented...'));
28
+ console.log('');
29
+ }
30
+
31
+ /**
32
+ * Display mode details
33
+ * @param {string} mode - Mode to display
34
+ */
35
+ function displayModeDetails(mode) {
36
+ const tier = getTier(mode);
37
+ const tierColor = tier.color;
38
+ const icon = tier.icon;
39
+
40
+ console.log(chalk.bold.cyan(`\n📋 ${icon} ${tierColor(tier.name)} Mode Details`));
41
+ console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
42
+
43
+ console.log(`${tierColor(tier.name)} - ${tier.description}\n`);
44
+
45
+ // Quality Requirements
46
+ console.log(chalk.bold('Quality Requirements:'));
47
+ console.log(chalk.gray(` Test Coverage: ${tier.qualityRequirements.testCoverage}%`));
48
+ console.log(chalk.gray(` Mutation Score: ${tier.qualityRequirements.mutationScore}%`));
49
+ console.log(chalk.gray(` Contracts: ${tier.qualityRequirements.contracts}\n`));
50
+
51
+ // Supported Risk Tiers
52
+ console.log(chalk.bold('Supported Risk Tiers:'));
53
+ tier.riskTiers.forEach((riskTier) => {
54
+ const riskColor =
55
+ riskTier === 'T1' ? chalk.red : riskTier === 'T2' ? chalk.yellow : chalk.green;
56
+ console.log(chalk.gray(` ${riskColor(riskTier)}`));
57
+ });
58
+ console.log('');
59
+
60
+ // Available Commands
61
+ console.log(chalk.bold('Available Commands:'));
62
+ Object.entries(tier.commands)
63
+ .filter(([, available]) => available)
64
+ .forEach(([command]) => {
65
+ console.log(chalk.gray(` ✅ caws ${command}`));
66
+ });
67
+
68
+ const disabledCommands = Object.entries(tier.commands)
69
+ .filter(([, available]) => !available)
70
+ .map(([command]) => command);
71
+
72
+ if (disabledCommands.length > 0) {
73
+ console.log(chalk.bold('\nDisabled Commands:'));
74
+ disabledCommands.forEach((command) => {
75
+ console.log(chalk.gray(` ❌ caws ${command}`));
76
+ });
77
+ }
78
+
79
+ console.log('');
80
+ }
81
+
82
+ /**
83
+ * Interactive mode selection
84
+ * @returns {Promise<string>} Selected mode
85
+ */
86
+ async function interactiveModeSelection() {
87
+ const readline = require('readline');
88
+
89
+ const rl = readline.createInterface({
90
+ input: process.stdin,
91
+ output: process.stdout,
92
+ });
93
+
94
+ return new Promise((resolve) => {
95
+ console.log(chalk.bold.cyan('\n🔧 Select CAWS Complexity Tier'));
96
+ console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
97
+
98
+ const tiers = getAvailableTiers();
99
+ tiers.forEach((tier, index) => {
100
+ const tierConfig = getTier(tier);
101
+ const tierColor = tierConfig.color;
102
+ const icon = tierConfig.icon;
103
+ console.log(`${index + 1}. ${icon} ${tierColor(tier)} - ${tierConfig.description}`);
104
+ });
105
+
106
+ console.log('\nEnter your choice (1-3): ');
107
+
108
+ rl.on('line', (input) => {
109
+ const choice = parseInt(input.trim());
110
+ if (choice >= 1 && choice <= tiers.length) {
111
+ rl.close();
112
+ resolve(tiers[choice - 1]);
113
+ } else {
114
+ console.log(chalk.red('Invalid choice. Please enter 1-3:'));
115
+ }
116
+ });
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Mode command handler
122
+ * @param {string} action - Action to perform (current, set, compare, recommend)
123
+ * @param {Object} options - Command options
124
+ */
125
+ async function modeCommand(action, options = {}) {
126
+ return safeAsync(
127
+ async () => {
128
+ switch (action) {
129
+ case 'current': {
130
+ const currentMode = await getCurrentMode();
131
+ displayCurrentMode();
132
+
133
+ const tier = getTier(currentMode);
134
+ console.log(chalk.bold(`Current Mode: ${tier.icon} ${tier.color(currentMode)}`));
135
+ console.log(chalk.gray(`Description: ${tier.description}`));
136
+ console.log(
137
+ chalk.gray(
138
+ `Quality: ${tier.qualityRequirements.testCoverage}% coverage, ${tier.qualityRequirements.mutationScore}% mutation`
139
+ )
140
+ );
141
+
142
+ return outputResult({
143
+ command: 'mode current',
144
+ mode: currentMode,
145
+ tier: tier,
146
+ });
147
+ }
148
+
149
+ case 'set': {
150
+ let targetMode;
151
+
152
+ if (options.mode) {
153
+ targetMode = options.mode;
154
+ } else if (options.interactive) {
155
+ targetMode = await interactiveModeSelection();
156
+ } else {
157
+ throw new Error('Mode not specified. Use --mode <mode> or --interactive');
158
+ }
159
+
160
+ if (!getAvailableTiers().includes(targetMode)) {
161
+ throw new Error(
162
+ `Invalid mode: ${targetMode}. Available: ${getAvailableTiers().join(', ')}`
163
+ );
164
+ }
165
+
166
+ const success = await setCurrentMode(targetMode);
167
+ if (!success) {
168
+ throw new Error(`Failed to set mode to ${targetMode}`);
169
+ }
170
+
171
+ console.log(
172
+ chalk.green(
173
+ `✅ Successfully switched to ${getTier(targetMode).icon} ${getTier(targetMode).color(targetMode)} mode`
174
+ )
175
+ );
176
+
177
+ return outputResult({
178
+ command: 'mode set',
179
+ mode: targetMode,
180
+ });
181
+ }
182
+
183
+ case 'compare': {
184
+ displayTierComparison();
185
+
186
+ return outputResult({
187
+ command: 'mode compare',
188
+ tiers: getAvailableTiers(),
189
+ });
190
+ }
191
+
192
+ case 'recommend': {
193
+ const projectInfo = {};
194
+
195
+ if (options.size) projectInfo.size = options.size;
196
+ if (options.teamSize) projectInfo.teamSize = parseInt(options.teamSize);
197
+ if (options.compliance) projectInfo.compliance = options.compliance === 'true';
198
+ if (options.audit) projectInfo.auditRequired = options.audit === 'true';
199
+
200
+ const recommendation = getTierRecommendation(projectInfo);
201
+ const recommendedTier = getTier(recommendation);
202
+
203
+ console.log(chalk.bold.cyan('\n🎯 Recommended CAWS Tier'));
204
+ console.log(chalk.cyan('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
205
+
206
+ console.log(
207
+ `${recommendedTier.icon} ${recommendedTier.color(recommendedTier.name)} - ${recommendedTier.description}`
208
+ );
209
+ console.log(
210
+ chalk.gray(
211
+ `Quality: ${recommendedTier.qualityRequirements.testCoverage}% coverage, ${recommendedTier.qualityRequirements.mutationScore}% mutation`
212
+ )
213
+ );
214
+
215
+ if (options.details) {
216
+ console.log('');
217
+ displayModeDetails(recommendation);
218
+ }
219
+
220
+ return outputResult({
221
+ command: 'mode recommend',
222
+ recommendation,
223
+ tier: recommendedTier,
224
+ projectInfo,
225
+ });
226
+ }
227
+
228
+ case 'details': {
229
+ if (!options.mode) {
230
+ throw new Error('Mode not specified. Use --mode <mode>');
231
+ }
232
+
233
+ displayModeDetails(options.mode);
234
+
235
+ return outputResult({
236
+ command: 'mode details',
237
+ mode: options.mode,
238
+ });
239
+ }
240
+
241
+ default:
242
+ throw new Error(
243
+ `Unknown mode action: ${action}. Use: current, set, compare, recommend, details`
244
+ );
245
+ }
246
+ },
247
+ `mode ${action}`,
248
+ true
249
+ );
250
+ }
251
+
252
+ module.exports = {
253
+ modeCommand,
254
+ getCurrentMode,
255
+ setCurrentMode,
256
+ displayCurrentMode,
257
+ displayModeDetails,
258
+ interactiveModeSelection,
259
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Plan command handler
3
+ * @param {string} action - Action to perform (generate)
4
+ * @param {Object} options - Command options
5
+ */
6
+ export function planCommand(action: string, options?: any): Promise<any>;
7
+ /**
8
+ * Generate implementation plan from spec
9
+ * @param {Object} spec - Spec data
10
+ * @returns {Object} Generated plan
11
+ */
12
+ export function generateImplementationPlan(spec: any): any;
13
+ /**
14
+ * Write plan to file
15
+ * @param {Object} plan - Plan data
16
+ * @param {string} outputPath - Output file path
17
+ * @returns {Promise<void>}
18
+ */
19
+ export function writePlanToFile(plan: any, outputPath: string): Promise<void>;
20
+ /**
21
+ * Generate markdown content from plan
22
+ * @param {Object} plan - Plan data
23
+ * @returns {string} Markdown content
24
+ */
25
+ export function generatePlanMarkdown(plan: any): string;
26
+ /**
27
+ * Display generated plan
28
+ * @param {Object} plan - Plan data
29
+ */
30
+ export function displayGeneratedPlan(plan: any): void;
31
+ export namespace PLAN_TEMPLATES {
32
+ namespace feature {
33
+ let sections: string[];
34
+ let defaultTasks: string[];
35
+ }
36
+ namespace fix {
37
+ let sections_1: string[];
38
+ export { sections_1 as sections };
39
+ let defaultTasks_1: string[];
40
+ export { defaultTasks_1 as defaultTasks };
41
+ }
42
+ namespace refactor {
43
+ let sections_2: string[];
44
+ export { sections_2 as sections };
45
+ let defaultTasks_2: string[];
46
+ export { defaultTasks_2 as defaultTasks };
47
+ }
48
+ }
49
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.js"],"names":[],"mappings":"AA6XA;;;;GAIG;AACH,oCAHW,MAAM,+BAuDhB;AA1OD;;;;GAIG;AACH,2DA8CC;AAED;;;;;GAKG;AACH,uDAHW,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAQzB;AAED;;;;GAIG;AACH,iDAFa,MAAM,CAiElB;AAED;;;GAGG;AACH,sDAkCC"}