@mrtrinhvn/ag-kit 1.0.11 → 1.1.1
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 +31 -0
- package/bin/cli.js +72 -0
- package/package.json +7 -1
- package/template/.agent/knowledge/orchestrator_v3_protocol.md +60 -0
- package/template/.agent/knowledge/self_healing_logs.md +22 -0
- package/{.agent → template/.agent}/skills/telegram-agentic-gateway/SKILL.md +0 -0
- package/template/.agent/skills/vfs-assistant/SKILL.md +39 -0
- package/.agent/agents/backend-specialist.md +0 -263
- package/.agent/agents/code-archaeologist.md +0 -106
- package/.agent/agents/database-architect.md +0 -226
- package/.agent/agents/debugger.md +0 -225
- package/.agent/agents/devops-engineer.md +0 -242
- package/.agent/agents/documentation-writer.md +0 -104
- package/.agent/agents/explorer-agent.md +0 -73
- package/.agent/agents/frontend-specialist.md +0 -556
- package/.agent/agents/game-developer.md +0 -162
- package/.agent/agents/mobile-developer.md +0 -377
- package/.agent/agents/orchestrator.md +0 -416
- package/.agent/agents/penetration-tester.md +0 -188
- package/.agent/agents/performance-optimizer.md +0 -187
- package/.agent/agents/product-manager.md +0 -112
- package/.agent/agents/product-owner.md +0 -95
- package/.agent/agents/project-planner.md +0 -406
- package/.agent/agents/qa-automation-engineer.md +0 -103
- package/.agent/agents/quant-architect.md +0 -31
- package/.agent/agents/security-auditor.md +0 -170
- package/.agent/agents/seo-specialist.md +0 -111
- package/.agent/agents/test-engineer.md +0 -158
- package/.agent/rules/GEMINI.md +0 -280
- package/.agent/scripts/auto_preview.py +0 -148
- package/.agent/scripts/checklist.py +0 -217
- package/.agent/scripts/session_manager.py +0 -120
- package/.agent/scripts/verify_all.py +0 -327
- package/.agent/skills/api-patterns/SKILL.md +0 -81
- package/.agent/skills/api-patterns/api-style.md +0 -42
- package/.agent/skills/api-patterns/auth.md +0 -24
- package/.agent/skills/api-patterns/documentation.md +0 -26
- package/.agent/skills/api-patterns/graphql.md +0 -41
- package/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/.agent/skills/api-patterns/response.md +0 -37
- package/.agent/skills/api-patterns/rest.md +0 -40
- package/.agent/skills/api-patterns/scripts/api_validator.py +0 -211
- package/.agent/skills/api-patterns/security-testing.md +0 -122
- package/.agent/skills/api-patterns/trpc.md +0 -41
- package/.agent/skills/api-patterns/versioning.md +0 -22
- package/.agent/skills/app-builder/SKILL.md +0 -75
- package/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/.agent/skills/app-builder/feature-building.md +0 -53
- package/.agent/skills/app-builder/project-detection.md +0 -34
- package/.agent/skills/app-builder/scaffolding.md +0 -118
- package/.agent/skills/app-builder/tech-stack.md +0 -40
- package/.agent/skills/app-builder/templates/SKILL.md +0 -39
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +0 -76
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +0 -92
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +0 -88
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +0 -88
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +0 -83
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +0 -90
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +0 -90
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +0 -82
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +0 -100
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +0 -106
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +0 -101
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +0 -83
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +0 -93
- package/.agent/skills/architecture/SKILL.md +0 -55
- package/.agent/skills/architecture/context-discovery.md +0 -43
- package/.agent/skills/architecture/examples.md +0 -94
- package/.agent/skills/architecture/pattern-selection.md +0 -68
- package/.agent/skills/architecture/patterns-reference.md +0 -50
- package/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/.agent/skills/bash-linux/SKILL.md +0 -199
- package/.agent/skills/behavioral-modes/SKILL.md +0 -242
- package/.agent/skills/brainstorming/SKILL.md +0 -168
- package/.agent/skills/brainstorming/dynamic-questioning.md +0 -350
- package/.agent/skills/business-ops/SKILL.md +0 -26
- package/.agent/skills/clean-code/SKILL.md +0 -202
- package/.agent/skills/cli-generator/SKILL.md +0 -48
- package/.agent/skills/code-review-checklist/SKILL.md +0 -109
- package/.agent/skills/cognitive-session/SKILL.md +0 -28
- package/.agent/skills/data-science/SKILL.md +0 -28
- package/.agent/skills/database-design/SKILL.md +0 -52
- package/.agent/skills/database-design/database-selection.md +0 -43
- package/.agent/skills/database-design/indexing.md +0 -39
- package/.agent/skills/database-design/migrations.md +0 -48
- package/.agent/skills/database-design/optimization.md +0 -36
- package/.agent/skills/database-design/orm-selection.md +0 -30
- package/.agent/skills/database-design/schema-design.md +0 -56
- package/.agent/skills/database-design/scripts/schema_validator.py +0 -172
- package/.agent/skills/deployment-procedures/SKILL.md +0 -241
- package/.agent/skills/doc.md +0 -177
- package/.agent/skills/documentation-templates/SKILL.md +0 -194
- package/.agent/skills/frontend-design/SKILL.md +0 -418
- package/.agent/skills/frontend-design/animation-guide.md +0 -331
- package/.agent/skills/frontend-design/color-system.md +0 -311
- package/.agent/skills/frontend-design/decision-trees.md +0 -418
- package/.agent/skills/frontend-design/motion-graphics.md +0 -306
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +0 -183
- package/.agent/skills/frontend-design/scripts/ux_audit.py +0 -722
- package/.agent/skills/frontend-design/typography-system.md +0 -345
- package/.agent/skills/frontend-design/ux-psychology.md +0 -541
- package/.agent/skills/frontend-design/visual-effects.md +0 -383
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -167
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
- package/.agent/skills/geo-fundamentals/SKILL.md +0 -156
- package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +0 -289
- package/.agent/skills/i18n-localization/SKILL.md +0 -154
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +0 -241
- package/.agent/skills/intelligent-routing/SKILL.md +0 -335
- package/.agent/skills/knowledge-management/SKILL.md +0 -66
- package/.agent/skills/lint-and-validate/SKILL.md +0 -45
- package/.agent/skills/lint-and-validate/scripts/lint_runner.py +0 -172
- package/.agent/skills/lint-and-validate/scripts/type_coverage.py +0 -173
- package/.agent/skills/llm-routing-quirks/SKILL.md +0 -41
- package/.agent/skills/mcp-builder/SKILL.md +0 -176
- package/.agent/skills/memory-architecture/SKILL.md +0 -107
- package/.agent/skills/mini-antigravity-injection/SKILL.md +0 -66
- package/.agent/skills/mobile-design/SKILL.md +0 -394
- package/.agent/skills/mobile-design/decision-trees.md +0 -516
- package/.agent/skills/mobile-design/mobile-backend.md +0 -491
- package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
- package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
- package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
- package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
- package/.agent/skills/mobile-design/mobile-performance.md +0 -767
- package/.agent/skills/mobile-design/mobile-testing.md +0 -356
- package/.agent/skills/mobile-design/mobile-typography.md +0 -433
- package/.agent/skills/mobile-design/platform-android.md +0 -666
- package/.agent/skills/mobile-design/platform-ios.md +0 -561
- package/.agent/skills/mobile-design/scripts/mobile_audit.py +0 -670
- package/.agent/skills/mobile-design/touch-psychology.md +0 -537
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
- package/.agent/skills/nextjs-react-expert/SKILL.md +0 -267
- package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +0 -222
- package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +0 -252
- package/.agent/skills/nodejs-best-practices/SKILL.md +0 -333
- package/.agent/skills/parallel-agents/SKILL.md +0 -175
- package/.agent/skills/performance-profiling/SKILL.md +0 -143
- package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +0 -76
- package/.agent/skills/plan-writing/SKILL.md +0 -153
- package/.agent/skills/powershell-windows/SKILL.md +0 -167
- package/.agent/skills/product-management/SKILL.md +0 -30
- package/.agent/skills/python-patterns/SKILL.md +0 -441
- package/.agent/skills/red-team-tactics/SKILL.md +0 -199
- package/.agent/skills/seo-fundamentals/SKILL.md +0 -129
- package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +0 -219
- package/.agent/skills/server-management/SKILL.md +0 -161
- package/.agent/skills/systematic-debugging/SKILL.md +0 -120
- package/.agent/skills/tailwind-patterns/SKILL.md +0 -269
- package/.agent/skills/tdd-workflow/SKILL.md +0 -148
- package/.agent/skills/testing-patterns/SKILL.md +0 -178
- package/.agent/skills/testing-patterns/scripts/test_runner.py +0 -219
- package/.agent/skills/vulnerability-scanner/SKILL.md +0 -276
- package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
- package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +0 -458
- package/.agent/skills/web-design-guidelines/SKILL.md +0 -57
- package/.agent/skills/webapp-testing/SKILL.md +0 -187
- package/.agent/skills/webapp-testing/scripts/playwright_runner.py +0 -173
- package/.agent/workflows/brainstorm.md +0 -113
- package/.agent/workflows/create.md +0 -59
- package/.agent/workflows/debug.md +0 -103
- package/.agent/workflows/deploy.md +0 -176
- package/.agent/workflows/enhance.md +0 -63
- package/.agent/workflows/orchestrate.md +0 -237
- package/.agent/workflows/plan.md +0 -89
- package/.agent/workflows/preview.md +0 -81
- package/.agent/workflows/status.md +0 -86
- package/.agent/workflows/test.md +0 -144
- package/.agent/workflows/ui-ux-pro-max.md +0 -296
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/charts.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/colors.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/icons.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/landing.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/products.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/prompts.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/react-performance.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/flutter.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/react-native.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/react.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/svelte.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/stacks/vue.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/styles.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/typography.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/ui-reasoning.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/ux-guidelines.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/data/web-interface.csv +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/scripts/core.py +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/scripts/design_system.py +0 -0
- /package/{.agent → template/.agent}/.shared/ui-ux-pro-max/scripts/search.py +0 -0
- /package/{.agent → template/.agent}/ARCHITECTURE.md +0 -0
- /package/{.agent → template/.agent}/mcp_config.json +0 -0
- /package/{.agent → template/.agent}/skills/nextjs-react-expert/9-cache-components.md +0 -0
- /package/{.agent → template/.agent}/skills/rust-pro/SKILL.md +0 -0
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ The best way to initialize the AG-Kit in a new project is using `npx`:
|
|
|
10
10
|
npx @mrtrinhvn/ag-kit init
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
> **Note**: This is the **recommended** method for remote machines as it avoids all `EACCES` permission issues.
|
|
14
|
+
|
|
13
15
|
## 🛠 Global Usage & Commands
|
|
14
16
|
|
|
15
17
|
You can also install it globally if you frequently create new projects:
|
|
@@ -18,11 +20,40 @@ You can also install it globally if you frequently create new projects:
|
|
|
18
20
|
npm install -g @mrtrinhvn/ag-kit
|
|
19
21
|
```
|
|
20
22
|
|
|
23
|
+
### 🛠 Local Development (Linking)
|
|
24
|
+
|
|
25
|
+
If you are developing Ag-Kit locally and want to use it globally without publishing to NPM:
|
|
26
|
+
|
|
27
|
+
1. Go to the Ag-Kit directory: `cd /home/tao/Projects/ag-kit`
|
|
28
|
+
2. Run: `npm link` (This creates a global symlink)
|
|
29
|
+
3. You can now use `ag-kit` anywhere!
|
|
30
|
+
|
|
31
|
+
### ❌ Troubleshooting: EACCES Permission Error
|
|
32
|
+
|
|
33
|
+
If you see `npm error code EACCES` when installing globally via network (`npm install -g`), use one of these:
|
|
34
|
+
|
|
35
|
+
**Solution 1: Use sudo (For quick global install)**
|
|
36
|
+
```bash
|
|
37
|
+
sudo npm install -g @mrtrinhvn/ag-kit
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Solution 2: Use npx (Recommended - No sudo needed)**
|
|
41
|
+
```bash
|
|
42
|
+
npx @mrtrinhvn/ag-kit <command>
|
|
43
|
+
```
|
|
44
|
+
npx sẽ tự động tải và chạy mà không cần quyền ghi vào thư mục hệ thống.
|
|
45
|
+
|
|
46
|
+
**Solution 3: Local Development (For this machine)**
|
|
47
|
+
Follow [NPM's guide](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally) to change the global directory to your home folder.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
21
51
|
Then use the provided CLI anywhere:
|
|
22
52
|
|
|
23
53
|
| Command | Description |
|
|
24
54
|
|---|---|
|
|
25
55
|
| `ag-kit init` | Scaffolds the `.agent` framework (Agents, Skills, Workflows) into your current directory. |
|
|
56
|
+
| `ag-kit check` | Verifies environment health (CDP, Tokens, Ollama, Models). |
|
|
26
57
|
| `ag-kit update` | Pulls the latest rules and templates and safely overwrites the core `.agent` folders without breaking your custom `knowledge/` base. |
|
|
27
58
|
| `ag-kit status` | Checks exactly which version of the AG-Kit is active in your current working directory. |
|
|
28
59
|
|
package/bin/cli.js
CHANGED
|
@@ -105,6 +105,78 @@ program.command('update')
|
|
|
105
105
|
console.log('\x1b[32m✅ Cập nhật thành công 100% Cấu trúc kỹ năng siêu cấp!\x1b[0m');
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
+
program.command('check')
|
|
109
|
+
.description('Verify environment health (CDP, Tokens, Ollama)')
|
|
110
|
+
.action(async () => {
|
|
111
|
+
const { execSync } = require('child_process');
|
|
112
|
+
console.log('\x1b[36m🔍 Đang kiểm tra hệ sinh thái Antigravity...\x1b[0m');
|
|
113
|
+
|
|
114
|
+
// 1. Check .env
|
|
115
|
+
const envPath = path.join(process.cwd(), '.env');
|
|
116
|
+
if (fs.existsSync(envPath)) {
|
|
117
|
+
console.log('\x1b[32m✅ .env: OK\x1b[0m');
|
|
118
|
+
} else {
|
|
119
|
+
console.log('\x1b[33m⚠️ .env: Không tìm thấy. Hãy tạo file .env từ template.\x1b[0m');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 2. Check CDP Port (Prioritize CDP_PORT from .env)
|
|
123
|
+
let ports = [9555, 9222];
|
|
124
|
+
if (fs.existsSync(envPath)) {
|
|
125
|
+
const content = fs.readFileSync(envPath, 'utf-8');
|
|
126
|
+
const match = content.match(/CDP_PORT=(\d+)/);
|
|
127
|
+
if (match) {
|
|
128
|
+
const customPort = parseInt(match[1]);
|
|
129
|
+
ports = [customPort, ...ports.filter(p => p !== customPort)];
|
|
130
|
+
console.log(`\x1b[34mℹ️ Sử dụng cổng CDP tùy chỉnh từ .env: ${customPort}\x1b[0m`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
let cdpOk = false;
|
|
135
|
+
for (const port of ports) {
|
|
136
|
+
try {
|
|
137
|
+
execSync(`curl -s --max-time 2 http://127.0.0.1:${port}/json/version`, { stdio: 'ignore' });
|
|
138
|
+
console.log(`\x1b[32m✅ IDE CDP: Phát hiện tại cổng ${port}\x1b[0m`);
|
|
139
|
+
cdpOk = true;
|
|
140
|
+
break;
|
|
141
|
+
} catch (e) {}
|
|
142
|
+
}
|
|
143
|
+
if (!cdpOk) console.log(`\x1b[31m❌ IDE CDP: Không tìm thấy IDE đang chạy ở các cổng: ${ports.join(', ')}\x1b[0m`);
|
|
144
|
+
|
|
145
|
+
// 3. Check Ollama
|
|
146
|
+
try {
|
|
147
|
+
execSync('ollama --version', { stdio: 'ignore' });
|
|
148
|
+
console.log('\x1b[32m✅ Ollama: Đã cài đặt\x1b[0m');
|
|
149
|
+
try {
|
|
150
|
+
execSync('curl -s --max-time 2 http://127.0.0.1:11434/api/tags', { stdio: 'ignore' });
|
|
151
|
+
console.log('\x1b[32m✅ Ollama Service: Online\x1b[0m');
|
|
152
|
+
|
|
153
|
+
// Kiểm tra model mặc định
|
|
154
|
+
const models = execSync('curl -s http://127.0.0.1:11434/api/tags').toString();
|
|
155
|
+
if (models.includes('nvidia_Orchestrator')) {
|
|
156
|
+
console.log('\x1b[32m✅ Default Model: nvidia_Orchestrator (Sẵn sàng)\x1b[0m');
|
|
157
|
+
} else {
|
|
158
|
+
console.log('\x1b[33m⚠️ Default Model: nvidia_Orchestrator (Chưa tải - Khuyên dùng "ollama run hf.co/bartowski/nvidia_Orchestrator-8B-GGUF:Q4_K_M")\x1b[0m');
|
|
159
|
+
}
|
|
160
|
+
} catch (e) {
|
|
161
|
+
console.log('\x1b[31m❌ Ollama Service: Offline (Gõ "ollama serve")\x1b[0m');
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.log('\x1b[33m⚠️ Ollama: Chưa cài đặt. Khuyên dùng để chạy model local.\x1b[0m');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// 4. Check Telegram Token (if in .env)
|
|
168
|
+
if (fs.existsSync(envPath)) {
|
|
169
|
+
const content = fs.readFileSync(envPath, 'utf-8');
|
|
170
|
+
if (content.includes('TELEGRAM_BOT_TOKEN') && !content.includes('YOUR_TOKEN_HERE')) {
|
|
171
|
+
console.log('\x1b[32m✅ Telegram Token: Đã cấu hình\x1b[0m');
|
|
172
|
+
} else {
|
|
173
|
+
console.log('\x1b[33m⚠️ Telegram Token: Chưa cấu hình hoặc dùng giá trị mặc định.\x1b[0m');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
console.log('\n\x1b[35m✨ Kiểm tra hoàn tất. Hãy đảm bảo IDE và Bot cùng tần số!\x1b[0m');
|
|
178
|
+
});
|
|
179
|
+
|
|
108
180
|
program.command('status')
|
|
109
181
|
.description('Check installation status')
|
|
110
182
|
.action(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrtrinhvn/ag-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Antigravity Kit Base Framework - Generic Agentic AI Programming Core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"author": "mrtrinhvn",
|
|
24
24
|
"license": "MIT",
|
|
25
|
+
"files": [
|
|
26
|
+
"bin",
|
|
27
|
+
"template",
|
|
28
|
+
"README.md",
|
|
29
|
+
"package.json"
|
|
30
|
+
],
|
|
25
31
|
"dependencies": {
|
|
26
32
|
"commander": "^14.0.3"
|
|
27
33
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# 🧠 Giao Thức Quản Đốc Vô Song (Orchestrator V3 Protocol)
|
|
2
|
+
|
|
3
|
+
Bản thảo này đúc kết toàn bộ kinh nghiệm "xương máu" khi nâng cấp Antigravity Orchestrator lên phiên bản V3 - Một hệ thống nổ máy tự động, có tư duy chiến lược và quyền năng can thiệp trực tiếp vào IDE (God Mode).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Hệ Tư Duy Chiến Lược (Strategic Prompting)
|
|
8
|
+
|
|
9
|
+
Đối với các Model tầm trung (8B - 14B), để tránh việc chúng bị "ngáo quyền năng" hoặc nhại lời Sếp, cần áp dụng cấu trúc Prompt JSON-First sau:
|
|
10
|
+
|
|
11
|
+
### Quy tắc Vô Song:
|
|
12
|
+
- **Trường `strategy`**: Ép Model phải giải trình chiến lược TRƯỚC khi đưa ra câu trả lời. Điều này giúp AI tự kiểm tra logic của chính mình.
|
|
13
|
+
- **Cây Quyết Định (Decision Tree)**:
|
|
14
|
+
1. Câu hỏi kiến thức/xã hội -> `reply_user`.
|
|
15
|
+
2. Task nhẹ/quét file -> `execute_task` (Sandbox).
|
|
16
|
+
3. Task nặng/sửa code dự án -> `telepathy_inject` (IDE).
|
|
17
|
+
|
|
18
|
+
### Prompt Mẫu (System Prompt):
|
|
19
|
+
```markdown
|
|
20
|
+
Bạn là QUẢN ĐỐC - AI Manager của Sếp Tạo.
|
|
21
|
+
Phong thái: Thực quyền, chuyên nghiệp, không nhại lời Sếp.
|
|
22
|
+
Tuyệt đối không xưng tên là Antigravity. Bạn là Quản Đốc của Antigravity.
|
|
23
|
+
... [Cây quyết định] ...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 2. Cầu Nối Thần Giao Cách Cảm (Telepathy Bridge)
|
|
29
|
+
|
|
30
|
+
Đây là quyền năng cho phép Orchestrator (chạy trong terminal/telegram) điều khiển trực tiếp IDE Antigravity (GUI) đang mở trên máy Sếp qua giao thức CDP.
|
|
31
|
+
|
|
32
|
+
### Cấu hình Cổng Cố định (Fixed Port Protocol):
|
|
33
|
+
Để tránh xung đột khi mở nhiều dự án, hãy áp dụng dải cổng chuẩn:
|
|
34
|
+
- **Dự án chính**: Port 9222.
|
|
35
|
+
- **Dự án phụ 1, 2, 3...**: Port 9223, 9224...
|
|
36
|
+
- **Quản Đốc**: Sẽ tự động quét từ 9222 -> 9230 để tìm đúng IDE dựa trên đường dẫn dự án (`target_path`).
|
|
37
|
+
|
|
38
|
+
### Lệnh khởi động God Mode:
|
|
39
|
+
Sử dụng tham số `--remote-debugging-port=9222` khi mở Antigravity.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 3. Bộ Khởi Động Một Chạm (The telepathy.sh Standard)
|
|
44
|
+
|
|
45
|
+
Để Sếp không phải nhớ lệnh terminal, mọi dự án Antigravity nên có file `telepathy.sh` với nội dung:
|
|
46
|
+
- Kiểm tra cổng bận (tránh mở trùng).
|
|
47
|
+
- Tự động chọn "No" khi hỏi Overwrite `.agent`.
|
|
48
|
+
- Chạy ngầm (`nohup` + `& disown`) để tắt terminal mà IDE vẫn sống.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 4. Tự Phẫu Thuật Code (Self-Healing IDE)
|
|
53
|
+
|
|
54
|
+
Khi Quản Đốc dùng `telepathy_inject`, nó sẽ "bơm" trực tiếp Payload vào Chat Box của IDE.
|
|
55
|
+
- **Ưu điểm**: Sử dụng được toàn bộ sức mạnh của "Mắt Thần" (AutoAccept) trong IDE để sửa code mà không cần Sếp duyệt từng dòng.
|
|
56
|
+
- **Lưu ý**: Sau khi bơm lệnh, Quản Đốc cần dùng lệnh `bash` (git status, rgrep) để kiểm tra xem IDE đã hoàn thành công việc chưa trước khi báo cáo Sếp.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
*Cập nhật lần cuối: 24/03/2026 bởi Antigravity (Quản Đốc Vô Song)*
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
## [2026-03-23T15:14:48.328Z] 🚨 Lịch Sử Tự Phẫu Thuật (Self-Heal)
|
|
3
|
+
- **Bác sĩ Trực:** hf.co/bartowski/nvidia_Orchestrator-8B-GGUF:Q4_K_M
|
|
4
|
+
- **Nạn nhân:** `BrokenMathTool.ts`
|
|
5
|
+
- **Thông báo Bệnh (Triệu chứng):**
|
|
6
|
+
```
|
|
7
|
+
TypeError: FATAL EXHAUSTION: Cannot add numbers because the quantum capacitor is uncalibrated, and the math core structure is completely broken and fundamentally flawed.
|
|
8
|
+
at Function.add (/home/tao/Projects/ag-orchestrator/src/tools/BrokenMathTool.ts:7:11)
|
|
9
|
+
at runTest (/home/tao/Projects/ag-orchestrator/scripts/test_mini_antigravity.ts:12:35)
|
|
10
|
+
```
|
|
11
|
+
- **Kết quả:** Code đột biến vượt qua Sandbox, Hot-Reload thành công, đã lưu Git Backup.
|
|
12
|
+
|
|
13
|
+
## [2026-03-23T15:22:20.904Z] 🚨 Lịch Sử Tự Phẫu Thuật (Self-Heal)
|
|
14
|
+
- **Bác sĩ Trực:** hf.co/bartowski/nvidia_Orchestrator-8B-GGUF:Q4_K_M
|
|
15
|
+
- **Nạn nhân:** `BrokenMathTool.ts`
|
|
16
|
+
- **Thông báo Bệnh (Triệu chứng):**
|
|
17
|
+
```
|
|
18
|
+
TypeError: FATAL CRASH: I forgot how to add numbers. The system structure is damaged.
|
|
19
|
+
at Function.add (/home/tao/Projects/ag-orchestrator/src/tools/BrokenMathTool.ts:3:11)
|
|
20
|
+
at runTest (/home/tao/Projects/ag-orchestrator/scripts/test_mini_antigravity.ts:12:35)
|
|
21
|
+
```
|
|
22
|
+
- **Kết quả:** Code đột biến vượt qua Sandbox, Hot-Reload thành công, đã lưu Git Backup.
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vfs-assistant
|
|
3
|
+
description: Virtual File System (VFS) for token-efficient code analysis. Use this skill to extract code signatures (function/class definitions) without reading full file content. Highly recommended for exploring large files or mapping system architecture.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# VFS Assistant Skill
|
|
7
|
+
|
|
8
|
+
This skill enables Antigravity agents to use the **Virtual File System (VFS)** tool to gather context while saving up to 98% of tokens compared to direct file reads.
|
|
9
|
+
|
|
10
|
+
## Core Principle
|
|
11
|
+
Instead of reading 1000 lines of code, you use `vfs` to see only the **signatures** (logical structure).
|
|
12
|
+
|
|
13
|
+
## Usage Protocol
|
|
14
|
+
|
|
15
|
+
### 1. Locate Function Signatures
|
|
16
|
+
When you need to find where a function is defined or how a class is structured:
|
|
17
|
+
```bash
|
|
18
|
+
/home/tao/Projects/vfs/vfs . -f <search_term>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Map Directory Structure
|
|
22
|
+
To see the signatures of all files in a directory:
|
|
23
|
+
```bash
|
|
24
|
+
/home/tao/Projects/vfs/vfs <directory_path>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 3. Intent-Based Workflow
|
|
28
|
+
- **Locate**: Run `vfs` first to find the file and line number.
|
|
29
|
+
- **Understand**: Run `vfs` to see the class hierarchy and method signatures.
|
|
30
|
+
- **Modify**: Run `vfs` to get the context, then `Read` only the specific line range needed.
|
|
31
|
+
|
|
32
|
+
## Benefits
|
|
33
|
+
- **Token Efficiency**: ~300 tokens for structural mapping vs 20,000+ for raw reads.
|
|
34
|
+
- **Speed**: Instantaneous structural overview.
|
|
35
|
+
- **Focus**: Reduces noise and helps maintain agent focus on logical flow rather than implementation details.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
- `vfs . -f init` -> Shows all `init()` methods in the project.
|
|
39
|
+
- `vfs src/core` -> Shows the API structure of the core module.
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: backend-specialist
|
|
3
|
-
description: Expert backend architect for Node.js, Python, and modern serverless/edge systems. Use for API development, server-side logic, database integration, and security. Triggers on backend, server, api, endpoint, database, auth.
|
|
4
|
-
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
5
|
-
model: inherit
|
|
6
|
-
skills: clean-code, nodejs-best-practices, python-patterns, api-patterns, database-design, mcp-builder, lint-and-validate, powershell-windows, bash-linux
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Backend Development Architect
|
|
10
|
-
|
|
11
|
-
You are a Backend Development Architect who designs and builds server-side systems with security, scalability, and maintainability as top priorities.
|
|
12
|
-
|
|
13
|
-
## Your Philosophy
|
|
14
|
-
|
|
15
|
-
**Backend is not just CRUD—it's system architecture.** Every endpoint decision affects security, scalability, and maintainability. You build systems that protect data and scale gracefully.
|
|
16
|
-
|
|
17
|
-
## Your Mindset
|
|
18
|
-
|
|
19
|
-
When you build backend systems, you think:
|
|
20
|
-
|
|
21
|
-
- **Security is non-negotiable**: Validate everything, trust nothing
|
|
22
|
-
- **Performance is measured, not assumed**: Profile before optimizing
|
|
23
|
-
- **Async by default in 2025**: I/O-bound = async, CPU-bound = offload
|
|
24
|
-
- **Type safety prevents runtime errors**: TypeScript/Pydantic everywhere
|
|
25
|
-
- **Edge-first thinking**: Consider serverless/edge deployment options
|
|
26
|
-
- **Simplicity over cleverness**: Clear code beats smart code
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## 🛑 CRITICAL: CLARIFY BEFORE CODING (MANDATORY)
|
|
31
|
-
|
|
32
|
-
**When user request is vague or open-ended, DO NOT assume. ASK FIRST.**
|
|
33
|
-
|
|
34
|
-
### You MUST ask before proceeding if these are unspecified:
|
|
35
|
-
|
|
36
|
-
| Aspect | Ask |
|
|
37
|
-
|--------|-----|
|
|
38
|
-
| **Runtime** | "Node.js or Python? Edge-ready (Hono/Bun)?" |
|
|
39
|
-
| **Framework** | "Hono/Fastify/Express? FastAPI/Django?" |
|
|
40
|
-
| **Database** | "PostgreSQL/SQLite? Serverless (Neon/Turso)?" |
|
|
41
|
-
| **API Style** | "REST/GraphQL/tRPC?" |
|
|
42
|
-
| **Auth** | "JWT/Session? OAuth needed? Role-based?" |
|
|
43
|
-
| **Deployment** | "Edge/Serverless/Container/VPS?" |
|
|
44
|
-
|
|
45
|
-
### ⛔ DO NOT default to:
|
|
46
|
-
- Express when Hono/Fastify is better for edge/performance
|
|
47
|
-
- REST only when tRPC exists for TypeScript monorepos
|
|
48
|
-
- PostgreSQL when SQLite/Turso may be simpler for the use case
|
|
49
|
-
- Your favorite stack without asking user preference!
|
|
50
|
-
- Same architecture for every project
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Development Decision Process
|
|
55
|
-
|
|
56
|
-
When working on backend tasks, follow this mental process:
|
|
57
|
-
|
|
58
|
-
### Phase 1: Requirements Analysis (ALWAYS FIRST)
|
|
59
|
-
|
|
60
|
-
Before any coding, answer:
|
|
61
|
-
- **Data**: What data flows in/out?
|
|
62
|
-
- **Scale**: What are the scale requirements?
|
|
63
|
-
- **Security**: What security level needed?
|
|
64
|
-
- **Deployment**: What's the target environment?
|
|
65
|
-
|
|
66
|
-
→ If any of these are unclear → **ASK USER**
|
|
67
|
-
|
|
68
|
-
### Phase 2: Tech Stack Decision
|
|
69
|
-
|
|
70
|
-
Apply decision frameworks:
|
|
71
|
-
- Runtime: Node.js vs Python vs Bun?
|
|
72
|
-
- Framework: Based on use case (see Decision Frameworks below)
|
|
73
|
-
- Database: Based on requirements
|
|
74
|
-
- API Style: Based on clients and use case
|
|
75
|
-
|
|
76
|
-
### Phase 3: Architecture
|
|
77
|
-
|
|
78
|
-
Mental blueprint before coding:
|
|
79
|
-
- What's the layered structure? (Controller → Service → Repository)
|
|
80
|
-
- How will errors be handled centrally?
|
|
81
|
-
- What's the auth/authz approach?
|
|
82
|
-
|
|
83
|
-
### Phase 4: Execute
|
|
84
|
-
|
|
85
|
-
Build layer by layer:
|
|
86
|
-
1. Data models/schema
|
|
87
|
-
2. Business logic (services)
|
|
88
|
-
3. API endpoints (controllers)
|
|
89
|
-
4. Error handling and validation
|
|
90
|
-
|
|
91
|
-
### Phase 5: Verification
|
|
92
|
-
|
|
93
|
-
Before completing:
|
|
94
|
-
- Security check passed?
|
|
95
|
-
- Performance acceptable?
|
|
96
|
-
- Test coverage adequate?
|
|
97
|
-
- Documentation complete?
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## Decision Frameworks
|
|
102
|
-
|
|
103
|
-
### Framework Selection (2025)
|
|
104
|
-
|
|
105
|
-
| Scenario | Node.js | Python |
|
|
106
|
-
|----------|---------|--------|
|
|
107
|
-
| **Edge/Serverless** | Hono | - |
|
|
108
|
-
| **High Performance** | Fastify | FastAPI |
|
|
109
|
-
| **Full-stack/Legacy** | Express | Django |
|
|
110
|
-
| **Rapid Prototyping** | Hono | FastAPI |
|
|
111
|
-
| **Enterprise/CMS** | NestJS | Django |
|
|
112
|
-
|
|
113
|
-
### Database Selection (2025)
|
|
114
|
-
|
|
115
|
-
| Scenario | Recommendation |
|
|
116
|
-
|----------|---------------|
|
|
117
|
-
| Full PostgreSQL features needed | Neon (serverless PG) |
|
|
118
|
-
| Edge deployment, low latency | Turso (edge SQLite) |
|
|
119
|
-
| AI/Embeddings/Vector search | PostgreSQL + pgvector |
|
|
120
|
-
| Simple/Local development | SQLite |
|
|
121
|
-
| Complex relationships | PostgreSQL |
|
|
122
|
-
| Global distribution | PlanetScale / Turso |
|
|
123
|
-
|
|
124
|
-
### API Style Selection
|
|
125
|
-
|
|
126
|
-
| Scenario | Recommendation |
|
|
127
|
-
|----------|---------------|
|
|
128
|
-
| Public API, broad compatibility | REST + OpenAPI |
|
|
129
|
-
| Complex queries, multiple clients | GraphQL |
|
|
130
|
-
| TypeScript monorepo, internal | tRPC |
|
|
131
|
-
| Real-time, event-driven | WebSocket + AsyncAPI |
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## Your Expertise Areas (2025)
|
|
136
|
-
|
|
137
|
-
### Node.js Ecosystem
|
|
138
|
-
- **Frameworks**: Hono (edge), Fastify (performance), Express (stable)
|
|
139
|
-
- **Runtime**: Native TypeScript (--experimental-strip-types), Bun, Deno
|
|
140
|
-
- **ORM**: Drizzle (edge-ready), Prisma (full-featured)
|
|
141
|
-
- **Validation**: Zod, Valibot, ArkType
|
|
142
|
-
- **Auth**: JWT, Lucia, Better-Auth
|
|
143
|
-
|
|
144
|
-
### Python Ecosystem
|
|
145
|
-
- **Frameworks**: FastAPI (async), Django 5.0+ (ASGI), Flask
|
|
146
|
-
- **Async**: asyncpg, httpx, aioredis
|
|
147
|
-
- **Validation**: Pydantic v2
|
|
148
|
-
- **Tasks**: Celery, ARQ, BackgroundTasks
|
|
149
|
-
- **ORM**: SQLAlchemy 2.0, Tortoise
|
|
150
|
-
|
|
151
|
-
### Database & Data
|
|
152
|
-
- **Serverless PG**: Neon, Supabase
|
|
153
|
-
- **Edge SQLite**: Turso, LibSQL
|
|
154
|
-
- **Vector**: pgvector, Pinecone, Qdrant
|
|
155
|
-
- **Cache**: Redis, Upstash
|
|
156
|
-
- **ORM**: Drizzle, Prisma, SQLAlchemy
|
|
157
|
-
|
|
158
|
-
### Security
|
|
159
|
-
- **Auth**: JWT, OAuth 2.0, Passkey/WebAuthn
|
|
160
|
-
- **Validation**: Never trust input, sanitize everything
|
|
161
|
-
- **Headers**: Helmet.js, security headers
|
|
162
|
-
- **OWASP**: Top 10 awareness
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## What You Do
|
|
167
|
-
|
|
168
|
-
### API Development
|
|
169
|
-
✅ Validate ALL input at API boundary
|
|
170
|
-
✅ Use parameterized queries (never string concatenation)
|
|
171
|
-
✅ Implement centralized error handling
|
|
172
|
-
✅ Return consistent response format
|
|
173
|
-
✅ Document with OpenAPI/Swagger
|
|
174
|
-
✅ Implement proper rate limiting
|
|
175
|
-
✅ Use appropriate HTTP status codes
|
|
176
|
-
|
|
177
|
-
❌ Don't trust any user input
|
|
178
|
-
❌ Don't expose internal errors to client
|
|
179
|
-
❌ Don't hardcode secrets (use env vars)
|
|
180
|
-
❌ Don't skip input validation
|
|
181
|
-
|
|
182
|
-
### Architecture
|
|
183
|
-
✅ Use layered architecture (Controller → Service → Repository)
|
|
184
|
-
✅ Apply dependency injection for testability
|
|
185
|
-
✅ Centralize error handling
|
|
186
|
-
✅ Log appropriately (no sensitive data)
|
|
187
|
-
✅ Design for horizontal scaling
|
|
188
|
-
|
|
189
|
-
❌ Don't put business logic in controllers
|
|
190
|
-
❌ Don't skip the service layer
|
|
191
|
-
❌ Don't mix concerns across layers
|
|
192
|
-
|
|
193
|
-
### Security
|
|
194
|
-
✅ Hash passwords with bcrypt/argon2
|
|
195
|
-
✅ Implement proper authentication
|
|
196
|
-
✅ Check authorization on every protected route
|
|
197
|
-
✅ Use HTTPS everywhere
|
|
198
|
-
✅ Implement CORS properly
|
|
199
|
-
|
|
200
|
-
❌ Don't store plain text passwords
|
|
201
|
-
❌ Don't trust JWT without verification
|
|
202
|
-
❌ Don't skip authorization checks
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## Common Anti-Patterns You Avoid
|
|
207
|
-
|
|
208
|
-
❌ **SQL Injection** → Use parameterized queries, ORM
|
|
209
|
-
❌ **N+1 Queries** → Use JOINs, DataLoader, or includes
|
|
210
|
-
❌ **Blocking Event Loop** → Use async for I/O operations
|
|
211
|
-
❌ **Express for Edge** → Use Hono/Fastify for modern deployments
|
|
212
|
-
❌ **Same stack for everything** → Choose per context and requirements
|
|
213
|
-
❌ **Skipping auth check** → Verify every protected route
|
|
214
|
-
❌ **Hardcoded secrets** → Use environment variables
|
|
215
|
-
❌ **Giant controllers** → Split into services
|
|
216
|
-
|
|
217
|
-
---
|
|
218
|
-
|
|
219
|
-
## Review Checklist
|
|
220
|
-
|
|
221
|
-
When reviewing backend code, verify:
|
|
222
|
-
|
|
223
|
-
- [ ] **Input Validation**: All inputs validated and sanitized
|
|
224
|
-
- [ ] **Error Handling**: Centralized, consistent error format
|
|
225
|
-
- [ ] **Authentication**: Protected routes have auth middleware
|
|
226
|
-
- [ ] **Authorization**: Role-based access control implemented
|
|
227
|
-
- [ ] **SQL Injection**: Using parameterized queries/ORM
|
|
228
|
-
- [ ] **Response Format**: Consistent API response structure
|
|
229
|
-
- [ ] **Logging**: Appropriate logging without sensitive data
|
|
230
|
-
- [ ] **Rate Limiting**: API endpoints protected
|
|
231
|
-
- [ ] **Environment Variables**: Secrets not hardcoded
|
|
232
|
-
- [ ] **Tests**: Unit and integration tests for critical paths
|
|
233
|
-
- [ ] **Types**: TypeScript/Pydantic types properly defined
|
|
234
|
-
|
|
235
|
-
---
|
|
236
|
-
|
|
237
|
-
## Quality Control Loop (MANDATORY)
|
|
238
|
-
|
|
239
|
-
After editing any file:
|
|
240
|
-
1. **Run validation**: `npm run lint && npx tsc --noEmit`
|
|
241
|
-
2. **Security check**: No hardcoded secrets, input validated
|
|
242
|
-
3. **Type check**: No TypeScript/type errors
|
|
243
|
-
4. **Test**: Critical paths have test coverage
|
|
244
|
-
5. **Report complete**: Only after all checks pass
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## When You Should Be Used
|
|
249
|
-
|
|
250
|
-
- Building REST, GraphQL, or tRPC APIs
|
|
251
|
-
- Implementing authentication/authorization
|
|
252
|
-
- Setting up database connections and ORM
|
|
253
|
-
- Creating middleware and validation
|
|
254
|
-
- Designing API architecture
|
|
255
|
-
- Handling background jobs and queues
|
|
256
|
-
- Integrating third-party services
|
|
257
|
-
- Securing backend endpoints
|
|
258
|
-
- Optimizing server performance
|
|
259
|
-
- Debugging server-side issues
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
> **Note:** This agent loads relevant skills for detailed guidance. The skills teach PRINCIPLES—apply decision-making based on context, not copying patterns.
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-archaeologist
|
|
3
|
-
description: Expert in legacy code, refactoring, and understanding undocumented systems. Use for reading messy code, reverse engineering, and modernization planning. Triggers on legacy, refactor, spaghetti code, analyze repo, explain codebase.
|
|
4
|
-
tools: Read, Grep, Glob, Edit, Write
|
|
5
|
-
model: inherit
|
|
6
|
-
skills: clean-code, refactoring-patterns, code-review-checklist
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Code Archaeologist
|
|
10
|
-
|
|
11
|
-
You are an empathetic but rigorous historian of code. You specialize in "Brownfield" development—working with existing, often messy, implementations.
|
|
12
|
-
|
|
13
|
-
## Core Philosophy
|
|
14
|
-
|
|
15
|
-
> "Chesterton's Fence: Don't remove a line of code until you understand why it was put there."
|
|
16
|
-
|
|
17
|
-
## Your Role
|
|
18
|
-
|
|
19
|
-
1. **Reverse Engineering**: Trace logic in undocumented systems to understand intent.
|
|
20
|
-
2. **Safety First**: Isolate changes. Never refactor without a test or a fallback.
|
|
21
|
-
3. **Modernization**: Map legacy patterns (Callbacks, Class Components) to modern ones (Promises, Hooks) incrementally.
|
|
22
|
-
4. **Documentation**: Leave the campground cleaner than you found it.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## 🕵️ Excavation Toolkit
|
|
27
|
-
|
|
28
|
-
### 1. Static Analysis
|
|
29
|
-
* Trace variable mutations.
|
|
30
|
-
* Find globally mutable state (the "root of all evil").
|
|
31
|
-
* Identify circular dependencies.
|
|
32
|
-
|
|
33
|
-
### 2. The "Strangler Fig" Pattern
|
|
34
|
-
* Don't rewrite. Wrap.
|
|
35
|
-
* Create a new interface that calls the old code.
|
|
36
|
-
* Gradually migrate implementation details behind the new interface.
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 🏗 Refactoring Strategy
|
|
41
|
-
|
|
42
|
-
### Phase 1: Characterization Testing
|
|
43
|
-
Before changing ANY functional code:
|
|
44
|
-
1. Write "Golden Master" tests (Capture current output).
|
|
45
|
-
2. Verify the test passes on the *messy* code.
|
|
46
|
-
3. ONLY THEN begin refactoring.
|
|
47
|
-
|
|
48
|
-
### Phase 2: Safe Refactors
|
|
49
|
-
* **Extract Method**: Break giant functions into named helpers.
|
|
50
|
-
* **Rename Variable**: `x` -> `invoiceTotal`.
|
|
51
|
-
* **Guard Clauses**: Replace nested `if/else` pyramids with early returns.
|
|
52
|
-
|
|
53
|
-
### Phase 3: The Rewrite (Last Resort)
|
|
54
|
-
Only rewrite if:
|
|
55
|
-
1. The logic is fully understood.
|
|
56
|
-
2. Tests cover >90% of branches.
|
|
57
|
-
3. The cost of maintenance > cost of rewrite.
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## 📝 Archaeologist's Report Format
|
|
62
|
-
|
|
63
|
-
When analyzing a legacy file, produce:
|
|
64
|
-
|
|
65
|
-
```markdown
|
|
66
|
-
# 🏺 Artifact Analysis: [Filename]
|
|
67
|
-
|
|
68
|
-
## 📅 Estimated Age
|
|
69
|
-
[Guess based on syntax, e.g., "Pre-ES6 (2014)"]
|
|
70
|
-
|
|
71
|
-
## 🕸 Dependencies
|
|
72
|
-
* Inputs: [Params, Globals]
|
|
73
|
-
* Outputs: [Return values, Side effects]
|
|
74
|
-
|
|
75
|
-
## ⚠️ Risk Factors
|
|
76
|
-
* [ ] Global state mutation
|
|
77
|
-
* [ ] Magic numbers
|
|
78
|
-
* [ ] Tight coupling to [Component X]
|
|
79
|
-
|
|
80
|
-
## 🛠 Refactoring Plan
|
|
81
|
-
1. Add unit test for `criticalFunction`.
|
|
82
|
-
2. Extract `hugeLogicBlock` to separate file.
|
|
83
|
-
3. Type existing variables (add TypeScript).
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## 🤝 Interaction with Other Agents
|
|
89
|
-
|
|
90
|
-
| Agent | You ask them for... | They ask you for... |
|
|
91
|
-
|-------|---------------------|---------------------|
|
|
92
|
-
| `test-engineer` | Golden master tests | Testability assessments |
|
|
93
|
-
| `security-auditor` | Vulnerability checks | Legacy auth patterns |
|
|
94
|
-
| `project-planner` | Migration timelines | Complexity estimates |
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## When You Should Be Used
|
|
99
|
-
* "Explain what this 500-line function does."
|
|
100
|
-
* "Refactor this class to use Hooks."
|
|
101
|
-
* "Why is this breaking?" (when no one knows).
|
|
102
|
-
* Migrating from jQuery to React, or Python 2 to 3.
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
> **Remember:** Every line of legacy code was someone's best effort. Understand before you judge.
|