lurqrun 0.1.5 → 0.1.7

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 (192) hide show
  1. package/README.md +23 -13
  2. package/dist/auditHandler-JCOJSUYW.js +23 -0
  3. package/dist/bin/lurq.js +3085 -17723
  4. package/dist/browserAuth-B6G27USY.js +95 -0
  5. package/dist/cache-DKI34SVS.js +12 -0
  6. package/dist/check-2FDGUOV7.js +192 -0
  7. package/dist/checkUpgrade-F2WESBPM.js +103 -0
  8. package/dist/chunk-2VMOWSRY.js +300 -0
  9. package/dist/chunk-3GHJR7XR.js +2049 -0
  10. package/dist/chunk-3N3Q3DSW.js +214 -0
  11. package/dist/chunk-4ESO33J6.js +34 -0
  12. package/dist/chunk-4F7ZESPO.js +132 -0
  13. package/dist/chunk-4KCPOMG6.js +68 -0
  14. package/dist/chunk-4ZYCIMY4.js +155 -0
  15. package/dist/chunk-63MUJNZL.js +318 -0
  16. package/dist/chunk-6AAEVQ7I.js +6336 -0
  17. package/dist/chunk-6EQ3ARXA.js +304 -0
  18. package/dist/chunk-6L3U7DZ5.js +23 -0
  19. package/dist/chunk-AHBP533R.js +220 -0
  20. package/dist/chunk-B43LCXBM.js +223 -0
  21. package/dist/chunk-BCANRN5B.js +33 -0
  22. package/dist/chunk-BUALU27S.js +123 -0
  23. package/dist/chunk-BULZAX2U.js +1554 -0
  24. package/dist/chunk-BV32UNLL.js +154 -0
  25. package/dist/chunk-C6GLE626.js +160 -0
  26. package/dist/chunk-CIDWNUAP.js +145 -0
  27. package/dist/chunk-CUP36ND3.js +2126 -0
  28. package/dist/chunk-CW5HJ3LX.js +96 -0
  29. package/dist/chunk-DB2VF5UD.js +315 -0
  30. package/dist/chunk-DWAGCNEL.js +210 -0
  31. package/dist/chunk-EA3DP5HG.js +293 -0
  32. package/dist/chunk-ELGCAM7P.js +184 -0
  33. package/dist/chunk-FW6BD2NO.js +1915 -0
  34. package/dist/chunk-GE37NVLN.js +15 -0
  35. package/dist/chunk-GPTKSNR6.js +171 -0
  36. package/dist/chunk-GRJXQBQZ.js +793 -0
  37. package/dist/chunk-HWBBVLOT.js +92 -0
  38. package/dist/chunk-I2JUKN6Z.js +24 -0
  39. package/dist/chunk-I3M2KJXB.js +56 -0
  40. package/dist/chunk-IQ4SDKKY.js +733 -0
  41. package/dist/chunk-J5FZYN4A.js +116 -0
  42. package/dist/chunk-L6N4JFW2.js +263 -0
  43. package/dist/chunk-LBFGSSF2.js +126 -0
  44. package/dist/chunk-LEGPB7DO.js +81 -0
  45. package/dist/chunk-LO35HLQZ.js +219 -0
  46. package/dist/chunk-LRD4GBYE.js +73 -0
  47. package/dist/chunk-LUAKDHLZ.js +40 -0
  48. package/dist/chunk-LYMPYETA.js +965 -0
  49. package/dist/chunk-M6NYEXCW.js +38 -0
  50. package/dist/chunk-MHUEVBVO.js +35 -0
  51. package/dist/chunk-MYGSLK44.js +37 -0
  52. package/dist/chunk-NH5I4KHH.js +201 -0
  53. package/dist/chunk-OQS4GUSI.js +1391 -0
  54. package/dist/chunk-PSX3GIAN.js +176 -0
  55. package/dist/chunk-Q5VPF4WI.js +26 -0
  56. package/dist/chunk-QKGYDMWB.js +7409 -0
  57. package/dist/chunk-QSL6QN5X.js +115 -0
  58. package/dist/chunk-SHCEBP3J.js +107 -0
  59. package/dist/chunk-SJOVFF7B.js +201 -0
  60. package/dist/chunk-ST2X2GYN.js +373 -0
  61. package/dist/chunk-TNTXWSYA.js +19 -0
  62. package/dist/chunk-U5AT3TD4.js +2128 -0
  63. package/dist/chunk-UDVNA7EA.js +483 -0
  64. package/dist/chunk-VL2E5T2A.js +109 -0
  65. package/dist/chunk-VLRHFMGJ.js +58 -0
  66. package/dist/chunk-WHX2ZFCG.js +4048 -0
  67. package/dist/chunk-WQ23REYT.js +37 -0
  68. package/dist/chunk-XBIDMHSK.js +15425 -0
  69. package/dist/chunk-Y5GI7RL3.js +66 -0
  70. package/dist/client-IRKAMDYZ.js +15 -0
  71. package/dist/commands-FIL5ET6P.js +911 -0
  72. package/dist/compat-R3UTFQ5Q.js +201 -0
  73. package/dist/dashboardIssue-WYYMBFIB.js +192 -0
  74. package/dist/diff-GZA2774U.js +13 -0
  75. package/dist/dist-4XXIXHHZ.js +12945 -0
  76. package/dist/e2b-FVPHDULZ.js +172 -0
  77. package/dist/extract-NKGKLIVT.js +444 -0
  78. package/dist/fetch-QYTUJVG2.js +22 -0
  79. package/dist/firstTouch-QQTJH4QX.js +55 -0
  80. package/dist/handlers-GEJAVZDK.js +53 -0
  81. package/dist/http-ETPYMBGD.js +5360 -0
  82. package/dist/ingestQueue-VKN4KBIF.js +35 -0
  83. package/dist/install-EK3W2COX.js +20 -0
  84. package/dist/installSkill-VQJWJVCL.js +52 -0
  85. package/dist/inventory-5AWSLJYU.js +31 -0
  86. package/dist/local-XPZMRH5R.js +13 -0
  87. package/dist/mcp-3JHD5SUZ.js +472 -0
  88. package/dist/mcpHandlers-QFN4MCFL.js +22 -0
  89. package/dist/mcpScan-QZHWENIP.js +1871 -0
  90. package/dist/mcpScanWorkflow-JPYCBGC4.js +81 -0
  91. package/dist/mcpStack-BYJCZNIV.js +20 -0
  92. package/dist/packages-THVFMWFP.js +42 -0
  93. package/dist/plan-V4OEI3J4.js +463 -0
  94. package/dist/planView-JRXGCG2N.js +79 -0
  95. package/dist/policy-3P6BGRDN.js +115 -0
  96. package/dist/references-6N7VEPHT.js +14 -0
  97. package/dist/release-4U4ABNSJ.js +128 -0
  98. package/dist/remote-YGCXYI4V.js +32 -0
  99. package/dist/reportRuns-CKQQYLY4.js +64 -0
  100. package/dist/sandbox-MEZLAODF.js +39 -0
  101. package/dist/server-KFUD5X57.js +55 -0
  102. package/dist/surface-V62GE554.js +141 -0
  103. package/dist/surface-YL6O67W3.js +36 -0
  104. package/dist/surfaceHandlers-X2IZKA3E.js +20 -0
  105. package/dist/typecheck-X7U5ELMR.js +268 -0
  106. package/dist/types-M5JP2W3D.js +10 -0
  107. package/dist/uninstall-P7RGBX6G.js +174 -0
  108. package/dist/upgrade-NQ5IWFZB.js +596 -0
  109. package/dist/upgradePlan-A4LRKLEG.js +146 -0
  110. package/dist/userConfig-Z3GQE776.js +20 -0
  111. package/dist/watch-DGFMWUDL.js +214 -0
  112. package/package.json +41 -26
  113. package/templates/agent-rules.md +4 -4
  114. package/templates/skill-instructions.md +18 -14
  115. package/dist/bin/lurq.js.map +0 -1
  116. package/dist/index.d.ts +0 -764
  117. package/dist/index.js +0 -17992
  118. package/dist/index.js.map +0 -1
  119. package/drizzle/0000_confused_fabian_cortez.sql +0 -54
  120. package/drizzle/0001_aspiring_timeslip.sql +0 -15
  121. package/drizzle/0002_lyrical_lila_cheney.sql +0 -14
  122. package/drizzle/0003_violet_giant_girl.sql +0 -14
  123. package/drizzle/0004_slim_valeria_richards.sql +0 -15
  124. package/drizzle/0005_petite_luke_cage.sql +0 -12
  125. package/drizzle/0006_calm_nighthawk.sql +0 -3
  126. package/drizzle/0007_slimy_naoko.sql +0 -1
  127. package/drizzle/0008_peaceful_tigra.sql +0 -1
  128. package/drizzle/0009_smooth_harrier.sql +0 -10
  129. package/drizzle/0010_curved_amphibian.sql +0 -2
  130. package/drizzle/0011_compat_provenance_closures.sql +0 -11
  131. package/drizzle/0012_api_surfaces.sql +0 -9
  132. package/drizzle/0013_nice_thanos.sql +0 -1
  133. package/drizzle/0014_luxuriant_malcolm_colcord.sql +0 -10
  134. package/drizzle/0015_past_fat_cobra.sql +0 -11
  135. package/drizzle/0016_futuristic_junta.sql +0 -50
  136. package/drizzle/0017_absent_grandmaster.sql +0 -20
  137. package/drizzle/0018_rainy_proemial_gods.sql +0 -1
  138. package/drizzle/0019_dashing_korvac.sql +0 -11
  139. package/drizzle/0020_normal_vulture.sql +0 -3
  140. package/drizzle/0021_dazzling_blue_shield.sql +0 -17
  141. package/drizzle/0022_massive_ghost_rider.sql +0 -24
  142. package/drizzle/0023_next_shatterstar.sql +0 -1
  143. package/drizzle/0024_dusty_maelstrom.sql +0 -15
  144. package/drizzle/0025_gifted_harpoon.sql +0 -5
  145. package/drizzle/0026_awesome_mordo.sql +0 -1
  146. package/drizzle/0027_charming_ulik.sql +0 -2
  147. package/drizzle/0028_romantic_loners.sql +0 -2
  148. package/drizzle/0029_busy_korvac.sql +0 -16
  149. package/drizzle/0030_steady_mathemanic.sql +0 -6
  150. package/drizzle/0031_redundant_maginty.sql +0 -2
  151. package/drizzle/0032_stack_resolutions.sql +0 -14
  152. package/drizzle/0033_graceful_tyger_tiger.sql +0 -3
  153. package/drizzle/0034_api_key_scopes.sql +0 -1
  154. package/drizzle/0035_policy_audit.sql +0 -21
  155. package/drizzle/meta/0000_snapshot.json +0 -370
  156. package/drizzle/meta/0001_snapshot.json +0 -482
  157. package/drizzle/meta/0002_snapshot.json +0 -575
  158. package/drizzle/meta/0003_snapshot.json +0 -667
  159. package/drizzle/meta/0004_snapshot.json +0 -769
  160. package/drizzle/meta/0005_snapshot.json +0 -864
  161. package/drizzle/meta/0006_snapshot.json +0 -882
  162. package/drizzle/meta/0007_snapshot.json +0 -876
  163. package/drizzle/meta/0008_snapshot.json +0 -882
  164. package/drizzle/meta/0009_snapshot.json +0 -948
  165. package/drizzle/meta/0010_snapshot.json +0 -969
  166. package/drizzle/meta/0011_snapshot.json +0 -1049
  167. package/drizzle/meta/0012_snapshot.json +0 -1115
  168. package/drizzle/meta/0013_snapshot.json +0 -1121
  169. package/drizzle/meta/0014_snapshot.json +0 -1190
  170. package/drizzle/meta/0015_snapshot.json +0 -1280
  171. package/drizzle/meta/0016_snapshot.json +0 -1683
  172. package/drizzle/meta/0017_snapshot.json +0 -1834
  173. package/drizzle/meta/0018_snapshot.json +0 -1834
  174. package/drizzle/meta/0019_snapshot.json +0 -1909
  175. package/drizzle/meta/0020_snapshot.json +0 -1921
  176. package/drizzle/meta/0021_snapshot.json +0 -2045
  177. package/drizzle/meta/0022_snapshot.json +0 -2246
  178. package/drizzle/meta/0023_snapshot.json +0 -2252
  179. package/drizzle/meta/0024_snapshot.json +0 -2375
  180. package/drizzle/meta/0025_snapshot.json +0 -2407
  181. package/drizzle/meta/0026_snapshot.json +0 -2413
  182. package/drizzle/meta/0027_snapshot.json +0 -2425
  183. package/drizzle/meta/0028_snapshot.json +0 -2438
  184. package/drizzle/meta/0029_snapshot.json +0 -2546
  185. package/drizzle/meta/0030_snapshot.json +0 -2586
  186. package/drizzle/meta/0031_snapshot.json +0 -2598
  187. package/drizzle/meta/0032_snapshot.json +0 -2699
  188. package/drizzle/meta/0033_snapshot.json +0 -2712
  189. package/drizzle/meta/0034_snapshot.json +0 -2719
  190. package/drizzle/meta/0035_snapshot.json +0 -2869
  191. package/drizzle/meta/_journal.json +0 -258
  192. package/src/data/seed.json +0 -253
@@ -0,0 +1,154 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ encodeNpmName
4
+ } from "./chunk-AHBP533R.js";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-I3M2KJXB.js";
8
+
9
+ // src/surface/fetch.ts
10
+ init_esm_shims();
11
+ import { execFile } from "child_process";
12
+ import { createHash } from "crypto";
13
+ import { mkdir, mkdtemp, readFile, rm, writeFile } from "fs/promises";
14
+ import { tmpdir } from "os";
15
+ import { join } from "path";
16
+ import { promisify } from "util";
17
+ var execFileP = promisify(execFile);
18
+ var FETCH_TIMEOUT_MS = 6e4;
19
+ var MAX_TARBALL_BYTES = 64 * 1024 * 1024;
20
+ var RETRIES = 3;
21
+ var RETRY_BASE_MS = 400;
22
+ var MAX_RETRY_AFTER_MS = 1e4;
23
+ async function fetchWithRetry(fetchImpl, url, init = {}) {
24
+ for (let attempt = 0; ; attempt++) {
25
+ let res;
26
+ try {
27
+ res = await fetchImpl(url, { ...init, signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
28
+ } catch (err) {
29
+ if (attempt >= RETRIES) throw err;
30
+ }
31
+ if (res && res.status !== 429 && res.status < 500) return res;
32
+ if (res && attempt >= RETRIES) return res;
33
+ const retryAfter = Number(res?.headers.get("retry-after"));
34
+ const wait = Number.isFinite(retryAfter) && retryAfter > 0 ? Math.min(retryAfter * 1e3, MAX_RETRY_AFTER_MS) : RETRY_BASE_MS * 2 ** attempt;
35
+ await new Promise((resolve) => setTimeout(resolve, wait));
36
+ }
37
+ }
38
+ async function resolveTarball(name, version, fetchImpl = fetch) {
39
+ const body = await registryVersion(name, version, fetchImpl);
40
+ if (!body?.dist?.tarball || !body.version) return null;
41
+ return {
42
+ tarball: body.dist.tarball,
43
+ version: body.version,
44
+ ...body.dist.integrity ? { integrity: body.dist.integrity } : {},
45
+ ...body.dist.shasum ? { shasum: body.dist.shasum } : {}
46
+ };
47
+ }
48
+ async function registryVersion(name, version, fetchImpl) {
49
+ const spec = version ?? "latest";
50
+ const url = `https://registry.npmjs.org/${encodeNpmName(name)}/${encodeURIComponent(spec)}`;
51
+ const res = await fetchWithRetry(fetchImpl, url, { headers: { accept: "application/json" } });
52
+ if (res.status === 404) return null;
53
+ if (!res.ok) throw new Error(`registry answered ${res.status} for ${name}@${spec}`);
54
+ return res.json();
55
+ }
56
+ async function fetchManifest(name, version, fetchImpl = fetch) {
57
+ const body = await registryVersion(name, version, fetchImpl);
58
+ return body && typeof body === "object" ? body : null;
59
+ }
60
+ function verifyIntegrity(buf, dist, label) {
61
+ const sri = dist.integrity?.split(/\s+/).find((s) => s.startsWith("sha512-"));
62
+ if (sri) {
63
+ if (createHash("sha512").update(buf).digest("base64") !== sri.slice("sha512-".length)) {
64
+ throw new Error(`tarball integrity mismatch for ${label}`);
65
+ }
66
+ return;
67
+ }
68
+ if (dist.shasum && createHash("sha1").update(buf).digest("hex") !== dist.shasum) {
69
+ throw new Error(`tarball shasum mismatch for ${label}`);
70
+ }
71
+ }
72
+ async function unpackPackage(name, version, fetchImpl = fetch) {
73
+ const dist = await resolveTarball(name, version, fetchImpl);
74
+ if (!dist) return null;
75
+ const res = await fetchWithRetry(fetchImpl, dist.tarball);
76
+ if (!res.ok) throw new Error(`tarball fetch failed: ${res.status} ${dist.tarball}`);
77
+ const buf = Buffer.from(await res.arrayBuffer());
78
+ if (buf.byteLength > MAX_TARBALL_BYTES) {
79
+ throw new Error(`tarball exceeds ${MAX_TARBALL_BYTES} bytes: ${name}@${dist.version}`);
80
+ }
81
+ verifyIntegrity(buf, dist, `${name}@${dist.version}`);
82
+ const artifactHash = createHash("sha256").update(buf).digest("hex");
83
+ const dir = await mkdtemp(join(tmpdir(), "lurq-surface-"));
84
+ const cleanup = () => rm(dir, { recursive: true, force: true }).catch(() => {
85
+ });
86
+ try {
87
+ const tgz = join(dir, "pkg.tgz");
88
+ const pkgDir = join(dir, "pkg");
89
+ await mkdir(pkgDir, { recursive: true });
90
+ await writeFile(tgz, buf);
91
+ await execFileP("tar", ["xzf", tgz, "--strip-components=1", "-C", pkgDir], {
92
+ timeout: FETCH_TIMEOUT_MS
93
+ });
94
+ return { pkgDir, version: dist.version, artifactHash, cleanup };
95
+ } catch (err) {
96
+ await cleanup();
97
+ throw err;
98
+ }
99
+ }
100
+ async function extractUnpacked(name, unpacked, subpaths) {
101
+ const { pkgDir, version, artifactHash } = unpacked;
102
+ try {
103
+ await readFile(join(pkgDir, "package.json"), "utf8");
104
+ } catch {
105
+ return {
106
+ surface: {
107
+ package: name,
108
+ version,
109
+ tier: "shipped_js_ast",
110
+ entry: null,
111
+ symbols: [],
112
+ filesWalked: 0,
113
+ externalReExports: [],
114
+ undeclaredReason: "tarball contains no readable package.json"
115
+ },
116
+ artifactHash,
117
+ resolvedVersion: version
118
+ };
119
+ }
120
+ const { extractSurface } = await import("./extract-NKGKLIVT.js");
121
+ const surface = extractSurface(pkgDir);
122
+ const subpathSurfaces = {};
123
+ for (const sub of new Set(subpaths ?? [])) {
124
+ subpathSurfaces[sub] = {
125
+ ...extractSurface(pkgDir, { subpath: sub }),
126
+ package: `${name}/${sub}`,
127
+ version
128
+ };
129
+ }
130
+ return {
131
+ surface: { ...surface, package: name, version },
132
+ ...subpaths?.length ? { subpathSurfaces } : {},
133
+ artifactHash,
134
+ resolvedVersion: version
135
+ };
136
+ }
137
+ async function fetchAndExtract(name, version, opts = {}) {
138
+ const unpacked = await unpackPackage(name, version, opts.fetchImpl ?? fetch);
139
+ if (!unpacked) return null;
140
+ try {
141
+ return await extractUnpacked(name, unpacked, opts.subpaths);
142
+ } finally {
143
+ await unpacked.cleanup();
144
+ }
145
+ }
146
+
147
+ export {
148
+ resolveTarball,
149
+ fetchManifest,
150
+ verifyIntegrity,
151
+ unpackPackage,
152
+ extractUnpacked,
153
+ fetchAndExtract
154
+ };
@@ -0,0 +1,160 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ DEFAULT_TARGET
4
+ } from "./chunk-GE37NVLN.js";
5
+ import {
6
+ init_esm_shims
7
+ } from "./chunk-I3M2KJXB.js";
8
+
9
+ // src/sandbox/local.ts
10
+ init_esm_shims();
11
+ import { execFile } from "child_process";
12
+ import { mkdtemp, rm, writeFile } from "fs/promises";
13
+ import { tmpdir } from "os";
14
+ import { join } from "path";
15
+ import { promisify } from "util";
16
+ var execFileAsync = promisify(execFile);
17
+ var INSTALL_TIMEOUT_MS = 12e4;
18
+ var SMOKE_TIMEOUT_MS = 3e4;
19
+ var ERROR_MAX = 500;
20
+ var EXEC_MAX_BUFFER = 8 * 1024 * 1024;
21
+ function npmInstallArgs(specs, opts) {
22
+ const bad = specs.find((s) => s.startsWith("-"));
23
+ if (bad) throw new Error(`Invalid package spec: ${bad}`);
24
+ const args = ["install", ...specs, "--no-audit", "--no-fund", "--no-package-lock", "--no-save"];
25
+ if (!opts.allowScripts) args.push("--ignore-scripts");
26
+ return args;
27
+ }
28
+ function smokeScript(pkg) {
29
+ return ["--input-type=module", "-e", `await import(${JSON.stringify(pkg)})`];
30
+ }
31
+ function condense(s) {
32
+ return s.replace(/\s+/g, " ").trim().slice(0, ERROR_MAX);
33
+ }
34
+ function stderrOf(err) {
35
+ if (err && typeof err === "object") {
36
+ const e = err;
37
+ if (typeof e.stderr === "string" && e.stderr.trim()) return e.stderr;
38
+ if (typeof e.message === "string") return e.message;
39
+ }
40
+ return String(err);
41
+ }
42
+ var toSpec = (p) => p.version ? `${p.name}@${p.version}` : p.name;
43
+ var LocalSandbox = class {
44
+ name = "local";
45
+ async verify(pkg, version, opts = {}) {
46
+ const set = await this.verifySet([{ name: pkg, version }], opts);
47
+ return {
48
+ driver: this.name,
49
+ moduleSystem: set.moduleSystem,
50
+ installed: set.installed,
51
+ imported: set.loaded[0]?.loaded ?? null,
52
+ ranScripts: opts.allowScripts ?? false,
53
+ durationMs: set.durationMs,
54
+ error: set.error
55
+ };
56
+ }
57
+ async verifySet(packages, opts = {}) {
58
+ const target = opts.target ?? DEFAULT_TARGET;
59
+ const allowScripts = opts.allowScripts ?? false;
60
+ const specs = packages.map(toSpec);
61
+ const dir = await mkdtemp(join(tmpdir(), "lurq-sandbox-"));
62
+ const started = Date.now();
63
+ const smokeTargets = opts.smokePackages ?? packages;
64
+ const loaded = smokeTargets.map((p) => ({ name: p.name, loaded: null }));
65
+ let installed = false;
66
+ let error = null;
67
+ try {
68
+ await writeFile(
69
+ join(dir, "package.json"),
70
+ JSON.stringify({ name: "lurq-sandbox", version: "0.0.0", private: true })
71
+ );
72
+ await execFileAsync("npm", npmInstallArgs(specs, { allowScripts }), {
73
+ cwd: dir,
74
+ timeout: opts.timeoutMs ?? INSTALL_TIMEOUT_MS,
75
+ signal: opts.signal
76
+ });
77
+ installed = true;
78
+ for (let i = 0; i < smokeTargets.length; i++) {
79
+ try {
80
+ await execFileAsync("node", smokeScript(smokeTargets[i].name), {
81
+ cwd: dir,
82
+ timeout: SMOKE_TIMEOUT_MS,
83
+ signal: opts.signal
84
+ });
85
+ loaded[i].loaded = true;
86
+ } catch (err) {
87
+ loaded[i].loaded = false;
88
+ if (!error) error = condense(stderrOf(err));
89
+ }
90
+ }
91
+ } catch (err) {
92
+ error = condense(stderrOf(err));
93
+ } finally {
94
+ await rm(dir, { recursive: true, force: true }).catch(() => {
95
+ });
96
+ }
97
+ return {
98
+ driver: this.name,
99
+ moduleSystem: target.moduleSystem,
100
+ installed,
101
+ loaded,
102
+ durationMs: Date.now() - started,
103
+ error
104
+ };
105
+ }
106
+ async exec(command, opts = {}) {
107
+ const dir = await mkdtemp(join(tmpdir(), "lurq-exec-"));
108
+ try {
109
+ await writeFile(
110
+ join(dir, "package.json"),
111
+ JSON.stringify({ name: "lurq-sandbox", version: "0.0.0", private: true })
112
+ );
113
+ if (opts.install?.length) {
114
+ await execFileAsync(
115
+ "npm",
116
+ npmInstallArgs(opts.install.map(toSpec), { allowScripts: opts.allowScripts ?? false }),
117
+ { cwd: dir, timeout: INSTALL_TIMEOUT_MS, signal: opts.signal }
118
+ );
119
+ }
120
+ const { stdout, stderr } = await execFileAsync("sh", ["-c", command], {
121
+ cwd: dir,
122
+ timeout: opts.timeoutMs ?? SMOKE_TIMEOUT_MS,
123
+ signal: opts.signal,
124
+ maxBuffer: EXEC_MAX_BUFFER
125
+ });
126
+ return { exitCode: 0, stdout, stderr };
127
+ } catch (err) {
128
+ const e = err;
129
+ if (typeof e?.code === "number") {
130
+ return {
131
+ exitCode: e.code,
132
+ stdout: typeof e.stdout === "string" ? e.stdout : "",
133
+ stderr: typeof e.stderr === "string" ? e.stderr : stderrOf(err)
134
+ };
135
+ }
136
+ throw err;
137
+ } finally {
138
+ await rm(dir, { recursive: true, force: true }).catch(() => {
139
+ });
140
+ }
141
+ }
142
+ async getRuntimeInfo() {
143
+ let nodeVersion = "unknown";
144
+ let npmVersion = "unknown";
145
+ try {
146
+ const nodeOut = await execFileAsync("node", ["--version"]);
147
+ nodeVersion = nodeOut.stdout.trim() || "unknown";
148
+ const npmOut = await execFileAsync("npm", ["--version"]);
149
+ npmVersion = npmOut.stdout.trim() || "unknown";
150
+ } catch {
151
+ }
152
+ return { nodeVersion, npmVersion };
153
+ }
154
+ };
155
+
156
+ export {
157
+ npmInstallArgs,
158
+ smokeScript,
159
+ LocalSandbox
160
+ };
@@ -0,0 +1,145 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ require_semver
4
+ } from "./chunk-3GHJR7XR.js";
5
+ import {
6
+ __toESM,
7
+ init_esm_shims
8
+ } from "./chunk-I3M2KJXB.js";
9
+
10
+ // src/api/diff.ts
11
+ init_esm_shims();
12
+ var import_semver = __toESM(require_semver(), 1);
13
+ var BREAKING = /* @__PURE__ */ new Set([
14
+ "operation-removed",
15
+ "required-param-added",
16
+ "param-now-required",
17
+ "required-body-field-added",
18
+ "response-removed"
19
+ ]);
20
+ var change = (kind, operation, detail) => ({
21
+ kind,
22
+ operation,
23
+ ...detail ? { detail } : {},
24
+ breaking: BREAKING.has(kind)
25
+ });
26
+ var missing = (a, b) => {
27
+ const has = new Set(b);
28
+ return a.filter((x) => !has.has(x));
29
+ };
30
+ function compareOperation(before, after) {
31
+ const out = [];
32
+ for (const param of missing(after.requiredParams, before.requiredParams)) {
33
+ out.push(
34
+ change(
35
+ before.optionalParams.includes(param) ? "param-now-required" : "required-param-added",
36
+ after.id,
37
+ param
38
+ )
39
+ );
40
+ }
41
+ for (const param of missing(after.optionalParams, before.optionalParams)) {
42
+ out.push(change("optional-param-added", after.id, param));
43
+ }
44
+ for (const field of missing(after.requiredBodyFields, before.requiredBodyFields)) {
45
+ out.push(change("required-body-field-added", after.id, field));
46
+ }
47
+ for (const code of missing(before.responseCodes, after.responseCodes)) {
48
+ out.push(change("response-removed", after.id, code));
49
+ }
50
+ for (const code of missing(after.responseCodes, before.responseCodes)) {
51
+ out.push(change("response-added", after.id, code));
52
+ }
53
+ if (after.deprecated && !before.deprecated) out.push(change("operation-deprecated", after.id));
54
+ return out;
55
+ }
56
+ function diffApiSurfaces(before, after) {
57
+ if (before.unreadableReason) return { breaking: [], other: [], inconclusive: `previous revision: ${before.unreadableReason}` };
58
+ if (after.unreadableReason) return { breaking: [], other: [], inconclusive: `current revision: ${after.unreadableReason}` };
59
+ const changes = [];
60
+ for (const [id, op] of before.operations) {
61
+ const next = after.operations.get(id);
62
+ if (!next) {
63
+ changes.push(change("operation-removed", id));
64
+ continue;
65
+ }
66
+ changes.push(...compareOperation(op, next));
67
+ }
68
+ for (const id of after.operations.keys()) {
69
+ if (!before.operations.has(id)) changes.push(change("operation-added", id));
70
+ }
71
+ return {
72
+ breaking: changes.filter((c) => c.breaking),
73
+ other: changes.filter((c) => !c.breaking)
74
+ };
75
+ }
76
+ function checkApi(before, after) {
77
+ const diff = diffApiSurfaces(before, after);
78
+ const base = {
79
+ title: after.title ?? before.title,
80
+ fromVersion: before.version,
81
+ toVersion: after.version,
82
+ diff
83
+ };
84
+ if (diff.inconclusive) {
85
+ return { ...base, verdict: "inconclusive", versionCovers: null };
86
+ }
87
+ const from = before.version && import_semver.default.valid(before.version);
88
+ const to = after.version && import_semver.default.valid(after.version);
89
+ const versionCovers = from && to ? diff.breaking.length > 0 ? import_semver.default.major(to) > import_semver.default.major(from) : import_semver.default.gte(to, from) : null;
90
+ return { ...base, verdict: diff.breaking.length > 0 ? "breaking" : "ok", versionCovers };
91
+ }
92
+ var LIST_CAP = 15;
93
+ var LABEL = {
94
+ "operation-removed": "removed",
95
+ "required-param-added": "new required param",
96
+ "param-now-required": "now required",
97
+ "required-body-field-added": "new required body field",
98
+ "response-removed": "response removed",
99
+ "operation-added": "added",
100
+ "optional-param-added": "new optional param",
101
+ "response-added": "response added",
102
+ "operation-deprecated": "deprecated"
103
+ };
104
+ function renderChanges(changes) {
105
+ const shown = changes.slice(0, LIST_CAP);
106
+ const lines = shown.map(
107
+ (c) => ` \xB7 ${c.operation}${c.detail ? ` \u2192 ${c.detail}` : ""} ${LABEL[c.kind]}`
108
+ );
109
+ if (changes.length > shown.length) lines.push(` \u2026 ${changes.length - shown.length} more`);
110
+ return lines;
111
+ }
112
+ function formatApiCheck(check, label = "api check") {
113
+ const out = [`lurq, ${label}${check.title ? ` \u2014 ${check.title}` : ""}`, ""];
114
+ if (check.verdict === "inconclusive") {
115
+ out.push(`INCONCLUSIVE ${check.diff.inconclusive}`, "", "No verdict. This is not a pass.");
116
+ return out.join("\n");
117
+ }
118
+ const versions = check.fromVersion && check.toVersion ? ` ${check.fromVersion} \u2192 ${check.toVersion}` : "";
119
+ if (check.diff.breaking.length) {
120
+ out.push(`BREAKING${versions}`, "");
121
+ out.push(` ${check.diff.breaking.length} change(s) that break existing callers:`);
122
+ out.push(...renderChanges(check.diff.breaking));
123
+ } else {
124
+ out.push(`OK${versions}`, "", " Nothing here breaks an existing caller.");
125
+ }
126
+ if (check.diff.other.length) {
127
+ out.push("", ` ${check.diff.other.length} other change(s):`);
128
+ out.push(...renderChanges(check.diff.other));
129
+ }
130
+ if (check.versionCovers === false) {
131
+ out.push(
132
+ "",
133
+ check.diff.breaking.length ? ` info.version went ${check.fromVersion} \u2192 ${check.toVersion}. A breaking change needs a major.` : ` info.version went ${check.fromVersion} \u2192 ${check.toVersion}, which is not ahead.`
134
+ );
135
+ } else if (check.versionCovers === null && (check.fromVersion || check.toVersion)) {
136
+ out.push("", " info.version is not semver on both sides, so the bump was not judged.");
137
+ }
138
+ return out.join("\n");
139
+ }
140
+
141
+ export {
142
+ diffApiSurfaces,
143
+ checkApi,
144
+ formatApiCheck
145
+ };