cast-code 1.0.5 → 1.0.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/dist/common/services/multi-llm.service.js +19 -0
- package/dist/common/services/multi-llm.service.js.map +1 -1
- package/dist/modules/config/services/config-commands.service.js +86 -6
- package/dist/modules/config/services/config-commands.service.js.map +1 -1
- package/dist/modules/config/types/config.types.js +5 -0
- package/dist/modules/config/types/config.types.js.map +1 -1
- package/dist/modules/config/types/config.types.spec.js +60 -0
- package/dist/modules/config/types/config.types.spec.js.map +1 -0
- package/dist/modules/core/services/deep-agent.service.js +40 -4
- package/dist/modules/core/services/deep-agent.service.js.map +1 -1
- package/dist/modules/git/git.module.js +5 -2
- package/dist/modules/git/git.module.js.map +1 -1
- package/dist/modules/git/git.module.spec.js +54 -0
- package/dist/modules/git/git.module.spec.js.map +1 -0
- package/dist/modules/git/services/pr-generator.service.js +70 -69
- package/dist/modules/git/services/pr-generator.service.js.map +1 -1
- package/dist/modules/git/services/unit-test-generator.service.js +557 -0
- package/dist/modules/git/services/unit-test-generator.service.js.map +1 -0
- package/dist/modules/git/services/unit-test-generator.service.spec.js +119 -0
- package/dist/modules/git/services/unit-test-generator.service.spec.js.map +1 -0
- package/dist/modules/repl/services/commands/git-commands.service.js +97 -2
- package/dist/modules/repl/services/commands/git-commands.service.js.map +1 -1
- package/dist/modules/repl/services/commands/repl-commands.service.js +1 -0
- package/dist/modules/repl/services/commands/repl-commands.service.js.map +1 -1
- package/dist/modules/repl/services/commands/repl-commands.service.spec.js +69 -0
- package/dist/modules/repl/services/commands/repl-commands.service.spec.js.map +1 -0
- package/dist/modules/repl/services/repl.service.js +11 -1
- package/dist/modules/repl/services/repl.service.js.map +1 -1
- package/dist/modules/repl/services/repl.service.spec.js +137 -0
- package/dist/modules/repl/services/repl.service.spec.js.map +1 -0
- package/package.json +1 -1
- package/dist/modules/agents/definitions/architect.md +0 -35
- package/dist/modules/agents/definitions/backend.md +0 -43
- package/dist/modules/agents/definitions/coder.md +0 -34
- package/dist/modules/agents/definitions/devops.md +0 -42
- package/dist/modules/agents/definitions/frontend.md +0 -46
- package/dist/modules/agents/definitions/reviewer.md +0 -35
- package/dist/modules/agents/definitions/tester.md +0 -41
- package/dist/modules/skills/definitions/general/file-operations.md +0 -60
- package/dist/modules/skills/definitions/general/git-operations.md +0 -59
- package/dist/modules/skills/definitions/general/planning.md +0 -86
- package/dist/modules/skills/definitions/general/search.md +0 -59
- package/dist/modules/skills/definitions/specialized/api-design.md +0 -85
- package/dist/modules/skills/definitions/specialized/database-operations.md +0 -78
- package/dist/modules/skills/definitions/specialized/frontend-bootstrap.md +0 -71
- package/dist/modules/skills/definitions/specialized/react-patterns.md +0 -77
- package/dist/modules/skills/definitions/specialized/testing-strategies.md +0 -79
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: database-operations
|
|
3
|
-
description: Database design and query optimization
|
|
4
|
-
tools:
|
|
5
|
-
- read_file
|
|
6
|
-
- write_file
|
|
7
|
-
- edit_file
|
|
8
|
-
- shell
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Database Operations — Domain Knowledge
|
|
12
|
-
|
|
13
|
-
This skill teaches you database design, query optimization, and safe migration practices. Study this to make good data modeling decisions.
|
|
14
|
-
|
|
15
|
-
## Schema Design Principles
|
|
16
|
-
|
|
17
|
-
### Normalization Rules
|
|
18
|
-
- **1NF**: Atomic values, no repeating groups
|
|
19
|
-
- **2NF**: No partial dependencies on composite keys
|
|
20
|
-
- **3NF**: No transitive dependencies
|
|
21
|
-
|
|
22
|
-
### When to Denormalize
|
|
23
|
-
| Situation | Denormalize? | Technique |
|
|
24
|
-
|-----------|-------------|-----------|
|
|
25
|
-
| Read-heavy, write-rare | Yes | Materialized view / computed column |
|
|
26
|
-
| Reporting/analytics | Yes | Star schema / denormalized table |
|
|
27
|
-
| Real-time dashboard | Yes | Pre-aggregated cache |
|
|
28
|
-
| OLTP with consistency needs | No | Keep normalized |
|
|
29
|
-
|
|
30
|
-
## Query Optimization
|
|
31
|
-
|
|
32
|
-
### Indexing Decision Framework
|
|
33
|
-
| Query pattern | Index type |
|
|
34
|
-
|---------------|------------|
|
|
35
|
-
| `WHERE col = value` | B-tree index on col |
|
|
36
|
-
| `WHERE col1 = X AND col2 = Y` | Composite index (col1, col2) |
|
|
37
|
-
| `WHERE col LIKE 'prefix%'` | B-tree (prefix only) |
|
|
38
|
-
| `ORDER BY col` | Index on col |
|
|
39
|
-
| `WHERE col IN (...)` | B-tree index on col |
|
|
40
|
-
| Full-text search | GIN / Full-text index |
|
|
41
|
-
|
|
42
|
-
### Performance Diagnosis
|
|
43
|
-
1. `EXPLAIN ANALYZE` the slow query
|
|
44
|
-
2. Look for: Seq Scan (missing index), Nested Loop (N+1), Sort (missing index)
|
|
45
|
-
3. Add index → re-explain → verify improvement
|
|
46
|
-
|
|
47
|
-
### Common Performance Issues
|
|
48
|
-
| Problem | Symptom | Fix |
|
|
49
|
-
|---------|---------|-----|
|
|
50
|
-
| N+1 queries | Many identical queries | Eager loading / JOIN |
|
|
51
|
-
| Missing index | Seq Scan on large table | Add appropriate index |
|
|
52
|
-
| Over-fetching | SELECT * on wide table | Select specific columns |
|
|
53
|
-
| Lock contention | Timeout errors | Shorter transactions |
|
|
54
|
-
|
|
55
|
-
## Migration Safety
|
|
56
|
-
|
|
57
|
-
### Safe Operations (can run anytime)
|
|
58
|
-
- Add nullable column
|
|
59
|
-
- Add index CONCURRENTLY
|
|
60
|
-
- Create new table
|
|
61
|
-
- Add constraint with NOT VALID
|
|
62
|
-
|
|
63
|
-
### Dangerous Operations (need careful planning)
|
|
64
|
-
| Operation | Risk | Safe approach |
|
|
65
|
-
|-----------|------|---------------|
|
|
66
|
-
| Drop column | Data loss | Deploy code first, drop later |
|
|
67
|
-
| Rename column | Breaks queries | Add new, migrate, drop old |
|
|
68
|
-
| Change type | Data corruption | Add new column, backfill, swap |
|
|
69
|
-
| Add NOT NULL | Fails on existing nulls | Backfill first, then constrain |
|
|
70
|
-
|
|
71
|
-
## ORM vs Raw SQL
|
|
72
|
-
|
|
73
|
-
| Use ORM when... | Use Raw SQL when... |
|
|
74
|
-
|-----------------|---------------------|
|
|
75
|
-
| Standard CRUD | Complex aggregations |
|
|
76
|
-
| Migrations | Performance-critical queries |
|
|
77
|
-
| Type safety needed | Database-specific features |
|
|
78
|
-
| Rapid prototyping | Bulk operations |
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: frontend-bootstrap
|
|
3
|
-
description: Bootstrap full frontend projects from Figma and product requirements
|
|
4
|
-
tools:
|
|
5
|
-
- read_file
|
|
6
|
-
- write_file
|
|
7
|
-
- edit_file
|
|
8
|
-
- glob
|
|
9
|
-
- grep
|
|
10
|
-
- ls
|
|
11
|
-
- shell
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Frontend Bootstrap from Figma
|
|
15
|
-
|
|
16
|
-
Use this skill when the goal is to turn a prototype into a complete frontend foundation quickly.
|
|
17
|
-
|
|
18
|
-
## Outcome Targets
|
|
19
|
-
|
|
20
|
-
- Deliver a runnable frontend scaffold with routing, layout, and core pages.
|
|
21
|
-
- Generate reusable UI primitives before page-specific components.
|
|
22
|
-
- Apply consistent styling through design tokens and theme variables.
|
|
23
|
-
- Keep architecture ready for backend integration.
|
|
24
|
-
|
|
25
|
-
## Figma-to-Code Workflow
|
|
26
|
-
|
|
27
|
-
1. Map screens and flows:
|
|
28
|
-
- Identify all top-level screens in the prototype.
|
|
29
|
-
- Capture navigation structure and page hierarchy.
|
|
30
|
-
- Note critical interaction states (loading, empty, error, success).
|
|
31
|
-
|
|
32
|
-
2. Extract design system:
|
|
33
|
-
- Color palette, typography scale, spacing scale, border radius, shadow set.
|
|
34
|
-
- Component variants for button, input, select, table, modal, card, badge, tabs.
|
|
35
|
-
- Breakpoints and responsive behavior.
|
|
36
|
-
|
|
37
|
-
3. Plan project structure:
|
|
38
|
-
- `src/app` or `src/pages` for routes/screens.
|
|
39
|
-
- `src/components/ui` for primitives.
|
|
40
|
-
- `src/components/features` for domain components.
|
|
41
|
-
- `src/styles` for tokens/theme/global styles.
|
|
42
|
-
- `src/lib` for utilities and configuration.
|
|
43
|
-
|
|
44
|
-
4. Generate in layers:
|
|
45
|
-
- First: tokens/theme + base layout + routes.
|
|
46
|
-
- Second: UI primitives and variants.
|
|
47
|
-
- Third: screen composition using primitives.
|
|
48
|
-
- Fourth: stubs for API services and typed contracts.
|
|
49
|
-
|
|
50
|
-
5. Validate consistency:
|
|
51
|
-
- Verify token usage over hardcoded values.
|
|
52
|
-
- Verify responsive layout across mobile/tablet/desktop.
|
|
53
|
-
- Verify accessibility basics: semantic roles, labels, focus, contrast.
|
|
54
|
-
|
|
55
|
-
## Heuristics for Common Elements
|
|
56
|
-
|
|
57
|
-
- Table-heavy screens:
|
|
58
|
-
- Create reusable `DataTable` with column config, pagination, loading and empty states.
|
|
59
|
-
- Form-heavy screens:
|
|
60
|
-
- Create form field wrappers with validation message and helper text support.
|
|
61
|
-
- Modal-heavy flows:
|
|
62
|
-
- Standardize modal shell, close behavior, keyboard handling, and action footer.
|
|
63
|
-
- Dashboard screens:
|
|
64
|
-
- Prioritize layout grid and card primitives before chart wiring.
|
|
65
|
-
|
|
66
|
-
## Integration Readiness
|
|
67
|
-
|
|
68
|
-
- Keep API and data fetching behind dedicated service/hooks layers.
|
|
69
|
-
- Use mock data adapters initially to unblock UI.
|
|
70
|
-
- Preserve clear boundaries so backend integration only replaces adapters and endpoints.
|
|
71
|
-
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: react-patterns
|
|
3
|
-
description: React component patterns and best practices
|
|
4
|
-
tools:
|
|
5
|
-
- read_file
|
|
6
|
-
- write_file
|
|
7
|
-
- edit_file
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# React Patterns — Domain Knowledge
|
|
11
|
-
|
|
12
|
-
This skill teaches you React best practices, component architecture, and performance patterns. Study this to write idiomatic React code.
|
|
13
|
-
|
|
14
|
-
## Component Architecture Decision Tree
|
|
15
|
-
|
|
16
|
-
| Need | Pattern | Why |
|
|
17
|
-
|------|---------|-----|
|
|
18
|
-
| Simple display | Functional component | No state needed |
|
|
19
|
-
| Local state | useState/useReducer | Component-level reactivity |
|
|
20
|
-
| Shared state | Context + useContext | Cross-component without prop drilling |
|
|
21
|
-
| Server data | React Query / SWR | Cache, refetch, loading states |
|
|
22
|
-
| Side effects | useEffect with cleanup | Subscriptions, timers, API calls |
|
|
23
|
-
| Reusable logic | Custom hooks | Extract and share behavior |
|
|
24
|
-
|
|
25
|
-
## Component Patterns
|
|
26
|
-
|
|
27
|
-
### Functional Components (always prefer)
|
|
28
|
-
```tsx
|
|
29
|
-
interface Props {
|
|
30
|
-
title: string;
|
|
31
|
-
onClick?: () => void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function MyComponent({ title, onClick }: Props) {
|
|
35
|
-
return <button onClick={onClick}>{title}</button>;
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Custom Hooks (extract reusable logic)
|
|
40
|
-
```tsx
|
|
41
|
-
function useCounter(initial = 0) {
|
|
42
|
-
const [count, setCount] = useState(initial);
|
|
43
|
-
const increment = useCallback(() => setCount(c => c + 1), []);
|
|
44
|
-
return { count, increment };
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Composition over Inheritance
|
|
49
|
-
- Use `children` prop for flexible layouts
|
|
50
|
-
- Use render props for shared behavior
|
|
51
|
-
- Use compound components for related UI (Tabs/Tab, Select/Option)
|
|
52
|
-
|
|
53
|
-
## Performance Rules
|
|
54
|
-
|
|
55
|
-
| Problem | Solution | When |
|
|
56
|
-
|---------|----------|------|
|
|
57
|
-
| Expensive calc re-runs | `useMemo(() => calc, [deps])` | calc takes >1ms |
|
|
58
|
-
| Callback causes re-render | `useCallback(fn, [deps])` | Passed to memoized child |
|
|
59
|
-
| Component re-renders unnecessarily | `React.memo(Component)` | Props rarely change |
|
|
60
|
-
| Large bundle | `React.lazy(() => import(...))` | Route-level splitting |
|
|
61
|
-
| Long list | Virtualization (react-window) | 100+ items |
|
|
62
|
-
|
|
63
|
-
## Anti-Patterns to Avoid
|
|
64
|
-
|
|
65
|
-
1. **State for derived data** — Compute from existing state instead of storing separately
|
|
66
|
-
2. **useEffect for transforms** — Transform during render, not in effects
|
|
67
|
-
3. **Index as key** — Use stable IDs from data, not array index
|
|
68
|
-
4. **Nested ternaries in JSX** — Extract to variables or early returns
|
|
69
|
-
5. **Prop drilling 3+ levels** — Use Context or composition
|
|
70
|
-
|
|
71
|
-
## Accessibility Checklist
|
|
72
|
-
|
|
73
|
-
- Semantic HTML (`button` not `div onClick`)
|
|
74
|
-
- ARIA labels for icon-only buttons
|
|
75
|
-
- Keyboard navigation (Tab, Enter, Escape)
|
|
76
|
-
- Focus management after modals/dialogs
|
|
77
|
-
- Color contrast (4.5:1 minimum)
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: testing-strategies
|
|
3
|
-
description: Testing patterns and strategies
|
|
4
|
-
tools:
|
|
5
|
-
- read_file
|
|
6
|
-
- write_file
|
|
7
|
-
- edit_file
|
|
8
|
-
- shell
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Testing Strategies — Domain Knowledge
|
|
12
|
-
|
|
13
|
-
This skill teaches you how to write effective tests. Study this to learn what to test, how to structure tests, and when to use different testing approaches.
|
|
14
|
-
|
|
15
|
-
## Testing Pyramid
|
|
16
|
-
|
|
17
|
-
| Level | Speed | Count | Coverage |
|
|
18
|
-
|-------|-------|-------|----------|
|
|
19
|
-
| Unit | Fast (ms) | Many | Functions, classes, utils |
|
|
20
|
-
| Integration | Medium (s) | Moderate | API routes, DB queries, services |
|
|
21
|
-
| E2E | Slow (s-min) | Few | Critical user flows only |
|
|
22
|
-
|
|
23
|
-
## The AAA Pattern (ALWAYS follow this)
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
test('should [behavior] when [condition]', () => {
|
|
27
|
-
// Arrange — set up the test
|
|
28
|
-
const calculator = new Calculator();
|
|
29
|
-
|
|
30
|
-
// Act — perform the action
|
|
31
|
-
const result = calculator.add(2, 3);
|
|
32
|
-
|
|
33
|
-
// Assert — verify the result
|
|
34
|
-
expect(result).toBe(5);
|
|
35
|
-
});
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## What to Test (Decision Framework)
|
|
39
|
-
|
|
40
|
-
| Code type | Test approach | Priority |
|
|
41
|
-
|-----------|---------------|----------|
|
|
42
|
-
| Pure functions | Unit test with edge cases | HIGH |
|
|
43
|
-
| API endpoints | Integration test with real DB | HIGH |
|
|
44
|
-
| UI components | Render + interaction tests | MEDIUM |
|
|
45
|
-
| Config/setup | Smoke test (does it load?) | LOW |
|
|
46
|
-
| External APIs | Mock + contract test | MEDIUM |
|
|
47
|
-
| Error paths | Unit test thrown errors | HIGH |
|
|
48
|
-
|
|
49
|
-
## Test Naming Convention
|
|
50
|
-
|
|
51
|
-
- `should [expected behavior] when [condition]`
|
|
52
|
-
- `[method] returns [result] for [input]`
|
|
53
|
-
- `throws [error] when [invalid input]`
|
|
54
|
-
|
|
55
|
-
## Mocking Rules
|
|
56
|
-
|
|
57
|
-
| Mock when... | Don't mock when... |
|
|
58
|
-
|-------------|-------------------|
|
|
59
|
-
| External API calls | Core business logic |
|
|
60
|
-
| Database in unit tests | Database in integration tests |
|
|
61
|
-
| Time (Date.now, timers) | Simple utility functions |
|
|
62
|
-
| Random values | Data transformations |
|
|
63
|
-
| File system in CI | File system in integration |
|
|
64
|
-
|
|
65
|
-
## Running Tests
|
|
66
|
-
|
|
67
|
-
- `npm test` or `npx jest` — run all tests
|
|
68
|
-
- `npm test -- --watch` — watch mode
|
|
69
|
-
- `npm test -- --coverage` — coverage report
|
|
70
|
-
- `npm test -- path/to/file` — run specific file
|
|
71
|
-
- `npx jest --testPathPattern="pattern"` — filter by pattern
|
|
72
|
-
|
|
73
|
-
## Common Mistakes
|
|
74
|
-
|
|
75
|
-
1. **Testing implementation, not behavior** — Test WHAT it does, not HOW
|
|
76
|
-
2. **Shared mutable state between tests** — Reset in beforeEach
|
|
77
|
-
3. **Not testing error cases** — Happy path + error paths
|
|
78
|
-
4. **Brittle snapshot tests** — Only snapshot stable, small components
|
|
79
|
-
5. **Skipping async cleanup** — Always await and clean up promises/timers
|