@paths.design/caws-cli 3.5.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/budget-derivation.d.ts +41 -2
- package/dist/budget-derivation.d.ts.map +1 -1
- package/dist/budget-derivation.js +417 -30
- package/dist/commands/archive.d.ts +50 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +353 -0
- package/dist/commands/iterate.d.ts.map +1 -1
- package/dist/commands/iterate.js +12 -13
- package/dist/commands/mode.d.ts +24 -0
- package/dist/commands/mode.d.ts.map +1 -0
- package/dist/commands/mode.js +259 -0
- package/dist/commands/plan.d.ts +49 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +448 -0
- 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 +490 -0
- package/dist/commands/specs.d.ts +71 -0
- package/dist/commands/specs.d.ts.map +1 -0
- package/dist/commands/specs.js +735 -0
- package/dist/commands/status.d.ts +4 -3
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +552 -22
- package/dist/commands/tutorial.d.ts +55 -0
- package/dist/commands/tutorial.d.ts.map +1 -0
- package/dist/commands/tutorial.js +481 -0
- package/dist/commands/validate.d.ts +10 -2
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +199 -39
- package/dist/config/modes.d.ts +225 -0
- package/dist/config/modes.d.ts.map +1 -0
- package/dist/config/modes.js +321 -0
- package/dist/constants/spec-types.d.ts +41 -0
- package/dist/constants/spec-types.d.ts.map +1 -0
- package/dist/constants/spec-types.js +42 -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.js +227 -10
- package/dist/index.js.backup +4711 -0
- package/dist/policy/PolicyManager.d.ts +104 -0
- package/dist/policy/PolicyManager.d.ts.map +1 -0
- package/dist/policy/PolicyManager.js +399 -0
- package/dist/scaffold/cursor-hooks.d.ts.map +1 -1
- package/dist/scaffold/cursor-hooks.js +15 -0
- package/dist/scaffold/git-hooks.d.ts.map +1 -1
- package/dist/scaffold/git-hooks.js +32 -44
- package/dist/scaffold/index.d.ts.map +1 -1
- package/dist/scaffold/index.js +19 -0
- package/dist/spec/SpecFileManager.d.ts +146 -0
- package/dist/spec/SpecFileManager.d.ts.map +1 -0
- package/dist/spec/SpecFileManager.js +419 -0
- package/dist/utils/quality-gates-errors.js +520 -0
- package/dist/utils/quality-gates.d.ts +49 -0
- package/dist/utils/quality-gates.d.ts.map +1 -0
- package/dist/utils/quality-gates.js +361 -0
- package/dist/utils/spec-resolver.d.ts +88 -0
- package/dist/utils/spec-resolver.d.ts.map +1 -0
- package/dist/utils/spec-resolver.js +602 -0
- package/dist/validation/spec-validation.d.ts +14 -0
- package/dist/validation/spec-validation.d.ts.map +1 -1
- package/dist/validation/spec-validation.js +225 -13
- package/package.json +6 -5
- package/templates/.cursor/hooks/caws-scope-guard.sh +64 -8
- package/templates/.cursor/hooks/validate-spec.sh +22 -12
- package/templates/.cursor/rules/00-claims-verification.mdc +144 -0
- package/templates/.cursor/rules/01-working-style.mdc +50 -0
- package/templates/.cursor/rules/02-quality-gates.mdc +370 -0
- package/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
- package/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
- package/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
- package/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
- package/templates/.cursor/rules/07-process-ops.mdc +20 -0
- package/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
- package/templates/.cursor/rules/09-docstrings.mdc +89 -0
- package/templates/.cursor/rules/10-authorship-and-attribution.mdc +15 -0
- package/templates/.cursor/rules/11-documentation-quality-standards.mdc +390 -0
- package/templates/.cursor/rules/12-scope-management-waivers.mdc +385 -0
- package/templates/.cursor/rules/13-implementation-completeness.mdc +516 -0
- package/templates/.cursor/rules/14-language-agnostic-standards.mdc +588 -0
- package/templates/.cursor/rules/15-sophisticated-todo-detection.mdc +425 -0
- package/templates/.cursor/rules/README.md +150 -0
- package/templates/apps/tools/caws/prompt-lint.js.backup +274 -0
- package/templates/apps/tools/caws/provenance.js.backup +73 -0
- package/templates/scripts/quality-gates/check-god-objects.js +146 -0
- package/templates/scripts/quality-gates/run-quality-gates.js +50 -0
- package/templates/scripts/v3/analysis/todo_analyzer.py +1950 -0
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Sophisticated TODO detection patterns and hidden implementation analysis
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sophisticated TODO Detection & Analysis
|
|
8
|
+
|
|
9
|
+
## Core Principle
|
|
10
|
+
|
|
11
|
+
**Detect hidden incomplete implementations beyond simple TODO comments.** Use context-aware analysis with confidence scoring to identify stub implementations, temporary solutions, and incomplete business logic.
|
|
12
|
+
|
|
13
|
+
## Advanced Detection Patterns
|
|
14
|
+
|
|
15
|
+
### High-Confidence Hidden TODO Patterns
|
|
16
|
+
|
|
17
|
+
**Incomplete Implementation Patterns:**
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
incomplete_implementation_patterns = [
|
|
21
|
+
r'\bnot\s+yet\s+implemented\b',
|
|
22
|
+
r'\bmissing\s+implementation\b',
|
|
23
|
+
r'\bincomplete\s+implementation\b',
|
|
24
|
+
r'\bpartial\s+implementation\b',
|
|
25
|
+
r'\bunimplemented\b',
|
|
26
|
+
r'\bnot\s+done\b',
|
|
27
|
+
r'\bpending\s+implementation\b',
|
|
28
|
+
r'\bto\s+be\s+implemented\b',
|
|
29
|
+
r'\bwill\s+be\s+implemented\b',
|
|
30
|
+
r'\bcoming\s+soon\b',
|
|
31
|
+
r'\bwork\s+in\s+progress\b',
|
|
32
|
+
r'\bwip\b',
|
|
33
|
+
]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Placeholder Code Patterns:**
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
placeholder_code_patterns = [
|
|
40
|
+
r'\bplaceholder\s+code\b',
|
|
41
|
+
r'\bplaceholder\s+implementation\b',
|
|
42
|
+
r'\bstub\s+implementation\b',
|
|
43
|
+
r'\bdummy\s+implementation\b',
|
|
44
|
+
r'\bfake\s+implementation\b',
|
|
45
|
+
r'\bsimplified\s+.*?\s+implementation\b',
|
|
46
|
+
r'\bfor\s+now\b.*?(just|simply|only)\s+(concatenate|return|use)',
|
|
47
|
+
r'\btemporary\s+implementation\b',
|
|
48
|
+
r'\bmock\s+implementation\b',
|
|
49
|
+
r'\bsample\s+implementation\b',
|
|
50
|
+
]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Temporary Solution Patterns:**
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
temporary_solution_patterns = [
|
|
57
|
+
r'\btemporary\s+solution\b',
|
|
58
|
+
r'\btemporary\s+fix\b',
|
|
59
|
+
r'\bquick\s+fix\b',
|
|
60
|
+
r'\bworkaround\b',
|
|
61
|
+
r'\bhack\b.*?(fix|solution)',
|
|
62
|
+
r'\bband-aid\s+solution\b',
|
|
63
|
+
r'\bkludge\b',
|
|
64
|
+
r'\bcrude\s+solution\b',
|
|
65
|
+
r'\brough\s+implementation\b',
|
|
66
|
+
]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Hardcoded Value Patterns:**
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
hardcoded_value_patterns = [
|
|
73
|
+
r'\bhardcoded\s+value\b',
|
|
74
|
+
r'\bmagic\s+number\b',
|
|
75
|
+
r'\bmagic\s+string\b',
|
|
76
|
+
r'\bconstant\s+value\b.*?(replace|change|make\s+configurable)',
|
|
77
|
+
r'\bfixed\s+value\b',
|
|
78
|
+
r'\bstatic\s+value\b',
|
|
79
|
+
r'\bhardcoded\s+constant\b',
|
|
80
|
+
]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Future Improvement Patterns:**
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
future_improvement_patterns = [
|
|
87
|
+
r'\bin\s+production\b.*?(implement|add|fix)',
|
|
88
|
+
r'\bin\s+a\s+real\s+implementation\b',
|
|
89
|
+
r'\beventually\b.*?(implement|add|fix)',
|
|
90
|
+
r'\bshould\s+be\b.*?(implemented|added|fixed)',
|
|
91
|
+
r'\bwould\s+be\b.*?(implemented|added|fixed)',
|
|
92
|
+
r'\bmight\s+be\b.*?(implemented|added|fixed)',
|
|
93
|
+
r'\bcould\s+be\b.*?(implemented|added|fixed)',
|
|
94
|
+
r'\blater\b.*?(implement|add|fix)',
|
|
95
|
+
r'\bsomeday\b.*?(implement|add|fix)',
|
|
96
|
+
]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Language-Specific Code Stub Detection
|
|
100
|
+
|
|
101
|
+
### JavaScript/TypeScript Patterns
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
javascript_stub_patterns = {
|
|
105
|
+
'function_stub': re.compile(r'^\s*(async\s+)?function\s+\w+\(.*\)\s*{'),
|
|
106
|
+
'throw_not_impl': re.compile(r"^\s*throw\s+new\s+Error\((\"|')(TODO|Not\s+Implemented|Not\s+Yet\s+Implemented)"),
|
|
107
|
+
'return_todo': re.compile(r"^\s*return\s+(null|undefined);\s*//\s*(TODO|PLACEHOLDER)"),
|
|
108
|
+
'console_log_stub': re.compile(r"^\s*console\.log\(.*?\);\s*//\s*(TODO|PLACEHOLDER|STUB)"),
|
|
109
|
+
'empty_function': re.compile(r'^\s*(async\s+)?function\s+\w+\(.*\)\s*{\s*}\s*$'),
|
|
110
|
+
'return_mock': re.compile(r"^\s*return\s+\{.*?\};\s*//\s*(MOCK|FAKE|DUMMY)"),
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Python Patterns
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
python_stub_patterns = {
|
|
118
|
+
'function_stub': re.compile(r'^\s*def\s+\w+\(.*\):'),
|
|
119
|
+
'pass_stmt': re.compile(r'^\s*pass\s*$'),
|
|
120
|
+
'ellipsis_stmt': re.compile(r'^\s*\.\.\.\s*$'),
|
|
121
|
+
'raise_not_impl': re.compile(r'^\s*raise\s+NotImplementedError'),
|
|
122
|
+
'return_none': re.compile(r"^\s*return\s+None\s*#\s*(TODO|PLACEHOLDER)"),
|
|
123
|
+
'print_stub': re.compile(r"^\s*print\(.*?\)\s*#\s*(TODO|PLACEHOLDER|STUB)"),
|
|
124
|
+
'empty_function': re.compile(r'^\s*def\s+\w+\(.*\):\s*pass\s*$'),
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Rust Patterns
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
rust_stub_patterns = {
|
|
132
|
+
'function_stub': re.compile(r'^\s*(async\s+)?fn\s+\w+\(.*\)\s*->\s*\w+\s*{'),
|
|
133
|
+
'todo_macro': re.compile(r'^\s*todo!\(\)'),
|
|
134
|
+
'unimplemented_macro': re.compile(r'^\s*unimplemented!\(\)'),
|
|
135
|
+
'panic_stub': re.compile(r"^\s*panic!\(\"TODO\"\)"),
|
|
136
|
+
'return_default': re.compile(r"^\s*Default::default\(\)\s*//\s*(TODO|PLACEHOLDER)"),
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Context-Aware Analysis
|
|
141
|
+
|
|
142
|
+
### Confidence Scoring
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
def calculate_confidence_score(comment: str, line_num: int, file_path: Path) -> float:
|
|
146
|
+
score = 0.0
|
|
147
|
+
|
|
148
|
+
# Check for documentation indicators (reduce score)
|
|
149
|
+
if is_documentation_comment(comment):
|
|
150
|
+
score -= 0.5
|
|
151
|
+
|
|
152
|
+
# Check for TODO indicators (increase score)
|
|
153
|
+
if has_todo_indicators(comment):
|
|
154
|
+
score += 0.3
|
|
155
|
+
|
|
156
|
+
# Check if it's in a generated file (reduce score)
|
|
157
|
+
if is_generated_file(file_path):
|
|
158
|
+
score -= 0.4
|
|
159
|
+
|
|
160
|
+
# Check for implementation context (increase score)
|
|
161
|
+
if is_implementation_context(comment):
|
|
162
|
+
score += 0.2
|
|
163
|
+
|
|
164
|
+
# Check for business logic context (increase score)
|
|
165
|
+
if is_business_logic_context(comment):
|
|
166
|
+
score += 0.3
|
|
167
|
+
|
|
168
|
+
return max(-1.0, min(1.0, score))
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Exclusion Patterns
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
exclusion_patterns = [
|
|
175
|
+
r'\bperformance\s+monitoring\b',
|
|
176
|
+
r'\bperformance\s+optimization\b',
|
|
177
|
+
r'\bfallback\s+mechanism\b',
|
|
178
|
+
r'\bbasic\s+authentication\b',
|
|
179
|
+
r'\bmock\s+object\b', # For testing
|
|
180
|
+
r'\bcurrent\s+implementation\b.*?(uses|provides|supports)',
|
|
181
|
+
r'\bexample\s+implementation\b',
|
|
182
|
+
r'\bsample\s+code\b',
|
|
183
|
+
r'\bdemo\s+implementation\b',
|
|
184
|
+
r'\btest\s+implementation\b',
|
|
185
|
+
]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Implementation Detection
|
|
189
|
+
|
|
190
|
+
### Fake Persistence Detection
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
fake_persistence_patterns = [
|
|
194
|
+
r'private\s+\w+:\s*\w+\[\]\s*=\s*\[\]', # In-memory arrays
|
|
195
|
+
r'const\s+\w+\s*=\s*\[\]', # Empty arrays
|
|
196
|
+
r'let\s+\w+\s*=\s*\[\]', # Empty arrays
|
|
197
|
+
r'mock.*database',
|
|
198
|
+
r'fake.*persistence',
|
|
199
|
+
r'in-memory.*storage',
|
|
200
|
+
r'temporary.*storage',
|
|
201
|
+
]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Mock API Detection
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
mock_api_patterns = [
|
|
208
|
+
r'return\s+\{.*?\};\s*//\s*(MOCK|FAKE|DUMMY)',
|
|
209
|
+
r'console\.log.*mock',
|
|
210
|
+
r'hardcoded.*response',
|
|
211
|
+
r'static.*response',
|
|
212
|
+
r'fake.*api',
|
|
213
|
+
r'mock.*endpoint',
|
|
214
|
+
]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Stub Business Logic Detection
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
stub_business_logic_patterns = [
|
|
221
|
+
r'return\s+\d+;\s*//\s*(TODO|PLACEHOLDER)',
|
|
222
|
+
r'return\s+true;\s*//\s*(TODO|PLACEHOLDER)',
|
|
223
|
+
r'return\s+false;\s*//\s*(TODO|PLACEHOLDER)',
|
|
224
|
+
r'return\s+null;\s*//\s*(TODO|PLACEHOLDER)',
|
|
225
|
+
r'throw\s+new\s+Error.*not\s+implemented',
|
|
226
|
+
r'raise.*NotImplementedError',
|
|
227
|
+
]
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## CAWS Integration
|
|
231
|
+
|
|
232
|
+
### Pre-Commit Analysis
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Run sophisticated TODO analysis
|
|
236
|
+
check-hidden-todos() {
|
|
237
|
+
echo "🔍 Running sophisticated TODO analysis..."
|
|
238
|
+
|
|
239
|
+
# Check for high-confidence hidden TODOs
|
|
240
|
+
local hidden_todos=$(grep -r -E "(not yet implemented|missing implementation|incomplete implementation|partial implementation|unimplemented|not done|pending implementation|to be implemented|will be implemented)" src/ | wc -l)
|
|
241
|
+
if [ "$hidden_todos" -gt 0 ]; then
|
|
242
|
+
echo "❌ Found $hidden_todos hidden incomplete implementations"
|
|
243
|
+
echo "All implementations must be complete"
|
|
244
|
+
exit 1
|
|
245
|
+
fi
|
|
246
|
+
|
|
247
|
+
# Check for placeholder implementations
|
|
248
|
+
local placeholders=$(grep -r -E "(placeholder code|placeholder implementation|stub implementation|dummy implementation|fake implementation)" src/ | wc -l)
|
|
249
|
+
if [ "$placeholders" -gt 0 ]; then
|
|
250
|
+
echo "❌ Found $placeholders placeholder implementations"
|
|
251
|
+
echo "Replace with real implementations"
|
|
252
|
+
exit 1
|
|
253
|
+
fi
|
|
254
|
+
|
|
255
|
+
# Check for temporary solutions
|
|
256
|
+
local temp_solutions=$(grep -r -E "(temporary solution|temporary fix|quick fix|workaround|hack.*fix)" src/ | wc -l)
|
|
257
|
+
if [ "$temp_solutions" -gt 0 ]; then
|
|
258
|
+
echo "❌ Found $temp_solutions temporary solutions"
|
|
259
|
+
echo "Implement proper solutions"
|
|
260
|
+
exit 1
|
|
261
|
+
fi
|
|
262
|
+
|
|
263
|
+
echo "✅ No hidden incomplete implementations found"
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### CI/CD Integration
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
# Sophisticated TODO analysis in CI
|
|
271
|
+
- name: Check Hidden TODOs
|
|
272
|
+
run: |
|
|
273
|
+
echo "🔍 Running sophisticated hidden TODO analysis..."
|
|
274
|
+
|
|
275
|
+
# Check for incomplete implementations
|
|
276
|
+
incomplete_count=$(grep -r -E "(not yet implemented|missing implementation|incomplete implementation|partial implementation|unimplemented|not done|pending implementation|to be implemented|will be implemented)" src/ | wc -l)
|
|
277
|
+
if [ "$incomplete_count" -gt 0 ]; then
|
|
278
|
+
echo "❌ Found $incomplete_count hidden incomplete implementations"
|
|
279
|
+
echo "All implementations must be complete"
|
|
280
|
+
exit 1
|
|
281
|
+
fi
|
|
282
|
+
|
|
283
|
+
# Check for placeholder implementations
|
|
284
|
+
placeholder_count=$(grep -r -E "(placeholder code|placeholder implementation|stub implementation|dummy implementation|fake implementation)" src/ | wc -l)
|
|
285
|
+
if [ "$placeholder_count" -gt 0 ]; then
|
|
286
|
+
echo "❌ Found $placeholder_count placeholder implementations"
|
|
287
|
+
echo "Replace with real implementations"
|
|
288
|
+
exit 1
|
|
289
|
+
fi
|
|
290
|
+
|
|
291
|
+
# Check for temporary solutions
|
|
292
|
+
temp_count=$(grep -r -E "(temporary solution|temporary fix|quick fix|workaround|hack.*fix)" src/ | wc -l)
|
|
293
|
+
if [ "$temp_count" -gt 0 ]; then
|
|
294
|
+
echo "❌ Found $temp_count temporary solutions"
|
|
295
|
+
echo "Implement proper solutions"
|
|
296
|
+
exit 1
|
|
297
|
+
fi
|
|
298
|
+
|
|
299
|
+
# Check for fake persistence
|
|
300
|
+
fake_persistence_count=$(grep -r -E "(private.*\[\]|mock.*database|fake.*persistence|in-memory.*storage)" src/ | wc -l)
|
|
301
|
+
if [ "$fake_persistence_count" -gt 0 ]; then
|
|
302
|
+
echo "❌ Found $fake_persistence_count fake persistence patterns"
|
|
303
|
+
echo "Use real database connections"
|
|
304
|
+
exit 1
|
|
305
|
+
fi
|
|
306
|
+
|
|
307
|
+
echo "✅ No hidden incomplete implementations found"
|
|
308
|
+
|
|
309
|
+
- name: Generate TODO Analysis Report
|
|
310
|
+
run: |
|
|
311
|
+
echo "📊 Generating comprehensive TODO analysis report..."
|
|
312
|
+
|
|
313
|
+
# Generate detailed report
|
|
314
|
+
echo "# Hidden TODO Analysis Report" > hidden-todos-report.md
|
|
315
|
+
echo "" >> hidden-todos-report.md
|
|
316
|
+
echo "## Incomplete Implementations" >> hidden-todos-report.md
|
|
317
|
+
grep -r -E "(not yet implemented|missing implementation|incomplete implementation|partial implementation|unimplemented|not done|pending implementation|to be implemented|will be implemented)" src/ >> hidden-todos-report.md || echo "None found" >> hidden-todos-report.md
|
|
318
|
+
echo "" >> hidden-todos-report.md
|
|
319
|
+
echo "## Placeholder Implementations" >> hidden-todos-report.md
|
|
320
|
+
grep -r -E "(placeholder code|placeholder implementation|stub implementation|dummy implementation|fake implementation)" src/ >> hidden-todos-report.md || echo "None found" >> hidden-todos-report.md
|
|
321
|
+
echo "" >> hidden-todos-report.md
|
|
322
|
+
echo "## Temporary Solutions" >> hidden-todos-report.md
|
|
323
|
+
grep -r -E "(temporary solution|temporary fix|quick fix|workaround|hack.*fix)" src/ >> hidden-todos-report.md || echo "None found" >> hidden-todos-report.md
|
|
324
|
+
echo "" >> hidden-todos-report.md
|
|
325
|
+
echo "## Fake Persistence Patterns" >> hidden-todos-report.md
|
|
326
|
+
grep -r -E "(private.*\[\]|mock.*database|fake.*persistence|in-memory.*storage)" src/ >> hidden-todos-report.md || echo "None found" >> hidden-todos-report.md
|
|
327
|
+
|
|
328
|
+
echo "📊 TODO analysis report generated"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## CAWS Commands
|
|
332
|
+
|
|
333
|
+
### TODO Analysis Commands
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
# Run comprehensive TODO analysis
|
|
337
|
+
caws analyze-todos --confidence-threshold=0.7
|
|
338
|
+
|
|
339
|
+
# Check for hidden incomplete implementations
|
|
340
|
+
caws analyze-todos --pattern="incomplete_implementation" --confidence-threshold=0.8
|
|
341
|
+
|
|
342
|
+
# Analyze placeholder implementations
|
|
343
|
+
caws analyze-todos --pattern="placeholder_code" --confidence-threshold=0.6
|
|
344
|
+
|
|
345
|
+
# Check for temporary solutions
|
|
346
|
+
caws analyze-todos --pattern="temporary_solution" --confidence-threshold=0.7
|
|
347
|
+
|
|
348
|
+
# Analyze fake persistence patterns
|
|
349
|
+
caws analyze-todos --pattern="fake_persistence" --confidence-threshold=0.8
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Quality Monitoring
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# Track TODO resolution progress
|
|
356
|
+
caws quality-monitor --action=code_edited --files="$(git diff --name-only)" --check-hidden-todos
|
|
357
|
+
|
|
358
|
+
# Update progress with TODO resolution
|
|
359
|
+
caws progress update --criterion-id="TODO-001" --status="completed" --tests-passing=1
|
|
360
|
+
|
|
361
|
+
# Track implementation completeness metrics
|
|
362
|
+
caws metrics track --metric="hidden_todos_count" --value=0
|
|
363
|
+
caws metrics track --metric="placeholder_implementations" --value=0
|
|
364
|
+
caws metrics track --metric="temporary_solutions" --value=0
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Quality Metrics
|
|
368
|
+
|
|
369
|
+
### Implementation Completeness Score
|
|
370
|
+
|
|
371
|
+
```python
|
|
372
|
+
def calculate_completeness_score(analysis_results):
|
|
373
|
+
total_files = analysis_results['total_files']
|
|
374
|
+
files_with_todos = analysis_results['files_with_hidden_todos']
|
|
375
|
+
high_conf_todos = analysis_results['high_confidence_todos']
|
|
376
|
+
|
|
377
|
+
# Completeness score (higher is better)
|
|
378
|
+
completeness_score = 1.0 - (files_with_todos / total_files) if total_files > 0 else 1.0
|
|
379
|
+
|
|
380
|
+
# Quality score based on confidence levels
|
|
381
|
+
quality_score = 1.0 - (high_conf_todos / total_files) if total_files > 0 else 1.0
|
|
382
|
+
|
|
383
|
+
return {
|
|
384
|
+
'completeness_score': completeness_score,
|
|
385
|
+
'quality_score': quality_score,
|
|
386
|
+
'files_with_todos': files_with_todos,
|
|
387
|
+
'high_confidence_todos': high_conf_todos,
|
|
388
|
+
'total_files_analyzed': total_files
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Anti-Pattern Detection Metrics
|
|
393
|
+
|
|
394
|
+
- **Placeholder Density**: Number of high-confidence TODOs per 1000 lines
|
|
395
|
+
- **Stub Implementation Rate**: % of functions with stub patterns detected
|
|
396
|
+
- **Temporary Solution Rate**: % of code marked as temporary/workaround
|
|
397
|
+
- **Hardcoded Value Rate**: % of magic numbers/strings detected
|
|
398
|
+
- **Fake Persistence Rate**: % of code using in-memory storage patterns
|
|
399
|
+
|
|
400
|
+
## Continuous Improvement
|
|
401
|
+
|
|
402
|
+
### Monthly Audits
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
# Generate monthly completeness report
|
|
406
|
+
grep -r -E "(not yet implemented|missing implementation|incomplete implementation|partial implementation|unimplemented|not done|pending implementation|to be implemented|will be implemented)" src/ > monthly-hidden-todos.txt
|
|
407
|
+
grep -r -E "(placeholder code|placeholder implementation|stub implementation|dummy implementation|fake implementation)" src/ > monthly-placeholders.txt
|
|
408
|
+
grep -r -E "(temporary solution|temporary fix|quick fix|workaround|hack.*fix)" src/ > monthly-temp-solutions.txt
|
|
409
|
+
|
|
410
|
+
# Track trends over time
|
|
411
|
+
echo "Implementation completeness trends:" >> monthly-report.md
|
|
412
|
+
echo "- Hidden incomplete implementations: $(wc -l < monthly-hidden-todos.txt)" >> monthly-report.md
|
|
413
|
+
echo "- Placeholder implementations: $(wc -l < monthly-placeholders.txt)" >> monthly-report.md
|
|
414
|
+
echo "- Temporary solutions: $(wc -l < monthly-temp-solutions.txt)" >> monthly-report.md
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Quarterly Reviews
|
|
418
|
+
|
|
419
|
+
- Full implementation audit across entire codebase
|
|
420
|
+
- Review integration reality and persistence patterns
|
|
421
|
+
- Update quality gates based on project evolution
|
|
422
|
+
- Refine detection patterns based on new anti-patterns
|
|
423
|
+
- Analyze confidence threshold effectiveness
|
|
424
|
+
|
|
425
|
+
This rule ensures sophisticated detection of hidden incomplete implementations beyond simple TODO comments, providing context-aware analysis with confidence scoring to maintain high code quality standards.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Cursor Rules for CAWS Projects
|
|
2
|
+
|
|
3
|
+
This directory contains modular rule files that Cursor uses to guide development in CAWS projects.
|
|
4
|
+
|
|
5
|
+
## Rule Files
|
|
6
|
+
|
|
7
|
+
### Always Applied (Core Governance)
|
|
8
|
+
|
|
9
|
+
- `00-claims-verification.mdc` - Production readiness claims require rigorous verification
|
|
10
|
+
- `01-working-style.mdc` - Default agent behavior, edit style, and risk limits
|
|
11
|
+
- `02-quality-gates.mdc` - Comprehensive testing standards and verification requirements
|
|
12
|
+
- `03-infrastructure-standards.mdc` - Infrastructure, deployment, and operational standards
|
|
13
|
+
- `03-naming-and-refactor.mdc` - Canonical naming enforcement and refactor strategies
|
|
14
|
+
- `04-documentation-integrity.mdc` - Documentation must match implementation reality
|
|
15
|
+
- `05-production-readiness-checklist.mdc` - Quick reference checklist for production readiness
|
|
16
|
+
- `05-safe-defaults-guards.mdc` - Safe defaults, guard clauses, and early returns
|
|
17
|
+
- `06-typescript-conventions.mdc` - TypeScript/JS conventions and best practices
|
|
18
|
+
- `07-process-ops.mdc` - Process discipline and server management
|
|
19
|
+
- `08-solid-and-architecture.mdc` - SOLID principles and architectural patterns
|
|
20
|
+
- `09-docstrings.mdc` - Language-specific docstring formats and standards
|
|
21
|
+
- `10-authorship-and-attribution.mdc` - File headers and authorship standards
|
|
22
|
+
- `16-documentation-quality-standards.mdc` - Engineering-grade documentation standards
|
|
23
|
+
- `17-scope-management-waivers.mdc` - Scope management, change budgets, and emergency waiver procedures
|
|
24
|
+
- `18-implementation-completeness.mdc` - Anti-fake implementation guardrails and completeness verification
|
|
25
|
+
- `19-language-agnostic-standards.mdc` - Universal engineering standards across all programming languages
|
|
26
|
+
- `20-sophisticated-todo-detection.mdc` - Advanced TODO detection patterns and hidden implementation analysis
|
|
27
|
+
|
|
28
|
+
## How MDC Works
|
|
29
|
+
|
|
30
|
+
Each `.mdc` file has frontmatter that controls when it applies:
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
---
|
|
34
|
+
description: Brief description of the rule
|
|
35
|
+
globs:
|
|
36
|
+
alwaysApply: true
|
|
37
|
+
---
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- **alwaysApply: true** - Rule is always active
|
|
41
|
+
- **globs: [...]** - Rule auto-attaches when editing matching files
|
|
42
|
+
|
|
43
|
+
## CAWS Quality Standards
|
|
44
|
+
|
|
45
|
+
These rules enforce CAWS quality tiers:
|
|
46
|
+
|
|
47
|
+
| Tier | Coverage | Mutation | Use Case |
|
|
48
|
+
| --------- | -------- | -------- | --------------------------- |
|
|
49
|
+
| 🔴 **T1** | 90%+ | 70%+ | Auth, billing, migrations |
|
|
50
|
+
| 🟡 **T2** | 80%+ | 50%+ | Features, APIs, data writes |
|
|
51
|
+
| 🟢 **T3** | 70%+ | 30%+ | UI, internal tools |
|
|
52
|
+
|
|
53
|
+
## Comprehensive Coverage Areas
|
|
54
|
+
|
|
55
|
+
### Core Engineering Standards
|
|
56
|
+
|
|
57
|
+
- **Production Readiness**: Rigorous verification requirements with evidence-based claims and accountability measures
|
|
58
|
+
- **Testing Standards**: Complete testing pyramid (unit/integration/E2E) with coverage thresholds and quality gates
|
|
59
|
+
- **Infrastructure**: Database, API, security, monitoring, deployment, and operational standards
|
|
60
|
+
- **Documentation**: Engineering-grade content with reality alignment verification and prohibited patterns
|
|
61
|
+
|
|
62
|
+
### Advanced Quality Controls
|
|
63
|
+
|
|
64
|
+
- **Scope Management**: Change budget enforcement with emergency waiver procedures and critical fix protocols
|
|
65
|
+
- **Implementation Completeness**: Anti-fake implementation guardrails with sophisticated TODO detection
|
|
66
|
+
- **Language-Agnostic Standards**: Universal patterns across all programming languages with complexity metrics
|
|
67
|
+
- **Duplication Prevention**: Canonical naming enforcement and refactor strategies (merge-then-delete)
|
|
68
|
+
|
|
69
|
+
### Development Workflow Standards
|
|
70
|
+
|
|
71
|
+
- **Working Style**: Risk-based edit principles with targeted edit plans for complex changes
|
|
72
|
+
- **Quality Gates**: Execution discipline, commit hygiene, and automated enforcement
|
|
73
|
+
- **Safe Defaults**: Guard clauses, early returns, and defensive programming patterns
|
|
74
|
+
- **Process Operations**: Server management, hung command handling, and development discipline
|
|
75
|
+
|
|
76
|
+
### Code Quality & Architecture
|
|
77
|
+
|
|
78
|
+
- **SOLID Principles**: Single responsibility, open-closed, Liskov substitution, interface segregation, dependency inversion
|
|
79
|
+
- **TypeScript Conventions**: Alias imports, const preferences, and type system management
|
|
80
|
+
- **Documentation Standards**: Language-specific docstring formats and comprehensive API documentation
|
|
81
|
+
- **Authorship & Attribution**: File headers, authorship tracking, and contribution standards
|
|
82
|
+
|
|
83
|
+
### Risk-Based Enforcement
|
|
84
|
+
|
|
85
|
+
- **Tier 1 (Critical Systems)**: 90%+ coverage, 95%+ branch, 70%+ mutation, manual review required
|
|
86
|
+
- **Tier 2 (Standard Features)**: 80%+ coverage, 90%+ branch, 50%+ mutation, optional review
|
|
87
|
+
- **Tier 3 (Low Risk)**: 70%+ coverage, 80%+ branch, 30%+ mutation, optional review
|
|
88
|
+
|
|
89
|
+
### Integration with Existing Tooling
|
|
90
|
+
|
|
91
|
+
- **TODO Analysis**: Sophisticated detection with confidence scoring and context-aware analysis
|
|
92
|
+
- **CAWS Workflow**: Seamless integration with CAWS validation, testing, and quality gates
|
|
93
|
+
- **Automated Detection**: Ripgrep patterns for banned naming, incomplete implementations, and quality violations
|
|
94
|
+
|
|
95
|
+
## Key Features
|
|
96
|
+
|
|
97
|
+
### Sophisticated TODO Detection
|
|
98
|
+
|
|
99
|
+
- **Context-aware analysis** with confidence scoring (0.0-1.0)
|
|
100
|
+
- **Language-specific patterns** for 13+ languages including Rust, Python, JavaScript, TypeScript
|
|
101
|
+
- **Code stub detection** beyond just comments (detects `pass`, `...`, `NotImplementedError`, etc.)
|
|
102
|
+
- **Dependency resolution** for staged files with blocking analysis
|
|
103
|
+
- **Sophisticated exclusion patterns** to prevent false positives
|
|
104
|
+
|
|
105
|
+
### Risk-Based Quality Gates
|
|
106
|
+
|
|
107
|
+
- **Tier 1 (Critical)**: Auth, billing, migrations - 90%+ coverage, 70%+ mutation, manual review
|
|
108
|
+
- **Tier 2 (Standard)**: Features, APIs, data writes - 80%+ coverage, 50%+ mutation, optional review
|
|
109
|
+
- **Tier 3 (Low Risk)**: UI, internal tools - 70%+ coverage, 30%+ mutation, optional review
|
|
110
|
+
|
|
111
|
+
### Emergency Procedures
|
|
112
|
+
|
|
113
|
+
- **Scope Management**: Change budget enforcement with automatic detection
|
|
114
|
+
- **Waiver System**: Structured procedures for critical fixes outside scope
|
|
115
|
+
- **Critical Fix Protocols**: Emergency override conditions with proper documentation
|
|
116
|
+
|
|
117
|
+
### Anti-Pattern Prevention
|
|
118
|
+
|
|
119
|
+
- **Banned Naming**: Prevents `enhanced-*`, `new-*`, `final-*` duplicate patterns
|
|
120
|
+
- **Implementation Completeness**: Detects fake persistence, stub APIs, placeholder business logic
|
|
121
|
+
- **Documentation Reality**: Ensures documented features actually work
|
|
122
|
+
|
|
123
|
+
## Usage
|
|
124
|
+
|
|
125
|
+
Cursor automatically loads these rules from `.cursor/rules/`. View active rules in Cursor's sidebar.
|
|
126
|
+
|
|
127
|
+
To disable a rule temporarily: Cursor Settings → Rules → Toggle specific rule
|
|
128
|
+
|
|
129
|
+
## Integration with CAWS Workflow
|
|
130
|
+
|
|
131
|
+
These rules complement CAWS tools and existing project tooling:
|
|
132
|
+
|
|
133
|
+
- **Validation**: `caws validate` checks rule compliance and working spec validity
|
|
134
|
+
- **Testing**: Rules guide comprehensive testing requirements with coverage thresholds
|
|
135
|
+
- **Quality Gates**: Automated enforcement of standards with risk-based tiers
|
|
136
|
+
- **Documentation**: Ensures docs match implementation reality with engineering-grade standards
|
|
137
|
+
- **TODO Analysis**: Sophisticated hidden TODO detection with confidence scoring
|
|
138
|
+
- **Scope Management**: Change budget enforcement with emergency waiver procedures
|
|
139
|
+
- **Implementation Completeness**: Anti-fake implementation guardrails with stub detection
|
|
140
|
+
|
|
141
|
+
## Continuous Improvement
|
|
142
|
+
|
|
143
|
+
Rules are regularly updated based on:
|
|
144
|
+
|
|
145
|
+
- Industry best practices
|
|
146
|
+
- CAWS user feedback
|
|
147
|
+
- Production incident analysis
|
|
148
|
+
- Security research and compliance updates
|
|
149
|
+
|
|
150
|
+
For questions about these rules, see the main CAWS documentation or contact the CAWS team.
|