lurqrun 0.1.7 → 0.1.8

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-VWCXSDVO.js} +12 -11
  3. package/dist/autopilotInit-Q62MX5M6.js +178 -0
  4. package/dist/bin/lurq.js +235 -83
  5. package/dist/{browserAuth-B6G27USY.js → browserAuth-J7APSD4P.js} +4 -3
  6. package/dist/{cache-DKI34SVS.js → cache-AEAKCV4I.js} +2 -2
  7. package/dist/check-2JTQDQA6.js +2613 -0
  8. package/dist/{check-2FDGUOV7.js → check-PQSQ2MMA.js} +1 -1
  9. package/dist/checkUpgrade-5YW77OBL.js +24 -0
  10. package/dist/{chunk-BCANRN5B.js → chunk-2GAYNIHG.js} +8 -1
  11. package/dist/{chunk-EA3DP5HG.js → chunk-2O6Z37IT.js} +155 -25
  12. package/dist/{chunk-J5FZYN4A.js → chunk-2WD4QAH4.js} +1 -1
  13. package/dist/{chunk-CUP36ND3.js → chunk-3676XOBU.js} +145 -36
  14. package/dist/chunk-3D2MPGOQ.js +181 -0
  15. package/dist/{chunk-LYMPYETA.js → chunk-4JHDSVIN.js} +270 -6
  16. package/dist/chunk-53SG6XWA.js +141 -0
  17. package/dist/chunk-5ABNDB3I.js +37 -0
  18. package/dist/chunk-5ALIJFDA.js +114 -0
  19. package/dist/{chunk-BULZAX2U.js → chunk-64ZF7KO4.js} +55 -38
  20. package/dist/{chunk-2VMOWSRY.js → chunk-6DM6UQFD.js} +19 -1
  21. package/dist/{chunk-HWBBVLOT.js → chunk-6L67QMCP.js} +1 -1
  22. package/dist/{chunk-GPTKSNR6.js → chunk-72Y2FDVS.js} +2 -1
  23. package/dist/{chunk-B43LCXBM.js → chunk-A3TYI2TF.js} +81 -16
  24. package/dist/{chunk-IQ4SDKKY.js → chunk-B2UUYRBX.js} +31 -228
  25. package/dist/{chunk-DB2VF5UD.js → chunk-BJT2LHAR.js} +16 -11
  26. package/dist/chunk-BM3LF5T6.js +132 -0
  27. package/dist/{chunk-3N3Q3DSW.js → chunk-BN3NM47Q.js} +8 -8
  28. package/dist/chunk-D3K6IZVR.js +12845 -0
  29. package/dist/{chunk-AHBP533R.js → chunk-D3VTZS7V.js} +7 -5
  30. package/dist/{chunk-UDVNA7EA.js → chunk-DM37MTOO.js} +161 -8
  31. package/dist/chunk-DONTW3NE.js +171 -0
  32. package/dist/{chunk-M6NYEXCW.js → chunk-DSROTZ3Z.js} +1 -1
  33. package/dist/{chunk-4F7ZESPO.js → chunk-EQCXENKZ.js} +3 -5
  34. package/dist/{chunk-CW5HJ3LX.js → chunk-EYAKM6YN.js} +1 -1
  35. package/dist/{chunk-VL2E5T2A.js → chunk-FDFPMBCA.js} +6 -3
  36. package/dist/{chunk-BV32UNLL.js → chunk-FVYFV5HA.js} +2 -2
  37. package/dist/{chunk-DWAGCNEL.js → chunk-GM5Y555O.js} +36 -103
  38. package/dist/{chunk-PSX3GIAN.js → chunk-HWFX4BC4.js} +2 -1
  39. package/dist/chunk-IFNONGRQ.js +603 -0
  40. package/dist/chunk-J3U2CPSK.js +136 -0
  41. package/dist/{chunk-Y5GI7RL3.js → chunk-J6XQ7OPZ.js} +9 -1
  42. package/dist/{chunk-LBFGSSF2.js → chunk-KMV4Y6R3.js} +2 -1
  43. package/dist/{chunk-L6N4JFW2.js → chunk-KP5ZDDPE.js} +81 -4
  44. package/dist/{chunk-SJOVFF7B.js → chunk-KYKSZ3XZ.js} +3 -2
  45. package/dist/chunk-NEZNAPPN.js +41 -0
  46. package/dist/{chunk-NH5I4KHH.js → chunk-NPVN2THM.js} +1 -5
  47. package/dist/{chunk-6L3U7DZ5.js → chunk-NYZU5NCW.js} +1 -1
  48. package/dist/chunk-O4KHCV6I.js +320 -0
  49. package/dist/{chunk-LO35HLQZ.js → chunk-ONDVTXUO.js} +25 -4
  50. package/dist/{chunk-4ZYCIMY4.js → chunk-OTJFHESY.js} +25 -4
  51. package/dist/chunk-P6MIKSPY.js +243 -0
  52. package/dist/{checkUpgrade-F2WESBPM.js → chunk-QCRBX3LV.js} +72 -10
  53. package/dist/{chunk-LRD4GBYE.js → chunk-QUIMQ7YL.js} +1 -1
  54. package/dist/chunk-RG3YLU6E.js +49 -0
  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-TDTYV6QI.js +119 -0
  58. package/dist/{chunk-FW6BD2NO.js → chunk-TUXQ32WE.js} +457 -121
  59. package/dist/{chunk-WQ23REYT.js → chunk-VGCDRK3S.js} +1 -1
  60. package/dist/{chunk-U5AT3TD4.js → chunk-X4W64MHU.js} +1735 -1858
  61. package/dist/chunk-XBQA4I36.js +92 -0
  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-ZJMLQ37G.js +90 -0
  66. package/dist/{client-IRKAMDYZ.js → client-MU4EUDZV.js} +3 -3
  67. package/dist/{commands-FIL5ET6P.js → commands-UOOTMBKA.js} +145 -33
  68. package/dist/{compat-R3UTFQ5Q.js → compat-Q5DVPITN.js} +6 -6
  69. package/dist/constants-DJFOFZ44.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-VRT4BRVZ.js +14 -0
  73. package/dist/env-UN6KGZ7S.js +15 -0
  74. package/dist/envCheck-KUPTORFQ.js +71 -0
  75. package/dist/{extract-NKGKLIVT.js → extract-6WG265BL.js} +14 -3
  76. package/dist/{fetch-QYTUJVG2.js → fetch-PJ3SC32M.js} +4 -4
  77. package/dist/{firstTouch-QQTJH4QX.js → firstTouch-COJCMOB3.js} +1 -1
  78. package/dist/fix-3EDWNKW3.js +220 -0
  79. package/dist/{handlers-GEJAVZDK.js → handlers-4Q37WIFT.js} +19 -17
  80. package/dist/hook-NA66XJLC.js +412 -0
  81. package/dist/{http-ETPYMBGD.js → http-25GJ6SKK.js} +2078 -510
  82. package/dist/{ingestQueue-VKN4KBIF.js → ingestQueue-FSVJC3AA.js} +14 -12
  83. package/dist/{install-EK3W2COX.js → install-G2HHXYJ2.js} +6 -6
  84. package/dist/{installSkill-VQJWJVCL.js → installSkill-5TIMYIJZ.js} +21 -3
  85. package/dist/manifest-ENMIC54B.js +13 -0
  86. package/dist/{mcp-3JHD5SUZ.js → mcp-PENLL2PK.js} +60 -32
  87. package/dist/mcpConfig-3LYPRY5Q.js +80 -0
  88. package/dist/{mcpHandlers-QFN4MCFL.js → mcpHandlers-PO7GENA7.js} +7 -7
  89. package/dist/{mcpScan-QZHWENIP.js → mcpScan-ULP626TQ.js} +306 -442
  90. package/dist/{mcpScanWorkflow-JPYCBGC4.js → mcpScanWorkflow-27O44FOE.js} +29 -12
  91. package/dist/{mcpStack-BYJCZNIV.js → mcpStack-ZNYIFXZ5.js} +1 -1
  92. package/dist/model-ASMZWLM7.js +214 -0
  93. package/dist/{packages-THVFMWFP.js → packages-RWF2LXST.js} +3 -5
  94. package/dist/{plan-V4OEI3J4.js → plan-SDILIDZT.js} +23 -21
  95. package/dist/{planView-JRXGCG2N.js → planView-ZAKRTGVS.js} +4 -1
  96. package/dist/{policy-3P6BGRDN.js → policy-JAGNMQJI.js} +5 -5
  97. package/dist/probe-3IK646WN.js +610 -0
  98. package/dist/publicUpgrades-WTBGLDIK.js +42 -0
  99. package/dist/{references-6N7VEPHT.js → references-I6Y4BSRR.js} +3 -1
  100. package/dist/{release-4U4ABNSJ.js → release-7IU2R4YG.js} +5 -5
  101. package/dist/{remote-YGCXYI4V.js → remote-FN6225AH.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-SAPSRKEI.js} +4 -4
  106. package/dist/sarif-WLVJFJ7U.js +125 -0
  107. package/dist/server-OLTY3NYT.js +59 -0
  108. package/dist/{surface-V62GE554.js → surface-7MHE3RL7.js} +18 -16
  109. package/dist/{surface-YL6O67W3.js → surface-JS2XU3U3.js} +5 -3
  110. package/dist/{surfaceHandlers-X2IZKA3E.js → surfaceHandlers-4B6TMZ34.js} +5 -5
  111. package/dist/{typecheck-X7U5ELMR.js → typecheck-NGOKNAJY.js} +23 -9
  112. package/dist/{uninstall-P7RGBX6G.js → uninstall-I2IJP5JZ.js} +30 -4
  113. package/dist/{upgrade-NQ5IWFZB.js → upgrade-FS26DJGG.js} +86 -32
  114. package/dist/{upgradePlan-A4LRKLEG.js → upgradePlan-ZS5IOVMZ.js} +46 -11
  115. package/dist/upkeepHandler-VFGYXJKB.js +13 -0
  116. package/dist/{userConfig-Z3GQE776.js → userConfig-ICASHI47.js} +1 -1
  117. package/dist/{watch-DGFMWUDL.js → watch-OCNEUXG6.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-2O6Z37IT.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-DM37MTOO.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-OTJFHESY.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-72Y2FDVS.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-5TIMYIJZ.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,67 @@ 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-G2HHXYJ2.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-G2HHXYJ2.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("set the repository secret and write the upgrade workflow (never commits)").option("--repo <owner/name>", "defaults to the origin remote of this checkout").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", "overwrite an existing workflow file").option("--json", "machine-readable summary").action(async (opts) => {
3175
+ const { runAutopilotInit } = await import("../autopilotInit-Q62MX5M6.js");
3176
+ await runAutopilotInit(opts);
3177
+ });
3100
3178
  program2.command("logout").description("remove the stored API key from this machine").action(async () => {
3101
- const { clearUserConfig, userConfigPath } = await import("../userConfig-Z3GQE776.js");
3179
+ const { clearUserConfig, userConfigPath } = await import("../userConfig-ICASHI47.js");
3102
3180
  const path = userConfigPath();
3103
3181
  console.log(
3104
3182
  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
3183
  );
3106
3184
  });
3107
3185
  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");
3186
+ const { runUninstall } = await import("../uninstall-I2IJP5JZ.js");
3109
3187
  await runUninstall(opts);
3110
3188
  });
3111
3189
  const policy = program2.command("policy").description("keep your selection policy in a file: pull it, review it, push it");
3112
3190
  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");
3191
+ const { runPolicyPull } = await import("../policy-JAGNMQJI.js");
3114
3192
  await runPolicyPull(file, opts);
3115
3193
  });
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
- );
3194
+ 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) => {
3195
+ const { runPolicyPush } = await import("../policy-JAGNMQJI.js");
3196
+ await runPolicyPush(file, opts);
3197
+ });
3122
3198
  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");
3199
+ const { runPolicyHistory } = await import("../policy-JAGNMQJI.js");
3124
3200
  await runPolicyHistory(opts);
3125
3201
  });
3126
3202
  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");
3203
+ const { runPolicyLog } = await import("../policy-JAGNMQJI.js");
3128
3204
  await runPolicyLog(opts);
3129
3205
  });
3130
3206
  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");
3207
+ const { runCan } = await import("../commands-UOOTMBKA.js");
3132
3208
  runCan(query.join(" "), opts);
3133
3209
  });
3134
3210
  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");
3211
+ const { runEvaluate } = await import("../commands-UOOTMBKA.js");
3136
3212
  await runEvaluate(pkg, opts);
3137
3213
  });
3138
3214
  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");
3215
+ const { runCompare } = await import("../commands-UOOTMBKA.js");
3140
3216
  await runCompare(pkgs, opts);
3141
3217
  });
3142
3218
  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");
3219
+ const { runVerify } = await import("../commands-UOOTMBKA.js");
3144
3220
  await runVerify(pkg, opts);
3145
3221
  });
3146
3222
  program2.command("usage").argument("<package>", "npm package name").description(
@@ -3151,7 +3227,7 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3151
3227
  (v) => Math.max(0, parseInt(v, 10) || 0)
3152
3228
  ).option("--json", "output JSON").action(
3153
3229
  async (pkg, opts) => {
3154
- const { runUsage } = await import("../commands-FIL5ET6P.js");
3230
+ const { runUsage } = await import("../commands-UOOTMBKA.js");
3155
3231
  await runUsage(pkg, {
3156
3232
  version: opts.target ?? opts.version,
3157
3233
  known: opts.known,
@@ -3162,18 +3238,18 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3162
3238
  }
3163
3239
  );
3164
3240
  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");
3241
+ const { runVersions } = await import("../commands-UOOTMBKA.js");
3166
3242
  await runVersions(pkg, opts);
3167
3243
  });
3168
3244
  program2.command("compat").argument("<packages...>", "npm package names to check together").description(
3169
3245
  "check whether a set of packages forms a coherent stack (peer/engine + recorded evidence)"
3170
3246
  ).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");
3247
+ const { runCompat } = await import("../commands-UOOTMBKA.js");
3172
3248
  await runCompat(pkgs, opts);
3173
3249
  });
3174
3250
  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
3251
  async (dir, opts) => {
3176
- const { buildUpgradePlan, formatUpgradePlan } = await import("../upgradePlan-A4LRKLEG.js");
3252
+ const { buildUpgradePlan, formatUpgradePlan } = await import("../upgradePlan-ZS5IOVMZ.js");
3177
3253
  const plan = await buildUpgradePlan(dir, {
3178
3254
  url: opts.url,
3179
3255
  apiKey: opts.apiKey,
@@ -3184,20 +3260,40 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3184
3260
  );
3185
3261
  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
3262
  async (dir, opts) => {
3187
- const { runCheckUpgrade } = await import("../checkUpgrade-F2WESBPM.js");
3263
+ const { runCheckUpgrade } = await import("../checkUpgrade-5YW77OBL.js");
3188
3264
  await runCheckUpgrade(dir, opts);
3189
3265
  }
3190
3266
  );
3267
+ program2.command("fix").argument("[dir]", "project directory to scan (default: current)", ".").description(
3268
+ "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"
3269
+ ).option("--plan <file>", "targets from `upgrade-plan --json`").option(
3270
+ "--upgrade <spec...>",
3271
+ "pkg@from..to (repeatable), e.g. cookie@1.1.1..2.0.1 \u2014 needs no API key"
3272
+ ).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(
3273
+ "--sarif <file>",
3274
+ "write SARIF for GitHub code scanning (upload with codeql-action/upload-sarif)"
3275
+ ).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(
3276
+ async (dir, opts) => {
3277
+ const { runFix } = await import("../fix-3EDWNKW3.js");
3278
+ await runFix(dir, opts);
3279
+ }
3280
+ );
3191
3281
  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");
3282
+ const { checkRelease, formatReleaseCheck } = await import("../release-7IU2R4YG.js");
3193
3283
  const check = await checkRelease(dir, { against: opts.against });
3194
3284
  console.log(opts.json ? JSON.stringify(check, null, 2) : formatReleaseCheck(check));
3195
3285
  if (opts.exitCode && check.verdict !== "ok") process.exitCode = 1;
3196
3286
  });
3287
+ 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(
3288
+ async (dir, opts) => {
3289
+ const { runEnvCheck } = await import("../envCheck-KUPTORFQ.js");
3290
+ await runEnvCheck(dir, opts);
3291
+ }
3292
+ );
3197
3293
  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
3294
  async (spec, opts) => {
3199
- const { runApiCheck } = await import("../check-2FDGUOV7.js");
3200
- const { formatApiCheck } = await import("../diff-GZA2774U.js");
3295
+ const { runApiCheck } = await import("../check-PQSQ2MMA.js");
3296
+ const { formatApiCheck } = await import("../diff-I4SNUHU3.js");
3201
3297
  const check = await runApiCheck(opts.dir ?? ".", { spec, against: opts.against });
3202
3298
  console.log(
3203
3299
  opts.json ? JSON.stringify(check, null, 2) : formatApiCheck(check, `api check (vs ${check.against})`)
@@ -3210,7 +3306,7 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3210
3306
  "probe your MCP servers now instead of waiting for the worker (self-hosted index only)"
3211
3307
  ).option("--probe-budget <seconds>", "wall-clock ceiling for probing (default 90)").option("--json", "output JSON instead of a table").action(
3212
3308
  async (dir, opts) => {
3213
- const { runAudit } = await import("../commands-FIL5ET6P.js");
3309
+ const { runAudit } = await import("../commands-UOOTMBKA.js");
3214
3310
  await runAudit(dir, opts);
3215
3311
  }
3216
3312
  );
@@ -3220,33 +3316,73 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3220
3316
  "--fail-on <severity>",
3221
3317
  "exit 1 when anything this severe is found: critical | high | moderate | low | none",
3222
3318
  "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(
3319
+ ).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(
3320
+ "--github-issue",
3321
+ "keep a pinned 'lurq dashboard' issue current in this repository (in GitHub Actions)"
3322
+ ).option(
3224
3323
  "--no-contribute",
3225
3324
  "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");
3325
+ ).option("--json", "output JSON instead of a report").option(
3326
+ "--sarif <file>",
3327
+ "write SARIF for GitHub code scanning (upload with codeql-action/upload-sarif)"
3328
+ ).action(async (dir, opts) => {
3329
+ const { runMcpScan } = await import("../mcpScan-ULP626TQ.js");
3228
3330
  await runMcpScan(dir, opts);
3229
3331
  });
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");
3332
+ program2.command("mcp-ci").argument("[dir]", "repository directory (defaults to the current one)").description(
3333
+ "write a GitHub Actions workflow that rescans this repository's MCP servers daily and when their config changes"
3334
+ ).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(
3335
+ "--fail-on <severity>",
3336
+ "fail the job at this severity: critical | high | moderate | low | none",
3337
+ "high"
3338
+ ).option(
3339
+ "--sarif",
3340
+ "also file findings as GitHub code scanning alerts (needs code scanning enabled; adds security-events: write)"
3341
+ ).option("--no-issue", "do not maintain the pinned lurq dashboard issue").action(async (dir, opts) => {
3342
+ const { runMcpCi } = await import("../mcpScan-ULP626TQ.js");
3232
3343
  await runMcpCi(dir, opts);
3233
3344
  });
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(
3345
+ program2.command("mcp-stack").argument("[dir]", "project directory (defaults to the current one)").description(
3346
+ "do your configured MCP servers coexist? checks tool-name collisions and shadowing, live"
3347
+ ).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
3348
  async (dir, opts) => {
3236
- const { runMcpStack } = await import("../commands-FIL5ET6P.js");
3349
+ const { runMcpStack } = await import("../commands-UOOTMBKA.js");
3237
3350
  await runMcpStack(dir, opts);
3238
3351
  }
3239
3352
  );
3240
3353
  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");
3354
+ const { runMcpSurface } = await import("../commands-UOOTMBKA.js");
3242
3355
  await runMcpSurface(server, opts);
3243
3356
  });
3244
3357
  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");
3358
+ const { runMcpDrift } = await import("../commands-UOOTMBKA.js");
3246
3359
  await runMcpDrift(server, opts);
3247
3360
  });
3361
+ program2.command("connect-check").argument("<server>", "endpoint URL, official registry name, or npm package name").description(
3362
+ "will this MCP server work in your client, and what does it take? (per-client verdicts + config)"
3363
+ ).option(
3364
+ "--client <id>",
3365
+ "one client: claude-code, claude-ai, chatgpt, cursor, vscode, codex, gemini-cli, \u2026"
3366
+ ).option("--json", "output JSON instead of a table").action(async (server, opts) => {
3367
+ const { runConnectCheck } = await import("../commands-UOOTMBKA.js");
3368
+ await runConnectCheck(server, opts);
3369
+ });
3370
+ program2.command("mcp-pin").argument("<server>", "endpoint URL or official registry name of a remote MCP server").description(
3371
+ "approve a remote MCP server as it is now; you are alerted when its tools or sign-in path change"
3372
+ ).option("--note <text>", "why it was approved, shown with the pin").option("--json", "output JSON").action(async (server, opts) => {
3373
+ const { runMcpPin } = await import("../commands-UOOTMBKA.js");
3374
+ await runMcpPin(server, opts);
3375
+ });
3376
+ program2.command("mcp-unpin").argument("<server>", "endpoint URL or official registry name").description("stop watching a pinned remote MCP server").action(async (server) => {
3377
+ const { runMcpUnpin } = await import("../commands-UOOTMBKA.js");
3378
+ await runMcpUnpin(server);
3379
+ });
3380
+ program2.command("mcp-pins").description("your pinned remote MCP servers, and which changed since you pinned them").option("--json", "output JSON").action(async (opts) => {
3381
+ const { runMcpPins } = await import("../commands-UOOTMBKA.js");
3382
+ await runMcpPins(opts);
3383
+ });
3248
3384
  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");
3385
+ const { runWeights } = await import("../commands-UOOTMBKA.js");
3250
3386
  runWeights(opts);
3251
3387
  });
3252
3388
  program2.command("edit-weights").description("override, reset, or explain the scoring weights (layered over defaults)").option(
@@ -3256,20 +3392,33 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3256
3392
  []
3257
3393
  ).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
3394
  async (opts) => {
3259
- const { runEditWeights } = await import("../commands-FIL5ET6P.js");
3395
+ const { runEditWeights } = await import("../commands-UOOTMBKA.js");
3260
3396
  await runEditWeights(opts);
3261
3397
  }
3262
3398
  );
3263
3399
  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");
3400
+ const { runInstallSkill } = await import("../installSkill-5TIMYIJZ.js");
3265
3401
  await runInstallSkill(opts);
3266
3402
  });
3403
+ program2.command("hook").argument(
3404
+ "<event>",
3405
+ "the agent event being handled: session-start, prompt, pre-tool-use, post-tool-use"
3406
+ ).option(
3407
+ "--agent <agent>",
3408
+ "whose hook format to read and write: claude, codex or cursor",
3409
+ "claude"
3410
+ ).description(
3411
+ "run as an agent hook: verify installs and suggest lurq where it helps (set up by `lurq setup`)"
3412
+ ).action(async (event, opts) => {
3413
+ const { runHook } = await import("../hook-NA66XJLC.js");
3414
+ await runHook(event, opts.agent);
3415
+ });
3267
3416
  program2.command("serve").description("start the MCP server over stdio (for agent integration)").action(async () => {
3268
- const { startMcpServer } = await import("../server-KFUD5X57.js");
3417
+ const { startMcpServer } = await import("../server-OLTY3NYT.js");
3269
3418
  await startMcpServer();
3270
3419
  });
3271
3420
  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");
3421
+ const { startHttpServer } = await import("../http-25GJ6SKK.js");
3273
3422
  await startHttpServer({ port: opts.port });
3274
3423
  });
3275
3424
  return program2;
@@ -3279,19 +3428,19 @@ coding agent on this machine. Get a key at ${KEYS_URL}
3279
3428
  init_esm_shims();
3280
3429
  var import_semver = __toESM(require_semver(), 1);
3281
3430
  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;
3431
+ import { mkdirSync as mkdirSync2, readFileSync, writeFileSync as writeFileSync2 } from "fs";
3432
+ import { homedir as homedir2 } from "os";
3433
+ import { dirname, join as join2 } from "path";
3434
+ var DAY_MS2 = 24 * 60 * 60 * 1e3;
3286
3435
  function statePath() {
3287
- return join(process.env.XDG_CACHE_HOME || join(homedir(), ".cache"), "lurq", "update-check.json");
3436
+ return join2(process.env.XDG_CACHE_HOME || join2(homedir2(), ".cache"), "lurq", "update-check.json");
3288
3437
  }
3289
3438
  function planUpdateCheck(state, now, current = VERSION) {
3290
3439
  const latest = state?.latest;
3291
3440
  const newer = latest && import_semver.default.valid(latest) && import_semver.default.valid(current) && import_semver.default.gt(latest, current);
3292
3441
  return {
3293
3442
  message: newer ? `Update available: ${current} \u2192 ${latest}. Run: npm install -g ${PACKAGE_NAME}` : null,
3294
- refresh: !state || !(now - state.checkedAt < DAY_MS)
3443
+ refresh: !state || !(now - state.checkedAt < DAY_MS2)
3295
3444
  };
3296
3445
  }
3297
3446
  var FETCH_LATEST = `
@@ -3301,8 +3450,8 @@ fetch(url, { signal: AbortSignal.timeout(10000) })
3301
3450
  .then((p) => require('fs').writeFileSync(file, JSON.stringify({ checkedAt: Date.now(), latest: p.version })))
3302
3451
  .catch(() => {});
3303
3452
  `;
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;
3453
+ function notifyOnUpdate(argv2) {
3454
+ 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
3455
  if (quiet) return;
3307
3456
  try {
3308
3457
  const path = statePath();
@@ -3316,8 +3465,8 @@ function notifyOnUpdate(argv) {
3316
3465
  ${yellow(message)}
3317
3466
  `));
3318
3467
  if (!refresh) return;
3319
- mkdirSync(dirname(path), { recursive: true });
3320
- writeFileSync(path, JSON.stringify({ ...state, checkedAt: Date.now() }));
3468
+ mkdirSync2(dirname(path), { recursive: true });
3469
+ writeFileSync2(path, JSON.stringify({ ...state, checkedAt: Date.now() }));
3321
3470
  spawn(
3322
3471
  process.execPath,
3323
3472
  ["-e", FETCH_LATEST, `https://registry.npmjs.org/${PACKAGE_NAME}/latest`, path],
@@ -3353,9 +3502,9 @@ function isOwner() {
3353
3502
  const want = Buffer.from(OWNER_HASH, "hex");
3354
3503
  return got.length === want.length && timingSafeEqual(got, want);
3355
3504
  }
3356
- function enforceGate(argv) {
3505
+ function enforceGate(argv2) {
3357
3506
  if (!PRE_LAUNCH || isOwner()) return;
3358
- if (argv[0] && ALLOWED.has(argv[0])) return;
3507
+ if (argv2[0] && ALLOWED.has(argv2[0])) return;
3359
3508
  printPlaceholder();
3360
3509
  process.exit(0);
3361
3510
  }
@@ -3391,7 +3540,9 @@ function selfHostHint(err) {
3391
3540
  if (err?.code !== "ERR_MODULE_NOT_FOUND") return null;
3392
3541
  const missing = /Cannot find package '([^']+)'/.exec(err.message ?? "")?.[1];
3393
3542
  if (!missing || !SELF_HOST_DEPENDENCIES.includes(missing)) return null;
3394
- const deps = SELF_HOST_DEPENDENCIES.map((name) => `${name}@${package_default.dependencies[name]}`);
3543
+ const deps = SELF_HOST_DEPENDENCIES.map(
3544
+ (name) => `${name}@${package_default.dependencies[name]}`
3545
+ );
3395
3546
  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
3547
  To self-host, install them next to lurq:
3397
3548
  npm install -g ${PACKAGE_NAME} ${deps.join(" ")}`;
@@ -3400,8 +3551,9 @@ To self-host, install them next to lurq:
3400
3551
  // src/bin/lurq.ts
3401
3552
  loadEnv();
3402
3553
  enforceGate(process.argv.slice(2));
3403
- notifyOnUpdate(process.argv.slice(2));
3404
- withSetupOnMissingKey(() => buildProgram().parseAsync(process.argv)).catch((err) => {
3554
+ var argv = process.argv.slice(2);
3555
+ notifyOnUpdate(argv);
3556
+ maintainHooks(argv).then(() => withSetupOnMissingKey(() => buildProgram().parseAsync(process.argv))).catch((err) => {
3405
3557
  logger.error(selfHostHint(err) ?? (err instanceof Error ? err.message : String(err)));
3406
3558
  process.exit(1);
3407
3559
  });
@@ -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-72Y2FDVS.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-6L67QMCP.js";
6
6
  import "./chunk-MYGSLK44.js";
7
- import "./chunk-GPTKSNR6.js";
7
+ import "./chunk-72Y2FDVS.js";
8
8
  import "./chunk-I3M2KJXB.js";
9
9
  export {
10
10
  cached,