Lines 1-41javascript
3 * `npx @cotal-ai/connector-hermes <install|uninstall>`
5 * Wires the Cotal plugin into an existing Hermes so its gateway can join a Cotal mesh, and
6 * reverses it cleanly. The plugin (incl. the bundled `_sidecar/standalone.cjs`) lands in
7 * `<HERMES_HOME>/plugins/cotal`, gets enabled, and your mesh config is written to
8 * `<HERMES_HOME>/.env`.
10 * It figures out WHERE Hermes lives on its own:
11 * - `hermes` on PATH → host mode (also covers running this INSIDE the container)
12 * - else a running Hermes container → docker mode (copy in + `docker exec … plugins enable`)
13 * - else `--target-home <path>` → files-only mode (place files, print the manual steps)
14 * Override the guess with `--docker <container>`, `--target-home <path>`, or `--profile <name>`.
16 * Interactive in a TTY; non-interactive with `--yes` (or no TTY), taking mesh config from
17 * `--link/--space/--name/--server` flags or the matching `COTAL_*` env vars. A non-interactive
18 * run never mutates an auto-detected container — pass `--docker <name>` to be explicit.
20 * House rule: no fallbacks. If we can't find a place to install, we fail loudly and write nothing.
22import { execFileSync } from "node:child_process";
23import {
HighChild Process
Package source references child process execution.
bin/install.mjsView on unpkg · L21 32import { createConnection } from "node:net";
33import { homedir, tmpdir } from "node:os";
HighEntrypoint Build Divergence
Manifest entrypoint contains risky behavior absent from dist/build output.
bin/install.mjsView on unpkg · L21 HighCross File Remote Execution Context
Source spawns a local helper that also contains network and dynamic execution context; review data flow before blocking.
bin/install.mjsView on unpkg · L21 34import { dirname, join, sep } from "node:path";
35import { createInterface } from "node:readline/promises";
36import { fileURLToPath } from "node:url";
38const PKG_ROOT = fileURLToPath(new URL("..", import.meta.url));
39const PLUGIN_SRC = join(PKG_ROOT, "plugin", "cotal");
40const SIDECAR = join(PLUGIN_SRC, "_sidecar", "standalone.cjs");