@bradtaylorsf/alpha-loop 1.0.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/LICENSE +21 -0
- package/README.md +294 -0
- package/agents/implementer.md +30 -0
- package/agents/reviewer.md +29 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +57 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/auth.d.ts +1 -0
- package/dist/commands/auth.js +89 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/history.d.ts +8 -0
- package/dist/commands/history.js +185 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +241 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.js +321 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/scan.d.ts +1 -0
- package/dist/commands/scan.js +50 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/sync.d.ts +20 -0
- package/dist/commands/sync.js +149 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/vision.d.ts +1 -0
- package/dist/commands/vision.js +194 -0
- package/dist/commands/vision.js.map +1 -0
- package/dist/engine/agents.d.ts +41 -0
- package/dist/engine/agents.js +90 -0
- package/dist/engine/agents.js.map +1 -0
- package/dist/engine/config.d.ts +71 -0
- package/dist/engine/config.js +73 -0
- package/dist/engine/config.js.map +1 -0
- package/dist/engine/prerequisites.d.ts +34 -0
- package/dist/engine/prerequisites.js +90 -0
- package/dist/engine/prerequisites.js.map +1 -0
- package/dist/lib/agent.d.ts +25 -0
- package/dist/lib/agent.js +97 -0
- package/dist/lib/agent.js.map +1 -0
- package/dist/lib/config.d.ts +35 -0
- package/dist/lib/config.js +179 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/context.d.ts +17 -0
- package/dist/lib/context.js +96 -0
- package/dist/lib/context.js.map +1 -0
- package/dist/lib/github.d.ts +61 -0
- package/dist/lib/github.js +313 -0
- package/dist/lib/github.js.map +1 -0
- package/dist/lib/learning.d.ts +43 -0
- package/dist/lib/learning.js +207 -0
- package/dist/lib/learning.js.map +1 -0
- package/dist/lib/logger.d.ts +9 -0
- package/dist/lib/logger.js +28 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/pipeline.d.ts +18 -0
- package/dist/lib/pipeline.js +456 -0
- package/dist/lib/pipeline.js.map +1 -0
- package/dist/lib/preflight.d.ts +33 -0
- package/dist/lib/preflight.js +123 -0
- package/dist/lib/preflight.js.map +1 -0
- package/dist/lib/prerequisites.d.ts +12 -0
- package/dist/lib/prerequisites.js +54 -0
- package/dist/lib/prerequisites.js.map +1 -0
- package/dist/lib/prompts.d.ts +44 -0
- package/dist/lib/prompts.js +102 -0
- package/dist/lib/prompts.js.map +1 -0
- package/dist/lib/session.d.ts +28 -0
- package/dist/lib/session.js +173 -0
- package/dist/lib/session.js.map +1 -0
- package/dist/lib/shell.d.ts +32 -0
- package/dist/lib/shell.js +95 -0
- package/dist/lib/shell.js.map +1 -0
- package/dist/lib/testing.d.ts +10 -0
- package/dist/lib/testing.js +51 -0
- package/dist/lib/testing.js.map +1 -0
- package/dist/lib/verify.d.ts +18 -0
- package/dist/lib/verify.js +235 -0
- package/dist/lib/verify.js.map +1 -0
- package/dist/lib/vision.d.ts +9 -0
- package/dist/lib/vision.js +21 -0
- package/dist/lib/vision.js.map +1 -0
- package/dist/lib/worktree.d.ts +29 -0
- package/dist/lib/worktree.js +153 -0
- package/dist/lib/worktree.js.map +1 -0
- package/package.json +63 -0
- package/templates/agents/implementer.md +34 -0
- package/templates/agents/reviewer.md +48 -0
- package/templates/skills/code-review/SKILL.md +58 -0
- package/templates/skills/git-workflow/SKILL.md +53 -0
- package/templates/skills/implementation-planning/SKILL.md +64 -0
- package/templates/skills/security-analysis/SKILL.md +560 -0
- package/templates/skills/security-analysis/scripts/security-scanner.sh +227 -0
- package/templates/skills/test-robustness/SKILL.md +897 -0
- package/templates/skills/testing-patterns/SKILL.md +75 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: testing-patterns
|
|
3
|
+
description: TDD patterns, Jest testing conventions, and test quality standards. Use when writing any tests.
|
|
4
|
+
auto_load: true
|
|
5
|
+
priority: high
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Testing Patterns Skill
|
|
9
|
+
|
|
10
|
+
## Trigger
|
|
11
|
+
When writing tests or implementing features that need tests.
|
|
12
|
+
|
|
13
|
+
## TDD Flow
|
|
14
|
+
|
|
15
|
+
1. **Red**: Write a failing test first
|
|
16
|
+
2. **Green**: Write minimal code to pass
|
|
17
|
+
3. **Refactor**: Clean up while tests stay green
|
|
18
|
+
|
|
19
|
+
## Test Structure
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
describe('ModuleName', () => {
|
|
23
|
+
describe('functionName', () => {
|
|
24
|
+
it('should do expected behavior when given input', () => {
|
|
25
|
+
// Arrange
|
|
26
|
+
const input = createTestInput();
|
|
27
|
+
|
|
28
|
+
// Act
|
|
29
|
+
const result = functionName(input);
|
|
30
|
+
|
|
31
|
+
// Assert
|
|
32
|
+
expect(result).toEqual(expectedOutput);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should throw when given invalid input', () => {
|
|
36
|
+
expect(() => functionName(null)).toThrow();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Rules
|
|
43
|
+
|
|
44
|
+
### Naming
|
|
45
|
+
- Describe behavior, not implementation
|
|
46
|
+
- Good: `should return 404 when user not found`
|
|
47
|
+
- Bad: `test getUserById`
|
|
48
|
+
|
|
49
|
+
### Isolation
|
|
50
|
+
- Each test is independent (no shared mutable state)
|
|
51
|
+
- Use `beforeEach` for setup, not `beforeAll` for mutable state
|
|
52
|
+
- Clean up after tests (close connections, clear timers)
|
|
53
|
+
|
|
54
|
+
### Mocking
|
|
55
|
+
- Mock external dependencies (APIs, databases, file system)
|
|
56
|
+
- Don't mock the thing you're testing
|
|
57
|
+
- Use `jest.mock()` at module level, `jest.spyOn()` for specific methods
|
|
58
|
+
- Reset mocks between tests: `jest.restoreAllMocks()` in `afterEach`
|
|
59
|
+
|
|
60
|
+
### What to Test
|
|
61
|
+
- Happy path (expected input -> expected output)
|
|
62
|
+
- Error cases (invalid input, missing data, network failures)
|
|
63
|
+
- Edge cases (empty arrays, null values, boundary conditions)
|
|
64
|
+
- Integration points (API endpoints with supertest)
|
|
65
|
+
|
|
66
|
+
### What NOT to Test
|
|
67
|
+
- Third-party library internals
|
|
68
|
+
- TypeScript type checking (the compiler does this)
|
|
69
|
+
- Simple getters/setters with no logic
|
|
70
|
+
|
|
71
|
+
### Anti-Patterns to Avoid
|
|
72
|
+
- No `waitForTimeout()` or `sleep()` in tests
|
|
73
|
+
- No hardcoded test IDs that depend on database state
|
|
74
|
+
- No tests that depend on execution order
|
|
75
|
+
- No `any` type assertions to make tests pass
|