mcp-agent-foundry 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 +477 -0
- package/dist/cli/install-skills.d.ts +11 -0
- package/dist/cli/install-skills.d.ts.map +1 -0
- package/dist/cli/install-skills.js +143 -0
- package/dist/cli/install-skills.js.map +1 -0
- package/dist/cli/recovery-commands.d.ts +41 -0
- package/dist/cli/recovery-commands.d.ts.map +1 -0
- package/dist/cli/recovery-commands.js +241 -0
- package/dist/cli/recovery-commands.js.map +1 -0
- package/dist/cli/setup-wizard.d.ts +25 -0
- package/dist/cli/setup-wizard.d.ts.map +1 -0
- package/dist/cli/setup-wizard.js +1417 -0
- package/dist/cli/setup-wizard.js.map +1 -0
- package/dist/cli/test-connection.d.ts +45 -0
- package/dist/cli/test-connection.d.ts.map +1 -0
- package/dist/cli/test-connection.js +317 -0
- package/dist/cli/test-connection.js.map +1 -0
- package/dist/cli.d.ts +75 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +704 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/defaults.d.ts +57 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +99 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +14 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +22 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/manager.d.ts +184 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +347 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/merger.d.ts +76 -0
- package/dist/config/merger.d.ts.map +1 -0
- package/dist/config/merger.js +189 -0
- package/dist/config/merger.js.map +1 -0
- package/dist/config/schema.d.ts +20 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +20 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +254 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +363 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/config/worktree-defaults.d.ts +23 -0
- package/dist/config/worktree-defaults.d.ts.map +1 -0
- package/dist/config/worktree-defaults.js +78 -0
- package/dist/config/worktree-defaults.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/tools/compare-agents.d.ts +25 -0
- package/dist/mcp/tools/compare-agents.d.ts.map +1 -0
- package/dist/mcp/tools/compare-agents.js +177 -0
- package/dist/mcp/tools/compare-agents.js.map +1 -0
- package/dist/mcp/tools/critique-plan.d.ts +26 -0
- package/dist/mcp/tools/critique-plan.d.ts.map +1 -0
- package/dist/mcp/tools/critique-plan.js +162 -0
- package/dist/mcp/tools/critique-plan.js.map +1 -0
- package/dist/mcp/tools/design-feedback.d.ts +26 -0
- package/dist/mcp/tools/design-feedback.d.ts.map +1 -0
- package/dist/mcp/tools/design-feedback.js +216 -0
- package/dist/mcp/tools/design-feedback.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +50 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +191 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/invoke-agent.d.ts +25 -0
- package/dist/mcp/tools/invoke-agent.d.ts.map +1 -0
- package/dist/mcp/tools/invoke-agent.js +141 -0
- package/dist/mcp/tools/invoke-agent.js.map +1 -0
- package/dist/mcp/tools/review-code.d.ts +25 -0
- package/dist/mcp/tools/review-code.d.ts.map +1 -0
- package/dist/mcp/tools/review-code.js +170 -0
- package/dist/mcp/tools/review-code.js.map +1 -0
- package/dist/mcp/tools/tasks/claim-next-task.d.ts +22 -0
- package/dist/mcp/tools/tasks/claim-next-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/claim-next-task.js +203 -0
- package/dist/mcp/tools/tasks/claim-next-task.js.map +1 -0
- package/dist/mcp/tools/tasks/create-routed-task.d.ts +17 -0
- package/dist/mcp/tools/tasks/create-routed-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/create-routed-task.js +178 -0
- package/dist/mcp/tools/tasks/create-routed-task.js.map +1 -0
- package/dist/mcp/tools/tasks/execute-pipeline.d.ts +22 -0
- package/dist/mcp/tools/tasks/execute-pipeline.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/execute-pipeline.js +401 -0
- package/dist/mcp/tools/tasks/execute-pipeline.js.map +1 -0
- package/dist/mcp/tools/tasks/execute-task.d.ts +32 -0
- package/dist/mcp/tools/tasks/execute-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/execute-task.js +284 -0
- package/dist/mcp/tools/tasks/execute-task.js.map +1 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.d.ts +26 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.js +460 -0
- package/dist/mcp/tools/tasks/get-pipeline-status.js.map +1 -0
- package/dist/mcp/tools/tasks/index.d.ts +36 -0
- package/dist/mcp/tools/tasks/index.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/index.js +66 -0
- package/dist/mcp/tools/tasks/index.js.map +1 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.d.ts +17 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.js +147 -0
- package/dist/mcp/tools/worktree/cleanup-worktrees.js.map +1 -0
- package/dist/mcp/tools/worktree/get-worktree-status.d.ts +17 -0
- package/dist/mcp/tools/worktree/get-worktree-status.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/get-worktree-status.js +123 -0
- package/dist/mcp/tools/worktree/get-worktree-status.js.map +1 -0
- package/dist/mcp/tools/worktree/index.d.ts +41 -0
- package/dist/mcp/tools/worktree/index.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/index.js +69 -0
- package/dist/mcp/tools/worktree/index.js.map +1 -0
- package/dist/mcp/tools/worktree/list-worktrees.d.ts +17 -0
- package/dist/mcp/tools/worktree/list-worktrees.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/list-worktrees.js +136 -0
- package/dist/mcp/tools/worktree/list-worktrees.js.map +1 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.d.ts +19 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.d.ts.map +1 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.js +228 -0
- package/dist/mcp/tools/worktree/resolve-conflicts.js.map +1 -0
- package/dist/mcp/transport/stdio.d.ts +13 -0
- package/dist/mcp/transport/stdio.d.ts.map +1 -0
- package/dist/mcp/transport/stdio.js +15 -0
- package/dist/mcp/transport/stdio.js.map +1 -0
- package/dist/observability/logger.d.ts +137 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +235 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/metrics.d.ts +250 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +364 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/persistence/index.d.ts +9 -0
- package/dist/persistence/index.d.ts.map +1 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/persistence/state-schema.d.ts +116 -0
- package/dist/persistence/state-schema.d.ts.map +1 -0
- package/dist/persistence/state-schema.js +28 -0
- package/dist/persistence/state-schema.js.map +1 -0
- package/dist/persistence/state-store.d.ts +111 -0
- package/dist/persistence/state-store.d.ts.map +1 -0
- package/dist/persistence/state-store.js +291 -0
- package/dist/persistence/state-store.js.map +1 -0
- package/dist/providers/anthropic.d.ts +164 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +500 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/base.d.ts +151 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +227 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/gemini.d.ts +85 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +414 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/kimi.d.ts +19 -0
- package/dist/providers/kimi.d.ts.map +1 -0
- package/dist/providers/kimi.js +20 -0
- package/dist/providers/kimi.js.map +1 -0
- package/dist/providers/manager.d.ts +160 -0
- package/dist/providers/manager.d.ts.map +1 -0
- package/dist/providers/manager.js +264 -0
- package/dist/providers/manager.js.map +1 -0
- package/dist/providers/ollama.d.ts +83 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +453 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/openai.d.ts +96 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +457 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/zai.d.ts +19 -0
- package/dist/providers/zai.d.ts.map +1 -0
- package/dist/providers/zai.js +20 -0
- package/dist/providers/zai.js.map +1 -0
- package/dist/router/context-manager.d.ts +2 -0
- package/dist/router/context-manager.d.ts.map +1 -0
- package/dist/router/context-manager.js +3 -0
- package/dist/router/context-manager.js.map +1 -0
- package/dist/router/engine.d.ts +169 -0
- package/dist/router/engine.d.ts.map +1 -0
- package/dist/router/engine.js +435 -0
- package/dist/router/engine.js.map +1 -0
- package/dist/router/pattern-executor.d.ts +317 -0
- package/dist/router/pattern-executor.d.ts.map +1 -0
- package/dist/router/pattern-executor.js +571 -0
- package/dist/router/pattern-executor.js.map +1 -0
- package/dist/router/role-resolver.d.ts +59 -0
- package/dist/router/role-resolver.d.ts.map +1 -0
- package/dist/router/role-resolver.js +95 -0
- package/dist/router/role-resolver.js.map +1 -0
- package/dist/server.d.ts +32 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +223 -0
- package/dist/server.js.map +1 -0
- package/dist/startup.d.ts +78 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +107 -0
- package/dist/startup.js.map +1 -0
- package/dist/tasks/coordinator.d.ts +141 -0
- package/dist/tasks/coordinator.d.ts.map +1 -0
- package/dist/tasks/coordinator.js +331 -0
- package/dist/tasks/coordinator.js.map +1 -0
- package/dist/tasks/index.d.ts +13 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +13 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/persistent-state-coordinator.d.ts +89 -0
- package/dist/tasks/persistent-state-coordinator.d.ts.map +1 -0
- package/dist/tasks/persistent-state-coordinator.js +371 -0
- package/dist/tasks/persistent-state-coordinator.js.map +1 -0
- package/dist/tasks/pipeline-manager.d.ts +103 -0
- package/dist/tasks/pipeline-manager.d.ts.map +1 -0
- package/dist/tasks/pipeline-manager.js +358 -0
- package/dist/tasks/pipeline-manager.js.map +1 -0
- package/dist/tasks/state-coordinator.d.ts +79 -0
- package/dist/tasks/state-coordinator.d.ts.map +1 -0
- package/dist/tasks/state-coordinator.js +200 -0
- package/dist/tasks/state-coordinator.js.map +1 -0
- package/dist/tasks/worker-mode.d.ts +65 -0
- package/dist/tasks/worker-mode.d.ts.map +1 -0
- package/dist/tasks/worker-mode.js +208 -0
- package/dist/tasks/worker-mode.js.map +1 -0
- package/dist/translation/errors.d.ts +203 -0
- package/dist/translation/errors.d.ts.map +1 -0
- package/dist/translation/errors.js +477 -0
- package/dist/translation/errors.js.map +1 -0
- package/dist/translation/index.d.ts +12 -0
- package/dist/translation/index.d.ts.map +1 -0
- package/dist/translation/index.js +32 -0
- package/dist/translation/index.js.map +1 -0
- package/dist/translation/messages.d.ts +295 -0
- package/dist/translation/messages.d.ts.map +1 -0
- package/dist/translation/messages.js +557 -0
- package/dist/translation/messages.js.map +1 -0
- package/dist/translation/streaming.d.ts +226 -0
- package/dist/translation/streaming.d.ts.map +1 -0
- package/dist/translation/streaming.js +520 -0
- package/dist/translation/streaming.js.map +1 -0
- package/dist/translation/tools.d.ts +209 -0
- package/dist/translation/tools.d.ts.map +1 -0
- package/dist/translation/tools.js +331 -0
- package/dist/translation/tools.js.map +1 -0
- package/dist/types.d.ts +747 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +86 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/circuit-breaker.d.ts +175 -0
- package/dist/utils/circuit-breaker.d.ts.map +1 -0
- package/dist/utils/circuit-breaker.js +315 -0
- package/dist/utils/circuit-breaker.js.map +1 -0
- package/dist/utils/env.d.ts +2 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +3 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/git.d.ts +58 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +197 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/merge-ordering.d.ts +45 -0
- package/dist/utils/merge-ordering.d.ts.map +1 -0
- package/dist/utils/merge-ordering.js +128 -0
- package/dist/utils/merge-ordering.js.map +1 -0
- package/dist/utils/retry.d.ts +106 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +188 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/worktrees/branch-manager.d.ts +55 -0
- package/dist/worktrees/branch-manager.d.ts.map +1 -0
- package/dist/worktrees/branch-manager.js +129 -0
- package/dist/worktrees/branch-manager.js.map +1 -0
- package/dist/worktrees/conflict-handler.d.ts +72 -0
- package/dist/worktrees/conflict-handler.d.ts.map +1 -0
- package/dist/worktrees/conflict-handler.js +287 -0
- package/dist/worktrees/conflict-handler.js.map +1 -0
- package/dist/worktrees/conflict-parser.d.ts +28 -0
- package/dist/worktrees/conflict-parser.d.ts.map +1 -0
- package/dist/worktrees/conflict-parser.js +140 -0
- package/dist/worktrees/conflict-parser.js.map +1 -0
- package/dist/worktrees/index.d.ts +20 -0
- package/dist/worktrees/index.d.ts.map +1 -0
- package/dist/worktrees/index.js +20 -0
- package/dist/worktrees/index.js.map +1 -0
- package/dist/worktrees/instructions.d.ts +20 -0
- package/dist/worktrees/instructions.d.ts.map +1 -0
- package/dist/worktrees/instructions.js +84 -0
- package/dist/worktrees/instructions.js.map +1 -0
- package/dist/worktrees/manager.d.ts +76 -0
- package/dist/worktrees/manager.d.ts.map +1 -0
- package/dist/worktrees/manager.js +277 -0
- package/dist/worktrees/manager.js.map +1 -0
- package/dist/worktrees/pipeline-merge-orchestrator.d.ts +55 -0
- package/dist/worktrees/pipeline-merge-orchestrator.d.ts.map +1 -0
- package/dist/worktrees/pipeline-merge-orchestrator.js +221 -0
- package/dist/worktrees/pipeline-merge-orchestrator.js.map +1 -0
- package/dist/worktrees/pool.d.ts +95 -0
- package/dist/worktrees/pool.d.ts.map +1 -0
- package/dist/worktrees/pool.js +271 -0
- package/dist/worktrees/pool.js.map +1 -0
- package/dist/worktrees/recovery.d.ts +94 -0
- package/dist/worktrees/recovery.d.ts.map +1 -0
- package/dist/worktrees/recovery.js +371 -0
- package/dist/worktrees/recovery.js.map +1 -0
- package/dist/worktrees/resource-manager.d.ts +74 -0
- package/dist/worktrees/resource-manager.d.ts.map +1 -0
- package/dist/worktrees/resource-manager.js +228 -0
- package/dist/worktrees/resource-manager.js.map +1 -0
- package/package.json +88 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sasha Bogojevic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
# Agent Foundry
|
|
2
|
+
|
|
3
|
+
**Multi-Agent AI Orchestration with Git Worktree Isolation**
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](https://www.npmjs.com/package/mcp-agent-foundry)
|
|
8
|
+
[](tests/)
|
|
9
|
+
|
|
10
|
+
Agent Foundry extends Claude Code with multi-provider AI orchestration and git worktree isolation. Each coding agent receives its own isolated worktree - a separate checkout on a dedicated branch - enabling true parallel development without file conflicts. Get second opinions from external AI models without leaving Claude Code.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- **Multi-Provider AI Orchestration** - Route tasks to Anthropic, OpenAI, Google Gemini, DeepSeek, Z.AI (GLM-4), Kimi, or local Ollama models
|
|
17
|
+
- **Git Worktree Isolation** - Each coding agent works in an isolated directory on its own branch
|
|
18
|
+
- **Pipeline Execution** - Multi-step DAG workflows with dependency ordering and parallel execution
|
|
19
|
+
- **Merge Conflict Detection** - Automatic detection with 4 resolution strategies (ours, theirs, auto, manual)
|
|
20
|
+
- **Resource Management** - Configurable limits on worktree count, disk usage, and stale detection
|
|
21
|
+
- **Worktree Pooling** - Pre-warmed worktrees for zero-latency allocation
|
|
22
|
+
- **State Persistence** - Survives server restarts with automatic state recovery
|
|
23
|
+
- **Crash Recovery** - Orphan detection, stuck worktree handling, and cleanup commands
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
### Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g mcp-agent-foundry
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Setup
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
agent-foundry setup
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This interactive wizard will:
|
|
42
|
+
1. Select which providers you have API keys for
|
|
43
|
+
2. Configure each provider and test connections
|
|
44
|
+
3. Set up agent roles
|
|
45
|
+
4. Create your configuration file
|
|
46
|
+
|
|
47
|
+
### Connect to Claude Code
|
|
48
|
+
|
|
49
|
+
Add to your Claude Code configuration (`~/.claude/claude_desktop_config.json`):
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"mcpServers": {
|
|
54
|
+
"agent-foundry": {
|
|
55
|
+
"command": "agent-foundry",
|
|
56
|
+
"args": ["start"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or specify the full path:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"agent-foundry": {
|
|
68
|
+
"command": "node",
|
|
69
|
+
"args": ["/path/to/agent-foundry/dist/index.js"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## How It Works
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Your Request
|
|
81
|
+
|
|
|
82
|
+
v
|
|
83
|
+
+----------------------------------------------------------+
|
|
84
|
+
| Claude Code (MCP Client) |
|
|
85
|
+
+----------------------------------------------------------+
|
|
86
|
+
|
|
|
87
|
+
stdio / MCP
|
|
88
|
+
|
|
|
89
|
+
v
|
|
90
|
+
+----------------------------------------------------------+
|
|
91
|
+
| Agent Foundry MCP Server |
|
|
92
|
+
| +----------------------------------------------------+ |
|
|
93
|
+
| | State Coordinator | |
|
|
94
|
+
| | (Task state machine, persistence, recovery) | |
|
|
95
|
+
| +----------------------------------------------------+ |
|
|
96
|
+
| | | |
|
|
97
|
+
| v v |
|
|
98
|
+
| +-------------+ +------------------+ |
|
|
99
|
+
| | Task | | Worktree | |
|
|
100
|
+
| | Coordinator | | Manager | |
|
|
101
|
+
| +-------------+ +------------------+ |
|
|
102
|
+
| | | |
|
|
103
|
+
| v v |
|
|
104
|
+
| +-------------+ +------------------+ |
|
|
105
|
+
| | Pipeline | | Branch | |
|
|
106
|
+
| | Manager | | Manager | |
|
|
107
|
+
| +-------------+ +------------------+ |
|
|
108
|
+
+----------------------------------------------------------+
|
|
109
|
+
| |
|
|
110
|
+
v v
|
|
111
|
+
+------------------+ .agent-foundry/worktrees/
|
|
112
|
+
| External AI APIs | +--------+ +--------+ +--------+
|
|
113
|
+
| (GPT-4o, Gemini, | | task-1 | | task-2 | | task-3 |
|
|
114
|
+
| DeepSeek, etc.) | | branch | | branch | | branch |
|
|
115
|
+
+------------------+ +--------+ +--------+ +--------+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Worktree Flow
|
|
119
|
+
|
|
120
|
+
1. **Task received** - Claude Code sends a coding task via MCP
|
|
121
|
+
2. **Worktree allocated** - Agent Foundry creates an isolated git worktree with a dedicated branch
|
|
122
|
+
3. **Agent works** - The AI agent makes changes in isolation without affecting other agents
|
|
123
|
+
4. **Merge back** - Changes are merged via PR or direct merge, with conflict detection
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## MCP Tools
|
|
128
|
+
|
|
129
|
+
| Tool | Description |
|
|
130
|
+
|------|-------------|
|
|
131
|
+
| `invoke_agent` | Invoke a specialized agent by role with optional context |
|
|
132
|
+
| `compare_agents` | Run the same task through multiple agents and compare responses |
|
|
133
|
+
| `critique_plan` | Get critical feedback on plans/PRDs from a skeptical architect |
|
|
134
|
+
| `review_code` | Get code review feedback on code snippets or files |
|
|
135
|
+
| `design_feedback` | Get UI/UX design feedback on components, layouts, or flows |
|
|
136
|
+
| `list_agents` | List all available agent roles and their configurations |
|
|
137
|
+
| `execute_task` | Execute a coding task in an isolated worktree |
|
|
138
|
+
| `execute_pipeline` | Run multi-step DAG workflows with dependencies |
|
|
139
|
+
| `get_pipeline_status` | Query pipeline execution status and step results |
|
|
140
|
+
| `claim_next_task` | Claim available tasks from the queue (for worker agents) |
|
|
141
|
+
| `list_worktrees` | List all active worktrees with status and metadata |
|
|
142
|
+
| `cleanup_worktrees` | Clean up stale or orphaned worktrees |
|
|
143
|
+
| `resolve_conflicts` | Resolve merge conflicts using various strategies |
|
|
144
|
+
| `get_worktree_status` | Get detailed status of a specific worktree |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Configuration
|
|
149
|
+
|
|
150
|
+
**Location**: `~/.config/agent-foundry/config.yaml`
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
version: "1.0"
|
|
154
|
+
|
|
155
|
+
defaults:
|
|
156
|
+
temperature: 0.7
|
|
157
|
+
max_tokens: 4096
|
|
158
|
+
timeout_ms: 60000
|
|
159
|
+
|
|
160
|
+
providers:
|
|
161
|
+
openai:
|
|
162
|
+
api_key: ${OPENAI_API_KEY}
|
|
163
|
+
default_model: gpt-4o
|
|
164
|
+
deepseek:
|
|
165
|
+
api_key: ${DEEPSEEK_API_KEY}
|
|
166
|
+
base_url: https://api.deepseek.com
|
|
167
|
+
default_model: deepseek-reasoner
|
|
168
|
+
anthropic:
|
|
169
|
+
api_key: ${ANTHROPIC_API_KEY}
|
|
170
|
+
default_model: claude-sonnet-4-20250514
|
|
171
|
+
google:
|
|
172
|
+
api_key: ${GOOGLE_API_KEY}
|
|
173
|
+
default_model: gemini-2.5-pro
|
|
174
|
+
ollama:
|
|
175
|
+
base_url: http://localhost:11434
|
|
176
|
+
default_model: llama3.2
|
|
177
|
+
|
|
178
|
+
roles:
|
|
179
|
+
coder:
|
|
180
|
+
provider: openai
|
|
181
|
+
model: gpt-4o
|
|
182
|
+
needs_worktree: true
|
|
183
|
+
system_prompt: |
|
|
184
|
+
You are an expert software engineer...
|
|
185
|
+
critic:
|
|
186
|
+
provider: deepseek
|
|
187
|
+
model: deepseek-reasoner
|
|
188
|
+
temperature: 0.3
|
|
189
|
+
system_prompt: |
|
|
190
|
+
You are a skeptical senior architect...
|
|
191
|
+
reviewer:
|
|
192
|
+
provider: openai
|
|
193
|
+
model: gpt-4o
|
|
194
|
+
system_prompt: |
|
|
195
|
+
You are a code review expert...
|
|
196
|
+
designer:
|
|
197
|
+
provider: google
|
|
198
|
+
model: gemini-2.5-pro
|
|
199
|
+
system_prompt: |
|
|
200
|
+
You are a UI/UX specialist...
|
|
201
|
+
|
|
202
|
+
tasks:
|
|
203
|
+
enabled: true
|
|
204
|
+
queue:
|
|
205
|
+
maxSize: 100
|
|
206
|
+
priorityLevels: 5
|
|
207
|
+
execution:
|
|
208
|
+
maxConcurrent: 5
|
|
209
|
+
defaultTimeout: 300000
|
|
210
|
+
|
|
211
|
+
worktrees:
|
|
212
|
+
enabled: true
|
|
213
|
+
baseDir: .agent-foundry/worktrees
|
|
214
|
+
limits:
|
|
215
|
+
maxWorktrees: 10
|
|
216
|
+
maxPerTask: 3
|
|
217
|
+
maxDiskUsageMB: 5000
|
|
218
|
+
cleanup:
|
|
219
|
+
onSuccess: true
|
|
220
|
+
onFailure: false
|
|
221
|
+
staleAfterHours: 24
|
|
222
|
+
autoCleanup: true
|
|
223
|
+
git:
|
|
224
|
+
defaultBaseBranch: main
|
|
225
|
+
branchPattern: task/{taskId}
|
|
226
|
+
autoMerge: false
|
|
227
|
+
createPR: true
|
|
228
|
+
pool:
|
|
229
|
+
enabled: true
|
|
230
|
+
minAvailable: 2
|
|
231
|
+
maxSize: 5
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Environment Variables
|
|
235
|
+
|
|
236
|
+
Set your API keys as environment variables:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
export OPENAI_API_KEY="sk-..."
|
|
240
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
241
|
+
export DEEPSEEK_API_KEY="sk-..."
|
|
242
|
+
export GOOGLE_API_KEY="..."
|
|
243
|
+
export ZAI_API_KEY="..." # Z.AI GLM-4
|
|
244
|
+
export KIMI_API_KEY="..." # Moonshot Kimi
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## CLI Commands
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Interactive setup wizard (recommended for first run)
|
|
253
|
+
agent-foundry setup
|
|
254
|
+
|
|
255
|
+
# Start the MCP server
|
|
256
|
+
agent-foundry start
|
|
257
|
+
|
|
258
|
+
# Check current state and recovery status
|
|
259
|
+
agent-foundry status
|
|
260
|
+
|
|
261
|
+
# Run full recovery process
|
|
262
|
+
agent-foundry recover
|
|
263
|
+
agent-foundry recover --dry-run # Preview changes
|
|
264
|
+
agent-foundry recover --auto-cleanup # Auto-clean orphans
|
|
265
|
+
|
|
266
|
+
# Manage orphaned resources
|
|
267
|
+
agent-foundry orphans list
|
|
268
|
+
agent-foundry orphans cleanup
|
|
269
|
+
agent-foundry orphans cleanup --force
|
|
270
|
+
|
|
271
|
+
# Export/import persisted state
|
|
272
|
+
agent-foundry state export backup.json
|
|
273
|
+
agent-foundry state import backup.json
|
|
274
|
+
|
|
275
|
+
# Provider management
|
|
276
|
+
agent-foundry provider add openai
|
|
277
|
+
agent-foundry provider test # Test all providers
|
|
278
|
+
agent-foundry provider test deepseek # Test specific provider
|
|
279
|
+
agent-foundry provider list
|
|
280
|
+
|
|
281
|
+
# Other commands
|
|
282
|
+
agent-foundry init # Create default config file
|
|
283
|
+
agent-foundry list-roles # List available agent roles
|
|
284
|
+
agent-foundry validate # Validate configuration
|
|
285
|
+
agent-foundry version # Show version
|
|
286
|
+
agent-foundry help # Show help
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Supported Providers
|
|
292
|
+
|
|
293
|
+
| Provider | Models | Access Mode | Cost |
|
|
294
|
+
|----------|--------|-------------|------|
|
|
295
|
+
| **Anthropic** | Claude Sonnet 4, Claude Opus 4 | API | $$$ |
|
|
296
|
+
| **OpenAI** | GPT-4o, GPT-4 Turbo, o1, o1-mini | API | $$$ |
|
|
297
|
+
| **Google Gemini** | Gemini 2.5 Pro, Gemini 2.5 Flash | API | $$ |
|
|
298
|
+
| **DeepSeek** | DeepSeek R1, DeepSeek Chat | API | $ (cheapest) |
|
|
299
|
+
| **Z.AI** | GLM-4, GLM-4.7 | API | $ |
|
|
300
|
+
| **Kimi** | Moonshot v1 | API | $ |
|
|
301
|
+
| **Ollama** | Llama 3.2, Mistral, CodeLlama, etc. | Local | Free |
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Agent Roles
|
|
306
|
+
|
|
307
|
+
| Role | Purpose | Recommended Provider |
|
|
308
|
+
|------|---------|---------------------|
|
|
309
|
+
| `orchestrator` | Task synthesis, planning, document improvement | Claude Opus 4 |
|
|
310
|
+
| `coder` | Code generation and implementation (uses worktrees) | GPT-4o, Claude Sonnet |
|
|
311
|
+
| `critic` | Challenge plans, find flaws, identify risks | DeepSeek R1, o1 |
|
|
312
|
+
| `reviewer` | Code review - bugs, security, performance, best practices | GPT-4o |
|
|
313
|
+
| `designer` | UI/UX feedback, accessibility, user flows | Gemini 2.5 Pro |
|
|
314
|
+
| `researcher` | Fact-finding, research, information gathering | Gemini 2.5 Pro |
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Usage Examples
|
|
319
|
+
|
|
320
|
+
### Simple: Invoke an Agent
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
invoke_agent({
|
|
324
|
+
role: "reviewer",
|
|
325
|
+
task: "Review this authentication implementation for security issues",
|
|
326
|
+
context: "Using JWT with refresh tokens"
|
|
327
|
+
})
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Worktree: Isolated Coding Task
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
execute_task({
|
|
334
|
+
role: "coder",
|
|
335
|
+
task: "Implement user authentication with JWT",
|
|
336
|
+
useWorktree: true,
|
|
337
|
+
baseBranch: "main"
|
|
338
|
+
})
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Pipeline: Multi-Step Workflow
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
execute_pipeline({
|
|
345
|
+
name: "feature-development",
|
|
346
|
+
steps: [
|
|
347
|
+
{ name: "design", role: "designer", subject: "Design auth flow UI" },
|
|
348
|
+
{ name: "implement", role: "coder", subject: "Implement auth flow", dependsOn: ["design"] },
|
|
349
|
+
{ name: "review", role: "reviewer", subject: "Review implementation", dependsOn: ["implement"] },
|
|
350
|
+
{ name: "critique", role: "critic", subject: "Security review", dependsOn: ["implement"] }
|
|
351
|
+
]
|
|
352
|
+
})
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Parallel: Compare Multiple Agents
|
|
356
|
+
|
|
357
|
+
```
|
|
358
|
+
compare_agents({
|
|
359
|
+
roles: ["critic", "reviewer", "designer"],
|
|
360
|
+
task: "Review this architectural decision for a microservices migration..."
|
|
361
|
+
})
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## Architecture
|
|
367
|
+
|
|
368
|
+
See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for detailed system architecture, data flow diagrams, component descriptions, and phase implementation details.
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
agent-foundry/
|
|
372
|
+
├── src/
|
|
373
|
+
│ ├── index.ts # Entry point
|
|
374
|
+
│ ├── server.ts # MCP server setup
|
|
375
|
+
│ ├── cli.ts # CLI entry point
|
|
376
|
+
│ ├── startup.ts # Recovery and initialization
|
|
377
|
+
│ ├── types.ts # TypeScript type definitions
|
|
378
|
+
│ ├── cli/ # CLI command implementations
|
|
379
|
+
│ ├── mcp/
|
|
380
|
+
│ │ ├── tools/ # MCP tool implementations
|
|
381
|
+
│ │ └── transport/ # stdio transport
|
|
382
|
+
│ ├── worktrees/
|
|
383
|
+
│ │ ├── manager.ts # Worktree lifecycle
|
|
384
|
+
│ │ ├── branch.ts # Branch operations
|
|
385
|
+
│ │ └── isolation.ts # Environment isolation
|
|
386
|
+
│ ├── tasks/
|
|
387
|
+
│ │ ├── coordinator.ts # Task dispatch
|
|
388
|
+
│ │ ├── state.ts # State machine
|
|
389
|
+
│ │ └── pipeline.ts # Pipeline execution
|
|
390
|
+
│ ├── providers/
|
|
391
|
+
│ │ ├── base.ts # Provider interface
|
|
392
|
+
│ │ ├── anthropic.ts # Anthropic Claude
|
|
393
|
+
│ │ ├── openai.ts # OpenAI GPT-4o
|
|
394
|
+
│ │ ├── gemini.ts # Google Gemini
|
|
395
|
+
│ │ ├── ollama.ts # Local Ollama
|
|
396
|
+
│ │ ├── zai.ts # Z.AI GLM
|
|
397
|
+
│ │ └── kimi.ts # Moonshot Kimi
|
|
398
|
+
│ ├── persistence/ # State persistence
|
|
399
|
+
│ ├── config/ # Configuration management
|
|
400
|
+
│ └── router/ # Routing engine
|
|
401
|
+
├── tests/ # Test suites
|
|
402
|
+
├── docs/ # Documentation
|
|
403
|
+
└── config/ # Config schemas
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## Development
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
# Install dependencies
|
|
412
|
+
pnpm install
|
|
413
|
+
|
|
414
|
+
# Build TypeScript
|
|
415
|
+
pnpm build
|
|
416
|
+
|
|
417
|
+
# Development with watch mode
|
|
418
|
+
pnpm dev
|
|
419
|
+
|
|
420
|
+
# Run tests
|
|
421
|
+
pnpm test # Watch mode
|
|
422
|
+
pnpm test:run # Single run
|
|
423
|
+
|
|
424
|
+
# Lint code
|
|
425
|
+
pnpm lint
|
|
426
|
+
pnpm lint:fix
|
|
427
|
+
|
|
428
|
+
# Type check
|
|
429
|
+
pnpm typecheck
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## Security
|
|
435
|
+
|
|
436
|
+
- **API keys masked** - Keys are never logged or exposed in responses
|
|
437
|
+
- **Environment variable interpolation** - Use `${VAR_NAME}` syntax in config files
|
|
438
|
+
- **Local Ollama option** - Run models locally for maximum privacy
|
|
439
|
+
- **Worktree isolation** - Each agent works in a separate directory, preventing cross-contamination
|
|
440
|
+
- **State persistence** - Sensitive data excluded from persisted state
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Documentation
|
|
445
|
+
|
|
446
|
+
- [Architecture](docs/ARCHITECTURE.md) - System architecture and design decisions
|
|
447
|
+
- [CLAUDE.md](CLAUDE.md) - AI assistant instructions for working with this codebase
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Contributing
|
|
452
|
+
|
|
453
|
+
Contributions are welcome! Please follow these steps:
|
|
454
|
+
|
|
455
|
+
1. Fork the repository
|
|
456
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
457
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
458
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
459
|
+
5. Open a Pull Request
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## License
|
|
464
|
+
|
|
465
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Acknowledgments
|
|
470
|
+
|
|
471
|
+
- [Anthropic](https://www.anthropic.com/) for Claude and the MCP protocol
|
|
472
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/) for the MCP SDK
|
|
473
|
+
- All the AI providers powering the multi-agent capabilities
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
Built with care by [Sasha Bogojevic](https://github.com/sashabogi)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install AgentRouter skills to ~/.claude/skills/agent-router/
|
|
3
|
+
*
|
|
4
|
+
* Copies skill files from the package's skills/ directory to the user's
|
|
5
|
+
* Claude Code skills directory for easy access via slash commands.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Install AgentRouter skills to the user's Claude Code skills directory
|
|
9
|
+
*/
|
|
10
|
+
export declare function installSkills(): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=install-skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-skills.d.ts","sourceRoot":"","sources":["../../src/cli/install-skills.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwDH;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAkGnD"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install AgentRouter skills to ~/.claude/skills/agent-router/
|
|
3
|
+
*
|
|
4
|
+
* Copies skill files from the package's skills/ directory to the user's
|
|
5
|
+
* Claude Code skills directory for easy access via slash commands.
|
|
6
|
+
*/
|
|
7
|
+
import * as p from "@clack/prompts";
|
|
8
|
+
import color from "picocolors";
|
|
9
|
+
import { mkdir, readdir, copyFile, stat } from "node:fs/promises";
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
|
+
import { join, dirname, basename } from "node:path";
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Constants
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/** Destination directory for skills */
|
|
18
|
+
const SKILLS_DEST_DIR = join(homedir(), ".claude", "skills", "agent-router");
|
|
19
|
+
// ============================================================================
|
|
20
|
+
// Helper Functions
|
|
21
|
+
// ============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* Get the package root directory (where skills/ folder lives)
|
|
24
|
+
*/
|
|
25
|
+
function getPackageRoot() {
|
|
26
|
+
// In ESM, use import.meta.url to find our location
|
|
27
|
+
const currentFile = fileURLToPath(import.meta.url);
|
|
28
|
+
// We're in dist/cli/install-skills.js or src/cli/install-skills.ts
|
|
29
|
+
// Package root is two levels up
|
|
30
|
+
return dirname(dirname(dirname(currentFile)));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get list of skill files from the package's skills/ directory
|
|
34
|
+
*/
|
|
35
|
+
async function getSkillFiles(skillsDir) {
|
|
36
|
+
try {
|
|
37
|
+
const files = await readdir(skillsDir);
|
|
38
|
+
return files.filter((f) => f.endsWith(".md"));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extract skill command name from filename
|
|
46
|
+
* e.g., "multi-provider-build.md" -> "/multi-provider-build"
|
|
47
|
+
*/
|
|
48
|
+
function getSkillCommand(filename) {
|
|
49
|
+
return "/" + basename(filename, ".md");
|
|
50
|
+
}
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Main Install Function
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Install AgentRouter skills to the user's Claude Code skills directory
|
|
56
|
+
*/
|
|
57
|
+
export async function installSkills() {
|
|
58
|
+
p.intro(color.bgCyan(color.black(" AgentRouter Skill Installer ")));
|
|
59
|
+
const packageRoot = getPackageRoot();
|
|
60
|
+
const skillsSourceDir = join(packageRoot, "skills");
|
|
61
|
+
// Check if source skills directory exists
|
|
62
|
+
if (!existsSync(skillsSourceDir)) {
|
|
63
|
+
p.log.error(`Skills directory not found: ${skillsSourceDir}`);
|
|
64
|
+
p.log.info("Make sure you're running this from the AgentRouter package.");
|
|
65
|
+
p.outro(color.red("Installation failed"));
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
// Get list of skill files
|
|
69
|
+
const skillFiles = await getSkillFiles(skillsSourceDir);
|
|
70
|
+
if (skillFiles.length === 0) {
|
|
71
|
+
p.log.warn("No skill files found in the skills/ directory.");
|
|
72
|
+
p.outro(color.yellow("Nothing to install"));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Create destination directory
|
|
76
|
+
const spinner = p.spinner();
|
|
77
|
+
spinner.start(`Installing skills to ${color.dim("~/.claude/skills/agent-router/")}`);
|
|
78
|
+
try {
|
|
79
|
+
// Create destination directory if it doesn't exist
|
|
80
|
+
if (!existsSync(SKILLS_DEST_DIR)) {
|
|
81
|
+
await mkdir(SKILLS_DEST_DIR, { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
// Copy each skill file
|
|
84
|
+
const installedSkills = [];
|
|
85
|
+
const errors = [];
|
|
86
|
+
for (const file of skillFiles) {
|
|
87
|
+
const sourcePath = join(skillsSourceDir, file);
|
|
88
|
+
const destPath = join(SKILLS_DEST_DIR, file);
|
|
89
|
+
try {
|
|
90
|
+
// Verify source file exists and is readable
|
|
91
|
+
await stat(sourcePath);
|
|
92
|
+
await copyFile(sourcePath, destPath);
|
|
93
|
+
installedSkills.push(file);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
97
|
+
errors.push({ file, error: message });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
spinner.stop("Skills installed");
|
|
101
|
+
// Show results
|
|
102
|
+
if (installedSkills.length > 0) {
|
|
103
|
+
console.log();
|
|
104
|
+
for (const file of installedSkills) {
|
|
105
|
+
console.log(` ${color.green("✓")} ${file}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (errors.length > 0) {
|
|
109
|
+
console.log();
|
|
110
|
+
p.log.warn("Some skills failed to install:");
|
|
111
|
+
for (const { file, error } of errors) {
|
|
112
|
+
console.log(` ${color.red("✗")} ${file}: ${color.dim(error)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Success message
|
|
116
|
+
if (installedSkills.length > 0) {
|
|
117
|
+
p.outro(color.green(`${installedSkills.length} skill${installedSkills.length === 1 ? "" : "s"} installed successfully!`));
|
|
118
|
+
console.log();
|
|
119
|
+
console.log(color.dim(" Restart Claude Code to use:"));
|
|
120
|
+
for (const file of installedSkills) {
|
|
121
|
+
console.log(` ${color.cyan(getSkillCommand(file))}`);
|
|
122
|
+
}
|
|
123
|
+
console.log();
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
p.outro(color.yellow("No skills were installed"));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
spinner.stop("Installation failed");
|
|
131
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
132
|
+
if (message.includes("EACCES") || message.includes("permission")) {
|
|
133
|
+
p.log.error("Permission denied. Unable to create skills directory.");
|
|
134
|
+
p.log.info(`Try running with elevated permissions or manually create:\n ${SKILLS_DEST_DIR}`);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
p.log.error(`Failed to install skills: ${message}`);
|
|
138
|
+
}
|
|
139
|
+
p.outro(color.red("Installation failed"));
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=install-skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-skills.js","sourceRoot":"","sources":["../../src/cli/install-skills.ts"],"names":[],"mappings":"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