Skip to content

Bare 'node' in hooks and commands fails on macOS Claude Code App #18

Closed

Description

@JohnnyVicious

Summary

plugins/opencode/hooks/hooks.json and every commands/*.md file invoke node without an absolute path. When Claude Code is launched from the macOS App (Finder / Spotlight / Dock), the shell environment for !-commands and hooks does not load .zshenv/.zshrc, so only the minimal system PATH=/usr/bin:/bin:/usr/sbin:/sbin is available. On macOS, Node.js is typically installed in /usr/local/bin (Intel), /opt/homebrew/bin (Apple Silicon), ~/.nvm/versions/..., ~/.volta/bin, etc. — none of which are in the minimal PATH.

Affected files:

  • plugins/opencode/hooks/hooks.json — SessionStart, SessionEnd, Stop hooks all run bare node.
  • plugins/opencode/commands/setup.md, review.md, adversarial-review.md, rescue.md, status.md, result.md, cancel.md — every command uses bare node and allowed-tools: Bash(node:*).

Suggested fix

  1. In handleSetup, resolve the node binary via process.execPath (Claude Code's own node) or which node under the user's login shell, and persist it to state.config.nodePath.
  2. Hooks and commands read ${OPENCODE_COMPANION_NODE:-node} or equivalent, populated by a setup-time rewrite pass.
  3. Alternatively: make the hook/command a shebanged script (#!/usr/bin/env node) and invoke that directly — but this still requires node to be on PATH somewhere env can find it.

The simplest defensible path: handleSetup writes the absolute node path into a config file, and hooks/commands resolve it at runtime.

Upstream reference

Derived from openai/codex-plugin-cc#105.

Activity

  1. JohnnyVicious commented on Apr 12, 2026

    @JohnnyVicious
    OwnerAuthor

    Consolidated into #28. Bare-node failures are part of the broader portable process invocation work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions