@evomap/evolver-cli 2.0.25 → 2.0.27
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/dist/doctor.js +26 -2
- package/dist/setupHooks.d.ts +12 -0
- package/dist/setupHooks.js +198 -40
- package/package.json +7 -7
package/dist/doctor.js
CHANGED
|
@@ -1043,12 +1043,28 @@ function parseFlags(argv) {
|
|
|
1043
1043
|
return { ...(root !== undefined ? { root } : {}), json, profile, envCatalog };
|
|
1044
1044
|
}
|
|
1045
1045
|
const ICON = { pass: 'ok ', warn: 'warn', fail: 'FAIL' };
|
|
1046
|
+
const PRIVATE_RUNTIME_OPERATOR_BOUNDARY = Object.freeze({
|
|
1047
|
+
invitationEnrollment: {
|
|
1048
|
+
owner: 'evolver_proxy',
|
|
1049
|
+
supported: true,
|
|
1050
|
+
input: 'A2A_INVITATION_TOKEN',
|
|
1051
|
+
},
|
|
1052
|
+
invitationManagement: {
|
|
1053
|
+
owner: 'private_hub_operator',
|
|
1054
|
+
cliSupported: false,
|
|
1055
|
+
actions: ['create', 'list', 'revoke'],
|
|
1056
|
+
},
|
|
1057
|
+
});
|
|
1046
1058
|
export async function runDoctor(argv, deps = {}) {
|
|
1047
1059
|
const f = parseFlags(argv);
|
|
1048
1060
|
if (f.envCatalog) {
|
|
1049
1061
|
const catalog = buildEnvCatalog({ ...deps, profile: f.profile, ...(f.root !== undefined ? { configRoot: f.root } : {}) });
|
|
1050
1062
|
if (f.json) {
|
|
1051
|
-
process.stdout.write(`${JSON.stringify({
|
|
1063
|
+
process.stdout.write(`${JSON.stringify({
|
|
1064
|
+
ok: true,
|
|
1065
|
+
...catalog,
|
|
1066
|
+
...(f.profile === 'private-runtime' ? { operatorBoundary: PRIVATE_RUNTIME_OPERATOR_BOUNDARY } : {}),
|
|
1067
|
+
})}\n`);
|
|
1052
1068
|
}
|
|
1053
1069
|
else {
|
|
1054
1070
|
process.stdout.write(formatEnvCatalog(catalog, deps.label ?? (f.profile === 'private-runtime' ? 'evolver phub doctor' : 'evolver doctor')));
|
|
@@ -1073,10 +1089,18 @@ export async function runDoctor(argv, deps = {}) {
|
|
|
1073
1089
|
}
|
|
1074
1090
|
}
|
|
1075
1091
|
if (f.json) {
|
|
1076
|
-
process.stdout.write(`${JSON.stringify({
|
|
1092
|
+
process.stdout.write(`${JSON.stringify({
|
|
1093
|
+
ok: !failed,
|
|
1094
|
+
profile: f.profile,
|
|
1095
|
+
checks,
|
|
1096
|
+
...(f.profile === 'private-runtime' ? { operatorBoundary: PRIVATE_RUNTIME_OPERATOR_BOUNDARY } : {}),
|
|
1097
|
+
})}\n`);
|
|
1077
1098
|
}
|
|
1078
1099
|
else {
|
|
1079
1100
|
process.stdout.write(`${deps.label ?? (f.profile === 'private-runtime' ? 'evolver phub doctor' : 'evolver doctor')} (read-only):\n`);
|
|
1101
|
+
if (f.profile === 'private-runtime') {
|
|
1102
|
+
process.stdout.write(' operator-boundary: invitation enrollment=proxy; create/list/revoke=private Hub operator console/API\n');
|
|
1103
|
+
}
|
|
1080
1104
|
for (const c of checks)
|
|
1081
1105
|
process.stdout.write(` [${ICON[c.status]}] ${c.name}: ${c.detail}\n`);
|
|
1082
1106
|
process.stdout.write(failed ? 'doctor: FAIL — fix the items above.\n' : 'doctor: ok.\n');
|
package/dist/setupHooks.d.ts
CHANGED
|
@@ -4,8 +4,20 @@ import { maybeEmitNonGitWorkspaceNotice } from './nonGitWorkspaceNotice.js';
|
|
|
4
4
|
interface SetupHooksDeps {
|
|
5
5
|
emitNonGitWorkspaceNotice?: typeof maybeEmitNonGitWorkspaceNotice;
|
|
6
6
|
runtimeAvailable?: (runtime: 'opencode' | 'kiro', configRoot: string, scope: InstallScope) => boolean;
|
|
7
|
+
/** Test seam proving service-only/manual paths do not resolve an unrelated MCP Node executable. */
|
|
8
|
+
resolveMcpNodePath?: () => string;
|
|
7
9
|
}
|
|
8
10
|
export declare function commandNamesForPath(command: string, platform: NodeJS.Platform, pathExt: string | undefined): string[];
|
|
11
|
+
/** Paths under package-manager stores are volatile: the linked Node disappears on the next install/upgrade,
|
|
12
|
+
* so a persisted command pointing there breaks the generated MCP config. Exported for tests so the assertion
|
|
13
|
+
* regex cannot drift from the resolver's. */
|
|
14
|
+
export declare const VOLATILE_PACKAGE_MANAGER_NODE_PATH: RegExp;
|
|
15
|
+
export declare function resolveStableMcpNodePath(options?: {
|
|
16
|
+
execPath?: string;
|
|
17
|
+
platform?: NodeJS.Platform;
|
|
18
|
+
/** Test-only fixed system candidates. Production callers must not derive these from environment input. */
|
|
19
|
+
systemCandidates?: readonly string[];
|
|
20
|
+
}): string;
|
|
9
21
|
export declare function safeSetupOperationError(error: unknown): string;
|
|
10
22
|
export declare function safeSetupResultError(error: unknown): string;
|
|
11
23
|
export declare function runSetupHooks(argv: readonly string[], store?: assetstore.AssetStoreProvider, review?: assetstore.ReviewLedger, deps?: SetupHooksDeps): Promise<number>;
|
package/dist/setupHooks.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
// cleanly removes only evolver's entries.
|
|
7
7
|
import { planInjection, installInjection, uninstallInjection, runtimeSupport, renderManualWiring, renderServiceGuidance, SETUP_RUNTIMES, SERVICE_TARGETS, kiroConfigRoot, resolveOpenCodeConfig, McpConfigConflictError, McpConfigOwnershipError, McpConfigVerificationError, McpServerValidationError } from '@evomap/evolver-mcp';
|
|
8
8
|
import { assetstore, events } from '@evomap/evolver-core';
|
|
9
|
-
import { accessSync, constants, existsSync, readFileSync, statSync } from 'node:fs';
|
|
9
|
+
import { accessSync, constants, existsSync, readFileSync, realpathSync, statSync } from 'node:fs';
|
|
10
10
|
import { createRequire } from 'node:module';
|
|
11
11
|
import { homedir } from 'node:os';
|
|
12
|
-
import { delimiter, dirname, isAbsolute,
|
|
12
|
+
import { basename, delimiter, dirname, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
14
|
import { currentTopCursorGenes } from './cursorRewrite.js';
|
|
15
15
|
import { resolveProxyBinPath, resolveStableNodePath } from './lifecycle.js';
|
|
@@ -42,7 +42,7 @@ function parseFlags(argv) {
|
|
|
42
42
|
}
|
|
43
43
|
return out;
|
|
44
44
|
}
|
|
45
|
-
const USAGE = `usage: evolver setup-hooks [--runtime=${SETUP_RUNTIMES.join('|')}] [--scope=user|project|global] [--root=<dir>] [--env-file=<path>] [--profile-descriptor=<json>] [--service=${SERVICE_TARGETS.join('|')}] [--verify] [--uninstall] [--dry-run] [--force] [--json] [--hook-command="evolver inject session-start"] [--server-command=<cmd>] [--server-args=a,b] [--service-command=<cmd>] [--service-args=a,b]\n --verify is read-only for opencode and kiro\n`;
|
|
45
|
+
const USAGE = `usage: evolver setup-hooks [--runtime=${SETUP_RUNTIMES.join('|')}] [--scope=user|project|global] [--root=<dir>] [--env-file=<path>] [--profile-descriptor=<json>] [--service=${SERVICE_TARGETS.join('|')}] [--verify] [--uninstall] [--dry-run] [--force] [--json] [--hook-command="evolver inject session-start"] [--server-node=<absolute-node>] [--server-command=<cmd>] [--server-args=a,b] [--service-command=<cmd>] [--service-args=a,b]\n --verify is read-only for opencode and kiro\n`;
|
|
46
46
|
export function commandNamesForPath(command, platform, pathExt) {
|
|
47
47
|
if (platform !== 'win32' || /\.[^\\/]+$/.test(command))
|
|
48
48
|
return [command];
|
|
@@ -53,23 +53,95 @@ export function commandNamesForPath(command, platform, pathExt) {
|
|
|
53
53
|
.map((extension) => extension.startsWith('.') ? extension : `.${extension}`);
|
|
54
54
|
return [command, ...extensions.map((extension) => `${command}${extension}`)];
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
class StableNodePathError extends Error {
|
|
57
|
+
constructor() {
|
|
58
|
+
super('[setup-hooks] cannot resolve a stable absolute Node executable outside package-manager stores; install Node at a standard system path or pass --server-node=<absolute-node>');
|
|
59
|
+
this.name = 'StableNodePathError';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
class McpNodeOverrideError extends Error {
|
|
63
|
+
constructor(message) {
|
|
64
|
+
super(`[setup-hooks] ${message}`);
|
|
65
|
+
this.name = 'McpNodeOverrideError';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Paths under package-manager stores are volatile: the linked Node disappears on the next install/upgrade,
|
|
69
|
+
* so a persisted command pointing there breaks the generated MCP config. Exported for tests so the assertion
|
|
70
|
+
* regex cannot drift from the resolver's. */
|
|
71
|
+
export const VOLATILE_PACKAGE_MANAGER_NODE_PATH = /(?:^|[\\/])(?:pnpm[\\/]store|store[\\/]v\d+[\\/]links|node_modules[\\/]\.pnpm|node_modules[\\/]\.bin|\.npm[\\/]_npx)(?:[\\/]|$)/i;
|
|
72
|
+
function executableFile(path) {
|
|
73
|
+
try {
|
|
74
|
+
if (!statSync(path).isFile())
|
|
75
|
+
return false;
|
|
76
|
+
accessSync(path, constants.X_OK);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function stableNodeExecutablePath(path, preserveStableEntry = false) {
|
|
84
|
+
if (!isAbsolute(path) || !/^node(?:js)?(?:\.exe)?$/i.test(basename(path)) || !executableFile(path))
|
|
85
|
+
return undefined;
|
|
86
|
+
if (preserveStableEntry && VOLATILE_PACKAGE_MANAGER_NODE_PATH.test(path))
|
|
87
|
+
return undefined;
|
|
88
|
+
try {
|
|
89
|
+
const canonical = realpathSync(path);
|
|
90
|
+
if (VOLATILE_PACKAGE_MANAGER_NODE_PATH.test(canonical)
|
|
91
|
+
|| !/^node(?:js)?(?:\.exe)?$/i.test(basename(canonical))
|
|
92
|
+
|| !executableFile(canonical))
|
|
93
|
+
return undefined;
|
|
94
|
+
return preserveStableEntry ? resolve(path) : canonical;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function commandPaths(commands, platform, env) {
|
|
101
|
+
const names = commands.flatMap((command) => commandNamesForPath(command, platform, env['PATHEXT']));
|
|
102
|
+
const candidates = [];
|
|
103
|
+
for (const rawDirectory of (env['PATH'] ?? '').split(delimiter).filter(Boolean)) {
|
|
104
|
+
const directory = rawDirectory.trim().replace(/^"|"$/g, '');
|
|
59
105
|
for (const name of names) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
continue;
|
|
64
|
-
accessSync(candidate, constants.X_OK);
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
// Continue searching PATH.
|
|
69
|
-
}
|
|
106
|
+
const candidate = resolve(directory, name);
|
|
107
|
+
if (executableFile(candidate))
|
|
108
|
+
candidates.push(candidate);
|
|
70
109
|
}
|
|
71
110
|
}
|
|
72
|
-
return
|
|
111
|
+
return candidates;
|
|
112
|
+
}
|
|
113
|
+
function commandPath(command, platform, env) {
|
|
114
|
+
return commandPaths([command], platform, env)[0];
|
|
115
|
+
}
|
|
116
|
+
export function resolveStableMcpNodePath(options = {}) {
|
|
117
|
+
const execPath = options.execPath ?? process.execPath;
|
|
118
|
+
const platform = options.platform ?? process.platform;
|
|
119
|
+
const stableExecPath = stableNodeExecutablePath(execPath);
|
|
120
|
+
if (stableExecPath)
|
|
121
|
+
return stableExecPath;
|
|
122
|
+
// Do not persist a PATH candidate: PATH and ProgramFiles-style environment variables are
|
|
123
|
+
// caller-controlled and the selected file can be replaced after validation. Fixed system
|
|
124
|
+
// locations are the only automatic fallback; non-standard layouts use --server-command.
|
|
125
|
+
const systemCandidates = options.systemCandidates ?? (platform === 'win32'
|
|
126
|
+
? []
|
|
127
|
+
: [
|
|
128
|
+
'/opt/homebrew/bin/node',
|
|
129
|
+
'/usr/local/bin/node',
|
|
130
|
+
'/usr/local/bin/nodejs',
|
|
131
|
+
'/usr/bin/node',
|
|
132
|
+
'/usr/bin/nodejs',
|
|
133
|
+
]);
|
|
134
|
+
for (const candidate of systemCandidates) {
|
|
135
|
+
if (!candidate)
|
|
136
|
+
continue;
|
|
137
|
+
const stableCandidate = stableNodeExecutablePath(candidate, true);
|
|
138
|
+
if (stableCandidate)
|
|
139
|
+
return stableCandidate;
|
|
140
|
+
}
|
|
141
|
+
throw new StableNodePathError();
|
|
142
|
+
}
|
|
143
|
+
function commandOnPath(command) {
|
|
144
|
+
return commandPath(command, process.platform, process.env) !== undefined;
|
|
73
145
|
}
|
|
74
146
|
function defaultRuntimeAvailable(runtime, configRoot, scope) {
|
|
75
147
|
if (runtime === 'opencode') {
|
|
@@ -137,6 +209,10 @@ export function safeSetupOperationError(error) {
|
|
|
137
209
|
}
|
|
138
210
|
if (error instanceof McpServerValidationError)
|
|
139
211
|
return error.message;
|
|
212
|
+
if (error instanceof StableNodePathError)
|
|
213
|
+
return error.message;
|
|
214
|
+
if (error instanceof McpNodeOverrideError)
|
|
215
|
+
return error.message;
|
|
140
216
|
const name = error instanceof Error ? error.name : '';
|
|
141
217
|
switch (name) {
|
|
142
218
|
case 'McpConfigConflictError': return '[setup-hooks] existing Evolver configuration conflicts; use --force to replace only the Evolver entry.';
|
|
@@ -145,6 +221,8 @@ export function safeSetupOperationError(error) {
|
|
|
145
221
|
case 'McpConfigVerificationError': return error.restored === true
|
|
146
222
|
? '[setup-hooks] runtime configuration verification failed; the previous configuration was restored.'
|
|
147
223
|
: '[setup-hooks] runtime configuration verification failed; rollback could not be confirmed. Inspect the runtime config before retrying.';
|
|
224
|
+
case 'StableNodePathError': return '[setup-hooks] cannot resolve a stable absolute Node executable outside package-manager stores; install Node at a standard system path or pass --server-node=<absolute-node>';
|
|
225
|
+
case 'McpNodeOverrideError': return '[setup-hooks] invalid --server-node configuration';
|
|
148
226
|
case 'McpConfigChangedError': return '[setup-hooks] runtime configuration changed during the operation; retry after the runtime finishes writing it.';
|
|
149
227
|
case 'EmptySharedConfigError': return '[setup-hooks] runtime configuration is empty; repair or remove it before retrying.';
|
|
150
228
|
case 'UnparseableConfigError': return '[setup-hooks] runtime configuration is not valid JSON; repair it before retrying.';
|
|
@@ -334,7 +412,7 @@ function parseDescriptorServer(value, label) {
|
|
|
334
412
|
function argsFromFlag(value) {
|
|
335
413
|
return typeof value === 'string' ? value.split(',').filter(Boolean) : undefined;
|
|
336
414
|
}
|
|
337
|
-
function
|
|
415
|
+
function defaultMcpServerArgs() {
|
|
338
416
|
let stdioPath;
|
|
339
417
|
try {
|
|
340
418
|
stdioPath = requireFromHere.resolve('@evomap/evolver-mcp/stdio');
|
|
@@ -342,7 +420,10 @@ function defaultMcpServer() {
|
|
|
342
420
|
catch {
|
|
343
421
|
stdioPath = fileURLToPath(new URL('../../evolver-mcp/dist/stdio.js', import.meta.url));
|
|
344
422
|
}
|
|
345
|
-
return
|
|
423
|
+
return [stdioPath];
|
|
424
|
+
}
|
|
425
|
+
function defaultMcpServer(resolveNodePath = resolveStableMcpNodePath) {
|
|
426
|
+
return { command: resolveNodePath(), args: defaultMcpServerArgs() };
|
|
346
427
|
}
|
|
347
428
|
function defaultProxyDaemon() {
|
|
348
429
|
return { command: resolveStableNodePath(), args: [resolveProxyBinPath() ?? '/ABSOLUTE/PATH/TO/evolver-proxy.js'] };
|
|
@@ -365,24 +446,47 @@ function descriptorEnvFile(f, descriptor, descriptorServer) {
|
|
|
365
446
|
return f['env-file'];
|
|
366
447
|
return descriptorServer?.env?.['EVOLVER_ENV_FILE'] ?? descriptor.envFile;
|
|
367
448
|
}
|
|
368
|
-
function buildServer(f, descriptor = { manualHints: {} }) {
|
|
449
|
+
function buildServer(f, descriptor = { manualHints: {} }, resolveNodePath) {
|
|
369
450
|
const serverArgs = argsFromFlag(f['server-args']);
|
|
370
|
-
|
|
371
|
-
|
|
451
|
+
if (f['server-node'] === true)
|
|
452
|
+
throw new McpNodeOverrideError('missing value for --server-node');
|
|
453
|
+
if (typeof f['server-node'] === 'string' && typeof f['server-command'] === 'string') {
|
|
454
|
+
throw new McpNodeOverrideError('--server-node cannot be combined with --server-command');
|
|
455
|
+
}
|
|
456
|
+
let nodePath;
|
|
457
|
+
let serverBase;
|
|
458
|
+
if (typeof f['server-node'] === 'string') {
|
|
459
|
+
nodePath = resolveStableMcpNodePath({
|
|
460
|
+
execPath: f['server-node'],
|
|
461
|
+
platform: process.platform,
|
|
462
|
+
systemCandidates: [],
|
|
463
|
+
});
|
|
464
|
+
serverBase = { command: nodePath, args: serverArgs ?? defaultMcpServerArgs() };
|
|
465
|
+
}
|
|
466
|
+
else if (typeof f['server-command'] === 'string') {
|
|
467
|
+
serverBase = {
|
|
372
468
|
command: f['server-command'],
|
|
373
469
|
...(serverArgs !== undefined ? { args: serverArgs } : {}),
|
|
374
470
|
...(serverArgs === undefined && descriptor.mcpServer?.args ? { args: descriptor.mcpServer.args } : {}),
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
else if (descriptor.mcpServer) {
|
|
474
|
+
serverBase = {
|
|
475
|
+
...descriptor.mcpServer,
|
|
476
|
+
...(serverArgs !== undefined ? { args: serverArgs } : {}),
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
serverBase = {
|
|
481
|
+
...defaultMcpServer(resolveNodePath),
|
|
482
|
+
...(serverArgs !== undefined ? { args: serverArgs } : {}),
|
|
483
|
+
};
|
|
484
|
+
nodePath = serverBase.command;
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
server: withEnvFile(serverBase, descriptorEnvFile(f, descriptor, descriptor.mcpServer)),
|
|
488
|
+
...(nodePath !== undefined ? { nodePath } : {}),
|
|
489
|
+
};
|
|
386
490
|
}
|
|
387
491
|
function buildServiceExec(f, descriptor = { manualHints: {} }) {
|
|
388
492
|
const serviceArgs = argsFromFlag(f['service-args']);
|
|
@@ -410,7 +514,7 @@ function appendAdapterNotes(text, hints) {
|
|
|
410
514
|
}
|
|
411
515
|
const SETUP_VALUE_FLAGS = new Set([
|
|
412
516
|
'runtime', 'platform', 'scope', 'root', 'env-file', 'profile-descriptor', 'service',
|
|
413
|
-
'hook-command', 'server-command', 'server-args', 'service-command', 'service-args',
|
|
517
|
+
'hook-command', 'server-node', 'server-command', 'server-args', 'service-command', 'service-args',
|
|
414
518
|
]);
|
|
415
519
|
function setupHelpRequested(argv) {
|
|
416
520
|
if (argv.includes('--help'))
|
|
@@ -436,6 +540,12 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
436
540
|
const json = f['json'] === true;
|
|
437
541
|
const emit = (obj) => { if (json)
|
|
438
542
|
process.stdout.write(`${JSON.stringify(obj)}\n`); };
|
|
543
|
+
const emitWarnings = (warnings) => {
|
|
544
|
+
if (json || !warnings)
|
|
545
|
+
return;
|
|
546
|
+
for (const warning of warnings)
|
|
547
|
+
process.stderr.write(`[setup-hooks] warning: ${warning}\n`);
|
|
548
|
+
};
|
|
439
549
|
const scopeResult = parseScope(f['scope']);
|
|
440
550
|
if (!scopeResult.ok) {
|
|
441
551
|
if (json)
|
|
@@ -495,7 +605,7 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
495
605
|
}
|
|
496
606
|
let verification;
|
|
497
607
|
try {
|
|
498
|
-
const server = buildServer(f, verifyDescriptor.descriptor);
|
|
608
|
+
const { server } = buildServer(f, verifyDescriptor.descriptor, deps.resolveMcpNodePath);
|
|
499
609
|
verification = installInjection(planInjection(runtime, server), {
|
|
500
610
|
configRoot,
|
|
501
611
|
server,
|
|
@@ -549,6 +659,7 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
549
659
|
configRoot,
|
|
550
660
|
scope,
|
|
551
661
|
homeDir: configuredHomeDir(),
|
|
662
|
+
codexHome: process.env['CODEX_HOME'],
|
|
552
663
|
kiroHome: process.env['KIRO_HOME'],
|
|
553
664
|
xdgConfigHome: process.env['XDG_CONFIG_HOME'],
|
|
554
665
|
opencodeConfig: process.env['OPENCODE_CONFIG'],
|
|
@@ -597,7 +708,6 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
597
708
|
}
|
|
598
709
|
const descriptor = profileDescriptor.descriptor;
|
|
599
710
|
if (support.outcome === 'manual') {
|
|
600
|
-
const server = buildServer(f, descriptor);
|
|
601
711
|
// server + --service=<target>: emit a ready service template (#217 slice 4). Print-only — evolver does NOT
|
|
602
712
|
// manage service lifecycle; it just prints a template wiring the EVOLVER_ENV_FILE pointer (never a secret).
|
|
603
713
|
if (runtimeRaw === 'server' && typeof f['service'] === 'string') {
|
|
@@ -610,13 +720,36 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
610
720
|
process.stderr.write(`${msg}\n`);
|
|
611
721
|
return 1;
|
|
612
722
|
}
|
|
613
|
-
|
|
723
|
+
let template;
|
|
724
|
+
try {
|
|
725
|
+
template = appendAdapterNotes(renderServiceGuidance(target, { exec: buildServiceExec(f, descriptor) }), descriptor.manualHints[runtimeRaw]);
|
|
726
|
+
}
|
|
727
|
+
catch (error) {
|
|
728
|
+
const message = safeSetupOperationError(error);
|
|
729
|
+
if (json)
|
|
730
|
+
emit({ runtime: runtimeRaw, outcome: 'error', files: [], error: message });
|
|
731
|
+
else
|
|
732
|
+
process.stderr.write(`${message}\n`);
|
|
733
|
+
return 1;
|
|
734
|
+
}
|
|
614
735
|
if (json)
|
|
615
736
|
emit({ runtime: runtimeRaw, outcome: 'manual', files: [], service: target, template });
|
|
616
737
|
else
|
|
617
738
|
process.stdout.write(`${template}\n`);
|
|
618
739
|
return 0;
|
|
619
740
|
}
|
|
741
|
+
let server;
|
|
742
|
+
try {
|
|
743
|
+
server = buildServer(f, descriptor, deps.resolveMcpNodePath).server;
|
|
744
|
+
}
|
|
745
|
+
catch (error) {
|
|
746
|
+
const message = safeSetupOperationError(error);
|
|
747
|
+
if (json)
|
|
748
|
+
emit({ runtime: runtimeRaw, outcome: 'error', files: [], error: message });
|
|
749
|
+
else
|
|
750
|
+
process.stderr.write(`${message}\n`);
|
|
751
|
+
return 1;
|
|
752
|
+
}
|
|
620
753
|
// Otherwise: PRECISE manual wiring (#217 slice 2) so manual is actionable, not a dead end.
|
|
621
754
|
const instructions = renderManualWiring(runtimeRaw, { server, hints: descriptor.manualHints[runtimeRaw] ?? [] });
|
|
622
755
|
if (json)
|
|
@@ -625,7 +758,21 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
625
758
|
process.stdout.write(`${instructions}\n`);
|
|
626
759
|
return 0;
|
|
627
760
|
}
|
|
628
|
-
|
|
761
|
+
let server;
|
|
762
|
+
let serverNodePath;
|
|
763
|
+
try {
|
|
764
|
+
const built = buildServer(f, descriptor, deps.resolveMcpNodePath);
|
|
765
|
+
server = built.server;
|
|
766
|
+
serverNodePath = built.nodePath;
|
|
767
|
+
}
|
|
768
|
+
catch (error) {
|
|
769
|
+
const message = safeSetupOperationError(error);
|
|
770
|
+
if (json)
|
|
771
|
+
emit({ runtime, outcome: 'error', files: [], error: message });
|
|
772
|
+
else
|
|
773
|
+
process.stderr.write(`${message}\n`);
|
|
774
|
+
return 1;
|
|
775
|
+
}
|
|
629
776
|
if ((runtime === 'opencode' || runtime === 'kiro') && f['dry-run'] !== true) {
|
|
630
777
|
let runtimeDetected;
|
|
631
778
|
try {
|
|
@@ -659,13 +806,22 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
659
806
|
: undefined;
|
|
660
807
|
let r;
|
|
661
808
|
try {
|
|
809
|
+
// claude-code and codex also persist a managed evox-product bridge entry that launches its own stdio shim.
|
|
810
|
+
// It must not inherit a package-manager-local process.execPath (#1068): give it the same stable Node the
|
|
811
|
+
// evolver entry uses — the pinned --server-node when set, otherwise the default stable resolution. Runtimes
|
|
812
|
+
// without a bridge entry never resolve a Node here.
|
|
813
|
+
const productBridgeNodePath = (runtime === 'claude-code' || runtime === 'codex')
|
|
814
|
+
? serverNodePath ?? (deps.resolveMcpNodePath ?? resolveStableMcpNodePath)()
|
|
815
|
+
: undefined;
|
|
662
816
|
r = installInjection(planInjection(runtime, server), {
|
|
663
817
|
configRoot, server, scope,
|
|
818
|
+
...(productBridgeNodePath !== undefined ? { productBridgeNodePath } : {}),
|
|
664
819
|
...(typeof f['hook-command'] === 'string' ? { hookCommand: f['hook-command'] } : {}),
|
|
665
820
|
...(cursorGenes ? { genes: cursorGenes } : {}),
|
|
666
821
|
force: f['force'] === true,
|
|
667
822
|
dryRun: f['dry-run'] === true,
|
|
668
823
|
homeDir: configuredHomeDir(),
|
|
824
|
+
codexHome: process.env['CODEX_HOME'],
|
|
669
825
|
kiroHome: process.env['KIRO_HOME'],
|
|
670
826
|
xdgConfigHome: process.env['XDG_CONFIG_HOME'],
|
|
671
827
|
opencodeConfig: process.env['OPENCODE_CONFIG'],
|
|
@@ -716,14 +872,16 @@ export async function runSetupHooks(argv, store, review, deps = {}) {
|
|
|
716
872
|
}
|
|
717
873
|
if (r.alreadyInstalled) {
|
|
718
874
|
if (json)
|
|
719
|
-
emit({ runtime, outcome: 'installed', files, alreadyInstalled: true });
|
|
875
|
+
emit({ runtime, outcome: 'installed', files, alreadyInstalled: true, ...(r.warnings ? { warnings: r.warnings } : {}) });
|
|
720
876
|
else
|
|
721
877
|
process.stdout.write('evolver already installed (use --force to reinstall)\n');
|
|
878
|
+
emitWarnings(r.warnings);
|
|
722
879
|
return 0;
|
|
723
880
|
}
|
|
724
881
|
if (json)
|
|
725
|
-
emit({ runtime, outcome: 'installed', files, backups, mode: r.mode, verified: r.verified });
|
|
882
|
+
emit({ runtime, outcome: 'installed', files, backups, mode: r.mode, verified: r.verified, ...(r.warnings ? { warnings: r.warnings } : {}) });
|
|
726
883
|
else
|
|
727
884
|
process.stdout.write(`installed evolver (${r.mode}) → ${files.join(', ')}\n`);
|
|
885
|
+
emitWarnings(r.warnings);
|
|
728
886
|
return 0;
|
|
729
887
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.27",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@evomap/evolver-core": "2.0.
|
|
27
|
-
"@evomap/evolver-adapter-public": "2.0.
|
|
28
|
-
"@evomap/evolver-mcp": "2.0.
|
|
29
|
-
"@evomap/evolver-proxy": "2.0.
|
|
30
|
-
"@evomap/evolver-runtime-adapters": "2.0.
|
|
31
|
-
"@evomap/evolver-webui": "2.0.
|
|
26
|
+
"@evomap/evolver-core": "2.0.27",
|
|
27
|
+
"@evomap/evolver-adapter-public": "2.0.27",
|
|
28
|
+
"@evomap/evolver-mcp": "2.0.27",
|
|
29
|
+
"@evomap/evolver-proxy": "2.0.27",
|
|
30
|
+
"@evomap/evolver-runtime-adapters": "2.0.27",
|
|
31
|
+
"@evomap/evolver-webui": "2.0.27"
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|