@63klabs/cache-data 1.3.6 → 1.3.7
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/CHANGELOG.md +20 -3
- package/CONTRIBUTING.md +18 -12
- package/package.json +5 -1
- package/src/lib/dao-cache.js +137 -11
- package/AI_CONTEXT.md +0 -863
- package/scripts/README.md +0 -175
- package/scripts/audit-documentation.mjs +0 -856
- package/scripts/review-documentation-files.mjs +0 -406
- package/scripts/setup-dev-environment.sh +0 -59
- package/scripts/verify-example-files.mjs +0 -194
package/scripts/README.md
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# Documentation Validation Scripts
|
|
2
|
-
|
|
3
|
-
This directory contains scripts for validating and auditing documentation in the @63klabs/cache-data package.
|
|
4
|
-
|
|
5
|
-
## Scripts
|
|
6
|
-
|
|
7
|
-
### audit-documentation.mjs
|
|
8
|
-
|
|
9
|
-
Comprehensive documentation audit and validation script that checks:
|
|
10
|
-
|
|
11
|
-
- **JSDoc Completeness**: Ensures all exported functions have complete JSDoc with required tags (@param, @returns, @example)
|
|
12
|
-
- **JSDoc Accuracy**: Verifies that documented parameters match actual function signatures
|
|
13
|
-
- **Link Validation**: Checks all links in documentation files to ensure they point to existing files
|
|
14
|
-
- **Example Code Validation**: Validates that JavaScript code examples have correct syntax
|
|
15
|
-
|
|
16
|
-
#### Usage
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
node scripts/audit-documentation.mjs
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
#### Output
|
|
23
|
-
|
|
24
|
-
The script generates a detailed report at:
|
|
25
|
-
```
|
|
26
|
-
.kiro/specs/1-3-6-documentation-enhancement/audit-report.json
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
The report includes:
|
|
30
|
-
- Summary statistics (coverage percentages, error counts)
|
|
31
|
-
- List of functions missing JSDoc
|
|
32
|
-
- List of functions with incomplete JSDoc
|
|
33
|
-
- List of functions with inaccurate JSDoc (hallucinated parameters)
|
|
34
|
-
- List of broken links in documentation
|
|
35
|
-
- List of invalid code examples
|
|
36
|
-
|
|
37
|
-
#### Exit Codes
|
|
38
|
-
|
|
39
|
-
- `0`: All validation checks passed
|
|
40
|
-
- `1`: Critical errors found (missing JSDoc, inaccurate JSDoc, broken links, or invalid examples)
|
|
41
|
-
|
|
42
|
-
### Pre-Commit Hook
|
|
43
|
-
|
|
44
|
-
A Git pre-commit hook is installed at `.git/hooks/pre-commit` that automatically runs documentation validation before each commit.
|
|
45
|
-
|
|
46
|
-
#### How It Works
|
|
47
|
-
|
|
48
|
-
1. When you run `git commit`, the hook automatically executes
|
|
49
|
-
2. It runs `audit-documentation.mjs` to validate all documentation
|
|
50
|
-
3. If critical errors are found, the commit is blocked
|
|
51
|
-
4. You must fix the errors before committing
|
|
52
|
-
|
|
53
|
-
#### Bypassing the Hook
|
|
54
|
-
|
|
55
|
-
If you need to commit despite validation errors (not recommended):
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
git commit --no-verify
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
#### Installing the Hook
|
|
62
|
-
|
|
63
|
-
The hook is automatically created when task 16.3 is completed. If you need to reinstall it:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
chmod +x .git/hooks/pre-commit
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Validation Requirements
|
|
70
|
-
|
|
71
|
-
### JSDoc Requirements
|
|
72
|
-
|
|
73
|
-
All exported functions, methods, and classes must have:
|
|
74
|
-
|
|
75
|
-
1. **Description**: Clear explanation of what the function does
|
|
76
|
-
2. **@param tags**: For each parameter, with type and description
|
|
77
|
-
3. **@returns tag**: With detailed type information and description
|
|
78
|
-
4. **@example tag**: Demonstrating typical usage
|
|
79
|
-
5. **@throws tag**: If the function can throw errors (optional but recommended)
|
|
80
|
-
|
|
81
|
-
### Type Annotation Standards
|
|
82
|
-
|
|
83
|
-
- Promises: `{Promise<ResolvedType>}`
|
|
84
|
-
- Arrays: `{Array.<ElementType>}`
|
|
85
|
-
- Objects: `{Object.<string, Type>}` or detailed property list
|
|
86
|
-
- Complex returns: `{Promise<{prop1: Type1, prop2: Type2}>}`
|
|
87
|
-
- Optional parameters: `{Type} [paramName=default]`
|
|
88
|
-
- Union types: `{Type1|Type2}`
|
|
89
|
-
|
|
90
|
-
### Example Code Standards
|
|
91
|
-
|
|
92
|
-
All JavaScript code examples in documentation must:
|
|
93
|
-
|
|
94
|
-
- Have valid syntax (pass Node.js syntax check)
|
|
95
|
-
- Include necessary imports if using package functionality
|
|
96
|
-
- Not use deprecated APIs
|
|
97
|
-
- Be executable or clearly marked as snippets
|
|
98
|
-
|
|
99
|
-
### Link Standards
|
|
100
|
-
|
|
101
|
-
All links in documentation must:
|
|
102
|
-
|
|
103
|
-
- Point to existing files for internal links
|
|
104
|
-
- Be valid URLs for external links
|
|
105
|
-
- Use relative paths for internal documentation
|
|
106
|
-
|
|
107
|
-
## Common Issues and Fixes
|
|
108
|
-
|
|
109
|
-
### Missing JSDoc
|
|
110
|
-
|
|
111
|
-
**Issue**: Function has no JSDoc comment
|
|
112
|
-
|
|
113
|
-
**Fix**: Add a JSDoc comment block above the function:
|
|
114
|
-
|
|
115
|
-
```javascript
|
|
116
|
-
/**
|
|
117
|
-
* Description of what the function does
|
|
118
|
-
*
|
|
119
|
-
* @param {Type} paramName - Description of parameter
|
|
120
|
-
* @returns {ReturnType} Description of return value
|
|
121
|
-
* @example
|
|
122
|
-
* // Example usage
|
|
123
|
-
* const result = functionName(param);
|
|
124
|
-
*/
|
|
125
|
-
function functionName(paramName) {
|
|
126
|
-
// ...
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Incomplete JSDoc
|
|
131
|
-
|
|
132
|
-
**Issue**: JSDoc is missing required tags
|
|
133
|
-
|
|
134
|
-
**Fix**: Add the missing tags (@param, @returns, @example)
|
|
135
|
-
|
|
136
|
-
### Inaccurate JSDoc
|
|
137
|
-
|
|
138
|
-
**Issue**: JSDoc documents parameters that don't exist in the function signature
|
|
139
|
-
|
|
140
|
-
**Fix**: Update JSDoc to match the actual function signature, or update the function signature if JSDoc is correct
|
|
141
|
-
|
|
142
|
-
### Broken Links
|
|
143
|
-
|
|
144
|
-
**Issue**: Documentation contains links to non-existent files
|
|
145
|
-
|
|
146
|
-
**Fix**: Update the link to point to the correct file, or create the missing file
|
|
147
|
-
|
|
148
|
-
### Invalid Code Examples
|
|
149
|
-
|
|
150
|
-
**Issue**: Code example has syntax errors
|
|
151
|
-
|
|
152
|
-
**Fix**: Correct the syntax error, or mark the code as a snippet if it's intentionally incomplete
|
|
153
|
-
|
|
154
|
-
## Integration with CI/CD
|
|
155
|
-
|
|
156
|
-
To integrate documentation validation into your CI/CD pipeline:
|
|
157
|
-
|
|
158
|
-
```yaml
|
|
159
|
-
# Example GitHub Actions workflow
|
|
160
|
-
- name: Validate Documentation
|
|
161
|
-
run: node scripts/audit-documentation.mjs
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
The script will exit with code 1 if validation fails, causing the CI/CD pipeline to fail.
|
|
165
|
-
|
|
166
|
-
## Maintenance
|
|
167
|
-
|
|
168
|
-
The validation script should be updated when:
|
|
169
|
-
|
|
170
|
-
- New JSDoc requirements are added
|
|
171
|
-
- New documentation standards are established
|
|
172
|
-
- New types of validation checks are needed
|
|
173
|
-
- Deprecated APIs change
|
|
174
|
-
|
|
175
|
-
See `.kiro/specs/1-3-6-documentation-enhancement/STEERING.md` for documentation standards and maintenance procedures.
|