@evomap/evolver-cli 2.0.52 → 2.0.53
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/lifecycle.js +12 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +3 -1
- package/dist/pluginHosts.d.ts +3 -0
- package/dist/pluginHosts.js +13 -13
- package/dist/pluginInspection.d.ts +2 -0
- package/dist/pluginInspection.js +7 -9
- package/dist/pluginInstall.d.ts +3 -0
- package/dist/pluginInstall.js +68 -35
- package/dist/pluginZcodeMigration.d.ts +22 -0
- package/dist/pluginZcodeMigration.js +40 -0
- package/package.json +7 -7
package/dist/lifecycle.js
CHANGED
|
@@ -3766,6 +3766,18 @@ function recoverBootstrapTransaction(stateDir, run, uid, now, deadlineMs, assert
|
|
|
3766
3766
|
return { status: 'none' };
|
|
3767
3767
|
}
|
|
3768
3768
|
const marker = readBootstrapMarker(stateDir);
|
|
3769
|
+
if (marker && journal.stage === 'rollback_pending') {
|
|
3770
|
+
assertBootstrapMarkerMatchesJournal(marker, journal);
|
|
3771
|
+
rollbackBootstrapTransaction(stateDir, journal, run, uid, now, deadlineMs, true, true, assertOwner);
|
|
3772
|
+
assertOwner();
|
|
3773
|
+
restoreBootstrapCanonicalQuarantine(stateDir, journal, {
|
|
3774
|
+
beforeMove: () => assertOwner(),
|
|
3775
|
+
afterMove: () => assertOwner(),
|
|
3776
|
+
});
|
|
3777
|
+
assertOwner();
|
|
3778
|
+
removeBootstrapJournal(stateDir);
|
|
3779
|
+
return { status: 'none' };
|
|
3780
|
+
}
|
|
3769
3781
|
if (marker) {
|
|
3770
3782
|
assertBootstrapMarkerMatchesJournal(marker, journal);
|
|
3771
3783
|
assertOwner();
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PluginRuntime } from './pluginRuntime.js';
|
|
2
|
-
export declare const PLUGIN_USAGE = "Usage: evolver plugin list [--json]\n evolver plugin install [--host <host>] [--scope user|project] [--root <dir>]\n [--profile <dsh-profile>] [--trust] [--dry-run] [--json]\n\nHosts: claude-code, codex, grok, qoder, antigravity, opencode, dsh, zcode,\n kimi, stepcode, minimax, cursor, workbuddy, mcp-generic\nDefault scope: user. dsh default profile: dsh-tui.\n--trust says you trust the plugin's hooks; only hosts that require it (grok) accept it.\nWith no host, only a single discovered native host is selected; otherwise choose --host.\nCursor, WorkBuddy and generic MCP return manual_required without writing client config.\nKimi Code
|
|
2
|
+
export declare const PLUGIN_USAGE = "Usage: evolver plugin list [--json]\n evolver plugin install [--host <host>] [--scope user|project] [--root <dir>]\n [--profile <dsh-profile>] [--trust] [--dry-run] [--json]\n\nHosts: claude-code, codex, grok, qoder, antigravity, opencode, dsh, zcode,\n kimi, stepcode, minimax, cursor, workbuddy, mcp-generic\nDefault scope: user. dsh default profile: dsh-tui.\n--trust says you trust the plugin's hooks; only hosts that require it (grok) accept it.\nWith no host, only a single discovered native host is selected; otherwise choose --host.\nCursor, WorkBuddy and generic MCP return manual_required without writing client config.\nKimi Code, Step Code and ZCode install on Windows and macOS.\nZCode installs evolver-plugin@evomap from the evolver-agent-plugin ZCode marketplace\nURL, after uninstalling an evolver-plugin@evolver-zcode-local install (data kept).\nDry-run performs no download, host command or config write and proves no installed state.\nInstallation uses EvoMap/evolver-agent-plugin and does not replace setup-hooks.\nExit codes: 0 verified install/already-installed/list/preview; 2 action required\n(including trust_required and profile_store_mismatch); 1 conflict or failure.\n";
|
|
3
3
|
export interface PluginCommandDeps {
|
|
4
4
|
runtime?: PluginRuntime;
|
|
5
5
|
stdout?: (text: string) => void;
|
package/dist/plugin.js
CHANGED
|
@@ -14,7 +14,9 @@ Default scope: user. dsh default profile: dsh-tui.
|
|
|
14
14
|
--trust says you trust the plugin's hooks; only hosts that require it (grok) accept it.
|
|
15
15
|
With no host, only a single discovered native host is selected; otherwise choose --host.
|
|
16
16
|
Cursor, WorkBuddy and generic MCP return manual_required without writing client config.
|
|
17
|
-
Kimi Code
|
|
17
|
+
Kimi Code, Step Code and ZCode install on Windows and macOS.
|
|
18
|
+
ZCode installs evolver-plugin@evomap from the evolver-agent-plugin ZCode marketplace
|
|
19
|
+
URL, after uninstalling an evolver-plugin@evolver-zcode-local install (data kept).
|
|
18
20
|
Dry-run performs no download, host command or config write and proves no installed state.
|
|
19
21
|
Installation uses EvoMap/evolver-agent-plugin and does not replace setup-hooks.
|
|
20
22
|
Exit codes: 0 verified install/already-installed/list/preview; 2 action required
|
package/dist/pluginHosts.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const AGENT_PLUGIN_GIT_URL = "https://github.com/EvoMap/evolver-a
|
|
|
3
3
|
export declare const AGENT_PLUGIN_NAME = "evolver-plugin";
|
|
4
4
|
export declare const AGENT_PLUGIN_RELEASE = "release";
|
|
5
5
|
export declare const DSH_PLUGIN_SOURCE = "github:EvoMap/evolver-agent-plugin#release&path:dist/dsh";
|
|
6
|
+
export declare const ZCODE_LOCAL_MARKETPLACE = "evolver-zcode-local";
|
|
6
7
|
export declare function agentPluginRepositoryMatches(value: unknown): boolean;
|
|
7
8
|
export type PluginScope = 'user' | 'project';
|
|
8
9
|
type PluginHostId = 'claude-code' | 'codex' | 'grok' | 'qoder' | 'antigravity' | 'opencode' | 'dsh' | 'zcode' | 'kimi' | 'stepcode' | 'minimax' | 'cursor' | 'workbuddy' | 'mcp-generic';
|
|
@@ -18,6 +19,8 @@ export interface PluginHost {
|
|
|
18
19
|
platforms?: readonly NodeJS.Platform[];
|
|
19
20
|
management?: 'plugin' | 'plugins';
|
|
20
21
|
marketplace?: string;
|
|
22
|
+
/** What `marketplace add` registers when it is not the plugin repository itself. */
|
|
23
|
+
marketplaceSource?: string;
|
|
21
24
|
manifest?: string;
|
|
22
25
|
packageName?: string;
|
|
23
26
|
/** Files an installed (and packed) plugin must contain besides its manifest. */
|
package/dist/pluginHosts.js
CHANGED
|
@@ -4,6 +4,9 @@ export const AGENT_PLUGIN_GIT_URL = `https://github.com/${AGENT_PLUGIN_REPOSITOR
|
|
|
4
4
|
export const AGENT_PLUGIN_NAME = 'evolver-plugin';
|
|
5
5
|
export const AGENT_PLUGIN_RELEASE = 'release';
|
|
6
6
|
export const DSH_PLUGIN_SOURCE = `github:${AGENT_PLUGIN_REPOSITORY}#${AGENT_PLUGIN_RELEASE}&path:dist/dsh`;
|
|
7
|
+
/** ZCode resolves a repository marketplace from `.claude-plugin/marketplace.json` first, so it gets its own manifest by URL. */
|
|
8
|
+
const ZCODE_MARKETPLACE_URL = `https://raw.githubusercontent.com/${AGENT_PLUGIN_REPOSITORY}/main/.zcode-plugin/marketplace.json`;
|
|
9
|
+
export const ZCODE_LOCAL_MARKETPLACE = 'evolver-zcode-local';
|
|
7
10
|
export function agentPluginRepositoryMatches(value) {
|
|
8
11
|
if (typeof value !== 'string')
|
|
9
12
|
return false;
|
|
@@ -51,25 +54,27 @@ export const PLUGIN_HOSTS = [
|
|
|
51
54
|
instructions: ['Restart dsh. Installation applies only to the selected profile; repeat for other profiles. DSH Desktop requires its own bundled CLI/profile.'],
|
|
52
55
|
},
|
|
53
56
|
{
|
|
54
|
-
id: 'zcode', label: 'ZCode', command: 'zcode', kind: '
|
|
57
|
+
id: 'zcode', label: 'ZCode', command: 'zcode', kind: 'marketplace', management: 'plugins', marketplace: 'evomap', marketplaceSource: ZCODE_MARKETPLACE_URL,
|
|
55
58
|
scopes: ['user'], platforms: ['win32', 'darwin'], manifest: '.zcode-plugin/plugin.json', entries: ['hooks/hooks.json', 'bin/hook.mjs'], legacyNames: [],
|
|
56
59
|
instructions: [
|
|
57
60
|
'Start a new ZCode session. ZCode CLI and Desktop share this installation; plugins and hooks must be enabled in ZCode.',
|
|
58
61
|
'Evolver runs the CLI shipped with ZCode Desktop, or the standalone zcode.cjs named by ZCODE_CLI_PATH.',
|
|
62
|
+
`The evomap marketplace is ${ZCODE_MARKETPLACE_URL}; plugins update evolver-plugin@evomap follows each release.`,
|
|
63
|
+
`An evolver-plugin@${ZCODE_LOCAL_MARKETPLACE} install is uninstalled first, keeping its data, so hooks do not run twice; its marketplace is removed only when it points into Evolver's release cache.`,
|
|
59
64
|
],
|
|
60
65
|
},
|
|
61
66
|
{
|
|
62
67
|
id: 'kimi', label: 'Kimi Code', command: 'kimi', kind: 'script', installer: 'scripts/install-kimi.mjs',
|
|
63
|
-
scopes: ['user'], platforms: ['win32'], manifest: 'kimi.plugin.json', entries: ['bin/hook.mjs'], legacyNames: [],
|
|
68
|
+
scopes: ['user'], platforms: ['win32', 'darwin'], manifest: 'kimi.plugin.json', entries: ['bin/hook.mjs'], legacyNames: [],
|
|
64
69
|
instructions: [
|
|
65
70
|
'Close Kimi Code before installing or updating, then start a new CLI or Desktop session.',
|
|
66
71
|
'KIMI_CODE_HOME selects the profile root; start Kimi with the same value.',
|
|
67
72
|
],
|
|
68
73
|
},
|
|
69
74
|
{
|
|
70
|
-
id: 'stepcode', label: 'Step Code', command: 'step', kind: 'bundle', scopes: ['user'], platforms: ['win32'],
|
|
75
|
+
id: 'stepcode', label: 'Step Code', command: 'step', kind: 'bundle', scopes: ['user'], platforms: ['win32', 'darwin'],
|
|
71
76
|
manifest: 'package.json', packageName: '@evomap/stepcode-evolver', entries: ['plugin.mjs'], legacyNames: [],
|
|
72
|
-
instructions: ['Start a new Step Code session. The adapter is
|
|
77
|
+
instructions: ['Start a new Step Code session. The adapter is verified with Step Code CLI 0.1.7 on Windows and macOS; STEP_CODING_AGENT_DIR selects the profile.'],
|
|
73
78
|
},
|
|
74
79
|
{
|
|
75
80
|
id: 'minimax', label: 'MiniMax Code', command: 'mcode', kind: 'script', installer: 'scripts/install-minimax.mjs',
|
|
@@ -118,10 +123,11 @@ export function pluginHostNamed(name) {
|
|
|
118
123
|
function marketplaceInstallSteps({ host, scope, trust }, step) {
|
|
119
124
|
const management = host.management;
|
|
120
125
|
const selector = host.id === 'grok' ? AGENT_PLUGIN_NAME : `${AGENT_PLUGIN_NAME}@${host.marketplace}`;
|
|
126
|
+
const scoped = host.id === 'claude-code' || host.id === 'zcode';
|
|
121
127
|
const install = host.id === 'codex'
|
|
122
128
|
? [management, 'add', selector, '--json']
|
|
123
|
-
: [management, 'install', selector, ...(
|
|
124
|
-
return [step('marketplace', [management, 'marketplace', 'add', AGENT_PLUGIN_REPOSITORY]), step('install', install)];
|
|
129
|
+
: [management, 'install', selector, ...(scoped ? ['--scope', scope, '--json'] : []), ...(host.requiresTrust && trust ? ['--trust'] : [])];
|
|
130
|
+
return [step('marketplace', [management, 'marketplace', 'add', host.marketplaceSource ?? AGENT_PLUGIN_REPOSITORY]), step('install', install)];
|
|
125
131
|
}
|
|
126
132
|
function scriptInstallSteps(host, bundle, step) {
|
|
127
133
|
const installer = { name: 'install', command: 'node', args: [join(dirname(bundle), host.installer), 'install'] };
|
|
@@ -135,12 +141,6 @@ export function pluginInstallSteps(options, bundle = '<release-checkout>/dist')
|
|
|
135
141
|
return marketplaceInstallSteps(options, step);
|
|
136
142
|
if (host.kind === 'script')
|
|
137
143
|
return scriptInstallSteps(host, bundle, step);
|
|
138
|
-
if (host.id === 'zcode') {
|
|
139
|
-
return [
|
|
140
|
-
step('marketplace', ['plugins', 'marketplace', 'add', join(bundle, 'zcode'), '--json']),
|
|
141
|
-
step('install', ['plugins', 'install', `${AGENT_PLUGIN_NAME}@${host.marketplace}`, '--scope', scope, '--json']),
|
|
142
|
-
];
|
|
143
|
-
}
|
|
144
144
|
if (host.id === 'antigravity')
|
|
145
145
|
return [step('install', ['plugin', 'install', `${bundle}/antigravity`])];
|
|
146
146
|
if (host.id === 'opencode')
|
|
@@ -169,7 +169,7 @@ export function pluginRollbackInstructions(options, bundle = '<release-checkout>
|
|
|
169
169
|
if (host.id === 'opencode')
|
|
170
170
|
return [`Remove only this plugin's ${bundle}/opencode/server.mjs and tui.mjs entries from opencode.json and tui.json; preserve neighboring configuration.`];
|
|
171
171
|
if (host.id === 'zcode')
|
|
172
|
-
return [`${cli} plugins uninstall ${AGENT_PLUGIN_NAME}@${host.marketplace} --scope ${scope}`];
|
|
172
|
+
return [`${cli} plugins uninstall ${AGENT_PLUGIN_NAME}@${host.marketplace} --scope ${scope} --keep-data`, `${cli} plugins marketplace remove ${host.marketplace}`];
|
|
173
173
|
if (host.id === 'kimi')
|
|
174
174
|
return [`node ${join(dirname(bundle), host.installer)} remove`];
|
|
175
175
|
if (host.id === 'stepcode')
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PluginInstallOptions, type PluginHost } from './pluginHosts.js';
|
|
2
|
+
import { type ZcodeLocalInstall } from './pluginZcodeMigration.js';
|
|
2
3
|
import { type PluginRuntime } from './pluginRuntime.js';
|
|
3
4
|
export interface InstalledAgentPlugin {
|
|
4
5
|
id: string;
|
|
@@ -16,6 +17,7 @@ export interface PluginInspection {
|
|
|
16
17
|
conflicts: string[];
|
|
17
18
|
/** Native commands the user can run to remove a conflicting standalone plugin; never run automatically. */
|
|
18
19
|
migrations: string[];
|
|
20
|
+
zcodeLocal?: ZcodeLocalInstall;
|
|
19
21
|
}
|
|
20
22
|
export declare function installedPluginsFromJson(value: unknown, host: PluginHost): InstalledAgentPlugin[];
|
|
21
23
|
export declare function verifyPluginManifest(runtime: PluginRuntime, options: PluginInstallOptions, plugin: InstalledAgentPlugin, installAnswer?: unknown): string;
|
package/dist/pluginInspection.js
CHANGED
|
@@ -3,8 +3,8 @@ import { existsSync } from 'node:fs';
|
|
|
3
3
|
import { dirname, join, resolve } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { agentPluginRepositoryMatches, AGENT_PLUGIN_NAME, AGENT_PLUGIN_REPOSITORY, standalonePluginRemoval } from './pluginHosts.js';
|
|
6
|
-
import { isManagedPackedBundle } from './pluginBundle.js';
|
|
7
6
|
import { inspectScriptPlugin, inspectStepCodePlugin } from './pluginLocalInspection.js';
|
|
7
|
+
import { zcodeLocalInstall } from './pluginZcodeMigration.js';
|
|
8
8
|
import { checkedPluginCommand, objectOf, pluginHome, pluginJson, pluginVersionAtLeast, PluginInstallError, readPluginJson, readPluginText } from './pluginRuntime.js';
|
|
9
9
|
function listRecords(value, key, label) {
|
|
10
10
|
const list = Array.isArray(value) ? value : objectOf(value)?.[key];
|
|
@@ -35,13 +35,10 @@ function repositoryOf(record) {
|
|
|
35
35
|
?? objectOf(record['source'])?.['url'] ?? (typeof record['source'] === 'string' ? record['source'] : undefined);
|
|
36
36
|
}
|
|
37
37
|
async function marketplaceMatches(runtime, host, record) {
|
|
38
|
+
if (host.marketplaceSource)
|
|
39
|
+
return objectOf(record['source'])?.['url'] === host.marketplaceSource;
|
|
38
40
|
if (agentPluginRepositoryMatches(repositoryOf(record)))
|
|
39
41
|
return true;
|
|
40
|
-
const source = objectOf(record['source']);
|
|
41
|
-
if (source?.['source'] === 'directory') {
|
|
42
|
-
const folder = stringOf(source['path']);
|
|
43
|
-
return folder !== undefined && isManagedPackedBundle(runtime, host, folder);
|
|
44
|
-
}
|
|
45
42
|
const root = stringOf(record['root']) ?? stringOf(record['installLocation']);
|
|
46
43
|
if (!root)
|
|
47
44
|
return false;
|
|
@@ -94,14 +91,15 @@ async function inspectMarketplacePlugin(runtime, options) {
|
|
|
94
91
|
const market = markets.find(record => record['name'] === host.marketplace);
|
|
95
92
|
const conflicts = oldHookConflicts(runtime, options);
|
|
96
93
|
const migrations = [];
|
|
94
|
+
const zcodeLocal = host.id === 'zcode' ? zcodeLocalInstall(runtime, host, plugins.map(plugin => plugin.id), markets) : undefined;
|
|
97
95
|
if (market && !await marketplaceMatches(runtime, host, market))
|
|
98
|
-
conflicts.push(`Marketplace ${host.marketplace} belongs to another source. Review its plugins before replacing it with ${AGENT_PLUGIN_REPOSITORY}.`);
|
|
96
|
+
conflicts.push(`Marketplace ${host.marketplace} belongs to another source. Review its plugins before replacing it with ${host.marketplaceSource ?? AGENT_PLUGIN_REPOSITORY}.`);
|
|
99
97
|
for (const plugin of plugins) {
|
|
100
98
|
if (host.legacyNames.includes(plugin.name) && plugin.enabled) {
|
|
101
99
|
conflicts.push(`The standalone ${plugin.name} plugin is enabled. Disable/remove it using ${host.label}, keeping its data, before installing ${AGENT_PLUGIN_NAME}.`);
|
|
102
100
|
migrations.push(standalonePluginRemoval(options, plugin));
|
|
103
101
|
}
|
|
104
|
-
if (plugin.name === AGENT_PLUGIN_NAME && plugin.id !== `${AGENT_PLUGIN_NAME}@${host.marketplace}` && !(host.id === 'grok' && plugin.id === AGENT_PLUGIN_NAME))
|
|
102
|
+
if (plugin.name === AGENT_PLUGIN_NAME && plugin.id !== `${AGENT_PLUGIN_NAME}@${host.marketplace}` && plugin.id !== zcodeLocal?.uninstall && !(host.id === 'grok' && plugin.id === AGENT_PLUGIN_NAME))
|
|
105
103
|
conflicts.push('An Evolver plugin from another marketplace is registered; review that installation before continuing.');
|
|
106
104
|
}
|
|
107
105
|
const installed = plugins.find(plugin => (plugin.id === `${AGENT_PLUGIN_NAME}@${host.marketplace}` || (host.id === 'grok' && plugin.id === AGENT_PLUGIN_NAME)) && (host.id !== 'claude-code' || plugin.scope === scope));
|
|
@@ -111,7 +109,7 @@ async function inspectMarketplacePlugin(runtime, options) {
|
|
|
111
109
|
conflicts.push('The plugin is installed but disabled. Enable it explicitly in the host rather than installing another copy.');
|
|
112
110
|
if (installed && host.id === 'codex' && !agentPluginRepositoryMatches(repositoryOf(installed.raw)))
|
|
113
111
|
conflicts.push('The installed plugin source does not match the unified Evolver plugin repository.');
|
|
114
|
-
return { installed, marketplacePresent: Boolean(market), conflicts, migrations };
|
|
112
|
+
return { installed, marketplacePresent: Boolean(market), conflicts, migrations, zcodeLocal };
|
|
115
113
|
}
|
|
116
114
|
export function verifyPluginManifest(runtime, options, plugin, installAnswer) {
|
|
117
115
|
const { host } = options;
|
package/dist/pluginInstall.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PluginCommandStep, type PluginInstallOptions } from './pluginHosts.js';
|
|
2
2
|
import { type PluginInstallStatus, type PluginRuntime } from './pluginRuntime.js';
|
|
3
|
+
import { type ZcodeMigrationReport } from './pluginZcodeMigration.js';
|
|
3
4
|
export interface AgentPluginInstallResult {
|
|
4
5
|
ok: boolean;
|
|
5
6
|
status: PluginInstallStatus;
|
|
@@ -16,5 +17,7 @@ export interface AgentPluginInstallResult {
|
|
|
16
17
|
installedPath?: string;
|
|
17
18
|
error?: string;
|
|
18
19
|
profile?: string;
|
|
20
|
+
migrated?: ZcodeMigrationReport;
|
|
21
|
+
warnings?: string[];
|
|
19
22
|
}
|
|
20
23
|
export declare function installAgentPlugin(runtime: PluginRuntime, options: PluginInstallOptions): Promise<AgentPluginInstallResult>;
|
package/dist/pluginInstall.js
CHANGED
|
@@ -5,6 +5,7 @@ import { inspectAgentPlugin, verifyPluginManifest } from './pluginInspection.js'
|
|
|
5
5
|
import { hostLauncher } from './pluginLauncher.js';
|
|
6
6
|
import { withPluginInstallLock } from './pluginLock.js';
|
|
7
7
|
import { checkedPluginCommand, checkPluginHostVersion, PluginInstallError } from './pluginRuntime.js';
|
|
8
|
+
import { ZCODE_LOCAL_PLUGIN, ZCODE_MIGRATION_PREVIEW, ZCODE_MIGRATION_PREVIEW_NOTE, zcodeKeptMarketplaceWarning, zcodeMigrationPending, zcodeMigrationReport, zcodeMigrationSteps } from './pluginZcodeMigration.js';
|
|
8
9
|
function trustInstruction(host) {
|
|
9
10
|
return `${host.label} asks you to trust a plugin before it installs. Review ${AGENT_PLUGIN_REPOSITORY}, then rerun with --trust: evolver plugin install --host ${host.id} --trust`;
|
|
10
11
|
}
|
|
@@ -19,6 +20,56 @@ function assertNoConflicts(inspection) {
|
|
|
19
20
|
if (inspection.conflicts.length > 0)
|
|
20
21
|
throw new PluginInstallError('conflict', inspection.conflicts.join('\n'), inspection.migrations);
|
|
21
22
|
}
|
|
23
|
+
function dryRunResult(options, result, trustMissing) {
|
|
24
|
+
const { host } = options;
|
|
25
|
+
const zcode = host.id === 'zcode';
|
|
26
|
+
const commands = zcode ? [...zcodeMigrationSteps(options, ZCODE_MIGRATION_PREVIEW), ...result.commands] : result.commands;
|
|
27
|
+
const notes = [...(zcode ? [ZCODE_MIGRATION_PREVIEW_NOTE] : []), ...(trustMissing ? [trustInstruction(host)] : [])];
|
|
28
|
+
return { ...result, ok: true, status: 'dry_run', commands, instructions: [...result.instructions, ...notes, 'Preview only: host version, registration, download and installation have not been executed.'] };
|
|
29
|
+
}
|
|
30
|
+
function alreadyInstalled(runtime, options, result, inspection) {
|
|
31
|
+
if (!inspection.installed || zcodeMigrationPending(inspection.zcodeLocal))
|
|
32
|
+
return undefined;
|
|
33
|
+
const installedPath = verifyPluginManifest(runtime, options, inspection.installed);
|
|
34
|
+
const warnings = zcodeKeptMarketplaceWarning(inspection.zcodeLocal);
|
|
35
|
+
return { ...result, ok: true, status: 'already_installed', verified: true, version: inspection.installed.version, installedPath, commands: [], ...(warnings.length > 0 && { warnings }) };
|
|
36
|
+
}
|
|
37
|
+
function plannedCommands(options, inspection, install) {
|
|
38
|
+
if (!zcodeMigrationPending(inspection.zcodeLocal))
|
|
39
|
+
return install;
|
|
40
|
+
return [...zcodeMigrationSteps(options, inspection.zcodeLocal), ...(inspection.installed ? [] : install)];
|
|
41
|
+
}
|
|
42
|
+
async function runPlannedCommands(runtime, options, result, inspection, bundle) {
|
|
43
|
+
let installAnswer;
|
|
44
|
+
for (const step of result.commands) {
|
|
45
|
+
if (step.name === 'marketplace' && inspection.marketplacePresent)
|
|
46
|
+
continue;
|
|
47
|
+
const executed = await checkedPluginCommand(runtime, step.command, step.args, options.root, 120_000);
|
|
48
|
+
result.completed.push(step.name);
|
|
49
|
+
if (step.name === 'marketplace') {
|
|
50
|
+
const registered = await inspectAgentPlugin(runtime, options, bundle);
|
|
51
|
+
if (!registered.marketplacePresent || registered.conflicts.length > 0) {
|
|
52
|
+
throw new PluginInstallError('conflict', 'The registered marketplace could not be confirmed as the unified plugin source. No plugin install was attempted.');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else if (step.name === 'install') {
|
|
56
|
+
try {
|
|
57
|
+
installAnswer = JSON.parse(executed.stdout);
|
|
58
|
+
}
|
|
59
|
+
catch { /* Some native installers report human-readable progress; the final inventory is authoritative. */ }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return installAnswer;
|
|
63
|
+
}
|
|
64
|
+
function failureNotes(completed) {
|
|
65
|
+
if (completed.length === 0)
|
|
66
|
+
return [];
|
|
67
|
+
const removed = completed.includes('uninstall-local') ? `Only the ${ZCODE_LOCAL_PLUGIN} steps in completed removed anything; no other` : 'No existing';
|
|
68
|
+
return [
|
|
69
|
+
`Commands already completed: ${completed.join(', ')}. Inspect the selected host before retrying.`,
|
|
70
|
+
`${removed} plugin, user data or marketplace was automatically removed. Use the rollback instructions only after checking the current host registration.`,
|
|
71
|
+
];
|
|
72
|
+
}
|
|
22
73
|
function migrationInstructions(error) {
|
|
23
74
|
if (!(error instanceof PluginInstallError) || error.instructions.length === 0)
|
|
24
75
|
return [];
|
|
@@ -40,9 +91,8 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
40
91
|
return { ...result, status: 'manual_required', instructions: [...instructions, `Requested scope: ${options.scope}. No client configuration was changed.`] };
|
|
41
92
|
}
|
|
42
93
|
const trustMissing = host.requiresTrust && !options.trust;
|
|
43
|
-
if (options.dryRun)
|
|
44
|
-
return
|
|
45
|
-
}
|
|
94
|
+
if (options.dryRun)
|
|
95
|
+
return dryRunResult(options, result, trustMissing);
|
|
46
96
|
if (trustMissing) {
|
|
47
97
|
return { ...result, status: 'trust_required', error: `${host.label} installs plugin hooks, MCP servers and skills only after you trust the plugin. No host command was run.`, instructions: [trustInstruction(host)] };
|
|
48
98
|
}
|
|
@@ -51,46 +101,32 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
51
101
|
let bundle = host.kind === 'script' ? await useReleaseCheckout(runtime, options, result) : undefined;
|
|
52
102
|
let inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
53
103
|
assertNoConflicts(inspection);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
}
|
|
104
|
+
const settled = alreadyInstalled(runtime, options, result, inspection);
|
|
105
|
+
if (settled)
|
|
106
|
+
return settled;
|
|
58
107
|
return await withPluginInstallLock(runtime, options, async () => {
|
|
59
108
|
inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
60
109
|
assertNoConflicts(inspection);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
}
|
|
110
|
+
const settledInLock = alreadyInstalled(runtime, options, result, inspection);
|
|
111
|
+
if (settledInLock)
|
|
112
|
+
return settledInLock;
|
|
65
113
|
if (host.id === 'dsh')
|
|
66
114
|
await assertDshProfileStoreMatches(runtime, options);
|
|
67
115
|
if (host.kind === 'bundle')
|
|
68
116
|
bundle = await useReleaseCheckout(runtime, options, result);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
continue;
|
|
73
|
-
const executed = await checkedPluginCommand(runtime, step.command, step.args, options.root, 120_000);
|
|
74
|
-
result.completed.push(step.name);
|
|
75
|
-
if (step.name === 'marketplace') {
|
|
76
|
-
inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
77
|
-
if (!inspection.marketplacePresent || inspection.conflicts.length > 0) {
|
|
78
|
-
throw new PluginInstallError('conflict', 'The registered marketplace could not be confirmed as the unified plugin source. No plugin install was attempted.');
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
try {
|
|
83
|
-
installAnswer = JSON.parse(executed.stdout);
|
|
84
|
-
}
|
|
85
|
-
catch { /* Some native installers report human-readable progress; the final inventory is authoritative. */ }
|
|
86
|
-
}
|
|
87
|
-
}
|
|
117
|
+
const local = inspection.zcodeLocal;
|
|
118
|
+
result.commands = plannedCommands(options, inspection, result.commands);
|
|
119
|
+
const installAnswer = await runPlannedCommands(runtime, options, result, inspection, bundle);
|
|
88
120
|
inspection = await inspectAgentPlugin(runtime, options, bundle);
|
|
89
121
|
assertNoConflicts(inspection);
|
|
90
122
|
if (!inspection.installed)
|
|
91
123
|
throw new PluginInstallError('failed', `The ${AGENT_PLUGIN_NAME} command completed, but the selected host/scope did not register it. Installation was not confirmed.`);
|
|
92
124
|
const installedPath = verifyPluginManifest(runtime, options, inspection.installed, installAnswer);
|
|
93
|
-
|
|
125
|
+
const warnings = zcodeKeptMarketplaceWarning(local);
|
|
126
|
+
return {
|
|
127
|
+
...result, ok: true, status: result.completed.includes('install') ? 'installed' : 'already_installed', verified: true, version: inspection.installed.version, installedPath,
|
|
128
|
+
...zcodeMigrationReport(local, result.completed), ...(warnings.length > 0 && { warnings }),
|
|
129
|
+
};
|
|
94
130
|
});
|
|
95
131
|
}
|
|
96
132
|
catch (error) {
|
|
@@ -98,10 +134,7 @@ export async function installAgentPlugin(runtime, options) {
|
|
|
98
134
|
...result,
|
|
99
135
|
status: error instanceof PluginInstallError ? error.status : 'failed',
|
|
100
136
|
error: error instanceof PluginInstallError ? error.message : 'The plugin operation failed; no verified installation was reported.',
|
|
101
|
-
instructions: [...result.instructions, ...migrationInstructions(error), ...(result.completed
|
|
102
|
-
`Commands already completed: ${result.completed.join(', ')}. Inspect the selected host before retrying.`,
|
|
103
|
-
'No existing plugin, user data or marketplace was automatically removed. Use the rollback instructions only after checking the current host registration.',
|
|
104
|
-
] : [])],
|
|
137
|
+
instructions: [...result.instructions, ...migrationInstructions(error), ...failureNotes(result.completed)],
|
|
105
138
|
};
|
|
106
139
|
}
|
|
107
140
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type PluginCommandStep, type PluginHost, type PluginInstallOptions } from './pluginHosts.js';
|
|
2
|
+
import { type PluginRuntime } from './pluginRuntime.js';
|
|
3
|
+
export declare const ZCODE_LOCAL_PLUGIN = "evolver-plugin@evolver-zcode-local";
|
|
4
|
+
/** A ZCode local-folder install of this plugin, which would run the same hooks as the evomap install. */
|
|
5
|
+
export interface ZcodeLocalInstall {
|
|
6
|
+
uninstall?: string;
|
|
7
|
+
removeMarketplace?: string;
|
|
8
|
+
keptMarketplace?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ZcodeMigrationReport {
|
|
11
|
+
uninstalled?: string;
|
|
12
|
+
removedMarketplace?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function zcodeLocalInstall(runtime: PluginRuntime, host: PluginHost, pluginIds: readonly string[], markets: readonly Record<string, unknown>[]): ZcodeLocalInstall | undefined;
|
|
15
|
+
export declare const zcodeMigrationPending: (local: ZcodeLocalInstall | undefined) => boolean;
|
|
16
|
+
export declare function zcodeMigrationSteps(options: PluginInstallOptions, local: ZcodeLocalInstall): PluginCommandStep[];
|
|
17
|
+
export declare const ZCODE_MIGRATION_PREVIEW: ZcodeLocalInstall;
|
|
18
|
+
export declare const ZCODE_MIGRATION_PREVIEW_NOTE = "uninstall-local and remove-local-marketplace run only when evolver-plugin@evolver-zcode-local is installed or its marketplace points into Evolver's release cache.";
|
|
19
|
+
export declare function zcodeMigrationReport(local: ZcodeLocalInstall | undefined, completed: readonly string[]): {
|
|
20
|
+
migrated?: ZcodeMigrationReport;
|
|
21
|
+
};
|
|
22
|
+
export declare function zcodeKeptMarketplaceWarning(local: ZcodeLocalInstall | undefined): string[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isManagedPackedBundle } from './pluginBundle.js';
|
|
2
|
+
import { AGENT_PLUGIN_NAME, ZCODE_LOCAL_MARKETPLACE } from './pluginHosts.js';
|
|
3
|
+
import { objectOf } from './pluginRuntime.js';
|
|
4
|
+
export const ZCODE_LOCAL_PLUGIN = `${AGENT_PLUGIN_NAME}@${ZCODE_LOCAL_MARKETPLACE}`;
|
|
5
|
+
function ownsLocalMarketplace(runtime, host, record) {
|
|
6
|
+
const source = objectOf(record['source']);
|
|
7
|
+
const folder = source?.['source'] === 'directory' ? source['path'] : undefined;
|
|
8
|
+
return typeof folder === 'string' && isManagedPackedBundle(runtime, host, folder);
|
|
9
|
+
}
|
|
10
|
+
export function zcodeLocalInstall(runtime, host, pluginIds, markets) {
|
|
11
|
+
const installed = pluginIds.includes(ZCODE_LOCAL_PLUGIN);
|
|
12
|
+
const market = markets.find(record => record['name'] === ZCODE_LOCAL_MARKETPLACE);
|
|
13
|
+
if (!installed && !market)
|
|
14
|
+
return undefined;
|
|
15
|
+
const marketplace = market && (ownsLocalMarketplace(runtime, host, market) ? { removeMarketplace: ZCODE_LOCAL_MARKETPLACE } : { keptMarketplace: ZCODE_LOCAL_MARKETPLACE });
|
|
16
|
+
return { ...(installed && { uninstall: ZCODE_LOCAL_PLUGIN }), ...marketplace };
|
|
17
|
+
}
|
|
18
|
+
export const zcodeMigrationPending = (local) => Boolean(local?.uninstall || local?.removeMarketplace);
|
|
19
|
+
export function zcodeMigrationSteps(options, local) {
|
|
20
|
+
const [command = '', ...prefix] = options.launcher;
|
|
21
|
+
const step = (name, args) => ({ name, command, args: [...prefix, ...args] });
|
|
22
|
+
return [
|
|
23
|
+
...(local.uninstall ? [step('uninstall-local', ['plugins', 'uninstall', local.uninstall, '--scope', options.scope, '--keep-data', '--force', '--json'])] : []),
|
|
24
|
+
...(local.removeMarketplace ? [step('remove-local-marketplace', ['plugins', 'marketplace', 'remove', local.removeMarketplace, '--json'])] : []),
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
export const ZCODE_MIGRATION_PREVIEW = { uninstall: ZCODE_LOCAL_PLUGIN, removeMarketplace: ZCODE_LOCAL_MARKETPLACE };
|
|
28
|
+
export const ZCODE_MIGRATION_PREVIEW_NOTE = `uninstall-local and remove-local-marketplace run only when ${ZCODE_LOCAL_PLUGIN} is installed or its marketplace points into Evolver's release cache.`;
|
|
29
|
+
export function zcodeMigrationReport(local, completed) {
|
|
30
|
+
const migrated = {
|
|
31
|
+
...(completed.includes('uninstall-local') && { uninstalled: local?.uninstall }),
|
|
32
|
+
...(completed.includes('remove-local-marketplace') && { removedMarketplace: local?.removeMarketplace }),
|
|
33
|
+
};
|
|
34
|
+
return Object.keys(migrated).length > 0 ? { migrated } : {};
|
|
35
|
+
}
|
|
36
|
+
export function zcodeKeptMarketplaceWarning(local) {
|
|
37
|
+
if (!local?.keptMarketplace)
|
|
38
|
+
return [];
|
|
39
|
+
return [`Marketplace ${local.keptMarketplace} points at a folder Evolver does not manage, so it stays registered. Do not install ${AGENT_PLUGIN_NAME} from it as well: both copies would run the same hooks.`];
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.53",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@evomap/evolver-core": "2.0.
|
|
31
|
-
"@evomap/evolver-adapter-public": "2.0.
|
|
32
|
-
"@evomap/evolver-mcp": "2.0.
|
|
33
|
-
"@evomap/evolver-proxy": "2.0.
|
|
34
|
-
"@evomap/evolver-runtime-adapters": "2.0.
|
|
35
|
-
"@evomap/evolver-webui": "2.0.
|
|
30
|
+
"@evomap/evolver-core": "2.0.53",
|
|
31
|
+
"@evomap/evolver-adapter-public": "2.0.53",
|
|
32
|
+
"@evomap/evolver-mcp": "2.0.53",
|
|
33
|
+
"@evomap/evolver-proxy": "2.0.53",
|
|
34
|
+
"@evomap/evolver-runtime-adapters": "2.0.53",
|
|
35
|
+
"@evomap/evolver-webui": "2.0.53"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|