lurqrun 0.1.6 → 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 (206) hide show
  1. package/README.md +18 -10
  2. package/dist/auditHandler-JCOJSUYW.js +23 -0
  3. package/dist/bin/lurq.js +3090 -23306
  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 +26 -21
  113. package/templates/agent-rules.md +4 -4
  114. package/templates/skill-instructions.md +13 -14
  115. package/dist/bin/lurq.js.map +0 -1
  116. package/dist/index.d.ts +0 -805
  117. package/dist/index.js +0 -23570
  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_uneven_thunderbird.sql +0 -1
  154. package/drizzle/0035_api_key_scopes.sql +0 -1
  155. package/drizzle/0036_policy_audit.sql +0 -21
  156. package/drizzle/0037_subscription_seats.sql +0 -1
  157. package/drizzle/0038_symbol_offsets.sql +0 -2
  158. package/drizzle/0039_mcp_runtime_scans.sql +0 -80
  159. package/drizzle/0040_subscription_overage_and_interval.sql +0 -4
  160. package/drizzle/0041_account_email.sql +0 -38
  161. package/drizzle/0042_alert_channels.sql +0 -21
  162. package/drizzle/meta/0000_snapshot.json +0 -370
  163. package/drizzle/meta/0001_snapshot.json +0 -482
  164. package/drizzle/meta/0002_snapshot.json +0 -575
  165. package/drizzle/meta/0003_snapshot.json +0 -667
  166. package/drizzle/meta/0004_snapshot.json +0 -769
  167. package/drizzle/meta/0005_snapshot.json +0 -864
  168. package/drizzle/meta/0006_snapshot.json +0 -882
  169. package/drizzle/meta/0007_snapshot.json +0 -876
  170. package/drizzle/meta/0008_snapshot.json +0 -882
  171. package/drizzle/meta/0009_snapshot.json +0 -948
  172. package/drizzle/meta/0010_snapshot.json +0 -969
  173. package/drizzle/meta/0011_snapshot.json +0 -1049
  174. package/drizzle/meta/0012_snapshot.json +0 -1115
  175. package/drizzle/meta/0013_snapshot.json +0 -1121
  176. package/drizzle/meta/0014_snapshot.json +0 -1190
  177. package/drizzle/meta/0015_snapshot.json +0 -1280
  178. package/drizzle/meta/0016_snapshot.json +0 -1683
  179. package/drizzle/meta/0017_snapshot.json +0 -1834
  180. package/drizzle/meta/0018_snapshot.json +0 -1834
  181. package/drizzle/meta/0019_snapshot.json +0 -1909
  182. package/drizzle/meta/0020_snapshot.json +0 -1921
  183. package/drizzle/meta/0021_snapshot.json +0 -2045
  184. package/drizzle/meta/0022_snapshot.json +0 -2246
  185. package/drizzle/meta/0023_snapshot.json +0 -2252
  186. package/drizzle/meta/0024_snapshot.json +0 -2375
  187. package/drizzle/meta/0025_snapshot.json +0 -2407
  188. package/drizzle/meta/0026_snapshot.json +0 -2413
  189. package/drizzle/meta/0027_snapshot.json +0 -2425
  190. package/drizzle/meta/0028_snapshot.json +0 -2438
  191. package/drizzle/meta/0029_snapshot.json +0 -2546
  192. package/drizzle/meta/0030_snapshot.json +0 -2586
  193. package/drizzle/meta/0031_snapshot.json +0 -2598
  194. package/drizzle/meta/0032_snapshot.json +0 -2699
  195. package/drizzle/meta/0033_snapshot.json +0 -2712
  196. package/drizzle/meta/0034_snapshot.json +0 -2719
  197. package/drizzle/meta/0035_snapshot.json +0 -2726
  198. package/drizzle/meta/0036_snapshot.json +0 -2876
  199. package/drizzle/meta/0037_snapshot.json +0 -2883
  200. package/drizzle/meta/0038_snapshot.json +0 -2895
  201. package/drizzle/meta/0039_snapshot.json +0 -3501
  202. package/drizzle/meta/0040_snapshot.json +0 -3527
  203. package/drizzle/meta/0041_snapshot.json +0 -3824
  204. package/drizzle/meta/0042_snapshot.json +0 -3960
  205. package/drizzle/meta/_journal.json +0 -307
  206. package/src/data/seed.json +0 -253
@@ -0,0 +1,268 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ init_esm_shims
4
+ } from "./chunk-I3M2KJXB.js";
5
+
6
+ // src/surface/typecheck.ts
7
+ init_esm_shims();
8
+ import { createRequire } from "module";
9
+ import { dirname, join, relative, resolve } from "path";
10
+ var DEFAULT_BUDGET_MS = 18e4;
11
+ var MESSAGE_CAP = 300;
12
+ var HOP_CAP = 300;
13
+ async function loadCompiler(rootDir) {
14
+ try {
15
+ return createRequire(join(resolve(rootDir), "package.json"))("typescript");
16
+ } catch {
17
+ try {
18
+ return (await import("typescript")).default;
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+ }
24
+ async function createTypeChecker(rootDir, opts = {}) {
25
+ const ts = await loadCompiler(rootDir);
26
+ return ts ? typeChecker(ts, rootDir, opts) : void 0;
27
+ }
28
+ function typeChecker(ts, rootDir, opts = {}) {
29
+ const root = resolve(rootDir);
30
+ const expiresAt = Date.now() + (opts.budgetMs ?? DEFAULT_BUDGET_MS);
31
+ const configs = /* @__PURE__ */ new Map();
32
+ const shareSourceFiles = Number(ts.versionMajorMinor.split(".")[0]) >= 5;
33
+ const caches = /* @__PURE__ */ new Map();
34
+ const parse = (configPath) => {
35
+ if (!configs.has(configPath)) {
36
+ const parsed = ts.getParsedCommandLineOfConfigFile(configPath, {}, {
37
+ ...ts.sys,
38
+ onUnRecoverableConfigFileDiagnostic: () => {
39
+ }
40
+ });
41
+ configs.set(configPath, parsed ?? null);
42
+ }
43
+ return configs.get(configPath);
44
+ };
45
+ return (pkg, fromDir, toDir, files) => {
46
+ if (Date.now() > expiresAt) {
47
+ return { checked: false, reason: "type check budget used up by earlier packages" };
48
+ }
49
+ const groups = groupByProject(ts, root, files, parse);
50
+ if (groups.size === 0) {
51
+ return { checked: false, reason: "no tsconfig.json includes the files that import it" };
52
+ }
53
+ const installedVersion = manifestVersion(ts, fromDir);
54
+ const introduced = [];
55
+ let covered = 0;
56
+ for (const [configPath, group] of groups) {
57
+ let cache = caches.get(configPath);
58
+ if (!cache) caches.set(configPath, cache = /* @__PURE__ */ new Map());
59
+ const shared = shareSourceFiles ? cache : /* @__PURE__ */ new Map();
60
+ const before = build(ts, group.parsed, pkg, fromDir, installedVersion, shared, false);
61
+ if ("reason" in before) return { checked: false, reason: `old version: ${before.reason}` };
62
+ const files2 = [...group.files, ...importersOf(ts, before.program, group.files)];
63
+ const beforeDiagnostics = semanticDiagnostics(before.program, files2);
64
+ if (Date.now() > expiresAt) return { checked: false, reason: "type check ran out of time" };
65
+ const after = build(ts, group.parsed, pkg, toDir, installedVersion, shared, true);
66
+ if ("reason" in after) return { checked: false, reason: after.reason };
67
+ const missingBefore = unresolvedTypeImports(ts, before);
68
+ const newlyMissing = [...unresolvedTypeImports(ts, after)].filter((s) => !missingBefore.has(s));
69
+ if (newlyMissing.length) {
70
+ return {
71
+ checked: false,
72
+ reason: `the new version's types import ${newlyMissing.join(", ")}, which is not installed here`
73
+ };
74
+ }
75
+ introduced.push(
76
+ ...newDiagnostics(ts, root, beforeDiagnostics, semanticDiagnostics(after.program, files2))
77
+ );
78
+ covered += files2.length;
79
+ }
80
+ return { checked: true, files: covered, introduced };
81
+ };
82
+ }
83
+ function groupByProject(ts, root, files, parse) {
84
+ const groups = /* @__PURE__ */ new Map();
85
+ for (const rel of new Set(files)) {
86
+ const abs = join(root, rel);
87
+ const project = projectFor(ts, root, abs, parse);
88
+ if (!project) continue;
89
+ const group = groups.get(project.configPath);
90
+ if (group) group.files.push(abs);
91
+ else groups.set(project.configPath, { parsed: project.parsed, files: [abs] });
92
+ }
93
+ return groups;
94
+ }
95
+ function projectFor(ts, root, abs, parse) {
96
+ const key = (p) => ts.sys.useCaseSensitiveFileNames ? p : p.toLowerCase();
97
+ const includes = (parsed) => parsed.fileNames.some((f) => key(resolve(f)) === key(abs));
98
+ for (let dir = dirname(abs); ; dir = dirname(dir)) {
99
+ const config = join(dir, "tsconfig.json");
100
+ if (ts.sys.fileExists(config)) {
101
+ const parsed = parse(config);
102
+ if (!parsed) return null;
103
+ if (includes(parsed)) return { configPath: config, parsed };
104
+ for (const ref of parsed.projectReferences ?? []) {
105
+ const refPath = ts.resolveProjectReferencePath(ref);
106
+ const refParsed = parse(refPath);
107
+ if (refParsed && includes(refParsed)) return { configPath: refPath, parsed: refParsed };
108
+ }
109
+ return null;
110
+ }
111
+ if (dir === root || dirname(dir) === dir) return null;
112
+ }
113
+ }
114
+ function build(ts, parsed, pkg, pkgDir, installedVersion, cache, ownTypes) {
115
+ const options = { ...parsed.options, noEmit: true, incremental: false };
116
+ const { host, overlaid } = overlayHost(ts, options, pkg, pkgDir, installedVersion, cache);
117
+ const program = ts.createProgram({ rootNames: parsed.fileNames, options, host });
118
+ const declarations = program.getSourceFiles().filter((sf) => sf.isDeclarationFile && overlaid(sf.fileName));
119
+ if (ownTypes && declarations.length === 0) {
120
+ return { reason: "the new version ships no type definitions of its own" };
121
+ }
122
+ if (declarations.some((sf) => program.getSyntacticDiagnostics(sf).length > 0)) {
123
+ return { reason: `its type definitions do not parse with TypeScript ${ts.version}` };
124
+ }
125
+ return { program, host, overlaid };
126
+ }
127
+ function unresolvedTypeImports(ts, built) {
128
+ const out = /* @__PURE__ */ new Set();
129
+ const options = built.program.getCompilerOptions();
130
+ for (const sf of built.program.getSourceFiles()) {
131
+ if (!sf.isDeclarationFile || !built.overlaid(sf.fileName)) continue;
132
+ for (const { fileName: spec } of ts.preProcessFile(sf.text, true, true).importedFiles) {
133
+ if (!ts.resolveModuleName(spec, sf.fileName, options, built.host).resolvedModule) out.add(spec);
134
+ }
135
+ }
136
+ return out;
137
+ }
138
+ function manifestVersion(ts, dir) {
139
+ try {
140
+ const version = JSON.parse(ts.sys.readFile(join(dir, "package.json")) ?? "{}").version;
141
+ return typeof version === "string" ? version : void 0;
142
+ } catch {
143
+ return void 0;
144
+ }
145
+ }
146
+ function semanticDiagnostics(program, files) {
147
+ return files.flatMap((f) => {
148
+ const sf = program.getSourceFile(f);
149
+ return sf ? [...program.getSemanticDiagnostics(sf)] : [];
150
+ });
151
+ }
152
+ function importersOf(ts, program, targets) {
153
+ const key = (p) => ts.sys.useCaseSensitiveFileNames ? resolve(p) : resolve(p).toLowerCase();
154
+ const wanted = new Set(targets.map(key));
155
+ const options = program.getCompilerOptions();
156
+ const cache = ts.createModuleResolutionCache(program.getCurrentDirectory(), (f) => key(f), options);
157
+ const out = [];
158
+ for (const sf of program.getSourceFiles()) {
159
+ if (out.length >= HOP_CAP) break;
160
+ if (sf.isDeclarationFile || sf.fileName.includes("/node_modules/") || wanted.has(key(sf.fileName))) continue;
161
+ const { importedFiles } = ts.preProcessFile(sf.text, true, true);
162
+ const imports = importedFiles.some(({ fileName: spec }) => {
163
+ const hit = ts.resolveModuleName(spec, sf.fileName, options, ts.sys, cache).resolvedModule;
164
+ return hit !== void 0 && wanted.has(key(hit.resolvedFileName));
165
+ });
166
+ if (imports) out.push(sf.fileName);
167
+ }
168
+ return out;
169
+ }
170
+ function overlayHost(ts, options, pkg, pkgDir, installedVersion, cache) {
171
+ const host = ts.createCompilerHost(options, true);
172
+ const base = {
173
+ fileExists: host.fileExists.bind(host),
174
+ readFile: host.readFile.bind(host),
175
+ directoryExists: host.directoryExists?.bind(host),
176
+ realpath: host.realpath?.bind(host),
177
+ getSourceFile: host.getSourceFile.bind(host)
178
+ };
179
+ const marker = `/node_modules/${pkg}`;
180
+ const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
181
+ const pnpmStore = installedVersion ? new RegExp(`^(.*)/node_modules/\\.pnpm/${escape(pkg.replace("/", "+"))}@${escape(installedVersion)}(?:[_(][^/]*)?$`) : null;
182
+ const ownInstall = (prefix) => {
183
+ if (!prefix.includes("/node_modules/")) return true;
184
+ const store = pnpmStore?.exec(prefix);
185
+ return Boolean(store && !store[1].includes("/node_modules/"));
186
+ };
187
+ const direct = (fileName) => {
188
+ const p = fileName.replace(/\\/g, "/");
189
+ const i = p.indexOf(marker);
190
+ if (i < 0 || !ownInstall(p.slice(0, i))) return null;
191
+ const rest = p.slice(i + marker.length);
192
+ return rest === "" || rest.startsWith("/") ? pkgDir + rest : null;
193
+ };
194
+ const redirect = (fileName) => {
195
+ const hit = direct(fileName);
196
+ if (hit !== null || !ts.sys.realpath) return hit;
197
+ const p = fileName.replace(/\\/g, "/");
198
+ const i = p.lastIndexOf(marker);
199
+ const end = i + marker.length;
200
+ if (i < 0 || p.length > end && p[end] !== "/") return null;
201
+ const root = ts.sys.realpath(p.slice(0, end)).replace(/\\/g, "/");
202
+ return root === p.slice(0, end) ? null : direct(root + p.slice(end));
203
+ };
204
+ host.fileExists = (p) => {
205
+ const r = redirect(p);
206
+ return r === null ? base.fileExists(p) : ts.sys.fileExists(r);
207
+ };
208
+ host.readFile = (p) => {
209
+ const r = redirect(p);
210
+ return r === null ? base.readFile(p) : ts.sys.readFile(r);
211
+ };
212
+ host.directoryExists = (p) => {
213
+ const r = redirect(p);
214
+ if (r !== null) return ts.sys.directoryExists(r);
215
+ const norm = p.replace(/\\/g, "/");
216
+ if (norm.endsWith("/node_modules") && !norm.slice(0, -"/node_modules".length).includes("/node_modules")) {
217
+ return true;
218
+ }
219
+ return base.directoryExists ? base.directoryExists(p) : ts.sys.directoryExists(p);
220
+ };
221
+ host.realpath = (p) => redirect(p) !== null ? p : base.realpath ? base.realpath(p) : p;
222
+ host.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
223
+ const r = redirect(fileName);
224
+ if (r !== null) {
225
+ const text = ts.sys.readFile(r);
226
+ return text === void 0 ? void 0 : ts.createSourceFile(fileName, text, languageVersion);
227
+ }
228
+ const hit = cache.get(fileName);
229
+ if (hit) return hit;
230
+ const sf = base.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
231
+ if (sf) cache.set(fileName, sf);
232
+ return sf;
233
+ };
234
+ return { host, overlaid: (fileName) => redirect(fileName) !== null };
235
+ }
236
+ function newDiagnostics(ts, root, before, after) {
237
+ const where = (d) => d.file && d.start !== void 0 ? { fileName: d.file.fileName, line: d.file.getLineAndCharacterOfPosition(d.start).line + 1 } : null;
238
+ const remaining = /* @__PURE__ */ new Map();
239
+ for (const d of before) {
240
+ const at = where(d);
241
+ if (!at) continue;
242
+ const key = `${at.fileName}:${at.line}:${d.code}`;
243
+ remaining.set(key, (remaining.get(key) ?? 0) + 1);
244
+ }
245
+ const out = [];
246
+ for (const d of after) {
247
+ const at = where(d);
248
+ if (!at) continue;
249
+ const key = `${at.fileName}:${at.line}:${d.code}`;
250
+ const left = remaining.get(key) ?? 0;
251
+ if (left > 0) {
252
+ remaining.set(key, left - 1);
253
+ continue;
254
+ }
255
+ out.push({
256
+ file: relative(root, at.fileName),
257
+ line: at.line,
258
+ code: d.code,
259
+ message: ts.flattenDiagnosticMessageText(d.messageText, " ").slice(0, MESSAGE_CAP)
260
+ });
261
+ }
262
+ return out;
263
+ }
264
+ export {
265
+ createTypeChecker,
266
+ loadCompiler,
267
+ typeChecker
268
+ };
@@ -0,0 +1,10 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ SEVERITY_RANK,
4
+ worstSeverity
5
+ } from "./chunk-Q5VPF4WI.js";
6
+ import "./chunk-I3M2KJXB.js";
7
+ export {
8
+ SEVERITY_RANK,
9
+ worstSeverity
10
+ };
@@ -0,0 +1,174 @@
1
+ import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
2
+ import {
3
+ dim,
4
+ green,
5
+ red,
6
+ yellow
7
+ } from "./chunk-4KCPOMG6.js";
8
+ import {
9
+ BLOCK_START,
10
+ agentSpecs,
11
+ readJsonObject,
12
+ removeMarkedBlock,
13
+ resolveAgents,
14
+ stripTomlBlock,
15
+ writeFileAtomic,
16
+ writeJson
17
+ } from "./chunk-UDVNA7EA.js";
18
+ import "./chunk-LUAKDHLZ.js";
19
+ import "./chunk-MYGSLK44.js";
20
+ import {
21
+ clearUserConfig,
22
+ lurqHome,
23
+ userConfigPath
24
+ } from "./chunk-Y5GI7RL3.js";
25
+ import {
26
+ KEYS_URL,
27
+ PACKAGE_NAME
28
+ } from "./chunk-GPTKSNR6.js";
29
+ import {
30
+ init_esm_shims
31
+ } from "./chunk-I3M2KJXB.js";
32
+
33
+ // src/cli/uninstall.ts
34
+ init_esm_shims();
35
+ import { existsSync, readdirSync, readFileSync, rmdirSync, rmSync } from "fs";
36
+ import { homedir } from "os";
37
+ import { dirname, join } from "path";
38
+ function removeDirIfEmpty(dir) {
39
+ if (existsSync(dir) && readdirSync(dir).length === 0) rmdirSync(dir);
40
+ }
41
+ function rewriteOrRemove(path, text) {
42
+ if (text.trim()) writeFileAtomic(path, text);
43
+ else rmSync(path, { force: true });
44
+ }
45
+ function mcpEntryRemoval(spec) {
46
+ if (!existsSync(spec.path)) return null;
47
+ const label = `${spec.label} MCP entry`;
48
+ if (spec.format === "toml") {
49
+ if (!readFileSync(spec.path, "utf8").includes("[mcp_servers.lurq]")) return null;
50
+ return {
51
+ label,
52
+ path: spec.path,
53
+ apply: () => {
54
+ const stripped = stripTomlBlock(readFileSync(spec.path, "utf8")).replace(/\s+$/, "");
55
+ rewriteOrRemove(spec.path, stripped ? `${stripped}
56
+ ` : "");
57
+ }
58
+ };
59
+ }
60
+ const key = spec.format === "servers" ? "servers" : "mcpServers";
61
+ const servers = readJsonObject(spec.path)[key];
62
+ if (!servers || typeof servers !== "object" || !Object.hasOwn(servers, "lurq")) return null;
63
+ return {
64
+ label,
65
+ path: spec.path,
66
+ // Re-read at apply time: the agent may have rewritten its config while the
67
+ // user was reading the list.
68
+ apply: () => {
69
+ const config = readJsonObject(spec.path);
70
+ delete config[key].lurq;
71
+ writeJson(spec.path, config);
72
+ }
73
+ };
74
+ }
75
+ function instructionsRemoval(spec) {
76
+ const target = spec.instructions;
77
+ if (!target || !existsSync(target.path)) return null;
78
+ if (target.kind === "shared") {
79
+ if (!readFileSync(target.path, "utf8").includes(BLOCK_START)) return null;
80
+ return {
81
+ label: `${spec.label} instructions block`,
82
+ path: target.path,
83
+ apply: () => rewriteOrRemove(target.path, removeMarkedBlock(readFileSync(target.path, "utf8")))
84
+ };
85
+ }
86
+ return {
87
+ label: `${spec.label} ${target.kind === "skill" ? "skill" : "steering file"}`,
88
+ path: target.path,
89
+ apply: () => {
90
+ rmSync(target.path, { force: true });
91
+ if (target.kind === "skill") removeDirIfEmpty(dirname(target.path));
92
+ }
93
+ };
94
+ }
95
+ function planUninstall(specs, opts) {
96
+ const removals = [];
97
+ const problems = [];
98
+ const seen = /* @__PURE__ */ new Set();
99
+ const add = (r) => {
100
+ if (!r || seen.has(r.path)) return;
101
+ seen.add(r.path);
102
+ removals.push(r);
103
+ };
104
+ for (const spec of specs) {
105
+ try {
106
+ add(mcpEntryRemoval(spec));
107
+ } catch (err) {
108
+ problems.push(`${spec.label}: ${err instanceof Error ? err.message : String(err)}`);
109
+ }
110
+ add(instructionsRemoval(spec));
111
+ }
112
+ if (opts.global) {
113
+ const guide = join(lurqHome(), "skill-instructions.md");
114
+ if (existsSync(guide)) {
115
+ add({ label: "lurq agent guide", path: guide, apply: () => rmSync(guide, { force: true }) });
116
+ }
117
+ if (existsSync(userConfigPath())) {
118
+ add({
119
+ label: "stored API key",
120
+ path: userConfigPath(),
121
+ apply: () => {
122
+ clearUserConfig();
123
+ removeDirIfEmpty(lurqHome());
124
+ }
125
+ });
126
+ }
127
+ }
128
+ return { removals, problems };
129
+ }
130
+ async function runUninstall(opts) {
131
+ const global = !opts.agent || opts.agent === "all";
132
+ const specs = global ? agentSpecs() : resolveAgents(opts.agent);
133
+ const { removals, problems } = planUninstall(specs, { global });
134
+ const short = (p) => p.startsWith(homedir()) ? `~${p.slice(homedir().length)}` : p;
135
+ for (const p of problems) console.log(`${yellow("!")} ${p}`);
136
+ if (removals.length === 0) {
137
+ console.log(`Nothing to remove: lurq is not set up ${global ? "on this machine" : `for ${specs[0].label}`}.`);
138
+ if (problems.length) process.exitCode = 1;
139
+ return;
140
+ }
141
+ console.log("lurq uninstall removes:");
142
+ for (const r of removals) console.log(` \u2022 ${r.label.padEnd(36)} ${short(r.path)}`);
143
+ console.log(dim(" Everything else in these files stays as it is.\n"));
144
+ if (!opts.yes) {
145
+ if (!(process.stdin.isTTY && process.stdout.isTTY)) {
146
+ throw new Error("Nothing was removed. Re-run with --yes to confirm without a prompt.");
147
+ }
148
+ const { confirm } = await import("./dist-4XXIXHHZ.js");
149
+ if (!await confirm({ message: "Remove these?", default: true })) {
150
+ console.log("Nothing was removed.");
151
+ return;
152
+ }
153
+ }
154
+ let failed = problems.length;
155
+ for (const r of removals) {
156
+ try {
157
+ r.apply();
158
+ console.log(`${green("\u2713")} removed ${r.label}`);
159
+ } catch (err) {
160
+ failed++;
161
+ console.log(`${red("\u2717")} ${r.label}: ${err instanceof Error ? err.message : String(err)}`);
162
+ }
163
+ }
164
+ console.log("\nRestart your agents so they drop the lurq server.");
165
+ if (global) {
166
+ console.log(dim(`The key keeps working until you revoke it: ${KEYS_URL}`));
167
+ console.log(dim(`To remove the \`lurq\` command as well: npm uninstall -g ${PACKAGE_NAME}`));
168
+ }
169
+ if (failed) process.exitCode = 1;
170
+ }
171
+ export {
172
+ planUninstall,
173
+ runUninstall
174
+ };