@wirecat/cli-template 0.13.2 → 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.
Files changed (112) hide show
  1. package/.github/workflows/changelog-guard.yml +1 -1
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/monthly.yml +1 -1
  4. package/.github/workflows/release.yml +1 -1
  5. package/CHANGELOG.md +25 -0
  6. package/config/parity-groups.json +32 -1
  7. package/contracts/mcp-tools.json +100 -0
  8. package/dist/bin/clidev.js +6 -2
  9. package/dist/bundle/{all-profiles-MJ6XSFOO.js → all-profiles-NVB2HT2S.js} +6 -6
  10. package/dist/bundle/{anthropic-W5UKBZUB.js → anthropic-ICTW7CNQ.js} +4 -4
  11. package/dist/bundle/{app-server-EZ46JAHB.js → app-server-B6BCKXR7.js} +40 -38
  12. package/dist/bundle/{bun-HB6O2TTT.js → bun-ILPS6AYA.js} +2 -2
  13. package/dist/bundle/{bun-sqlite-KBXOW2ES.js → bun-sqlite-JE6FJFQT.js} +3 -3
  14. package/dist/bundle/{chunk-KJTNT4SW.js → chunk-2DAXUNTS.js} +2 -2
  15. package/dist/bundle/chunk-3MDNAYQA.js +34 -0
  16. package/dist/bundle/chunk-3WDYHOAF.js +91 -0
  17. package/dist/bundle/{chunk-EGRB55FF.js → chunk-45244QQ6.js} +14 -12
  18. package/dist/bundle/{chunk-JHO2LL2J.js → chunk-4PA6DJ7F.js} +7 -7
  19. package/dist/bundle/{chunk-FZZIU4B7.js → chunk-5SAF3XOL.js} +8196 -5601
  20. package/dist/bundle/chunk-62JRF2JA.js +35 -0
  21. package/dist/bundle/{chunk-TGB5F7NC.js → chunk-66VMJGV6.js} +4 -4
  22. package/dist/bundle/{chunk-V3ZTQ24B.js → chunk-6AW4DDK4.js} +4 -4
  23. package/dist/bundle/{chunk-PJOVK7PG.js → chunk-7F5VMLVK.js} +49 -24
  24. package/dist/bundle/{chunk-MFS52LTZ.js → chunk-7Z4HR6GO.js} +1 -1
  25. package/dist/bundle/{chunk-E42W72PQ.js → chunk-AS2PJNQ2.js} +7 -5
  26. package/dist/bundle/{chunk-SVDF6NJF.js → chunk-ASHVHS52.js} +14 -14
  27. package/dist/bundle/{chunk-N2Z3MCOF.js → chunk-BEBD27QT.js} +37 -35
  28. package/dist/bundle/{chunk-IGHEW777.js → chunk-BM5ZCDPQ.js} +5 -40
  29. package/dist/bundle/{chunk-AK257OMS.js → chunk-BVLPNNEL.js} +209 -78
  30. package/dist/bundle/{chunk-ERKR3VJ5.js → chunk-BWBZCYUN.js} +141 -46
  31. package/dist/bundle/{chunk-Z7MSIRSQ.js → chunk-CGFQT3LQ.js} +1 -1
  32. package/dist/bundle/{chunk-QKWRL4OD.js → chunk-DQIBGCF3.js} +6 -6
  33. package/dist/bundle/{chunk-RUKDZEID.js → chunk-DZLHY4IA.js} +3 -3
  34. package/dist/bundle/{chunk-TAYOKLGF.js → chunk-EMHCXXNJ.js} +7 -6
  35. package/dist/bundle/{chunk-IBBN7Z3A.js → chunk-F34HGYWF.js} +12 -3
  36. package/dist/bundle/{chunk-ERGB4NJA.js → chunk-G45R7M42.js} +1 -1
  37. package/dist/bundle/{chunk-ZLY6GUAS.js → chunk-G7W53MQP.js} +3 -3
  38. package/dist/bundle/{chunk-JAOGZMKQ.js → chunk-GUFPQZUA.js} +2 -2
  39. package/dist/bundle/{chunk-4LURWBVV.js → chunk-HYTHTSJP.js} +188 -22
  40. package/dist/bundle/{chunk-EFHLQXG6.js → chunk-IOJ2DTCY.js} +162 -55
  41. package/dist/bundle/{chunk-L5WWMP5M.js → chunk-IZKXJJ7V.js} +121 -31
  42. package/dist/bundle/{chunk-NOVLCHDV.js → chunk-LATYBJ4T.js} +2 -2
  43. package/dist/bundle/{chunk-QBP7OMN5.js → chunk-LFLSV353.js} +2 -2
  44. package/dist/bundle/{chunk-HDY5X3WQ.js → chunk-LU4A2T7Y.js} +4 -4
  45. package/dist/bundle/{chunk-JRK73FOW.js → chunk-NENYWEXF.js} +1 -1
  46. package/dist/bundle/{chunk-2B5U4Z5H.js → chunk-NH6LZ3H3.js} +8 -13
  47. package/dist/bundle/{chunk-OV6PHTAY.js → chunk-NVNUUHT5.js} +17130 -2232
  48. package/dist/bundle/chunk-PIJUGF5F.js +392 -0
  49. package/dist/bundle/{chunk-7IXL4UFK.js → chunk-PX2KP4QE.js} +8 -8
  50. package/dist/bundle/{chunk-KRCCGWWS.js → chunk-QXOSPYM3.js} +1 -1
  51. package/dist/bundle/{chunk-PBN4RBHS.js → chunk-R2JKPHH5.js} +8 -8
  52. package/dist/bundle/{chunk-PDGXMKJS.js → chunk-R5RYPD23.js} +2 -2
  53. package/dist/bundle/{chunk-QJ6XW4DM.js → chunk-RJ7AS7UB.js} +6210 -1207
  54. package/dist/bundle/{chunk-35KYY65W.js → chunk-SOYOOU2D.js} +3 -3
  55. package/dist/bundle/{chunk-FDBINRWA.js → chunk-TJJ2XSJP.js} +5 -5
  56. package/dist/bundle/{chunk-O3UXNU3S.js → chunk-U6QD3J3F.js} +3 -3
  57. package/dist/bundle/{chunk-YJNUDHJD.js → chunk-UT5TQ6MD.js} +139 -35
  58. package/dist/bundle/{chunk-VYSUKHKL.js → chunk-VOTEB3AN.js} +1 -1
  59. package/dist/bundle/{chunk-IN3FVRPK.js → chunk-VS5LGSTM.js} +1 -1
  60. package/dist/bundle/{chunk-MJRSEUKG.js → chunk-VXOR76ZL.js} +13 -89
  61. package/dist/bundle/{chunk-CXQXVKUY.js → chunk-YIVY2WI3.js} +1 -1
  62. package/dist/bundle/{chunk-VLNKTMV7.js → chunk-YOJLIVGO.js} +959 -350
  63. package/dist/bundle/clidev.js +3 -3
  64. package/dist/bundle/command-contract-JMVMT5HT.js +28 -0
  65. package/dist/bundle/{decode-AMXUVKNY.js → decode-NXB5UKMO.js} +18 -16
  66. package/dist/bundle/{echarts-GJDMQ2AQ.js → echarts-DRDGGHJT.js} +2 -2
  67. package/dist/bundle/{embed-L4CRZ2XQ.js → embed-IKZ24BMC.js} +4 -4
  68. package/dist/bundle/{embedder-IBGV4M2K.js → embedder-GMQ24DOQ.js} +7 -7
  69. package/dist/bundle/{first-run-VTKC2IBV.js → first-run-MDD4SIUK.js} +8 -8
  70. package/dist/bundle/first-screen-376CXGXJ.js +26 -0
  71. package/dist/bundle/{instructions-YJECS4KN.js → instructions-EOQOXY6V.js} +1 -1
  72. package/dist/bundle/{mcp-OQBZXELQ.js → mcp-7HBLFGCW.js} +2 -2
  73. package/dist/bundle/mcp-KHUZOJO6.js +82 -0
  74. package/dist/bundle/{mcp-GBSAK3VW.js → mcp-MZHWJXAE.js} +38 -37
  75. package/dist/bundle/{node-NQG4EVZR.js → node-52WF2326.js} +2 -2
  76. package/dist/bundle/{node-sqlite-BR7F3BLB.js → node-sqlite-73Z4SFOA.js} +9 -3
  77. package/dist/bundle/{oauth-J7UAWNIK.js → oauth-EVTPAMZP.js} +5 -5
  78. package/dist/bundle/{open-BR47R5UE.js → open-46WZAPJ3.js} +3 -2
  79. package/dist/bundle/openai-GWRDAHDU.js +248 -0
  80. package/dist/bundle/{process-66I7RDPJ.js → process-YIQPKLZI.js} +1 -1
  81. package/dist/bundle/{program-EM4FKOCK.js → program-B3CY3FP7.js} +11346 -9559
  82. package/dist/bundle/{prompt-NE5JJ7UP.js → prompt-IVEYRLS5.js} +3 -3
  83. package/dist/bundle/{recognize-GC3YFVIA.js → recognize-WVEKHODM.js} +4 -2
  84. package/dist/bundle/{remote-QELOMKQM.js → remote-4K5VPMC7.js} +5 -5
  85. package/dist/bundle/{rerank-BH6TZ2SP.js → rerank-V24UJZYJ.js} +5 -5
  86. package/dist/bundle/{serve-WWLRNDT2.js → serve-PJWSOV7F.js} +7 -7
  87. package/dist/bundle/server-2ZN7KZHZ.js +40 -0
  88. package/dist/bundle/server-5VYM7CCF.js +53 -0
  89. package/dist/bundle/{state-2BEGXAMO.js → state-ZPYGECVP.js} +4 -4
  90. package/dist/bundle/{store-AH6WZMCF.js → store-6JQCLPQF.js} +14 -9
  91. package/dist/bundle/store-maintenance-command-7XICIYHW.js +42 -0
  92. package/dist/version.d.ts +1 -1
  93. package/dist/version.js +1 -1
  94. package/docs/commands.md +37 -11
  95. package/docs/dev/reference-clis.md +1 -1
  96. package/docs/dev/skills/design-interview/SKILL.md +2 -2
  97. package/docs/dev/test-matrix.md +5 -1
  98. package/kit/dist/interview.js +1 -0
  99. package/kit/dist/new.js +8 -3
  100. package/package.json +3 -3
  101. package/src/program.test.ts +56 -0
  102. package/src/version.ts +1 -1
  103. package/dist/bundle/chunk-IDWW4TU2.js +0 -18
  104. package/dist/bundle/chunk-MUSYGFCY.js +0 -3556
  105. package/dist/bundle/chunk-O5EHUB2V.js +0 -2
  106. package/dist/bundle/command-contract-75VJ36U4.js +0 -29
  107. package/dist/bundle/first-screen-X5IJKBSU.js +0 -27
  108. package/dist/bundle/mcp-RDZGYPSY.js +0 -78
  109. package/dist/bundle/server-DE6NLNUF.js +0 -52
  110. package/dist/bundle/server-ZPSQKOAH.js +0 -39
  111. package/dist/bundle/store-maintenance-command-PBXX3IEV.js +0 -40
  112. /package/dist/bundle/{chunk-GOO67PDU.js → chunk-NL2DQPT7.js} +0 -0
@@ -1872,7 +1872,7 @@ var require_cli_table3 = __commonJS({
1872
1872
  }
1873
1873
  });
1874
1874
 
1875
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
1875
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/errors.js
1876
1876
  var errorCodes = [
1877
1877
  "validation_error",
1878
1878
  "configuration_error",
@@ -1887,6 +1887,7 @@ var errorCodes = [
1887
1887
  "provider_unavailable",
1888
1888
  "invalid_response",
1889
1889
  "outcome_unknown",
1890
+ "conflict",
1890
1891
  "cancelled"
1891
1892
  ];
1892
1893
  var BRAND = /* @__PURE__ */ Symbol.for("@wirecat/cli-base/CliError");
@@ -3751,7 +3752,7 @@ function toStandardJsonSchema(schema) {
3751
3752
  }
3752
3753
  __name(toStandardJsonSchema, "toStandardJsonSchema");
3753
3754
 
3754
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/registry.js
3755
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/registry.js
3755
3756
  var word = pipe(string(), regex(/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/, "a lower-case word, words joined by -"));
3756
3757
  var SNAKE_CASE = /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/;
3757
3758
  var text = pipe(string(), regex(/\S/, "must not be empty"));
@@ -3793,7 +3794,7 @@ var fill = /* @__PURE__ */ __name((template, values) => template.replace(PLACEHO
3793
3794
  return String(value);
3794
3795
  }), "fill");
3795
3796
 
3796
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
3797
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/exit-codes.js
3797
3798
  var EXIT_CODES = {
3798
3799
  validation_error: 2,
3799
3800
  configuration_error: 3,
@@ -3808,12 +3809,13 @@ var EXIT_CODES = {
3808
3809
  provider_unavailable: 12,
3809
3810
  invalid_response: 13,
3810
3811
  outcome_unknown: 14,
3812
+ conflict: 15,
3811
3813
  cancelled: 130
3812
3814
  };
3813
3815
  var exitCodeFor = /* @__PURE__ */ __name((code) => EXIT_CODES[code], "exitCodeFor");
3814
3816
  var GENERIC_FAILURE = 1;
3815
3817
 
3816
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
3818
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/sanitize.js
3817
3819
  var CONTROL = (
3818
3820
  // biome-ignore lint/suspicious/noControlCharactersInRegex: matching them is the whole point
3819
3821
  /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u200B\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF\u{E0000}-\u{E007F}]/gu
@@ -3837,7 +3839,7 @@ var visibleControls = /* @__PURE__ */ __name((text2) => {
3837
3839
  }, "visibleControls");
3838
3840
  var singleLine = /* @__PURE__ */ __name((text2) => visibleControls(text2).replace(LINE_BREAKS, escaped), "singleLine");
3839
3841
 
3840
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
3842
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/effects.js
3841
3843
  var EFFECT_LEVELS = ["none", "read", "write"];
3842
3844
  var effectsSchema = strictObject({
3843
3845
  remote: picklist(EFFECT_LEVELS),
@@ -3845,9 +3847,11 @@ var effectsSchema = strictObject({
3845
3847
  });
3846
3848
  var writes = /* @__PURE__ */ __name((effects) => effects === void 0 || effects.remote === "write" || effects.local === "write", "writes");
3847
3849
 
3848
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/output.js
3850
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/output.js
3849
3851
  var MAX_NEXT_STEPS = 2;
3852
+ var COMPACT_FLAG = "--compact";
3850
3853
  var isoTime = pipe(string(), isoTimestamp("an ISO 8601 time in UTC"), endsWith("Z", "an ISO 8601 time in UTC, ending in `Z`"));
3854
+ var localTime = pipe(string(), regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}[+-]\d{2}:\d{2}$/, "an ISO 8601 time with its offset"));
3851
3855
  var reference = pipe(string(), regex(/^[a-z]+:\S+$/, "a reference such as `note:42`"));
3852
3856
  var nextStepSchema = variant("kind", [
3853
3857
  strictObject({
@@ -3880,14 +3884,25 @@ var missingSchema = strictObject({
3880
3884
  step: optional(dottedId)
3881
3885
  });
3882
3886
  var limit = pipe(number(), integer(), minValue(1));
3887
+ var totalSchema = strictObject({
3888
+ value: pipe(number(), integer(), minValue(0)),
3889
+ relation: picklist(["eq", "gte"])
3890
+ });
3883
3891
  var pageSchema = variant("mode", [
3884
3892
  strictObject({
3885
3893
  mode: literal("page"),
3886
3894
  limit,
3887
3895
  has_more: boolean(),
3888
- next_page: optional(pipe(number(), integer(), minValue(2)))
3896
+ next_page: optional(pipe(number(), integer(), minValue(2))),
3897
+ total: optional(totalSchema)
3889
3898
  }),
3890
- strictObject({ mode: literal("cursor"), limit, has_more: boolean(), next_cursor: optional(text) })
3899
+ strictObject({
3900
+ mode: literal("cursor"),
3901
+ limit,
3902
+ has_more: boolean(),
3903
+ next_cursor: optional(text),
3904
+ total: optional(totalSchema)
3905
+ })
3891
3906
  ]);
3892
3907
  var issueSchema = strictObject({
3893
3908
  code: picklist(errorCodes),
@@ -3903,8 +3918,22 @@ var metaSchema = strictObject({
3903
3918
  issues: optional(array(issueSchema)),
3904
3919
  truncated: optional(boolean()),
3905
3920
  timezone: optional(text),
3921
+ /** When the command answered, for an agent that plans from "now" (WC-TIME-7); `timezone` names the zone of `now_local`. */
3922
+ now: optional(isoTime),
3923
+ now_local: optional(localTime),
3906
3924
  window: optional(strictObject({ since: optional(isoTime), until: optional(isoTime) }))
3907
3925
  });
3926
+ var offsetOf = /* @__PURE__ */ __name((at, zone) => {
3927
+ const name = new Intl.DateTimeFormat("en-US", { timeZone: zone, timeZoneName: "longOffset" }).formatToParts(at).find((part) => part.type === "timeZoneName")?.value ?? "GMT";
3928
+ return name === "GMT" ? "+00:00" : name.slice(3);
3929
+ }, "offsetOf");
3930
+ var clockMeta = /* @__PURE__ */ __name((at, zone) => {
3931
+ const offset = offsetOf(at, zone);
3932
+ const sign = offset.startsWith("-") ? -1 : 1;
3933
+ const [hours = 0, minutes = 0] = offset.slice(1).split(":").map(Number);
3934
+ const wall = new Date(at + sign * (hours * 60 + minutes) * 6e4).toISOString().slice(0, -1);
3935
+ return { now: new Date(at).toISOString(), now_local: `${wall}${offset}`, timezone: zone };
3936
+ }, "clockMeta");
3908
3937
  var nextSteps = optional(pipe(array(nextStepSchema), maxLength(MAX_NEXT_STEPS)));
3909
3938
  var listEnvelopeSchema = /* @__PURE__ */ __name((item) => strictObject({
3910
3939
  items: array(item),
@@ -3930,7 +3959,7 @@ var jsonlOf = /* @__PURE__ */ __name(({ items, page, meta }) => [
3930
3959
  JSON.stringify({ type: "end", complete: meta.complete, ...meta.issues ? { issues: meta.issues } : {}, page })
3931
3960
  ].join("\n"), "jsonlOf");
3932
3961
 
3933
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/errors.js
3962
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/errors.js
3934
3963
  var CRASH_CODE = "internal_error";
3935
3964
  var CRASH_REASON = "command.crashed";
3936
3965
  var errorObjectSchema = strictObject({
@@ -3977,6 +4006,12 @@ var BASE_REASONS = defineReasons([
3977
4006
  { reason: "auth.failed", code: "authentication_error", message: "the sign-in did not work", details: [] },
3978
4007
  { reason: "access.denied", code: "permission_error", message: "this account may not do that", details: [] },
3979
4008
  { reason: "item.not-found", code: "not_found", message: "nothing found by that name", details: [] },
4009
+ {
4010
+ reason: "tool.not-installed",
4011
+ code: "not_found",
4012
+ message: "no wcat-<name> program by that name is on PATH",
4013
+ details: ["tool", "installed"]
4014
+ },
3980
4015
  {
3981
4016
  reason: "confirmation.required",
3982
4017
  code: "confirmation_required",
@@ -4007,11 +4042,17 @@ var BASE_REASONS = defineReasons([
4007
4042
  details: []
4008
4043
  },
4009
4044
  { reason: "outcome.unknown", code: "outcome_unknown", message: "it is not known whether it worked", details: [] },
4045
+ {
4046
+ reason: "write.conflict",
4047
+ code: "conflict",
4048
+ message: "it changed since it was read; read it again",
4049
+ details: []
4050
+ },
4010
4051
  { reason: "command.cancelled", code: "cancelled", message: "the command was cancelled", details: [] },
4011
4052
  { reason: CRASH_REASON, code: CRASH_CODE, message: "the command failed; this is a bug", details: [] }
4012
4053
  ]);
4013
4054
 
4014
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/steps.js
4055
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/steps.js
4015
4056
  var SAME_COMMAND = "*";
4016
4057
  var commandPath = pipe(string(), regex(/^[a-z][a-z0-9-]*( [a-z][a-z0-9-]*)*$/, "a command path such as `messages sync`"));
4017
4058
  var stepSchema = union([
@@ -4090,7 +4131,7 @@ var STEPS = defineSteps([
4090
4131
  }
4091
4132
  ]);
4092
4133
 
4093
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
4134
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/failure.js
4094
4135
  var recognise = /* @__PURE__ */ __name((failure) => {
4095
4136
  if (isCliError(failure))
4096
4137
  return failure;
@@ -4237,8 +4278,8 @@ var catchCrashes = /* @__PURE__ */ __name((options) => {
4237
4278
  };
4238
4279
  }, "catchCrashes");
4239
4280
 
4240
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
4241
- import { homedir } from "node:os";
4281
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/paths.js
4282
+ import { homedir, userInfo } from "node:os";
4242
4283
  import { join, posix, win32 } from "node:path";
4243
4284
  var PATH_KINDS = ["config", "state", "cache"];
4244
4285
  var OVERRIDES = { config: "CONFIG_DIR", state: "STATE_DIR", cache: "CACHE_DIR" };
@@ -4271,9 +4312,37 @@ var resolvePaths = /* @__PURE__ */ __name((options) => {
4271
4312
  };
4272
4313
  }, "resolvePaths");
4273
4314
  var pathsAreOverridden = /* @__PURE__ */ __name(({ appName, prefix, env = process.env }) => PATH_KINDS.some((kind) => env[overrideName(appName, prefix, kind)] !== void 0), "pathsAreOverridden");
4315
+ var accountHome = /* @__PURE__ */ __name(() => {
4316
+ try {
4317
+ return userInfo().homedir;
4318
+ } catch {
4319
+ return void 0;
4320
+ }
4321
+ }, "accountHome");
4322
+ var homeIsMoved = /* @__PURE__ */ __name(({ env = process.env, platform = process.platform, home = accountHome() } = {}) => {
4323
+ if (home === void 0)
4324
+ return true;
4325
+ const appName = "app";
4326
+ const actual = defaultPaths({ appName, env, platform });
4327
+ const owners = defaultPaths({ appName, env: { HOME: home, USERPROFILE: home }, platform });
4328
+ return PATH_KINDS.some((kind) => actual[kind] !== owners[kind]);
4329
+ }, "homeIsMoved");
4330
+ var isMovedRun = /* @__PURE__ */ __name((options) => pathsAreOverridden(options) || homeIsMoved(options), "isMovedRun");
4274
4331
  var configFilePath = /* @__PURE__ */ __name((configDir, fileName = "config.json") => join(configDir, fileName), "configFilePath");
4275
4332
 
4276
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
4333
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/retry.js
4334
+ var DEFAULT_RETRY = {
4335
+ retries: 1,
4336
+ baseDelayMs: 250,
4337
+ maxDelayMs: 1e4,
4338
+ maxRetryAfterMs: 3e4
4339
+ };
4340
+ var backoffMs = /* @__PURE__ */ __name((attempt, config, random) => {
4341
+ const ceiling = Math.min(config.maxDelayMs, config.baseDelayMs * 2 ** (attempt - 1));
4342
+ return Math.round(random() * ceiling);
4343
+ }, "backoffMs");
4344
+
4345
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/result-fields.js
4277
4346
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
4278
4347
  var validate = /* @__PURE__ */ __name((paths) => {
4279
4348
  if (paths.length === 0 || paths.length > 128 || paths.some((path) => path.length > 256 || !/^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*)*$/.test(path) || path.split(".").some((part) => forbidden.has(part))))
@@ -4338,7 +4407,7 @@ var projectFields = /* @__PURE__ */ __name((value, fields) => {
4338
4407
  return project(value, fields);
4339
4408
  }, "projectFields");
4340
4409
 
4341
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
4410
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/batch.js
4342
4411
  var BATCH_LIMITS = Object.freeze({
4343
4412
  requests: 32,
4344
4413
  input_bytes: 262144,
@@ -4465,7 +4534,7 @@ var runBatch = /* @__PURE__ */ __name(async (requests, options = {}) => {
4465
4534
  };
4466
4535
  }, "runBatch");
4467
4536
 
4468
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
4537
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/config.js
4469
4538
  import { randomBytes } from "node:crypto";
4470
4539
  import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
4471
4540
  import { dirname, join as join2 } from "node:path";
@@ -4509,11 +4578,16 @@ var saveConfigFile = /* @__PURE__ */ __name((path, config) => {
4509
4578
  `, 384);
4510
4579
  }, "saveConfigFile");
4511
4580
 
4512
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
4581
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/constants.js
4582
+ var BASE_CONSTANTS = new URL("../constants.json", new URL("constants.js", import.meta.resolve("@wirecat/cli-base")).href);
4583
+ var baseConstantsSchema = object({});
4584
+ var LayerSchema = record(string(), unknown());
4585
+
4586
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
4513
4587
  import { readFileSync as readFileSync2 } from "node:fs";
4514
- import { join as join3 } from "node:path";
4588
+ import { join as join3, resolve } from "node:path";
4515
4589
 
4516
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
4590
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/keyring.js
4517
4591
  import { createRequire } from "node:module";
4518
4592
  var ENTRY_OPTIONS = { linux: { store: "secret-service" } };
4519
4593
  var require2 = createRequire(new URL("keyring.js", import.meta.resolve("@wirecat/cli-base")).href);
@@ -4533,8 +4607,9 @@ var systemKeyring = {
4533
4607
  delete: /* @__PURE__ */ __name((service, account) => entry(service, account).deletePassword(), "delete")
4534
4608
  };
4535
4609
 
4536
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
4537
- var keyringService = /* @__PURE__ */ __name((service, configDir, isolated = false) => isolated ? `${service}:${configDir}` : service, "keyringService");
4610
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/credentials.js
4611
+ var movedRunService = /* @__PURE__ */ __name((service, configDir) => `${service}:${resolve(configDir)}`, "movedRunService");
4612
+ var warnedRuns = /* @__PURE__ */ new WeakSet();
4538
4613
  var Credentials = class {
4539
4614
  static {
4540
4615
  __name(this, "Credentials");
@@ -4547,7 +4622,8 @@ var Credentials = class {
4547
4622
  #envVar;
4548
4623
  #fileName;
4549
4624
  #warn;
4550
- #warned = false;
4625
+ /** Set only for a moved run with the system keyring. */
4626
+ #temporaryService;
4551
4627
  constructor(options) {
4552
4628
  this.#configDir = options.configDir;
4553
4629
  this.#storage = options.storage ?? "auto";
@@ -4557,28 +4633,37 @@ var Credentials = class {
4557
4633
  this.#fileName = options.fileName ?? "credentials.json";
4558
4634
  this.#warn = options.warn ?? ((message) => process.stderr.write(`${message}
4559
4635
  `));
4560
- this.#service = keyringService(options.service, options.configDir, options.isolated);
4636
+ this.#service = options.service;
4637
+ const moved = this.#keyring === systemKeyring && (options.isolated === true || homeIsMoved({ env: this.#env }));
4638
+ this.#temporaryService = moved ? movedRunService(options.service, options.configDir) : void 0;
4561
4639
  }
4562
4640
  read(account) {
4563
4641
  const fromEnv = this.#envVar ? this.#env[this.#envVar]?.trim() : void 0;
4564
4642
  if (fromEnv)
4565
4643
  return { secret: fromEnv, source: "environment" };
4644
+ const fromFile = this.#storage === "keyring" ? void 0 : this.#readFile()?.[account]?.secret;
4645
+ if (fromFile)
4646
+ return { secret: fromFile, source: "file" };
4566
4647
  if (this.#storage !== "file") {
4567
- const fromKeyring = this.#tryKeyring(() => this.#keyring.get(this.#service, account));
4648
+ const temporary = this.#temporaryService;
4649
+ const fromKeyring = this.#tryKeyring(() => temporary && this.#keyring.get(temporary, account) || this.#keyring.get(this.#service, account));
4568
4650
  if (fromKeyring)
4569
4651
  return { secret: fromKeyring, source: "keyring" };
4570
4652
  }
4571
- const fromFile = this.#readFile()?.[account]?.secret;
4572
- return fromFile ? { secret: fromFile, source: "file" } : void 0;
4653
+ return void 0;
4573
4654
  }
4574
- write(account, secret) {
4575
- if (this.#storage !== "file") {
4655
+ write(account, secret, options = {}) {
4656
+ const inFile = this.#storage === "auto" && this.#readFile()?.[account] !== void 0;
4657
+ if (this.#storage === "keyring" || this.#storage === "auto" && (options.signIn || !inFile)) {
4576
4658
  const stored = this.#tryKeyring(() => {
4577
- this.#keyring.set(this.#service, account, secret);
4659
+ this.#keyring.set(this.#temporaryService ?? this.#service, account, secret);
4578
4660
  return true;
4579
4661
  });
4580
- if (stored)
4662
+ if (stored) {
4663
+ if (inFile)
4664
+ this.#removeFromFile(account);
4581
4665
  return "keyring";
4666
+ }
4582
4667
  }
4583
4668
  const store2 = this.#readFile();
4584
4669
  if (!store2) {
@@ -4590,17 +4675,34 @@ var Credentials = class {
4590
4675
  }
4591
4676
  remove(account) {
4592
4677
  const removed = [];
4593
- if (this.#storage !== "file" && this.#tryKeyring(() => this.#keyring.delete(this.#service, account))) {
4594
- removed.push("keyring");
4678
+ if (this.#storage !== "file") {
4679
+ if (this.#tryKeyring(() => this.#keyring.delete(this.#temporaryService ?? this.#service, account))) {
4680
+ removed.push("keyring");
4681
+ }
4682
+ if (this.#temporaryService && this.#ownersEntryExists(account)) {
4683
+ this.#warn(removed.includes("keyring") ? `removed this run's own sign-in of ${account} from the OS keyring and kept the owner's: a run with moved folders never removes it` : `kept ${account} in the OS keyring: it is the owner's sign-in, shared with every run, and a run with moved folders never removes it`);
4684
+ }
4595
4685
  }
4596
- const store2 = this.#readFile();
4597
- if (store2?.[account] !== void 0) {
4598
- delete store2[account];
4599
- this.#writeFile(store2);
4686
+ if (this.#storage !== "keyring" && this.#removeFromFile(account))
4600
4687
  removed.push("file");
4601
- }
4602
4688
  return removed;
4603
4689
  }
4690
+ #removeFromFile(account) {
4691
+ const store2 = this.#readFile();
4692
+ if (store2?.[account] === void 0)
4693
+ return false;
4694
+ delete store2[account];
4695
+ this.#writeFile(store2);
4696
+ return true;
4697
+ }
4698
+ /** Only for the warning: a keyring that fails here must not fail a removal that already happened. */
4699
+ #ownersEntryExists(account) {
4700
+ try {
4701
+ return this.#keyring.get(this.#service, account) !== null;
4702
+ } catch {
4703
+ return false;
4704
+ }
4705
+ }
4604
4706
  #path() {
4605
4707
  return join3(this.#configDir, this.#fileName);
4606
4708
  }
@@ -4631,8 +4733,8 @@ var Credentials = class {
4631
4733
  try {
4632
4734
  return operation();
4633
4735
  } catch (error) {
4634
- if (!this.#warned) {
4635
- this.#warned = true;
4736
+ if (!warnedRuns.has(this.#env)) {
4737
+ warnedRuns.add(this.#env);
4636
4738
  this.#warn(`could not reach the OS keyring \u2014 it may be locked, or no keyring service is running (${error instanceof Error ? error.message : String(error)}); using ${this.#path()} instead, readable only by you`);
4637
4739
  }
4638
4740
  return void 0;
@@ -4640,24 +4742,24 @@ var Credentials = class {
4640
4742
  }
4641
4743
  };
4642
4744
 
4643
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
4745
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/time.js
4644
4746
  var abortError = /* @__PURE__ */ __name(() => new DOMException("The operation was aborted.", "AbortError"), "abortError");
4645
- var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve, reject) => {
4747
+ var realSleep = /* @__PURE__ */ __name((ms, signal) => new Promise((resolve2, reject) => {
4646
4748
  if (signal?.aborted) {
4647
4749
  reject(abortError());
4648
4750
  return;
4649
4751
  }
4650
- const timer = setTimeout(resolve, ms);
4752
+ const timer = setTimeout(resolve2, ms);
4651
4753
  signal?.addEventListener("abort", () => {
4652
4754
  clearTimeout(timer);
4653
4755
  reject(abortError());
4654
4756
  }, { once: true });
4655
4757
  }), "realSleep");
4656
4758
 
4657
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
4759
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
4658
4760
  import { appendFileSync } from "node:fs";
4659
4761
 
4660
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
4762
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/standards/log.js
4661
4763
  var LOG_SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
4662
4764
  var logRecordSchema = strictObject({
4663
4765
  time: isoTime,
@@ -4735,7 +4837,7 @@ var traceIdOf = /* @__PURE__ */ __name((traceparent) => {
4735
4837
  return traceId;
4736
4838
  }, "traceIdOf");
4737
4839
 
4738
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
4840
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/logging.js
4739
4841
  var REDACTED_FIELDS = [
4740
4842
  "authorization",
4741
4843
  "Authorization",
@@ -4829,7 +4931,7 @@ var silent = {
4829
4931
  }, "error")
4830
4932
  };
4831
4933
 
4832
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
4934
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/pretty.js
4833
4935
  var import_cli_table3 = __toESM(require_cli_table3(), 1);
4834
4936
  import { styleText } from "node:util";
4835
4937
  var renderPretty = /* @__PURE__ */ __name((value, options) => {
@@ -4903,7 +5005,7 @@ var BORDERLESS = {
4903
5005
  middle: ""
4904
5006
  };
4905
5007
 
4906
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
5008
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/drain.js
4907
5009
  var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
4908
5010
  if (signal?.aborted)
4909
5011
  return Promise.reject(signal.reason);
@@ -4911,14 +5013,14 @@ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
4911
5013
  return Promise.reject(new Error("output stream closed"));
4912
5014
  if (!stream.writableNeedDrain)
4913
5015
  return Promise.resolve();
4914
- return new Promise((resolve, reject) => {
5016
+ return new Promise((resolve2, reject) => {
4915
5017
  const cleanup = /* @__PURE__ */ __name(() => {
4916
5018
  stream.off("drain", drained).off("error", failed).off("close", closed);
4917
5019
  signal?.removeEventListener("abort", aborted);
4918
5020
  }, "cleanup");
4919
5021
  const drained = /* @__PURE__ */ __name(() => {
4920
5022
  cleanup();
4921
- resolve();
5023
+ resolve2();
4922
5024
  }, "drained");
4923
5025
  const failed = /* @__PURE__ */ __name((error) => {
4924
5026
  cleanup();
@@ -4931,7 +5033,7 @@ var waitForDrain = /* @__PURE__ */ __name((stream, signal) => {
4931
5033
  });
4932
5034
  }, "waitForDrain");
4933
5035
 
4934
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
5036
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/streams.js
4935
5037
  var processStreams = {
4936
5038
  drain: /* @__PURE__ */ __name(async (signal) => {
4937
5039
  await Promise.all([waitForDrain(process.stdout, signal), waitForDrain(process.stderr, signal)]);
@@ -4960,7 +5062,7 @@ var captureStreams = /* @__PURE__ */ __name(() => {
4960
5062
  };
4961
5063
  }, "captureStreams");
4962
5064
 
4963
- // node_modules/.pnpm/@wirecat+cli-base@0.65.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
5065
+ // node_modules/.pnpm/@wirecat+cli-base@0.77.1_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/renderer.js
4964
5066
  var createRenderer = /* @__PURE__ */ __name(({ format, color, streams = processStreams, quiet = false }) => {
4965
5067
  const mark = /* @__PURE__ */ __name((symbol, message) => format === "pretty" ? `${symbol} ${visibleControls(message)}` : visibleControls(message), "mark");
4966
5068
  const say = /* @__PURE__ */ __name((symbol) => (message) => {
@@ -5061,9 +5163,11 @@ export {
5061
5163
  duplicates,
5062
5164
  jsonSchemaOf,
5063
5165
  MAX_NEXT_STEPS,
5166
+ COMPACT_FLAG,
5064
5167
  isoTime,
5065
5168
  reference,
5066
5169
  pageSchema,
5170
+ clockMeta,
5067
5171
  listEnvelopeSchema,
5068
5172
  itemEnvelopeSchema,
5069
5173
  jsonlOf,
@@ -5088,6 +5192,10 @@ export {
5088
5192
  writeSecurely,
5089
5193
  loadConfigFile,
5090
5194
  saveConfigFile,
5195
+ resolvePaths,
5196
+ pathsAreOverridden,
5197
+ isMovedRun,
5198
+ configFilePath,
5091
5199
  Credentials,
5092
5200
  realSleep,
5093
5201
  defineLogEvents,
@@ -5095,10 +5203,9 @@ export {
5095
5203
  traceIdOf,
5096
5204
  logRecordOf,
5097
5205
  createRecordLog,
5098
- resolvePaths,
5099
- pathsAreOverridden,
5100
- configFilePath,
5101
5206
  processStreams,
5102
5207
  captureStreams,
5103
- createRenderer
5208
+ createRenderer,
5209
+ DEFAULT_RETRY,
5210
+ backoffMs
5104
5211
  };