omgkit 2.22.7 → 2.22.8
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/lib/cli.js +2 -1
- package/package.json +1 -1
- package/plugin/registry.yaml +2 -2
- package/templates/CLAUDE.md +11 -0
- package/templates/stdrules/TESTING_STANDARDS.md +271 -0
package/lib/cli.js
CHANGED
|
@@ -396,7 +396,8 @@ export function initProject(options = {}) {
|
|
|
396
396
|
{ src: 'devlogs/README.md', dest: '.omgkit/devlogs/README.md' },
|
|
397
397
|
{ src: 'stdrules/README.md', dest: '.omgkit/stdrules/README.md' },
|
|
398
398
|
{ src: 'stdrules/SKILL_STANDARDS.md', dest: '.omgkit/stdrules/SKILL_STANDARDS.md' },
|
|
399
|
-
{ src: 'stdrules/BEFORE_COMMIT.md', dest: '.omgkit/stdrules/BEFORE_COMMIT.md' }
|
|
399
|
+
{ src: 'stdrules/BEFORE_COMMIT.md', dest: '.omgkit/stdrules/BEFORE_COMMIT.md' },
|
|
400
|
+
{ src: 'stdrules/TESTING_STANDARDS.md', dest: '.omgkit/stdrules/TESTING_STANDARDS.md' }
|
|
400
401
|
];
|
|
401
402
|
|
|
402
403
|
templates.forEach(({ src, dest }) => {
|
package/package.json
CHANGED
package/plugin/registry.yaml
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# OMGKIT Component Registry
|
|
2
2
|
# Single Source of Truth for Agents, Skills, Commands, Workflows, and MCPs
|
|
3
|
-
# Version: 2.22.
|
|
3
|
+
# Version: 2.22.8
|
|
4
4
|
# Updated: 2026-01-03
|
|
5
5
|
|
|
6
|
-
version: "2.22.
|
|
6
|
+
version: "2.22.8"
|
|
7
7
|
|
|
8
8
|
# =============================================================================
|
|
9
9
|
# OPTIMIZED ALIGNMENT PRINCIPLE (OAP)
|
package/templates/CLAUDE.md
CHANGED
|
@@ -12,10 +12,21 @@ This project uses **OMGKIT** - an AI Team System for Claude Code with 23 Agents,
|
|
|
12
12
|
├── sprints/ # Sprint management files
|
|
13
13
|
│ ├── vision.yaml # Product vision and goals
|
|
14
14
|
│ └── backlog.yaml # Product backlog items
|
|
15
|
+
├── stdrules/ # Standards and rules (MUST READ)
|
|
16
|
+
│ ├── TESTING_STANDARDS.md # Testing methodology
|
|
17
|
+
│ └── BEFORE_COMMIT.md # Pre-commit checklist
|
|
15
18
|
├── devlogs/ # Development logs (git-ignored)
|
|
16
19
|
└── settings.json # Local settings
|
|
17
20
|
```
|
|
18
21
|
|
|
22
|
+
## MANDATORY: Read Before Tasks
|
|
23
|
+
|
|
24
|
+
| Task Type | Read First |
|
|
25
|
+
|-----------|------------|
|
|
26
|
+
| Writing Tests | `.omgkit/stdrules/TESTING_STANDARDS.md` |
|
|
27
|
+
| Before Commit | `.omgkit/stdrules/BEFORE_COMMIT.md` |
|
|
28
|
+
| New Feature | `.omgkit/config.yaml` for project settings |
|
|
29
|
+
|
|
19
30
|
## Development Workflow Rules
|
|
20
31
|
|
|
21
32
|
### `.omgkit/devlogs/` Folder
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# OMGKIT Testing Standards
|
|
2
|
+
|
|
3
|
+
This document defines the testing philosophy and standards for this project. Claude Code MUST follow these guidelines when writing tests.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Core Philosophy
|
|
8
|
+
|
|
9
|
+
### F.I.R.S.T. Principles (MANDATORY)
|
|
10
|
+
|
|
11
|
+
| Principle | Requirement | Example |
|
|
12
|
+
|-----------|-------------|---------|
|
|
13
|
+
| **Fast** | Unit tests < 1ms, Integration < 100ms | Use mocks for slow dependencies |
|
|
14
|
+
| **Independent** | Tests don't share state | Fresh setup for each test |
|
|
15
|
+
| **Repeatable** | Same result every run | No random data, no time-dependent logic |
|
|
16
|
+
| **Self-Validating** | Clear pass/fail | Explicit assertions, no manual inspection |
|
|
17
|
+
| **Timely** | Write with code (TDD preferred) | Test before or during implementation |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 4D Testing Methodology
|
|
22
|
+
|
|
23
|
+
Every feature MUST be tested across 4 dimensions:
|
|
24
|
+
|
|
25
|
+
### 1. Accuracy Testing
|
|
26
|
+
```javascript
|
|
27
|
+
// REQUIRED: Unit tests for all functions
|
|
28
|
+
describe('functionName', () => {
|
|
29
|
+
// Happy path
|
|
30
|
+
it('should handle normal input correctly', () => {});
|
|
31
|
+
|
|
32
|
+
// Edge cases (MANDATORY)
|
|
33
|
+
it('should handle empty input', () => {});
|
|
34
|
+
it('should handle null/undefined', () => {});
|
|
35
|
+
it('should handle boundary values', () => {});
|
|
36
|
+
|
|
37
|
+
// Error cases
|
|
38
|
+
it('should throw on invalid input', () => {});
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Performance Testing
|
|
43
|
+
```javascript
|
|
44
|
+
// REQUIRED for critical paths
|
|
45
|
+
it('should complete within SLA', async () => {
|
|
46
|
+
const start = performance.now();
|
|
47
|
+
await operation();
|
|
48
|
+
expect(performance.now() - start).toBeLessThan(100); // 100ms max
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3. Security Testing
|
|
53
|
+
```javascript
|
|
54
|
+
// REQUIRED for user input handling
|
|
55
|
+
const MALICIOUS_INPUTS = [
|
|
56
|
+
"'; DROP TABLE users; --", // SQL injection
|
|
57
|
+
"<script>alert('xss')</script>", // XSS
|
|
58
|
+
"../../../etc/passwd", // Path traversal
|
|
59
|
+
"{{constructor.constructor('return this')()}}", // Prototype pollution
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
MALICIOUS_INPUTS.forEach(input => {
|
|
63
|
+
it(`should sanitize: ${input.slice(0, 20)}...`, () => {
|
|
64
|
+
expect(() => processInput(input)).not.toThrow();
|
|
65
|
+
expect(processInput(input)).not.toContain(input);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 4. Accessibility Testing (for UI)
|
|
71
|
+
```javascript
|
|
72
|
+
// REQUIRED for all UI components
|
|
73
|
+
it('should be keyboard accessible', () => {});
|
|
74
|
+
it('should have proper ARIA labels', () => {});
|
|
75
|
+
it('should meet WCAG AA contrast', () => {});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Boundary Value Testing (MANDATORY)
|
|
81
|
+
|
|
82
|
+
Always test these boundaries:
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// Numbers
|
|
86
|
+
const BOUNDARY_NUMBERS = [
|
|
87
|
+
0, -0, 1, -1,
|
|
88
|
+
Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER,
|
|
89
|
+
Number.MAX_VALUE, Number.MIN_VALUE,
|
|
90
|
+
Infinity, -Infinity, NaN
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
// Strings
|
|
94
|
+
const BOUNDARY_STRINGS = [
|
|
95
|
+
'', ' ', ' ',
|
|
96
|
+
'a'.repeat(10000), // Very long
|
|
97
|
+
'\n\t\r', // Whitespace
|
|
98
|
+
'🔮💀', // Unicode/emoji
|
|
99
|
+
'\x00\x01', // Control chars
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
// Arrays
|
|
103
|
+
const BOUNDARY_ARRAYS = [
|
|
104
|
+
[], [null], [undefined],
|
|
105
|
+
new Array(10000).fill(0), // Large array
|
|
106
|
+
[1, [2, [3]]], // Nested
|
|
107
|
+
];
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## "Naughty" Data Patterns
|
|
113
|
+
|
|
114
|
+
When testing user input, ALWAYS include:
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
const NAUGHTY_STRINGS = [
|
|
118
|
+
// Injection attacks
|
|
119
|
+
"'; DROP TABLE users; --",
|
|
120
|
+
"1; UPDATE users SET role='admin'",
|
|
121
|
+
|
|
122
|
+
// XSS attacks
|
|
123
|
+
"<script>alert('xss')</script>",
|
|
124
|
+
"<img src=x onerror=alert('xss')>",
|
|
125
|
+
"javascript:alert('xss')",
|
|
126
|
+
|
|
127
|
+
// Format strings
|
|
128
|
+
"%s%s%s%s%s",
|
|
129
|
+
"{0}{1}{2}",
|
|
130
|
+
|
|
131
|
+
// Unicode edge cases
|
|
132
|
+
"Ω≈ç√∫",
|
|
133
|
+
"田中さんにあげて下さい",
|
|
134
|
+
"表ポあA鳥唐",
|
|
135
|
+
|
|
136
|
+
// Null bytes
|
|
137
|
+
"test\x00hidden",
|
|
138
|
+
|
|
139
|
+
// Path traversal
|
|
140
|
+
"../../../etc/passwd",
|
|
141
|
+
"....//....//etc/passwd",
|
|
142
|
+
];
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Test Structure
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
tests/
|
|
151
|
+
├── unit/ # Fast, isolated tests
|
|
152
|
+
│ ├── *.test.ts # Co-located or separate
|
|
153
|
+
├── integration/ # Component interaction
|
|
154
|
+
│ ├── api.integration.ts
|
|
155
|
+
│ ├── db.integration.ts
|
|
156
|
+
├── e2e/ # Full user flows
|
|
157
|
+
│ ├── checkout.e2e.ts
|
|
158
|
+
├── security/ # Security-specific
|
|
159
|
+
│ ├── injection.test.ts
|
|
160
|
+
│ ├── auth.test.ts
|
|
161
|
+
└── performance/ # Performance benchmarks
|
|
162
|
+
├── benchmarks.test.ts
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Coverage Requirements
|
|
168
|
+
|
|
169
|
+
| Type | Minimum | Target |
|
|
170
|
+
|------|---------|--------|
|
|
171
|
+
| Statements | 80% | 90% |
|
|
172
|
+
| Branches | 75% | 85% |
|
|
173
|
+
| Functions | 80% | 90% |
|
|
174
|
+
| Lines | 80% | 90% |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Property-Based Testing
|
|
179
|
+
|
|
180
|
+
For complex logic, use property-based testing:
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
import { fc } from 'fast-check';
|
|
184
|
+
|
|
185
|
+
// Instead of specific examples, test properties
|
|
186
|
+
test('sort is idempotent', () => {
|
|
187
|
+
fc.assert(
|
|
188
|
+
fc.property(fc.array(fc.integer()), (arr) => {
|
|
189
|
+
const sorted = sort(arr);
|
|
190
|
+
return JSON.stringify(sort(sorted)) === JSON.stringify(sorted);
|
|
191
|
+
})
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('reverse is its own inverse', () => {
|
|
196
|
+
fc.assert(
|
|
197
|
+
fc.property(fc.array(fc.anything()), (arr) => {
|
|
198
|
+
return JSON.stringify(reverse(reverse(arr))) === JSON.stringify(arr);
|
|
199
|
+
})
|
|
200
|
+
);
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Anti-Patterns (AVOID)
|
|
207
|
+
|
|
208
|
+
1. **Testing Implementation** - Test behavior, not internal details
|
|
209
|
+
2. **Flaky Tests** - No random, no timing-dependent
|
|
210
|
+
3. **Over-Mocking** - Don't mock everything
|
|
211
|
+
4. **Copy-Paste Tests** - Use `it.each()` or `describe.each()`
|
|
212
|
+
5. **No Assertions** - Every test MUST assert
|
|
213
|
+
6. **Ignoring Edge Cases** - Boundaries are where bugs hide
|
|
214
|
+
7. **Massive Test Files** - Split by functionality
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Mutation Testing (Quality Check)
|
|
219
|
+
|
|
220
|
+
Run mutation testing to verify test quality:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npx stryker run
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Target: **Mutation score > 80%**
|
|
227
|
+
|
|
228
|
+
If tests pass but mutations survive, tests are too weak.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## When Claude Code Writes Tests
|
|
233
|
+
|
|
234
|
+
Claude Code MUST:
|
|
235
|
+
|
|
236
|
+
1. **Read this file first** when asked to write tests
|
|
237
|
+
2. **Apply 4D methodology** - not just happy path
|
|
238
|
+
3. **Include boundary values** from this document
|
|
239
|
+
4. **Test security** for any user input
|
|
240
|
+
5. **Use property-based testing** for complex logic
|
|
241
|
+
6. **Check coverage** after writing tests
|
|
242
|
+
7. **Run mutation testing** if available
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Quick Reference
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
// Minimum test template for any function
|
|
250
|
+
describe('functionName', () => {
|
|
251
|
+
// 1. Happy path
|
|
252
|
+
it('should work with valid input', () => {});
|
|
253
|
+
|
|
254
|
+
// 2. Edge cases
|
|
255
|
+
it('should handle empty/null/undefined', () => {});
|
|
256
|
+
it('should handle boundary values', () => {});
|
|
257
|
+
|
|
258
|
+
// 3. Error handling
|
|
259
|
+
it('should throw/return error for invalid input', () => {});
|
|
260
|
+
|
|
261
|
+
// 4. Security (if user input)
|
|
262
|
+
it('should sanitize malicious input', () => {});
|
|
263
|
+
|
|
264
|
+
// 5. Performance (if critical path)
|
|
265
|
+
it('should complete within SLA', () => {});
|
|
266
|
+
});
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
*Think Omega. Test Omega. Be Omega.* 🔮
|