nexus-agents 4.11.0 → 4.11.1
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/dist/{chunk-IGKDZXNU.js → chunk-EKEK2YEU.js} +3 -3
- package/dist/{chunk-OBNQCC5R.js → chunk-EZYPUUIK.js} +2 -2
- package/dist/{chunk-PDAD3S2X.js → chunk-HSWOBNVW.js} +11 -73
- package/dist/chunk-HSWOBNVW.js.map +1 -0
- package/dist/chunk-WPLXWTUK.js +69 -0
- package/dist/chunk-WPLXWTUK.js.map +1 -0
- package/dist/cli.js +5 -4
- package/dist/cli.js.map +1 -1
- package/dist/{doctor-live-2WD3BRLP.js → doctor-live-EYAUDVPS.js} +14 -3
- package/dist/{doctor-live-2WD3BRLP.js.map → doctor-live-EYAUDVPS.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{setup-command-FVA3PYJQ.js → setup-command-FKQMJ747.js} +4 -3
- package/package.json +1 -1
- package/dist/chunk-PDAD3S2X.js.map +0 -1
- /package/dist/{chunk-IGKDZXNU.js.map → chunk-EKEK2YEU.js.map} +0 -0
- /package/dist/{chunk-OBNQCC5R.js.map → chunk-EZYPUUIK.js.map} +0 -0
- /package/dist/{setup-command-FVA3PYJQ.js.map → setup-command-FKQMJ747.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/cli-detection-error.ts","../src/cli/setup-cli-detection.ts"],"sourcesContent":["/**\n * nexus-agents/cli - CLI detection error classification (#2152)\n *\n * Small helper shared by `setup-codex.ts`, `setup-gemini.ts`, `setup-opencode.ts`\n * (and later `setup-cli-detection.ts` once #2155 consolidates them) so that a\n * `which`/`where` or `<cli> --version` failure is classified instead of\n * silently collapsed into `installed: false`.\n *\n * Before this file, all three setup modules did `catch { return { installed: false } }`,\n * treating `ENOENT` (genuinely not installed), `ETIMEDOUT` (PATH lookup hung),\n * `EACCES` (binary present but not executable), and arbitrary other exec\n * failures identically. That made doctor/verify diagnostics unactionable.\n *\n * @module cli/cli-detection-error\n */\n\n/**\n * Stable classification of why a CLI-detection exec failed.\n *\n * - `not-found`: binary is not on PATH (`ENOENT`). User action: install the CLI.\n * - `timeout`: the exec hung past the configured timeout (`ETIMEDOUT`,\n * `exit code null with signal`). User action: investigate PATH for hung\n * filesystems (NFS mounts, dead autofs entries).\n * - `permission`: binary is present but the current user can't execute it\n * (`EACCES`, `EPERM`). User action: fix mode bits or ownership.\n * - `other`: any other exec failure. User action: re-run with verbose\n * logging or inspect stderr directly.\n */\nexport type DetectionError = 'not-found' | 'timeout' | 'permission' | 'other';\n\n/**\n * Human-readable explanation for each detection-error class. Intended for\n * `doctor`/`verify` output — short enough to fit on one line next to the CLI\n * name.\n */\nexport const DETECTION_ERROR_MESSAGES: Record<DetectionError, string> = {\n 'not-found': 'binary not on PATH',\n timeout: 'detection timed out (hung PATH?)',\n permission: 'binary present but not executable',\n other: 'detection failed — check verbose logs',\n};\n\n/**\n * Formats a user-facing \"not installed\" message that incorporates the\n * detection-error class. Called by setup runners to replace the flat\n * \"<cli> not installed\" message when the underlying cause is more specific.\n *\n * - `not-found` or undefined → \"<cli> not installed\"\n * - other classes → \"<cli> detection failed: <class-message>\"\n */\nexport function formatDetectionMessage(cliName: string, detectionError?: DetectionError): string {\n if (detectionError === undefined || detectionError === 'not-found') {\n return `${cliName} not installed`;\n }\n return `${cliName} detection failed: ${DETECTION_ERROR_MESSAGES[detectionError]}`;\n}\n\n/**\n * Actionable recovery step for each detection-error class (#3213). Each takes\n * the CLI's **binary** name (e.g. `opencode`, not the display name) so the\n * suggested command is runnable verbatim. Intended to be shown alongside the\n * `formatDetectionMessage` line on setup/doctor failures.\n */\nexport const DETECTION_ERROR_SOLUTIONS: Record<DetectionError, (cliBinary: string) => string> = {\n 'not-found': (cli) =>\n `Install ${cli} and make sure it is on your PATH — see docs/getting-started/INSTALLATION.md.`,\n permission: (cli) =>\n `The ${cli} binary is present but not executable. Run: chmod +x \"$(command -v ${cli})\"`,\n timeout: (cli) =>\n `${cli} detection timed out. Check PATH for hung mounts (e.g. NFS); re-run with --verbose to see where detection hangs.`,\n other: (cli) => `Re-run with --verbose for detailed ${cli} detection logs.`,\n};\n\n/**\n * One-line actionable recovery hint for a detection error, with a docs pointer.\n * `cliBinary` is the runnable binary name (e.g. `gemini`); defaults the class to\n * `not-found` when unclassified.\n */\nexport function detectionRecoveryHint(cliBinary: string, detectionError?: DetectionError): string {\n const cls: DetectionError = detectionError ?? 'not-found';\n return `${DETECTION_ERROR_SOLUTIONS[cls](cliBinary)} (more: docs/TROUBLESHOOTING.md)`;\n}\n\n/**\n * Classifies a thrown error from `execFileSync('which'|'where', ...)` or\n * `execFileSync(cli, ['--version'])`.\n *\n * Node's `execFileSync` throws with a `code` property on the error object\n * (string like `'ENOENT'`) for most OS-level failures. Timeouts additionally\n * set `signal: 'SIGTERM'` and may have `code: undefined`. We probe both.\n */\nexport function classifyExecError(err: unknown): DetectionError {\n if (typeof err !== 'object' || err === null) return 'other';\n\n // Duck-type rather than instanceof — execFileSync errors aren't always\n // `Error` instances across Node versions and test harnesses.\n const e = err as { code?: unknown; signal?: unknown; killed?: unknown };\n\n if (e.code === 'ENOENT') return 'not-found';\n if (e.code === 'ETIMEDOUT') return 'timeout';\n if (e.killed === true || e.signal === 'SIGTERM' || e.signal === 'SIGKILL') {\n // execFileSync sets `killed: true` + SIGTERM when its own timeout fires.\n return 'timeout';\n }\n if (e.code === 'EACCES' || e.code === 'EPERM') return 'permission';\n\n return 'other';\n}\n","/**\n * Shared CLI binary detection helpers (#2155, child of #2151).\n *\n * Consolidates the near-identical detection logic that previously lived in\n * `setup-codex.ts`, `setup-gemini.ts`, and `setup-opencode.ts`. Each setup\n * file now delegates to `detectCliBinary(name)` instead of carrying its\n * own copy of the platform-aware locator + version-extraction logic.\n *\n * The per-CLI `ConfigResult` interfaces remain separate because they\n * legitimately differ (Codex writes via MCP, Gemini and OpenCode write to\n * config files with paths).\n *\n * @module cli/setup-cli-detection\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { platform } from 'node:os';\n\nimport { classifyExecError, type DetectionError } from './cli-detection-error.js';\n\n/** Generic CLI detection result. Consumed by every `setup-*.ts` detector. */\nexport interface CliDetectionInfo {\n readonly installed: boolean;\n readonly version: string | undefined;\n /**\n * Classification of why detection failed. Set when `installed` is `false`\n * OR when the binary was located but `--version` failed (#2152).\n */\n readonly detectionError?: DetectionError;\n}\n\n/** Returns the platform-appropriate command for locating an executable. */\nexport function getCliLocatorCommand(): 'where' | 'which' {\n return platform() === 'win32' ? 'where' : 'which';\n}\n\n/**\n * Extracts a semver triple (`X.Y.Z`) from CLI `--version` output.\n *\n * Pure helper — exported for direct unit testing. Returns the matched\n * version string or undefined when no semver-shaped substring is present.\n */\nexport function extractSemver(output: string): string | undefined {\n const match = /(\\d+\\.\\d+\\.\\d+)/.exec(output);\n return match?.[1];\n}\n\n/**\n * Detects whether a CLI binary is installed and reports its version.\n *\n * Two-phase detection:\n * 1. Locate via `which` / `where` — fast PATH check (3s timeout).\n * 2. If located, run `<name> --version` and extract semver (5s timeout).\n *\n * Both phases trap `execFileSync` exceptions and return a `CliDetectionInfo`\n * with a classified `detectionError`. Callers never see exceptions from\n * this function.\n */\nexport function detectCliBinary(name: string): CliDetectionInfo {\n try {\n execFileSync(getCliLocatorCommand(), [name], { timeout: 3000, stdio: 'pipe' });\n } catch (err: unknown) {\n return { installed: false, version: undefined, detectionError: classifyExecError(err) };\n }\n\n try {\n const output = execFileSync(name, ['--version'], {\n timeout: 5000,\n stdio: 'pipe',\n encoding: 'utf-8',\n });\n return { installed: true, version: extractSemver(output) };\n } catch (err: unknown) {\n return { installed: true, version: undefined, detectionError: classifyExecError(err) };\n }\n}\n"],"mappings":";AAmCO,IAAM,2BAA2D;AAAA,EACtE,aAAa;AAAA,EACb,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,OAAO;AACT;AAUO,SAAS,uBAAuB,SAAiB,gBAAyC;AAC/F,MAA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AEA,MAAI;AACF,UAAM,SAAS,aAAa,MAAM,CAAC,WAAW,GAAG;AAAA,MAC/C,SAAS;AAAA,MACT,OAAO;AAAA,MACP,UAAU;AAAA,IACZ,CAAC;AACD,WAAO,EAAE,WAAW,MAAM,SAAS,cAAc,MAAM,EAAE;AAAA,EAC3D,SAAS,KAAc;AACrB,WAAO,EAAE,WAAW,MAAM,SAAS,QAAW,gBAAgB,kBAAkB,GAAG,EAAE;AAAA,EACvF;AACF;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -18,7 +18,8 @@ import "./chunk-H7C3YEVA.js";
|
|
|
18
18
|
import {
|
|
19
19
|
setupCommandAsync,
|
|
20
20
|
verifyCommand
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-HSWOBNVW.js";
|
|
22
|
+
import "./chunk-WPLXWTUK.js";
|
|
22
23
|
import "./chunk-IW3G6WVW.js";
|
|
23
24
|
import {
|
|
24
25
|
AuthHandler,
|
|
@@ -139,7 +140,7 @@ import {
|
|
|
139
140
|
validateCommand,
|
|
140
141
|
validateWorkflow,
|
|
141
142
|
wrapInMarkdownFence
|
|
142
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-EZYPUUIK.js";
|
|
143
144
|
import "./chunk-2A664K4J.js";
|
|
144
145
|
import "./chunk-HFOQKCD2.js";
|
|
145
146
|
import "./chunk-RSMG2DPB.js";
|
|
@@ -166,7 +167,7 @@ import {
|
|
|
166
167
|
loadConfig,
|
|
167
168
|
runDoctor,
|
|
168
169
|
validateNexusEnv
|
|
169
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-EKEK2YEU.js";
|
|
170
171
|
import {
|
|
171
172
|
buildOpenAICompatAdapters,
|
|
172
173
|
readOpenAICompatEnv
|
|
@@ -20895,7 +20896,7 @@ async function handleDoctorCommand(args) {
|
|
|
20895
20896
|
process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
|
|
20896
20897
|
}
|
|
20897
20898
|
if (args.options.live) {
|
|
20898
|
-
const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-
|
|
20899
|
+
const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-EYAUDVPS.js");
|
|
20899
20900
|
const report = await runLiveReadiness();
|
|
20900
20901
|
process.stdout.write(formatLiveReadiness(report) + "\n");
|
|
20901
20902
|
if (report.some((r) => r.levels.serves.status === "failed")) {
|