agent-switchboard 0.1.1 → 0.1.3
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 +121 -3
- package/dist/agents/adapter.d.ts +2 -2
- package/dist/agents/claude-code.d.ts +3 -3
- package/dist/agents/claude-code.js +4 -8
- package/dist/agents/claude-code.js.map +1 -1
- package/dist/agents/claude-desktop.d.ts +3 -3
- package/dist/agents/claude-desktop.js +4 -18
- package/dist/agents/claude-desktop.js.map +1 -1
- package/dist/agents/codex.d.ts +5 -5
- package/dist/agents/codex.js +20 -22
- package/dist/agents/codex.js.map +1 -1
- package/dist/agents/cursor.d.ts +3 -3
- package/dist/agents/cursor.js +5 -5
- package/dist/agents/cursor.js.map +1 -1
- package/dist/agents/gemini.d.ts +3 -3
- package/dist/agents/gemini.js +4 -8
- package/dist/agents/gemini.js.map +1 -1
- package/dist/agents/json-utils.js +5 -4
- package/dist/agents/json-utils.js.map +1 -1
- package/dist/agents/opencode.d.ts +3 -3
- package/dist/agents/opencode.js +21 -25
- package/dist/agents/opencode.js.map +1 -1
- package/dist/agents/registry.d.ts +1 -1
- package/dist/agents/registry.js +7 -7
- package/dist/agents/registry.js.map +1 -1
- package/dist/commands/distribution.d.ts +12 -0
- package/dist/commands/distribution.js +96 -0
- package/dist/commands/distribution.js.map +1 -0
- package/dist/commands/importer.d.ts +6 -0
- package/dist/commands/importer.js +66 -0
- package/dist/commands/importer.js.map +1 -0
- package/dist/commands/inventory.d.ts +16 -0
- package/dist/commands/inventory.js +78 -0
- package/dist/commands/inventory.js.map +1 -0
- package/dist/commands/library.d.ts +9 -0
- package/dist/commands/library.js +49 -0
- package/dist/commands/library.js.map +1 -0
- package/dist/commands/template.d.ts +1 -0
- package/dist/commands/template.js +9 -0
- package/dist/commands/template.js.map +1 -0
- package/dist/config/mcp-config.d.ts +1 -1
- package/dist/config/mcp-config.js +26 -27
- package/dist/config/mcp-config.js.map +1 -1
- package/dist/config/paths.d.ts +32 -0
- package/dist/config/paths.js +81 -5
- package/dist/config/paths.js.map +1 -1
- package/dist/config/schemas.d.ts +24 -1
- package/dist/config/schemas.js +9 -2
- package/dist/config/schemas.js.map +1 -1
- package/dist/config/switchboard-config.d.ts +1 -1
- package/dist/config/switchboard-config.js +10 -8
- package/dist/config/switchboard-config.js.map +1 -1
- package/dist/index.js +604 -27
- package/dist/index.js.map +1 -1
- package/dist/library/distribute.d.ts +23 -0
- package/dist/library/distribute.js +66 -0
- package/dist/library/distribute.js.map +1 -0
- package/dist/library/fs.d.ts +14 -0
- package/dist/library/fs.js +55 -0
- package/dist/library/fs.js.map +1 -0
- package/dist/library/parser.d.ts +7 -0
- package/dist/library/parser.js +11 -0
- package/dist/library/parser.js.map +1 -0
- package/dist/library/schema.d.ts +18 -0
- package/dist/library/schema.js +14 -0
- package/dist/library/schema.js.map +1 -0
- package/dist/library/state.d.ts +43 -0
- package/dist/library/state.js +64 -0
- package/dist/library/state.js.map +1 -0
- package/dist/rules/agents.d.ts +3 -0
- package/dist/rules/agents.js +3 -0
- package/dist/rules/agents.js.map +1 -0
- package/dist/rules/composer.d.ts +17 -0
- package/dist/rules/composer.js +71 -0
- package/dist/rules/composer.js.map +1 -0
- package/dist/rules/distribution.d.ts +21 -0
- package/dist/rules/distribution.js +103 -0
- package/dist/rules/distribution.js.map +1 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.js +8 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/inventory.d.ts +17 -0
- package/dist/rules/inventory.js +66 -0
- package/dist/rules/inventory.js.map +1 -0
- package/dist/rules/library.d.ts +9 -0
- package/dist/rules/library.js +49 -0
- package/dist/rules/library.js.map +1 -0
- package/dist/rules/parser.d.ts +6 -0
- package/dist/rules/parser.js +49 -0
- package/dist/rules/parser.js.map +1 -0
- package/dist/rules/schema.d.ts +56 -0
- package/dist/rules/schema.js +22 -0
- package/dist/rules/schema.js.map +1 -0
- package/dist/rules/state.d.ts +5 -0
- package/dist/rules/state.js +71 -0
- package/dist/rules/state.js.map +1 -0
- package/dist/subagents/distribution.d.ts +12 -0
- package/dist/subagents/distribution.js +71 -0
- package/dist/subagents/distribution.js.map +1 -0
- package/dist/subagents/importer.d.ts +6 -0
- package/dist/subagents/importer.js +42 -0
- package/dist/subagents/importer.js.map +1 -0
- package/dist/subagents/inventory.d.ts +17 -0
- package/dist/subagents/inventory.js +111 -0
- package/dist/subagents/inventory.js.map +1 -0
- package/dist/subagents/library.d.ts +9 -0
- package/dist/subagents/library.js +49 -0
- package/dist/subagents/library.js.map +1 -0
- package/dist/subagents/template.d.ts +1 -0
- package/dist/subagents/template.js +9 -0
- package/dist/subagents/template.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/ui/command-ui.d.ts +3 -0
- package/dist/ui/command-ui.js +23 -0
- package/dist/ui/command-ui.js.map +1 -0
- package/dist/ui/library-selector.d.ts +14 -0
- package/dist/ui/library-selector.js +136 -0
- package/dist/ui/library-selector.js.map +1 -0
- package/dist/ui/mcp-ui.d.ts +1 -1
- package/dist/ui/mcp-ui.js +12 -13
- package/dist/ui/mcp-ui.js.map +1 -1
- package/dist/ui/rule-ui.d.ts +5 -0
- package/dist/ui/rule-ui.js +154 -0
- package/dist/ui/rule-ui.js.map +1 -0
- package/dist/ui/subagent-ui.d.ts +3 -0
- package/dist/ui/subagent-ui.js +29 -0
- package/dist/ui/subagent-ui.js.map +1 -0
- package/dist/util/cli.d.ts +6 -0
- package/dist/util/cli.js +24 -0
- package/dist/util/cli.js.map +1 -0
- package/dist/util/extras.d.ts +4 -0
- package/dist/util/extras.js +25 -0
- package/dist/util/extras.js.map +1 -0
- package/dist/util/frontmatter.d.ts +1 -0
- package/dist/util/frontmatter.js +7 -0
- package/dist/util/frontmatter.js.map +1 -0
- package/dist/util/markdown.d.ts +24 -0
- package/dist/util/markdown.js +70 -0
- package/dist/util/markdown.js.map +1 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Manage MCP servers in one place and apply them to local agents (Codex, Claude Code/Desktop, Gemini) and opencode.
|
|
4
4
|
|
|
5
|
+
You can run with either `agent-switchboard` or the shorter alias `asb`.
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
Global install:
|
|
@@ -23,8 +25,6 @@ npx agent-switchboard@latest mcp
|
|
|
23
25
|
|
|
24
26
|
```bash
|
|
25
27
|
agent-switchboard mcp
|
|
26
|
-
# or
|
|
27
|
-
asb mcp
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
That’s it. The tool updates `~/.agent-switchboard/mcp.json` and writes agent configs.
|
|
@@ -38,6 +38,9 @@ Create the file if it does not exist:
|
|
|
38
38
|
```toml
|
|
39
39
|
# ~/.agent-switchboard/config.toml
|
|
40
40
|
agents = ["codex", "cursor"]
|
|
41
|
+
|
|
42
|
+
[rules]
|
|
43
|
+
includeDelimiters = false
|
|
41
44
|
```
|
|
42
45
|
|
|
43
46
|
Supported agent IDs:
|
|
@@ -46,10 +49,125 @@ Supported agent IDs:
|
|
|
46
49
|
- `claude-code` — Claude Code CLI
|
|
47
50
|
- `claude-desktop` — Claude Desktop app
|
|
48
51
|
- `gemini` — Gemini CLI
|
|
49
|
-
|
|
52
|
+
- `opencode` — opencode global config
|
|
53
|
+
|
|
54
|
+
Toggle `rules.includeDelimiters` to `true` if you want each snippet surrounded by markers such as:
|
|
55
|
+
```
|
|
56
|
+
<!-- your-rule-name:start -->
|
|
57
|
+
…
|
|
58
|
+
<!-- your-rule-name:end -->
|
|
59
|
+
```
|
|
50
60
|
|
|
51
61
|
Run `agent-switchboard mcp` again after updating the list.
|
|
52
62
|
|
|
63
|
+
## Rule Library
|
|
64
|
+
|
|
65
|
+
Rule snippets live in `~/.agent-switchboard/rules/` (respects `ASB_HOME`). Each snippet is a Markdown file and can include YAML frontmatter with `title`, `description`, `tags`, and `requires` fields. Example:
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
---
|
|
69
|
+
title: Prompt Hygiene
|
|
70
|
+
tags:
|
|
71
|
+
- hygiene
|
|
72
|
+
requires:
|
|
73
|
+
- claude-code
|
|
74
|
+
---
|
|
75
|
+
Keep commit messages scoped to the change.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Selecting and Ordering Rules
|
|
79
|
+
|
|
80
|
+
Use the interactive selector to choose the active snippets and adjust their order:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
agent-switchboard rule
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Once confirmed, Agent Switchboard composes the merged Markdown, stores the active order, and writes the document to:
|
|
87
|
+
- `~/.claude/CLAUDE.md`
|
|
88
|
+
- `~/.codex/AGENTS.md`
|
|
89
|
+
- `~/.gemini/AGENTS.md`
|
|
90
|
+
- `~/.config/opencode/AGENTS.md` (or `%APPDATA%/opencode/AGENTS.md` on Windows)
|
|
91
|
+
|
|
92
|
+
Unsupportive agents such as Claude Desktop and Cursor are reported and left untouched. If you rerun the selector without changing the order, the tool refreshes the destination files to overwrite any manual edits.
|
|
93
|
+
|
|
94
|
+
### Auditing Rules
|
|
95
|
+
|
|
96
|
+
See the full inventory, activation state, and per-agent sync timestamps:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
agent-switchboard rule list
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Command Library
|
|
103
|
+
|
|
104
|
+
- Location: `~/.agent-switchboard/commands/<slug>.md` (respects `ASB_HOME`).
|
|
105
|
+
- Frontmatter: only global `description` (optional). Any platform-native options must live under `extras.<platform>` and are written through verbatim. No parsing, no key renaming, no documentation of platform keys here.
|
|
106
|
+
|
|
107
|
+
### Import
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Import an existing platform file or directory into the library
|
|
111
|
+
# Use -r/--recursive to traverse subdirectories when <path> is a directory
|
|
112
|
+
agent-switchboard command load <platform> [path] [-r]
|
|
113
|
+
# <platform>: claude-code | codex | gemini | opencode
|
|
114
|
+
# If [path] is omitted, defaults by platform:
|
|
115
|
+
# claude-code → ~/.claude/commands
|
|
116
|
+
# codex → ~/.codex/prompts
|
|
117
|
+
# gemini → ~/.gemini/commands
|
|
118
|
+
# opencode → ~/.config/opencode/command (Windows: %APPDATA%/opencode/command)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Select and Distribute
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
agent-switchboard command
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
On confirm, adapters write each selected command to the corresponding platform output in your user home (platform defaults), using the file format that platform expects. The frontmatter consists of the global `description` (if present) plus `extras.<platform>` written as-is.
|
|
128
|
+
|
|
129
|
+
Files are only rewritten when content changes.
|
|
130
|
+
|
|
131
|
+
### Inventory
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Inventory
|
|
135
|
+
agent-switchboard command list
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Subagent Library
|
|
139
|
+
|
|
140
|
+
- Location: `~/.agent-switchboard/subagents/<slug>.md` (respects `ASB_HOME`).
|
|
141
|
+
- Frontmatter: only global `description` (optional). Any platform-native options must live under `extras.<platform>` and are written through verbatim. We do not parse, validate, or showcase platform key names in this README. Platforms that do not support subagent files are skipped.
|
|
142
|
+
|
|
143
|
+
### Import
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
agent-switchboard subagent load <platform> [path] [-r]
|
|
147
|
+
# <platform>: claude-code | opencode
|
|
148
|
+
# If [path] is omitted, defaults by platform:
|
|
149
|
+
# claude-code → ~/.claude/agents
|
|
150
|
+
# opencode → ~/.config/opencode/agent (Windows: %APPDATA%/opencode/agent)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Select and Distribute
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
agent-switchboard subagent
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
On confirm, adapters write each selected subagent to the corresponding platform output in your user home (platform defaults), using the file format that platform expects. The frontmatter consists of the global `description` (if present) plus `extras.<platform>` written as-is. Platforms that do not accept subagent files are skipped with a hint.
|
|
160
|
+
|
|
161
|
+
### Inventory
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
agent-switchboard subagent list
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Environment
|
|
168
|
+
|
|
169
|
+
- `ASB_HOME`: overrides `~/.agent-switchboard` for library/state files.
|
|
170
|
+
|
|
53
171
|
## License
|
|
54
172
|
|
|
55
173
|
MIT
|
package/dist/agents/adapter.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agent adapter interface
|
|
3
3
|
* Implements the strategy pattern for different agent config formats
|
|
4
4
|
*/
|
|
5
|
-
import type { McpServer } from
|
|
5
|
+
import type { McpServer } from '../config/schemas.js';
|
|
6
6
|
/**
|
|
7
7
|
* Agent adapter interface
|
|
8
8
|
* Each agent (Claude Code, Codex, Cursor, etc.) implements this interface
|
|
@@ -27,6 +27,6 @@ export interface AgentAdapter {
|
|
|
27
27
|
* @param config - MCP servers to apply (without 'enabled')
|
|
28
28
|
*/
|
|
29
29
|
applyConfig(config: {
|
|
30
|
-
mcpServers: Record<string, Omit<McpServer,
|
|
30
|
+
mcpServers: Record<string, Omit<McpServer, 'enabled'>>;
|
|
31
31
|
}): void;
|
|
32
32
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Claude Code agent adapter
|
|
3
3
|
* Manages MCP server configuration for Claude Code CLI
|
|
4
4
|
*/
|
|
5
|
-
import type { McpServer } from
|
|
6
|
-
import type { AgentAdapter } from
|
|
5
|
+
import type { McpServer } from '../config/schemas.js';
|
|
6
|
+
import type { AgentAdapter } from './adapter.js';
|
|
7
7
|
/**
|
|
8
8
|
* Claude Code agent adapter
|
|
9
9
|
* Config location: ~/.claude.json
|
|
@@ -12,6 +12,6 @@ export declare class ClaudeCodeAgent implements AgentAdapter {
|
|
|
12
12
|
readonly id: "claude-code";
|
|
13
13
|
configPath(): string;
|
|
14
14
|
applyConfig(config: {
|
|
15
|
-
mcpServers: Record<string, Omit<McpServer,
|
|
15
|
+
mcpServers: Record<string, Omit<McpServer, 'enabled'>>;
|
|
16
16
|
}): void;
|
|
17
17
|
}
|
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
* Claude Code agent adapter
|
|
3
3
|
* Manages MCP server configuration for Claude Code CLI
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from "./json-utils.js";
|
|
5
|
+
import { getClaudeJsonPath } from '../config/paths.js';
|
|
6
|
+
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from './json-utils.js';
|
|
8
7
|
/**
|
|
9
8
|
* Claude Code agent adapter
|
|
10
9
|
* Config location: ~/.claude.json
|
|
11
10
|
*/
|
|
12
11
|
export class ClaudeCodeAgent {
|
|
13
|
-
id =
|
|
12
|
+
id = 'claude-code';
|
|
14
13
|
configPath() {
|
|
15
|
-
|
|
16
|
-
? process.env.ASB_AGENTS_HOME
|
|
17
|
-
: os.homedir();
|
|
18
|
-
return path.join(base, ".claude.json");
|
|
14
|
+
return getClaudeJsonPath();
|
|
19
15
|
}
|
|
20
16
|
applyConfig(config) {
|
|
21
17
|
const path = this.configPath();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/agents/claude-code.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/agents/claude-code.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAIvD,OAAO,EAEL,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,OAAO,eAAe;IACjB,EAAE,GAAG,aAAsB,CAAC;IAErC,UAAU;QACR,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,WAAW,CAAC,MAAkE;QAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,YAAY,CAAkB,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAoC,CAAC,CAAC;QAC3F,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Claude Desktop agent adapter
|
|
3
3
|
* Manages MCP server configuration for Claude Desktop app
|
|
4
4
|
*/
|
|
5
|
-
import type { McpServer } from
|
|
6
|
-
import type { AgentAdapter } from
|
|
5
|
+
import type { McpServer } from '../config/schemas.js';
|
|
6
|
+
import type { AgentAdapter } from './adapter.js';
|
|
7
7
|
/**
|
|
8
8
|
* Claude Desktop config file structure
|
|
9
9
|
*/
|
|
@@ -18,6 +18,6 @@ export declare class ClaudeDesktopAgent implements AgentAdapter {
|
|
|
18
18
|
readonly id: "claude-desktop";
|
|
19
19
|
configPath(): string;
|
|
20
20
|
applyConfig(config: {
|
|
21
|
-
mcpServers: Record<string, Omit<McpServer,
|
|
21
|
+
mcpServers: Record<string, Omit<McpServer, 'enabled'>>;
|
|
22
22
|
}): void;
|
|
23
23
|
}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Claude Desktop agent adapter
|
|
3
3
|
* Manages MCP server configuration for Claude Desktop app
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from "./json-utils.js";
|
|
5
|
+
import { getClaudeDesktopConfigPath } from '../config/paths.js';
|
|
6
|
+
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from './json-utils.js';
|
|
8
7
|
/**
|
|
9
8
|
* Claude Desktop config file structure
|
|
10
9
|
*/
|
|
@@ -17,22 +16,9 @@ import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from "./json-utils.js"
|
|
|
17
16
|
* - Windows: %APPDATA%\Claude\claude_desktop_config.json
|
|
18
17
|
*/
|
|
19
18
|
export class ClaudeDesktopAgent {
|
|
20
|
-
id =
|
|
19
|
+
id = 'claude-desktop';
|
|
21
20
|
configPath() {
|
|
22
|
-
|
|
23
|
-
const home = process.env.ASB_AGENTS_HOME && process.env.ASB_AGENTS_HOME.trim().length > 0
|
|
24
|
-
? process.env.ASB_AGENTS_HOME
|
|
25
|
-
: os.homedir();
|
|
26
|
-
switch (platform) {
|
|
27
|
-
case "darwin": // macOS
|
|
28
|
-
return path.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
29
|
-
case "win32": // Windows
|
|
30
|
-
return path.join(home, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
31
|
-
case "linux": // Linux
|
|
32
|
-
return path.join(home, ".config", "Claude", "claude_desktop_config.json");
|
|
33
|
-
default:
|
|
34
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
35
|
-
}
|
|
21
|
+
return getClaudeDesktopConfigPath();
|
|
36
22
|
}
|
|
37
23
|
applyConfig(config) {
|
|
38
24
|
const path = this.configPath();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-desktop.js","sourceRoot":"","sources":["../../src/agents/claude-desktop.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"claude-desktop.js","sourceRoot":"","sources":["../../src/agents/claude-desktop.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,OAAO,EAEL,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,8BAA8B;AAE9B;;;;;;GAMG;AACH,MAAM,OAAO,kBAAkB;IACpB,EAAE,GAAG,gBAAyB,CAAC;IAExC,UAAU;QACR,OAAO,0BAA0B,EAAE,CAAC;IACtC,CAAC;IAED,WAAW,CAAC,MAAkE;QAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,YAAY,CAAkB,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAoC,CAAC,CAAC;QAC3F,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/agents/codex.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Codex CLI Agent Adapter
|
|
3
3
|
* Handles TOML-based configuration with canonical section output
|
|
4
4
|
*/
|
|
5
|
-
import type { McpServer } from
|
|
6
|
-
import type { AgentAdapter } from
|
|
5
|
+
import type { McpServer } from '../config/schemas.js';
|
|
6
|
+
import type { AgentAdapter } from './adapter.js';
|
|
7
7
|
/**
|
|
8
8
|
* Codex CLI agent adapter
|
|
9
9
|
* Config: ~/.codex/config.toml (TOML format)
|
|
@@ -12,7 +12,7 @@ export declare class CodexAgent implements AgentAdapter {
|
|
|
12
12
|
readonly id: "codex";
|
|
13
13
|
configPath(): string;
|
|
14
14
|
applyConfig(config: {
|
|
15
|
-
mcpServers: Record<string, Omit<McpServer,
|
|
15
|
+
mcpServers: Record<string, Omit<McpServer, 'enabled'>>;
|
|
16
16
|
}): void;
|
|
17
17
|
private _loadConfig;
|
|
18
18
|
private _saveConfig;
|
|
@@ -21,7 +21,7 @@ export declare class CodexAgent implements AgentAdapter {
|
|
|
21
21
|
* Merge MCP server config into TOML content
|
|
22
22
|
* Preserves unrelated top-level tables/keys; rewrites mcp_servers in canonical form
|
|
23
23
|
*/
|
|
24
|
-
export declare function mergeConfig(content: string, mcpServers: Record<string, Omit<McpServer,
|
|
24
|
+
export declare function mergeConfig(content: string, mcpServers: Record<string, Omit<McpServer, 'enabled'>>): string;
|
|
25
25
|
/**
|
|
26
26
|
* Minimal shape for a Codex MCP server entry used by the renderer
|
|
27
27
|
*/
|
|
@@ -39,4 +39,4 @@ export type McpServerLike = Record<string, unknown> & {
|
|
|
39
39
|
* Key order per server: command, args, url, type, env_file, env.* (alpha), unknown (alpha)
|
|
40
40
|
* Exactly one blank line between server tables; final newline added by caller
|
|
41
41
|
*/
|
|
42
|
-
export declare function buildNestedToml(mcpServers: Record<string, Omit<McpServerLike,
|
|
42
|
+
export declare function buildNestedToml(mcpServers: Record<string, Omit<McpServerLike, 'enabled'>>): string;
|
package/dist/agents/codex.js
CHANGED
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
* Codex CLI Agent Adapter
|
|
3
3
|
* Handles TOML-based configuration with canonical section output
|
|
4
4
|
*/
|
|
5
|
-
import fs from
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
5
|
+
import fs from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { parse as parseToml, stringify as tomlStringify } from '@iarna/toml';
|
|
8
|
+
import { getCodexConfigPath } from '../config/paths.js';
|
|
9
9
|
/**
|
|
10
10
|
* Codex CLI agent adapter
|
|
11
11
|
* Config: ~/.codex/config.toml (TOML format)
|
|
12
12
|
*/
|
|
13
13
|
export class CodexAgent {
|
|
14
|
-
id =
|
|
14
|
+
id = 'codex';
|
|
15
15
|
configPath() {
|
|
16
|
-
|
|
17
|
-
? process.env.ASB_AGENTS_HOME
|
|
18
|
-
: os.homedir();
|
|
19
|
-
return path.join(base, ".codex", "config.toml");
|
|
16
|
+
return getCodexConfigPath();
|
|
20
17
|
}
|
|
21
18
|
applyConfig(config) {
|
|
22
19
|
const content = this._loadConfig();
|
|
@@ -26,9 +23,9 @@ export class CodexAgent {
|
|
|
26
23
|
_loadConfig() {
|
|
27
24
|
const configPath = this.configPath();
|
|
28
25
|
if (!fs.existsSync(configPath)) {
|
|
29
|
-
return
|
|
26
|
+
return '';
|
|
30
27
|
}
|
|
31
|
-
return fs.readFileSync(configPath,
|
|
28
|
+
return fs.readFileSync(configPath, 'utf-8');
|
|
32
29
|
}
|
|
33
30
|
_saveConfig(content) {
|
|
34
31
|
const configPath = this.configPath();
|
|
@@ -36,7 +33,7 @@ export class CodexAgent {
|
|
|
36
33
|
if (!fs.existsSync(dirPath)) {
|
|
37
34
|
fs.mkdirSync(dirPath, { recursive: true });
|
|
38
35
|
}
|
|
39
|
-
fs.writeFileSync(configPath, content,
|
|
36
|
+
fs.writeFileSync(configPath, content, 'utf-8');
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
/**
|
|
@@ -61,21 +58,22 @@ export function mergeConfig(content, mcpServers) {
|
|
|
61
58
|
// Build canonical mcp_servers TOML from provided config
|
|
62
59
|
const mcpToml = buildNestedToml(mcpServers);
|
|
63
60
|
// Stringify other top-level tables/keys via iarna/toml
|
|
64
|
-
let otherToml =
|
|
61
|
+
let otherToml = '';
|
|
65
62
|
try {
|
|
66
63
|
if (Object.keys(otherTopLevel).length > 0) {
|
|
64
|
+
// Cast to JsonMap type expected by tomlStringify
|
|
67
65
|
otherToml = tomlStringify(otherTopLevel);
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
68
|
catch {
|
|
71
|
-
otherToml =
|
|
69
|
+
otherToml = '';
|
|
72
70
|
}
|
|
73
71
|
const parts = [];
|
|
74
72
|
if (otherToml.trim().length > 0)
|
|
75
73
|
parts.push(otherToml.trimEnd());
|
|
76
74
|
if (mcpToml.trim().length > 0)
|
|
77
75
|
parts.push(mcpToml.trimEnd());
|
|
78
|
-
return `${parts.join(
|
|
76
|
+
return `${parts.join('\n\n')}\n`;
|
|
79
77
|
}
|
|
80
78
|
/**
|
|
81
79
|
* Build canonical TOML: one table per server [mcp_servers.<name>]
|
|
@@ -90,17 +88,17 @@ export function buildNestedToml(mcpServers) {
|
|
|
90
88
|
const name = serverNames[idx];
|
|
91
89
|
const server = (mcpServers[name] ?? {});
|
|
92
90
|
lines.push(`[mcp_servers.${name}]`);
|
|
93
|
-
const KNOWN_ORDER = [
|
|
91
|
+
const KNOWN_ORDER = ['command', 'args', 'url', 'type', 'env_file'];
|
|
94
92
|
const emit = (k, v) => {
|
|
95
93
|
if (v === undefined || v === null)
|
|
96
94
|
return;
|
|
97
95
|
// Only allow primitives and primitive arrays
|
|
98
|
-
const isPrim = (x) => typeof x ===
|
|
96
|
+
const isPrim = (x) => typeof x === 'string' || typeof x === 'number' || typeof x === 'boolean';
|
|
99
97
|
const isPrimArr = (x) => Array.isArray(x) && x.every(isPrim);
|
|
100
98
|
if (!isPrim(v) && !isPrimArr(v))
|
|
101
99
|
return;
|
|
102
100
|
// @iarna/toml value formatting for RHS
|
|
103
|
-
const rhs = tomlStringify
|
|
101
|
+
const rhs = 'value' in tomlStringify
|
|
104
102
|
? tomlStringify.value(v)
|
|
105
103
|
: JSON.stringify(v);
|
|
106
104
|
lines.push(`${k} = ${rhs}`);
|
|
@@ -109,22 +107,22 @@ export function buildNestedToml(mcpServers) {
|
|
|
109
107
|
for (const k of KNOWN_ORDER)
|
|
110
108
|
emit(k, server[k]);
|
|
111
109
|
// env dotted keys (alphabetical)
|
|
112
|
-
if (server.env && typeof server.env ===
|
|
110
|
+
if (server.env && typeof server.env === 'object') {
|
|
113
111
|
const envEntries = Object.entries(server.env).filter(([_, v]) => v !== undefined && v !== null);
|
|
114
112
|
envEntries.sort(([a], [b]) => a.localeCompare(b));
|
|
115
113
|
for (const [ek, ev] of envEntries)
|
|
116
114
|
emit(`env.${ek}`, String(ev));
|
|
117
115
|
}
|
|
118
116
|
// Unknown keys (exclude known + env)
|
|
119
|
-
const knownSet = new Set([...KNOWN_ORDER.map(String),
|
|
117
|
+
const knownSet = new Set([...KNOWN_ORDER.map(String), 'env']);
|
|
120
118
|
const unknownKeys = Object.keys(server)
|
|
121
119
|
.filter((k) => !knownSet.has(k))
|
|
122
120
|
.sort((a, b) => a.localeCompare(b));
|
|
123
121
|
for (const uk of unknownKeys)
|
|
124
122
|
emit(uk, server[uk]);
|
|
125
123
|
if (idx !== serverNames.length - 1)
|
|
126
|
-
lines.push(
|
|
124
|
+
lines.push(''); // blank line between servers
|
|
127
125
|
}
|
|
128
|
-
return lines.join(
|
|
126
|
+
return lines.join('\n');
|
|
129
127
|
}
|
|
130
128
|
//# sourceMappingURL=codex.js.map
|
package/dist/agents/codex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/agents/codex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/agents/codex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAIxD;;;GAGG;AACH,MAAM,OAAO,UAAU;IACZ,EAAE,GAAG,OAAgB,CAAC;IAE/B,UAAU;QACR,OAAO,kBAAkB,EAAE,CAAC;IAC9B,CAAC;IAED,WAAW,CAAC,MAAkE;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEO,WAAW;QACjB,MAAM,UAAU,GAAG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AAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YAClD,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,UAAU;gBAAE,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QACnE,CAAC;QAED,qCAAqC;QACrC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;aACpC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aAC/B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,KAAK,MAAM,EAAE,IAAI,WAAW;YAAE,IAAI,CAAC,EAAE,EAAG,MAAkC,CAAC,EAAE,CAAC,CAAC,CAAC;QAEhF,IAAI,GAAG,KAAK,WAAW,CAAC,MAAM,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,6BAA6B;IACnF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/agents/cursor.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Cursor agent adapter
|
|
3
3
|
* Manages MCP server configuration for Cursor IDE
|
|
4
4
|
*/
|
|
5
|
-
import type { McpServer } from
|
|
6
|
-
import type { AgentAdapter } from
|
|
5
|
+
import type { McpServer } from '../config/schemas.js';
|
|
6
|
+
import type { AgentAdapter } from './adapter.js';
|
|
7
7
|
/**
|
|
8
8
|
* Cursor config file structure
|
|
9
9
|
*/
|
|
@@ -15,6 +15,6 @@ export declare class CursorAgent implements AgentAdapter {
|
|
|
15
15
|
readonly id: "cursor";
|
|
16
16
|
configPath(): string;
|
|
17
17
|
applyConfig(config: {
|
|
18
|
-
mcpServers: Record<string, Omit<McpServer,
|
|
18
|
+
mcpServers: Record<string, Omit<McpServer, 'enabled'>>;
|
|
19
19
|
}): void;
|
|
20
20
|
}
|
package/dist/agents/cursor.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Cursor agent adapter
|
|
3
3
|
* Manages MCP server configuration for Cursor IDE
|
|
4
4
|
*/
|
|
5
|
-
import os from
|
|
6
|
-
import path from
|
|
7
|
-
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from
|
|
5
|
+
import os from 'node:os';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from './json-utils.js';
|
|
8
8
|
/**
|
|
9
9
|
* Cursor config file structure
|
|
10
10
|
*/
|
|
@@ -14,12 +14,12 @@ import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from "./json-utils.js"
|
|
|
14
14
|
* Config location: ~/.cursor/mcp.json
|
|
15
15
|
*/
|
|
16
16
|
export class CursorAgent {
|
|
17
|
-
id =
|
|
17
|
+
id = 'cursor';
|
|
18
18
|
configPath() {
|
|
19
19
|
const base = process.env.ASB_AGENTS_HOME && process.env.ASB_AGENTS_HOME.trim().length > 0
|
|
20
20
|
? process.env.ASB_AGENTS_HOME
|
|
21
21
|
: os.homedir();
|
|
22
|
-
return path.join(base,
|
|
22
|
+
return path.join(base, '.cursor', 'mcp.json');
|
|
23
23
|
}
|
|
24
24
|
applyConfig(config) {
|
|
25
25
|
const path = this.configPath();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/agents/cursor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/agents/cursor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAEL,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,8BAA8B;AAE9B;;;GAGG;AACH,MAAM,OAAO,WAAW;IACb,EAAE,GAAG,QAAiB,CAAC;IAEhC,UAAU;QACR,MAAM,IAAI,GACR,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YAC1E,CAAC,CAAE,OAAO,CAAC,GAAG,CAAC,eAA0B;YACzC,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAChD,CAAC;IAED,WAAW,CAAC,MAAkE;QAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,YAAY,CAAkB,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAoC,CAAC,CAAC;QAC3F,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/agents/gemini.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Gemini CLI agent adapter
|
|
3
3
|
* Manages MCP server configuration for Gemini CLI
|
|
4
4
|
*/
|
|
5
|
-
import type { McpServer } from
|
|
6
|
-
import type { AgentAdapter } from
|
|
5
|
+
import type { McpServer } from '../config/schemas.js';
|
|
6
|
+
import type { AgentAdapter } from './adapter.js';
|
|
7
7
|
/**
|
|
8
8
|
* Gemini CLI config file structure
|
|
9
9
|
*/
|
|
@@ -15,6 +15,6 @@ export declare class GeminiAgent implements AgentAdapter {
|
|
|
15
15
|
readonly id: "gemini";
|
|
16
16
|
configPath(): string;
|
|
17
17
|
applyConfig(config: {
|
|
18
|
-
mcpServers: Record<string, Omit<McpServer,
|
|
18
|
+
mcpServers: Record<string, Omit<McpServer, 'enabled'>>;
|
|
19
19
|
}): void;
|
|
20
20
|
}
|
package/dist/agents/gemini.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Gemini CLI agent adapter
|
|
3
3
|
* Manages MCP server configuration for Gemini CLI
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from "./json-utils.js";
|
|
5
|
+
import { getGeminiSettingsPath } from '../config/paths.js';
|
|
6
|
+
import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from './json-utils.js';
|
|
8
7
|
/**
|
|
9
8
|
* Gemini CLI config file structure
|
|
10
9
|
*/
|
|
@@ -14,12 +13,9 @@ import { loadJsonFile, mergeMcpIntoAgent, saveJsonFile, } from "./json-utils.js"
|
|
|
14
13
|
* Config location: ~/.gemini/settings.json
|
|
15
14
|
*/
|
|
16
15
|
export class GeminiAgent {
|
|
17
|
-
id =
|
|
16
|
+
id = 'gemini';
|
|
18
17
|
configPath() {
|
|
19
|
-
|
|
20
|
-
? process.env.ASB_AGENTS_HOME
|
|
21
|
-
: os.homedir();
|
|
22
|
-
return path.join(base, ".gemini", "settings.json");
|
|
18
|
+
return getGeminiSettingsPath();
|
|
23
19
|
}
|
|
24
20
|
applyConfig(config) {
|
|
25
21
|
const path = this.configPath();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/agents/gemini.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/agents/gemini.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,EAEL,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB;;GAEG;AACH,8BAA8B;AAE9B;;;GAGG;AACH,MAAM,OAAO,WAAW;IACb,EAAE,GAAG,QAAiB,CAAC;IAEhC,UAAU;QACR,OAAO,qBAAqB,EAAE,CAAC;IACjC,CAAC;IAED,WAAW,CAAC,MAAkE;QAC5E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,WAAW,GAAG,YAAY,CAAkB,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,UAAoC,CAAC,CAAC;QAC3F,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared JSON file helpers for agent adapters
|
|
3
3
|
*/
|
|
4
|
-
import fs from
|
|
4
|
+
import fs from 'node:fs';
|
|
5
5
|
export function loadJsonFile(filePath, fallback) {
|
|
6
6
|
if (!fs.existsSync(filePath))
|
|
7
7
|
return fallback;
|
|
8
|
-
const content = fs.readFileSync(filePath,
|
|
8
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
9
9
|
return JSON.parse(content);
|
|
10
10
|
}
|
|
11
11
|
export function saveJsonFile(filePath, data) {
|
|
12
12
|
const json = `${JSON.stringify(data, null, 2)}\n`;
|
|
13
|
-
fs.writeFileSync(filePath, json,
|
|
13
|
+
fs.writeFileSync(filePath, json, 'utf-8');
|
|
14
14
|
}
|
|
15
15
|
export function mergeMcpIntoAgent(agentConfig, mcpServers) {
|
|
16
16
|
if (Object.keys(mcpServers).length === 0)
|
|
17
17
|
return agentConfig;
|
|
18
18
|
const merged = { ...agentConfig };
|
|
19
|
-
if (!merged.mcpServers)
|
|
19
|
+
if (!merged.mcpServers) {
|
|
20
20
|
merged.mcpServers = {};
|
|
21
|
+
}
|
|
21
22
|
const target = merged.mcpServers;
|
|
22
23
|
for (const [name, server] of Object.entries(mcpServers)) {
|
|
23
24
|
const existing = target[name] ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-utils.js","sourceRoot":"","sources":["../../src/agents/json-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAIzB,MAAM,UAAU,YAAY,CAAmB,QAAgB,EAAE,QAAW;
|
|
1
|
+
{"version":3,"file":"json-utils.js","sourceRoot":"","sources":["../../src/agents/json-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAIzB,MAAM,UAAU,YAAY,CAAmB,QAAgB,EAAE,QAAW;IAC1E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC9C,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,IAAY;IACzD,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;IAClD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,WAA4B,EAC5B,UAAkC;IAElC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC;IAE7D,MAAM,MAAM,GAAoB,EAAE,GAAG,WAAW,EAAE,CAAC;IACnD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACvB,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC;IAEjC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACxD,MAAM,QAAQ,GAAI,MAAM,CAAC,IAAI,CAA6B,IAAI,EAAE,CAAC;QACjE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;IAC5C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* opencode agent adapter
|
|
3
3
|
* Synchronizes MCP servers into ~/.config/opencode/opencode.json
|
|
4
4
|
*/
|
|
5
|
-
import type { McpServer } from
|
|
6
|
-
import type { AgentAdapter } from
|
|
5
|
+
import type { McpServer } from '../config/schemas.js';
|
|
6
|
+
import type { AgentAdapter } from './adapter.js';
|
|
7
7
|
export declare class OpencodeAgent implements AgentAdapter {
|
|
8
8
|
readonly id: "opencode";
|
|
9
9
|
configPath(): string;
|
|
10
10
|
applyConfig(config: {
|
|
11
|
-
mcpServers: Record<string, Omit<McpServer,
|
|
11
|
+
mcpServers: Record<string, Omit<McpServer, 'enabled'>>;
|
|
12
12
|
}): void;
|
|
13
13
|
}
|