@brainervirus/workit-core 2.1.3 → 2.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-core",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "private": false,
5
5
  "description": "Workit shared core — task, policy, evidence, review, decision, worker, and writer state for agentic coding workflows",
6
6
  "keywords": [
@@ -1,5 +1,13 @@
1
1
  import { spawnSync } from "node:child_process";
2
- import { accessSync, constants, existsSync, readFileSync, readdirSync, statSync } from "node:fs";
2
+ import {
3
+ accessSync,
4
+ constants,
5
+ existsSync,
6
+ readFileSync,
7
+ readdirSync,
8
+ realpathSync,
9
+ statSync,
10
+ } from "node:fs";
3
11
  import os from "node:os";
4
12
  import path from "node:path";
5
13
 
@@ -448,6 +456,14 @@ export function runHostCommand(
448
456
  }
449
457
 
450
458
  const findNpmCli = (npm: string): string | null => {
459
+ // `npm` is usually a symlink to npm-cli.js (Node's bin/npm, a package's
460
+ // node_modules/.bin/npm); resolve it before guessing install layouts.
461
+ try {
462
+ const resolved = realpathSync(npm);
463
+ if (path.basename(resolved) === "npm-cli.js") return resolved;
464
+ } catch {
465
+ // Fall through to the layout candidates.
466
+ }
451
467
  const dir = path.dirname(npm);
452
468
  const candidates = [
453
469
  path.join(dir, "node_modules", "npm", "bin", "npm-cli.js"),