@paths.design/caws-cli 3.1.0 → 3.2.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 (94) hide show
  1. package/README.md +295 -150
  2. package/dist/budget-derivation.d.ts +35 -0
  3. package/dist/budget-derivation.d.ts.map +1 -0
  4. package/dist/budget-derivation.js +204 -0
  5. package/dist/cicd-optimizer.d.ts +142 -0
  6. package/dist/cicd-optimizer.d.ts.map +1 -0
  7. package/dist/cicd-optimizer.js +504 -0
  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 +90 -0
  11. package/dist/commands/init.d.ts +5 -0
  12. package/dist/commands/init.d.ts.map +1 -0
  13. package/dist/commands/init.js +514 -0
  14. package/dist/commands/provenance.d.ts +32 -0
  15. package/dist/commands/provenance.d.ts.map +1 -0
  16. package/dist/commands/provenance.js +979 -0
  17. package/dist/commands/tool.d.ts +13 -0
  18. package/dist/commands/tool.d.ts.map +1 -0
  19. package/dist/commands/tool.js +138 -0
  20. package/dist/commands/validate.d.ts +7 -0
  21. package/dist/commands/validate.d.ts.map +1 -0
  22. package/dist/commands/validate.js +80 -0
  23. package/dist/config/index.d.ts +29 -0
  24. package/dist/config/index.d.ts.map +1 -0
  25. package/dist/config/index.js +132 -0
  26. package/dist/error-handler.d.ts +50 -0
  27. package/dist/error-handler.d.ts.map +1 -0
  28. package/dist/error-handler.js +253 -0
  29. package/dist/generators/working-spec.d.ts +13 -0
  30. package/dist/generators/working-spec.d.ts.map +1 -0
  31. package/dist/generators/working-spec.js +204 -0
  32. package/dist/index.d.ts +3 -12
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +193 -2983
  35. package/dist/scaffold/cursor-hooks.d.ts +7 -0
  36. package/dist/scaffold/cursor-hooks.d.ts.map +1 -0
  37. package/dist/scaffold/cursor-hooks.js +152 -0
  38. package/dist/scaffold/git-hooks.d.ts +20 -0
  39. package/dist/scaffold/git-hooks.d.ts.map +1 -0
  40. package/dist/scaffold/git-hooks.js +417 -0
  41. package/dist/scaffold/index.d.ts +20 -0
  42. package/dist/scaffold/index.d.ts.map +1 -0
  43. package/dist/scaffold/index.js +486 -0
  44. package/dist/test-analysis.d.ts +182 -0
  45. package/dist/test-analysis.d.ts.map +1 -0
  46. package/dist/test-analysis.js +580 -0
  47. package/dist/tool-interface.d.ts +236 -0
  48. package/dist/tool-interface.d.ts.map +1 -0
  49. package/dist/tool-interface.js +314 -0
  50. package/dist/tool-loader.d.ts +77 -0
  51. package/dist/tool-loader.d.ts.map +1 -0
  52. package/dist/tool-loader.js +298 -0
  53. package/dist/tool-validator.d.ts +72 -0
  54. package/dist/tool-validator.d.ts.map +1 -0
  55. package/dist/tool-validator.js +387 -0
  56. package/dist/utils/detection.d.ts +7 -0
  57. package/dist/utils/detection.d.ts.map +1 -0
  58. package/dist/utils/detection.js +174 -0
  59. package/dist/utils/finalization.d.ts +17 -0
  60. package/dist/utils/finalization.d.ts.map +1 -0
  61. package/dist/utils/finalization.js +229 -0
  62. package/dist/utils/project-analysis.d.ts +14 -0
  63. package/dist/utils/project-analysis.d.ts.map +1 -0
  64. package/dist/utils/project-analysis.js +105 -0
  65. package/dist/validation/spec-validation.d.ts +29 -0
  66. package/dist/validation/spec-validation.d.ts.map +1 -0
  67. package/dist/validation/spec-validation.js +376 -0
  68. package/dist/waivers-manager.d.ts +167 -0
  69. package/dist/waivers-manager.d.ts.map +1 -0
  70. package/dist/waivers-manager.js +549 -0
  71. package/package.json +10 -12
  72. package/templates/.cursor/README.md +311 -0
  73. package/templates/.cursor/hooks/audit.sh +55 -0
  74. package/templates/.cursor/hooks/block-dangerous.sh +77 -0
  75. package/templates/.cursor/hooks/caws-quality-check.sh +52 -0
  76. package/templates/.cursor/hooks/caws-scope-guard.sh +74 -0
  77. package/templates/.cursor/hooks/caws-tool-validation.sh +121 -0
  78. package/templates/.cursor/hooks/format.sh +38 -0
  79. package/templates/.cursor/hooks/naming-check.sh +64 -0
  80. package/templates/.cursor/hooks/scan-secrets.sh +46 -0
  81. package/templates/.cursor/hooks/scope-guard.sh +52 -0
  82. package/templates/.cursor/hooks/validate-spec.sh +38 -0
  83. package/templates/.cursor/hooks.json +59 -0
  84. package/templates/.github/copilot/instructions.md +311 -0
  85. package/templates/.idea/runConfigurations/CAWS_Evaluate.xml +5 -0
  86. package/templates/.idea/runConfigurations/CAWS_Validate.xml +5 -0
  87. package/templates/.vscode/launch.json +56 -0
  88. package/templates/.vscode/settings.json +93 -0
  89. package/templates/.windsurf/workflows/caws-guided-development.md +92 -0
  90. package/templates/apps/tools/caws/README.md +1 -1
  91. package/templates/apps/tools/caws/schemas/working-spec.schema.json +21 -3
  92. package/templates/codemod/test.js +93 -1
  93. package/templates/apps/tools/caws/prompt-lint.js.backup +0 -274
  94. package/templates/apps/tools/caws/provenance.js.backup +0 -73
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ # Cursor Hook: Auto-formatting
3
+ #
4
+ # Purpose: Run formatters after file edits
5
+ # Event: afterFileEdit
6
+ #
7
+ # @author @darianrosebrook
8
+
9
+ set -euo pipefail
10
+
11
+ # Read input from Cursor
12
+ INPUT=$(cat)
13
+
14
+ # Extract file path
15
+ FILE_PATH=$(echo "$INPUT" | jq -r '.file_path // ""')
16
+
17
+ # Only format source code files
18
+ if [[ "$FILE_PATH" =~ \.(js|ts|jsx|tsx|json|md|yml|yaml)$ ]]; then
19
+ # Try prettier if available
20
+ if command -v prettier &> /dev/null; then
21
+ prettier --write "$FILE_PATH" 2>/dev/null || true
22
+ elif [ -f "node_modules/.bin/prettier" ]; then
23
+ node_modules/.bin/prettier --write "$FILE_PATH" 2>/dev/null || true
24
+ fi
25
+
26
+ # Try eslint for JS/TS files
27
+ if [[ "$FILE_PATH" =~ \.(js|ts|jsx|tsx)$ ]]; then
28
+ if command -v eslint &> /dev/null; then
29
+ eslint --fix "$FILE_PATH" 2>/dev/null || true
30
+ elif [ -f "node_modules/.bin/eslint" ]; then
31
+ node_modules/.bin/eslint --fix "$FILE_PATH" 2>/dev/null || true
32
+ fi
33
+ fi
34
+ fi
35
+
36
+ # Always allow - formatting is non-blocking
37
+ exit 0
38
+
@@ -0,0 +1,64 @@
1
+ #!/bin/bash
2
+ # Cursor Hook: Naming Conventions
3
+ #
4
+ # Purpose: Enforce CAWS naming conventions (no enhanced-, -copy, etc.)
5
+ # Event: afterFileEdit
6
+ #
7
+ # @author @darianrosebrook
8
+
9
+ set -euo pipefail
10
+
11
+ # Read input from Cursor
12
+ INPUT=$(cat)
13
+
14
+ # Extract file path
15
+ FILE_PATH=$(echo "$INPUT" | jq -r '.file_path // ""')
16
+
17
+ # Get just the filename
18
+ FILENAME=$(basename "$FILE_PATH")
19
+
20
+ # Check for banned naming patterns
21
+ BANNED_PATTERNS=(
22
+ "enhanced-"
23
+ "-enhanced"
24
+ "unified-"
25
+ "-unified"
26
+ "better-"
27
+ "-better"
28
+ "new-"
29
+ "-new"
30
+ "next-"
31
+ "-next"
32
+ "final-"
33
+ "-final"
34
+ "-copy"
35
+ "copy-"
36
+ "-revamp"
37
+ "revamp-"
38
+ "-improved"
39
+ "improved-"
40
+ )
41
+
42
+ for pattern in "${BANNED_PATTERNS[@]}"; do
43
+ if [[ "$FILENAME" == *"$pattern"* ]]; then
44
+ # Extract the pattern for the message
45
+ echo '{"userMessage":"⚠️ Naming violation: File contains banned pattern '"'$pattern'"'. Use purpose-driven names instead.","agentMessage":"This file uses a generic naming pattern ('"$pattern"'). Please rename with a specific, purpose-driven name that describes what the file does."}' 2>/dev/null
46
+ exit 0
47
+ fi
48
+ done
49
+
50
+ # Check for duplicate module patterns (e.g., both processor.ts and enhanced-processor.ts)
51
+ if [[ "$FILENAME" =~ ^(enhanced|unified|better|new|next|final|improved)- ]]; then
52
+ BASE_NAME=$(echo "$FILENAME" | sed -E 's/^(enhanced|unified|better|new|next|final|improved)-//')
53
+ DIR_PATH=$(dirname "$FILE_PATH")
54
+
55
+ # Check if base file exists
56
+ if [ -f "$DIR_PATH/$BASE_NAME" ]; then
57
+ echo '{"userMessage":"⚠️ Duplicate module detected: Both '"$FILENAME"' and '"$BASE_NAME"' exist. Merge into canonical name.","agentMessage":"Found duplicate modules. Please merge '"$FILENAME"' into '"$BASE_NAME"' and remove the duplicate."}' 2>/dev/null
58
+ exit 0
59
+ fi
60
+ fi
61
+
62
+ # Allow by default
63
+ exit 0
64
+
@@ -0,0 +1,46 @@
1
+ #!/bin/bash
2
+ # Cursor Hook: Secret & PII Scanner
3
+ #
4
+ # Purpose: Prevent reading files with secrets or sensitive information
5
+ # Event: beforeReadFile
6
+ #
7
+ # @author @darianrosebrook
8
+
9
+ set -euo pipefail
10
+
11
+ # Read input from Cursor
12
+ INPUT=$(cat)
13
+
14
+ # Extract file path and content
15
+ FILE_PATH=$(echo "$INPUT" | jq -r '.file_path // ""')
16
+ CONTENT=$(echo "$INPUT" | jq -r '.content // ""')
17
+
18
+ # Block reading of environment files
19
+ if [[ "$FILE_PATH" =~ \.(env|env\.local|env\.development|env\.production|env\.test)$ ]]; then
20
+ echo '{"permission":"deny","userMessage":"⚠️ Blocked: Environment files contain secrets. Use placeholder values instead."}' 2>/dev/null
21
+ exit 0
22
+ fi
23
+
24
+ # Block reading of key files
25
+ if [[ "$FILE_PATH" =~ \.(pem|key|p12|pfx|cert|crt)$ ]]; then
26
+ echo '{"permission":"deny","userMessage":"⚠️ Blocked: Certificate/key files should not be read by AI."}' 2>/dev/null
27
+ exit 0
28
+ fi
29
+
30
+ # Scan content for common secret patterns
31
+ if echo "$CONTENT" | grep -qiE "(api[_-]?key|secret[_-]?key|password|private[_-]?key|access[_-]?token|bearer\s+[A-Za-z0-9_\-\.]+|AKIA[0-9A-Z]{16})"; then
32
+ # Don't block, but warn
33
+ echo '{"permission":"allow","userMessage":"⚠️ Warning: Potential secrets detected in file. Ensure they are not committed.","agentMessage":"This file may contain secrets. Use placeholder values or environment variables."}' 2>/dev/null
34
+ exit 0
35
+ fi
36
+
37
+ # Check for common PII patterns (SSN, credit card, etc.)
38
+ if echo "$CONTENT" | grep -qE "([0-9]{3}-[0-9]{2}-[0-9]{4}|[0-9]{4}[- ]?[0-9]{4}[- ]?[0-9]{4}[- ]?[0-9]{4})"; then
39
+ echo '{"permission":"allow","userMessage":"⚠️ Warning: Potential PII detected. Ensure compliance with data protection policies.","agentMessage":"This file may contain PII (SSN, credit card). Use anonymized test data."}' 2>/dev/null
40
+ exit 0
41
+ fi
42
+
43
+ # Allow by default
44
+ echo '{"permission":"allow"}' 2>/dev/null
45
+ exit 0
46
+
@@ -0,0 +1,52 @@
1
+ #!/bin/bash
2
+ # Cursor Hook: Scope Guard
3
+ #
4
+ # Purpose: Check if files being worked on are within working-spec scope
5
+ # Event: beforeSubmitPrompt
6
+ #
7
+ # @author @darianrosebrook
8
+
9
+ set -euo pipefail
10
+
11
+ # Read input from Cursor
12
+ INPUT=$(cat)
13
+
14
+ # Extract attachments
15
+ ATTACHMENTS=$(echo "$INPUT" | jq -r '.attachments // []')
16
+
17
+ # Only check if we have file attachments and a working spec
18
+ if [ ! -f ".caws/working-spec.yaml" ] && [ ! -f ".caws/working-spec.yml" ]; then
19
+ # No spec file, allow by default
20
+ echo '{"continue":true}' 2>/dev/null
21
+ exit 0
22
+ fi
23
+
24
+ # Check if scope-guard tool exists
25
+ if [ -f "apps/tools/caws/scope-guard.js" ]; then
26
+ # Extract file paths from attachments
27
+ FILE_PATHS=$(echo "$ATTACHMENTS" | jq -r '.[] | select(.type=="file") | .file_path' 2>/dev/null || echo "")
28
+
29
+ if [ -n "$FILE_PATHS" ]; then
30
+ # Check each file against scope
31
+ OUT_OF_SCOPE=()
32
+ while IFS= read -r file; do
33
+ if [ -n "$file" ]; then
34
+ if ! node apps/tools/caws/scope-guard.js check "$file" 2>/dev/null; then
35
+ OUT_OF_SCOPE+=("$file")
36
+ fi
37
+ fi
38
+ done <<< "$FILE_PATHS"
39
+
40
+ # If any files are out of scope, warn but don't block
41
+ if [ ${#OUT_OF_SCOPE[@]} -gt 0 ]; then
42
+ FILES_LIST=$(printf '%s\n' "${OUT_OF_SCOPE[@]}")
43
+ echo '{"continue":true,"userMessage":"⚠️ Warning: Some attached files may be outside working-spec scope:\n'"$FILES_LIST"'","agentMessage":"Some files are outside the defined scope in working-spec.yaml. Consider updating the scope or removing these files."}' 2>/dev/null
44
+ exit 0
45
+ fi
46
+ fi
47
+ fi
48
+
49
+ # Allow by default
50
+ echo '{"continue":true}' 2>/dev/null
51
+ exit 0
52
+
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ # Cursor Hook: CAWS Spec Validation
3
+ #
4
+ # Purpose: Validate working-spec.yaml when it's edited
5
+ # Event: afterFileEdit
6
+ #
7
+ # @author @darianrosebrook
8
+
9
+ set -euo pipefail
10
+
11
+ # Read input from Cursor
12
+ INPUT=$(cat)
13
+
14
+ # Extract file path from input
15
+ FILE_PATH=$(echo "$INPUT" | jq -r '.file_path // ""')
16
+
17
+ # Only validate if working-spec.yaml was edited
18
+ if [[ "$FILE_PATH" == *"working-spec.yaml"* ]] || [[ "$FILE_PATH" == *"working-spec.yml"* ]]; then
19
+ # Run CAWS validation
20
+ if [ -f "apps/tools/caws/validate.js" ]; then
21
+ if ! node apps/tools/caws/validate.js --quiet 2>/dev/null; then
22
+ echo '{"userMessage":"⚠️ CAWS spec validation failed. Run: caws validate --suggestions","agentMessage":"The working-spec.yaml file has validation errors. Please review and fix before continuing."}' 2>/dev/null
23
+ exit 0
24
+ fi
25
+ else
26
+ # Fallback: try caws CLI
27
+ if command -v caws &> /dev/null; then
28
+ if ! caws validate --quiet 2>/dev/null; then
29
+ echo '{"userMessage":"⚠️ CAWS spec validation failed. Run: caws validate --suggestions","agentMessage":"The working-spec.yaml file has validation errors."}' 2>/dev/null
30
+ exit 0
31
+ fi
32
+ fi
33
+ fi
34
+ fi
35
+
36
+ # Allow the edit
37
+ exit 0
38
+
@@ -0,0 +1,59 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "beforeShellExecution": [
5
+ {
6
+ "command": "./.cursor/hooks/block-dangerous.sh"
7
+ },
8
+ {
9
+ "command": "./.cursor/hooks/audit.sh"
10
+ }
11
+ ],
12
+ "beforeMCPExecution": [
13
+ {
14
+ "command": "./.cursor/hooks/audit.sh"
15
+ },
16
+ {
17
+ "command": "./.cursor/hooks/caws-tool-validation.sh"
18
+ }
19
+ ],
20
+ "beforeReadFile": [
21
+ {
22
+ "command": "./.cursor/hooks/scan-secrets.sh"
23
+ },
24
+ {
25
+ "command": "./.cursor/hooks/caws-scope-guard.sh"
26
+ }
27
+ ],
28
+ "afterFileEdit": [
29
+ {
30
+ "command": "./.cursor/hooks/format.sh"
31
+ },
32
+ {
33
+ "command": "./.cursor/hooks/naming-check.sh"
34
+ },
35
+ {
36
+ "command": "./.cursor/hooks/validate-spec.sh"
37
+ },
38
+ {
39
+ "command": "./.cursor/hooks/caws-quality-check.sh"
40
+ },
41
+ {
42
+ "command": "./.cursor/hooks/audit.sh"
43
+ }
44
+ ],
45
+ "beforeSubmitPrompt": [
46
+ {
47
+ "command": "./.cursor/hooks/caws-scope-guard.sh"
48
+ },
49
+ {
50
+ "command": "./.cursor/hooks/audit.sh"
51
+ }
52
+ ],
53
+ "stop": [
54
+ {
55
+ "command": "./.cursor/hooks/audit.sh"
56
+ }
57
+ ]
58
+ }
59
+ }
@@ -0,0 +1,311 @@
1
+ # CAWS Integration Instructions for GitHub Copilot
2
+
3
+ These instructions help Copilot understand and work with CAWS (Coding Agent Workflow System) quality assurance processes.
4
+
5
+ ## Overview
6
+
7
+ CAWS provides structured quality assurance for AI-assisted development. When working on CAWS-enabled projects, follow these guidelines to maintain quality standards and leverage CAWS tools effectively.
8
+
9
+ ## CAWS Project Detection
10
+
11
+ **Check if current project uses CAWS:**
12
+ - Look for `.caws/working-spec.yaml` file
13
+ - Check for `caws` commands in package.json scripts
14
+ - Verify CAWS CLI availability: `caws --version`
15
+
16
+ ## Working with CAWS Working Specifications
17
+
18
+ **Working specs define project requirements and constraints:**
19
+
20
+ ```yaml
21
+ id: PROJ-001
22
+ title: "Feature implementation"
23
+ risk_tier: 2 # 1=Critical, 2=Standard, 3=Low risk
24
+ mode: feature # feature|refactor|fix|chore
25
+ change_budget:
26
+ max_files: 25
27
+ max_loc: 1000
28
+ scope:
29
+ in: ["src/", "tests/"]
30
+ out: ["node_modules/", "dist/"]
31
+ ```
32
+
33
+ **Always validate working specs:**
34
+ ```bash
35
+ caws validate .caws/working-spec.yaml
36
+ ```
37
+
38
+ ## Quality Assurance Workflow
39
+
40
+ ### 1. Pre-Implementation
41
+ ```
42
+ # Get CAWS guidance before starting
43
+ caws agent iterate --current-state "About to implement X"
44
+
45
+ # CAWS will provide:
46
+ # - Implementation suggestions
47
+ # - Quality requirements
48
+ # - Risk considerations
49
+ ```
50
+
51
+ ### 2. During Implementation
52
+ ```
53
+ # Regular quality checks
54
+ caws agent evaluate --quiet
55
+
56
+ # Address any issues immediately
57
+ # Create waivers only when justified
58
+ caws waivers create --reason emergency_hotfix --gates coverage_threshold
59
+ ```
60
+
61
+ ### 3. Pre-Commit Validation
62
+ ```
63
+ # Comprehensive validation before commits
64
+ caws validate
65
+ caws agent evaluate
66
+
67
+ # Fix any quality gate failures
68
+ ```
69
+
70
+ ## CAWS Quality Gates
71
+
72
+ ### Code Quality Gates
73
+ - **Linting**: ESLint, Prettier formatting
74
+ - **Type Checking**: TypeScript strict mode
75
+ - **Security**: Dependency scanning, secret detection
76
+ - **Performance**: Bundle size, runtime budgets
77
+
78
+ ### Testing Gates
79
+ - **Unit Tests**: Individual component testing
80
+ - **Integration Tests**: Component interaction
81
+ - **Contract Tests**: API contract validation
82
+ - **E2E Tests**: Full workflow testing
83
+ - **Mutation Tests**: Test effectiveness validation
84
+
85
+ ### Analysis Gates
86
+ - **Accessibility**: WCAG 2.1 AA compliance
87
+ - **Complexity**: Maintainability metrics
88
+ - **Coverage**: Test coverage thresholds
89
+
90
+ ## Waiver Management
91
+
92
+ **Create waivers only for justified exceptions:**
93
+
94
+ ```bash
95
+ # Example: Emergency security fix
96
+ caws waivers create \
97
+ --title "Critical security vulnerability fix" \
98
+ --reason emergency_hotfix \
99
+ --gates coverage_threshold,contract_tests \
100
+ --expires-at "2025-11-01T00:00:00Z" \
101
+ --approved-by "security-team" \
102
+ --impact-level critical \
103
+ --mitigation-plan "Manual testing completed, security review passed"
104
+ ```
105
+
106
+ **Waiver reasons:**
107
+ - `emergency_hotfix` - Critical production issues
108
+ - `legacy_integration` - Third-party compatibility
109
+ - `experimental_feature` - Sandbox/prototype code
110
+ - `performance_critical` - Hot path optimizations
111
+ - `infrastructure_limitation` - Platform constraints
112
+
113
+ ## Scope Management
114
+
115
+ **Respect CAWS-defined scope boundaries:**
116
+
117
+ - **In scope**: Files listed in `scope.in` - full quality requirements apply
118
+ - **Out of scope**: Files in `scope.out` - no CAWS restrictions
119
+ - **Scope warnings**: Files outside primary scope but allowed
120
+
121
+ **Check scope compliance:**
122
+ ```bash
123
+ caws validate --scope-check path/to/file.js
124
+ ```
125
+
126
+ ## Risk Tier Considerations
127
+
128
+ ### Tier 1 (Critical) - Highest Quality Standards
129
+ - 90%+ test coverage
130
+ - All security scans pass
131
+ - Performance budgets strictly enforced
132
+ - Manual review required
133
+ - Zero waivers allowed for core gates
134
+
135
+ ### Tier 2 (Standard) - Balanced Quality
136
+ - 80%+ test coverage
137
+ - Security scans pass
138
+ - Performance budgets monitored
139
+ - Peer review recommended
140
+ - Limited waivers allowed
141
+
142
+ ### Tier 3 (Low Risk) - Flexible Development
143
+ - 70%+ test coverage
144
+ - Basic security checks
145
+ - Relaxed performance budgets
146
+ - Self-review acceptable
147
+ - Waivers freely allowed
148
+
149
+ ## Common Patterns
150
+
151
+ ### Feature Development
152
+ 1. Update working spec with feature requirements
153
+ 2. Get CAWS implementation guidance
154
+ 3. Implement with regular quality checks
155
+ 4. Create comprehensive tests
156
+ 5. Validate all quality gates pass
157
+ 6. Generate provenance report
158
+
159
+ ### Bug Fixes
160
+ 1. Assess risk tier and impact
161
+ 2. Create minimal reproduction
162
+ 3. Implement fix with tests
163
+ 4. Run quality validation
164
+ 5. Create waiver if emergency fix
165
+ 6. Update working spec if scope changes
166
+
167
+ ### Refactoring
168
+ 1. Establish baseline quality metrics
169
+ 2. Create refactoring plan
170
+ 3. Implement changes incrementally
171
+ 4. Maintain test suite passing
172
+ 5. Run comprehensive validation
173
+ 6. Update documentation
174
+
175
+ ## Error Handling
176
+
177
+ ### Quality Gate Failures
178
+ ```
179
+ ❌ CAWS validation failed
180
+ ✅ Solution: Run caws validate --suggestions
181
+ ✅ Fix identified issues
182
+ ✅ Re-run validation
183
+ ```
184
+
185
+ ### Scope Violations
186
+ ```
187
+ ❌ File outside CAWS scope
188
+ ✅ Solution: Update .caws/working-spec.yaml scope
189
+ ✅ Or create waiver if justified
190
+ ```
191
+
192
+ ### Waiver Required
193
+ ```
194
+ ⚠️ High-risk change detected
195
+ ✅ Solution: caws waivers create with justification
196
+ ✅ Include mitigation plan
197
+ ✅ Get appropriate approval
198
+ ```
199
+
200
+ ## Best Practices
201
+
202
+ ### Code Quality
203
+ - Follow established patterns and conventions
204
+ - Write comprehensive tests with new code
205
+ - Maintain existing test coverage
206
+ - Address linting issues immediately
207
+
208
+ ### Documentation
209
+ - Update working specs when requirements change
210
+ - Document waiver justifications thoroughly
211
+ - Keep provenance records current
212
+ - Update API documentation for public interfaces
213
+
214
+ ### Collaboration
215
+ - Communicate waiver needs early
216
+ - Share quality gate results with team
217
+ - Review high-risk changes together
218
+ - Maintain collective code ownership
219
+
220
+ ### Performance
221
+ - Monitor performance budgets during development
222
+ - Optimize hot paths identified by CAWS
223
+ - Address performance regressions immediately
224
+ - Include performance tests for critical paths
225
+
226
+ ## Emergency Procedures
227
+
228
+ ### Production Hotfix
229
+ 1. Assess severity and business impact
230
+ 2. Create emergency waiver immediately
231
+ 3. Implement minimal fix with safety measures
232
+ 4. Add comprehensive tests post-fix
233
+ 5. Schedule follow-up quality improvements
234
+
235
+ ### Security Vulnerability
236
+ 1. Create critical waiver with security approval
237
+ 2. Implement minimal security fix
238
+ 3. Add security tests and monitoring
239
+ 4. Conduct security review
240
+ 5. Plan comprehensive fix for next release
241
+
242
+ ## Integration with Other Tools
243
+
244
+ ### Git Workflow
245
+ - Pre-commit hooks run fast CAWS checks
246
+ - Pre-push hooks run comprehensive validation
247
+ - Post-commit hooks update provenance
248
+ - Branch protection requires CAWS validation
249
+
250
+ ### CI/CD Pipeline
251
+ - Automated CAWS quality gates
252
+ - Tier-based conditional execution
253
+ - Waiver validation and auditing
254
+ - Provenance report generation
255
+
256
+ ### IDE Integration
257
+ - Real-time quality feedback
258
+ - Scope boundary enforcement
259
+ - Automatic waiver suggestions
260
+ - Quality dashboard visualization
261
+
262
+ ## Troubleshooting
263
+
264
+ ### CAWS CLI Issues
265
+ ```bash
266
+ # Check installation
267
+ caws --version
268
+
269
+ # Update to latest version
270
+ npm install -g @caws/cli@latest
271
+
272
+ # Check working spec syntax
273
+ caws validate --suggestions
274
+ ```
275
+
276
+ ### Quality Gate Failures
277
+ ```bash
278
+ # Get detailed feedback
279
+ caws agent evaluate
280
+
281
+ # Check specific gate
282
+ caws validate --gate linting
283
+
284
+ # View waiver options
285
+ caws waivers list --expiring-soon
286
+ ```
287
+
288
+ ### Performance Issues
289
+ ```bash
290
+ # Skip heavy checks for urgent fixes
291
+ caws validate --skip performance,mutation
292
+
293
+ # Run fast checks only
294
+ caws agent evaluate --quick
295
+ ```
296
+
297
+ ## Support
298
+
299
+ ### Getting Help
300
+ - Run `caws --help` for command reference
301
+ - Check `caws validate --suggestions` for specific issues
302
+ - Review working spec documentation
303
+ - Consult team CAWS guidelines
304
+
305
+ ### Common Issues
306
+ - **Working spec invalid**: Fix YAML syntax and required fields
307
+ - **Scope violations**: Update scope or create waiver
308
+ - **Quality gate failures**: Address root cause, don't just waive
309
+ - **Performance regressions**: Optimize or adjust budgets
310
+
311
+ Remember: CAWS is designed to maintain quality while enabling development velocity. Use waivers judiciously and always prioritize code quality and security.
@@ -0,0 +1,5 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="CAWS: Evaluate Quality" type="NodeJSConfigurationType" factoryName="Node.js" path-to-js-file="$PROJECT_DIR$/packages/caws-cli/dist/index.js" working-dir="$PROJECT_DIR$" application-parameters="agent evaluate .caws/working-spec.yaml">
3
+ <method v="2" />
4
+ </configuration>
5
+ </component>
@@ -0,0 +1,5 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="CAWS: Validate" type="NodeJSConfigurationType" factoryName="Node.js" path-to-js-file="$PROJECT_DIR$/packages/caws-cli/dist/index.js" working-dir="$PROJECT_DIR$" application-parameters="validate .caws/working-spec.yaml">
3
+ <method v="2" />
4
+ </configuration>
5
+ </component>
@@ -0,0 +1,56 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "name": "Run CAWS Extension",
6
+ "type": "extensionHost",
7
+ "request": "launch",
8
+ "args": ["--extensionDevelopmentPath=${workspaceFolder}/packages/caws-vscode-extension"],
9
+ "outFiles": ["${workspaceFolder}/packages/caws-vscode-extension/out/**/*.js"],
10
+ "preLaunchTask": "${workspaceFolder}/packages/caws-vscode-extension:watch"
11
+ },
12
+ {
13
+ "name": "Run CAWS Extension (Host Workspace)",
14
+ "type": "extensionHost",
15
+ "request": "launch",
16
+ "args": ["--extensionDevelopmentPath=${workspaceFolder}/packages/caws-vscode-extension", "${workspaceFolder}"],
17
+ "outFiles": ["${workspaceFolder}/packages/caws-vscode-extension/out/**/*.js"],
18
+ "preLaunchTask": "${workspaceFolder}/packages/caws-vscode-extension:watch"
19
+ },
20
+ {
21
+ "name": "Debug CAWS Extension",
22
+ "type": "node",
23
+ "request": "launch",
24
+ "program": "${workspaceFolder}/packages/caws-vscode-extension/out/extension.js",
25
+ "args": ["--inspect=6009"],
26
+ "env": {
27
+ "CAWS_DEBUG": "true"
28
+ },
29
+ "preLaunchTask": "${workspaceFolder}/packages/caws-vscode-extension:compile"
30
+ },
31
+ {
32
+ "name": "Debug MCP Server",
33
+ "type": "node",
34
+ "request": "launch",
35
+ "program": "${workspaceFolder}/packages/caws-mcp-server/index.js",
36
+ "args": [],
37
+ "env": {
38
+ "NODE_ENV": "development",
39
+ "CAWS_DEBUG": "true"
40
+ },
41
+ "console": "integratedTerminal"
42
+ },
43
+ {
44
+ "name": "Debug CAWS CLI",
45
+ "type": "node",
46
+ "request": "launch",
47
+ "program": "${workspaceFolder}/packages/caws-cli/src/index.js",
48
+ "args": ["validate", ".caws/working-spec.yaml"],
49
+ "env": {
50
+ "NODE_ENV": "development",
51
+ "CAWS_DEBUG": "true"
52
+ },
53
+ "console": "integratedTerminal"
54
+ }
55
+ ]
56
+ }