@mindmux/cli 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,10 +39,13 @@ Want a local Brain without Cloud login? Run `mmx setup --local` instead.
39
39
  | --- | --- |
40
40
  | `mmx` | Open the interactive menu |
41
41
  | `mmx status --online` | Check the connection |
42
+ | `mmx update` | Upgrade the CLI and refresh managed integrations |
42
43
  | `mmx doctor --fix` | Diagnose and repair setup |
43
44
  | `mmx switch` | Choose another Brain |
44
45
  | `mmx --help` | Show command help |
45
46
 
47
+ Run `mmx update --help` for upgrade instructions, including agent automation and manual npm/pnpm upgrades. Restart affected agents after an update. See [upgrade details](docs/installation.md#update).
48
+
46
49
  To start setup again, `mmx clean` resets local integration, binding, local Brain data and CLI login after confirmation. **Cloud data is kept.** Use `mmx clean --keep-login` to stay signed in. See [cleanup details](docs/setup.md#reset-for-testing).
47
50
 
48
51
  ## Documentation
@@ -12,6 +12,21 @@ Instructions for an agent installing MindMux in the user's current project. The
12
12
  4. For a new installation, use `npm install -g @mindmux/cli@latest` or `pnpm add -g @mindmux/cli@latest`. Do not install a project dependency or use a temporary `npx` installation: generated launchers need a persistent executable path. Do not use `sudo` automatically. Resolve missing global bin/PATH configuration before continuing.
13
13
  5. An older installation without the protocol below needs an upgrade through its existing package manager. Newer installations can use `mmx update`.
14
14
 
15
+ ## Upgrade an existing installation
16
+
17
+ Read `mmx update --help` before upgrading. In the intended project:
18
+
19
+ ```sh
20
+ mmx update --check --json
21
+ mmx update --yes --json
22
+ ```
23
+
24
+ Use `--yes --json` for agent-driven upgrades; `-agent` is a setup shortcut, not an update shortcut. Inspect `status`, `warnings` and per-project refresh results. An updated package with failed integration refresh is partial completion. Already-current releases still refresh recorded integrations. Do not run `clean` or switch Brain bindings as an upgrade step.
25
+
26
+ For a version without `update`, use its original installer (`npm install -g @mindmux/cli@latest` or `pnpm add -g @mindmux/cli@latest`), then run `mmx update --refresh-integrations`. For mise or source installations, retain that installation workflow and run the same refresh afterwards. Never install a second global copy to bypass installer detection or use `sudo` automatically.
27
+
28
+ Verify `mmx --version` and `mmx doctor --online`, report any remaining warnings, and ask the user to restart affected agents and review changed hook trust prompts. These checks do not prove the running host loaded the new tools or executed hooks.
29
+
15
30
  ## Drive setup without a terminal menu
16
31
 
17
32
  Run commands in the intended project (or provide an explicit `--project PATH`). Start with:
package/docs/agents.md CHANGED
@@ -40,6 +40,8 @@ Review tokens expire after 24 hours and are invalidated when the active turn or
40
40
 
41
41
  Upgrade existing Codex installations with `mmx connect --agent codex` or `mmx doctor --fix`, restart Codex and review `/hooks`. The managed installation also handles interruption to invalidate the active review. Claude Code and Cursor retain their existing Stop behavior.
42
42
 
43
+ Codex Interrupt handlers use a three-second timeout to match the host limit; other managed Codex and Claude Code handlers retain ten seconds. Existing configurations can be refreshed with `mmx update --refresh-integrations`, then restart Codex and review `/hooks`. See the [official hook limits](https://learn.chatgpt.com/docs/hooks#interrupt).
44
+
43
45
  `doctor` checks files, executable paths, and recent hook receipts:
44
46
 
45
47
  - `retrieved`: retrieval completed, awaiting delivery.
@@ -47,6 +47,7 @@ mmx setup
47
47
  mmx update # Check, confirm with an arrow-key menu, and upgrade.
48
48
  mmx update --check # Check the latest stable release without installing.
49
49
  mmx update --yes # Upgrade without a confirmation prompt.
50
+ mmx update --all-projects # Explicit alias: updates already refresh recorded projects.
50
51
  mmx update --check --json
51
52
  ```
52
53
 
@@ -54,7 +55,9 @@ Interactive menu, `setup`, `status` and `doctor` commands show a notice when a n
54
55
 
55
56
  `update` compares the running package with npm/pnpm global roots, then uses its owning manager to install the exact checked version from the official npm registry. It does not switch managers, downgrade, use `sudo`, modify a source checkout, or update a project dependency. If both managers own the same path, select `--manager npm` or `--manager pnpm`; an unrelated manager is never accepted. An unavailable/unrecognized installer produces manual-update guidance instead of installing a second copy.
56
57
 
57
- After installation, it verifies the new CLI version and runs the new CLI to refresh this project's existing managed MCP launchers, instructions and hooks. This refresh backs up configuration, preserves foreign entries, login, Brain binding and data, and does not contact Cloud or request browser authorization. A refresh failure is reported separately from a successful package installation; use `mmx doctor --fix` or `mmx setup` to resolve it. Restart the agent/MCP service afterwards. Other connected projects may need the same repair if their absolute paths or instructions are stale; they are not silently rewritten.
58
+ After installation, it verifies the new CLI version and runs the new CLI to refresh recorded projects’ existing managed MCP launchers, instructions and hooks. This refresh backs up configuration, preserves foreign entries, login, Brain binding and data, and does not contact Cloud or request browser authorization. A refresh failure is reported separately from a successful package installation; use `mmx doctor --fix` or `mmx setup` to resolve it. Restart the agent/MCP service afterwards. By default the current project and existing managed projects identified from this CLI home's configuration backups are refreshed. `--all-projects` remains an explicit alias for this default. Each project is backed up and refreshed independently; a conflict is reported without overwriting unrelated configuration or preventing other projects from being refreshed. Deleted, disconnected or unsafe projects are skipped. The CLI does not scan the filesystem for projects; connect-only projects without backups must be refreshed explicitly from their directory.
59
+
60
+ When the running CLI is already at or above the latest registry version, `mmx update` still refreshes owned project connections using that running CLI without reinstalling or requiring npm/pnpm ownership detection. This repairs stale paths after an external npm, pnpm or mise upgrade. `--check` stays read-only and never refreshes files. A new package version still requires a supported owning installer; mise-managed packages may require upgrading through mise first.
58
61
 
59
62
  For older CLI versions without `update`, or for a manual upgrade:
60
63
 
@@ -64,7 +67,7 @@ npm install -g @mindmux/cli@latest
64
67
  pnpm add -g @mindmux/cli@latest
65
68
  ```
66
69
 
67
- Then rerun `mmx setup` in each connected project and restart the agent. The new update mechanism becomes available after the first manual upgrade to a release containing it. `mmx update --refresh-integrations` can also refresh only the current project's owned configuration offline, without checking or installing a release.
70
+ Then run `mmx update` to refresh the current and recorded projects and restart the affected agents. Older CLI versions may still require `mmx setup` after a manual upgrade. The new update mechanism becomes available after the first manual upgrade to a release containing it. `mmx update --refresh-integrations` refreshes the current and recorded projects offline, without checking or installing a release. This default also applies when an older updater invokes the new CLI without `--all-projects`, so the first upgrade to this release refreshes recorded projects too. These commands do not change installation managers, sign in, change Brain bindings or write Brain content.
68
71
 
69
72
  ## Install from source
70
73
 
@@ -108,4 +111,4 @@ The old `bin/mindmux.mjs` script remains as a compatibility entry point for exis
108
111
  node scripts/verify-update.mjs npm pnpm
109
112
  ```
110
113
 
111
- This creates synthetic old/new package tarballs and isolated temporary global roots, then verifies version changes and refreshed launcher paths, including pnpm's versioned directories. It uses the network for public dependencies and prints the temporary report location. It does not update your actual CLI installation or touch existing projects. Pass only `npm` or `pnpm` to test one manager.
114
+ This creates synthetic old/new package tarballs and isolated temporary global roots, then verifies version changes and refreshed launcher paths in two projects for both Codex and Claude Code, including pnpm's versioned directories. It removes the retired package directory when the path changes and executes every managed hook with a minimal PATH. It uses the network for public dependencies and prints the temporary report location. It does not update your actual CLI installation or touch existing projects. Pass only `npm` or `pnpm` to test one manager.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindmux/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Brain operations and lifecycle integrations for coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -19,7 +19,8 @@ Setup:
19
19
  mmx setup -agent resumable Agent setup (alias: --non-interactive --json)
20
20
  mmx login --non-interactive --json start/reuse background browser authorization
21
21
  mmx login --status check --non-interactive --json inspect background authorization
22
- mmx update [--check] [--yes] [--json] check for releases or upgrade this global installation
22
+ mmx update [--check] [--yes] [--json] upgrade and refresh all recorded managed projects
23
+ mmx update --help show upgrade, Agent and manual recovery instructions
23
24
  mmx status [--online] [--json] show configuration and observed activity
24
25
  mmx switch [--brain-id ID | --local] choose another Brain; keep login and data
25
26
  mmx clean [--keep-login] [--yes] reset local setup and data; keep Cloud data
@@ -64,6 +65,38 @@ Cursor: startup context + prompt retrieval delivered at first tool call; one sto
64
65
  Claude Code: startup + prompt context; one stop review. Codex: pre-answer review; Stop recovers a missing review once.
65
66
  `;
66
67
 
68
+ const UPDATE_HELP = `mmx update — upgrade MindMux CLI and refresh managed integrations
69
+
70
+ Run from a connected project, or pass --project PATH:
71
+ mmx update check, confirm and upgrade with the owning npm/pnpm installer
72
+ mmx update --check check only; never install or change project files
73
+ mmx update --check --json machine-readable release check for agents
74
+ mmx update --yes --json upgrade without a terminal prompt; inspect warnings and refresh results
75
+ mmx update --refresh-integrations refresh offline using this CLI; do not install or check a release
76
+ mmx update --all-projects explicit alias for the default recorded-project refresh scope
77
+ mmx update --manager npm|pnpm select an installer only if it owns this installation
78
+
79
+ Updates refresh Hook commands, MCP launchers and project instructions in the current
80
+ and recorded managed projects, even when this CLI is already current. Unrecorded
81
+ projects need the refresh command from their own directory. Partial failures are
82
+ reported per project; package installation alone does not prove integrations work.
83
+ Login, Brain bindings and Brain data are preserved. No setup or clean is needed.
84
+
85
+ Older releases without update, or manual upgrades (use the original installer):
86
+ npm install -g @mindmux/cli@latest
87
+ # Or: pnpm add -g @mindmux/cli@latest
88
+ mmx update --refresh-integrations
89
+
90
+ For mise or source installations, upgrade through the original installation workflow,
91
+ then run mmx update --refresh-integrations. Do not install a second global copy.
92
+ Do not use sudo automatically or replace a source checkout with a registry package.
93
+
94
+ After upgrading, restart affected agents/MCP services and review any changed hook
95
+ trust prompts. Run mmx --version and mmx doctor --online in the intended project.
96
+ Agents: inspect warnings and each project's refresh result before reporting success;
97
+ configuration checks do not prove that a running agent loaded or executed its hooks.
98
+ `;
99
+
67
100
  async function stdin(limit = 1024 * 1024) {
68
101
  if (process.stdin.isTTY) throw new Error('Pipe content through stdin.');
69
102
  let value = '';
@@ -83,7 +116,7 @@ function cloudVersion(value) {
83
116
 
84
117
  export async function main(argv = process.argv.slice(2)) {
85
118
  const options = Object.fromEntries(['project', 'agent', 'brain-id', 'server', 'workspace-id', 'name', 'description', 'id', 'title', 'category', 'status', 'source', 'expected-version', 'change-kind', 'summary', 'kind', 'args', 'review-token', 'outcome', 'reason', 'manager'].map(key => [key, { type: 'string' }]));
86
- for (const key of ['local', 'online', 'no-open', 'confirm', 'help', 'version', 'yes', 'migrate', 'json', 'keep-login', 'include-external-data', 'fix', 'check', 'refresh-integrations', 'non-interactive']) options[key] = { type: 'boolean' };
119
+ for (const key of ['local', 'online', 'no-open', 'confirm', 'help', 'version', 'yes', 'migrate', 'json', 'keep-login', 'include-external-data', 'fix', 'check', 'refresh-integrations', 'all-projects', 'non-interactive']) options[key] = { type: 'boolean' };
87
120
  // -agent is an exact single-dash alias, distinct from --agent NAME.
88
121
  // Do not rewrite option values or positional content after --.
89
122
  const args = [];
@@ -96,6 +129,7 @@ export async function main(argv = process.argv.slice(2)) {
96
129
  const { values: flags, positionals: pos } = parseArgs({ args, options, allowPositionals: true, strict: true });
97
130
  if (flags['non-interactive']) flags.json = true;
98
131
  if (flags.version) { console.log(VERSION); return; }
132
+ if ((flags.help && pos[0] === 'update') || (pos[0] === 'help' && pos[1] === 'update')) { console.log(UPDATE_HELP); return; }
99
133
  if (flags.help || pos[0] === 'help' || (!pos.length && (!process.stdin.isTTY || !process.stderr.isTTY || flags.json || flags.yes))) { console.log(HELP); return; }
100
134
  const root = realpathSync(flags.project ? resolve(flags.project) : projectRoot());
101
135
  process.chdir(root);
@@ -115,10 +149,15 @@ export async function main(argv = process.argv.slice(2)) {
115
149
  if (action || rest.length) throw new Error('Run mmx update [--check] [--yes] [--json] [--manager npm|pnpm].');
116
150
  if (flags['refresh-integrations']) {
117
151
  if (flags.check || flags.manager) throw new Error('Integration refresh cannot be combined with update selection flags.');
118
- const { refreshIntegrations } = await import('./setup.mjs');
119
- const result = await refreshIntegrations(root);
152
+ // Older updaters call this entry without --all-projects after installing a release.
153
+ // Default to the full recorded scope so their first upgrade also repairs other projects.
154
+ const result = await (await import('./update-projects.mjs')).refreshUpdateProjects(root, { allProjects: true });
120
155
  if (flags.json) output(result);
121
- else console.log(result.refreshed ? 'Managed integrations refreshed. Restart your agent.' : 'No managed integrations in this project.');
156
+ else {
157
+ console.log(result.refreshed ? 'Managed integrations refreshed. Restart your agent.' : 'No managed integrations found.');
158
+ for (const project of result.projects || []) console.log(`${project.refreshed ? '✓' : '•'} ${project.project}${project.error ? `: ${project.error}` : ''}`);
159
+ for (const warning of result.warnings || []) console.error(`Warning: ${warning}`);
160
+ }
122
161
  return;
123
162
  }
124
163
  const { update, formatUpdate } = await import('./update.mjs');
@@ -42,7 +42,8 @@ function definitions(root, agent, { home = homeDir(), node = process.execPath, b
42
42
  if (agent === 'claude-code' || agent === 'codex') return Object.fromEntries([
43
43
  ['SessionStart', 'session-start'], ['UserPromptSubmit', 'prompt'], ['Stop', 'stop'], ...(agent === 'codex' ? [['Interrupt', 'interrupt']] : []),
44
44
  ].map(([event, operation]) => [event, [{ hooks: [{
45
- type: 'command', command: `${prefix} ${operation}`, timeout: 10,
45
+ // Codex caps Interrupt hooks at three seconds, including background hooks.
46
+ type: 'command', command: `${prefix} ${operation}`, timeout: agent === 'codex' && event === 'Interrupt' ? 3 : 10,
46
47
  // Codex also uses statusMessage as the handler title in /hooks.
47
48
  ...(agent === 'codex' ? { statusMessage: CODEX_STATUS_MESSAGES[event] } : {}),
48
49
  ...(agent === 'codex' && ['SessionStart', 'UserPromptSubmit'].includes(event) ? { additionalContextLimit: 10000 } : {}),
package/src/setup.mjs CHANGED
@@ -62,7 +62,7 @@ function restore(files) {
62
62
  }
63
63
  async function transaction(root, files, run) {
64
64
  const backup = join(homeDir(), 'backups', createHash('sha256').update(root).digest('hex'), `${Date.now()}-${randomUUID()}.json`);
65
- writeJson(backup, { createdAt: new Date().toISOString(), files });
65
+ writeJson(backup, { project: root, createdAt: new Date().toISOString(), files });
66
66
  const interrupted = () => {
67
67
  try { restore(files); } catch (error) { console.error(`Interrupted setup rollback failed: ${error.message}. Backup: ${backup}`); }
68
68
  };
@@ -0,0 +1,60 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { existsSync, lstatSync, readdirSync, realpathSync } from 'node:fs';
3
+ import { dirname, isAbsolute, join } from 'node:path';
4
+ import { homeDir, readJson } from './storage.mjs';
5
+ import { guardPath } from './host-config.mjs';
6
+
7
+ // Recover only previously configured projects from this CLI home's own backups.
8
+ // Never scan arbitrary user directories or restore old backup contents.
9
+ export function updateProjects(root, { allProjects = false, home = homeDir() } = {}) {
10
+ const projects = [realpathSync(root)], warnings = [];
11
+ if (!allProjects) return { projects, warnings };
12
+ const backups = join(home, 'backups');
13
+ if (!existsSync(backups)) return { projects, warnings };
14
+ if (lstatSync(backups).isSymbolicLink()) throw new Error(`Refusing backup directory symlink: ${backups}`);
15
+ for (const hash of readdirSync(backups).sort()) {
16
+ if (!/^[a-f0-9]{64}$/.test(hash)) continue;
17
+ const dir = join(backups, hash);
18
+ if (lstatSync(dir).isSymbolicLink() || !lstatSync(dir).isDirectory()) continue;
19
+ const files = readdirSync(dir).filter(name => name.endsWith('.json')).sort().reverse();
20
+ let known;
21
+ for (const name of files) {
22
+ const path = join(dir, name);
23
+ if (lstatSync(path).isSymbolicLink() || !lstatSync(path).isFile()) continue;
24
+ try {
25
+ const backup = readJson(path, {});
26
+ const record = backup.files?.find(file => typeof file.path === 'string' && file.path.endsWith('/.mindmux/cli/setup.json'));
27
+ const candidate = backup.project || (record && dirname(dirname(dirname(record.path))));
28
+ if (typeof candidate !== 'string' || !isAbsolute(candidate) || createHash('sha256').update(candidate).digest('hex') !== hash) continue;
29
+ known = candidate; break;
30
+ } catch { /* An older valid backup can still identify this project. */ }
31
+ }
32
+ if (!known) { warnings.push(`Could not identify the project for backup ${hash}; it was not refreshed.`); continue; }
33
+ if (projects.includes(known)) continue;
34
+ if (!existsSync(known)) { warnings.push(`Recorded project no longer exists: ${known}. Skipped.`); continue; }
35
+ try {
36
+ if (realpathSync(known) !== known) throw new Error('Project path now resolves through a symlink.');
37
+ const setup = join(known, '.mindmux/cli/setup.json'), integrations = join(known, '.mindmux/cli/integrations.json');
38
+ guardPath(known, setup); guardPath(known, integrations);
39
+ const agents = [...Object.keys(readJson(setup, {}).agents || {}), ...Object.keys(readJson(integrations, {}))];
40
+ if (agents.length) projects.push(known);
41
+ } catch (error) { warnings.push(`Cannot inspect recorded project ${known}: ${error.message}`); }
42
+ }
43
+ return { projects, warnings };
44
+ }
45
+
46
+ export async function refreshUpdateProjects(root, options = {}, dependencies = {}) {
47
+ const plan = options.plan || updateProjects(root, options);
48
+ const refresh = dependencies.refresh || (await import('./setup.mjs')).refreshIntegrations;
49
+ const projects = [], warnings = [...plan.warnings];
50
+ for (const project of plan.projects) {
51
+ try {
52
+ const result = await refresh(project);
53
+ projects.push({ project, ...result });
54
+ } catch (error) {
55
+ projects.push({ project, refreshed: false, error: error.message });
56
+ warnings.push(`Project connections could not be refreshed in ${project}: ${error.message}. Run mmx doctor --fix in that project.`);
57
+ }
58
+ }
59
+ return { refreshed: projects.some(project => project.refreshed), projects, warnings };
60
+ }
package/src/update.mjs CHANGED
@@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url';
6
6
  import { homedir } from 'node:os';
7
7
  import semver from 'semver';
8
8
  import { homeDir, readJson, writeJson } from './storage.mjs';
9
+ import { updateProjects, refreshUpdateProjects } from './update-projects.mjs';
9
10
  import { VERSION } from './version.mjs';
10
11
  import { createSetupPrompts } from './prompts.mjs';
11
12
 
@@ -84,14 +85,24 @@ export async function update(root, flags = {}, dependencies = {}) {
84
85
  const current = dependencies.current || VERSION;
85
86
  const report = await (dependencies.check || checkUpdate)({ force: true, current });
86
87
  if (flags.check) return { ...report, status: report.available ? 'available' : 'current' };
87
- if (!report.available) return { ...report, status: 'current' };
88
+ if (!report.available) {
89
+ const lock = join(dependencies.home || homeDir(), 'update.lock');
90
+ mkdirSync(dirname(lock), { recursive: true, mode: 0o700 });
91
+ try { mkdirSync(lock); } catch { throw new Error('Another update is active. Wait for it to finish before refreshing connections.'); }
92
+ try {
93
+ const refresh = await (dependencies.refresh || refreshUpdateProjects)(root, { allProjects: true, home: dependencies.home || homeDir() });
94
+ return { ...report, status: 'current', refresh, warnings: refresh.warnings || [],
95
+ next: refresh.refreshed ? 'Restart your agent/MCP service to load refreshed connections.' : 'No managed connections were refreshed.' };
96
+ } finally { rmSync(lock, { recursive: true, force: true }); }
97
+ }
88
98
  if (!semver.satisfies(process.versions.node, report.node)) throw new Error(`MindMux ${report.latest} requires Node.js ${report.node}. Upgrade Node.js first.`);
89
99
  const installation = await (dependencies.detect || detectInstallation)({ run, manager: flags.manager });
90
100
  if (installation.kind !== 'global') return { ...report, status: 'manual', installation,
91
101
  message: installation.kind === 'source' ? 'Source installation detected. Update your checkout and reinstall using your original source-install workflow; local changes were not modified.' : installation.reason };
102
+ const plan = (dependencies.projects || updateProjects)(root, { allProjects: true, home: dependencies.home || homeDir() });
92
103
  if (!flags.yes) {
93
104
  if (!dependencies.prompts && !(process.stdin.isTTY && process.stderr.isTTY)) throw new Error('Run mmx update in an interactive terminal, or pass --yes.');
94
- const confirmed = await (dependencies.prompts || createSetupPrompts()).confirm(`Update MindMux ${current} → ${report.latest} using ${installation.manager}? Refresh this project’s managed connections afterwards.`);
105
+ const confirmed = await (dependencies.prompts || createSetupPrompts()).confirm(`Update MindMux ${current} → ${report.latest} using ${installation.manager}? Refresh managed connections afterwards in:\n${plan.projects.join('\n')}`);
95
106
  if (!confirmed) return { ...report, status: 'cancelled' };
96
107
  }
97
108
  const lock = join(dependencies.home || homeDir(), 'update.lock');
@@ -116,22 +127,29 @@ export async function update(root, flags = {}, dependencies = {}) {
116
127
  const warnings = [];
117
128
  let refresh;
118
129
  try {
119
- refresh = JSON.parse(await run(process.execPath, [newBin, '--project', root, 'update', '--refresh-integrations', '--json'], { timeout: 30000 }));
120
- if (!refresh.refreshed) warnings.push('No managed connections in this project. Run mmx setup if needed.');
130
+ refresh = JSON.parse(await run(process.execPath, [newBin, '--project', root, 'update', '--refresh-integrations', '--json', '--all-projects'], { timeout: 30000 }));
131
+ warnings.push(...(refresh.warnings || []));
132
+ if (!refresh.refreshed && !refresh.warnings?.length) warnings.push('No managed connections found. Run mmx setup if needed.');
121
133
  } catch (error) { warnings.push(`CLI updated, but project connections could not be refreshed: ${error.message}. Run mmx doctor --fix or mmx setup in this project.`); }
122
134
  try {
123
135
  const pathVersion = await run('mmx', ['--version']);
124
136
  if (pathVersion !== report.latest) warnings.push(`Your shell resolves mmx ${pathVersion}, not ${report.latest}. Check PATH for multiple installations.`);
125
137
  } catch { warnings.push('Could not verify mmx on PATH. Check PATH or reopen your terminal.'); }
126
138
  return { ...report, status: 'updated', manager: installation.manager, installedVersion, refresh, warnings,
127
- next: 'Restart your agent/MCP service. Other connected projects may need mmx doctor --fix or mmx setup to refresh their paths and rules.' };
139
+ next: 'Restart agents/MCP services in refreshed projects. Review any project warnings above.' };
128
140
  } finally { rmSync(lock, { recursive: true, force: true }); }
129
141
  }
130
142
 
131
143
  export function formatUpdate(report) {
132
144
  if (report.status === 'cancelled') return 'Update cancelled.';
133
145
  if (report.status === 'manual') return `${report.message}\nCurrent installation: ${report.installation.path}\nSee docs/installation.md for the original installation workflow.`;
134
- if (report.status === 'current') return `MindMux ${report.current} is up to date (latest stable: ${report.latest}).`;
146
+ if (report.status === 'current') return `MindMux ${report.current} is up to date (latest stable: ${report.latest}).${formatRefresh(report)}${(report.warnings || []).map(warning => `\n• ${warning}`).join('')}${report.next ? `\n\n${report.next}` : ''}`;
135
147
  if (report.status === 'available') return `Update available: ${report.current} → ${report.latest}\nRun mmx update to upgrade.`;
136
- return `\n✓ Updated MindMux to ${report.installedVersion}.${report.refresh?.refreshed ? '\n✓ Refreshed this project’s integrations.' : ''}\n${report.warnings.map(warning => `\n• ${warning}`).join('')}\n\n${report.next}`;
148
+ return `\n✓ Updated MindMux to ${report.installedVersion}.${formatRefresh(report)}\n${report.warnings.map(warning => `\n• ${warning}`).join('')}\n\n${report.next}`;
149
+ }
150
+
151
+ function formatRefresh(report) {
152
+ if (!report.refresh?.refreshed) return '';
153
+ if (!report.refresh.projects) return '\n✓ Refreshed this project’s integrations.';
154
+ return report.refresh.projects.filter(project => project.refreshed).map(project => `\n✓ Refreshed integrations: ${project.project}`).join('');
137
155
  }