ai-factory 2.0.0 → 2.2.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/README.md +17 -4
- package/dist/cli/commands/extension.d.ts +4 -0
- package/dist/cli/commands/extension.d.ts.map +1 -0
- package/dist/cli/commands/extension.js +288 -0
- package/dist/cli/commands/extension.js.map +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +31 -35
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +86 -7
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/upgrade.d.ts.map +1 -1
- package/dist/cli/commands/upgrade.js +44 -41
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/index.js +48 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/wizard/prompts.d.ts +2 -1
- package/dist/cli/wizard/prompts.d.ts.map +1 -1
- package/dist/cli/wizard/prompts.js +13 -20
- package/dist/cli/wizard/prompts.js.map +1 -1
- package/dist/core/agents.d.ts.map +1 -1
- package/dist/core/agents.js +9 -0
- package/dist/core/agents.js.map +1 -1
- package/dist/core/config.d.ts +8 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +5 -8
- package/dist/core/config.js.map +1 -1
- package/dist/core/extension-ops.d.ts +32 -0
- package/dist/core/extension-ops.d.ts.map +1 -0
- package/dist/core/extension-ops.js +83 -0
- package/dist/core/extension-ops.js.map +1 -0
- package/dist/core/extensions.d.ts +53 -0
- package/dist/core/extensions.d.ts.map +1 -0
- package/dist/core/extensions.js +141 -0
- package/dist/core/extensions.js.map +1 -0
- package/dist/core/injections.d.ts +10 -0
- package/dist/core/injections.d.ts.map +1 -0
- package/dist/core/injections.js +154 -0
- package/dist/core/injections.js.map +1 -0
- package/dist/core/installer.d.ts +7 -3
- package/dist/core/installer.d.ts.map +1 -1
- package/dist/core/installer.js +68 -26
- package/dist/core/installer.js.map +1 -1
- package/dist/core/mcp.d.ts +12 -0
- package/dist/core/mcp.d.ts.map +1 -1
- package/dist/core/mcp.js +112 -67
- package/dist/core/mcp.js.map +1 -1
- package/dist/core/transformer.d.ts +10 -1
- package/dist/core/transformer.d.ts.map +1 -1
- package/dist/core/transformer.js +19 -1
- package/dist/core/transformer.js.map +1 -1
- package/dist/core/transformers/antigravity.d.ts +1 -0
- package/dist/core/transformers/antigravity.d.ts.map +1 -1
- package/dist/core/transformers/antigravity.js +19 -4
- package/dist/core/transformers/antigravity.js.map +1 -1
- package/dist/core/transformers/codex.d.ts +7 -0
- package/dist/core/transformers/codex.d.ts.map +1 -0
- package/dist/core/transformers/codex.js +24 -0
- package/dist/core/transformers/codex.js.map +1 -0
- package/dist/core/transformers/default.d.ts +1 -0
- package/dist/core/transformers/default.d.ts.map +1 -1
- package/dist/core/transformers/default.js +6 -0
- package/dist/core/transformers/default.js.map +1 -1
- package/dist/core/transformers/kilocode.js +1 -1
- package/dist/core/transformers/kilocode.js.map +1 -1
- package/dist/core/transformers/qwen.d.ts +7 -0
- package/dist/core/transformers/qwen.d.ts.map +1 -0
- package/dist/core/transformers/qwen.js +25 -0
- package/dist/core/transformers/qwen.js.map +1 -0
- package/dist/utils/fs.d.ts +0 -2
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +1 -5
- package/dist/utils/fs.js.map +1 -1
- package/mcp/templates/playwright.json +4 -0
- package/package.json +16 -1
- package/skills/aif/SKILL.md +27 -52
- package/skills/aif-commit/SKILL.md +13 -1
- package/skills/aif-grounded/SKILL.md +90 -0
- package/skills/aif-implement/SKILL.md +39 -2
- package/skills/aif-implement/references/IMPLEMENTATION-GUIDE.md +16 -0
- package/skills/aif-loop/SKILL.md +2 -2
- package/dist/cli/wizard/detector.d.ts +0 -10
- package/dist/cli/wizard/detector.d.ts.map +0 -1
- package/dist/cli/wizard/detector.js +0 -231
- package/dist/cli/wizard/detector.js.map +0 -1
- package/skills/_templates/nextjs/nextjs-patterns/SKILL.md +0 -146
- package/skills/_templates/node-api/api-patterns/SKILL.md +0 -245
- package/skills/_templates/php/php-patterns/SKILL.md +0 -491
- package/skills/_templates/python/python-patterns/SKILL.md +0 -236
- package/skills/_templates/react/react-patterns/SKILL.md +0 -181
- package/skills/aif-deploy/SKILL.md +0 -138
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: react-patterns
|
|
3
|
-
description: React development patterns and best practices. Covers hooks, state management, component design, and performance optimization.
|
|
4
|
-
argument-hint: "[topic: hooks|state|components|performance]"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# React Patterns Guide
|
|
8
|
-
|
|
9
|
-
Modern React patterns and best practices for building scalable applications.
|
|
10
|
-
|
|
11
|
-
## Topics
|
|
12
|
-
|
|
13
|
-
### Hooks (`/react-patterns hooks`)
|
|
14
|
-
|
|
15
|
-
**Custom Hook Pattern:**
|
|
16
|
-
```typescript
|
|
17
|
-
function useAsync<T>(asyncFn: () => Promise<T>, deps: unknown[]) {
|
|
18
|
-
const [state, setState] = useState<{
|
|
19
|
-
data: T | null;
|
|
20
|
-
loading: boolean;
|
|
21
|
-
error: Error | null;
|
|
22
|
-
}>({ data: null, loading: true, error: null });
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
setState(prev => ({ ...prev, loading: true }));
|
|
26
|
-
asyncFn()
|
|
27
|
-
.then(data => setState({ data, loading: false, error: null }))
|
|
28
|
-
.catch(error => setState({ data: null, loading: false, error }));
|
|
29
|
-
}, deps);
|
|
30
|
-
|
|
31
|
-
return state;
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**Common Custom Hooks:**
|
|
36
|
-
- `useLocalStorage` - Persist state to localStorage
|
|
37
|
-
- `useDebounce` - Debounce rapidly changing values
|
|
38
|
-
- `useMediaQuery` - Responsive breakpoints
|
|
39
|
-
- `usePrevious` - Access previous value
|
|
40
|
-
- `useOnClickOutside` - Detect outside clicks
|
|
41
|
-
|
|
42
|
-
### State Management (`/react-patterns state`)
|
|
43
|
-
|
|
44
|
-
**Context + Reducer Pattern:**
|
|
45
|
-
```typescript
|
|
46
|
-
// 1. Define types
|
|
47
|
-
type State = { count: number };
|
|
48
|
-
type Action = { type: 'increment' } | { type: 'decrement' };
|
|
49
|
-
|
|
50
|
-
// 2. Create context
|
|
51
|
-
const StateContext = createContext<State | null>(null);
|
|
52
|
-
const DispatchContext = createContext<Dispatch<Action> | null>(null);
|
|
53
|
-
|
|
54
|
-
// 3. Provider component
|
|
55
|
-
function StateProvider({ children }: { children: ReactNode }) {
|
|
56
|
-
const [state, dispatch] = useReducer(reducer, { count: 0 });
|
|
57
|
-
return (
|
|
58
|
-
<StateContext.Provider value={state}>
|
|
59
|
-
<DispatchContext.Provider value={dispatch}>
|
|
60
|
-
{children}
|
|
61
|
-
</DispatchContext.Provider>
|
|
62
|
-
</StateContext.Provider>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// 4. Custom hooks for access
|
|
67
|
-
function useAppState() {
|
|
68
|
-
const context = useContext(StateContext);
|
|
69
|
-
if (!context) throw new Error('Must be inside StateProvider');
|
|
70
|
-
return context;
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**When to use what:**
|
|
75
|
-
- **useState**: Local component state
|
|
76
|
-
- **useReducer**: Complex state logic
|
|
77
|
-
- **Context**: Shared state (auth, theme)
|
|
78
|
-
- **Zustand/Jotai**: Global state, simpler than Redux
|
|
79
|
-
- **TanStack Query**: Server state
|
|
80
|
-
|
|
81
|
-
### Components (`/react-patterns components`)
|
|
82
|
-
|
|
83
|
-
**Composition Pattern:**
|
|
84
|
-
```typescript
|
|
85
|
-
// Instead of prop drilling, use composition
|
|
86
|
-
function Card({ children }: { children: ReactNode }) {
|
|
87
|
-
return <div className="card">{children}</div>;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
Card.Header = function CardHeader({ children }) {
|
|
91
|
-
return <div className="card-header">{children}</div>;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
Card.Body = function CardBody({ children }) {
|
|
95
|
-
return <div className="card-body">{children}</div>;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// Usage
|
|
99
|
-
<Card>
|
|
100
|
-
<Card.Header>Title</Card.Header>
|
|
101
|
-
<Card.Body>Content</Card.Body>
|
|
102
|
-
</Card>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**Render Props Pattern:**
|
|
106
|
-
```typescript
|
|
107
|
-
function MouseTracker({ render }: { render: (pos: Position) => ReactNode }) {
|
|
108
|
-
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
109
|
-
// ... mouse tracking logic
|
|
110
|
-
return render(position);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Usage
|
|
114
|
-
<MouseTracker render={({ x, y }) => <div>Mouse: {x}, {y}</div>} />
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Performance (`/react-patterns performance`)
|
|
118
|
-
|
|
119
|
-
**Memoization:**
|
|
120
|
-
```typescript
|
|
121
|
-
// Memoize expensive computations
|
|
122
|
-
const expensiveResult = useMemo(() => {
|
|
123
|
-
return heavyComputation(data);
|
|
124
|
-
}, [data]);
|
|
125
|
-
|
|
126
|
-
// Memoize callbacks passed to children
|
|
127
|
-
const handleClick = useCallback(() => {
|
|
128
|
-
doSomething(id);
|
|
129
|
-
}, [id]);
|
|
130
|
-
|
|
131
|
-
// Memoize components that receive same props
|
|
132
|
-
const MemoizedChild = memo(function Child({ data }) {
|
|
133
|
-
return <div>{data}</div>;
|
|
134
|
-
});
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Code Splitting:**
|
|
138
|
-
```typescript
|
|
139
|
-
// Lazy load components
|
|
140
|
-
const HeavyComponent = lazy(() => import('./HeavyComponent'));
|
|
141
|
-
|
|
142
|
-
function App() {
|
|
143
|
-
return (
|
|
144
|
-
<Suspense fallback={<Loading />}>
|
|
145
|
-
<HeavyComponent />
|
|
146
|
-
</Suspense>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**Virtualization:**
|
|
152
|
-
```typescript
|
|
153
|
-
// For long lists, use virtualization
|
|
154
|
-
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
155
|
-
|
|
156
|
-
function VirtualList({ items }) {
|
|
157
|
-
const virtualizer = useVirtualizer({
|
|
158
|
-
count: items.length,
|
|
159
|
-
getScrollElement: () => parentRef.current,
|
|
160
|
-
estimateSize: () => 50,
|
|
161
|
-
});
|
|
162
|
-
// ... render only visible items
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## Best Practices
|
|
167
|
-
|
|
168
|
-
1. **Single Responsibility** - One component, one job
|
|
169
|
-
2. **Lift state up** - Share state via common ancestor
|
|
170
|
-
3. **Colocation** - Keep related code together
|
|
171
|
-
4. **Avoid prop drilling** - Use composition or context
|
|
172
|
-
5. **Type everything** - Use TypeScript for safety
|
|
173
|
-
6. **Test behavior** - Not implementation details
|
|
174
|
-
|
|
175
|
-
## Anti-Patterns to Avoid
|
|
176
|
-
|
|
177
|
-
- Mutating state directly
|
|
178
|
-
- useEffect for derived state
|
|
179
|
-
- Inline object/array props (causes re-renders)
|
|
180
|
-
- Over-using context for frequently changing state
|
|
181
|
-
- Giant components (break them down)
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: aif-deploy
|
|
3
|
-
description: Prepare and execute deployments with pre-flight checks, release notes generation, and CI/CD integration. NEVER auto-deploy. Use when user explicitly says "deploy", "release", or "go live".
|
|
4
|
-
argument-hint: "[staging|production]"
|
|
5
|
-
allowed-tools: Bash(git *) Bash(npm *) Bash(docker *) Bash(gh *)
|
|
6
|
-
disable-model-invocation: true
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Deployment Assistant
|
|
10
|
-
|
|
11
|
-
Help prepare and execute deployments safely with automated checks and documentation.
|
|
12
|
-
|
|
13
|
-
## Behavior
|
|
14
|
-
|
|
15
|
-
### Without Arguments (Pre-flight Checks Only)
|
|
16
|
-
|
|
17
|
-
Run deployment readiness checks:
|
|
18
|
-
|
|
19
|
-
1. **Git Status Check**
|
|
20
|
-
- Ensure working directory is clean
|
|
21
|
-
- Verify on correct branch
|
|
22
|
-
- Check if branch is up to date with remote
|
|
23
|
-
|
|
24
|
-
2. **Build Check**
|
|
25
|
-
- Run build command (`npm run build`, `cargo build`, etc.)
|
|
26
|
-
- Report any build errors
|
|
27
|
-
|
|
28
|
-
3. **Test Check**
|
|
29
|
-
- Run test suite
|
|
30
|
-
- Report coverage if available
|
|
31
|
-
|
|
32
|
-
4. **Environment Check**
|
|
33
|
-
- Verify required environment variables
|
|
34
|
-
- Check `.env.example` vs actual env
|
|
35
|
-
|
|
36
|
-
5. **Dependency Check**
|
|
37
|
-
- Look for security vulnerabilities (`npm audit`, etc.)
|
|
38
|
-
- Check for outdated critical packages
|
|
39
|
-
|
|
40
|
-
### With Environment Argument
|
|
41
|
-
|
|
42
|
-
#### `/aif-deploy staging`
|
|
43
|
-
|
|
44
|
-
1. Run pre-flight checks
|
|
45
|
-
2. Generate changelog since last staging deploy
|
|
46
|
-
3. Provide deployment commands for staging environment
|
|
47
|
-
4. Tag release as staging-{date}
|
|
48
|
-
|
|
49
|
-
#### `/aif-deploy production`
|
|
50
|
-
|
|
51
|
-
1. Run ALL pre-flight checks (more strict)
|
|
52
|
-
2. Require clean git status
|
|
53
|
-
3. Require all tests passing
|
|
54
|
-
4. Generate full release notes
|
|
55
|
-
5. Create git tag for release
|
|
56
|
-
6. Provide production deployment commands
|
|
57
|
-
|
|
58
|
-
## Pre-flight Check Output
|
|
59
|
-
|
|
60
|
-
```markdown
|
|
61
|
-
## Deployment Readiness Check
|
|
62
|
-
|
|
63
|
-
### Git Status
|
|
64
|
-
✅ Working directory clean
|
|
65
|
-
✅ On branch: main
|
|
66
|
-
✅ Up to date with origin/main
|
|
67
|
-
|
|
68
|
-
### Build
|
|
69
|
-
✅ Build successful
|
|
70
|
-
⏱️ Build time: 45s
|
|
71
|
-
|
|
72
|
-
### Tests
|
|
73
|
-
✅ All tests passing (142/142)
|
|
74
|
-
📊 Coverage: 78%
|
|
75
|
-
|
|
76
|
-
### Environment
|
|
77
|
-
✅ All required variables set
|
|
78
|
-
⚠️ Optional: SENTRY_DSN not set
|
|
79
|
-
|
|
80
|
-
### Dependencies
|
|
81
|
-
✅ No known vulnerabilities
|
|
82
|
-
⚠️ 3 packages have updates available
|
|
83
|
-
|
|
84
|
-
## Verdict: ✅ Ready for deployment
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Release Notes Generation
|
|
88
|
-
|
|
89
|
-
When deploying, generate release notes from:
|
|
90
|
-
- Git commits since last tag/release
|
|
91
|
-
- Merged PR titles and descriptions
|
|
92
|
-
- Conventional commit messages
|
|
93
|
-
|
|
94
|
-
Format:
|
|
95
|
-
```markdown
|
|
96
|
-
## Release v1.2.3
|
|
97
|
-
|
|
98
|
-
### Features
|
|
99
|
-
- feat(auth): Add OAuth2 support (#45)
|
|
100
|
-
- feat(api): New user endpoints (#48)
|
|
101
|
-
|
|
102
|
-
### Bug Fixes
|
|
103
|
-
- fix(ui): Correct button alignment (#46)
|
|
104
|
-
|
|
105
|
-
### Other Changes
|
|
106
|
-
- chore(deps): Update dependencies
|
|
107
|
-
- docs: Update API documentation
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## CI/CD Integration
|
|
111
|
-
|
|
112
|
-
Detect and provide commands for:
|
|
113
|
-
|
|
114
|
-
- **Vercel**: `vercel --prod`
|
|
115
|
-
- **Netlify**: `netlify deploy --prod`
|
|
116
|
-
- **Railway**: `railway up`
|
|
117
|
-
- **Docker**: Build and push commands
|
|
118
|
-
- **Kubernetes**: `kubectl apply` commands
|
|
119
|
-
- **GitHub Actions**: Trigger workflow
|
|
120
|
-
|
|
121
|
-
## Safety Features
|
|
122
|
-
|
|
123
|
-
- Never auto-deploy to production
|
|
124
|
-
- Always show diff of what will be deployed
|
|
125
|
-
- Require confirmation for destructive actions
|
|
126
|
-
- Suggest rollback commands
|
|
127
|
-
- Log deployment actions
|
|
128
|
-
|
|
129
|
-
## Examples
|
|
130
|
-
|
|
131
|
-
**User:** `/aif-deploy`
|
|
132
|
-
Run all pre-flight checks, report readiness.
|
|
133
|
-
|
|
134
|
-
**User:** `/aif-deploy staging`
|
|
135
|
-
Prepare staging deployment with changelog.
|
|
136
|
-
|
|
137
|
-
**User:** `/aif-deploy production`
|
|
138
|
-
Full production deployment workflow with release notes.
|