Summary
@dataforxyz/agent-intercom-codex@0.10.0 declares "bin": { "coi": "dist/coi.mjs" }, but the npm-installed .bin/coi shim never executes the CLI entrypoint: the coi.mjs top-level guard only calls main2() when basename(process.argv[1]) is coi.ts or coi.mjs. The shim's basename is coi, so the process exits 0 silently with no socket, no broker peer registration, and no output.
Minimal reproduction
npm install @dataforxyz/agent-intercom-codex@0.10.0
# A) npm shim -> silent exit 0, main() never runs
./node_modules/.bin/coi --help
echo "exit=$? bytes=$(wc -c < <(./node_modules/.bin/coi --help))"
# -> exit=0 bytes=0
# B) direct entrypoint -> works
node ./node_modules/@dataforxyz/agent-intercom-codex/dist/coi.mjs --help
echo "exit=$? bytes=$(wc -c < <(node ./node_modules/@dataforxyz/agent-intercom-codex/dist/coi.mjs --help))"
# -> exit=0 bytes=5728 (Codex CLI help)
Observed on Linux, codex-cli 0.148.0, node v24.
Root cause
dist/coi.mjs (0.10.0) ends with:
if (process.argv[1] && (basename(process.argv[1]) === "coi.ts" || basename(process.argv[1]) === "coi.mjs")) {
void main2().catch((error) => { ... });
}
The npm-generated shim for a bin named coi passes the shim path (basename coi) as process.argv[1], so the guard is false and the process exits 0 without doing anything.
Suggested fix
Do not gate the entrypoint on argv[1] basename. Either:
- remove the guard and always run
main2() when the module is the main entry (import.meta.main / process.argv[1] === fileURLToPath(import.meta.url), not basename); or
- keep the guard but compare the resolved realpath of
argv[1] against the module path, so the npm shim symlink still resolves to coi.mjs.
Related observation (same launch path)
After fixing the launcher, coi invokes codex app-server -c "mcp_servers.codex-intercom.env.*=..." --listen unix://.... If the user config does not already define [mcp_servers.codex-intercom], codex rejects the implicit entry with invalid transport in mcp_servers.codex-intercom. The package ships a correct .mcp.json (command: node, args: ["./dist/codex-server.mjs"]) but it is not auto-loaded, so the user must add the server stanza via codex mcp add before coi can start the worker. Consider auto-registering the MCP server entry (or documenting the required codex mcp add step) as part of the launch path.
Summary
@dataforxyz/agent-intercom-codex@0.10.0declares"bin": { "coi": "dist/coi.mjs" }, but the npm-installed.bin/coishim never executes the CLI entrypoint: thecoi.mjstop-level guard only callsmain2()whenbasename(process.argv[1])iscoi.tsorcoi.mjs. The shim's basename iscoi, so the process exits 0 silently with no socket, no broker peer registration, and no output.Minimal reproduction
Observed on Linux, codex-cli 0.148.0, node v24.
Root cause
dist/coi.mjs(0.10.0) ends with:The npm-generated shim for a
binnamedcoipasses the shim path (basenamecoi) asprocess.argv[1], so the guard is false and the process exits 0 without doing anything.Suggested fix
Do not gate the entrypoint on
argv[1]basename. Either:main2()when the module is the main entry (import.meta.main/process.argv[1] === fileURLToPath(import.meta.url), not basename); orargv[1]against the module path, so the npm shim symlink still resolves tocoi.mjs.Related observation (same launch path)
After fixing the launcher,
coiinvokescodex app-server -c "mcp_servers.codex-intercom.env.*=..." --listen unix://.... If the user config does not already define[mcp_servers.codex-intercom], codex rejects the implicit entry withinvalid transport in mcp_servers.codex-intercom. The package ships a correct.mcp.json(command: node,args: ["./dist/codex-server.mjs"]) but it is not auto-loaded, so the user must add the server stanza viacodex mcp addbeforecoican start the worker. Consider auto-registering the MCP server entry (or documenting the requiredcodex mcp addstep) as part of the launch path.