@paths.design/caws-cli 5.0.1 → 5.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.
- package/README.md +15 -12
- package/dist/budget-derivation.d.ts +74 -0
- package/dist/budget-derivation.d.ts.map +1 -0
- package/dist/cicd-optimizer.d.ts +142 -0
- package/dist/cicd-optimizer.d.ts.map +1 -0
- package/dist/commands/archive.d.ts +50 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/burnup.d.ts +6 -0
- package/dist/commands/burnup.d.ts.map +1 -0
- package/dist/commands/diagnose.d.ts +52 -0
- package/dist/commands/diagnose.d.ts.map +1 -0
- package/dist/commands/evaluate.d.ts +8 -0
- package/dist/commands/evaluate.d.ts.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/iterate.d.ts +8 -0
- package/dist/commands/iterate.d.ts.map +1 -0
- package/dist/commands/mode.d.ts +24 -0
- package/dist/commands/mode.d.ts.map +1 -0
- package/dist/commands/plan.d.ts +49 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/provenance.d.ts +32 -0
- package/dist/commands/provenance.d.ts.map +1 -0
- package/dist/commands/provenance.js +27 -22
- package/dist/commands/quality-gates.d.ts +52 -0
- package/dist/commands/quality-gates.d.ts.map +1 -0
- package/dist/commands/quality-gates.js +190 -455
- package/dist/commands/quality-monitor.d.ts +17 -0
- package/dist/commands/quality-monitor.d.ts.map +1 -0
- package/dist/commands/specs.d.ts +71 -0
- package/dist/commands/specs.d.ts.map +1 -0
- package/dist/commands/specs.js +34 -35
- package/dist/commands/status.d.ts +44 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +10 -7
- package/dist/commands/templates.d.ts +74 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/tool.d.ts +13 -0
- package/dist/commands/tool.d.ts.map +1 -0
- package/dist/commands/tool.js +63 -63
- package/dist/commands/troubleshoot.d.ts +8 -0
- package/dist/commands/troubleshoot.d.ts.map +1 -0
- package/dist/commands/tutorial.d.ts +55 -0
- package/dist/commands/tutorial.d.ts.map +1 -0
- package/dist/commands/validate.d.ts +15 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/waivers.d.ts +8 -0
- package/dist/commands/waivers.d.ts.map +1 -0
- package/dist/commands/waivers.js +38 -39
- package/dist/commands/workflow.d.ts +85 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/config/index.d.ts +29 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/modes.d.ts +225 -0
- package/dist/config/modes.d.ts.map +1 -0
- package/dist/constants/spec-types.d.ts +41 -0
- package/dist/constants/spec-types.d.ts.map +1 -0
- package/dist/error-handler.d.ts +164 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/generators/jest-config.d.ts +32 -0
- package/dist/generators/jest-config.d.ts.map +1 -0
- package/dist/generators/working-spec.d.ts +13 -0
- package/dist/generators/working-spec.d.ts.map +1 -0
- package/dist/index-new.d.ts +5 -0
- package/dist/index-new.d.ts.map +1 -0
- package/dist/index-new.js +317 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.backup +4711 -0
- package/dist/minimal-cli.d.ts +3 -0
- package/dist/minimal-cli.d.ts.map +1 -0
- package/dist/policy/PolicyManager.d.ts +104 -0
- package/dist/policy/PolicyManager.d.ts.map +1 -0
- package/dist/policy/PolicyManager.js +60 -28
- package/dist/scaffold/cursor-hooks.d.ts +7 -0
- package/dist/scaffold/cursor-hooks.d.ts.map +1 -0
- package/dist/scaffold/git-hooks.d.ts +20 -0
- package/dist/scaffold/git-hooks.d.ts.map +1 -0
- package/dist/scaffold/git-hooks.js +89 -27
- package/dist/scaffold/index.d.ts +20 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/index.js +25 -0
- package/dist/spec/SpecFileManager.d.ts +146 -0
- package/dist/spec/SpecFileManager.d.ts.map +1 -0
- package/dist/test-analysis.d.ts +182 -0
- package/dist/test-analysis.d.ts.map +1 -0
- package/dist/tool-interface.d.ts +236 -0
- package/dist/tool-interface.d.ts.map +1 -0
- package/dist/tool-loader.d.ts +77 -0
- package/dist/tool-loader.d.ts.map +1 -0
- package/dist/tool-validator.d.ts +72 -0
- package/dist/tool-validator.d.ts.map +1 -0
- package/dist/utils/async-utils.js +188 -0
- package/dist/utils/command-wrapper.js +200 -0
- package/dist/utils/detection.d.ts +7 -0
- package/dist/utils/detection.d.ts.map +1 -0
- package/dist/utils/finalization.d.ts +17 -0
- package/dist/utils/finalization.d.ts.map +1 -0
- package/dist/utils/project-analysis.d.ts +14 -0
- package/dist/utils/project-analysis.d.ts.map +1 -0
- package/dist/utils/promise-utils.js +72 -0
- package/dist/utils/quality-gates.d.ts +49 -0
- package/dist/utils/quality-gates.d.ts.map +1 -0
- package/dist/utils/spec-resolver.d.ts +88 -0
- package/dist/utils/spec-resolver.d.ts.map +1 -0
- package/dist/utils/typescript-detector.d.ts +63 -0
- package/dist/utils/typescript-detector.d.ts.map +1 -0
- package/dist/validation/spec-validation.d.ts +43 -0
- package/dist/validation/spec-validation.d.ts.map +1 -0
- package/dist/waivers-manager.d.ts +167 -0
- package/dist/waivers-manager.d.ts.map +1 -0
- package/package.json +1 -1
- package/templates/apps/tools/caws/prompt-lint.js.backup +274 -0
- package/templates/apps/tools/caws/provenance.js.backup +73 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Async Operation Utilities
|
|
3
|
+
* Provides consistent patterns for async operations, parallel execution, and resource cleanup
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Execute multiple async operations in parallel
|
|
9
|
+
* @param {Array<Promise>} promises - Array of promises to execute
|
|
10
|
+
* @param {Object} options - Options
|
|
11
|
+
* @param {boolean} [options.failFast=true] - Stop on first error
|
|
12
|
+
* @returns {Promise<Array>} Array of results
|
|
13
|
+
*/
|
|
14
|
+
async function parallel(promises, options = {}) {
|
|
15
|
+
const { failFast = true } = options;
|
|
16
|
+
|
|
17
|
+
if (failFast) {
|
|
18
|
+
return Promise.all(promises);
|
|
19
|
+
} else {
|
|
20
|
+
// Wait for all promises, collecting both successes and failures
|
|
21
|
+
return Promise.allSettled(promises).then((results) => {
|
|
22
|
+
return results.map((result) => {
|
|
23
|
+
if (result.status === 'fulfilled') {
|
|
24
|
+
return { success: true, value: result.value };
|
|
25
|
+
} else {
|
|
26
|
+
return { success: false, error: result.reason };
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Execute async operations sequentially
|
|
35
|
+
* @param {Array<Function>} operations - Array of async functions to execute
|
|
36
|
+
* @param {Object} options - Options
|
|
37
|
+
* @param {boolean} [options.stopOnError=true] - Stop on first error
|
|
38
|
+
* @returns {Promise<Array>} Array of results
|
|
39
|
+
*/
|
|
40
|
+
async function sequential(operations, options = {}) {
|
|
41
|
+
const { stopOnError = true } = options;
|
|
42
|
+
const results = [];
|
|
43
|
+
|
|
44
|
+
for (const operation of operations) {
|
|
45
|
+
try {
|
|
46
|
+
const result = await operation();
|
|
47
|
+
results.push({ success: true, value: result });
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (stopOnError) {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
results.push({ success: false, error });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return results;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Retry an async operation with exponential backoff
|
|
61
|
+
* @param {Function} operation - Async function to retry
|
|
62
|
+
* @param {Object} options - Retry options
|
|
63
|
+
* @param {number} [options.maxRetries=3] - Maximum number of retries
|
|
64
|
+
* @param {number} [options.initialDelay=1000] - Initial delay in ms
|
|
65
|
+
* @param {number} [options.maxDelay=10000] - Maximum delay in ms
|
|
66
|
+
* @param {Function} [options.shouldRetry] - Function to determine if error should be retried
|
|
67
|
+
* @returns {Promise<any>} Operation result
|
|
68
|
+
*/
|
|
69
|
+
async function retry(operation, options = {}) {
|
|
70
|
+
const {
|
|
71
|
+
maxRetries = 3,
|
|
72
|
+
initialDelay = 1000,
|
|
73
|
+
maxDelay = 10000,
|
|
74
|
+
shouldRetry = () => true,
|
|
75
|
+
} = options;
|
|
76
|
+
|
|
77
|
+
let lastError;
|
|
78
|
+
let delay = initialDelay;
|
|
79
|
+
|
|
80
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
81
|
+
try {
|
|
82
|
+
return await operation();
|
|
83
|
+
} catch (error) {
|
|
84
|
+
lastError = error;
|
|
85
|
+
|
|
86
|
+
if (attempt === maxRetries || !shouldRetry(error)) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Wait before retrying with exponential backoff
|
|
91
|
+
// eslint-disable-next-line no-undef
|
|
92
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
93
|
+
delay = Math.min(delay * 2, maxDelay);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
throw lastError;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Execute operation with timeout
|
|
102
|
+
* @param {Promise} promise - Promise to execute
|
|
103
|
+
* @param {number} timeoutMs - Timeout in milliseconds
|
|
104
|
+
* @param {string} [errorMessage] - Custom error message
|
|
105
|
+
* @returns {Promise<any>} Operation result
|
|
106
|
+
*/
|
|
107
|
+
async function withTimeout(promise, timeoutMs, errorMessage = 'Operation timed out') {
|
|
108
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
109
|
+
// eslint-disable-next-line no-undef
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
reject(new Error(`${errorMessage} (${timeoutMs}ms)`));
|
|
112
|
+
}, timeoutMs);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return Promise.race([promise, timeoutPromise]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Execute operation with resource cleanup
|
|
120
|
+
* @param {Function} operation - Async operation to execute
|
|
121
|
+
* @param {Function} cleanup - Cleanup function (called in finally)
|
|
122
|
+
* @returns {Promise<any>} Operation result
|
|
123
|
+
*/
|
|
124
|
+
async function withCleanup(operation, cleanup) {
|
|
125
|
+
try {
|
|
126
|
+
return await operation();
|
|
127
|
+
} finally {
|
|
128
|
+
await cleanup();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Execute multiple operations and collect all errors
|
|
134
|
+
* @param {Array<Function>} operations - Array of async functions
|
|
135
|
+
* @returns {Promise<{successes: Array, errors: Array}>} Results and errors
|
|
136
|
+
*/
|
|
137
|
+
async function collectResults(operations) {
|
|
138
|
+
const results = await Promise.allSettled(
|
|
139
|
+
operations.map((op) => op())
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const successes = [];
|
|
143
|
+
const errors = [];
|
|
144
|
+
|
|
145
|
+
results.forEach((result, index) => {
|
|
146
|
+
if (result.status === 'fulfilled') {
|
|
147
|
+
successes.push({ index, value: result.value });
|
|
148
|
+
} else {
|
|
149
|
+
errors.push({ index, error: result.reason });
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
return { successes, errors };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Execute operation with cancellation support
|
|
158
|
+
* @param {Function} operation - Async operation to execute
|
|
159
|
+
* @param {AbortSignal} signal - Abort signal for cancellation
|
|
160
|
+
* @returns {Promise<any>} Operation result
|
|
161
|
+
*/
|
|
162
|
+
async function withCancellation(operation, signal) {
|
|
163
|
+
if (signal.aborted) {
|
|
164
|
+
throw new Error('Operation cancelled');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return new Promise((resolve, reject) => {
|
|
168
|
+
signal.addEventListener('abort', () => {
|
|
169
|
+
reject(new Error('Operation cancelled'));
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
operation()
|
|
173
|
+
.then(resolve)
|
|
174
|
+
.catch(reject);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
module.exports = {
|
|
179
|
+
parallel,
|
|
180
|
+
sequential,
|
|
181
|
+
retry,
|
|
182
|
+
withTimeout,
|
|
183
|
+
withCleanup,
|
|
184
|
+
collectResults,
|
|
185
|
+
withCancellation,
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Unified Command Wrapper
|
|
3
|
+
* Provides consistent error handling and output formatting for all CLI commands
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { safeAsync, handleCliError, outputResult, isJsonOutput } = require('../error-handler');
|
|
8
|
+
const chalk = require('chalk');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Unified command wrapper that provides:
|
|
12
|
+
* - Consistent error handling
|
|
13
|
+
* - Standardized output formatting
|
|
14
|
+
* - Execution timing
|
|
15
|
+
* - JSON output support
|
|
16
|
+
*
|
|
17
|
+
* @param {Function} commandFn - Async command function to execute
|
|
18
|
+
* @param {Object} options - Command options
|
|
19
|
+
* @param {string} options.commandName - Name of the command (for error context)
|
|
20
|
+
* @param {boolean} [options.includeTiming=true] - Include execution timing
|
|
21
|
+
* @param {boolean} [options.exitOnError=true] - Exit process on error
|
|
22
|
+
* @param {Object} [options.context={}] - Additional context for error handling
|
|
23
|
+
* @returns {Promise<any>} Command result
|
|
24
|
+
*/
|
|
25
|
+
async function commandWrapper(commandFn, options = {}) {
|
|
26
|
+
const {
|
|
27
|
+
commandName = 'command',
|
|
28
|
+
includeTiming = true,
|
|
29
|
+
exitOnError = true,
|
|
30
|
+
context = {},
|
|
31
|
+
} = options;
|
|
32
|
+
|
|
33
|
+
return safeAsync(
|
|
34
|
+
async () => {
|
|
35
|
+
try {
|
|
36
|
+
const result = await commandFn();
|
|
37
|
+
return result;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
// Enhance error with command context
|
|
40
|
+
error.commandName = commandName;
|
|
41
|
+
error.context = { ...context, ...error.context };
|
|
42
|
+
|
|
43
|
+
// Handle error with unified handler
|
|
44
|
+
handleCliError(
|
|
45
|
+
error,
|
|
46
|
+
{
|
|
47
|
+
command: commandName,
|
|
48
|
+
...context,
|
|
49
|
+
},
|
|
50
|
+
exitOnError
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// If exitOnError is false, rethrow for caller to handle
|
|
54
|
+
if (!exitOnError) {
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
commandName,
|
|
60
|
+
includeTiming
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Unified output utilities for consistent formatting
|
|
66
|
+
*/
|
|
67
|
+
const Output = {
|
|
68
|
+
/**
|
|
69
|
+
* Output success message
|
|
70
|
+
* @param {string} message - Success message
|
|
71
|
+
* @param {Object} [data] - Additional data to output
|
|
72
|
+
*/
|
|
73
|
+
success(message, data = {}) {
|
|
74
|
+
if (isJsonOutput()) {
|
|
75
|
+
outputResult(
|
|
76
|
+
{
|
|
77
|
+
success: true,
|
|
78
|
+
message,
|
|
79
|
+
...data,
|
|
80
|
+
},
|
|
81
|
+
true
|
|
82
|
+
);
|
|
83
|
+
} else {
|
|
84
|
+
console.log(chalk.green(`✅ ${message}`));
|
|
85
|
+
if (Object.keys(data).length > 0 && !isJsonOutput()) {
|
|
86
|
+
console.log(chalk.gray(JSON.stringify(data, null, 2)));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Output error message
|
|
93
|
+
* @param {string} message - Error message
|
|
94
|
+
* @param {string[]} [suggestions] - Recovery suggestions
|
|
95
|
+
*/
|
|
96
|
+
error(message, suggestions = []) {
|
|
97
|
+
if (isJsonOutput()) {
|
|
98
|
+
outputResult(
|
|
99
|
+
{
|
|
100
|
+
success: false,
|
|
101
|
+
error: {
|
|
102
|
+
message,
|
|
103
|
+
suggestions,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
false
|
|
107
|
+
);
|
|
108
|
+
} else {
|
|
109
|
+
console.error(chalk.red(`❌ ${message}`));
|
|
110
|
+
if (suggestions.length > 0) {
|
|
111
|
+
console.error(chalk.yellow('\n💡 Suggestions:'));
|
|
112
|
+
suggestions.forEach((suggestion) => {
|
|
113
|
+
console.error(chalk.yellow(` ${suggestion}`));
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Output warning message
|
|
121
|
+
* @param {string} message - Warning message
|
|
122
|
+
* @param {string} [suggestion] - Optional suggestion
|
|
123
|
+
*/
|
|
124
|
+
warning(message, suggestion = null) {
|
|
125
|
+
if (isJsonOutput()) {
|
|
126
|
+
outputResult(
|
|
127
|
+
{
|
|
128
|
+
warning: true,
|
|
129
|
+
message,
|
|
130
|
+
suggestion,
|
|
131
|
+
},
|
|
132
|
+
true
|
|
133
|
+
);
|
|
134
|
+
} else {
|
|
135
|
+
console.warn(chalk.yellow(`⚠️ ${message}`));
|
|
136
|
+
if (suggestion) {
|
|
137
|
+
console.warn(chalk.blue(` 💡 ${suggestion}`));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Output info message
|
|
144
|
+
* @param {string} message - Info message
|
|
145
|
+
* @param {Object} [data] - Additional data
|
|
146
|
+
*/
|
|
147
|
+
info(message, data = {}) {
|
|
148
|
+
if (isJsonOutput()) {
|
|
149
|
+
outputResult(
|
|
150
|
+
{
|
|
151
|
+
info: true,
|
|
152
|
+
message,
|
|
153
|
+
...data,
|
|
154
|
+
},
|
|
155
|
+
true
|
|
156
|
+
);
|
|
157
|
+
} else {
|
|
158
|
+
console.log(chalk.blue(`ℹ️ ${message}`));
|
|
159
|
+
if (Object.keys(data).length > 0) {
|
|
160
|
+
console.log(chalk.gray(JSON.stringify(data, null, 2)));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Output data in JSON format
|
|
167
|
+
* @param {Object} data - Data to output
|
|
168
|
+
* @param {boolean} [success=true] - Whether operation was successful
|
|
169
|
+
*/
|
|
170
|
+
json(data, success = true) {
|
|
171
|
+
outputResult(data, success);
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Output progress message
|
|
176
|
+
* @param {string} message - Progress message
|
|
177
|
+
*/
|
|
178
|
+
progress(message) {
|
|
179
|
+
if (!isJsonOutput()) {
|
|
180
|
+
console.log(chalk.blue(`🔄 ${message}`));
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Output section header
|
|
186
|
+
* @param {string} title - Section title
|
|
187
|
+
*/
|
|
188
|
+
section(title) {
|
|
189
|
+
if (!isJsonOutput()) {
|
|
190
|
+
console.log(chalk.bold(`\n${title}`));
|
|
191
|
+
console.log('─'.repeat(Math.min(title.length, 60)));
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
module.exports = {
|
|
197
|
+
commandWrapper,
|
|
198
|
+
Output,
|
|
199
|
+
isJsonOutput,
|
|
200
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/utils/detection.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,sCAHW,MAAM,OA6JhB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate provenance manifest and git initialization (for both modes)
|
|
3
|
+
* @param {string} projectName - Project name
|
|
4
|
+
* @param {Object} options - Command options
|
|
5
|
+
* @param {Object} answers - User answers
|
|
6
|
+
*/
|
|
7
|
+
export function finalizeProject(projectName: string, options: any, answers: any): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Display success message after project initialization
|
|
10
|
+
*/
|
|
11
|
+
export function continueToSuccess(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Set dependencies for finalization utilities
|
|
14
|
+
* @param {Object} deps - Dependencies object
|
|
15
|
+
*/
|
|
16
|
+
export function setFinalizationDependencies(deps: any): void;
|
|
17
|
+
//# sourceMappingURL=finalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalization.d.ts","sourceRoot":"","sources":["../../src/utils/finalization.js"],"names":[],"mappings":"AA6BA;;;;;GAKG;AACH,6CAJW,MAAM,6CAgKhB;AAED;;GAEG;AACH,0CA0BC;AA1MD;;;GAGG;AACH,6DAGC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect project type from existing files and structure
|
|
3
|
+
* @param {string} cwd - Current working directory
|
|
4
|
+
* @returns {string} Project type
|
|
5
|
+
*/
|
|
6
|
+
export function detectProjectType(cwd?: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Detect if current directory appears to be a project that should be initialized directly
|
|
9
|
+
* @param {string} projectName - Project name from command line
|
|
10
|
+
* @param {string} currentDir - Current directory path
|
|
11
|
+
* @returns {boolean} Whether to init in current directory
|
|
12
|
+
*/
|
|
13
|
+
export function shouldInitInCurrentDirectory(projectName: string, currentDir: string): boolean;
|
|
14
|
+
//# sourceMappingURL=project-analysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-analysis.d.ts","sourceRoot":"","sources":["../../src/utils/project-analysis.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wCAHW,MAAM,GACJ,MAAM,CAmDlB;AAED;;;;;GAKG;AACH,0DAJW,MAAM,cACN,MAAM,GACJ,OAAO,CA8BnB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Promise Utilities
|
|
3
|
+
* Utilities for converting callback-based APIs to promises
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Convert readline question to promise
|
|
9
|
+
* @param {readline.Interface} rl - Readline interface
|
|
10
|
+
* @param {string} question - Question to ask
|
|
11
|
+
* @returns {Promise<string>} User's answer
|
|
12
|
+
*/
|
|
13
|
+
function question(rl, questionText) {
|
|
14
|
+
return new Promise((resolve) => {
|
|
15
|
+
rl.question(questionText, (answer) => {
|
|
16
|
+
resolve(answer);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Close readline interface and return promise
|
|
23
|
+
* @param {readline.Interface} rl - Readline interface
|
|
24
|
+
* @returns {Promise<void>}
|
|
25
|
+
*/
|
|
26
|
+
function closeReadline(rl) {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
rl.once('close', resolve);
|
|
29
|
+
rl.close();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create a promise that resolves when event fires
|
|
35
|
+
* @param {EventEmitter} emitter - Event emitter
|
|
36
|
+
* @param {string} event - Event name
|
|
37
|
+
* @param {Object} options - Options
|
|
38
|
+
* @param {number} [options.timeout] - Timeout in ms
|
|
39
|
+
* @returns {Promise<any>} Event data
|
|
40
|
+
*/
|
|
41
|
+
function once(emitter, event, options = {}) {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const { timeout } = options;
|
|
44
|
+
|
|
45
|
+
const timeoutId = timeout
|
|
46
|
+
? // eslint-disable-next-line no-undef
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
emitter.removeListener(event, handler);
|
|
49
|
+
reject(new Error(`Event '${event}' timed out after ${timeout}ms`));
|
|
50
|
+
}, timeout)
|
|
51
|
+
: null;
|
|
52
|
+
|
|
53
|
+
const handler = (...args) => {
|
|
54
|
+
if (timeoutId) {
|
|
55
|
+
// eslint-disable-next-line no-undef
|
|
56
|
+
clearTimeout(timeoutId);
|
|
57
|
+
}
|
|
58
|
+
emitter.removeListener(event, handler);
|
|
59
|
+
resolve(args.length === 1 ? args[0] : args);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
emitter.once(event, handler);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = {
|
|
67
|
+
question,
|
|
68
|
+
closeReadline,
|
|
69
|
+
once,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get staged files from git
|
|
3
|
+
* @returns {string[]} Array of staged file paths
|
|
4
|
+
*/
|
|
5
|
+
export function getStagedFiles(): string[];
|
|
6
|
+
/**
|
|
7
|
+
* Check for god objects in staged files
|
|
8
|
+
* @param {string[]} stagedFiles - Array of staged file paths
|
|
9
|
+
* @param {string} language - Language to check ('rust', 'typescript', etc.)
|
|
10
|
+
* @returns {Object} God object analysis results
|
|
11
|
+
*/
|
|
12
|
+
export function checkGodObjects(stagedFiles: string[], language?: string): any;
|
|
13
|
+
/**
|
|
14
|
+
* Check for hidden TODOs in staged files
|
|
15
|
+
* @param {string[]} stagedFiles - Array of staged file paths
|
|
16
|
+
* @returns {Object} TODO analysis results
|
|
17
|
+
*/
|
|
18
|
+
export function checkHiddenTodos(stagedFiles: string[]): any;
|
|
19
|
+
/**
|
|
20
|
+
* Check if a waiver applies to the given gate
|
|
21
|
+
* @param {string} gate - Gate name to check
|
|
22
|
+
* @returns {Object} Waiver check result
|
|
23
|
+
*/
|
|
24
|
+
export function checkWaiver(gate: string): any;
|
|
25
|
+
/**
|
|
26
|
+
* Detect if project is in crisis response mode
|
|
27
|
+
* @returns {boolean} True if in crisis mode
|
|
28
|
+
*/
|
|
29
|
+
export function detectCrisisMode(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Run comprehensive quality gates on staged files
|
|
32
|
+
* @param {Object} options - Options for quality gates
|
|
33
|
+
* @returns {Object} Quality gate results
|
|
34
|
+
*/
|
|
35
|
+
export function runQualityGates(options?: any): any;
|
|
36
|
+
export namespace CONFIG {
|
|
37
|
+
namespace godObjectThresholds {
|
|
38
|
+
let warning: number;
|
|
39
|
+
let critical: number;
|
|
40
|
+
}
|
|
41
|
+
let todoConfidenceThreshold: number;
|
|
42
|
+
let supportedExtensions: string[];
|
|
43
|
+
namespace crisisResponseThresholds {
|
|
44
|
+
export let godObjectCritical: number;
|
|
45
|
+
let todoConfidenceThreshold_1: number;
|
|
46
|
+
export { todoConfidenceThreshold_1 as todoConfidenceThreshold };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=quality-gates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality-gates.d.ts","sourceRoot":"","sources":["../../src/utils/quality-gates.js"],"names":[],"mappings":"AAyGA;;;GAGG;AACH,kCAFa,MAAM,EAAE,CAcpB;AAED;;;;;GAKG;AACH,6CAJW,MAAM,EAAE,aACR,MAAM,OAqDhB;AAED;;;;GAIG;AACH,8CAHW,MAAM,EAAE,OA2ClB;AApMD;;;;GAIG;AACH,kCAHW,MAAM,OAiChB;AAED;;;GAGG;AACH,oCAFa,OAAO,CAkCnB;AA6HD;;;;GAIG;AACH,oDAqHC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve spec file path based on priority
|
|
3
|
+
* @param {Object} options - Resolution options
|
|
4
|
+
* @param {string} [options.specId] - Feature-specific spec ID (e.g., 'user-auth', 'FEAT-001')
|
|
5
|
+
* @param {string} [options.specFile] - Explicit file path override
|
|
6
|
+
* @param {boolean} [options.warnLegacy=true] - Warn when falling back to legacy spec
|
|
7
|
+
* @param {boolean} [options.interactive=false] - Use interactive spec selection for multiple specs
|
|
8
|
+
* @returns {Promise<{path: string, type: 'feature' | 'legacy', spec: Object}>}
|
|
9
|
+
*/
|
|
10
|
+
export function resolveSpec(options?: {
|
|
11
|
+
specId?: string;
|
|
12
|
+
specFile?: string;
|
|
13
|
+
warnLegacy?: boolean;
|
|
14
|
+
interactive?: boolean;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
path: string;
|
|
17
|
+
type: "feature" | "legacy";
|
|
18
|
+
spec: any;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* List all available specs
|
|
22
|
+
* @returns {Promise<Array<{id: string, path: string, type: string}>>}
|
|
23
|
+
*/
|
|
24
|
+
export function listAvailableSpecs(): Promise<Array<{
|
|
25
|
+
id: string;
|
|
26
|
+
path: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}>>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if project is using multi-spec architecture
|
|
31
|
+
* @returns {Promise<{isMultiSpec: boolean, specCount: number, needsMigration: boolean}>}
|
|
32
|
+
*/
|
|
33
|
+
export function checkMultiSpecStatus(): Promise<{
|
|
34
|
+
isMultiSpec: boolean;
|
|
35
|
+
specCount: number;
|
|
36
|
+
needsMigration: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Check for scope conflicts between specs
|
|
40
|
+
* @param {string[]} specIds - Array of spec IDs to check
|
|
41
|
+
* @returns {Promise<Array<{spec1: string, spec2: string, conflicts: string[]}>>} Array of conflicts
|
|
42
|
+
*/
|
|
43
|
+
export function checkScopeConflicts(specIds: string[]): Promise<Array<{
|
|
44
|
+
spec1: string;
|
|
45
|
+
spec2: string;
|
|
46
|
+
conflicts: string[];
|
|
47
|
+
}>>;
|
|
48
|
+
/**
|
|
49
|
+
* Suggest migration from legacy to multi-spec
|
|
50
|
+
* @returns {Promise<void>}
|
|
51
|
+
*/
|
|
52
|
+
export function suggestMigration(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Interactive spec selection using readline
|
|
55
|
+
* @param {string[]} specIds - Available spec IDs
|
|
56
|
+
* @returns {Promise<string>} Selected spec ID
|
|
57
|
+
*/
|
|
58
|
+
export function interactiveSpecSelection(specIds: string[]): Promise<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Load specs registry
|
|
61
|
+
* @returns {Promise<Object>} Registry data
|
|
62
|
+
*/
|
|
63
|
+
export function loadSpecsRegistry(): Promise<any>;
|
|
64
|
+
export function suggestFeatureBreakdown(legacySpec: any): {
|
|
65
|
+
id: string;
|
|
66
|
+
title: any;
|
|
67
|
+
criteria: any;
|
|
68
|
+
scope: {
|
|
69
|
+
in: string[];
|
|
70
|
+
out: any[];
|
|
71
|
+
};
|
|
72
|
+
}[];
|
|
73
|
+
/**
|
|
74
|
+
* Check if two paths overlap (simplified implementation)
|
|
75
|
+
* @param {string} path1 - First path
|
|
76
|
+
* @param {string} path2 - Second path
|
|
77
|
+
* @returns {boolean} True if paths overlap
|
|
78
|
+
*/
|
|
79
|
+
export function pathsOverlap(path1: string, path2: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Spec resolution priority:
|
|
82
|
+
* 1. .caws/specs/<spec-id>.yaml (feature-specific, multi-agent safe)
|
|
83
|
+
* 2. .caws/working-spec.yaml (legacy, single-agent only)
|
|
84
|
+
*/
|
|
85
|
+
export const SPECS_DIR: ".caws/specs";
|
|
86
|
+
export const LEGACY_SPEC: ".caws/working-spec.yaml";
|
|
87
|
+
export const SPECS_REGISTRY: ".caws/specs/registry.json";
|
|
88
|
+
//# sourceMappingURL=spec-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/spec-resolver.js"],"names":[],"mappings":"AAwBA;;;;;;;;GAQG;AACH,sCANG;IAAyB,MAAM,GAAvB,MAAM;IACW,QAAQ,GAAzB,MAAM;IACY,UAAU,GAA5B,OAAO;IACW,WAAW,GAA7B,OAAO;CACf,GAAU,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAAC,IAAI,MAAQ;CAAC,CAAC,CAwK7E;AA6BD;;;GAGG;AACH,sCAFa,OAAO,CAAC,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC,CAoDpE;AAgDD;;;GAGG;AACH,wCAFa,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAC,CAAC,CAavF;AAED;;;;GAIG;AACH,6CAHW,MAAM,EAAE,GACN,OAAO,CAAC,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC,CAAC,CA2D/E;AA+DD;;;GAGG;AACH,oCAFa,OAAO,CAAC,IAAI,CAAC,CAczB;AA5MD;;;;GAIG;AACH,kDAHW,MAAM,EAAE,GACN,OAAO,CAAC,MAAM,CAAC,CAyC3B;AA/HD;;;GAGG;AACH,qCAFa,OAAO,KAAQ,CAuB3B;AAyQD;;;;;;;;IA+FC;AA/KD;;;;;GAKG;AACH,oCAJW,MAAM,SACN,MAAM,GACJ,OAAO,CAuDnB;AAvcD;;;;GAIG;AACH,wBAAkB,aAAa,CAAC;AAChC,0BAAoB,yBAAyB,CAAC;AAC9C,6BAAuB,2BAA2B,CAAC"}
|