@ouro.bot/cli 0.1.0-alpha.145 → 0.1.0-alpha.146

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.146",
6
+ "changes": [
7
+ "fix(hook): target specific agent only, ouro up breaks dev dispatch loop"
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.145",
6
12
  "changes": [
@@ -947,10 +947,25 @@ function parseOuroCommand(args) {
947
947
  return parseOuroCommand(args.slice(2));
948
948
  }
949
949
  if (head === "hook") {
950
- const event = second;
950
+ const hookArgs = args.slice(1);
951
+ let event;
952
+ let hookAgent;
953
+ for (let i = 0; i < hookArgs.length; i++) {
954
+ if (hookArgs[i] === "--agent" && hookArgs[i + 1]) {
955
+ hookAgent = hookArgs[++i];
956
+ continue;
957
+ }
958
+ /* v8 ignore start -- false branch: extra positional args after event are ignored */
959
+ if (!event) {
960
+ event = hookArgs[i];
961
+ }
962
+ /* v8 ignore stop */
963
+ }
951
964
  if (!event)
952
965
  throw new Error("hook requires an event name (session-start, stop, post-tool-use)");
953
- return { kind: "hook", event };
966
+ if (!hookAgent)
967
+ throw new Error("hook requires --agent <name>");
968
+ return { kind: "hook", event, agent: hookAgent };
954
969
  }
955
970
  if (head === "up")
956
971
  return { kind: "daemon.up" };
@@ -1987,6 +2002,16 @@ async function runOuroCli(args, deps = createDefaultOuroCliDeps()) {
1987
2002
  meta: { kind: command.kind },
1988
2003
  });
1989
2004
  if (command.kind === "daemon.up") {
2005
+ // ── dev mode cleanup: delete dev-config.json so the wrapper stops dispatching to dev repo ──
2006
+ /* v8 ignore start -- dev-config cleanup: requires real filesystem state @preserve */
2007
+ try {
2008
+ const devConfigPath = getDevConfigPath();
2009
+ if (fs.existsSync(devConfigPath)) {
2010
+ fs.unlinkSync(devConfigPath);
2011
+ }
2012
+ }
2013
+ catch { /* best effort */ }
2014
+ /* v8 ignore stop */
1990
2015
  // ── dev mode delegation: ouro up from a dev repo delegates to installed binary ──
1991
2016
  // Only runs when detectMode is explicitly injected (via createDefaultOuroCliDeps or tests)
1992
2017
  if (deps.detectMode) {
@@ -2336,15 +2361,10 @@ async function runOuroCli(args, deps = createDefaultOuroCliDeps()) {
2336
2361
  else {
2337
2362
  content = `[Claude Code hook: ${eventType} in session ${sessionId}]`;
2338
2363
  }
2339
- // Send to daemon (best effort — daemon may not be running)
2364
+ // Send to the specific agent configured for this hook
2340
2365
  try {
2341
- const agents = require("fs").readdirSync(path.join(os.homedir(), "AgentBundles"))
2342
- .filter((f) => f.endsWith(".ouro"))
2343
- .map((f) => f.replace(".ouro", ""));
2344
- for (const agent of agents) {
2345
- await deps.sendCommand(deps.socketPath, { kind: "message.send", from: `claude-code:${sessionId}`, to: agent, content });
2346
- }
2347
- await deps.sendCommand(deps.socketPath, { kind: "inner.wake", agent: agents[0] }).catch(() => { });
2366
+ await deps.sendCommand(deps.socketPath, { kind: "message.send", from: `claude-code:${sessionId}`, to: command.agent, content }).catch(() => { });
2367
+ await deps.sendCommand(deps.socketPath, { kind: "inner.wake", agent: command.agent }).catch(() => { });
2348
2368
  }
2349
2369
  catch { /* daemon not running — silent */ }
2350
2370
  // Output for Claude Code hook system
@@ -2377,9 +2397,9 @@ async function runOuroCli(args, deps = createDefaultOuroCliDeps()) {
2377
2397
  // Bare `ouro` works because ouro is on PATH via ~/.ouro-cli/bin/.
2378
2398
  settings.hooks = {
2379
2399
  ...(settings.hooks ?? {}),
2380
- SessionStart: [{ hooks: [{ type: "command", command: "ouro hook session-start", timeout: 5 }] }],
2381
- Stop: [{ hooks: [{ type: "command", command: "ouro hook stop", timeout: 5 }] }],
2382
- PostToolUse: [{ matcher: "Bash|Edit|Write", hooks: [{ type: "command", command: "ouro hook post-tool-use", timeout: 5 }] }],
2400
+ SessionStart: [{ hooks: [{ type: "command", command: `ouro hook session-start --agent ${setupAgent}`, timeout: 5 }] }],
2401
+ Stop: [{ hooks: [{ type: "command", command: `ouro hook stop --agent ${setupAgent}`, timeout: 5 }] }],
2402
+ PostToolUse: [{ matcher: "Bash|Edit|Write", hooks: [{ type: "command", command: `ouro hook post-tool-use --agent ${setupAgent}`, timeout: 5 }] }],
2383
2403
  };
2384
2404
  fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
2385
2405
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
@@ -40,8 +40,9 @@ const path = __importStar(require("path"));
40
40
  const runtime_1 = require("../../nerves/runtime");
41
41
  const WRAPPER_SCRIPT = `#!/bin/sh
42
42
  # Check for dev mode — if dev-config.json exists, dispatch to the dev repo
43
+ # Skip dev dispatch for "up" command (explicitly returns to production)
43
44
  DEV_CONFIG="$HOME/.ouro-cli/dev-config.json"
44
- if [ -f "$DEV_CONFIG" ]; then
45
+ if [ -f "$DEV_CONFIG" ] && [ "$1" != "up" ]; then
45
46
  DEV_REPO=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('$DEV_CONFIG','utf-8')).repoPath)}catch{}" 2>/dev/null)
46
47
  DEV_ENTRY="$DEV_REPO/dist/heart/daemon/ouro-entry.js"
47
48
  if [ -n "$DEV_REPO" ] && [ -e "$DEV_ENTRY" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.145",
3
+ "version": "0.1.0-alpha.146",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",