@ouro.bot/cli 0.1.0-alpha.719 → 0.1.0-alpha.720

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.720",
6
+ "changes": [
7
+ "Make MCP setup repair commands replace existing stale dev-tool registrations."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.719",
6
12
  "changes": [
@@ -129,6 +129,42 @@ function setupReloadNotice(tool) {
129
129
  const host = tool === "codex" ? "Codex" : "Claude Code";
130
130
  return ` reload required: open a fresh ${host} session so the host launches the newly registered MCP bridge; existing MCP processes keep their old runtime`;
131
131
  }
132
+ function commandFailureText(error) {
133
+ const parts = [];
134
+ if (error instanceof Error)
135
+ parts.push(error.message);
136
+ else if (error !== undefined && error !== null)
137
+ parts.push(String(error));
138
+ const maybeOutput = error;
139
+ if (maybeOutput?.stdout)
140
+ parts.push(String(maybeOutput.stdout));
141
+ if (maybeOutput?.stderr)
142
+ parts.push(String(maybeOutput.stderr));
143
+ if (Array.isArray(maybeOutput?.output)) {
144
+ for (const chunk of maybeOutput.output) {
145
+ if (chunk)
146
+ parts.push(String(chunk));
147
+ }
148
+ }
149
+ return parts.join("\n");
150
+ }
151
+ function isExistingMcpServerFailure(error) {
152
+ return /mcp server .+ already exists/i.test(commandFailureText(error))
153
+ || /already exists in .+ config/i.test(commandFailureText(error));
154
+ }
155
+ function registerMcpServer(addCommand, removeCommand) {
156
+ try {
157
+ (0, child_process_1.execSync)(addCommand, { stdio: "pipe" });
158
+ return "registered";
159
+ }
160
+ catch (error) {
161
+ if (!isExistingMcpServerFailure(error))
162
+ throw error;
163
+ (0, child_process_1.execSync)(removeCommand, { stdio: "pipe" });
164
+ (0, child_process_1.execSync)(addCommand, { stdio: "pipe" });
165
+ return "replaced";
166
+ }
167
+ }
132
168
  const DEFAULT_DAEMON_STARTUP_LOG_LINES = 10;
133
169
  const RSVP_CLI_KINDS = new Set([
134
170
  "rsvp.doctor",
@@ -6910,7 +6946,8 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
6910
6946
  if (tool === "claude-code") {
6911
6947
  // 1. Register MCP server with Claude Code
6912
6948
  const mcpAddCmd = `${claudeCmd} mcp add ouro-${setupAgent} -s user -- ${mcpServeCommand}`;
6913
- (0, child_process_1.execSync)(mcpAddCmd, { stdio: "pipe" });
6949
+ const mcpRemoveCmd = `${claudeCmd} mcp remove -s user ouro-${setupAgent}`;
6950
+ const mcpRegistration = registerMcpServer(mcpAddCmd, mcpRemoveCmd);
6914
6951
  // 2. Write hooks config
6915
6952
  const settingsPath = path.join(claudeConfigDir, "settings.json");
6916
6953
  let settings = {};
@@ -6932,7 +6969,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
6932
6969
  component: "daemon",
6933
6970
  event: "daemon.setup_complete",
6934
6971
  message: "dev tool setup complete",
6935
- meta: { tool, agent: setupAgent, runtimeMode, platform },
6972
+ meta: { tool, agent: setupAgent, runtimeMode, platform, mcpRegistration },
6936
6973
  });
6937
6974
  // 3. Write conversation formatting instructions
6938
6975
  const claudeMdPath = path.join(claudeConfigDir, "CLAUDE.md");
@@ -6944,21 +6981,22 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
6944
6981
  if (!existingClaudeMd.includes("Agent conversations (ouro)")) {
6945
6982
  fs.writeFileSync(claudeMdPath, existingClaudeMd + agentInstructions);
6946
6983
  }
6947
- const message = `setup complete: claude-code + ${setupAgent}\n MCP server registered\n hooks configured\n conversation formatting instructions added\n${setupReloadNotice("claude-code")}`;
6984
+ const message = `setup complete: claude-code + ${setupAgent}\n MCP server ${mcpRegistration}\n hooks configured\n conversation formatting instructions added\n${setupReloadNotice("claude-code")}`;
6948
6985
  deps.writeStdout(message);
6949
6986
  return message;
6950
6987
  }
6951
6988
  else {
6952
6989
  // tool === "codex" (parseSetupCommand validates tool, so this is the only remaining option)
6953
6990
  const mcpAddCmd = `codex mcp add ouro-${setupAgent} -- ${mcpServeCommand}`;
6954
- (0, child_process_1.execSync)(mcpAddCmd, { stdio: "pipe" });
6991
+ const mcpRemoveCmd = `codex mcp remove ouro-${setupAgent}`;
6992
+ const mcpRegistration = registerMcpServer(mcpAddCmd, mcpRemoveCmd);
6955
6993
  (0, runtime_1.emitNervesEvent)({
6956
6994
  component: "daemon",
6957
6995
  event: "daemon.setup_complete",
6958
6996
  message: "dev tool setup complete",
6959
- meta: { tool, agent: setupAgent, runtimeMode, platform },
6997
+ meta: { tool, agent: setupAgent, runtimeMode, platform, mcpRegistration },
6960
6998
  });
6961
- const message = `setup complete: codex + ${setupAgent}\n MCP server registered\n${setupReloadNotice("codex")}`;
6999
+ const message = `setup complete: codex + ${setupAgent}\n MCP server ${mcpRegistration}\n${setupReloadNotice("codex")}`;
6962
7000
  deps.writeStdout(message);
6963
7001
  return message;
6964
7002
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.719",
3
+ "version": "0.1.0-alpha.720",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",