@paths.design/caws-cli 8.0.0 → 8.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/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 +51 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +114 -6
- package/dist/commands/burnup.d.ts +6 -0
- package/dist/commands/burnup.d.ts.map +1 -0
- package/dist/commands/burnup.js +109 -10
- package/dist/commands/diagnose.d.ts +52 -0
- package/dist/commands/diagnose.d.ts.map +1 -0
- package/dist/commands/diagnose.js +1 -1
- 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/mode.js +24 -14
- 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 +216 -93
- package/dist/commands/quality-gates.d.ts +6 -0
- package/dist/commands/quality-gates.d.ts.map +1 -0
- package/dist/commands/quality-gates.js +82 -3
- 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 +184 -6
- package/dist/commands/status.d.ts +44 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +134 -10
- package/dist/commands/templates.d.ts +74 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/templates.js +2 -2
- package/dist/commands/tool.d.ts +13 -0
- package/dist/commands/tool.d.ts.map +1 -0
- 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/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/error-handler.js +6 -98
- package/dist/generators/jest-config-generator.js +242 -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 +14 -7
- 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/minimal-cli.js +3 -1
- package/dist/policy/PolicyManager.d.ts +104 -0
- package/dist/policy/PolicyManager.d.ts.map +1 -0
- package/dist/scaffold/claude-hooks.js +316 -0
- 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 +38 -0
- package/dist/scaffold/git-hooks.d.ts.map +1 -0
- package/dist/scaffold/index.d.ts +15 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/index.js +18 -0
- package/dist/spec/SpecFileManager.d.ts +146 -0
- package/dist/spec/SpecFileManager.d.ts.map +1 -0
- package/dist/templates/.claude/README.md +190 -0
- package/dist/templates/.claude/hooks/audit.sh +96 -0
- package/dist/templates/.claude/hooks/block-dangerous.sh +90 -0
- package/dist/templates/.claude/hooks/naming-check.sh +97 -0
- package/dist/templates/.claude/hooks/quality-check.sh +68 -0
- package/dist/templates/.claude/hooks/scan-secrets.sh +85 -0
- package/dist/templates/.claude/hooks/scope-guard.sh +105 -0
- package/dist/templates/.claude/hooks/validate-spec.sh +76 -0
- package/dist/templates/.claude/settings.json +95 -0
- package/dist/test-analysis.d.ts +182 -0
- package/dist/test-analysis.d.ts.map +1 -0
- package/dist/test-analysis.js +203 -10
- 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.d.ts +73 -0
- package/dist/utils/async-utils.d.ts.map +1 -0
- package/dist/utils/command-wrapper.d.ts +66 -0
- package/dist/utils/command-wrapper.d.ts.map +1 -0
- package/dist/utils/detection.d.ts +14 -0
- package/dist/utils/detection.d.ts.map +1 -0
- package/dist/utils/error-categories.js +210 -0
- package/dist/utils/finalization.d.ts +17 -0
- package/dist/utils/finalization.d.ts.map +1 -0
- package/dist/utils/git-lock.d.ts +13 -0
- package/dist/utils/git-lock.d.ts.map +1 -0
- package/dist/utils/gitignore-updater.d.ts +39 -0
- package/dist/utils/gitignore-updater.d.ts.map +1 -0
- package/dist/utils/project-analysis.d.ts +34 -0
- package/dist/utils/project-analysis.d.ts.map +1 -0
- package/dist/utils/promise-utils.d.ts +30 -0
- package/dist/utils/promise-utils.d.ts.map +1 -0
- package/dist/utils/quality-gates-utils.js +402 -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 +80 -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/utils/typescript-detector.js +36 -90
- package/dist/utils/yaml-validation.d.ts +32 -0
- package/dist/utils/yaml-validation.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/validation/spec-validation.js +59 -6
- package/dist/waivers-manager.d.ts +167 -0
- package/dist/waivers-manager.d.ts.map +1 -0
- package/package.json +5 -3
- package/templates/.claude/README.md +190 -0
- package/templates/.claude/hooks/audit.sh +96 -0
- package/templates/.claude/hooks/block-dangerous.sh +90 -0
- package/templates/.claude/hooks/naming-check.sh +97 -0
- package/templates/.claude/hooks/quality-check.sh +68 -0
- package/templates/.claude/hooks/scan-secrets.sh +85 -0
- package/templates/.claude/hooks/scope-guard.sh +105 -0
- package/templates/.claude/hooks/validate-spec.sh +76 -0
- package/templates/.claude/settings.json +95 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Async Operation Utilities
|
|
3
|
+
* Provides consistent patterns for async operations, parallel execution, and resource cleanup
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Execute multiple async operations in parallel
|
|
8
|
+
* @param {Array<Promise>} promises - Array of promises to execute
|
|
9
|
+
* @param {Object} options - Options
|
|
10
|
+
* @param {boolean} [options.failFast=true] - Stop on first error
|
|
11
|
+
* @returns {Promise<Array>} Array of results
|
|
12
|
+
*/
|
|
13
|
+
export function parallel(promises: Array<Promise<any>>, options?: {
|
|
14
|
+
failFast?: boolean;
|
|
15
|
+
}): Promise<any[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Execute async operations sequentially
|
|
18
|
+
* @param {Array<Function>} operations - Array of async functions to execute
|
|
19
|
+
* @param {Object} options - Options
|
|
20
|
+
* @param {boolean} [options.stopOnError=true] - Stop on first error
|
|
21
|
+
* @returns {Promise<Array>} Array of results
|
|
22
|
+
*/
|
|
23
|
+
export function sequential(operations: Array<Function>, options?: {
|
|
24
|
+
stopOnError?: boolean;
|
|
25
|
+
}): Promise<any[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Retry an async operation with exponential backoff
|
|
28
|
+
* @param {Function} operation - Async function to retry
|
|
29
|
+
* @param {Object} options - Retry options
|
|
30
|
+
* @param {number} [options.maxRetries=3] - Maximum number of retries
|
|
31
|
+
* @param {number} [options.initialDelay=1000] - Initial delay in ms
|
|
32
|
+
* @param {number} [options.maxDelay=10000] - Maximum delay in ms
|
|
33
|
+
* @param {Function} [options.shouldRetry] - Function to determine if error should be retried
|
|
34
|
+
* @returns {Promise<any>} Operation result
|
|
35
|
+
*/
|
|
36
|
+
export function retry(operation: Function, options?: {
|
|
37
|
+
maxRetries?: number;
|
|
38
|
+
initialDelay?: number;
|
|
39
|
+
maxDelay?: number;
|
|
40
|
+
shouldRetry?: Function;
|
|
41
|
+
}): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Execute operation with timeout
|
|
44
|
+
* @param {Promise} promise - Promise to execute
|
|
45
|
+
* @param {number} timeoutMs - Timeout in milliseconds
|
|
46
|
+
* @param {string} [errorMessage] - Custom error message
|
|
47
|
+
* @returns {Promise<any>} Operation result
|
|
48
|
+
*/
|
|
49
|
+
export function withTimeout(promise: Promise<any>, timeoutMs: number, errorMessage?: string): Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* Execute operation with resource cleanup
|
|
52
|
+
* @param {Function} operation - Async operation to execute
|
|
53
|
+
* @param {Function} cleanup - Cleanup function (called in finally)
|
|
54
|
+
* @returns {Promise<any>} Operation result
|
|
55
|
+
*/
|
|
56
|
+
export function withCleanup(operation: Function, cleanup: Function): Promise<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Execute multiple operations and collect all errors
|
|
59
|
+
* @param {Array<Function>} operations - Array of async functions
|
|
60
|
+
* @returns {Promise<{successes: Array, errors: Array}>} Results and errors
|
|
61
|
+
*/
|
|
62
|
+
export function collectResults(operations: Array<Function>): Promise<{
|
|
63
|
+
successes: any[];
|
|
64
|
+
errors: any[];
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Execute operation with cancellation support
|
|
68
|
+
* @param {Function} operation - Async operation to execute
|
|
69
|
+
* @param {AbortSignal} signal - Abort signal for cancellation
|
|
70
|
+
* @returns {Promise<any>} Operation result
|
|
71
|
+
*/
|
|
72
|
+
export function withCancellation(operation: Function, signal: AbortSignal): Promise<any>;
|
|
73
|
+
//# sourceMappingURL=async-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-utils.d.ts","sourceRoot":"","sources":["../../src/utils/async-utils.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,mCALW,KAAK,cAAS,YAEtB;IAA0B,QAAQ,GAA1B,OAAO;CACf,GAAU,OAAO,OAAO,CAmB1B;AAED;;;;;;GAMG;AACH,uCALW,KAAK,UAAU,YAEvB;IAA0B,WAAW,GAA7B,OAAO;CACf,GAAU,OAAO,OAAO,CAmB1B;AAED;;;;;;;;;GASG;AACH,qDANG;IAAyB,UAAU,GAA3B,MAAM;IACW,YAAY,GAA7B,MAAM;IACW,QAAQ,GAAzB,MAAM;IACa,WAAW;CACtC,GAAU,OAAO,CAAC,GAAG,CAAC,CA+BxB;AAED;;;;;;GAMG;AACH,8DAJW,MAAM,iBACN,MAAM,GACJ,OAAO,CAAC,GAAG,CAAC,CAWxB;AAED;;;;;GAKG;AACH,qEAFa,OAAO,CAAC,GAAG,CAAC,CAQxB;AAED;;;;GAIG;AACH,2CAHW,KAAK,UAAU,GACb,OAAO,CAAC;IAAC,SAAS,QAAQ;IAAC,MAAM,QAAO;CAAC,CAAC,CAmBtD;AAED;;;;;GAKG;AACH,8DAHW,WAAW,GACT,OAAO,CAAC,GAAG,CAAC,CAgBxB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified command wrapper that provides:
|
|
3
|
+
* - Consistent error handling
|
|
4
|
+
* - Standardized output formatting
|
|
5
|
+
* - Execution timing
|
|
6
|
+
* - JSON output support
|
|
7
|
+
*
|
|
8
|
+
* @param {Function} commandFn - Async command function to execute
|
|
9
|
+
* @param {Object} options - Command options
|
|
10
|
+
* @param {string} options.commandName - Name of the command (for error context)
|
|
11
|
+
* @param {boolean} [options.includeTiming=true] - Include execution timing
|
|
12
|
+
* @param {boolean} [options.exitOnError=true] - Exit process on error
|
|
13
|
+
* @param {Object} [options.context={}] - Additional context for error handling
|
|
14
|
+
* @returns {Promise<any>} Command result
|
|
15
|
+
*/
|
|
16
|
+
export function commandWrapper(commandFn: Function, options?: {
|
|
17
|
+
commandName: string;
|
|
18
|
+
includeTiming?: boolean;
|
|
19
|
+
exitOnError?: boolean;
|
|
20
|
+
context?: any;
|
|
21
|
+
}): Promise<any>;
|
|
22
|
+
export namespace Output {
|
|
23
|
+
/**
|
|
24
|
+
* Output success message
|
|
25
|
+
* @param {string} message - Success message
|
|
26
|
+
* @param {Object} [data] - Additional data to output
|
|
27
|
+
*/
|
|
28
|
+
function success(message: string, data?: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* Output error message
|
|
31
|
+
* @param {string} message - Error message
|
|
32
|
+
* @param {string[]} [suggestions] - Recovery suggestions
|
|
33
|
+
*/
|
|
34
|
+
function error(message: string, suggestions?: string[]): void;
|
|
35
|
+
/**
|
|
36
|
+
* Output warning message
|
|
37
|
+
* @param {string} message - Warning message
|
|
38
|
+
* @param {string} [suggestion] - Optional suggestion
|
|
39
|
+
*/
|
|
40
|
+
function warning(message: string, suggestion?: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Output info message
|
|
43
|
+
* @param {string} message - Info message
|
|
44
|
+
* @param {Object} [data] - Additional data
|
|
45
|
+
*/
|
|
46
|
+
function info(message: string, data?: any): void;
|
|
47
|
+
/**
|
|
48
|
+
* Output data in JSON format
|
|
49
|
+
* @param {Object} data - Data to output
|
|
50
|
+
* @param {boolean} [success=true] - Whether operation was successful
|
|
51
|
+
*/
|
|
52
|
+
function json(data: any, success?: boolean): void;
|
|
53
|
+
/**
|
|
54
|
+
* Output progress message
|
|
55
|
+
* @param {string} message - Progress message
|
|
56
|
+
*/
|
|
57
|
+
function progress(message: string): void;
|
|
58
|
+
/**
|
|
59
|
+
* Output section header
|
|
60
|
+
* @param {string} title - Section title
|
|
61
|
+
*/
|
|
62
|
+
function section(title: string): void;
|
|
63
|
+
}
|
|
64
|
+
import { isJsonOutput } from "../error-handler";
|
|
65
|
+
export { isJsonOutput };
|
|
66
|
+
//# sourceMappingURL=command-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/command-wrapper.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;GAcG;AACH,8DANG;IAAwB,WAAW,EAA3B,MAAM;IACY,aAAa,GAA/B,OAAO;IACW,WAAW,GAA7B,OAAO;IACU,OAAO;CAChC,GAAU,OAAO,CAAC,GAAG,CAAC,CAuCxB;;IAMC;;;;OAIG;IACH,0BAHW,MAAM,oBAmBhB;IAED;;;;OAIG;IACH,wBAHW,MAAM,gBACN,MAAM,EAAE,QAuBlB;IAED;;;;OAIG;IACH,0BAHW,MAAM,eACN,MAAM,QAkBhB;IAED;;;;OAIG;IACH,uBAHW,MAAM,oBAmBhB;IAED;;;;OAIG;IACH,mCAFW,OAAO,QAIjB;IAED;;;OAGG;IACH,2BAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,wBAFW,MAAM,QAOhB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect CAWS setup in a directory
|
|
3
|
+
* @param {string} cwd - Current working directory
|
|
4
|
+
* @returns {Object} Setup information
|
|
5
|
+
*/
|
|
6
|
+
export function detectCAWSSetup(cwd?: string): any;
|
|
7
|
+
/**
|
|
8
|
+
* Find the package root directory by looking for package.json
|
|
9
|
+
* Works in both development (src/) and production (dist/) scenarios
|
|
10
|
+
* @param {string} startDir - Directory to start searching from (defaults to __dirname)
|
|
11
|
+
* @returns {string} Package root directory path
|
|
12
|
+
*/
|
|
13
|
+
export function findPackageRoot(startDir?: string): string;
|
|
14
|
+
//# sourceMappingURL=detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/utils/detection.js"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH,sCAHW,MAAM,OAqKhB;AA1LD;;;;;GAKG;AACH,2CAHW,MAAM,GACJ,MAAM,CAalB"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Centralized Error Categories
|
|
3
|
+
* Shared error categorization for consistent error handling across CAWS packages
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Error categories for better user experience
|
|
9
|
+
*/
|
|
10
|
+
const ERROR_CATEGORIES = {
|
|
11
|
+
VALIDATION: 'validation',
|
|
12
|
+
PERMISSION: 'permission',
|
|
13
|
+
FILESYSTEM: 'filesystem',
|
|
14
|
+
NETWORK: 'network',
|
|
15
|
+
CONFIGURATION: 'configuration',
|
|
16
|
+
USER_INPUT: 'user_input',
|
|
17
|
+
DEPENDENCY: 'dependency',
|
|
18
|
+
UNKNOWN: 'unknown',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Error code mappings for common system errors
|
|
23
|
+
*/
|
|
24
|
+
const ERROR_CODES = {
|
|
25
|
+
EACCES: ERROR_CATEGORIES.PERMISSION,
|
|
26
|
+
EPERM: ERROR_CATEGORIES.PERMISSION,
|
|
27
|
+
ENOENT: ERROR_CATEGORIES.FILESYSTEM,
|
|
28
|
+
ENOTFOUND: ERROR_CATEGORIES.NETWORK,
|
|
29
|
+
ECONNREFUSED: ERROR_CATEGORIES.NETWORK,
|
|
30
|
+
ETIMEDOUT: ERROR_CATEGORIES.NETWORK,
|
|
31
|
+
ENOSPC: ERROR_CATEGORIES.FILESYSTEM,
|
|
32
|
+
EEXIST: ERROR_CATEGORIES.FILESYSTEM,
|
|
33
|
+
EISDIR: ERROR_CATEGORIES.FILESYSTEM,
|
|
34
|
+
ENOTDIR: ERROR_CATEGORIES.FILESYSTEM,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get error category from error object or message
|
|
39
|
+
* @param {Error|string} error - Error object or message
|
|
40
|
+
* @returns {string} Error category
|
|
41
|
+
*/
|
|
42
|
+
function getErrorCategory(error) {
|
|
43
|
+
const errorMessage = typeof error === 'string' ? error : (error?.message || '');
|
|
44
|
+
const errorCode = typeof error === 'object' && error?.code ? error.code : null;
|
|
45
|
+
|
|
46
|
+
// Check error codes first
|
|
47
|
+
if (errorCode && ERROR_CODES[errorCode]) {
|
|
48
|
+
return ERROR_CODES[errorCode];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Check message patterns
|
|
52
|
+
const lowerMessage = errorMessage.toLowerCase();
|
|
53
|
+
|
|
54
|
+
if (
|
|
55
|
+
lowerMessage.includes('validation') ||
|
|
56
|
+
lowerMessage.includes('invalid') ||
|
|
57
|
+
lowerMessage.includes('required') ||
|
|
58
|
+
lowerMessage.includes('malformed') ||
|
|
59
|
+
lowerMessage.includes('syntax')
|
|
60
|
+
) {
|
|
61
|
+
return ERROR_CATEGORIES.VALIDATION;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (
|
|
65
|
+
lowerMessage.includes('permission') ||
|
|
66
|
+
lowerMessage.includes('access') ||
|
|
67
|
+
lowerMessage.includes('denied') ||
|
|
68
|
+
lowerMessage.includes('forbidden')
|
|
69
|
+
) {
|
|
70
|
+
return ERROR_CATEGORIES.PERMISSION;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (
|
|
74
|
+
lowerMessage.includes('file') ||
|
|
75
|
+
lowerMessage.includes('directory') ||
|
|
76
|
+
lowerMessage.includes('path') ||
|
|
77
|
+
lowerMessage.includes('not found') ||
|
|
78
|
+
lowerMessage.includes('does not exist') ||
|
|
79
|
+
lowerMessage.includes('enoent')
|
|
80
|
+
) {
|
|
81
|
+
return ERROR_CATEGORIES.FILESYSTEM;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (
|
|
85
|
+
lowerMessage.includes('network') ||
|
|
86
|
+
lowerMessage.includes('connection') ||
|
|
87
|
+
lowerMessage.includes('timeout')
|
|
88
|
+
) {
|
|
89
|
+
return ERROR_CATEGORIES.NETWORK;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (
|
|
93
|
+
lowerMessage.includes('config') ||
|
|
94
|
+
lowerMessage.includes('setting') ||
|
|
95
|
+
lowerMessage.includes('option') ||
|
|
96
|
+
lowerMessage.includes('missing') ||
|
|
97
|
+
lowerMessage.includes('empty')
|
|
98
|
+
) {
|
|
99
|
+
return ERROR_CATEGORIES.CONFIGURATION;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (
|
|
103
|
+
lowerMessage.includes('input') ||
|
|
104
|
+
lowerMessage.includes('prompt') ||
|
|
105
|
+
lowerMessage.includes('answer')
|
|
106
|
+
) {
|
|
107
|
+
return ERROR_CATEGORIES.USER_INPUT;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (
|
|
111
|
+
lowerMessage.includes('dependency') ||
|
|
112
|
+
lowerMessage.includes('module not found')
|
|
113
|
+
) {
|
|
114
|
+
return ERROR_CATEGORIES.DEPENDENCY;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return ERROR_CATEGORIES.UNKNOWN;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get user-friendly error message based on category
|
|
122
|
+
* @param {string} category - Error category
|
|
123
|
+
* @param {string} originalMessage - Original error message
|
|
124
|
+
* @returns {string} User-friendly message
|
|
125
|
+
*/
|
|
126
|
+
function getFriendlyMessage(category, originalMessage) {
|
|
127
|
+
const messages = {
|
|
128
|
+
[ERROR_CATEGORIES.PERMISSION]:
|
|
129
|
+
'Permission denied. Check file permissions or run with elevated privileges.',
|
|
130
|
+
[ERROR_CATEGORIES.FILESYSTEM]:
|
|
131
|
+
'File system error. Check if the file/directory exists and is accessible.',
|
|
132
|
+
[ERROR_CATEGORIES.NETWORK]: 'Network error. Check your connection and try again.',
|
|
133
|
+
[ERROR_CATEGORIES.VALIDATION]:
|
|
134
|
+
'Data validation failed. Check your input format and requirements.',
|
|
135
|
+
[ERROR_CATEGORIES.CONFIGURATION]:
|
|
136
|
+
'Configuration error. Check your settings and required fields.',
|
|
137
|
+
[ERROR_CATEGORIES.USER_INPUT]: 'Invalid user input. Check the command syntax and parameters.',
|
|
138
|
+
[ERROR_CATEGORIES.DEPENDENCY]: 'Missing dependency. Install required packages.',
|
|
139
|
+
[ERROR_CATEGORIES.UNKNOWN]: 'An unexpected error occurred.',
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return messages[category] || originalMessage;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Get recovery suggestions based on error category
|
|
147
|
+
* @param {string} category - Error category
|
|
148
|
+
* @returns {Array<string>} Array of recovery suggestions
|
|
149
|
+
*/
|
|
150
|
+
function getCategorySuggestions(category) {
|
|
151
|
+
const suggestions = {
|
|
152
|
+
[ERROR_CATEGORIES.PERMISSION]: [
|
|
153
|
+
'Try running with sudo/admin privileges',
|
|
154
|
+
'Check file/directory permissions with chmod/chown',
|
|
155
|
+
'Verify user has write access to the target directory',
|
|
156
|
+
],
|
|
157
|
+
[ERROR_CATEGORIES.FILESYSTEM]: [
|
|
158
|
+
'Verify the file/directory path is correct',
|
|
159
|
+
'Check if the file is not corrupted',
|
|
160
|
+
'Ensure sufficient disk space is available',
|
|
161
|
+
'Check if the file is not being used by another process',
|
|
162
|
+
],
|
|
163
|
+
[ERROR_CATEGORIES.NETWORK]: [
|
|
164
|
+
'Check your internet connection',
|
|
165
|
+
'Verify network configuration and firewall settings',
|
|
166
|
+
'Try again in a few moments',
|
|
167
|
+
'Check if the remote service is available',
|
|
168
|
+
],
|
|
169
|
+
[ERROR_CATEGORIES.VALIDATION]: [
|
|
170
|
+
'Review the input format and requirements',
|
|
171
|
+
'Check for typos in file paths or values',
|
|
172
|
+
'Validate against the schema documentation',
|
|
173
|
+
'Use the --help flag to see correct syntax',
|
|
174
|
+
],
|
|
175
|
+
[ERROR_CATEGORIES.CONFIGURATION]: [
|
|
176
|
+
'Check that all required configuration files exist',
|
|
177
|
+
'Verify configuration values are in the correct format',
|
|
178
|
+
'Review the setup documentation',
|
|
179
|
+
'Ensure environment variables are set correctly',
|
|
180
|
+
],
|
|
181
|
+
[ERROR_CATEGORIES.USER_INPUT]: [
|
|
182
|
+
'Check the command syntax with --help',
|
|
183
|
+
'Verify all required arguments are provided',
|
|
184
|
+
'Ensure arguments are in the correct order',
|
|
185
|
+
'Check for typos in command names or options',
|
|
186
|
+
],
|
|
187
|
+
[ERROR_CATEGORIES.DEPENDENCY]: [
|
|
188
|
+
'Install missing dependencies with npm install',
|
|
189
|
+
'Check if all peer dependencies are installed',
|
|
190
|
+
'Verify Node.js version compatibility',
|
|
191
|
+
'Clear npm cache and try again',
|
|
192
|
+
],
|
|
193
|
+
[ERROR_CATEGORIES.UNKNOWN]: [
|
|
194
|
+
'Check the logs for more detailed information',
|
|
195
|
+
'Try restarting the process',
|
|
196
|
+
'Verify system resources (memory, disk space)',
|
|
197
|
+
'Report the issue with full error details',
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return suggestions[category] || suggestions[ERROR_CATEGORIES.UNKNOWN];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
module.exports = {
|
|
205
|
+
ERROR_CATEGORIES,
|
|
206
|
+
ERROR_CODES,
|
|
207
|
+
getErrorCategory,
|
|
208
|
+
getFriendlyMessage,
|
|
209
|
+
getCategorySuggestions,
|
|
210
|
+
};
|
|
@@ -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,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check for git lock files
|
|
3
|
+
* @param {string} projectRoot - Project root directory
|
|
4
|
+
* @returns {Object} Lock status information
|
|
5
|
+
*/
|
|
6
|
+
export function checkGitLock(projectRoot: string): any;
|
|
7
|
+
/**
|
|
8
|
+
* Format git lock error message
|
|
9
|
+
* @param {Object} lockStatus - Lock status from checkGitLock
|
|
10
|
+
* @returns {string} Formatted error message
|
|
11
|
+
*/
|
|
12
|
+
export function formatGitLockError(lockStatus: any): string;
|
|
13
|
+
//# sourceMappingURL=git-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-lock.d.ts","sourceRoot":"","sources":["../../src/utils/git-lock.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH,0CAHW,MAAM,OA+DhB;AAED;;;;GAIG;AACH,qDAFa,MAAM,CAgClB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update .gitignore to include CAWS runtime file exclusions
|
|
3
|
+
* @param {string} projectRoot - Project root directory
|
|
4
|
+
* @param {Object} options - Options
|
|
5
|
+
* @param {boolean} options.force - Force update even if entries exist
|
|
6
|
+
* @returns {Promise<boolean>} Whether .gitignore was updated
|
|
7
|
+
*/
|
|
8
|
+
export function updateGitignore(projectRoot: string, options?: {
|
|
9
|
+
force: boolean;
|
|
10
|
+
}): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Verify .gitignore has proper CAWS entries
|
|
13
|
+
* @param {string} projectRoot - Project root directory
|
|
14
|
+
* @returns {Promise<boolean>} Whether .gitignore has CAWS entries
|
|
15
|
+
*/
|
|
16
|
+
export function verifyGitignore(projectRoot: string): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* CAWS .gitignore entries
|
|
19
|
+
*
|
|
20
|
+
* Strategy: Track shared/collaborative files, ignore local-only runtime data
|
|
21
|
+
*
|
|
22
|
+
* TRACKED (shared with team):
|
|
23
|
+
* - .caws/working-spec.yaml (main spec)
|
|
24
|
+
* - .caws/specs/*.yaml (feature specs)
|
|
25
|
+
* - .caws/policy.yaml (team policy)
|
|
26
|
+
* - .caws/waivers/*.yaml (project-wide waivers)
|
|
27
|
+
* - .caws/provenance/ (audit trails for compliance)
|
|
28
|
+
* - .caws/changes/ (change tracking for team visibility)
|
|
29
|
+
* - .caws/archive/ (archived changes for history)
|
|
30
|
+
* - .caws/plans/*.md (implementation plans)
|
|
31
|
+
*
|
|
32
|
+
* IGNORED (local-only):
|
|
33
|
+
* - .agent/ (agent runtime tracking, local to each developer)
|
|
34
|
+
* - Temporary files (*.tmp, *.bak)
|
|
35
|
+
* - Logs (caws.log, debug logs)
|
|
36
|
+
* - Local overrides (caws.local.*)
|
|
37
|
+
*/
|
|
38
|
+
export const CAWS_GITIGNORE_ENTRIES: "\n# CAWS Local Runtime Data (developer-specific, should not be tracked)\n# ====================================================================\n# Note: Specs, policy, waivers, provenance, and plans ARE tracked for team collaboration\n# Only local agent tracking, generated tools, and temporary files are ignored\n\n# Agent runtime tracking (local to each developer)\n.agent/\n\n# CAWS tools (now in .caws/tools/)\n.caws/tools/\n# Legacy location (for backward compatibility)\napps/tools/caws/\n\n# Temporary CAWS files\n**/*.caws.tmp\n**/*.working-spec.bak\n.caws/*.tmp\n.caws/*.bak\n\n# CAWS logs (local debugging)\ncaws-debug.log*\n**/caws.log\n.caws/*.log\n\n# Local development overrides (developer-specific)\ncaws.local.*\n.caws/local.*\n";
|
|
39
|
+
//# sourceMappingURL=gitignore-updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore-updater.d.ts","sourceRoot":"","sources":["../../src/utils/gitignore-updater.js"],"names":[],"mappings":"AA6DA;;;;;;GAMG;AACH,6CALW,MAAM,YAEd;IAAyB,KAAK,EAAtB,OAAO;CACf,GAAU,OAAO,CAAC,OAAO,CAAC,CA2D5B;AAED;;;;GAIG;AACH,6CAHW,MAAM,GACJ,OAAO,CAAC,OAAO,CAAC,CAW5B;AAnID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,gxBA4BE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
/**
|
|
15
|
+
* Detect if project publishes packages to registries
|
|
16
|
+
* Checks for publishing configuration in package.json, pyproject.toml, etc.
|
|
17
|
+
* @param {string} cwd - Current working directory
|
|
18
|
+
* @returns {boolean} Whether project appears to publish packages
|
|
19
|
+
*/
|
|
20
|
+
export function detectsPublishing(cwd?: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Detect primary programming language(s) used in project
|
|
23
|
+
* @param {string} cwd - Current working directory
|
|
24
|
+
* @returns {Object} Language detection result with primary language and indicators
|
|
25
|
+
*/
|
|
26
|
+
export function detectProjectLanguage(cwd?: string): any;
|
|
27
|
+
/**
|
|
28
|
+
* Get language-agnostic suggestion for TODO analyzer installation
|
|
29
|
+
* Focuses on runtime availability (Node.js/npx) rather than project language
|
|
30
|
+
* @param {string} cwd - Current working directory
|
|
31
|
+
* @returns {string} Installation suggestion message
|
|
32
|
+
*/
|
|
33
|
+
export function getTodoAnalyzerSuggestion(cwd?: string): string;
|
|
34
|
+
//# 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;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,OAAO,CAsFnB;AAED;;;;GAIG;AACH,4CAHW,MAAM,OAiHhB;AAED;;;;;GAKG;AACH,gDAHW,MAAM,GACJ,MAAM,CA6ClB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Promise Utilities
|
|
3
|
+
* Utilities for converting callback-based APIs to promises
|
|
4
|
+
* @author @darianrosebrook
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Convert readline question to promise
|
|
8
|
+
* @param {readline.Interface} rl - Readline interface
|
|
9
|
+
* @param {string} question - Question to ask
|
|
10
|
+
* @returns {Promise<string>} User's answer
|
|
11
|
+
*/
|
|
12
|
+
export function question(rl: readline.Interface, questionText: any): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Close readline interface and return promise
|
|
15
|
+
* @param {readline.Interface} rl - Readline interface
|
|
16
|
+
* @returns {Promise<void>}
|
|
17
|
+
*/
|
|
18
|
+
export function closeReadline(rl: readline.Interface): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Create a promise that resolves when event fires
|
|
21
|
+
* @param {EventEmitter} emitter - Event emitter
|
|
22
|
+
* @param {string} event - Event name
|
|
23
|
+
* @param {Object} options - Options
|
|
24
|
+
* @param {number} [options.timeout] - Timeout in ms
|
|
25
|
+
* @returns {Promise<any>} Event data
|
|
26
|
+
*/
|
|
27
|
+
export function once(emitter: EventEmitter, event: string, options?: {
|
|
28
|
+
timeout?: number;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
//# sourceMappingURL=promise-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise-utils.d.ts","sourceRoot":"","sources":["../../src/utils/promise-utils.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,6BAJW,QAAQ,CAAC,SAAS,sBAEhB,OAAO,CAAC,MAAM,CAAC,CAQ3B;AAED;;;;GAIG;AACH,kCAHW,QAAQ,CAAC,SAAS,GAChB,OAAO,CAAC,IAAI,CAAC,CAOzB;AAED;;;;;;;GAOG;AACH,8BANW,YAAY,SACZ,MAAM,YAEd;IAAyB,OAAO,GAAxB,MAAM;CACd,GAAU,OAAO,CAAC,GAAG,CAAC,CAyBxB"}
|