@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.
Files changed (149) hide show
  1. package/dist/budget-derivation.d.ts +74 -0
  2. package/dist/budget-derivation.d.ts.map +1 -0
  3. package/dist/cicd-optimizer.d.ts +142 -0
  4. package/dist/cicd-optimizer.d.ts.map +1 -0
  5. package/dist/commands/archive.d.ts +51 -0
  6. package/dist/commands/archive.d.ts.map +1 -0
  7. package/dist/commands/archive.js +114 -6
  8. package/dist/commands/burnup.d.ts +6 -0
  9. package/dist/commands/burnup.d.ts.map +1 -0
  10. package/dist/commands/burnup.js +109 -10
  11. package/dist/commands/diagnose.d.ts +52 -0
  12. package/dist/commands/diagnose.d.ts.map +1 -0
  13. package/dist/commands/diagnose.js +1 -1
  14. package/dist/commands/evaluate.d.ts +8 -0
  15. package/dist/commands/evaluate.d.ts.map +1 -0
  16. package/dist/commands/init.d.ts +5 -0
  17. package/dist/commands/init.d.ts.map +1 -0
  18. package/dist/commands/iterate.d.ts +8 -0
  19. package/dist/commands/iterate.d.ts.map +1 -0
  20. package/dist/commands/mode.d.ts +24 -0
  21. package/dist/commands/mode.d.ts.map +1 -0
  22. package/dist/commands/mode.js +24 -14
  23. package/dist/commands/plan.d.ts +49 -0
  24. package/dist/commands/plan.d.ts.map +1 -0
  25. package/dist/commands/provenance.d.ts +32 -0
  26. package/dist/commands/provenance.d.ts.map +1 -0
  27. package/dist/commands/provenance.js +216 -93
  28. package/dist/commands/quality-gates.d.ts +6 -0
  29. package/dist/commands/quality-gates.d.ts.map +1 -0
  30. package/dist/commands/quality-gates.js +82 -3
  31. package/dist/commands/quality-monitor.d.ts +17 -0
  32. package/dist/commands/quality-monitor.d.ts.map +1 -0
  33. package/dist/commands/specs.d.ts +71 -0
  34. package/dist/commands/specs.d.ts.map +1 -0
  35. package/dist/commands/specs.js +184 -6
  36. package/dist/commands/status.d.ts +44 -0
  37. package/dist/commands/status.d.ts.map +1 -0
  38. package/dist/commands/status.js +134 -10
  39. package/dist/commands/templates.d.ts +74 -0
  40. package/dist/commands/templates.d.ts.map +1 -0
  41. package/dist/commands/templates.js +2 -2
  42. package/dist/commands/tool.d.ts +13 -0
  43. package/dist/commands/tool.d.ts.map +1 -0
  44. package/dist/commands/troubleshoot.d.ts +8 -0
  45. package/dist/commands/troubleshoot.d.ts.map +1 -0
  46. package/dist/commands/tutorial.d.ts +55 -0
  47. package/dist/commands/tutorial.d.ts.map +1 -0
  48. package/dist/commands/validate.d.ts +15 -0
  49. package/dist/commands/validate.d.ts.map +1 -0
  50. package/dist/commands/waivers.d.ts +8 -0
  51. package/dist/commands/waivers.d.ts.map +1 -0
  52. package/dist/commands/workflow.d.ts +85 -0
  53. package/dist/commands/workflow.d.ts.map +1 -0
  54. package/dist/config/index.d.ts +29 -0
  55. package/dist/config/index.d.ts.map +1 -0
  56. package/dist/config/modes.d.ts +225 -0
  57. package/dist/config/modes.d.ts.map +1 -0
  58. package/dist/constants/spec-types.d.ts +41 -0
  59. package/dist/constants/spec-types.d.ts.map +1 -0
  60. package/dist/error-handler.d.ts +164 -0
  61. package/dist/error-handler.d.ts.map +1 -0
  62. package/dist/error-handler.js +6 -98
  63. package/dist/generators/jest-config-generator.js +242 -0
  64. package/dist/generators/jest-config.d.ts +32 -0
  65. package/dist/generators/jest-config.d.ts.map +1 -0
  66. package/dist/generators/working-spec.d.ts +13 -0
  67. package/dist/generators/working-spec.d.ts.map +1 -0
  68. package/dist/index-new.d.ts +5 -0
  69. package/dist/index-new.d.ts.map +1 -0
  70. package/dist/index-new.js +317 -0
  71. package/dist/index.d.ts +5 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +14 -7
  74. package/dist/index.js.backup +4711 -0
  75. package/dist/minimal-cli.d.ts +3 -0
  76. package/dist/minimal-cli.d.ts.map +1 -0
  77. package/dist/minimal-cli.js +3 -1
  78. package/dist/policy/PolicyManager.d.ts +104 -0
  79. package/dist/policy/PolicyManager.d.ts.map +1 -0
  80. package/dist/scaffold/claude-hooks.js +316 -0
  81. package/dist/scaffold/cursor-hooks.d.ts +7 -0
  82. package/dist/scaffold/cursor-hooks.d.ts.map +1 -0
  83. package/dist/scaffold/git-hooks.d.ts +38 -0
  84. package/dist/scaffold/git-hooks.d.ts.map +1 -0
  85. package/dist/scaffold/index.d.ts +15 -0
  86. package/dist/scaffold/index.d.ts.map +1 -0
  87. package/dist/scaffold/index.js +18 -0
  88. package/dist/spec/SpecFileManager.d.ts +146 -0
  89. package/dist/spec/SpecFileManager.d.ts.map +1 -0
  90. package/dist/templates/.claude/README.md +190 -0
  91. package/dist/templates/.claude/hooks/audit.sh +96 -0
  92. package/dist/templates/.claude/hooks/block-dangerous.sh +90 -0
  93. package/dist/templates/.claude/hooks/naming-check.sh +97 -0
  94. package/dist/templates/.claude/hooks/quality-check.sh +68 -0
  95. package/dist/templates/.claude/hooks/scan-secrets.sh +85 -0
  96. package/dist/templates/.claude/hooks/scope-guard.sh +105 -0
  97. package/dist/templates/.claude/hooks/validate-spec.sh +76 -0
  98. package/dist/templates/.claude/settings.json +95 -0
  99. package/dist/test-analysis.d.ts +182 -0
  100. package/dist/test-analysis.d.ts.map +1 -0
  101. package/dist/test-analysis.js +203 -10
  102. package/dist/tool-interface.d.ts +236 -0
  103. package/dist/tool-interface.d.ts.map +1 -0
  104. package/dist/tool-loader.d.ts +77 -0
  105. package/dist/tool-loader.d.ts.map +1 -0
  106. package/dist/tool-validator.d.ts +72 -0
  107. package/dist/tool-validator.d.ts.map +1 -0
  108. package/dist/utils/async-utils.d.ts +73 -0
  109. package/dist/utils/async-utils.d.ts.map +1 -0
  110. package/dist/utils/command-wrapper.d.ts +66 -0
  111. package/dist/utils/command-wrapper.d.ts.map +1 -0
  112. package/dist/utils/detection.d.ts +14 -0
  113. package/dist/utils/detection.d.ts.map +1 -0
  114. package/dist/utils/error-categories.js +210 -0
  115. package/dist/utils/finalization.d.ts +17 -0
  116. package/dist/utils/finalization.d.ts.map +1 -0
  117. package/dist/utils/git-lock.d.ts +13 -0
  118. package/dist/utils/git-lock.d.ts.map +1 -0
  119. package/dist/utils/gitignore-updater.d.ts +39 -0
  120. package/dist/utils/gitignore-updater.d.ts.map +1 -0
  121. package/dist/utils/project-analysis.d.ts +34 -0
  122. package/dist/utils/project-analysis.d.ts.map +1 -0
  123. package/dist/utils/promise-utils.d.ts +30 -0
  124. package/dist/utils/promise-utils.d.ts.map +1 -0
  125. package/dist/utils/quality-gates-utils.js +402 -0
  126. package/dist/utils/quality-gates.d.ts +49 -0
  127. package/dist/utils/quality-gates.d.ts.map +1 -0
  128. package/dist/utils/spec-resolver.d.ts +80 -0
  129. package/dist/utils/spec-resolver.d.ts.map +1 -0
  130. package/dist/utils/typescript-detector.d.ts +63 -0
  131. package/dist/utils/typescript-detector.d.ts.map +1 -0
  132. package/dist/utils/typescript-detector.js +36 -90
  133. package/dist/utils/yaml-validation.d.ts +32 -0
  134. package/dist/utils/yaml-validation.d.ts.map +1 -0
  135. package/dist/validation/spec-validation.d.ts +43 -0
  136. package/dist/validation/spec-validation.d.ts.map +1 -0
  137. package/dist/validation/spec-validation.js +59 -6
  138. package/dist/waivers-manager.d.ts +167 -0
  139. package/dist/waivers-manager.d.ts.map +1 -0
  140. package/package.json +5 -3
  141. package/templates/.claude/README.md +190 -0
  142. package/templates/.claude/hooks/audit.sh +96 -0
  143. package/templates/.claude/hooks/block-dangerous.sh +90 -0
  144. package/templates/.claude/hooks/naming-check.sh +97 -0
  145. package/templates/.claude/hooks/quality-check.sh +68 -0
  146. package/templates/.claude/hooks/scan-secrets.sh +85 -0
  147. package/templates/.claude/hooks/scope-guard.sh +105 -0
  148. package/templates/.claude/hooks/validate-spec.sh +76 -0
  149. package/templates/.claude/settings.json +95 -0
@@ -0,0 +1,85 @@
1
+ #!/bin/bash
2
+ # CAWS Secret Scanner for Claude Code
3
+ # Warns when reading files that may contain secrets
4
+ # @author @darianrosebrook
5
+
6
+ set -euo pipefail
7
+
8
+ # Read JSON input from Claude Code
9
+ INPUT=$(cat)
10
+
11
+ # Extract file path
12
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
13
+
14
+ if [[ -z "$FILE_PATH" ]]; then
15
+ exit 0
16
+ fi
17
+
18
+ # Get just the filename for pattern matching
19
+ FILENAME=$(basename "$FILE_PATH")
20
+
21
+ # Files that commonly contain secrets
22
+ SECRET_FILE_PATTERNS=(
23
+ '.env'
24
+ '.env.local'
25
+ '.env.production'
26
+ '.env.development'
27
+ '.env.*'
28
+ 'credentials.json'
29
+ 'service-account.json'
30
+ 'secrets.yaml'
31
+ 'secrets.yml'
32
+ 'secrets.json'
33
+ '.netrc'
34
+ '.npmrc'
35
+ '.pypirc'
36
+ 'id_rsa'
37
+ 'id_ed25519'
38
+ 'id_ecdsa'
39
+ '*.pem'
40
+ '*.key'
41
+ '*.p12'
42
+ '*.pfx'
43
+ 'htpasswd'
44
+ 'shadow'
45
+ )
46
+
47
+ # Directories that commonly contain secrets
48
+ SECRET_DIRS=(
49
+ '.ssh'
50
+ '.aws'
51
+ '.azure'
52
+ '.gcloud'
53
+ '.kube'
54
+ '.gnupg'
55
+ )
56
+
57
+ # Check if file matches secret patterns
58
+ for pattern in "${SECRET_FILE_PATTERNS[@]}"; do
59
+ if [[ "$FILENAME" == $pattern ]]; then
60
+ # Output JSON with warning for Claude
61
+ echo '{
62
+ "hookSpecificOutput": {
63
+ "hookEventName": "PreToolUse",
64
+ "additionalContext": "WARNING: This file may contain secrets. Do not include sensitive values in your response. If you need to reference credentials, use placeholders like <API_KEY> instead of actual values."
65
+ }
66
+ }'
67
+ exit 0
68
+ fi
69
+ done
70
+
71
+ # Check if file is in a sensitive directory
72
+ for dir in "${SECRET_DIRS[@]}"; do
73
+ if [[ "$FILE_PATH" == *"/$dir/"* ]] || [[ "$FILE_PATH" == *"/$dir" ]]; then
74
+ echo '{
75
+ "hookSpecificOutput": {
76
+ "hookEventName": "PreToolUse",
77
+ "additionalContext": "WARNING: This file is in a sensitive directory that may contain secrets. Do not include any sensitive values in your response."
78
+ }
79
+ }'
80
+ exit 0
81
+ fi
82
+ done
83
+
84
+ # Allow the read
85
+ exit 0
@@ -0,0 +1,105 @@
1
+ #!/bin/bash
2
+ # CAWS Scope Guard Hook for Claude Code
3
+ # Validates file edits against the working spec's scope boundaries
4
+ # @author @darianrosebrook
5
+
6
+ set -euo pipefail
7
+
8
+ # Read JSON input from Claude Code
9
+ INPUT=$(cat)
10
+
11
+ # Extract file path from PreToolUse input
12
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
13
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // ""')
14
+
15
+ # Only check Write/Edit operations
16
+ if [[ "$TOOL_NAME" != "Write" ]] && [[ "$TOOL_NAME" != "Edit" ]]; then
17
+ exit 0
18
+ fi
19
+
20
+ if [[ -z "$FILE_PATH" ]]; then
21
+ exit 0
22
+ fi
23
+
24
+ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
25
+ SPEC_FILE="$PROJECT_DIR/.caws/working-spec.yaml"
26
+
27
+ # Check if spec file exists
28
+ if [[ ! -f "$SPEC_FILE" ]]; then
29
+ exit 0
30
+ fi
31
+
32
+ # Get relative path from project root
33
+ REL_PATH=$(realpath --relative-to="$PROJECT_DIR" "$FILE_PATH" 2>/dev/null || echo "$FILE_PATH")
34
+
35
+ # Use Node.js to parse YAML and check scope
36
+ if command -v node >/dev/null 2>&1; then
37
+ SCOPE_CHECK=$(node -e "
38
+ const yaml = require('js-yaml');
39
+ const fs = require('fs');
40
+ const path = require('path');
41
+
42
+ try {
43
+ const spec = yaml.load(fs.readFileSync('$SPEC_FILE', 'utf8'));
44
+ const filePath = '$REL_PATH';
45
+
46
+ // Check if file is explicitly out of scope
47
+ const outOfScope = spec.scope?.out_of_scope || [];
48
+ for (const pattern of outOfScope) {
49
+ // Simple glob-like matching
50
+ const regex = new RegExp(pattern.replace(/\*/g, '.*').replace(/\?/g, '.'));
51
+ if (regex.test(filePath)) {
52
+ console.log('out_of_scope:' + pattern);
53
+ process.exit(0);
54
+ }
55
+ }
56
+
57
+ // Check if file is in scope (if scope is explicitly defined)
58
+ const inScope = spec.scope?.files || spec.scope?.directories || [];
59
+ if (inScope.length > 0) {
60
+ let found = false;
61
+ for (const pattern of inScope) {
62
+ const regex = new RegExp(pattern.replace(/\*/g, '.*').replace(/\?/g, '.'));
63
+ if (regex.test(filePath)) {
64
+ found = true;
65
+ break;
66
+ }
67
+ }
68
+ if (!found) {
69
+ console.log('not_in_scope');
70
+ process.exit(0);
71
+ }
72
+ }
73
+
74
+ console.log('in_scope');
75
+ } catch (error) {
76
+ console.log('error:' + error.message);
77
+ }
78
+ " 2>&1)
79
+
80
+ if [[ "$SCOPE_CHECK" == out_of_scope:* ]]; then
81
+ PATTERN="${SCOPE_CHECK#out_of_scope:}"
82
+ echo '{
83
+ "hookSpecificOutput": {
84
+ "hookEventName": "PreToolUse",
85
+ "permissionDecision": "ask",
86
+ "permissionDecisionReason": "This file ('"$REL_PATH"') is marked as out-of-scope in the working spec (pattern: '"$PATTERN"'). Editing it may cause scope creep. Please confirm this edit is intentional."
87
+ }
88
+ }'
89
+ exit 0
90
+ fi
91
+
92
+ if [[ "$SCOPE_CHECK" == "not_in_scope" ]]; then
93
+ echo '{
94
+ "hookSpecificOutput": {
95
+ "hookEventName": "PreToolUse",
96
+ "permissionDecision": "ask",
97
+ "permissionDecisionReason": "This file ('"$REL_PATH"') is not in the defined scope of the working spec. Editing it may cause scope creep. Please confirm this edit is intentional."
98
+ }
99
+ }'
100
+ exit 0
101
+ fi
102
+ fi
103
+
104
+ # File is in scope or scope couldn't be checked - allow
105
+ exit 0
@@ -0,0 +1,76 @@
1
+ #!/bin/bash
2
+ # CAWS Spec Validation Hook for Claude Code
3
+ # Validates working-spec.yaml when it's edited
4
+ # @author @darianrosebrook
5
+
6
+ set -euo pipefail
7
+
8
+ # Read JSON input from Claude Code
9
+ INPUT=$(cat)
10
+
11
+ # Extract file path from PostToolUse input
12
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
13
+
14
+ # Only validate CAWS YAML files
15
+ if [[ "$FILE_PATH" != *".caws/"* ]] || ([[ "$FILE_PATH" != *.yaml ]] && [[ "$FILE_PATH" != *.yml ]]); then
16
+ exit 0
17
+ fi
18
+
19
+ PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
20
+
21
+ # First, validate YAML syntax using Node.js if available
22
+ if command -v node >/dev/null 2>&1; then
23
+ YAML_CHECK=$(node -e "
24
+ try {
25
+ const yaml = require('js-yaml');
26
+ const fs = require('fs');
27
+ const content = fs.readFileSync('$FILE_PATH', 'utf8');
28
+ yaml.load(content);
29
+ console.log('valid');
30
+ } catch (error) {
31
+ console.error(error.message);
32
+ if (error.mark) {
33
+ console.error('Line: ' + (error.mark.line + 1) + ', Column: ' + (error.mark.column + 1));
34
+ }
35
+ process.exit(1);
36
+ }
37
+ " 2>&1)
38
+
39
+ if [ $? -ne 0 ]; then
40
+ echo '{
41
+ "decision": "block",
42
+ "reason": "YAML syntax error in spec file:\n'"$YAML_CHECK"'\n\nPlease fix the syntax before continuing. Common issues:\n- Check indentation (YAML uses 2 spaces)\n- Ensure arrays use consistent format\n- Remove duplicate keys"
43
+ }'
44
+ exit 0
45
+ fi
46
+ fi
47
+
48
+ # Run CAWS CLI validation if available
49
+ if command -v caws &> /dev/null; then
50
+ if VALIDATION=$(caws validate "$FILE_PATH" --quiet 2>&1); then
51
+ echo '{
52
+ "hookSpecificOutput": {
53
+ "hookEventName": "PostToolUse",
54
+ "additionalContext": "Spec validation passed. The specification is valid and complete."
55
+ }
56
+ }'
57
+ else
58
+ # Get suggestions
59
+ SUGGESTIONS=$(caws validate "$FILE_PATH" --suggestions 2>/dev/null | head -5 | tr '\n' ' ' || echo "Run 'caws validate --suggestions' for details")
60
+
61
+ echo '{
62
+ "decision": "block",
63
+ "reason": "Spec validation failed:\n'"$VALIDATION"'\n\nSuggestions:\n'"$SUGGESTIONS"'"
64
+ }'
65
+ fi
66
+ else
67
+ # Basic validation without CAWS CLI
68
+ echo '{
69
+ "hookSpecificOutput": {
70
+ "hookEventName": "PostToolUse",
71
+ "additionalContext": "CAWS CLI not available for full spec validation. Install with: npm install -g @caws/cli"
72
+ }
73
+ }'
74
+ fi
75
+
76
+ exit 0
@@ -0,0 +1,95 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-dangerous.sh",
10
+ "timeout": 10
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "matcher": "Read",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/scan-secrets.sh",
20
+ "timeout": 10
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "matcher": "Write|Edit",
26
+ "hooks": [
27
+ {
28
+ "type": "command",
29
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/scope-guard.sh",
30
+ "timeout": 10
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "PostToolUse": [
36
+ {
37
+ "matcher": "Write|Edit",
38
+ "hooks": [
39
+ {
40
+ "type": "command",
41
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/quality-check.sh",
42
+ "timeout": 30
43
+ },
44
+ {
45
+ "type": "command",
46
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/validate-spec.sh",
47
+ "timeout": 15
48
+ },
49
+ {
50
+ "type": "command",
51
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/naming-check.sh",
52
+ "timeout": 10
53
+ },
54
+ {
55
+ "type": "command",
56
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/audit.sh tool-use",
57
+ "timeout": 5
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ "matcher": "Bash",
63
+ "hooks": [
64
+ {
65
+ "type": "command",
66
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/audit.sh tool-use",
67
+ "timeout": 5
68
+ }
69
+ ]
70
+ }
71
+ ],
72
+ "SessionStart": [
73
+ {
74
+ "hooks": [
75
+ {
76
+ "type": "command",
77
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/audit.sh session-start",
78
+ "timeout": 5
79
+ }
80
+ ]
81
+ }
82
+ ],
83
+ "Stop": [
84
+ {
85
+ "hooks": [
86
+ {
87
+ "type": "command",
88
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/audit.sh stop",
89
+ "timeout": 5
90
+ }
91
+ ]
92
+ }
93
+ ]
94
+ }
95
+ }
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Main Test Analysis CLI handler
3
+ */
4
+ export function testAnalysisCommand(subcommand: any, options?: any[]): Promise<void>;
5
+ /**
6
+ * Waiver Pattern Learning Engine
7
+ * Analyzes waiver history to find systematic patterns in budget overruns
8
+ */
9
+ export class WaiverPatternLearner {
10
+ constructor(projectRoot?: string);
11
+ projectRoot: string;
12
+ /**
13
+ * Analyze waiver patterns from historical data
14
+ */
15
+ analyzePatterns(): {
16
+ status: string;
17
+ patterns: {
18
+ total_waivers: number;
19
+ budget_overruns: {
20
+ average_overrun_files: number;
21
+ average_overrun_loc: number;
22
+ common_patterns: any[];
23
+ total_budget_waivers?: undefined;
24
+ } | {
25
+ total_budget_waivers: any;
26
+ average_overrun_files: number;
27
+ average_overrun_loc: number;
28
+ common_patterns: {
29
+ reason: string;
30
+ frequency: number;
31
+ avg_overrun_files: number;
32
+ avg_overrun_loc: number;
33
+ }[];
34
+ };
35
+ common_reasons: {
36
+ reason: string;
37
+ count: any;
38
+ frequency: number;
39
+ }[];
40
+ risk_factors: {
41
+ factor: string;
42
+ description: string;
43
+ risk_level: string;
44
+ }[];
45
+ generated_at: string;
46
+ };
47
+ message?: undefined;
48
+ } | {
49
+ status: string;
50
+ message: any;
51
+ patterns: {};
52
+ };
53
+ /**
54
+ * Load all waiver files from .caws/waivers/
55
+ */
56
+ loadWaivers(): any[];
57
+ /**
58
+ * Load historical working specs (mock implementation)
59
+ */
60
+ loadHistoricalSpecs(): any[];
61
+ /**
62
+ * Analyze budget overrun patterns
63
+ */
64
+ analyzeBudgetOverruns(waivers: any, specs: any): {
65
+ average_overrun_files: number;
66
+ average_overrun_loc: number;
67
+ common_patterns: any[];
68
+ total_budget_waivers?: undefined;
69
+ } | {
70
+ total_budget_waivers: any;
71
+ average_overrun_files: number;
72
+ average_overrun_loc: number;
73
+ common_patterns: {
74
+ reason: string;
75
+ frequency: number;
76
+ avg_overrun_files: number;
77
+ avg_overrun_loc: number;
78
+ }[];
79
+ };
80
+ /**
81
+ * Analyze most common waiver reasons
82
+ */
83
+ analyzeCommonReasons(waivers: any): {
84
+ reason: string;
85
+ count: any;
86
+ frequency: number;
87
+ }[];
88
+ /**
89
+ * Identify risk factors from waiver patterns
90
+ */
91
+ identifyRiskFactors(waivers: any, specs: any): {
92
+ factor: string;
93
+ description: string;
94
+ risk_level: string;
95
+ }[];
96
+ }
97
+ /**
98
+ * Project Similarity Matcher
99
+ * Finds historical projects similar to current work
100
+ */
101
+ export class ProjectSimilarityMatcher {
102
+ constructor(projectRoot?: string);
103
+ projectRoot: string;
104
+ /**
105
+ * Find projects similar to the current spec
106
+ */
107
+ findSimilarProjects(currentSpec: any): {
108
+ project: string;
109
+ similarity_score: number;
110
+ budget_accuracy: number;
111
+ waiver_count: number;
112
+ details: {
113
+ id: string;
114
+ title: string;
115
+ risk_tier: number;
116
+ mode: string;
117
+ tech_stack: string;
118
+ feature_type: string;
119
+ actual_budget: {
120
+ files: number;
121
+ loc: number;
122
+ };
123
+ allocated_budget: {
124
+ files: number;
125
+ loc: number;
126
+ };
127
+ waivers: string[];
128
+ };
129
+ }[];
130
+ /**
131
+ * Calculate similarity score between two specs/projects
132
+ */
133
+ calculateSimilarity(spec1: any, spec2: any): number;
134
+ }
135
+ /**
136
+ * Budget Predictor using statistical analysis
137
+ */
138
+ export class BudgetPredictor {
139
+ constructor(projectRoot?: string);
140
+ projectRoot: string;
141
+ patternLearner: WaiverPatternLearner;
142
+ similarityMatcher: ProjectSimilarityMatcher;
143
+ /**
144
+ * Assess budget for a working spec
145
+ */
146
+ assessBudget(spec: any): {
147
+ status: string;
148
+ assessment: {
149
+ similar_projects_analyzed: number;
150
+ recommended_budget: {
151
+ files: number;
152
+ loc: number;
153
+ };
154
+ baseline_budget: {
155
+ files: number;
156
+ loc: number;
157
+ };
158
+ buffer_applied: {
159
+ files_percent: number;
160
+ loc_percent: number;
161
+ };
162
+ rationale: string[];
163
+ risk_factors: any;
164
+ confidence: number;
165
+ };
166
+ message?: undefined;
167
+ recommendation?: undefined;
168
+ } | {
169
+ status: string;
170
+ message: any;
171
+ recommendation: {
172
+ use_default_tier: boolean;
173
+ confidence: number;
174
+ };
175
+ assessment?: undefined;
176
+ };
177
+ /**
178
+ * Generate human-readable rationale for the recommendation
179
+ */
180
+ generateRationale(spec: any, similarProjects: any, patterns: any): string[];
181
+ }
182
+ //# sourceMappingURL=test-analysis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-analysis.d.ts","sourceRoot":"","sources":["../src/test-analysis.js"],"names":[],"mappings":"AAiZA;;GAEG;AACH,qFAsBC;AAhaD;;;GAGG;AACH;IACE,kCAEC;IADC,oBAA8B;IAGhC;;OAEG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCC;IAED;;OAEG;IACH,qBAsBC;IAED;;OAEG;IACH,6BAIC;IAED;;OAEG;IACH;;;;;;;;;;;;;;;MA6CC;IAED;;OAEG;IACH;;;;QAaC;IAED;;OAEG;IACH;;;;QAeC;CACF;AAED;;;GAGG;AACH;IACE,kCAEC;IADC,oBAA8B;IAGhC;;OAEG;IACH;;;;;;;;;;;;;;;;;;;;;;QAkEC;IAED;;OAEG;IACH,oDA6BC;CACF;AAED;;GAEG;AACH;IACE,kCAIC;IAHC,oBAA8B;IAC9B,qCAA2D;IAC3D,4CAAkE;IAGpE;;OAEG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA8DC;IAED;;OAEG;IACH,4EAsBC;CACF"}