@aperant/framework 0.9.0 → 0.11.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/CHANGELOG.md +120 -0
- package/agents/apt-verifier.md +6 -3
- package/dist/cli/commands/catch-up.d.mts +9 -0
- package/dist/cli/commands/catch-up.d.mts.map +1 -0
- package/dist/cli/commands/catch-up.mjs +64 -0
- package/dist/cli/commands/catch-up.mjs.map +1 -0
- package/dist/cli/commands/init.d.mts.map +1 -1
- package/dist/cli/commands/init.mjs +17 -1
- package/dist/cli/commands/init.mjs.map +1 -1
- package/dist/cli/commands/pr-review.d.mts +16 -4
- package/dist/cli/commands/pr-review.d.mts.map +1 -1
- package/dist/cli/commands/pr-review.mjs +30 -11
- package/dist/cli/commands/pr-review.mjs.map +1 -1
- package/dist/cli/commands/route.d.mts.map +1 -1
- package/dist/cli/commands/route.mjs +92 -2
- package/dist/cli/commands/route.mjs.map +1 -1
- package/dist/cli/commands/validate-evidence.d.mts +1 -1
- package/dist/cli/config/share-policy.d.mts.map +1 -1
- package/dist/cli/config/share-policy.mjs +1 -0
- package/dist/cli/config/share-policy.mjs.map +1 -1
- package/dist/cli/config/upgrade-gitignore.d.mts.map +1 -1
- package/dist/cli/config/upgrade-gitignore.mjs +1 -0
- package/dist/cli/config/upgrade-gitignore.mjs.map +1 -1
- package/dist/cli/consistency/parse-review.mjs +5 -3
- package/dist/cli/consistency/parse-review.mjs.map +1 -1
- package/dist/cli/consistency/rules/r5-verdict-consistency.d.mts.map +1 -1
- package/dist/cli/consistency/rules/r5-verdict-consistency.mjs +10 -8
- package/dist/cli/consistency/rules/r5-verdict-consistency.mjs.map +1 -1
- package/dist/cli/coordination/catch-up.d.mts +26 -0
- package/dist/cli/coordination/catch-up.d.mts.map +1 -0
- package/dist/cli/coordination/catch-up.mjs +239 -0
- package/dist/cli/coordination/catch-up.mjs.map +1 -0
- package/dist/cli/coordination/last-seen.d.mts +45 -0
- package/dist/cli/coordination/last-seen.d.mts.map +1 -0
- package/dist/cli/coordination/last-seen.mjs +128 -0
- package/dist/cli/coordination/last-seen.mjs.map +1 -0
- package/dist/cli/coordination/store.d.mts +15 -0
- package/dist/cli/coordination/store.d.mts.map +1 -1
- package/dist/cli/coordination/store.mjs +16 -0
- package/dist/cli/coordination/store.mjs.map +1 -1
- package/dist/cli/design/frontmatter-schema.d.mts +8 -8
- package/dist/cli/dispatch.d.mts.map +1 -1
- package/dist/cli/dispatch.mjs +2 -0
- package/dist/cli/dispatch.mjs.map +1 -1
- package/dist/cli/gate/gates/review-clean.d.mts.map +1 -1
- package/dist/cli/gate/gates/review-clean.mjs +4 -2
- package/dist/cli/gate/gates/review-clean.mjs.map +1 -1
- package/dist/cli/git/default-branch.d.mts +51 -0
- package/dist/cli/git/default-branch.d.mts.map +1 -0
- package/dist/cli/git/default-branch.mjs +234 -0
- package/dist/cli/git/default-branch.mjs.map +1 -0
- package/dist/cli/git/identity.d.mts +3 -5
- package/dist/cli/git/identity.d.mts.map +1 -1
- package/dist/cli/git/identity.mjs +10 -4
- package/dist/cli/git/identity.mjs.map +1 -1
- package/dist/cli/install/legacy-paths.d.mts.map +1 -1
- package/dist/cli/install/legacy-paths.mjs +2 -0
- package/dist/cli/install/legacy-paths.mjs.map +1 -1
- package/dist/cli/install/mcp-provision.d.mts +26 -0
- package/dist/cli/install/mcp-provision.d.mts.map +1 -0
- package/dist/cli/install/mcp-provision.mjs +281 -0
- package/dist/cli/install/mcp-provision.mjs.map +1 -0
- package/dist/cli/install/mcp-server-specs.d.mts +80 -0
- package/dist/cli/install/mcp-server-specs.d.mts.map +1 -0
- package/dist/cli/install/mcp-server-specs.mjs +102 -0
- package/dist/cli/install/mcp-server-specs.mjs.map +1 -0
- package/dist/cli/install/runtime-detect.d.mts +1 -0
- package/dist/cli/install/runtime-detect.d.mts.map +1 -1
- package/dist/cli/install/runtime-detect.mjs +5 -0
- package/dist/cli/install/runtime-detect.mjs.map +1 -1
- package/dist/cli/install/toml-merge.d.mts +40 -0
- package/dist/cli/install/toml-merge.d.mts.map +1 -0
- package/dist/cli/install/toml-merge.mjs +134 -0
- package/dist/cli/install/toml-merge.mjs.map +1 -0
- package/dist/cli/personas/sidecar.d.mts +1 -1
- package/dist/cli/roadmap/lifecycle.d.mts +1 -1
- package/dist/cli/roadmap/rollup.d.mts +2 -2
- package/dist/cli/util/events-path.d.mts +8 -0
- package/dist/cli/util/events-path.d.mts.map +1 -0
- package/dist/cli/util/events-path.mjs +23 -0
- package/dist/cli/util/events-path.mjs.map +1 -0
- package/dist/cli/util/runtime-capabilities.d.mts +30 -0
- package/dist/cli/util/runtime-capabilities.d.mts.map +1 -0
- package/dist/cli/util/runtime-capabilities.mjs +214 -0
- package/dist/cli/util/runtime-capabilities.mjs.map +1 -0
- package/dist/cli/verify-proof/audit.d.mts +2 -7
- package/dist/cli/verify-proof/audit.d.mts.map +1 -1
- package/dist/cli/verify-proof/audit.mjs +11 -17
- package/dist/cli/verify-proof/audit.mjs.map +1 -1
- package/dist/cli/verify-proof/runtime-detect.d.mts +2 -29
- package/dist/cli/verify-proof/runtime-detect.d.mts.map +1 -1
- package/dist/cli/verify-proof/runtime-detect.mjs +8 -203
- package/dist/cli/verify-proof/runtime-detect.mjs.map +1 -1
- package/dist/plugin/.claude-plugin/plugin.json +2 -1
- package/dist/plugin/agents/apt-verifier.md +6 -3
- package/dist/plugin/skills/apt/SKILL.md +29 -0
- package/dist/plugin/skills/apt-catch-up/SKILL.md +79 -0
- package/dist/plugin/skills/apt-pr-review/SKILL.md +59 -4
- package/dist/plugin/skills/apt-setup/SKILL.md +76 -0
- package/dist/plugin/skills/apt-verify/SKILL.md +1 -1
- package/dist/plugin/skills/apt-verify-proof/SKILL.md +25 -1
- package/drivers/browser/skill/agent-browser/SKILL.md +51 -0
- package/drivers/tauri/README.md +107 -0
- package/drivers/tauri/driver.mjs +88 -0
- package/drivers/tauri/manifest.json +37 -0
- package/drivers/tauri/scripts/tauri-mcp.sh +41 -0
- package/package.json +138 -138
- package/skills/apt/SKILL.md +29 -0
- package/skills/apt-catch-up/SKILL.md +79 -0
- package/skills/apt-pr-review/SKILL.md +59 -4
- package/skills/apt-setup/SKILL.md +76 -0
- package/skills/apt-verify/SKILL.md +1 -1
- package/skills/apt-verify-proof/SKILL.md +25 -1
- package/src/cli/commands/catch-up.mjs +67 -0
- package/src/cli/commands/init.mjs +19 -0
- package/src/cli/commands/pr-review.mjs +32 -11
- package/src/cli/commands/route.mjs +92 -1
- package/src/cli/config/share-policy.mjs +1 -0
- package/src/cli/config/upgrade-gitignore.mjs +1 -0
- package/src/cli/consistency/parse-review.mjs +5 -3
- package/src/cli/consistency/rules/r5-verdict-consistency.mjs +14 -9
- package/src/cli/coordination/catch-up.mjs +231 -0
- package/src/cli/coordination/last-seen.mjs +131 -0
- package/src/cli/coordination/store.mjs +18 -0
- package/src/cli/dispatch.mjs +2 -0
- package/src/cli/gate/gates/review-clean.mjs +4 -2
- package/src/cli/git/default-branch.mjs +250 -0
- package/src/cli/git/identity.mjs +9 -3
- package/src/cli/install/legacy-paths.mjs +2 -0
- package/src/cli/install/mcp-provision.mjs +293 -0
- package/src/cli/install/mcp-server-specs.mjs +101 -0
- package/src/cli/install/runtime-detect.mjs +9 -0
- package/src/cli/install/toml-merge.mjs +139 -0
- package/src/cli/util/events-path.mjs +24 -0
- package/src/cli/util/runtime-capabilities.mjs +216 -0
- package/src/cli/verify-proof/audit.mjs +11 -17
- package/src/cli/verify-proof/runtime-detect.mjs +11 -204
- package/templates/config.json +13 -1
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* install/mcp-provision.mjs — TOFU install-time MCP-server + skill provisioner.
|
|
3
|
+
*
|
|
4
|
+
* Called from cmdInit (the only call site — the QUICK fast-path never invokes
|
|
5
|
+
* init, so the Fast Path Guarantee is structurally untouched). Detects the
|
|
6
|
+
* project's runtime, then for each selected host CLI that supports the action:
|
|
7
|
+
*
|
|
8
|
+
* - kind 'mcp-server' (electron/tauri) → write the server into the host's
|
|
9
|
+
* MCP config (claude → .mcp.json JSON merge; codex → .codex/config.toml
|
|
10
|
+
* TOML upsert).
|
|
11
|
+
* - kind 'skill' (agent-browser) → copy the vendored SKILL.md into the
|
|
12
|
+
* host's skill dir (claude → .claude/skills/; codex → .agents/skills/).
|
|
13
|
+
*
|
|
14
|
+
* Every write is TOFU/idempotent (ID-05): if the target server id / table /
|
|
15
|
+
* skill file already exists, SKIP (never diff/merge/overwrite) — this is the
|
|
16
|
+
* must-not-clobber invariant for a hand-authored electron
|
|
17
|
+
* SCREENSHOT_ENCRYPTION_KEY (US-3) and a user-edited agent-browser skill
|
|
18
|
+
* (US-6). Each action appends one audit line to .aperant/events/{date}.jsonl.
|
|
19
|
+
*
|
|
20
|
+
* Gated behind config.verification.provision_mcp (default true) so users can
|
|
21
|
+
* opt out. Never throws — wraps the body in try/catch → {status:'error'}.
|
|
22
|
+
*/
|
|
23
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs';
|
|
24
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
25
|
+
import { appendJsonl, atomicWriteJson, atomicWriteText } from '../util/atomic-write.mjs';
|
|
26
|
+
import { dailyEventsPath } from '../util/events-path.mjs';
|
|
27
|
+
import { capabilityToProvisionIds, PROVISION_SPECS } from './mcp-server-specs.mjs';
|
|
28
|
+
import { loadRuntimeCapabilities } from './runtime-detect.mjs';
|
|
29
|
+
import { upsertMcpServerToml } from './toml-merge.mjs';
|
|
30
|
+
/**
|
|
31
|
+
* Per-host writer registry (ID-07, ID-08). v1 = claude + codex. The MCP
|
|
32
|
+
* config path AND skill dir are EXPLICIT per host — neither is derived from
|
|
33
|
+
* the runtime's installRoot (Codex's MCP path .codex/config.toml diverges
|
|
34
|
+
* from its skill dir .agents/skills/). Adding gemini/opencode later = one
|
|
35
|
+
* entry each.
|
|
36
|
+
*
|
|
37
|
+
* @type {Record<string, {mcpFormat: 'json'|'toml', mcpConfigPath: string, skillDir: string}>}
|
|
38
|
+
*/
|
|
39
|
+
const HOST_PROVISION_WRITERS = {
|
|
40
|
+
claude: { mcpFormat: 'json', mcpConfigPath: '.mcp.json', skillDir: '.claude/skills' },
|
|
41
|
+
codex: { mcpFormat: 'toml', mcpConfigPath: '.codex/config.toml', skillDir: '.agents/skills' },
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Substitute the per-project socket basename into the tauri launcher
|
|
45
|
+
* template, deriving uniqueness from the project dir basename.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} template
|
|
48
|
+
* @param {string} targetDir
|
|
49
|
+
* @returns {string}
|
|
50
|
+
*/
|
|
51
|
+
function renderTauriLauncher(template, targetDir) {
|
|
52
|
+
const slug = basename(resolve(targetDir))
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
55
|
+
.replace(/^-+|-+$/g, '') || 'tauri';
|
|
56
|
+
return template.replaceAll('{{PROJECT_SOCKET}}', slug);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Write the electron/tauri MCP server into a Claude `.mcp.json`. JSON merge:
|
|
60
|
+
* read-or-{}, ensure mcpServers, SKIP if the server id already exists, else
|
|
61
|
+
* insert {type:'stdio', command, args, env?} preserving all sibling keys.
|
|
62
|
+
*
|
|
63
|
+
* TOFU non-clobber (ID-05): if the existing file fails to parse OR parses to
|
|
64
|
+
* a non-plain-object root (array / null / primitive), do NOT overwrite it —
|
|
65
|
+
* return `skipped_unsafe` with a reason so the caller can audit it and leave
|
|
66
|
+
* the file byte-identical. (`typeof [] === 'object'` is why arrays must be
|
|
67
|
+
* excluded explicitly: a `.mcp.json` containing `[]` would otherwise pass the
|
|
68
|
+
* object guard, drop the user's content on stringify, and report `written`.)
|
|
69
|
+
*
|
|
70
|
+
* @param {string} configPath — absolute path to .mcp.json
|
|
71
|
+
* @param {string} serverId
|
|
72
|
+
* @param {import('./mcp-server-specs.mjs').McpServerSpec} spec
|
|
73
|
+
* @returns {{action: 'written'|'skipped'|'skipped_unsafe', reason?: string}}
|
|
74
|
+
*/
|
|
75
|
+
function writeClaudeMcpServer(configPath, serverId, spec) {
|
|
76
|
+
let config = {};
|
|
77
|
+
if (existsSync(configPath)) {
|
|
78
|
+
try {
|
|
79
|
+
config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Malformed JSON: overwriting would erase every hand-authored MCP
|
|
83
|
+
// server. Leave the file untouched and surface it.
|
|
84
|
+
return { action: 'skipped_unsafe', reason: 'malformed_json' };
|
|
85
|
+
}
|
|
86
|
+
if (config === null || typeof config !== 'object' || Array.isArray(config)) {
|
|
87
|
+
// Non-plain-object root (array / null / primitive): same non-clobber
|
|
88
|
+
// rule — never overwrite content we cannot safely merge into.
|
|
89
|
+
return { action: 'skipped_unsafe', reason: 'non_object_root' };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (config.mcpServers === null || typeof config.mcpServers !== 'object') {
|
|
93
|
+
config.mcpServers = {};
|
|
94
|
+
}
|
|
95
|
+
// TOFU: never clobber a hand-authored server id.
|
|
96
|
+
if (Object.hasOwn(config.mcpServers, serverId))
|
|
97
|
+
return { action: 'skipped' };
|
|
98
|
+
const entry = { type: 'stdio', command: spec.command, args: spec.args ?? [] };
|
|
99
|
+
if (spec.env && Object.keys(spec.env).length > 0)
|
|
100
|
+
entry.env = spec.env;
|
|
101
|
+
config.mcpServers[serverId] = entry;
|
|
102
|
+
atomicWriteJson(configPath, config);
|
|
103
|
+
return { action: 'written' };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Write the electron/tauri MCP server into a Codex `.codex/config.toml`.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} configPath — absolute path to .codex/config.toml
|
|
109
|
+
* @param {string} serverId
|
|
110
|
+
* @param {import('./mcp-server-specs.mjs').McpServerSpec} spec
|
|
111
|
+
* @returns {{action: 'written'|'skipped'}}
|
|
112
|
+
*/
|
|
113
|
+
function writeCodexMcpServer(configPath, serverId, spec) {
|
|
114
|
+
const existing = existsSync(configPath) ? readFileSync(configPath, 'utf-8') : '';
|
|
115
|
+
const { content, action } = upsertMcpServerToml(existing, serverId, {
|
|
116
|
+
command: spec.command,
|
|
117
|
+
args: spec.args ?? [],
|
|
118
|
+
...(spec.env && Object.keys(spec.env).length > 0 ? { env: spec.env } : {}),
|
|
119
|
+
});
|
|
120
|
+
if (action === 'written')
|
|
121
|
+
atomicWriteText(configPath, content);
|
|
122
|
+
return { action };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Copy the vendored skill into a host skill dir. TOFU: never overwrite an
|
|
126
|
+
* existing agent-browser/SKILL.md (a user may have edited it).
|
|
127
|
+
*
|
|
128
|
+
* @param {string} skillDestPath — absolute <skillDir>/<skillId>/SKILL.md
|
|
129
|
+
* @param {string} vendoredSkillPath — absolute source path
|
|
130
|
+
* @returns {'written'|'skipped'}
|
|
131
|
+
*/
|
|
132
|
+
function copySkill(skillDestPath, vendoredSkillPath) {
|
|
133
|
+
if (existsSync(skillDestPath))
|
|
134
|
+
return 'skipped';
|
|
135
|
+
mkdirSync(dirname(skillDestPath), { recursive: true });
|
|
136
|
+
// copyFileSync is fine here — atomicWriteText would re-read; the dest is
|
|
137
|
+
// guaranteed absent (TOFU check above) so there is no clobber risk.
|
|
138
|
+
copyFileSync(vendoredSkillPath, skillDestPath);
|
|
139
|
+
return 'written';
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Provision MCP servers + skills for the selected host CLIs.
|
|
143
|
+
*
|
|
144
|
+
* @param {Object} opts
|
|
145
|
+
* @param {string} opts.targetDir — project root being installed into
|
|
146
|
+
* @param {string[]} opts.selectedRuntimes — the runtimes the user selected
|
|
147
|
+
* @param {object} opts.config — the effective merged project config
|
|
148
|
+
* @param {string} opts.frameworkRoot — absolute path to packages/framework (for vendored skill resolution)
|
|
149
|
+
* @returns {{status: 'ok'|'disabled'|'error', writes?: Array<{host:string, spec_id:string, kind:string, action:string}>, reason?: string}}
|
|
150
|
+
*/
|
|
151
|
+
export function provisionMcpConfig(opts) {
|
|
152
|
+
const targetDir = resolve(opts.targetDir);
|
|
153
|
+
const config = opts.config ?? {};
|
|
154
|
+
const selected = Array.isArray(opts.selectedRuntimes) ? opts.selectedRuntimes : [];
|
|
155
|
+
const frameworkRoot = opts.frameworkRoot;
|
|
156
|
+
try {
|
|
157
|
+
// (1) Opt-out gate (default true).
|
|
158
|
+
if (config?.verification?.provision_mcp === false) {
|
|
159
|
+
appendEvent(targetDir, 'mcp-provision.disabled', {
|
|
160
|
+
reason: 'verification.provision_mcp=false',
|
|
161
|
+
});
|
|
162
|
+
return { status: 'disabled' };
|
|
163
|
+
}
|
|
164
|
+
// (2) Detect runtime → derive spec ids.
|
|
165
|
+
const runtimeCaps = loadRuntimeCapabilities(targetDir);
|
|
166
|
+
const specIds = capabilityToProvisionIds(runtimeCaps);
|
|
167
|
+
/** @type {Array<{host:string, spec_id:string, kind:string, action:string}>} */
|
|
168
|
+
const writes = [];
|
|
169
|
+
// Iterate every (selected host, spec) pair.
|
|
170
|
+
for (const host of selected) {
|
|
171
|
+
const writer = HOST_PROVISION_WRITERS[host];
|
|
172
|
+
if (!writer) {
|
|
173
|
+
// Selected host with no writer (gemini/opencode/... in v1) — record
|
|
174
|
+
// once as unsupported_host, no write.
|
|
175
|
+
writes.push({ host, spec_id: '*', kind: '*', action: 'unsupported_host' });
|
|
176
|
+
appendEvent(targetDir, 'mcp-provision.unsupported_host', { host });
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
for (const specId of specIds) {
|
|
180
|
+
const spec = PROVISION_SPECS[specId];
|
|
181
|
+
if (!spec)
|
|
182
|
+
continue;
|
|
183
|
+
if (spec.kind === 'mcp-server') {
|
|
184
|
+
const configPath = join(targetDir, writer.mcpConfigPath);
|
|
185
|
+
const { action, reason } = writer.mcpFormat === 'json'
|
|
186
|
+
? writeClaudeMcpServer(configPath, specId, spec)
|
|
187
|
+
: writeCodexMcpServer(configPath, specId, spec);
|
|
188
|
+
writes.push({ host, spec_id: specId, kind: 'mcp-server', action });
|
|
189
|
+
appendEvent(targetDir, `mcp-provision.${action}`, {
|
|
190
|
+
host,
|
|
191
|
+
spec_id: specId,
|
|
192
|
+
config_path: writer.mcpConfigPath,
|
|
193
|
+
...(reason ? { reason } : {}),
|
|
194
|
+
});
|
|
195
|
+
// (5) tauri needs its launcher script — only provision it once the
|
|
196
|
+
// MCP config entry is actually written, so a TOFU-skipped or
|
|
197
|
+
// skipped_unsafe config never leaves an orphan launcher + a
|
|
198
|
+
// misleading audit line.
|
|
199
|
+
if (spec.requiresLauncherScript && frameworkRoot && action === 'written') {
|
|
200
|
+
provisionTauriLauncher(targetDir, frameworkRoot, writes);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
else if (spec.kind === 'skill') {
|
|
204
|
+
if (!frameworkRoot)
|
|
205
|
+
continue;
|
|
206
|
+
const vendoredSkillPath = resolve(frameworkRoot, spec.vendoredSkillRelPath);
|
|
207
|
+
const skillDestPath = join(targetDir, writer.skillDir, spec.skillId, 'SKILL.md');
|
|
208
|
+
const action = copySkill(skillDestPath, vendoredSkillPath);
|
|
209
|
+
writes.push({ host, spec_id: specId, kind: 'skill', action });
|
|
210
|
+
appendEvent(targetDir, `skill-provision.${action}`, {
|
|
211
|
+
host,
|
|
212
|
+
spec_id: specId,
|
|
213
|
+
skill_dir: writer.skillDir,
|
|
214
|
+
}, 'skill_provision');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return { status: 'ok', writes };
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
return { status: 'error', reason: e instanceof Error ? e.message : String(e) };
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Copy the tauri launcher template into the project's scripts/ dir (TOFU).
|
|
226
|
+
* Records its own audit line; appends to `writes` with a synthetic host.
|
|
227
|
+
*
|
|
228
|
+
* @param {string} targetDir
|
|
229
|
+
* @param {string} frameworkRoot
|
|
230
|
+
* @param {Array<{host:string, spec_id:string, kind:string, action:string}>} writes
|
|
231
|
+
*/
|
|
232
|
+
function provisionTauriLauncher(targetDir, frameworkRoot, writes) {
|
|
233
|
+
const destPath = join(targetDir, 'scripts', 'tauri-mcp.sh');
|
|
234
|
+
// Already recorded a launcher write/skip for this run? Only provision once.
|
|
235
|
+
if (writes.some((w) => w.kind === 'launcher'))
|
|
236
|
+
return;
|
|
237
|
+
if (existsSync(destPath)) {
|
|
238
|
+
writes.push({ host: '-', spec_id: 'tauri', kind: 'launcher', action: 'skipped' });
|
|
239
|
+
appendEvent(targetDir, 'mcp-provision.skipped', {
|
|
240
|
+
host: '-',
|
|
241
|
+
spec_id: 'tauri',
|
|
242
|
+
launcher: 'scripts/tauri-mcp.sh',
|
|
243
|
+
});
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const templatePath = resolve(frameworkRoot, 'drivers/tauri/scripts/tauri-mcp.sh');
|
|
247
|
+
const template = readFileSync(templatePath, 'utf-8');
|
|
248
|
+
atomicWriteText(destPath, renderTauriLauncher(template, targetDir));
|
|
249
|
+
writes.push({ host: '-', spec_id: 'tauri', kind: 'launcher', action: 'written' });
|
|
250
|
+
appendEvent(targetDir, 'mcp-provision.written', {
|
|
251
|
+
host: '-',
|
|
252
|
+
spec_id: 'tauri',
|
|
253
|
+
launcher: 'scripts/tauri-mcp.sh',
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Append one audit line to .aperant/events/{date}.jsonl, mirroring the
|
|
258
|
+
* daily-events shape. `kind` discriminates the provisioning channel:
|
|
259
|
+
* `mcp_provision` for MCP-server + launcher events, `skill_provision` for
|
|
260
|
+
* skill-copy events.
|
|
261
|
+
*
|
|
262
|
+
* @param {string} targetDir
|
|
263
|
+
* @param {string} op — e.g. mcp-provision.written, skill-provision.skipped
|
|
264
|
+
* @param {Record<string, unknown>} [extra]
|
|
265
|
+
* @param {string} [kind] — audit channel (default `mcp_provision`)
|
|
266
|
+
*/
|
|
267
|
+
function appendEvent(targetDir, op, extra = {}, kind = 'mcp_provision') {
|
|
268
|
+
try {
|
|
269
|
+
const path = dailyEventsPath(targetDir);
|
|
270
|
+
appendJsonl(path, {
|
|
271
|
+
ts: new Date().toISOString(),
|
|
272
|
+
kind,
|
|
273
|
+
op,
|
|
274
|
+
...extra,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// Audit is best-effort — never fail provisioning on a log write error.
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=mcp-provision.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-provision.mjs","sourceRoot":"","sources":["../../../src/cli/install/mcp-provision.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEtD;;;;;;;;GAQG;AACH,MAAM,sBAAsB,GAAG;IAC9B,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAA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KAChC,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,WAAW,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,GAAG,eAAe;IACrE,IAAI,CAAC;QACJ,MAAM,IAAI,GAAG,eAAe,CAAC,SAAS,CAAC,CAAA;QACvC,WAAW,CAAC,IAAI,EAAE;YACjB,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC5B,IAAI;YACJ,EAAE;YACF,GAAG,KAAK;SACR,CAAC,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QACR,uEAAuE;IACxE,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map a project's runtime capabilities to the provision spec ids it
|
|
3
|
+
* triggers. A multi-surface monorepo (e.g. electron + nextjs) returns
|
|
4
|
+
* multiple ids.
|
|
5
|
+
*
|
|
6
|
+
* is_electron → ['electron']
|
|
7
|
+
* is_tauri → ['tauri']
|
|
8
|
+
* is_web_frontend|is_nextjs|is_nuxt → ['agent-browser']
|
|
9
|
+
*
|
|
10
|
+
* Accepts a partial capability record — only the flags it reads need be
|
|
11
|
+
* present (the rest default to absent/false).
|
|
12
|
+
*
|
|
13
|
+
* @param {Partial<import('../util/runtime-capabilities.mjs').RuntimeCapabilities>} runtimeCaps
|
|
14
|
+
* @returns {string[]}
|
|
15
|
+
*/
|
|
16
|
+
export function capabilityToProvisionIds(runtimeCaps: Partial<import("../util/runtime-capabilities.mjs").RuntimeCapabilities>): string[];
|
|
17
|
+
/**
|
|
18
|
+
* install/mcp-server-specs.mjs — single-sourced install-time provision specs.
|
|
19
|
+
*
|
|
20
|
+
* One registry, two kinds (ID-03):
|
|
21
|
+
* - kind 'mcp-server' (electron, tauri): the {command, args, env?} the
|
|
22
|
+
* installer writes into each host CLI's MCP config. Keyed by the SAME
|
|
23
|
+
* `transport.mcp_server_id` string the driver manifests carry.
|
|
24
|
+
* - kind 'skill' (agent-browser): the vendored SKILL.md the installer
|
|
25
|
+
* copies into each host CLI's skill dir. Keyed by the SAME
|
|
26
|
+
* `transport.skill_id` the browser driver manifest carries.
|
|
27
|
+
*
|
|
28
|
+
* We do NOT derive commands from the driver manifests — manifests are
|
|
29
|
+
* transport-agnostic by design (ID-01 keeps the verb→tool mapping in the
|
|
30
|
+
* driver; this is a separate install-only transport/skill concern). We do
|
|
31
|
+
* NOT add a per-driver mcp-server.json (over-engineering for 3 specs —
|
|
32
|
+
* CLAUDE.md Simplicity First).
|
|
33
|
+
*
|
|
34
|
+
* Pure module — no fs, no exec.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {Object} McpServerSpec
|
|
38
|
+
* @property {'mcp-server'} kind
|
|
39
|
+
* @property {string} command
|
|
40
|
+
* @property {string[]} args
|
|
41
|
+
* @property {Record<string, string>} [env]
|
|
42
|
+
* @property {boolean} [requiresLauncherScript] — tauri: copy scripts/tauri-mcp.sh first
|
|
43
|
+
*
|
|
44
|
+
* @typedef {Object} SkillSpec
|
|
45
|
+
* @property {'skill'} kind
|
|
46
|
+
* @property {string} skillId
|
|
47
|
+
* @property {string} vendoredSkillRelPath — relative to the framework root
|
|
48
|
+
*
|
|
49
|
+
* @typedef {McpServerSpec | SkillSpec} ProvisionSpec
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* The install-time provision specs, keyed by spec id.
|
|
53
|
+
*
|
|
54
|
+
* `electron` / `tauri` ids match each driver manifest's
|
|
55
|
+
* `transport.mcp_server_id`; `agent-browser` matches the browser driver
|
|
56
|
+
* manifest's `transport.skill_id`.
|
|
57
|
+
*
|
|
58
|
+
* @type {Record<string, ProvisionSpec>}
|
|
59
|
+
*/
|
|
60
|
+
export const PROVISION_SPECS: Record<string, ProvisionSpec>;
|
|
61
|
+
export type McpServerSpec = {
|
|
62
|
+
kind: "mcp-server";
|
|
63
|
+
command: string;
|
|
64
|
+
args: string[];
|
|
65
|
+
env?: Record<string, string> | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* — tauri: copy scripts/tauri-mcp.sh first
|
|
68
|
+
*/
|
|
69
|
+
requiresLauncherScript?: boolean | undefined;
|
|
70
|
+
};
|
|
71
|
+
export type SkillSpec = {
|
|
72
|
+
kind: "skill";
|
|
73
|
+
skillId: string;
|
|
74
|
+
/**
|
|
75
|
+
* — relative to the framework root
|
|
76
|
+
*/
|
|
77
|
+
vendoredSkillRelPath: string;
|
|
78
|
+
};
|
|
79
|
+
export type ProvisionSpec = McpServerSpec | SkillSpec;
|
|
80
|
+
//# sourceMappingURL=mcp-server-specs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server-specs.d.mts","sourceRoot":"","sources":["../../../src/cli/install/mcp-server-specs.mjs"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;;;GAcG;AACH,sDAHW,OAAO,CAAC,OAAO,kCAAkC,EAAE,mBAAmB,CAAC,GACrE,MAAM,EAAE,CAWpB;AApGD;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,8BAFU,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CA+BtC;;UApDa,YAAY;aACZ,MAAM;UACN,MAAM,EAAE;;;;;;;;UAKR,OAAO;aACP,MAAM;;;;0BACN,MAAM;;4BAEP,aAAa,GAAG,SAAS"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* install/mcp-server-specs.mjs — single-sourced install-time provision specs.
|
|
3
|
+
*
|
|
4
|
+
* One registry, two kinds (ID-03):
|
|
5
|
+
* - kind 'mcp-server' (electron, tauri): the {command, args, env?} the
|
|
6
|
+
* installer writes into each host CLI's MCP config. Keyed by the SAME
|
|
7
|
+
* `transport.mcp_server_id` string the driver manifests carry.
|
|
8
|
+
* - kind 'skill' (agent-browser): the vendored SKILL.md the installer
|
|
9
|
+
* copies into each host CLI's skill dir. Keyed by the SAME
|
|
10
|
+
* `transport.skill_id` the browser driver manifest carries.
|
|
11
|
+
*
|
|
12
|
+
* We do NOT derive commands from the driver manifests — manifests are
|
|
13
|
+
* transport-agnostic by design (ID-01 keeps the verb→tool mapping in the
|
|
14
|
+
* driver; this is a separate install-only transport/skill concern). We do
|
|
15
|
+
* NOT add a per-driver mcp-server.json (over-engineering for 3 specs —
|
|
16
|
+
* CLAUDE.md Simplicity First).
|
|
17
|
+
*
|
|
18
|
+
* Pure module — no fs, no exec.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} McpServerSpec
|
|
22
|
+
* @property {'mcp-server'} kind
|
|
23
|
+
* @property {string} command
|
|
24
|
+
* @property {string[]} args
|
|
25
|
+
* @property {Record<string, string>} [env]
|
|
26
|
+
* @property {boolean} [requiresLauncherScript] — tauri: copy scripts/tauri-mcp.sh first
|
|
27
|
+
*
|
|
28
|
+
* @typedef {Object} SkillSpec
|
|
29
|
+
* @property {'skill'} kind
|
|
30
|
+
* @property {string} skillId
|
|
31
|
+
* @property {string} vendoredSkillRelPath — relative to the framework root
|
|
32
|
+
*
|
|
33
|
+
* @typedef {McpServerSpec | SkillSpec} ProvisionSpec
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* The install-time provision specs, keyed by spec id.
|
|
37
|
+
*
|
|
38
|
+
* `electron` / `tauri` ids match each driver manifest's
|
|
39
|
+
* `transport.mcp_server_id`; `agent-browser` matches the browser driver
|
|
40
|
+
* manifest's `transport.skill_id`.
|
|
41
|
+
*
|
|
42
|
+
* @type {Record<string, ProvisionSpec>}
|
|
43
|
+
*/
|
|
44
|
+
export const PROVISION_SPECS = {
|
|
45
|
+
// kind 'mcp-server'
|
|
46
|
+
electron: {
|
|
47
|
+
kind: 'mcp-server',
|
|
48
|
+
command: 'npx',
|
|
49
|
+
args: ['-y', 'electron-mcp-server'],
|
|
50
|
+
// No SCREENSHOT_ENCRYPTION_KEY — left for the user to add per ID-09.
|
|
51
|
+
env: {},
|
|
52
|
+
},
|
|
53
|
+
tauri: {
|
|
54
|
+
kind: 'mcp-server',
|
|
55
|
+
// The tauri-plugin-mcp-server npm bin ships without a shebang, so it
|
|
56
|
+
// cannot be invoked via `npx -y`. We launch it through a generated
|
|
57
|
+
// scripts/tauri-mcp.sh (ID-04) — the proven racing-ai shape.
|
|
58
|
+
command: 'bash',
|
|
59
|
+
args: ['./scripts/tauri-mcp.sh'],
|
|
60
|
+
requiresLauncherScript: true,
|
|
61
|
+
},
|
|
62
|
+
// kind 'skill'
|
|
63
|
+
'agent-browser': {
|
|
64
|
+
kind: 'skill',
|
|
65
|
+
skillId: 'agent-browser',
|
|
66
|
+
// Vendored UNDER the browser driver (NOT skills/agent-browser/) so the
|
|
67
|
+
// install pipeline's discoverCanonicalFiles does not auto-install it
|
|
68
|
+
// into every project unconditionally — that would break the
|
|
69
|
+
// verification.provision_mcp opt-out (AC7) and the web-frontend runtime
|
|
70
|
+
// gate. The provisioner (mcp-provision.mjs) is the sole installer.
|
|
71
|
+
vendoredSkillRelPath: 'drivers/browser/skill/agent-browser/SKILL.md',
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Map a project's runtime capabilities to the provision spec ids it
|
|
76
|
+
* triggers. A multi-surface monorepo (e.g. electron + nextjs) returns
|
|
77
|
+
* multiple ids.
|
|
78
|
+
*
|
|
79
|
+
* is_electron → ['electron']
|
|
80
|
+
* is_tauri → ['tauri']
|
|
81
|
+
* is_web_frontend|is_nextjs|is_nuxt → ['agent-browser']
|
|
82
|
+
*
|
|
83
|
+
* Accepts a partial capability record — only the flags it reads need be
|
|
84
|
+
* present (the rest default to absent/false).
|
|
85
|
+
*
|
|
86
|
+
* @param {Partial<import('../util/runtime-capabilities.mjs').RuntimeCapabilities>} runtimeCaps
|
|
87
|
+
* @returns {string[]}
|
|
88
|
+
*/
|
|
89
|
+
export function capabilityToProvisionIds(runtimeCaps) {
|
|
90
|
+
const ids = [];
|
|
91
|
+
if (!runtimeCaps || typeof runtimeCaps !== 'object')
|
|
92
|
+
return ids;
|
|
93
|
+
if (runtimeCaps.is_electron)
|
|
94
|
+
ids.push('electron');
|
|
95
|
+
if (runtimeCaps.is_tauri)
|
|
96
|
+
ids.push('tauri');
|
|
97
|
+
if (runtimeCaps.is_web_frontend || runtimeCaps.is_nextjs || runtimeCaps.is_nuxt) {
|
|
98
|
+
ids.push('agent-browser');
|
|
99
|
+
}
|
|
100
|
+
return ids;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=mcp-server-specs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server-specs.mjs","sourceRoot":"","sources":["../../../src/cli/install/mcp-server-specs.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,oBAAoB;IACpB,QAAQ,EAAE;QACT,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,qBAAqB,CAAC;QACnC,qEAAqE;QACrE,GAAG,EAAE,EAAE;KACP;IACD,KAAK,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,qEAAqE;QACrE,mEAAmE;QACnE,6DAA6D;QAC7D,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,CAAC,wBAAwB,CAAC;QAChC,sBAAsB,EAAE,IAAI;KAC5B;IACD,eAAe;IACf,eAAe,EAAE;QAChB,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,eAAe;QACxB,uEAAuE;QACvE,qEAAqE;QACrE,4DAA4D;QAC5D,wEAAwE;QACxE,mEAAmE;QACnE,oBAAoB,EAAE,8CAA8C;KACpE;CACD,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAW;IACnD,MAAM,GAAG,GAAG,EAAE,CAAA;IACd,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAA;IAC/D,IAAI,WAAW,CAAC,WAAW;QAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACjD,IAAI,WAAW,CAAC,QAAQ;QAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC3C,IAAI,WAAW,CAAC,eAAe,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACjF,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,GAAG,CAAA;AACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-detect.d.mts","sourceRoot":"","sources":["../../../src/cli/install/runtime-detect.mjs"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-detect.d.mts","sourceRoot":"","sources":["../../../src/cli/install/runtime-detect.mjs"],"names":[],"mappings":"AAgMA;;;;;GAKG;AACH,+BAHW,MAAM,GACJ,iBAAiB,GAAC,IAAI,CAIlC;AAED;;;;;;;;;GASG;AACH,2CAHW,MAAM,GACJ,MAAM,EAAE,CAcpB;AAED;;;;;;GAMG;AACH,mDAHW,MAAM,GACJ,iBAAiB,EAAE,CAc/B;AAxND;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,kCAAkC;AAClC,uBADW,iBAAiB,EAAE,CA8H5B;AAEF,0BAA0B;AAC1B,0BADW,GAAG,CAAC,MAAM,CAAC,CACuC;;;;;QA/J/C,MAAM;;;;UACN,MAAM;;;;;iBACN,MAAM;;;;;;aAEN,MAAM,EAAE;;;;;;;WAGR,MAAM,GAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;2BASX,MAAM,GAAC,IAAI"}
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
import { existsSync, statSync } from 'node:fs';
|
|
17
17
|
import { join } from 'node:path';
|
|
18
18
|
import { MANIFEST_FILENAME } from './manifest.mjs';
|
|
19
|
+
// Package.json-shape capability detection lives in util/ (shared with
|
|
20
|
+
// verify-proof/runtime-detect.mjs). Re-exported here so install-layer callers
|
|
21
|
+
// (e.g. install/mcp-provision.mjs) consume it from their OWN layer instead of
|
|
22
|
+
// reaching across into verify-proof/.
|
|
23
|
+
export { detectFromPackageJson, loadRuntimeCapabilities, } from '../util/runtime-capabilities.mjs';
|
|
19
24
|
/**
|
|
20
25
|
* @typedef {Object} RuntimeDescriptor
|
|
21
26
|
* @property {string} id Stable identifier (`claude`, `cursor`, …).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-detect.mjs","sourceRoot":"","sources":["../../../src/cli/install/runtime-detect.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,kCAAkC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC;QACC,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,CAAC,uBAAuB,EAAE,6BAA6B,CAAC;QACjE,KAAK,EAAE,aAAa;QACpB,qBAAqB,EAAE,WAAW;KAClC;IACD;QACC,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,CAAC,oBAAoB,CAAC;QAC/B,KAAK,EAAE,OAAO;QACd,qBAAqB,EAAE,WAAW;KAClC;IACD;QACC,EAAE,EAAE,QAAQ;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xC,MAAM,GAAG,GAAG,EAAE,CAAA;IACd,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC1B,IAAI,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;YAChD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;YACd,SAAQ;QACT,CAAC;QACD,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QACf,CAAC;IACF,CAAC;IACD,OAAO,GAAG,CAAA;AACX,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAS;IAChD,MAAM,GAAG,GAAG,EAAE,CAAA;IACd,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;QACtE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YAAE,SAAQ;QACvC,IAAI,CAAC;YACJ,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE;gBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjD,CAAC;QAAC,MAAM,CAAC;YACR,0DAA0D;QAC3D,CAAC;IACF,CAAC;IACD,OAAO,GAAG,CAAA;AACX,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `existingToml` already declares a `[mcp_servers.<id>]` table.
|
|
3
|
+
* Matches the header at the start of a line (ignoring leading whitespace),
|
|
4
|
+
* permitting an optional TOML trailing comment (` # …`) after the header —
|
|
5
|
+
* a hand-authored `[mcp_servers.tauri] # my server` must still count as
|
|
6
|
+
* present, otherwise the upsert would append a DUPLICATE table and produce
|
|
7
|
+
* an unparseable config (two same-named tables). The id is taken literally
|
|
8
|
+
* (dotted-key TOML ids do not occur for our server ids — electron/tauri are
|
|
9
|
+
* bare) and regex-escaped defensively. A `#`-prefixed comment LINE that
|
|
10
|
+
* merely mentions the header is NOT a match (the header must be the first
|
|
11
|
+
* non-whitespace token).
|
|
12
|
+
*
|
|
13
|
+
* @param {string} existingToml
|
|
14
|
+
* @param {string} serverId
|
|
15
|
+
* @returns {boolean}
|
|
16
|
+
*/
|
|
17
|
+
export function hasMcpServerTable(existingToml: string, serverId: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Upsert a `[mcp_servers.<id>]` table into a Codex config.toml string.
|
|
20
|
+
*
|
|
21
|
+
* TOFU (ID-05): if a `[mcp_servers.<id>]` table already exists, returns the
|
|
22
|
+
* input unchanged with `action: 'skipped'`. Otherwise appends the new table
|
|
23
|
+
* (and a nested `[mcp_servers.<id>.env]` table when `env` is non-empty) at
|
|
24
|
+
* EOF, preserving all existing content verbatim, and returns the new
|
|
25
|
+
* content with `action: 'written'`.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} existingToml — current file contents ('' when the file is absent)
|
|
28
|
+
* @param {string} serverId
|
|
29
|
+
* @param {{command: string, args: string[], env?: Record<string, string>}} spec
|
|
30
|
+
* @returns {{content: string, action: 'written'|'skipped'}}
|
|
31
|
+
*/
|
|
32
|
+
export function upsertMcpServerToml(existingToml: string, serverId: string, spec: {
|
|
33
|
+
command: string;
|
|
34
|
+
args: string[];
|
|
35
|
+
env?: Record<string, string>;
|
|
36
|
+
}): {
|
|
37
|
+
content: string;
|
|
38
|
+
action: "written" | "skipped";
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=toml-merge.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toml-merge.d.mts","sourceRoot":"","sources":["../../../src/cli/install/toml-merge.mjs"],"names":[],"mappings":"AA2DA;;;;;;;;;;;;;;;GAeG;AACH,gDAJW,MAAM,YACN,MAAM,GACJ,OAAO,CAanB;AAED;;;;;;;;;;;;;GAaG;AACH,kDALW,MAAM,YACN,MAAM,QACN;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,GAC7D;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAC,SAAS,CAAA;CAAC,CAsC1D"}
|