agentic-relay 5.0.0 → 5.0.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/README.md CHANGED
@@ -27,7 +27,9 @@ npx agentic-relay --all --api-key=am_live_xxx
27
27
 
28
28
  > One package, one command. `agentrelay` with no subcommand runs the installer; `agentrelay <cmd>` (e.g. `search`, `session`, `fetch`) runs the CLI. If the global link can't be created (e.g. an unwritable npm prefix), run `npm i -g agentic-relay` once yourself.
29
29
  >
30
- > **Reinstalling is always a clean, fresh install:** it removes the old global command and reinstalls the current code (from your local checkout when you're developing), rewrites the skill files, and re-checks your cached API key replacing it only if it's no longer valid. Nothing stale is left behind.
30
+ > **Reinstalling is always a clean, fresh install:** it removes the old global command and reinstalls `agentic-relay@latest` (or your local checkout when you're developing), rewrites the skill files, re-checks your cached API key (replacing it only if it's no longer valid), and clears this package's npx cache entry. Nothing stale is left behind.
31
+ >
32
+ > npx tip: `npx <name>` caches by bare name and won't auto-upgrade. If `npx agentic-relay` ever runs an old version, run `npx agentic-relay@latest` once (or `npm i -g agentic-relay@latest`) — after that the installer keeps itself current.
31
33
 
32
34
  Don't run `npm install` (as a dependency) — this is a CLI installer, not a library.
33
35
 
package/bin/install.mjs CHANGED
@@ -44,6 +44,7 @@ import {
44
44
  globalPrefixWritable,
45
45
  npmCacheOwnedByOther,
46
46
  dirOnPath,
47
+ clearNpxCacheFor,
47
48
  USER_PREFIX_RECIPE,
48
49
  CACHE_CHOWN_RECIPE,
49
50
  } from "./lib/sysenv.mjs";
@@ -643,18 +644,15 @@ function getExistingKey() {
643
644
  *
644
645
  * Install source: from a DEV CHECKOUT (a .git dir next to the package) the
645
646
  * local path is installed FIRST so your edits actually go global; a normal
646
- * published run installs `agentic-relay@<version>` from the registry first, with
647
- * the path as fallback. Surfaces npm's actual error (EACCES etc.) and verifies
648
- * the global bin landed. System probes live in lib/sysenv.mjs.
647
+ * published run installs `agentic-relay@latest` from the registry first, with
648
+ * the path as fallback. `@latest` (not the running version) matters: a stale
649
+ * cached npx installer must still land the NEWEST global, not pin its own old
650
+ * version. Surfaces npm's actual error (EACCES etc.), verifies the global bin
651
+ * landed, then clears our npx cache entry so the next `npx` is fresh too.
652
+ * System probes live in lib/sysenv.mjs.
649
653
  */
650
654
  function linkGlobalCli() {
651
655
  const pkgRoot = join(__dirname, "..");
652
- let version = null;
653
- try {
654
- version = JSON.parse(readFileSync(join(pkgRoot, "package.json"), "utf-8")).version;
655
- } catch {
656
- // unknown version — fall through to the path install
657
- }
658
656
 
659
657
  // Preflight: detect the two environment breakages PROACTIVELY instead of
660
658
  // letting `npm install -g` fail with a buried stderr.
@@ -678,11 +676,13 @@ function linkGlobalCli() {
678
676
  } catch {}
679
677
 
680
678
  // Prefer the local path when this is a dev checkout, so local edits actually
681
- // reach the global command; otherwise install the published version. Detect a
682
- // checkout by the .git dir — a published tarball (incl. an npx run) never has
683
- // one. (bin/test/ ships in the package, so it can't be the signal.)
679
+ // reach the global command; otherwise install @latest. Detect a checkout by
680
+ // the .git dir — a published tarball (incl. an npx run) never has one.
681
+ // (bin/test/ ships in the package, so it can't be the signal.) @latest, not
682
+ // @<version>: if a STALE cached npx installer runs this, it must still land
683
+ // the newest global rather than re-pinning its own old version.
684
684
  const isDevCheckout = existsSync(join(pkgRoot, ".git"));
685
- const registrySpec = version ? `agentic-relay@${version}` : "agentic-relay";
685
+ const registrySpec = "agentic-relay@latest";
686
686
  const pathSpec = `"${pkgRoot}"`;
687
687
  const attempts = isDevCheckout ? [pathSpec, registrySpec] : [registrySpec, pathSpec];
688
688
  let lastErr = null;
@@ -715,6 +715,9 @@ function linkGlobalCli() {
715
715
  const shim = globalBinShimPath(prefix, "agentrelay");
716
716
  if (shim && existsSync(shim)) {
717
717
  success(`linked global \`agentrelay\` CLI (${installedFrom})`);
718
+ // Drop our stale npx cache entry so the next `npx agentic-relay` re-resolves
719
+ // the newest version instead of replaying an old cached installer.
720
+ clearNpxCacheFor("agentic-relay");
718
721
  if (!dirOnPath(binDir)) {
719
722
  warn(`note: ${binDir} doesn't appear to be on your PATH — add it to use \`agentrelay\` directly`);
720
723
  return "linked-offpath";
@@ -9,7 +9,7 @@
9
9
  * - npm's global bin dir may not be on the user's PATH
10
10
  */
11
11
 
12
- import { existsSync, accessSync, statSync, constants } from "fs";
12
+ import { existsSync, accessSync, statSync, constants, readdirSync, rmSync } from "fs";
13
13
  import { homedir } from "os";
14
14
  import { join, dirname } from "path";
15
15
  import { execSync } from "child_process";
@@ -99,6 +99,32 @@ export function dirOnPath(dir, pathVar = process.env.PATH || "") {
99
99
  return pathVar.split(delim).map(norm).includes(norm(dir));
100
100
  }
101
101
 
102
+ /**
103
+ * Remove ONLY this package's entries from npm's npx cache, so the next
104
+ * `npx <pkg>` re-resolves from the registry instead of replaying a stale cached
105
+ * copy (npx reuses its cache for a bare name and won't auto-upgrade). Scoped to
106
+ * `<npm cache>/_npx/<hash>` dirs whose node_modules contains pkgName — other
107
+ * tools' npx caches are left alone. Best-effort; never throws.
108
+ */
109
+ export function clearNpxCacheFor(pkgName) {
110
+ try {
111
+ const cacheDir = execSync("npm config get cache", {
112
+ encoding: "utf-8",
113
+ stdio: ["ignore", "pipe", "ignore"],
114
+ }).trim();
115
+ if (!cacheDir) return;
116
+ const npxDir = join(cacheDir, "_npx");
117
+ if (!existsSync(npxDir)) return;
118
+ for (const entry of readdirSync(npxDir)) {
119
+ if (existsSync(join(npxDir, entry, "node_modules", pkgName))) {
120
+ try {
121
+ rmSync(join(npxDir, entry), { recursive: true, force: true });
122
+ } catch {}
123
+ }
124
+ }
125
+ } catch {}
126
+ }
127
+
102
128
  /** The official npm user-level-prefix recipe for EACCES on the global prefix. */
103
129
  export const USER_PREFIX_RECIPE = [
104
130
  "mkdir -p ~/.npm-global",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-relay",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Install Agent Relay AI search across 17+ agents — Claude Code, Codex, Cursor, Gemini CLI, Goose, Windsurf, Cline, BoltAI, Claude Desktop, VS Code, Amazon Q, Roo Code, Witsy, LibreChat, OpenClaw, Tome, Raycast — plus the `agentrelay` CLI for live agent sessions and deliverable fetch",
5
5
  "bin": {
6
6
  "agentrelay": "bin/cli.mjs"