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
@@ -0,0 +1,178 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ WORKFLOW_PATH,
4
+ detectInstallCommand,
5
+ renderWorkflow
6
+ } from "./chunk-A3TYI2TF.js";
7
+ import {
8
+ bold,
9
+ dim,
10
+ green,
11
+ yellow
12
+ } from "./chunk-4KCPOMG6.js";
13
+ import {
14
+ logger
15
+ } from "./chunk-MYGSLK44.js";
16
+ import {
17
+ resolveApiKey
18
+ } from "./chunk-J6XQ7OPZ.js";
19
+ import "./chunk-72Y2FDVS.js";
20
+ import {
21
+ init_esm_shims
22
+ } from "./chunk-I3M2KJXB.js";
23
+
24
+ // src/cli/autopilotInit.ts
25
+ init_esm_shims();
26
+ import { spawnSync } from "child_process";
27
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
28
+ import { dirname, join } from "path";
29
+ var LOCKFILES = ["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock"];
30
+ function parseRepoFromRemote(url) {
31
+ const trimmed = url.trim().replace(/\.git$/, "");
32
+ if (!trimmed) return null;
33
+ const match = (
34
+ // git@github.com:owner/name | ssh://git@github.com/owner/name
35
+ trimmed.match(/^(?:ssh:\/\/)?git@[^:/]+[:/]([^/]+)\/([^/]+)$/) ?? // https://github.com/owner/name
36
+ trimmed.match(/^https?:\/\/[^/]+\/([^/]+)\/([^/]+)$/)
37
+ );
38
+ if (!match) return null;
39
+ const [, owner, name] = match;
40
+ return owner && name ? `${owner}/${name}` : null;
41
+ }
42
+ function needsAgentCredential(mode) {
43
+ return mode === "pr";
44
+ }
45
+ function parseMode(raw) {
46
+ if (!raw) return "fix";
47
+ if (raw === "comment" || raw === "fix" || raw === "pr") return raw;
48
+ throw new Error(`Unknown mode "${raw}". Use comment, fix, or pr.`);
49
+ }
50
+ function run(cmd, args, cwd) {
51
+ return spawnSync(cmd, args, { cwd, encoding: "utf8" });
52
+ }
53
+ function have(cmd) {
54
+ const res = run(cmd, ["--version"]);
55
+ return res.status === 0;
56
+ }
57
+ function setSecret(repo, name, value) {
58
+ const res = spawnSync("gh", ["secret", "set", name, "--repo", repo], {
59
+ input: value,
60
+ encoding: "utf8"
61
+ });
62
+ if (res.status !== 0) {
63
+ logger.error(` could not set ${name}: ${(res.stderr || res.stdout || "").trim()}`);
64
+ return false;
65
+ }
66
+ return true;
67
+ }
68
+ function mintClaudeToken() {
69
+ const res = spawnSync("claude", ["setup-token"], {
70
+ stdio: ["inherit", "pipe", "inherit"],
71
+ encoding: "utf8"
72
+ });
73
+ if (res.status !== 0) return null;
74
+ const lines = (res.stdout ?? "").split("\n").map((l) => l.trim()).filter(Boolean);
75
+ const token = lines[lines.length - 1];
76
+ if (!token || token.includes(" ") || token.length < 20) return null;
77
+ return token;
78
+ }
79
+ async function runAutopilotInit(opts) {
80
+ const cwd = opts.cwd ?? process.cwd();
81
+ const mode = parseMode(opts.mode);
82
+ const done = [];
83
+ const todo = [];
84
+ let repo = opts.repo?.trim();
85
+ if (!repo) {
86
+ const remote = run("git", ["remote", "get-url", "origin"], cwd);
87
+ repo = remote.status === 0 && parseRepoFromRemote(remote.stdout) || void 0;
88
+ }
89
+ if (!repo) {
90
+ logger.error("Could not work out which repository this is.");
91
+ logger.error("Pass it: lurq autopilot init --repo owner/name");
92
+ process.exitCode = 1;
93
+ return;
94
+ }
95
+ const apiKey = resolveApiKey(opts.apiKey);
96
+ if (!apiKey) {
97
+ logger.error("No lurq API key on this machine. Run `lurq setup` first, then this again.");
98
+ process.exitCode = 1;
99
+ return;
100
+ }
101
+ if (!have("gh")) {
102
+ logger.error("The GitHub CLI (`gh`) is not installed. https://cli.github.com");
103
+ process.exitCode = 1;
104
+ return;
105
+ }
106
+ if (run("gh", ["auth", "status"]).status !== 0) {
107
+ logger.error("`gh` is not signed in. Run `gh auth login`, then this again.");
108
+ process.exitCode = 1;
109
+ return;
110
+ }
111
+ logger.info(`${bold("repository")} ${repo}`);
112
+ logger.info(`${bold("mode")} ${mode}
113
+ `);
114
+ if (setSecret(repo, "LURQ_API_KEY", apiKey)) done.push("LURQ_API_KEY set as a repository secret");
115
+ else {
116
+ process.exitCode = 1;
117
+ return;
118
+ }
119
+ const path = join(cwd, WORKFLOW_PATH);
120
+ if (existsSync(path) && !opts.force) {
121
+ done.push(`${WORKFLOW_PATH} already exists (left alone; --force overwrites)`);
122
+ } else {
123
+ const lockfiles = LOCKFILES.filter((f) => existsSync(join(cwd, f)));
124
+ mkdirSync(dirname(path), { recursive: true });
125
+ writeFileSync(path, renderWorkflow({ mode, installCommand: detectInstallCommand(lockfiles) }));
126
+ done.push(`${WORKFLOW_PATH} written`);
127
+ }
128
+ if (needsAgentCredential(mode) && opts.credential !== false) {
129
+ if (!have("claude")) {
130
+ todo.push(
131
+ `Set ANTHROPIC_API_KEY (from the Anthropic console) as a repository secret \u2014 pr mode fails without a credential:
132
+ gh secret set ANTHROPIC_API_KEY --repo ${repo}`
133
+ );
134
+ } else {
135
+ logger.info(dim("Minting a Claude token \u2014 sign in when prompted."));
136
+ const token = mintClaudeToken();
137
+ if (token && setSecret(repo, "CLAUDE_CODE_OAUTH_TOKEN", token)) {
138
+ done.push("CLAUDE_CODE_OAUTH_TOKEN set as a repository secret");
139
+ todo.push(
140
+ yellow("That token expires one year from today, with no warning.") + " This is a scheduled job, so it will work for a year and then stop.\n An ANTHROPIC_API_KEY from the console does not expire, and is the right one if anyone else maintains this repo."
141
+ );
142
+ } else {
143
+ todo.push(
144
+ `Could not read a token back from \`claude setup-token\`. Set one by hand:
145
+ claude setup-token
146
+ gh secret set CLAUDE_CODE_OAUTH_TOKEN --repo ${repo}`
147
+ );
148
+ }
149
+ }
150
+ }
151
+ todo.push(
152
+ `Read the workflow, then commit it \u2014 that commit is what grants write access:
153
+ git add ${WORKFLOW_PATH} && git commit -m "ci: lurq upgrade autopilot" && git push`
154
+ );
155
+ if (opts.json) {
156
+ logger.info(JSON.stringify({ repo, mode, done, todo: todo.length }, null, 2));
157
+ return;
158
+ }
159
+ logger.info("");
160
+ for (const line of done) logger.info(`${green("\u2713")} ${line}`);
161
+ logger.info(`
162
+ ${bold("Next")}`);
163
+ for (const line of todo) logger.info(` \xB7 ${line}`);
164
+ }
165
+ function workflowExists(cwd) {
166
+ return existsSync(join(cwd, WORKFLOW_PATH));
167
+ }
168
+ function readWorkflow(cwd) {
169
+ const path = join(cwd, WORKFLOW_PATH);
170
+ return existsSync(path) ? readFileSync(path, "utf8") : null;
171
+ }
172
+ export {
173
+ needsAgentCredential,
174
+ parseRepoFromRemote,
175
+ readWorkflow,
176
+ runAutopilotInit,
177
+ workflowExists
178
+ };