@eliya-oss/agent-diff 0.1.0-alpha.39 → 0.1.0-alpha.40

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.40
4
+
5
+ ### Patch Changes
6
+
7
+ - `adiff upgrade` answers in plain english, starting with what happened: already the newest build, a newer one is out, or the registry never answered. `--json` gives the envelope back to a caller.
8
+
3
9
  ## 0.1.0-alpha.39
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9174,10 +9174,10 @@ var init_pane = __esmMin((() => {
9174
9174
  init_commands();
9175
9175
  init_init();
9176
9176
  init_pane();
9177
- var version$1 = "0.1.0-alpha.39";
9177
+ var version$1 = "0.1.0-alpha.40";
9178
9178
  //#endregion
9179
9179
  //#region src/cli/upgrade.ts
9180
- var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, ran, here, noteFor, upgradeAdiff;
9180
+ var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, ran, here, statusOf$1, ranLine, failedLine, noteFor, offerFor, restOf, sayUpgrade, upgradeAdiff;
9181
9181
  var init_upgrade$1 = __esmMin((() => {
9182
9182
  init_dist();
9183
9183
  PACKAGE = "@eliya-oss/agent-diff";
@@ -9207,9 +9207,9 @@ var init_upgrade$1 = __esmMin((() => {
9207
9207
  };
9208
9208
  NOTES = {
9209
9209
  brew: "Homebrew installed this build, so Homebrew replaces it.",
9210
- npm: `npm installed this build. Name the ${TAG} tag: the latest tag on the registry is an old build.`,
9211
- bun: `bun installed this build. Name the ${TAG} tag: the latest tag on the registry is an old build.`,
9212
- binary: `This is a downloaded binary, so nothing upgrades it on its own. The command replaces it in place; a running executable cannot rewrite itself, so run it yourself. Every build is on ${RELEASES}.`,
9210
+ npm: `npm installed this build, so npm replaces it. The ${TAG} tag matters: the latest tag on the registry still points at an old build.`,
9211
+ bun: `bun installed this build, so bun replaces it. The ${TAG} tag matters: the latest tag on the registry still points at an old build.`,
9212
+ binary: "This is a downloaded binary, so nothing upgrades it on its own, and a running executable cannot rewrite itself.",
9213
9213
  source: "This is running from a checkout, so git is what updates it."
9214
9214
  };
9215
9215
  RUNNABLE = /* @__PURE__ */ new Set([
@@ -9260,11 +9260,32 @@ var init_upgrade$1 = __esmMin((() => {
9260
9260
  executable: process.execPath,
9261
9261
  module: fileURLToPath(new URL(".", import.meta.url))
9262
9262
  });
9263
- noteFor = (route, run, version, checked) => {
9264
- const refused = run && !RUNNABLE.has(route) ? " adiff will not run this one for you; run it yourself." : "";
9265
- const blind = checked ? "" : ` adiff could not reach the registry, so it cannot say whether ${version} is current. Every build is listed on ${RELEASES}.`;
9266
- return `${NOTES[route]}${refused}${blind}`;
9263
+ statusOf$1 = (told) => {
9264
+ if (!told.checked) return `adiff ${told.version} is installed. The registry did not answer, so adiff cannot tell whether a newer build is out.`;
9265
+ if (told.current === true) return `adiff ${told.version} is the newest build.`;
9266
+ return `adiff ${told.version} is installed, and ${told.latest} is out.`;
9267
+ };
9268
+ ranLine = (told) => told.latest === void 0 ? `Ran \`${told.command}\`. Run \`adiff --version\` to see what you have now.` : `Ran \`${told.command}\`, so the next adiff you run will be ${told.latest}.`;
9269
+ failedLine = (told) => `Ran \`${told.command}\` and it did not work. Run it yourself to see what it said.`;
9270
+ noteFor = (told, run) => {
9271
+ if (told.current === true) return statusOf$1(told);
9272
+ if (told.ran) return `${statusOf$1(told)} ${ranLine(told)}`;
9273
+ if (run && RUNNABLE.has(told.route)) return `${statusOf$1(told)} ${failedLine(told)}`;
9274
+ const refused = run ? " adiff will not run this one for you; run it yourself." : "";
9275
+ return `${statusOf$1(told)} ${NOTES[told.route]}${refused} Run \`${told.command}\` to upgrade.`;
9276
+ };
9277
+ offerFor = (told) => RUNNABLE.has(told.route) ? "Or run `adiff upgrade --run` and adiff runs that for you." : `Every build is listed on ${RELEASES}.`;
9278
+ restOf = (told, run) => {
9279
+ if (told.ran) return [ranLine(told)];
9280
+ if (run && RUNNABLE.has(told.route)) return [failedLine(told)];
9281
+ const refused = run ? " adiff will not run this one for you; run it yourself." : "";
9282
+ return [
9283
+ `${NOTES[told.route]}${refused}`,
9284
+ ` ${told.command}`,
9285
+ offerFor(told)
9286
+ ];
9267
9287
  };
9288
+ sayUpgrade = (told, run) => told.current === true ? statusOf$1(told) : [statusOf$1(told), ...restOf(told, run)].join("\n\n");
9268
9289
  upgradeAdiff = fn("Cli.upgradeAdiff")(function* (run) {
9269
9290
  const { executable, module } = here();
9270
9291
  const route = routeOf(executable, module);
@@ -9277,14 +9298,17 @@ var init_upgrade$1 = __esmMin((() => {
9277
9298
  current: current === true
9278
9299
  };
9279
9300
  const performed = run && RUNNABLE.has(route) && current !== true ? yield* ran(command) : false;
9280
- return {
9301
+ const told = {
9281
9302
  route,
9282
9303
  version,
9283
9304
  checked: latest !== void 0,
9284
9305
  ...known,
9285
9306
  command,
9286
- ran: performed,
9287
- note: noteFor(route, run, version, latest !== void 0)
9307
+ ran: performed
9308
+ };
9309
+ return {
9310
+ ...told,
9311
+ note: noteFor(told, run)
9288
9312
  };
9289
9313
  });
9290
9314
  }));
@@ -10150,16 +10174,21 @@ var init_catalog = __esmMin((() => {
10150
10174
  },
10151
10175
  {
10152
10176
  name: "upgrade",
10153
- about: "Work out how adiff was installed and name the one command that updates it. Prints, does not run",
10177
+ about: "Say whether a newer adiff is out and name the one command that installs it. Answers a person in plain text, and a caller in JSON with --json",
10154
10178
  safety: "read",
10155
10179
  options: [{
10156
10180
  name: "run",
10157
10181
  required: false,
10158
10182
  value: "flag",
10159
10183
  about: "Run the command instead of printing it. Ignored for a downloaded binary or a checkout, which adiff will not rewrite under itself"
10184
+ }, {
10185
+ name: "json",
10186
+ required: false,
10187
+ value: "flag",
10188
+ about: "Answer with the usual envelope instead of plain text. This is the only command that needs it"
10160
10189
  }],
10161
10190
  dataKey: "upgrade",
10162
- example: "adiff upgrade --fields route,command"
10191
+ example: "adiff upgrade --json --fields route,command"
10163
10192
  },
10164
10193
  {
10165
10194
  name: "describe",
@@ -14951,8 +14980,10 @@ const routes = {
14951
14980
  "layers show": layersShow,
14952
14981
  init,
14953
14982
  upgrade: fn("Main.upgrade")(function* (options) {
14954
- const report = yield* upgradeAdiff(options["run"] !== void 0);
14955
- yield* answer(options, { upgrade: report });
14983
+ const run = options["run"] !== void 0;
14984
+ const report = yield* upgradeAdiff(run);
14985
+ if (options["json"] !== void 0) return yield* answer(options, { upgrade: report });
14986
+ return yield* sync(() => process.stdout.write(`${sayUpgrade(report, run)}\n`));
14956
14987
  }),
14957
14988
  describe: fn("Main.describe")(function* (options) {
14958
14989
  const wanted = options["command"];
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "bin": {
24
24
  "adiff": "./bin/adiff.js"
25
25
  },
26
- "version": "0.1.0-alpha.39",
26
+ "version": "0.1.0-alpha.40",
27
27
  "description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
28
28
  "license": "MIT",
29
29
  "repository": {