Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/adapters/claudeCode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const { mergeJsonFile, copyHookScripts, verifyHookScriptCopies, appendSectionToFile, removeHookScripts, removeMarkedSection, assertSafeConfigDir, isEvolverHookCommand, buildSafeNodeHookCommand } = require('./hookAdapter');
const productBridgeMcp = require('./productBridgeMcp');

const HOOK_SCRIPTS_DIR_NAME = 'hooks';
const EVOLVER_MARKER = '<!-- evolver-evolution-memory -->';
Expand Down Expand Up @@ -109,12 +110,19 @@ function install({ configRoot, evolverRoot, force }) {
console.log('[claude-code] Injected evolution section into ' + claudeMdPath);
}

const mcp = productBridgeMcp.installClaudeJson({ configRoot, evolverRoot, force });
if (mcp.changed) {
console.log('[claude-code] Wrote product-bridge MCP ' + mcp.path);
} else if (mcp.skipped) {
console.log('[claude-code] Left a user-owned evox-product MCP entry in place');
}

console.log('[claude-code] Installation complete.');

return {
ok: true,
platform: 'claude-code',
files: [settingsPath, claudeMdPath, ...copied],
files: [settingsPath, claudeMdPath, mcp.path, ...copied],
};
}

Expand Down Expand Up @@ -198,6 +206,7 @@ function verify({ configRoot }) {
? 'CLAUDE.md contains the managed evolution section'
: 'CLAUDE.md is missing the managed evolution section',
});
checks.push(...productBridgeMcp.verifyClaudeJson({ configRoot }).checks);

return {
ok: checks.every(check => check.ok),
Expand Down Expand Up @@ -282,6 +291,10 @@ function uninstall({ configRoot }) {
changed = true;
}

if (productBridgeMcp.uninstallClaudeJson({ configRoot })) {
changed = true;
}

console.log(changed
? '[claude-code] Uninstalled evolver hooks.'
: '[claude-code] No evolver hooks found to uninstall.');
Expand Down
19 changes: 18 additions & 1 deletion src/adapters/codex.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const path = require('path');
const { mergeJsonFile, copyHookScripts, verifyHookScriptCopies, appendSectionToFile, removeHookScripts, removeMarkedSection, assertSafeConfigDir, isEvolverHookCommand } = require('./hookAdapter');
const productBridgeMcp = require('./productBridgeMcp');

const HOOK_SCRIPTS_DIR_NAME = 'hooks';
const EVOLVER_MARKER = '<!-- evolver-evolution-memory -->';
Expand Down Expand Up @@ -209,8 +210,12 @@ function install({ configRoot, evolverRoot, force }) {
try {
const existing = JSON.parse(fs.readFileSync(hooksJsonPath, 'utf8'));
if (existing._evolver_managed) {
const mcp = productBridgeMcp.installCodexToml({ configRoot, evolverRoot, force });
if (mcp.changed) {
console.log('[codex] Wrote product-bridge MCP ' + mcp.path);
}
console.log('[codex] Evolver hooks already installed. Use --force to overwrite.');
return { ok: true, skipped: true };
return { ok: true, skipped: true, files: mcp.changed ? [mcp.path] : [] };
}
} catch { /* proceed */ }
}
Expand All @@ -234,6 +239,13 @@ function install({ configRoot, evolverRoot, force }) {
console.log('[codex] Injected evolution section into ' + agentsMdPath);
}

const mcp = productBridgeMcp.installCodexToml({ configRoot, evolverRoot, force });
if (mcp.changed) {
console.log('[codex] Wrote product-bridge MCP ' + mcp.path);
} else if (mcp.skipped) {
console.log('[codex] Left a user-owned evox-product MCP table in place');
}

console.log('[codex] Installation complete.');

return {
Expand Down Expand Up @@ -319,6 +331,7 @@ function verify({ configRoot }) {
? 'AGENTS.md contains the managed evolution section'
: 'AGENTS.md is missing the managed evolution section',
});
checks.push(...productBridgeMcp.verifyCodexToml({ configRoot }).checks);

return {
ok: checks.every(check => check.ok),
Expand Down Expand Up @@ -396,6 +409,10 @@ function uninstall({ configRoot }) {
changed = true;
}

if (productBridgeMcp.uninstallCodexToml({ configRoot })) {
changed = true;
}

if (removeMarkedSection(agentsMdPath, EVOLVER_MARKER)) {
changed = true;
}
Expand Down
4 changes: 3 additions & 1 deletion src/adapters/hookAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,9 @@ function removeEvolverHooks(filePath, { markerKey = '_evolver_managed' } = {}) {
if (Object.keys(data.hooks).length === 0) delete data.hooks;
}
if (data.mcpServers) {
// Claude Code / Codex: hooks in mcpServers sub-key -- not relevant, skip
// Product-bridge MCP is owned by productBridgeMcp.js, not this
// hooks cleaner. Leaving mcpServers untouched avoids deleting a
// user server just because the file also carries _evolver_managed.
}
delete data[markerKey];
const tmp = filePath + '.tmp';
Expand Down
Loading
Loading