lurqrun 0.1.7 → 0.1.9

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 (122) hide show
  1. package/README.md +312 -148
  2. package/dist/{auditHandler-JCOJSUYW.js → auditHandler-G7PHKMZR.js} +12 -11
  3. package/dist/autopilotInit-JO2SH5K3.js +266 -0
  4. package/dist/bin/lurq.js +238 -83
  5. package/dist/{browserAuth-B6G27USY.js → browserAuth-PVYODBNR.js} +4 -3
  6. package/dist/{cache-DKI34SVS.js → cache-ND4VOUVY.js} +2 -2
  7. package/dist/check-A3FJE62G.js +2613 -0
  8. package/dist/{check-2FDGUOV7.js → check-PQSQ2MMA.js} +1 -1
  9. package/dist/checkUpgrade-Q4CV7GXG.js +24 -0
  10. package/dist/{chunk-BCANRN5B.js → chunk-2GAYNIHG.js} +8 -1
  11. package/dist/chunk-2LXYRDUN.js +92 -0
  12. package/dist/chunk-2XMD4H2I.js +243 -0
  13. package/dist/chunk-3D2MPGOQ.js +181 -0
  14. package/dist/chunk-53SG6XWA.js +141 -0
  15. package/dist/chunk-5ABNDB3I.js +37 -0
  16. package/dist/chunk-5ALIJFDA.js +114 -0
  17. package/dist/{chunk-LYMPYETA.js → chunk-6353IJJ5.js} +270 -6
  18. package/dist/{chunk-M6NYEXCW.js → chunk-64DPQSXV.js} +1 -1
  19. package/dist/chunk-64YOP5BQ.js +320 -0
  20. package/dist/{chunk-2VMOWSRY.js → chunk-6DM6UQFD.js} +19 -1
  21. package/dist/{chunk-NH5I4KHH.js → chunk-75LMEMJ3.js} +1 -5
  22. package/dist/{chunk-FW6BD2NO.js → chunk-ABH4BTK4.js} +458 -121
  23. package/dist/chunk-AHRDDKNO.js +90 -0
  24. package/dist/chunk-AQ6IVSFB.js +119 -0
  25. package/dist/chunk-BM3LF5T6.js +132 -0
  26. package/dist/chunk-D3K6IZVR.js +12845 -0
  27. package/dist/chunk-DONTW3NE.js +171 -0
  28. package/dist/{chunk-UDVNA7EA.js → chunk-ETY4FSOW.js} +161 -8
  29. package/dist/{chunk-VL2E5T2A.js → chunk-FHRT32JH.js} +6 -3
  30. package/dist/{chunk-DWAGCNEL.js → chunk-GM5Y555O.js} +36 -103
  31. package/dist/{chunk-6L3U7DZ5.js → chunk-GNNGXVCG.js} +1 -1
  32. package/dist/{chunk-PSX3GIAN.js → chunk-HWFX4BC4.js} +2 -1
  33. package/dist/{checkUpgrade-F2WESBPM.js → chunk-ILKYIVYV.js} +72 -10
  34. package/dist/{chunk-HWBBVLOT.js → chunk-J3NUERU7.js} +1 -1
  35. package/dist/chunk-J3U2CPSK.js +136 -0
  36. package/dist/{chunk-Y5GI7RL3.js → chunk-J6XQ7OPZ.js} +9 -1
  37. package/dist/{chunk-3N3Q3DSW.js → chunk-JGIJZJ3X.js} +8 -8
  38. package/dist/{chunk-DB2VF5UD.js → chunk-JJCQVOC6.js} +16 -11
  39. package/dist/{chunk-LBFGSSF2.js → chunk-KMV4Y6R3.js} +2 -1
  40. package/dist/{chunk-L6N4JFW2.js → chunk-KP5ZDDPE.js} +81 -4
  41. package/dist/{chunk-CW5HJ3LX.js → chunk-KT7PWDNV.js} +1 -1
  42. package/dist/{chunk-SJOVFF7B.js → chunk-KYKSZ3XZ.js} +3 -2
  43. package/dist/{chunk-GPTKSNR6.js → chunk-L3V7AVM6.js} +2 -1
  44. package/dist/{chunk-CUP36ND3.js → chunk-M2CYYBAH.js} +145 -36
  45. package/dist/{chunk-IQ4SDKKY.js → chunk-N2NYPTRU.js} +31 -228
  46. package/dist/chunk-N4TJO44E.js +603 -0
  47. package/dist/chunk-NEZNAPPN.js +41 -0
  48. package/dist/{chunk-WQ23REYT.js → chunk-NGMJQBOV.js} +1 -1
  49. package/dist/{chunk-BULZAX2U.js → chunk-POHTPT37.js} +55 -38
  50. package/dist/{chunk-EA3DP5HG.js → chunk-PZZU3FQY.js} +155 -25
  51. package/dist/{chunk-4F7ZESPO.js → chunk-Q7CMOU5C.js} +3 -5
  52. package/dist/{chunk-LRD4GBYE.js → chunk-QUIMQ7YL.js} +1 -1
  53. package/dist/chunk-RG3YLU6E.js +49 -0
  54. package/dist/{chunk-4ZYCIMY4.js → chunk-SFY5MPJE.js} +25 -4
  55. package/dist/{chunk-ST2X2GYN.js → chunk-SHZFOSXC.js} +109 -20
  56. package/dist/{chunk-CIDWNUAP.js → chunk-SOXFMMXC.js} +8 -2
  57. package/dist/{chunk-B43LCXBM.js → chunk-SWMWVK2R.js} +81 -16
  58. package/dist/{chunk-J5FZYN4A.js → chunk-TVOCVIM7.js} +1 -1
  59. package/dist/{chunk-U5AT3TD4.js → chunk-X4W64MHU.js} +1735 -1858
  60. package/dist/{chunk-BV32UNLL.js → chunk-XA2SLNBR.js} +2 -2
  61. package/dist/{chunk-AHBP533R.js → chunk-XBTYJQEK.js} +7 -5
  62. package/dist/chunk-XGOV6KV4.js +413 -0
  63. package/dist/{chunk-OQS4GUSI.js → chunk-XIFQIFSZ.js} +210 -661
  64. package/dist/{chunk-XBIDMHSK.js → chunk-XLXPVN3Y.js} +2 -34
  65. package/dist/{chunk-LO35HLQZ.js → chunk-ZJ5XHA77.js} +25 -4
  66. package/dist/{client-IRKAMDYZ.js → client-SJIWK4CK.js} +3 -3
  67. package/dist/{commands-FIL5ET6P.js → commands-6BBLN5N5.js} +145 -33
  68. package/dist/{compat-R3UTFQ5Q.js → compat-6B3CRT5F.js} +6 -6
  69. package/dist/constants-HX3RTD6Q.js +24 -0
  70. package/dist/{dashboardIssue-WYYMBFIB.js → dashboardIssue-KBKLQMGC.js} +105 -23
  71. package/dist/{diff-GZA2774U.js → diff-I4SNUHU3.js} +1 -1
  72. package/dist/domains-RKRPVP5A.js +14 -0
  73. package/dist/env-UN6KGZ7S.js +15 -0
  74. package/dist/envCheck-IL22OTSC.js +71 -0
  75. package/dist/{extract-NKGKLIVT.js → extract-6WG265BL.js} +14 -3
  76. package/dist/{fetch-QYTUJVG2.js → fetch-GHIP3VHN.js} +4 -4
  77. package/dist/{firstTouch-QQTJH4QX.js → firstTouch-M64T2MWF.js} +1 -1
  78. package/dist/fix-Z7ZY55HB.js +220 -0
  79. package/dist/{handlers-GEJAVZDK.js → handlers-GOXW2GWZ.js} +19 -17
  80. package/dist/hook-TWFLIDK3.js +412 -0
  81. package/dist/{http-ETPYMBGD.js → http-7VF2RE2D.js} +2097 -509
  82. package/dist/{ingestQueue-VKN4KBIF.js → ingestQueue-RSEPMORK.js} +14 -12
  83. package/dist/{install-EK3W2COX.js → install-55EPX34C.js} +6 -6
  84. package/dist/{installSkill-VQJWJVCL.js → installSkill-A7KKPDMS.js} +21 -3
  85. package/dist/manifest-ENMIC54B.js +13 -0
  86. package/dist/{mcp-3JHD5SUZ.js → mcp-CM6CDLHM.js} +60 -32
  87. package/dist/mcpConfig-FENV6NI7.js +80 -0
  88. package/dist/{mcpHandlers-QFN4MCFL.js → mcpHandlers-2UCLKMWN.js} +7 -7
  89. package/dist/{mcpScan-QZHWENIP.js → mcpScan-CKBQNK5H.js} +306 -442
  90. package/dist/{mcpScanWorkflow-JPYCBGC4.js → mcpScanWorkflow-NFUD3S7U.js} +29 -12
  91. package/dist/{mcpStack-BYJCZNIV.js → mcpStack-FLQ6XY2P.js} +1 -1
  92. package/dist/model-ASMZWLM7.js +214 -0
  93. package/dist/{packages-THVFMWFP.js → packages-2XRHNBJ7.js} +3 -5
  94. package/dist/{plan-V4OEI3J4.js → plan-XRZS6C7Z.js} +23 -21
  95. package/dist/{planView-JRXGCG2N.js → planView-ZAKRTGVS.js} +4 -1
  96. package/dist/{policy-3P6BGRDN.js → policy-EQT43P7S.js} +5 -5
  97. package/dist/probe-ZEZFNIQZ.js +610 -0
  98. package/dist/publicUpgrades-JZEOV24A.js +42 -0
  99. package/dist/{references-6N7VEPHT.js → references-I6Y4BSRR.js} +3 -1
  100. package/dist/{release-4U4ABNSJ.js → release-EUOM5I3R.js} +5 -5
  101. package/dist/{remote-YGCXYI4V.js → remote-I5O43WAY.js} +13 -3
  102. package/dist/rename-OS6JYBZQ.js +204 -0
  103. package/dist/{reportRuns-CKQQYLY4.js → reportRuns-O4X7ZFTX.js} +15 -2
  104. package/dist/safeFetch-COERXGFN.js +19 -0
  105. package/dist/{sandbox-MEZLAODF.js → sandbox-46TZNYZT.js} +4 -4
  106. package/dist/sarif-WLVJFJ7U.js +125 -0
  107. package/dist/server-LROMHS62.js +59 -0
  108. package/dist/{surface-YL6O67W3.js → surface-CZMHQLV3.js} +5 -3
  109. package/dist/{surface-V62GE554.js → surface-OH4TZR32.js} +18 -16
  110. package/dist/{surfaceHandlers-X2IZKA3E.js → surfaceHandlers-BDYRZMAC.js} +5 -5
  111. package/dist/{typecheck-X7U5ELMR.js → typecheck-NGOKNAJY.js} +23 -9
  112. package/dist/{uninstall-P7RGBX6G.js → uninstall-4E5YUDQO.js} +30 -4
  113. package/dist/{upgrade-NQ5IWFZB.js → upgrade-S72W7JVC.js} +86 -32
  114. package/dist/{upgradePlan-A4LRKLEG.js → upgradePlan-F3OUNL3E.js} +46 -11
  115. package/dist/upkeepHandler-7Q56A4UA.js +13 -0
  116. package/dist/{userConfig-Z3GQE776.js → userConfig-ICASHI47.js} +1 -1
  117. package/dist/{watch-DGFMWUDL.js → watch-LZPOKWCL.js} +24 -34
  118. package/package.json +3 -2
  119. package/templates/skill-instructions.md +22 -3
  120. package/dist/chunk-6AAEVQ7I.js +0 -6336
  121. package/dist/chunk-I2JUKN6Z.js +0 -24
  122. package/dist/server-KFUD5X57.js +0 -55
package/dist/bin/lurq.js CHANGED
@@ -9,27 +9,30 @@ import {
9
9
  import "../chunk-WHX2ZFCG.js";
10
10
  import {
11
11
  withSetupOnMissingKey
12
- } from "../chunk-EA3DP5HG.js";
13
- import "../chunk-4ZYCIMY4.js";
14
- import "../chunk-TNTXWSYA.js";
12
+ } from "../chunk-PZZU3FQY.js";
15
13
  import {
16
14
  yellow
17
15
  } from "../chunk-4KCPOMG6.js";
18
16
  import {
19
17
  SUPPORTED_AGENTS
20
- } from "../chunk-UDVNA7EA.js";
18
+ } from "../chunk-ETY4FSOW.js";
21
19
  import "../chunk-LUAKDHLZ.js";
22
20
  import {
23
21
  logger
24
22
  } from "../chunk-MYGSLK44.js";
25
- import "../chunk-Y5GI7RL3.js";
23
+ import "../chunk-SFY5MPJE.js";
24
+ import {
25
+ readUserConfig,
26
+ resolveApiKey
27
+ } from "../chunk-J6XQ7OPZ.js";
28
+ import "../chunk-TNTXWSYA.js";
26
29
  import {
27
30
  KEYS_URL,
28
31
  PACKAGE_NAME,
29
32
  SERVER_NAME,
30
33
  VERSION,
31
34
  package_default
32
- } from "../chunk-GPTKSNR6.js";
35
+ } from "../chunk-L3V7AVM6.js";
33
36
  import {
34
37
  __commonJS,
35
38
  __require,
@@ -1804,12 +1807,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
1804
1807
  *
1805
1808
  * @private
1806
1809
  */
1807
- _prepareUserArgs(argv, parseOptions) {
1808
- if (argv !== void 0 && !Array.isArray(argv)) {
1810
+ _prepareUserArgs(argv2, parseOptions) {
1811
+ if (argv2 !== void 0 && !Array.isArray(argv2)) {
1809
1812
  throw new Error("first parameter to parse must be array or undefined");
1810
1813
  }
1811
1814
  parseOptions = parseOptions || {};
1812
- if (argv === void 0 && parseOptions.from === void 0) {
1815
+ if (argv2 === void 0 && parseOptions.from === void 0) {
1813
1816
  if (process2.versions?.electron) {
1814
1817
  parseOptions.from = "electron";
1815
1818
  }
@@ -1818,30 +1821,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
1818
1821
  parseOptions.from = "eval";
1819
1822
  }
1820
1823
  }
1821
- if (argv === void 0) {
1822
- argv = process2.argv;
1824
+ if (argv2 === void 0) {
1825
+ argv2 = process2.argv;
1823
1826
  }
1824
- this.rawArgs = argv.slice();
1827
+ this.rawArgs = argv2.slice();
1825
1828
  let userArgs;
1826
1829
  switch (parseOptions.from) {
1827
1830
  case void 0:
1828
1831
  case "node":
1829
- this._scriptPath = argv[1];
1830
- userArgs = argv.slice(2);
1832
+ this._scriptPath = argv2[1];
1833
+ userArgs = argv2.slice(2);
1831
1834
  break;
1832
1835
  case "electron":
1833
1836
  if (process2.defaultApp) {
1834
- this._scriptPath = argv[1];
1835
- userArgs = argv.slice(2);
1837
+ this._scriptPath = argv2[1];
1838
+ userArgs = argv2.slice(2);
1836
1839
  } else {
1837
- userArgs = argv.slice(1);
1840
+ userArgs = argv2.slice(1);
1838
1841
  }
1839
1842
  break;
1840
1843
  case "user":
1841
- userArgs = argv.slice(0);
1844
+ userArgs = argv2.slice(0);
1842
1845
  break;
1843
1846
  case "eval":
1844
- userArgs = argv.slice(1);
1847
+ userArgs = argv2.slice(1);
1845
1848
  break;
1846
1849
  default:
1847
1850
  throw new Error(
@@ -1875,8 +1878,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1875
1878
  * @param {string} [parseOptions.from] - where the args are from: 'node', 'user', 'electron'
1876
1879
  * @return {Command} `this` command for chaining
1877
1880
  */
1878
- parse(argv, parseOptions) {
1879
- const userArgs = this._prepareUserArgs(argv, parseOptions);
1881
+ parse(argv2, parseOptions) {
1882
+ const userArgs = this._prepareUserArgs(argv2, parseOptions);
1880
1883
  this._parseCommand([], userArgs);
1881
1884
  return this;
1882
1885
  }
@@ -1900,8 +1903,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
1900
1903
  * @param {string} parseOptions.from - where the args are from: 'node', 'user', 'electron'
1901
1904
  * @return {Promise}
1902
1905
  */
1903
- async parseAsync(argv, parseOptions) {
1904
- const userArgs = this._prepareUserArgs(argv, parseOptions);
1906
+ async parseAsync(argv2, parseOptions) {
1907
+ const userArgs = this._prepareUserArgs(argv2, parseOptions);
1905
1908
  await this._parseCommand([], userArgs);
1906
1909
  return this;
1907
1910
  }
@@ -2350,11 +2353,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2350
2353
  * @param {string[]} argv
2351
2354
  * @return {{operands: string[], unknown: string[]}}
2352
2355
  */
2353
- parseOptions(argv) {
2356
+ parseOptions(argv2) {
2354
2357
  const operands = [];
2355
2358
  const unknown = [];
2356
2359
  let dest = operands;
2357
- const args = argv.slice();
2360
+ const args = argv2.slice();
2358
2361
  function maybeOption(arg) {
2359
2362
  return arg.length > 1 && arg[0] === "-";
2360
2363
  }
@@ -3047,6 +3050,76 @@ var require_commander = __commonJS({
3047
3050
  // src/bin/lurq.ts
3048
3051
  init_esm_shims();
3049
3052
 
3053
+ // src/cli/autoHooks.ts
3054
+ init_esm_shims();
3055
+ import { mkdirSync, statSync, writeFileSync } from "fs";
3056
+ import { homedir } from "os";
3057
+ import { join } from "path";
3058
+ var DAY_MS = 24 * 60 * 60 * 1e3;
3059
+ var SKIP = /* @__PURE__ */ new Set(["setup", "uninstall", "logout", "install-skill", "serve-http"]);
3060
+ function planHookMaintenance(states) {
3061
+ return states.flatMap((s) => {
3062
+ if (!s.hasEntry) return [];
3063
+ if (s.recorded === void 0)
3064
+ return [{ agent: s.agent, kind: s.hooksPresent ? "refresh" : "install" }];
3065
+ if (!s.hooksPresent) return [];
3066
+ return s.recorded === s.current ? [] : [{ agent: s.agent, kind: "refresh" }];
3067
+ });
3068
+ }
3069
+ function stampPath() {
3070
+ return join(process.env.XDG_CACHE_HOME || join(homedir(), ".cache"), "lurq", "hooks-check");
3071
+ }
3072
+ async function maintainHooks(argv2, now = Date.now()) {
3073
+ try {
3074
+ if (SKIP.has(argv2[0] ?? "") || process.env.LURQ_NO_AUTO_HOOKS === "1") return;
3075
+ const stamp = stampPath();
3076
+ try {
3077
+ if (now - statSync(stamp).mtimeMs < DAY_MS) return;
3078
+ } catch {
3079
+ }
3080
+ const config = readUserConfig();
3081
+ if (config.autoHooks === false || !resolveApiKey()) return;
3082
+ mkdirSync(join(stamp, ".."), { recursive: true });
3083
+ writeFileSync(stamp, "");
3084
+ const skill = await import("../installSkill-A7KKPDMS.js");
3085
+ const invocation = skill.lurqInvocation();
3086
+ if (!invocation.onPath) return;
3087
+ const states = skill.agentSpecs().flatMap((spec) => {
3088
+ const agent = skill.hookAgentFor(spec.id);
3089
+ if (!agent) return [];
3090
+ try {
3091
+ return [
3092
+ {
3093
+ agent,
3094
+ hasEntry: skill.hasLurqEntry(spec),
3095
+ hooksPresent: skill.hasLurqHooks(skill.readJsonObject(skill.hooksPath(agent))),
3096
+ recorded: config.hooks?.[agent]?.command,
3097
+ current: skill.lurqCommandFor(agent, invocation)
3098
+ }
3099
+ ];
3100
+ } catch {
3101
+ return [];
3102
+ }
3103
+ });
3104
+ const added = [];
3105
+ for (const action of planHookMaintenance(states)) {
3106
+ try {
3107
+ if (skill.installHooks(action.agent, void 0, invocation) && action.kind === "install")
3108
+ added.push(action.agent);
3109
+ } catch {
3110
+ }
3111
+ }
3112
+ if (added.length && process.stderr.isTTY) {
3113
+ const names = added.map((a) => skill.hooksLabel(a).replace(/ hooks$/, "")).join(", ");
3114
+ process.stderr.write(
3115
+ `lurq: turned on install checks for ${names}.${added.includes("codex") ? " In Codex, run /hooks once to trust them." : ""} Turn this off with LURQ_NO_AUTO_HOOKS=1.
3116
+ `
3117
+ );
3118
+ }
3119
+ } catch {
3120
+ }
3121
+ }
3122
+
3050
3123
  // src/cli/index.ts
3051
3124
  init_esm_shims();
3052
3125
 
@@ -3083,64 +3156,70 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3083
3156
  if (cmd.args.length > 0) {
3084
3157
  program2.unknownCommand();
3085
3158
  }
3086
- const { resolveApiKey } = await import("../userConfig-Z3GQE776.js");
3087
- if (resolveApiKey()) {
3159
+ const { resolveApiKey: resolveApiKey2 } = await import("../userConfig-ICASHI47.js");
3160
+ if (resolveApiKey2()) {
3088
3161
  program2.outputHelp();
3089
3162
  return;
3090
3163
  }
3091
- const { runSetup } = await import("../install-EK3W2COX.js");
3164
+ const { runSetup } = await import("../install-55EPX34C.js");
3092
3165
  await runSetup({});
3093
3166
  });
3094
- program2.command("setup").aliases(["install", "login"]).description("one-time setup: store your API key, wire up your assistants and skills").option("--api-key <key>", "hosted API key (skips the prompt)").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--agent <agent>", AGENT_CHOICES).option("--yes", "non-interactive: use flags/env and detected agents without prompting").option("--no-open", "don't launch a browser (headless boxes, SSH, CI)").action(
3167
+ program2.command("setup").aliases(["install", "login"]).description("one-time setup: store your API key, wire up your assistants and skills").option("--api-key <key>", "hosted API key (skips the prompt)").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--agent <agent>", AGENT_CHOICES).option("--yes", "non-interactive: use flags/env and detected agents without prompting").option("--no-open", "don't launch a browser (headless boxes, SSH, CI)").addOption(new Option("--wait-for-signin").hideHelp()).action(
3095
3168
  async (opts) => {
3096
- const { runSetup } = await import("../install-EK3W2COX.js");
3169
+ const { runSetup } = await import("../install-55EPX34C.js");
3097
3170
  await runSetup({ ...opts, noOpen: opts.open === false });
3098
3171
  }
3099
3172
  );
3173
+ const autopilot = program2.command("autopilot").description("set up and inspect the upgrade autopilot for a repository");
3174
+ autopilot.command("init").description("turn the autopilot on for one or many repositories: secret, workflow, first run").option("--repo <owner/name...>", "one or more repositories (default: this checkout's origin)").option("--mode <mode>", "comment, fix, or pr (default: fix \u2014 opens PRs, needs no model)").option("--api-key <key>", "lurq API key (defaults to the stored one, then $LURQ_API_KEY)").option("--no-credential", "skip the Anthropic credential step in pr mode").option("--force", "replace a workflow that is already committed").option(
3175
+ "--pr",
3176
+ "open a pull request in each repository instead of committing to the default branch"
3177
+ ).option("--json", "machine-readable summary").action(async (opts) => {
3178
+ const { runAutopilotInit } = await import("../autopilotInit-JO2SH5K3.js");
3179
+ await runAutopilotInit(opts);
3180
+ });
3100
3181
  program2.command("logout").description("remove the stored API key from this machine").action(async () => {
3101
- const { clearUserConfig, userConfigPath } = await import("../userConfig-Z3GQE776.js");
3182
+ const { clearUserConfig, userConfigPath } = await import("../userConfig-ICASHI47.js");
3102
3183
  const path = userConfigPath();
3103
3184
  console.log(
3104
3185
  clearUserConfig() ? `Removed ${path}. Your agents' MCP configs still hold the key: \`lurq uninstall\` removes those too.` : "No stored API key on this machine. To remove lurq from your agents, run `lurq uninstall`."
3105
3186
  );
3106
3187
  });
3107
3188
  program2.command("uninstall").description("undo setup: remove lurq's MCP entries, agent instructions and the stored key").option("--agent <agent>", `only this agent: ${AGENT_CHOICES}`).option("--yes", "remove without asking").action(async (opts) => {
3108
- const { runUninstall } = await import("../uninstall-P7RGBX6G.js");
3189
+ const { runUninstall } = await import("../uninstall-4E5YUDQO.js");
3109
3190
  await runUninstall(opts);
3110
3191
  });
3111
3192
  const policy = program2.command("policy").description("keep your selection policy in a file: pull it, review it, push it");
3112
3193
  policy.command("pull").argument("[file]", "write the policy here (default: stdout)").description("download the policy your agents are held to").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").action(async (file, opts) => {
3113
- const { runPolicyPull } = await import("../policy-3P6BGRDN.js");
3194
+ const { runPolicyPull } = await import("../policy-EQT43P7S.js");
3114
3195
  await runPolicyPull(file, opts);
3115
3196
  });
3116
- policy.command("push").argument("<file>", "policy JSON, as written by `lurq policy pull`").description("replace the policy with this file (needs a policy:write key)").option("--check", "validate the file only; send nothing (for PR checks)").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").action(
3117
- async (file, opts) => {
3118
- const { runPolicyPush } = await import("../policy-3P6BGRDN.js");
3119
- await runPolicyPush(file, opts);
3120
- }
3121
- );
3197
+ policy.command("push").argument("<file>", "policy JSON, as written by `lurq policy pull`").description("replace the policy with this file (needs a policy:write key)").option("--check", "validate the file only; send nothing (for PR checks)").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").action(async (file, opts) => {
3198
+ const { runPolicyPush } = await import("../policy-EQT43P7S.js");
3199
+ await runPolicyPush(file, opts);
3200
+ });
3122
3201
  policy.command("history").description("who changed the policy, from where, and what changed").option("--json", "output the changes as JSON").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").action(async (opts) => {
3123
- const { runPolicyHistory } = await import("../policy-3P6BGRDN.js");
3202
+ const { runPolicyHistory } = await import("../policy-EQT43P7S.js");
3124
3203
  await runPolicyHistory(opts);
3125
3204
  });
3126
3205
  policy.command("log").description("packages the policy refused, or warned about, grouped by rule").option("--days <n>", "look back this many days, 1 to 365 (default 30)").option("--json", "output the log as JSON").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").action(async (opts) => {
3127
- const { runPolicyLog } = await import("../policy-3P6BGRDN.js");
3206
+ const { runPolicyLog } = await import("../policy-EQT43P7S.js");
3128
3207
  await runPolicyLog(opts);
3129
3208
  });
3130
3209
  program2.command("can").argument("[query...]", "what you are trying to do, in plain words").description("find the lurq capability for what you are trying to do").option("--json", "output matches as JSON").action(async (query, opts) => {
3131
- const { runCan } = await import("../commands-FIL5ET6P.js");
3210
+ const { runCan } = await import("../commands-6BBLN5N5.js");
3132
3211
  runCan(query.join(" "), opts);
3133
3212
  });
3134
3213
  program2.command("evaluate").argument("<package>", "npm package name").description("full evidence read for one package (scores, signals, usage guide)").option("--json", "output JSON instead of a table").action(async (pkg, opts) => {
3135
- const { runEvaluate } = await import("../commands-FIL5ET6P.js");
3214
+ const { runEvaluate } = await import("../commands-6BBLN5N5.js");
3136
3215
  await runEvaluate(pkg, opts);
3137
3216
  });
3138
3217
  program2.command("compare").argument("<packages...>", "2\u20135 npm package names").description("side-by-side comparison of packages, ranked by health").option("--json", "output JSON instead of a table").action(async (pkgs, opts) => {
3139
- const { runCompare } = await import("../commands-FIL5ET6P.js");
3218
+ const { runCompare } = await import("../commands-6BBLN5N5.js");
3140
3219
  await runCompare(pkgs, opts);
3141
3220
  });
3142
3221
  program2.command("verify").argument("<package>", "npm package name").description("safety check: is this package real, healthy, and not risky?").option("--json", "output JSON instead of a table").action(async (pkg, opts) => {
3143
- const { runVerify } = await import("../commands-FIL5ET6P.js");
3222
+ const { runVerify } = await import("../commands-6BBLN5N5.js");
3144
3223
  await runVerify(pkg, opts);
3145
3224
  });
3146
3225
  program2.command("usage").argument("<package>", "npm package name").description(
@@ -3151,7 +3230,7 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3151
3230
  (v) => Math.max(0, parseInt(v, 10) || 0)
3152
3231
  ).option("--json", "output JSON").action(
3153
3232
  async (pkg, opts) => {
3154
- const { runUsage } = await import("../commands-FIL5ET6P.js");
3233
+ const { runUsage } = await import("../commands-6BBLN5N5.js");
3155
3234
  await runUsage(pkg, {
3156
3235
  version: opts.target ?? opts.version,
3157
3236
  known: opts.known,
@@ -3162,18 +3241,18 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3162
3241
  }
3163
3242
  );
3164
3243
  program2.command("versions").argument("<package>", "npm package name").description("show the stored version timeline for a package").option("--json", "output JSON instead of a table").option("-n, --limit <n>", "how many versions to show (default 30)").action(async (pkg, opts) => {
3165
- const { runVersions } = await import("../commands-FIL5ET6P.js");
3244
+ const { runVersions } = await import("../commands-6BBLN5N5.js");
3166
3245
  await runVersions(pkg, opts);
3167
3246
  });
3168
3247
  program2.command("compat").argument("<packages...>", "npm package names to check together").description(
3169
3248
  "check whether a set of packages forms a coherent stack (peer/engine + recorded evidence)"
3170
3249
  ).option("--pin <name=version...>", "evaluate an exact version, e.g. --pin next=15").option("--json", "output JSON").action(async (pkgs, opts) => {
3171
- const { runCompat } = await import("../commands-FIL5ET6P.js");
3250
+ const { runCompat } = await import("../commands-6BBLN5N5.js");
3172
3251
  await runCompat(pkgs, opts);
3173
3252
  });
3174
3253
  program2.command("upgrade-plan").argument("[dir]", "project directory (default: current)", ".").description("what is behind in this project, and what each upgrade removes from its API").option("--json", "output the plan as JSON (feed to `check-upgrade --plan`)").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").option("--repo <owner/name>", "apply this repo's policy (defaults to $GITHUB_REPOSITORY)").action(
3175
3254
  async (dir, opts) => {
3176
- const { buildUpgradePlan, formatUpgradePlan } = await import("../upgradePlan-A4LRKLEG.js");
3255
+ const { buildUpgradePlan, formatUpgradePlan } = await import("../upgradePlan-F3OUNL3E.js");
3177
3256
  const plan = await buildUpgradePlan(dir, {
3178
3257
  url: opts.url,
3179
3258
  apiKey: opts.apiKey,
@@ -3184,20 +3263,40 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3184
3263
  );
3185
3264
  program2.command("check-upgrade").argument("[dir]", "project directory to scan (default: current)", ".").description("do these upgrades remove symbols your code actually references?").option("--plan <file>", "targets from `upgrade-plan --json`").option("--upgrade <spec...>", "pkg@from..to (repeatable), e.g. commander@11.1.0..12.1.0").option("--json", "output the report as JSON").option("--exit-code", "exit 1 when the report is not safe (for CI)").option("--report", "send the result to your lurq dashboard (CI; needs an API key)").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").option("--no-types", "skip the type check (runtime surface only; faster)").action(
3186
3265
  async (dir, opts) => {
3187
- const { runCheckUpgrade } = await import("../checkUpgrade-F2WESBPM.js");
3266
+ const { runCheckUpgrade } = await import("../checkUpgrade-Q4CV7GXG.js");
3188
3267
  await runCheckUpgrade(dir, opts);
3189
3268
  }
3190
3269
  );
3270
+ program2.command("fix").argument("[dir]", "project directory to scan (default: current)", ".").description(
3271
+ "write the changes that need no judgement \u2014 a rename an upgrade proves, a model id the provider retired \u2014 and brief the agent on the rest"
3272
+ ).option("--plan <file>", "targets from `upgrade-plan --json`").option(
3273
+ "--upgrade <spec...>",
3274
+ "pkg@from..to (repeatable), e.g. cookie@1.1.1..2.0.1 \u2014 needs no API key"
3275
+ ).option("--apply", "write the files (default: print the diff and change nothing)").option("--json", "output the result as JSON").option("--exit-code", "exit 1 when something is left for a human or an agent to do").option("--max <n>", "most packages to fix in one run (blast radius)", (v) => parseInt(v, 10)).option(
3276
+ "--sarif <file>",
3277
+ "write SARIF for GitHub code scanning (upload with codeql-action/upload-sarif)"
3278
+ ).option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--api-key <key>", "hosted API key (defaults to $LURQ_API_KEY)").option("--repo <owner/name>", "apply this repo's policy (defaults to $GITHUB_REPOSITORY)").action(
3279
+ async (dir, opts) => {
3280
+ const { runFix } = await import("../fix-Z7ZY55HB.js");
3281
+ await runFix(dir, opts);
3282
+ }
3283
+ );
3191
3284
  program2.command("check-release").argument("[dir]", "package directory (default: current)", ".").description("is the version you are about to publish honest about what changed?").option("--against <version>", "compare with this published version (default: latest)").option("--json", "output the check as JSON").option("--exit-code", "exit 1 when the bump is understated (for CI / prepublish)").action(async (dir, opts) => {
3192
- const { checkRelease, formatReleaseCheck } = await import("../release-4U4ABNSJ.js");
3285
+ const { checkRelease, formatReleaseCheck } = await import("../release-EUOM5I3R.js");
3193
3286
  const check = await checkRelease(dir, { against: opts.against });
3194
3287
  console.log(opts.json ? JSON.stringify(check, null, 2) : formatReleaseCheck(check));
3195
3288
  if (opts.exitCode && check.verdict !== "ok") process.exitCode = 1;
3196
3289
  });
3290
+ program2.command("check-env").argument("[dir]", "project directory to scan (default: current)", ".").description("which environment variables does this project read that nothing declares?").option("--json", "output the result as JSON").option("--exit-code", "exit 1 when anything is undeclared (for CI)").option("--sarif <file>", "write SARIF for GitHub code scanning").option("--limit <n>", "source files to read before stopping (default 5000)").action(
3291
+ async (dir, opts) => {
3292
+ const { runEnvCheck } = await import("../envCheck-IL22OTSC.js");
3293
+ await runEnvCheck(dir, opts);
3294
+ }
3295
+ );
3197
3296
  program2.command("check-api").argument("[spec]", "OpenAPI document (default: the first one found)").description("does this change break the callers of your own API?").option("--against <rev>", "git revision to compare with (default: HEAD)").option("-C, --dir <dir>", "repository directory (default: current)", ".").option("--json", "output the check as JSON").option("--exit-code", "exit 1 on a breaking change (for CI)").action(
3198
3297
  async (spec, opts) => {
3199
- const { runApiCheck } = await import("../check-2FDGUOV7.js");
3200
- const { formatApiCheck } = await import("../diff-GZA2774U.js");
3298
+ const { runApiCheck } = await import("../check-PQSQ2MMA.js");
3299
+ const { formatApiCheck } = await import("../diff-I4SNUHU3.js");
3201
3300
  const check = await runApiCheck(opts.dir ?? ".", { spec, against: opts.against });
3202
3301
  console.log(
3203
3302
  opts.json ? JSON.stringify(check, null, 2) : formatApiCheck(check, `api check (vs ${check.against})`)
@@ -3210,7 +3309,7 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3210
3309
  "probe your MCP servers now instead of waiting for the worker (self-hosted index only)"
3211
3310
  ).option("--probe-budget <seconds>", "wall-clock ceiling for probing (default 90)").option("--json", "output JSON instead of a table").action(
3212
3311
  async (dir, opts) => {
3213
- const { runAudit } = await import("../commands-FIL5ET6P.js");
3312
+ const { runAudit } = await import("../commands-6BBLN5N5.js");
3214
3313
  await runAudit(dir, opts);
3215
3314
  }
3216
3315
  );
@@ -3220,33 +3319,73 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3220
3319
  "--fail-on <severity>",
3221
3320
  "exit 1 when anything this severe is found: critical | high | moderate | low | none",
3222
3321
  "none"
3223
- ).option("--no-history", "do not compare with, or record, the previous scan").option("--no-upload", "keep this scan on this machine; do not record it to your account").option("--require-upload", "exit 1 if the scan could not be recorded to your account (for CI)").option("--github-issue", "keep a pinned 'lurq dashboard' issue current in this repository (in GitHub Actions)").option(
3322
+ ).option("--no-history", "do not compare with, or record, the previous scan").option("--no-upload", "keep this scan on this machine; do not record it to your account").option("--require-upload", "exit 1 if the scan could not be recorded to your account (for CI)").option(
3323
+ "--github-issue",
3324
+ "keep a pinned 'lurq dashboard' issue current in this repository (in GitHub Actions)"
3325
+ ).option(
3224
3326
  "--no-contribute",
3225
3327
  "do not offer published servers' contracts as corroboration for the public index"
3226
- ).option("--json", "output JSON instead of a report").action(async (dir, opts) => {
3227
- const { runMcpScan } = await import("../mcpScan-QZHWENIP.js");
3328
+ ).option("--json", "output JSON instead of a report").option(
3329
+ "--sarif <file>",
3330
+ "write SARIF for GitHub code scanning (upload with codeql-action/upload-sarif)"
3331
+ ).action(async (dir, opts) => {
3332
+ const { runMcpScan } = await import("../mcpScan-CKBQNK5H.js");
3228
3333
  await runMcpScan(dir, opts);
3229
3334
  });
3230
- program2.command("mcp-ci").argument("[dir]", "repository directory (defaults to the current one)").description("write a GitHub Actions workflow that rescans this repository's MCP servers daily and when their config changes").option("--print", "print the workflow instead of writing it").option("--force", "replace an existing workflow file").option("--cron <expr>", "schedule (default: daily 06:23 UTC)").option("--fail-on <severity>", "fail the job at this severity: critical | high | moderate | low | none", "high").option("--no-issue", "do not maintain the pinned lurq dashboard issue").action(async (dir, opts) => {
3231
- const { runMcpCi } = await import("../mcpScan-QZHWENIP.js");
3335
+ program2.command("mcp-ci").argument("[dir]", "repository directory (defaults to the current one)").description(
3336
+ "write a GitHub Actions workflow that rescans this repository's MCP servers daily and when their config changes"
3337
+ ).option("--print", "print the workflow instead of writing it").option("--force", "replace an existing workflow file").option("--cron <expr>", "schedule (default: daily 06:23 UTC)").option(
3338
+ "--fail-on <severity>",
3339
+ "fail the job at this severity: critical | high | moderate | low | none",
3340
+ "high"
3341
+ ).option(
3342
+ "--sarif",
3343
+ "also file findings as GitHub code scanning alerts (needs code scanning enabled; adds security-events: write)"
3344
+ ).option("--no-issue", "do not maintain the pinned lurq dashboard issue").action(async (dir, opts) => {
3345
+ const { runMcpCi } = await import("../mcpScan-CKBQNK5H.js");
3232
3346
  await runMcpCi(dir, opts);
3233
3347
  });
3234
- program2.command("mcp-stack").argument("[dir]", "project directory (defaults to the current one)").description("do your configured MCP servers coexist? checks tool-name collisions and shadowing, live").option("--project-only", "read only config files in the project").option("--trust-project", "launch servers committed to the repository without asking").option("--timeout <seconds>", "per-server connect deadline (default 60)").option("--json", "output JSON instead of a table").action(
3348
+ program2.command("mcp-stack").argument("[dir]", "project directory (defaults to the current one)").description(
3349
+ "do your configured MCP servers coexist? checks tool-name collisions and shadowing, live"
3350
+ ).option("--project-only", "read only config files in the project").option("--trust-project", "launch servers committed to the repository without asking").option("--timeout <seconds>", "per-server connect deadline (default 60)").option("--json", "output JSON instead of a table").action(
3235
3351
  async (dir, opts) => {
3236
- const { runMcpStack } = await import("../commands-FIL5ET6P.js");
3352
+ const { runMcpStack } = await import("../commands-6BBLN5N5.js");
3237
3353
  await runMcpStack(dir, opts);
3238
3354
  }
3239
3355
  );
3240
3356
  program2.command("mcp-surface").argument("<server>", "npm package name of the MCP server").description("an MCP server's real tool contract: params and behaviour annotations").option("--version <v>", "exact version (defaults to the latest probed)").option("--json", "output JSON instead of a table").action(async (server, opts) => {
3241
- const { runMcpSurface } = await import("../commands-FIL5ET6P.js");
3357
+ const { runMcpSurface } = await import("../commands-6BBLN5N5.js");
3242
3358
  await runMcpSurface(server, opts);
3243
3359
  });
3244
3360
  program2.command("mcp-drift").argument("<server>", "npm package name of the MCP server").description("what an MCP server changed between two versions (incl. silent + privilege drift)").requiredOption("--from <v>", "version you are on").requiredOption("--to <v>", "version you are moving to").option("--json", "output JSON instead of a table").action(async (server, opts) => {
3245
- const { runMcpDrift } = await import("../commands-FIL5ET6P.js");
3361
+ const { runMcpDrift } = await import("../commands-6BBLN5N5.js");
3246
3362
  await runMcpDrift(server, opts);
3247
3363
  });
3364
+ program2.command("connect-check").argument("<server>", "endpoint URL, official registry name, or npm package name").description(
3365
+ "will this MCP server work in your client, and what does it take? (per-client verdicts + config)"
3366
+ ).option(
3367
+ "--client <id>",
3368
+ "one client: claude-code, claude-ai, chatgpt, cursor, vscode, codex, gemini-cli, \u2026"
3369
+ ).option("--json", "output JSON instead of a table").action(async (server, opts) => {
3370
+ const { runConnectCheck } = await import("../commands-6BBLN5N5.js");
3371
+ await runConnectCheck(server, opts);
3372
+ });
3373
+ program2.command("mcp-pin").argument("<server>", "endpoint URL or official registry name of a remote MCP server").description(
3374
+ "approve a remote MCP server as it is now; you are alerted when its tools or sign-in path change"
3375
+ ).option("--note <text>", "why it was approved, shown with the pin").option("--json", "output JSON").action(async (server, opts) => {
3376
+ const { runMcpPin } = await import("../commands-6BBLN5N5.js");
3377
+ await runMcpPin(server, opts);
3378
+ });
3379
+ program2.command("mcp-unpin").argument("<server>", "endpoint URL or official registry name").description("stop watching a pinned remote MCP server").action(async (server) => {
3380
+ const { runMcpUnpin } = await import("../commands-6BBLN5N5.js");
3381
+ await runMcpUnpin(server);
3382
+ });
3383
+ program2.command("mcp-pins").description("your pinned remote MCP servers, and which changed since you pinned them").option("--json", "output JSON").action(async (opts) => {
3384
+ const { runMcpPins } = await import("../commands-6BBLN5N5.js");
3385
+ await runMcpPins(opts);
3386
+ });
3248
3387
  program2.command("weights").description("show and explain the scoring weight model (health, quality, composite \u03BB)").option("--json", "output the weight model as JSON").action(async (opts) => {
3249
- const { runWeights } = await import("../commands-FIL5ET6P.js");
3388
+ const { runWeights } = await import("../commands-6BBLN5N5.js");
3250
3389
  runWeights(opts);
3251
3390
  });
3252
3391
  program2.command("edit-weights").description("override, reset, or explain the scoring weights (layered over defaults)").option(
@@ -3256,20 +3395,33 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3256
3395
  []
3257
3396
  ).option("--reset", "remove all overrides and restore defaults").option("--explain <component>", "explain a component (e.g. adoption, quality, lambda)").option("--project", "write to project-local .lurq/weights.json instead of the user config").action(
3258
3397
  async (opts) => {
3259
- const { runEditWeights } = await import("../commands-FIL5ET6P.js");
3398
+ const { runEditWeights } = await import("../commands-6BBLN5N5.js");
3260
3399
  await runEditWeights(opts);
3261
3400
  }
3262
3401
  );
3263
3402
  program2.command("install-skill").description("register lurq as an MCP server in supported AI assistants (scriptable)").option("--agent <agent>", AGENT_CHOICES, "claude-code").option("--api-key <key>", "hosted API key (remote install; default mode)").option("--url <url>", "hosted endpoint URL (defaults to the lurq service)").option("--local", "self-host: write a local stdio entry using your own DATABASE_URL").action(async (opts) => {
3264
- const { runInstallSkill } = await import("../installSkill-VQJWJVCL.js");
3403
+ const { runInstallSkill } = await import("../installSkill-A7KKPDMS.js");
3265
3404
  await runInstallSkill(opts);
3266
3405
  });
3406
+ program2.command("hook").argument(
3407
+ "<event>",
3408
+ "the agent event being handled: session-start, prompt, pre-tool-use, post-tool-use"
3409
+ ).option(
3410
+ "--agent <agent>",
3411
+ "whose hook format to read and write: claude, codex or cursor",
3412
+ "claude"
3413
+ ).description(
3414
+ "run as an agent hook: verify installs and suggest lurq where it helps (set up by `lurq setup`)"
3415
+ ).action(async (event, opts) => {
3416
+ const { runHook } = await import("../hook-TWFLIDK3.js");
3417
+ await runHook(event, opts.agent);
3418
+ });
3267
3419
  program2.command("serve").description("start the MCP server over stdio (for agent integration)").action(async () => {
3268
- const { startMcpServer } = await import("../server-KFUD5X57.js");
3420
+ const { startMcpServer } = await import("../server-LROMHS62.js");
3269
3421
  await startMcpServer();
3270
3422
  });
3271
3423
  program2.command("serve-http").description("start the hosted MCP server over HTTP with API-key auth").option("--port <n>", "port to listen on (default: $PORT or 8080)", (v) => parseInt(v, 10)).action(async (opts) => {
3272
- const { startHttpServer } = await import("../http-ETPYMBGD.js");
3424
+ const { startHttpServer } = await import("../http-7VF2RE2D.js");
3273
3425
  await startHttpServer({ port: opts.port });
3274
3426
  });
3275
3427
  return program2;
@@ -3279,19 +3431,19 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3279
3431
  init_esm_shims();
3280
3432
  var import_semver = __toESM(require_semver(), 1);
3281
3433
  import { spawn } from "child_process";
3282
- import { mkdirSync, readFileSync, writeFileSync } from "fs";
3283
- import { homedir } from "os";
3284
- import { dirname, join } from "path";
3285
- var DAY_MS = 24 * 60 * 60 * 1e3;
3434
+ import { mkdirSync as mkdirSync2, readFileSync, writeFileSync as writeFileSync2 } from "fs";
3435
+ import { homedir as homedir2 } from "os";
3436
+ import { dirname, join as join2 } from "path";
3437
+ var DAY_MS2 = 24 * 60 * 60 * 1e3;
3286
3438
  function statePath() {
3287
- return join(process.env.XDG_CACHE_HOME || join(homedir(), ".cache"), "lurq", "update-check.json");
3439
+ return join2(process.env.XDG_CACHE_HOME || join2(homedir2(), ".cache"), "lurq", "update-check.json");
3288
3440
  }
3289
3441
  function planUpdateCheck(state, now, current = VERSION) {
3290
3442
  const latest = state?.latest;
3291
3443
  const newer = latest && import_semver.default.valid(latest) && import_semver.default.valid(current) && import_semver.default.gt(latest, current);
3292
3444
  return {
3293
3445
  message: newer ? `Update available: ${current} \u2192 ${latest}. Run: npm install -g ${PACKAGE_NAME}` : null,
3294
- refresh: !state || !(now - state.checkedAt < DAY_MS)
3446
+ refresh: !state || !(now - state.checkedAt < DAY_MS2)
3295
3447
  };
3296
3448
  }
3297
3449
  var FETCH_LATEST = `
@@ -3301,8 +3453,8 @@ fetch(url, { signal: AbortSignal.timeout(10000) })
3301
3453
  .then((p) => require('fs').writeFileSync(file, JSON.stringify({ checkedAt: Date.now(), latest: p.version })))
3302
3454
  .catch(() => {});
3303
3455
  `;
3304
- function notifyOnUpdate(argv) {
3305
- const quiet = argv[0] === "serve" || argv[0] === "serve-http" || argv.includes("--json") || !process.stdout.isTTY || !!process.env.CI || "NO_UPDATE_NOTIFIER" in process.env;
3456
+ function notifyOnUpdate(argv2) {
3457
+ const quiet = argv2[0] === "serve" || argv2[0] === "serve-http" || argv2.includes("--json") || !process.stdout.isTTY || !!process.env.CI || "NO_UPDATE_NOTIFIER" in process.env;
3306
3458
  if (quiet) return;
3307
3459
  try {
3308
3460
  const path = statePath();
@@ -3316,8 +3468,8 @@ function notifyOnUpdate(argv) {
3316
3468
  ${yellow(message)}
3317
3469
  `));
3318
3470
  if (!refresh) return;
3319
- mkdirSync(dirname(path), { recursive: true });
3320
- writeFileSync(path, JSON.stringify({ ...state, checkedAt: Date.now() }));
3471
+ mkdirSync2(dirname(path), { recursive: true });
3472
+ writeFileSync2(path, JSON.stringify({ ...state, checkedAt: Date.now() }));
3321
3473
  spawn(
3322
3474
  process.execPath,
3323
3475
  ["-e", FETCH_LATEST, `https://registry.npmjs.org/${PACKAGE_NAME}/latest`, path],
@@ -3353,9 +3505,9 @@ function isOwner() {
3353
3505
  const want = Buffer.from(OWNER_HASH, "hex");
3354
3506
  return got.length === want.length && timingSafeEqual(got, want);
3355
3507
  }
3356
- function enforceGate(argv) {
3508
+ function enforceGate(argv2) {
3357
3509
  if (!PRE_LAUNCH || isOwner()) return;
3358
- if (argv[0] && ALLOWED.has(argv[0])) return;
3510
+ if (argv2[0] && ALLOWED.has(argv2[0])) return;
3359
3511
  printPlaceholder();
3360
3512
  process.exit(0);
3361
3513
  }
@@ -3391,7 +3543,9 @@ function selfHostHint(err) {
3391
3543
  if (err?.code !== "ERR_MODULE_NOT_FOUND") return null;
3392
3544
  const missing = /Cannot find package '([^']+)'/.exec(err.message ?? "")?.[1];
3393
3545
  if (!missing || !SELF_HOST_DEPENDENCIES.includes(missing)) return null;
3394
- const deps = SELF_HOST_DEPENDENCIES.map((name) => `${name}@${package_default.dependencies[name]}`);
3546
+ const deps = SELF_HOST_DEPENDENCIES.map(
3547
+ (name) => `${name}@${package_default.dependencies[name]}`
3548
+ );
3395
3549
  return `This command runs lurq's server or a local index, which needs packages the CLI does not install ("${missing}" is missing). Hosted users never need them: run \`lurq setup\` instead.
3396
3550
  To self-host, install them next to lurq:
3397
3551
  npm install -g ${PACKAGE_NAME} ${deps.join(" ")}`;
@@ -3400,8 +3554,9 @@ To self-host, install them next to lurq:
3400
3554
  // src/bin/lurq.ts
3401
3555
  loadEnv();
3402
3556
  enforceGate(process.argv.slice(2));
3403
- notifyOnUpdate(process.argv.slice(2));
3404
- withSetupOnMissingKey(() => buildProgram().parseAsync(process.argv)).catch((err) => {
3557
+ var argv = process.argv.slice(2);
3558
+ notifyOnUpdate(argv);
3559
+ maintainHooks(argv).then(() => withSetupOnMissingKey(() => buildProgram().parseAsync(process.argv))).catch((err) => {
3405
3560
  logger.error(selfHostHint(err) ?? (err instanceof Error ? err.message : String(err)));
3406
3561
  process.exit(1);
3407
3562
  });
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-TNTXWSYA.js";
5
5
  import {
6
6
  API_KEY_PREFIX
7
- } from "./chunk-GPTKSNR6.js";
7
+ } from "./chunk-L3V7AVM6.js";
8
8
  import {
9
9
  init_esm_shims
10
10
  } from "./chunk-I3M2KJXB.js";
@@ -74,13 +74,14 @@ function keyViaBrowser(opts) {
74
74
  finish({ key, label });
75
75
  });
76
76
  });
77
- const timer = setTimeout(() => finish(null), DEADLINE_MS);
77
+ const timer = setTimeout(() => finish(null), opts.deadlineMs ?? DEADLINE_MS);
78
78
  timer.unref?.();
79
79
  server.on("error", () => finish(null));
80
80
  opts.signal?.addEventListener("abort", () => finish(null), { once: true });
81
81
  server.listen(0, "127.0.0.1", () => {
82
82
  const { port } = server.address();
83
- const url = `${WEB_ORIGIN}/dashboard/cli?port=${port}&nonce=${encodeURIComponent(nonce)}`;
83
+ const via = opts.via ? `&via=${opts.via}` : "";
84
+ const url = `${WEB_ORIGIN}/dashboard/cli?port=${port}&nonce=${encodeURIComponent(nonce)}${via}`;
84
85
  opts.onUrl(url);
85
86
  if (!opts.noOpen) openInBrowser(url);
86
87
  });
@@ -2,9 +2,9 @@ import { createRequire as __lurqCreateRequire } from 'node:module'; const requir
2
2
  import {
3
3
  cached,
4
4
  invalidateCache
5
- } from "./chunk-HWBBVLOT.js";
5
+ } from "./chunk-J3NUERU7.js";
6
6
  import "./chunk-MYGSLK44.js";
7
- import "./chunk-GPTKSNR6.js";
7
+ import "./chunk-L3V7AVM6.js";
8
8
  import "./chunk-I3M2KJXB.js";
9
9
  export {
10
10
  cached,