@rightkit/release 0.6.25 → 0.6.26

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/managed-cargo.mjs CHANGED
@@ -156,7 +156,31 @@ export function realCargoOf(candidates, readHead = fileHead, readMap = (file) =>
156
156
  * RIGHTKIT_MANAGED_AGENT_BIN, or a script that routes through the broker, read 4 KiB at most), and the first real cargo left on it.
157
157
  * Plain `cargo` then can only be a real toolchain; with none, a cargo launch fails as missing, never through a shim.
158
158
  */
159
- export function directCargoPath({ env = process.env, exists = existsSync, readHead = fileHead, platform = process.platform, gateWrappers = false } = {}) {
159
+ /**
160
+ * The broker's own registered toolchain on a broker host (Mac, Dell): `{ cargo, dirs }` from its config's `tools` (cargo's toolchain bin first,
161
+ * then the registered cargo plugins cargo-deny, cargo-audit, ...), or null when no broker config is readable (Linux, CI). The gate's direct,
162
+ * non-compiling cargo (GATE-CONTRACT GC-A11) runs exactly the broker's pinned toolchain and plugins, never whatever PATH or rustup's
163
+ * default holds (the Dell has no cargo on PATH; rustup's default there is another toolchain). The config is the live one at the managed
164
+ * control root, else the data root's (a host whose control-root move has not happened yet).
165
+ */
166
+ const BROKER_PLUGIN_TOOLS = Object.freeze(["cargo-deny", "cargo-audit", "cargo-about", "cargo-outdated", "cargo-machete", "cargo-upgrade", "cargo-set-version"]);
167
+ export function brokerToolchain({ env = process.env, platform = process.platform, readFile = (f) => readFileSync(f, "utf8"), exists = existsSync } = {}) {
168
+ let roots; try { roots = resolveManagedRoots({ env, platform }); } catch { return null; }
169
+ const paths = platform === "win32" ? path.win32 : path.posix;
170
+ for (const file of [roots.configPath, roots.dataRoot ? paths.join(roots.dataRoot, "config.json") : null].filter(Boolean)) {
171
+ let config; try { if (!exists(file)) continue; config = JSON.parse(readFile(file)); } catch { continue; }
172
+ const tools = Array.isArray(config?.tools) ? config.tools : [];
173
+ const byId = new Map(tools.filter((t) => t && typeof t.id === "string" && typeof t.path === "string").map((t) => [t.id, t]));
174
+ const cargo = byId.get("cargo");
175
+ if (!cargo || !exists(cargo.path)) continue;
176
+ const dirOf = (t) => (typeof t.root === "string" && t.root ? t.root : paths.dirname(t.path));
177
+ const dirs = [dirOf(cargo), ...BROKER_PLUGIN_TOOLS.map((id) => byId.get(id)).filter((t) => t && exists(t.path)).map(dirOf)];
178
+ return { cargo: cargo.path, dirs: [...new Set(dirs)], config: file };
179
+ }
180
+ return null;
181
+ }
182
+
183
+ export function directCargoPath({ env = process.env, exists = existsSync, readHead = fileHead, platform = process.platform, gateWrappers = false, broker = brokerToolchain({ env, platform, exists }) } = {}) {
160
184
  // `platform` only matters for a forced direct run on Windows (a recorded broker exception): ";" separators, backslash paths, cargo.exe.
161
185
  const win = platform === "win32";
162
186
  const norm = (d) => (win ? String(d).replaceAll("\\", "/") : d);
@@ -173,6 +197,8 @@ export function directCargoPath({ env = process.env, exists = existsSync, readHe
173
197
  kept.push(dir);
174
198
  if (!cargo && found) cargo = found;
175
199
  }
200
+ // A broker host: its registered toolchain and plugins come first, and its cargo is the one used.
201
+ if (broker) return { path: [...broker.dirs, ...kept.filter((d) => !broker.dirs.includes(d))].join(win ? ";" : ":"), dropped, cargo: broker.cargo, broker: broker.config };
176
202
  return { path: kept.join(win ? ";" : ":"), dropped, cargo };
177
203
  }
178
204
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.25",
3
+ "version": "0.6.26",
4
4
  "description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  "@rightkit/qa": "0.6.2",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.2",
52
- "@rightkit/release": "0.6.25",
52
+ "@rightkit/release": "0.6.26",
53
53
  "@rightkit/settings-ui": "0.7.0",
54
54
  "@rightkit/social-ui": "0.1.0",
55
55
  "@rightkit/system-ui": "0.1.0",