probe-research 0.13.1 → 0.14.0

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.
@@ -233,6 +233,32 @@ function cliArgs(args) {
233
233
  return args;
234
234
  }
235
235
 
236
+ /**
237
+ * Commands that never run on the installed `probe`: they repair it, so they
238
+ * must not depend on it starting. `npx probe-research repair` runs the newest
239
+ * release from a throwaway environment, which rebuilds the installed one
240
+ * (`probe repair`: the install pipeline in repair mode).
241
+ */
242
+ const REPAIR_VERBS = Object.freeze(["repair"]);
243
+
244
+ /** Whether a call may be handed to the installed `probe` (else: the newest, throwaway). */
245
+ function mayUseInstalled(forwarded) {
246
+ return !REPAIR_VERBS.includes(forwarded[0]);
247
+ }
248
+
249
+ /**
250
+ * Extra `uv tool run` flags for a call. A repair runs `--isolated`: without
251
+ * it uv reuses the INSTALLED tool environment whenever it satisfies the
252
+ * requirement -- the corrupted one the repair is for (reproduced with uv
253
+ * 0.12.5).
254
+ */
255
+ function uvRunFlags(forwarded) {
256
+ return mayUseInstalled(forwarded) ? [] : ["--isolated"];
257
+ }
258
+
259
+ /** What a repair says when the newest release cannot be read. */
260
+ const REPAIR_NEEDS_NETWORK = "probe repair needs the network to fetch a working CLI";
261
+
236
262
  async function main() {
237
263
  const args = process.argv.slice(2);
238
264
  // `npx probe-research` with no arguments runs the wizard — that is the entire
@@ -250,7 +276,15 @@ async function main() {
250
276
  // serving whatever it resolved on day one -- in the other branch. It was
251
277
  // fixed there and left standing here.
252
278
  let latest = null;
253
- if (has("probe")) {
279
+ if (!mayUseInstalled(forwarded)) {
280
+ // A repair runs the NEWEST release, never the floor: the floor predates
281
+ // `probe repair`, and would hand the job to a CLI that cannot do it.
282
+ latest = await latestVersion();
283
+ if (!latest) {
284
+ console.error(`probe-research: ${REPAIR_NEEDS_NETWORK}`);
285
+ process.exit(1);
286
+ }
287
+ } else if (has("probe")) {
254
288
  const found = installedVersion();
255
289
  if (found && atLeast(found, wanted)) {
256
290
  latest = await latestVersion();
@@ -289,8 +323,9 @@ async function main() {
289
323
  // kept returning 0.10.0 after 0.10.1 was published). The full refresh costs
290
324
  // ~100ms, which is nothing for a command that only runs when there is no
291
325
  // usable local install.
326
+ const isolated = uvRunFlags(forwarded);
292
327
  if (has("uv")) {
293
- return run("uv", ["tool", "run", "--refresh", "--from", spec, "probe", ...forwarded]);
328
+ return run("uv", ["tool", "run", ...isolated, "--refresh", "--from", spec, "probe", ...forwarded]);
294
329
  }
295
330
  if (has("pipx")) {
296
331
  return run("pipx", ["run", "--no-cache", "--spec", spec, "probe", ...forwarded]);
@@ -316,7 +351,7 @@ async function main() {
316
351
  // because it was resolved before the install ran.
317
352
  const uv = `${os.homedir()}/.local/bin/uv`;
318
353
  return run(uv, [
319
- "tool", "run", "--refresh", "--from", spec, "probe", ...forwarded,
354
+ "tool", "run", ...isolated, "--refresh", "--from", spec, "probe", ...forwarded,
320
355
  ]);
321
356
  }
322
357
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "probe-research",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "Setup wizard for Probe Research in your coding agents. Runs from zero with npx.",
5
5
  "bin": {
6
6
  "probe-research": "bin/probe-research.js"