lens-engine 2.0.1 → 2.1.0
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.
- package/cli.js +298 -39
- package/daemon.js +430 -70
- package/dashboard/assets/{index-x1mtAEvB.js → index-CzRbHqXG.js} +28 -28
- package/dashboard/index.html +1 -1
- package/drizzle-engine/0002_csharp_namespaces.sql +1 -0
- package/drizzle-engine/meta/0002_snapshot.json +586 -0
- package/drizzle-engine/meta/_journal.json +7 -0
- package/package.json +4 -2
package/daemon.js
CHANGED
|
@@ -125997,7 +125997,7 @@ ${lanes.join("\n")}
|
|
|
125997
125997
|
}
|
|
125998
125998
|
}
|
|
125999
125999
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
126000
|
-
const
|
|
126000
|
+
const resolve4 = factory2.createUniqueName("resolve");
|
|
126001
126001
|
const reject = factory2.createUniqueName("reject");
|
|
126002
126002
|
const parameters = [
|
|
126003
126003
|
factory2.createParameterDeclaration(
|
|
@@ -126006,7 +126006,7 @@ ${lanes.join("\n")}
|
|
|
126006
126006
|
/*dotDotDotToken*/
|
|
126007
126007
|
void 0,
|
|
126008
126008
|
/*name*/
|
|
126009
|
-
|
|
126009
|
+
resolve4
|
|
126010
126010
|
),
|
|
126011
126011
|
factory2.createParameterDeclaration(
|
|
126012
126012
|
/*modifiers*/
|
|
@@ -126023,7 +126023,7 @@ ${lanes.join("\n")}
|
|
|
126023
126023
|
factory2.createIdentifier("require"),
|
|
126024
126024
|
/*typeArguments*/
|
|
126025
126025
|
void 0,
|
|
126026
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
126026
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve4, reject]
|
|
126027
126027
|
)
|
|
126028
126028
|
)
|
|
126029
126029
|
]);
|
|
@@ -189178,7 +189178,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
189178
189178
|
return ts_textChanges_exports.ChangeTracker.with(
|
|
189179
189179
|
{ host, formatContext, preferences },
|
|
189180
189180
|
(changeTracker) => {
|
|
189181
|
-
const parsed = contents.map((c) =>
|
|
189181
|
+
const parsed = contents.map((c) => parse4(sourceFile, c));
|
|
189182
189182
|
const flattenedLocations = focusLocations && flatten(focusLocations);
|
|
189183
189183
|
for (const nodes of parsed) {
|
|
189184
189184
|
placeNodeGroup(
|
|
@@ -189191,7 +189191,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
189191
189191
|
}
|
|
189192
189192
|
);
|
|
189193
189193
|
}
|
|
189194
|
-
function
|
|
189194
|
+
function parse4(sourceFile, content) {
|
|
189195
189195
|
const nodeKinds = [
|
|
189196
189196
|
{
|
|
189197
189197
|
parse: () => createSourceFile(
|
|
@@ -212748,8 +212748,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
212748
212748
|
installPackage(options) {
|
|
212749
212749
|
this.packageInstallId++;
|
|
212750
212750
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
212751
|
-
const promise = new Promise((
|
|
212752
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
212751
|
+
const promise = new Promise((resolve4, reject) => {
|
|
212752
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve4, reject });
|
|
212753
212753
|
});
|
|
212754
212754
|
this.installer.send(request);
|
|
212755
212755
|
return promise;
|
|
@@ -214774,7 +214774,7 @@ var require_path_browserify = __commonJS({
|
|
|
214774
214774
|
}
|
|
214775
214775
|
var posix2 = {
|
|
214776
214776
|
// path.resolve([from ...], to)
|
|
214777
|
-
resolve: function
|
|
214777
|
+
resolve: function resolve4() {
|
|
214778
214778
|
var resolvedPath = "";
|
|
214779
214779
|
var resolvedAbsolute = false;
|
|
214780
214780
|
var cwd;
|
|
@@ -215026,7 +215026,7 @@ var require_path_browserify = __commonJS({
|
|
|
215026
215026
|
}
|
|
215027
215027
|
return _format("/", pathObject);
|
|
215028
215028
|
},
|
|
215029
|
-
parse: function
|
|
215029
|
+
parse: function parse4(path2) {
|
|
215030
215030
|
assertPath(path2);
|
|
215031
215031
|
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
215032
215032
|
if (path2.length === 0) return ret;
|
|
@@ -215718,7 +215718,7 @@ var require_parse = __commonJS({
|
|
|
215718
215718
|
var syntaxError = (type, char) => {
|
|
215719
215719
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
215720
215720
|
};
|
|
215721
|
-
var
|
|
215721
|
+
var parse4 = (input, options) => {
|
|
215722
215722
|
if (typeof input !== "string") {
|
|
215723
215723
|
throw new TypeError("Expected a string");
|
|
215724
215724
|
}
|
|
@@ -215866,7 +215866,7 @@ var require_parse = __commonJS({
|
|
|
215866
215866
|
output = token.close = `)$))${extglobStar}`;
|
|
215867
215867
|
}
|
|
215868
215868
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
215869
|
-
const expression =
|
|
215869
|
+
const expression = parse4(rest, { ...options, fastpaths: false }).output;
|
|
215870
215870
|
output = token.close = `)${expression})${extglobStar})`;
|
|
215871
215871
|
}
|
|
215872
215872
|
if (token.prev.type === "bos") {
|
|
@@ -216388,7 +216388,7 @@ var require_parse = __commonJS({
|
|
|
216388
216388
|
}
|
|
216389
216389
|
return state;
|
|
216390
216390
|
};
|
|
216391
|
-
|
|
216391
|
+
parse4.fastpaths = (input, options) => {
|
|
216392
216392
|
const opts = { ...options };
|
|
216393
216393
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
216394
216394
|
const len = input.length;
|
|
@@ -216453,7 +216453,7 @@ var require_parse = __commonJS({
|
|
|
216453
216453
|
}
|
|
216454
216454
|
return source;
|
|
216455
216455
|
};
|
|
216456
|
-
module.exports =
|
|
216456
|
+
module.exports = parse4;
|
|
216457
216457
|
}
|
|
216458
216458
|
});
|
|
216459
216459
|
|
|
@@ -216462,7 +216462,7 @@ var require_picomatch = __commonJS({
|
|
|
216462
216462
|
"node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
216463
216463
|
"use strict";
|
|
216464
216464
|
var scan = require_scan();
|
|
216465
|
-
var
|
|
216465
|
+
var parse4 = require_parse();
|
|
216466
216466
|
var utils = require_utils();
|
|
216467
216467
|
var constants2 = require_constants();
|
|
216468
216468
|
var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -216550,7 +216550,7 @@ var require_picomatch = __commonJS({
|
|
|
216550
216550
|
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
216551
216551
|
picomatch.parse = (pattern, options) => {
|
|
216552
216552
|
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
|
|
216553
|
-
return
|
|
216553
|
+
return parse4(pattern, { ...options, fastpaths: false });
|
|
216554
216554
|
};
|
|
216555
216555
|
picomatch.scan = (input, options) => scan(input, options);
|
|
216556
216556
|
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
@@ -216576,10 +216576,10 @@ var require_picomatch = __commonJS({
|
|
|
216576
216576
|
}
|
|
216577
216577
|
let parsed = { negated: false, fastpaths: true };
|
|
216578
216578
|
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
216579
|
-
parsed.output =
|
|
216579
|
+
parsed.output = parse4.fastpaths(input, options);
|
|
216580
216580
|
}
|
|
216581
216581
|
if (!parsed.output) {
|
|
216582
|
-
parsed =
|
|
216582
|
+
parsed = parse4(input, options);
|
|
216583
216583
|
}
|
|
216584
216584
|
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
216585
216585
|
};
|
|
@@ -218725,12 +218725,12 @@ ${nodeLocation}` : message;
|
|
|
218725
218725
|
};
|
|
218726
218726
|
var NodeRuntimeFileSystem = class {
|
|
218727
218727
|
delete(path3) {
|
|
218728
|
-
return new Promise((
|
|
218728
|
+
return new Promise((resolve4, reject) => {
|
|
218729
218729
|
fs__namespace.rm(path3, { recursive: true }, (err) => {
|
|
218730
218730
|
if (err)
|
|
218731
218731
|
reject(err);
|
|
218732
218732
|
else
|
|
218733
|
-
|
|
218733
|
+
resolve4();
|
|
218734
218734
|
});
|
|
218735
218735
|
});
|
|
218736
218736
|
}
|
|
@@ -218749,12 +218749,12 @@ ${nodeLocation}` : message;
|
|
|
218749
218749
|
}));
|
|
218750
218750
|
}
|
|
218751
218751
|
readFile(filePath, encoding = "utf-8") {
|
|
218752
|
-
return new Promise((
|
|
218752
|
+
return new Promise((resolve4, reject) => {
|
|
218753
218753
|
fs__namespace.readFile(filePath, encoding, (err, data) => {
|
|
218754
218754
|
if (err)
|
|
218755
218755
|
reject(err);
|
|
218756
218756
|
else
|
|
218757
|
-
|
|
218757
|
+
resolve4(data);
|
|
218758
218758
|
});
|
|
218759
218759
|
});
|
|
218760
218760
|
}
|
|
@@ -218762,12 +218762,12 @@ ${nodeLocation}` : message;
|
|
|
218762
218762
|
return fs__namespace.readFileSync(filePath, encoding);
|
|
218763
218763
|
}
|
|
218764
218764
|
async writeFile(filePath, fileText) {
|
|
218765
|
-
await new Promise((
|
|
218765
|
+
await new Promise((resolve4, reject) => {
|
|
218766
218766
|
fs__namespace.writeFile(filePath, fileText, (err) => {
|
|
218767
218767
|
if (err)
|
|
218768
218768
|
reject(err);
|
|
218769
218769
|
else
|
|
218770
|
-
|
|
218770
|
+
resolve4();
|
|
218771
218771
|
});
|
|
218772
218772
|
});
|
|
218773
218773
|
}
|
|
@@ -218781,12 +218781,12 @@ ${nodeLocation}` : message;
|
|
|
218781
218781
|
fs__namespace.mkdirSync(dirPath, { recursive: true });
|
|
218782
218782
|
}
|
|
218783
218783
|
move(srcPath, destPath) {
|
|
218784
|
-
return new Promise((
|
|
218784
|
+
return new Promise((resolve4, reject) => {
|
|
218785
218785
|
fs__namespace.rename(srcPath, destPath, (err) => {
|
|
218786
218786
|
if (err)
|
|
218787
218787
|
reject(err);
|
|
218788
218788
|
else
|
|
218789
|
-
|
|
218789
|
+
resolve4();
|
|
218790
218790
|
});
|
|
218791
218791
|
});
|
|
218792
218792
|
}
|
|
@@ -218794,12 +218794,12 @@ ${nodeLocation}` : message;
|
|
|
218794
218794
|
fs__namespace.renameSync(srcPath, destPath);
|
|
218795
218795
|
}
|
|
218796
218796
|
copy(srcPath, destPath) {
|
|
218797
|
-
return new Promise((
|
|
218797
|
+
return new Promise((resolve4, reject) => {
|
|
218798
218798
|
fs__namespace.copyFile(srcPath, destPath, (err) => {
|
|
218799
218799
|
if (err)
|
|
218800
218800
|
reject(err);
|
|
218801
218801
|
else
|
|
218802
|
-
|
|
218802
|
+
resolve4();
|
|
218803
218803
|
});
|
|
218804
218804
|
});
|
|
218805
218805
|
}
|
|
@@ -218807,15 +218807,15 @@ ${nodeLocation}` : message;
|
|
|
218807
218807
|
fs__namespace.copyFileSync(srcPath, destPath);
|
|
218808
218808
|
}
|
|
218809
218809
|
stat(path3) {
|
|
218810
|
-
return new Promise((
|
|
218810
|
+
return new Promise((resolve4, reject) => {
|
|
218811
218811
|
fs__namespace.stat(path3, (err, stat2) => {
|
|
218812
218812
|
if (err) {
|
|
218813
218813
|
if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
|
218814
|
-
|
|
218814
|
+
resolve4(void 0);
|
|
218815
218815
|
else
|
|
218816
218816
|
reject(err);
|
|
218817
218817
|
} else {
|
|
218818
|
-
|
|
218818
|
+
resolve4(stat2);
|
|
218819
218819
|
}
|
|
218820
218820
|
});
|
|
218821
218821
|
});
|
|
@@ -247337,7 +247337,7 @@ var init_errors2 = __esm({
|
|
|
247337
247337
|
});
|
|
247338
247338
|
|
|
247339
247339
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/parse.js
|
|
247340
|
-
var _parse,
|
|
247340
|
+
var _parse, parse2, _parseAsync, parseAsync2, _safeParse, safeParse, _safeParseAsync, safeParseAsync;
|
|
247341
247341
|
var init_parse = __esm({
|
|
247342
247342
|
"node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/parse.js"() {
|
|
247343
247343
|
init_core();
|
|
@@ -247356,7 +247356,7 @@ var init_parse = __esm({
|
|
|
247356
247356
|
}
|
|
247357
247357
|
return result.value;
|
|
247358
247358
|
};
|
|
247359
|
-
|
|
247359
|
+
parse2 = /* @__PURE__ */ _parse($ZodRealError);
|
|
247360
247360
|
_parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
247361
247361
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
247362
247362
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -247369,7 +247369,7 @@ var init_parse = __esm({
|
|
|
247369
247369
|
}
|
|
247370
247370
|
return result.value;
|
|
247371
247371
|
};
|
|
247372
|
-
|
|
247372
|
+
parseAsync2 = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
247373
247373
|
_safeParse = (_Err) => (schema, value, _ctx) => {
|
|
247374
247374
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
247375
247375
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -250621,9 +250621,9 @@ var init_schemas2 = __esm({
|
|
|
250621
250621
|
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
250622
250622
|
$ZodType.init(inst, def);
|
|
250623
250623
|
inst.def = def;
|
|
250624
|
-
inst.parse = (data, params) =>
|
|
250624
|
+
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
250625
250625
|
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
250626
|
-
inst.parseAsync = async (data, params) =>
|
|
250626
|
+
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
|
|
250627
250627
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
250628
250628
|
inst.check = (...checks) => {
|
|
250629
250629
|
return inst.clone(
|
|
@@ -250945,13 +250945,13 @@ var init_errors3 = __esm({
|
|
|
250945
250945
|
});
|
|
250946
250946
|
|
|
250947
250947
|
// node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/parse.js
|
|
250948
|
-
var
|
|
250948
|
+
var parse3, parseAsync3, safeParse3, safeParseAsync3;
|
|
250949
250949
|
var init_parse3 = __esm({
|
|
250950
250950
|
"node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/parse.js"() {
|
|
250951
250951
|
init_core2();
|
|
250952
250952
|
init_errors3();
|
|
250953
|
-
|
|
250954
|
-
|
|
250953
|
+
parse3 = /* @__PURE__ */ _parse(ZodRealError);
|
|
250954
|
+
parseAsync3 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
250955
250955
|
safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
250956
250956
|
safeParseAsync3 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
250957
250957
|
}
|
|
@@ -251180,9 +251180,9 @@ var init_schemas3 = __esm({
|
|
|
251180
251180
|
reg.add(inst, meta);
|
|
251181
251181
|
return inst;
|
|
251182
251182
|
});
|
|
251183
|
-
inst.parse = (data, params) =>
|
|
251183
|
+
inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
|
|
251184
251184
|
inst.safeParse = (data, params) => safeParse3(inst, data, params);
|
|
251185
|
-
inst.parseAsync = async (data, params) =>
|
|
251185
|
+
inst.parseAsync = async (data, params) => parseAsync3(inst, data, params, { callee: inst.parseAsync });
|
|
251186
251186
|
inst.safeParseAsync = async (data, params) => safeParseAsync3(inst, data, params);
|
|
251187
251187
|
inst.spa = inst.safeParseAsync;
|
|
251188
251188
|
inst.refine = (check2, params) => inst.check(refine(check2, params));
|
|
@@ -255298,7 +255298,7 @@ var init_protocol = __esm({
|
|
|
255298
255298
|
return;
|
|
255299
255299
|
}
|
|
255300
255300
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
255301
|
-
await new Promise((
|
|
255301
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
255302
255302
|
options?.signal?.throwIfAborted();
|
|
255303
255303
|
}
|
|
255304
255304
|
} catch (error2) {
|
|
@@ -255315,7 +255315,7 @@ var init_protocol = __esm({
|
|
|
255315
255315
|
*/
|
|
255316
255316
|
request(request, resultSchema, options) {
|
|
255317
255317
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
255318
|
-
return new Promise((
|
|
255318
|
+
return new Promise((resolve4, reject) => {
|
|
255319
255319
|
const earlyReject = (error2) => {
|
|
255320
255320
|
reject(error2);
|
|
255321
255321
|
};
|
|
@@ -255393,7 +255393,7 @@ var init_protocol = __esm({
|
|
|
255393
255393
|
if (!parseResult.success) {
|
|
255394
255394
|
reject(parseResult.error);
|
|
255395
255395
|
} else {
|
|
255396
|
-
|
|
255396
|
+
resolve4(parseResult.data);
|
|
255397
255397
|
}
|
|
255398
255398
|
} catch (error2) {
|
|
255399
255399
|
reject(error2);
|
|
@@ -255654,12 +255654,12 @@ var init_protocol = __esm({
|
|
|
255654
255654
|
}
|
|
255655
255655
|
} catch {
|
|
255656
255656
|
}
|
|
255657
|
-
return new Promise((
|
|
255657
|
+
return new Promise((resolve4, reject) => {
|
|
255658
255658
|
if (signal.aborted) {
|
|
255659
255659
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
255660
255660
|
return;
|
|
255661
255661
|
}
|
|
255662
|
-
const timeoutId = setTimeout(
|
|
255662
|
+
const timeoutId = setTimeout(resolve4, interval);
|
|
255663
255663
|
signal.addEventListener("abort", () => {
|
|
255664
255664
|
clearTimeout(timeoutId);
|
|
255665
255665
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -258686,7 +258686,7 @@ var require_compile = __commonJS({
|
|
|
258686
258686
|
const schOrFunc = root.refs[ref];
|
|
258687
258687
|
if (schOrFunc)
|
|
258688
258688
|
return schOrFunc;
|
|
258689
|
-
let _sch =
|
|
258689
|
+
let _sch = resolve4.call(this, root, ref);
|
|
258690
258690
|
if (_sch === void 0) {
|
|
258691
258691
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
258692
258692
|
const { schemaId } = this.opts;
|
|
@@ -258713,7 +258713,7 @@ var require_compile = __commonJS({
|
|
|
258713
258713
|
function sameSchemaEnv(s1, s2) {
|
|
258714
258714
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
258715
258715
|
}
|
|
258716
|
-
function
|
|
258716
|
+
function resolve4(root, ref) {
|
|
258717
258717
|
let sch;
|
|
258718
258718
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
258719
258719
|
ref = sch;
|
|
@@ -259281,24 +259281,24 @@ var require_fast_uri = __commonJS({
|
|
|
259281
259281
|
function normalize(uri, options) {
|
|
259282
259282
|
if (typeof uri === "string") {
|
|
259283
259283
|
uri = /** @type {T} */
|
|
259284
|
-
serialize(
|
|
259284
|
+
serialize(parse4(uri, options), options);
|
|
259285
259285
|
} else if (typeof uri === "object") {
|
|
259286
259286
|
uri = /** @type {T} */
|
|
259287
|
-
|
|
259287
|
+
parse4(serialize(uri, options), options);
|
|
259288
259288
|
}
|
|
259289
259289
|
return uri;
|
|
259290
259290
|
}
|
|
259291
|
-
function
|
|
259291
|
+
function resolve4(baseURI, relativeURI, options) {
|
|
259292
259292
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
259293
|
-
const resolved = resolveComponent(
|
|
259293
|
+
const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
259294
259294
|
schemelessOptions.skipEscape = true;
|
|
259295
259295
|
return serialize(resolved, schemelessOptions);
|
|
259296
259296
|
}
|
|
259297
259297
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
259298
259298
|
const target = {};
|
|
259299
259299
|
if (!skipNormalization) {
|
|
259300
|
-
base =
|
|
259301
|
-
relative =
|
|
259300
|
+
base = parse4(serialize(base, options), options);
|
|
259301
|
+
relative = parse4(serialize(relative, options), options);
|
|
259302
259302
|
}
|
|
259303
259303
|
options = options || {};
|
|
259304
259304
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -259350,13 +259350,13 @@ var require_fast_uri = __commonJS({
|
|
|
259350
259350
|
function equal(uriA, uriB, options) {
|
|
259351
259351
|
if (typeof uriA === "string") {
|
|
259352
259352
|
uriA = unescape(uriA);
|
|
259353
|
-
uriA = serialize(normalizeComponentEncoding(
|
|
259353
|
+
uriA = serialize(normalizeComponentEncoding(parse4(uriA, options), true), { ...options, skipEscape: true });
|
|
259354
259354
|
} else if (typeof uriA === "object") {
|
|
259355
259355
|
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
259356
259356
|
}
|
|
259357
259357
|
if (typeof uriB === "string") {
|
|
259358
259358
|
uriB = unescape(uriB);
|
|
259359
|
-
uriB = serialize(normalizeComponentEncoding(
|
|
259359
|
+
uriB = serialize(normalizeComponentEncoding(parse4(uriB, options), true), { ...options, skipEscape: true });
|
|
259360
259360
|
} else if (typeof uriB === "object") {
|
|
259361
259361
|
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
259362
259362
|
}
|
|
@@ -259425,7 +259425,7 @@ var require_fast_uri = __commonJS({
|
|
|
259425
259425
|
return uriTokens.join("");
|
|
259426
259426
|
}
|
|
259427
259427
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
259428
|
-
function
|
|
259428
|
+
function parse4(uri, opts) {
|
|
259429
259429
|
const options = Object.assign({}, opts);
|
|
259430
259430
|
const parsed = {
|
|
259431
259431
|
scheme: void 0,
|
|
@@ -259515,11 +259515,11 @@ var require_fast_uri = __commonJS({
|
|
|
259515
259515
|
var fastUri = {
|
|
259516
259516
|
SCHEMES,
|
|
259517
259517
|
normalize,
|
|
259518
|
-
resolve:
|
|
259518
|
+
resolve: resolve4,
|
|
259519
259519
|
resolveComponent,
|
|
259520
259520
|
equal,
|
|
259521
259521
|
serialize,
|
|
259522
|
-
parse:
|
|
259522
|
+
parse: parse4
|
|
259523
259523
|
};
|
|
259524
259524
|
module.exports = fastUri;
|
|
259525
259525
|
module.exports.default = fastUri;
|
|
@@ -263497,7 +263497,7 @@ var init_mcp = __esm({
|
|
|
263497
263497
|
let task = createTaskResult.task;
|
|
263498
263498
|
const pollInterval = task.pollInterval ?? 5e3;
|
|
263499
263499
|
while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
|
|
263500
|
-
await new Promise((
|
|
263500
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
263501
263501
|
const updatedTask = await extra.taskStore.getTask(taskId);
|
|
263502
263502
|
if (!updatedTask) {
|
|
263503
263503
|
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
|
|
@@ -264361,9 +264361,9 @@ data:
|
|
|
264361
264361
|
const initRequest = messages.find((m) => isInitializeRequest(m));
|
|
264362
264362
|
const clientProtocolVersion = initRequest ? initRequest.params.protocolVersion : req.headers.get("mcp-protocol-version") ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION;
|
|
264363
264363
|
if (this._enableJsonResponse) {
|
|
264364
|
-
return new Promise((
|
|
264364
|
+
return new Promise((resolve4) => {
|
|
264365
264365
|
this._streamMapping.set(streamId, {
|
|
264366
|
-
resolveJson:
|
|
264366
|
+
resolveJson: resolve4,
|
|
264367
264367
|
cleanup: () => {
|
|
264368
264368
|
this._streamMapping.delete(streamId);
|
|
264369
264369
|
}
|
|
@@ -264687,6 +264687,29 @@ function registerTools(server2) {
|
|
|
264687
264687
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
264688
264688
|
}
|
|
264689
264689
|
);
|
|
264690
|
+
server2.registerTool(
|
|
264691
|
+
"lens_pattern",
|
|
264692
|
+
{
|
|
264693
|
+
title: "LENS Pattern \u2014 Structural AST Search",
|
|
264694
|
+
description: "Find code matching an ast-grep pattern (structural AST shape, not text). Use $NAME for a single capture, $$$ for any sequence. Example: 'class $C : IController { $$$ }' finds C# controllers. Use AFTER lens_grep when you know the EXACT structural shape (e.g. every place a specific decorator is applied, every export that wraps a HOF). Returns path:line + captured meta-variables.",
|
|
264695
|
+
inputSchema: {
|
|
264696
|
+
repoPath: external_exports.string().describe("Absolute path to the repository root"),
|
|
264697
|
+
pattern: external_exports.string().describe('ast-grep pattern. $NAME = capture, $$$ = any sequence. Example: "function $N($$$) { $$$ }"'),
|
|
264698
|
+
language: external_exports.enum(["typescript", "tsx", "javascript", "csharp"]).describe("Source language to parse files as"),
|
|
264699
|
+
limit: external_exports.number().int().min(1).max(200).optional().default(50).describe("Max matches returned"),
|
|
264700
|
+
format: external_exports.enum(["text", "json"]).optional().default("text").describe("Output format. text = one line per match. json = full structure with captures.")
|
|
264701
|
+
}
|
|
264702
|
+
},
|
|
264703
|
+
async ({ repoPath, pattern, language, limit, format }) => {
|
|
264704
|
+
const res = await fetch(`${API}/pattern`, {
|
|
264705
|
+
method: "POST",
|
|
264706
|
+
headers: { "Content-Type": "application/json" },
|
|
264707
|
+
body: JSON.stringify({ repoPath, pattern, language, limit, format })
|
|
264708
|
+
});
|
|
264709
|
+
const body = format === "text" ? await res.text() : JSON.stringify(await res.json(), null, 2);
|
|
264710
|
+
return { content: [{ type: "text", text: body }] };
|
|
264711
|
+
}
|
|
264712
|
+
);
|
|
264690
264713
|
}
|
|
264691
264714
|
function createSession() {
|
|
264692
264715
|
const server2 = new McpServer({ name: "lens", version: "2.0.0" });
|
|
@@ -264741,7 +264764,8 @@ import { fileURLToPath } from "url";
|
|
|
264741
264764
|
|
|
264742
264765
|
// cjs-extern:better-sqlite3
|
|
264743
264766
|
var _mod = "better-sqlite3";
|
|
264744
|
-
var
|
|
264767
|
+
var _impl = __require(_mod);
|
|
264768
|
+
var better_sqlite3_default = _impl;
|
|
264745
264769
|
|
|
264746
264770
|
// node_modules/.pnpm/drizzle-orm@0.45.1_@types+better-sqlite3@7.6.13_better-sqlite3@12.6.2/node_modules/drizzle-orm/entity.js
|
|
264747
264771
|
var entityKind = /* @__PURE__ */ Symbol.for("drizzle:entityKind");
|
|
@@ -270531,6 +270555,25 @@ import { dirname as dirname2, join as join2 } from "path";
|
|
|
270531
270555
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
270532
270556
|
import { readFile } from "fs/promises";
|
|
270533
270557
|
import { join as join22 } from "path";
|
|
270558
|
+
|
|
270559
|
+
// cjs-extern:@ast-grep/napi
|
|
270560
|
+
var _mod2 = "@ast-grep/napi";
|
|
270561
|
+
var _impl2 = __require(_mod2);
|
|
270562
|
+
var parse = _impl2.parse;
|
|
270563
|
+
var parseAsync = _impl2.parseAsync;
|
|
270564
|
+
var parseFiles = _impl2.parseFiles;
|
|
270565
|
+
var findInFiles = _impl2.findInFiles;
|
|
270566
|
+
var Lang = _impl2.Lang;
|
|
270567
|
+
var SgNode = _impl2.SgNode;
|
|
270568
|
+
var SgRoot = _impl2.SgRoot;
|
|
270569
|
+
var registerDynamicLanguage = _impl2.registerDynamicLanguage;
|
|
270570
|
+
|
|
270571
|
+
// cjs-extern:@ast-grep/lang-csharp
|
|
270572
|
+
var _mod3 = "@ast-grep/lang-csharp";
|
|
270573
|
+
var _impl3 = __require(_mod3);
|
|
270574
|
+
var lang_csharp_default = _impl3;
|
|
270575
|
+
|
|
270576
|
+
// packages/engine/dist/index.js
|
|
270534
270577
|
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
270535
270578
|
import * as path from "path";
|
|
270536
270579
|
import { execFile as execFile2 } from "child_process";
|
|
@@ -270600,7 +270643,8 @@ var fileMetadata = sqliteTable(
|
|
|
270600
270643
|
docstring: text("docstring").default(""),
|
|
270601
270644
|
sections: text("sections").default("[]"),
|
|
270602
270645
|
internals: text("internals").default("[]"),
|
|
270603
|
-
symbols: text("symbols").default("[]")
|
|
270646
|
+
symbols: text("symbols").default("[]"),
|
|
270647
|
+
namespaces: text("namespaces").default("[]")
|
|
270604
270648
|
},
|
|
270605
270649
|
(t) => [uniqueIndex("idx_file_metadata_unique").on(t.repo_id, t.path)]
|
|
270606
270650
|
);
|
|
@@ -270728,7 +270772,8 @@ var metadataQueries = {
|
|
|
270728
270772
|
docstring: metadata.docstring,
|
|
270729
270773
|
sections: JSON.stringify(metadata.sections),
|
|
270730
270774
|
internals: JSON.stringify(metadata.internals),
|
|
270731
|
-
symbols: JSON.stringify(metadata.symbols)
|
|
270775
|
+
symbols: JSON.stringify(metadata.symbols),
|
|
270776
|
+
namespaces: JSON.stringify(metadata.namespaces ?? [])
|
|
270732
270777
|
}).where(eq(fileMetadata.id, existing.id)).run();
|
|
270733
270778
|
} else {
|
|
270734
270779
|
db.insert(fileMetadata).values({
|
|
@@ -270741,7 +270786,8 @@ var metadataQueries = {
|
|
|
270741
270786
|
docstring: metadata.docstring,
|
|
270742
270787
|
sections: JSON.stringify(metadata.sections),
|
|
270743
270788
|
internals: JSON.stringify(metadata.internals),
|
|
270744
|
-
symbols: JSON.stringify(metadata.symbols)
|
|
270789
|
+
symbols: JSON.stringify(metadata.symbols),
|
|
270790
|
+
namespaces: JSON.stringify(metadata.namespaces ?? [])
|
|
270745
270791
|
}).run();
|
|
270746
270792
|
}
|
|
270747
270793
|
},
|
|
@@ -271505,8 +271551,12 @@ async function diffScan(repoRoot, fromCommit, toCommit) {
|
|
|
271505
271551
|
return results;
|
|
271506
271552
|
}
|
|
271507
271553
|
async function getHeadCommit(repoRoot) {
|
|
271508
|
-
|
|
271509
|
-
|
|
271554
|
+
try {
|
|
271555
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { cwd: repoRoot });
|
|
271556
|
+
return stdout.trim();
|
|
271557
|
+
} catch {
|
|
271558
|
+
throw new Error(`Not a git repository: ${repoRoot}`);
|
|
271559
|
+
}
|
|
271510
271560
|
}
|
|
271511
271561
|
function normalizeRemoteUrl(url) {
|
|
271512
271562
|
let normalized = url.trim();
|
|
@@ -271572,6 +271622,57 @@ function getEngineDb() {
|
|
|
271572
271622
|
if (!_db) throw new Error("Engine DB not initialized. Call configureEngineDb() first.");
|
|
271573
271623
|
return _db;
|
|
271574
271624
|
}
|
|
271625
|
+
var MAX_OWNERS_PER_NAMESPACE = 5;
|
|
271626
|
+
function resolveCsharpEdges(files) {
|
|
271627
|
+
const owners = /* @__PURE__ */ new Map();
|
|
271628
|
+
for (const f of files) {
|
|
271629
|
+
for (const ns of f.namespaces) {
|
|
271630
|
+
const list = owners.get(ns) ?? [];
|
|
271631
|
+
list.push(f.path);
|
|
271632
|
+
owners.set(ns, list);
|
|
271633
|
+
}
|
|
271634
|
+
}
|
|
271635
|
+
const seen = /* @__PURE__ */ new Set();
|
|
271636
|
+
const edges = [];
|
|
271637
|
+
for (const f of files) {
|
|
271638
|
+
for (const ns of f.imports) {
|
|
271639
|
+
const ownerPaths = owners.get(ns);
|
|
271640
|
+
if (!ownerPaths || ownerPaths.length === 0) continue;
|
|
271641
|
+
for (const target of ownerPaths.slice(0, MAX_OWNERS_PER_NAMESPACE)) {
|
|
271642
|
+
if (target === f.path) continue;
|
|
271643
|
+
const key = `${f.path}\0${target}`;
|
|
271644
|
+
if (seen.has(key)) continue;
|
|
271645
|
+
seen.add(key);
|
|
271646
|
+
edges.push({ sourcePath: f.path, targetPath: target });
|
|
271647
|
+
}
|
|
271648
|
+
}
|
|
271649
|
+
}
|
|
271650
|
+
return edges;
|
|
271651
|
+
}
|
|
271652
|
+
function buildCsharpNamespaceGraphImpl(db, repoId) {
|
|
271653
|
+
const all = metadataQueries.getAllForRepo(db, repoId);
|
|
271654
|
+
const csFiles = [];
|
|
271655
|
+
for (const m of all) {
|
|
271656
|
+
if (m.language !== "csharp") continue;
|
|
271657
|
+
let namespaces = [];
|
|
271658
|
+
let imports = [];
|
|
271659
|
+
try {
|
|
271660
|
+
namespaces = JSON.parse(m.namespaces ?? "[]");
|
|
271661
|
+
} catch {
|
|
271662
|
+
}
|
|
271663
|
+
try {
|
|
271664
|
+
imports = JSON.parse(m.imports ?? "[]");
|
|
271665
|
+
} catch {
|
|
271666
|
+
}
|
|
271667
|
+
csFiles.push({ path: m.path, namespaces, imports });
|
|
271668
|
+
}
|
|
271669
|
+
if (csFiles.length === 0) return { edges: 0 };
|
|
271670
|
+
const edges = resolveCsharpEdges(csFiles);
|
|
271671
|
+
if (edges.length > 0) {
|
|
271672
|
+
importQueries.insertEdges(db, repoId, edges);
|
|
271673
|
+
}
|
|
271674
|
+
return { edges: edges.length };
|
|
271675
|
+
}
|
|
271575
271676
|
var SECTION_SINGLE_RE = /^(?:\/\/|#)\s*[-=]{3,}\s*(.+?)\s*[-=]{3,}\s*$/gm;
|
|
271576
271677
|
var SECTION_BLOCK_RE = /^\/\*\s*[-=]{3,}\s*(.+?)\s*[-=]{3,}\s*\*\/$/gm;
|
|
271577
271678
|
function extractSections(content) {
|
|
@@ -271644,6 +271745,132 @@ function extractUniversalInternals(content, exports) {
|
|
|
271644
271745
|
}
|
|
271645
271746
|
return results.slice(0, 20);
|
|
271646
271747
|
}
|
|
271748
|
+
var registered = false;
|
|
271749
|
+
function ensureCsharpRegistered() {
|
|
271750
|
+
if (registered) return;
|
|
271751
|
+
registered = true;
|
|
271752
|
+
try {
|
|
271753
|
+
registerDynamicLanguage({ csharp: lang_csharp_default });
|
|
271754
|
+
} catch {
|
|
271755
|
+
}
|
|
271756
|
+
}
|
|
271757
|
+
var PATTERNS = ["using $NS;", "using static $NS;", "using $ALIAS = $NS;"];
|
|
271758
|
+
function extractCsharpImports(content) {
|
|
271759
|
+
ensureCsharpRegistered();
|
|
271760
|
+
const root = parse("csharp", content).root();
|
|
271761
|
+
const found = /* @__PURE__ */ new Set();
|
|
271762
|
+
for (const pattern of PATTERNS) {
|
|
271763
|
+
for (const node of root.findAll(pattern)) {
|
|
271764
|
+
const ns = node.getMatch("NS");
|
|
271765
|
+
if (ns) found.add(ns.text());
|
|
271766
|
+
}
|
|
271767
|
+
}
|
|
271768
|
+
return Array.from(found);
|
|
271769
|
+
}
|
|
271770
|
+
var PATTERNS2 = [
|
|
271771
|
+
"namespace $NS { $$$ }",
|
|
271772
|
+
// block-scoped
|
|
271773
|
+
"namespace $NS;"
|
|
271774
|
+
// file-scoped (C# 10+)
|
|
271775
|
+
];
|
|
271776
|
+
function extractCsharpNamespaces(content) {
|
|
271777
|
+
ensureCsharpRegistered();
|
|
271778
|
+
const root = parse("csharp", content).root();
|
|
271779
|
+
const found = /* @__PURE__ */ new Set();
|
|
271780
|
+
for (const pattern of PATTERNS2) {
|
|
271781
|
+
for (const node of root.findAll(pattern)) {
|
|
271782
|
+
const ns = node.getMatch("NS");
|
|
271783
|
+
if (ns) found.add(ns.text());
|
|
271784
|
+
}
|
|
271785
|
+
}
|
|
271786
|
+
return Array.from(found);
|
|
271787
|
+
}
|
|
271788
|
+
var DECL_PATTERNS = [
|
|
271789
|
+
{
|
|
271790
|
+
kind: "class",
|
|
271791
|
+
re: /^[ \t]*(?:(public|internal|private|protected(?:\s+internal)?)\s+)?(?:abstract\s+|sealed\s+|static\s+|partial\s+)*class\s+(\w+)/m
|
|
271792
|
+
},
|
|
271793
|
+
{
|
|
271794
|
+
kind: "interface",
|
|
271795
|
+
re: /^[ \t]*(?:(public|internal|private|protected(?:\s+internal)?)\s+)?(?:partial\s+)*interface\s+(\w+)/m
|
|
271796
|
+
},
|
|
271797
|
+
{
|
|
271798
|
+
kind: "type",
|
|
271799
|
+
re: /^[ \t]*(?:(public|internal|private|protected(?:\s+internal)?)\s+)?(?:readonly\s+|ref\s+)?struct\s+(\w+)/m
|
|
271800
|
+
},
|
|
271801
|
+
{ kind: "enum", re: /^[ \t]*(?:(public|internal|private|protected(?:\s+internal)?)\s+)?enum\s+(\w+)/m },
|
|
271802
|
+
{
|
|
271803
|
+
kind: "type",
|
|
271804
|
+
re: /^[ \t]*(?:(public|internal|private|protected(?:\s+internal)?)\s+)?(?:abstract\s+|sealed\s+|partial\s+)*record\s+(\w+)/m
|
|
271805
|
+
}
|
|
271806
|
+
];
|
|
271807
|
+
function extractCsharpSymbols(content) {
|
|
271808
|
+
const lines = content.split(/\r?\n/);
|
|
271809
|
+
const out = [];
|
|
271810
|
+
const seen = /* @__PURE__ */ new Set();
|
|
271811
|
+
for (let i = 0; i < lines.length; i++) {
|
|
271812
|
+
const line = lines[i];
|
|
271813
|
+
for (const { kind, re } of DECL_PATTERNS) {
|
|
271814
|
+
const m = line.match(re);
|
|
271815
|
+
if (!m) continue;
|
|
271816
|
+
const accessModifier = m[1];
|
|
271817
|
+
const name = m[2];
|
|
271818
|
+
const lineNum = i + 1;
|
|
271819
|
+
const key = `${kind}:${name}:${lineNum}`;
|
|
271820
|
+
if (seen.has(key)) continue;
|
|
271821
|
+
seen.add(key);
|
|
271822
|
+
const exported = accessModifier === "public";
|
|
271823
|
+
out.push({ name, kind, line: lineNum, exported });
|
|
271824
|
+
break;
|
|
271825
|
+
}
|
|
271826
|
+
}
|
|
271827
|
+
return out;
|
|
271828
|
+
}
|
|
271829
|
+
var csharpParser = {
|
|
271830
|
+
languages: ["csharp"],
|
|
271831
|
+
extractImports(content) {
|
|
271832
|
+
return extractCsharpImports(content);
|
|
271833
|
+
},
|
|
271834
|
+
extractExports(content) {
|
|
271835
|
+
return extractCsharpSymbols(content).filter((s) => s.exported).map((s) => s.name);
|
|
271836
|
+
},
|
|
271837
|
+
extractDocstring(content) {
|
|
271838
|
+
const lines = content.split(/\r?\n/);
|
|
271839
|
+
const collected = [];
|
|
271840
|
+
for (const line of lines) {
|
|
271841
|
+
const trimmed = line.trim();
|
|
271842
|
+
if (trimmed.startsWith("///")) {
|
|
271843
|
+
collected.push(trimmed.replace(/^\/+/, "").trim());
|
|
271844
|
+
continue;
|
|
271845
|
+
}
|
|
271846
|
+
if (collected.length > 0) break;
|
|
271847
|
+
if (trimmed === "" || trimmed.startsWith("using ")) continue;
|
|
271848
|
+
break;
|
|
271849
|
+
}
|
|
271850
|
+
return collected.join(" ").replace(/<\/?[a-zA-Z][^>]*>/g, "").trim();
|
|
271851
|
+
},
|
|
271852
|
+
extractSections(content) {
|
|
271853
|
+
const out = [];
|
|
271854
|
+
for (const line of content.split(/\r?\n/)) {
|
|
271855
|
+
const m = line.match(/^\s*#region\s+(.+)$/);
|
|
271856
|
+
if (m) out.push(m[1].trim());
|
|
271857
|
+
}
|
|
271858
|
+
return out;
|
|
271859
|
+
},
|
|
271860
|
+
extractInternals(content, exports) {
|
|
271861
|
+
const exportSet = new Set(exports);
|
|
271862
|
+
return extractCsharpSymbols(content).filter((s) => !s.exported && !exportSet.has(s.name)).map((s) => s.name);
|
|
271863
|
+
},
|
|
271864
|
+
extractSymbols(content) {
|
|
271865
|
+
return extractCsharpSymbols(content);
|
|
271866
|
+
},
|
|
271867
|
+
extractNamespaces(content) {
|
|
271868
|
+
return extractCsharpNamespaces(content);
|
|
271869
|
+
},
|
|
271870
|
+
resolveImport() {
|
|
271871
|
+
return null;
|
|
271872
|
+
}
|
|
271873
|
+
};
|
|
271647
271874
|
var TS_EXPORT_RE = /^export\s+(?:default\s+)?(?:async\s+)?(?:function|class|interface|type|const|let|enum|namespace)\s+(\w+)/gm;
|
|
271648
271875
|
function extractExports(content) {
|
|
271649
271876
|
const result = [];
|
|
@@ -271816,6 +272043,7 @@ function getParser(language) {
|
|
|
271816
272043
|
return parsers.get(language ?? "") ?? null;
|
|
271817
272044
|
}
|
|
271818
272045
|
registerParser(typescriptParser);
|
|
272046
|
+
registerParser(csharpParser);
|
|
271819
272047
|
function extractFileMetadata(content, path2, language) {
|
|
271820
272048
|
const parser = getParser(language);
|
|
271821
272049
|
const exports = parser?.extractExports(content) ?? [];
|
|
@@ -271827,7 +272055,8 @@ function extractFileMetadata(content, path2, language) {
|
|
|
271827
272055
|
docstring: parser?.extractDocstring(content) ?? "",
|
|
271828
272056
|
sections: parser?.extractSections(content) ?? extractSections(content),
|
|
271829
272057
|
internals: parser?.extractInternals(content, exports) ?? extractUniversalInternals(content, exports),
|
|
271830
|
-
symbols: parser?.extractSymbols?.(content) ?? []
|
|
272058
|
+
symbols: parser?.extractSymbols?.(content) ?? [],
|
|
272059
|
+
namespaces: parser?.extractNamespaces?.(content) ?? []
|
|
271831
272060
|
};
|
|
271832
272061
|
}
|
|
271833
272062
|
function extractAndPersistMetadata(db, repoId, fileContents) {
|
|
@@ -271841,7 +272070,8 @@ function extractAndPersistMetadata(db, repoId, fileContents) {
|
|
|
271841
272070
|
docstring: meta.docstring,
|
|
271842
272071
|
sections: meta.sections,
|
|
271843
272072
|
internals: meta.internals,
|
|
271844
|
-
symbols: meta.symbols
|
|
272073
|
+
symbols: meta.symbols,
|
|
272074
|
+
namespaces: meta.namespaces
|
|
271845
272075
|
});
|
|
271846
272076
|
count2++;
|
|
271847
272077
|
}
|
|
@@ -272006,6 +272236,7 @@ async function indexImpl(db, repoId, force) {
|
|
|
272006
272236
|
}
|
|
272007
272237
|
extractAndPersistMetadata(db, repoId, fileContents);
|
|
272008
272238
|
buildAndPersistImportGraph(db, repoId);
|
|
272239
|
+
buildCsharpNamespaceGraphImpl(db, repoId);
|
|
272009
272240
|
await analyzeGitHistory(db, repoId, repo.root_path, repo.last_git_analysis_commit);
|
|
272010
272241
|
repoQueries.updateIndexState(db, repoId, headCommit, "ready");
|
|
272011
272242
|
return {
|
|
@@ -272023,6 +272254,64 @@ var runIndex = lensFn(
|
|
|
272023
272254
|
"engine.runIndex",
|
|
272024
272255
|
async (db, repoId, force = false) => indexImpl(db, repoId, force)
|
|
272025
272256
|
);
|
|
272257
|
+
var LANG_MAP2 = {
|
|
272258
|
+
typescript: "TypeScript",
|
|
272259
|
+
tsx: "Tsx",
|
|
272260
|
+
javascript: "JavaScript",
|
|
272261
|
+
csharp: "csharp"
|
|
272262
|
+
};
|
|
272263
|
+
function extractMetaVars(pattern) {
|
|
272264
|
+
const names = /* @__PURE__ */ new Set();
|
|
272265
|
+
for (const m of pattern.matchAll(/\$+([A-Z_][A-Z0-9_]*)/g)) {
|
|
272266
|
+
names.add(m[1]);
|
|
272267
|
+
}
|
|
272268
|
+
return [...names];
|
|
272269
|
+
}
|
|
272270
|
+
async function runPatternImpl(args) {
|
|
272271
|
+
const { pattern, language, files, limit } = args;
|
|
272272
|
+
const lang = LANG_MAP2[language];
|
|
272273
|
+
if (!lang) {
|
|
272274
|
+
throw new Error(`Unsupported language: ${language}`);
|
|
272275
|
+
}
|
|
272276
|
+
if (language === "csharp") ensureCsharpRegistered();
|
|
272277
|
+
const metaVars = extractMetaVars(pattern);
|
|
272278
|
+
const matches = [];
|
|
272279
|
+
let truncated = false;
|
|
272280
|
+
for (const file of files) {
|
|
272281
|
+
if (matches.length >= limit) {
|
|
272282
|
+
truncated = true;
|
|
272283
|
+
break;
|
|
272284
|
+
}
|
|
272285
|
+
const root = parse(lang, file.content).root();
|
|
272286
|
+
const found = root.findAll(pattern);
|
|
272287
|
+
for (const node of found) {
|
|
272288
|
+
if (matches.length >= limit) {
|
|
272289
|
+
truncated = true;
|
|
272290
|
+
break;
|
|
272291
|
+
}
|
|
272292
|
+
const range = node.range();
|
|
272293
|
+
const captures = {};
|
|
272294
|
+
for (const name of metaVars) {
|
|
272295
|
+
const captured = node.getMatch(name);
|
|
272296
|
+
if (captured) captures[name] = captured.text();
|
|
272297
|
+
}
|
|
272298
|
+
matches.push({
|
|
272299
|
+
path: file.path,
|
|
272300
|
+
line: range.start.line + 1,
|
|
272301
|
+
column: range.start.column + 1,
|
|
272302
|
+
text: node.text(),
|
|
272303
|
+
captures
|
|
272304
|
+
});
|
|
272305
|
+
}
|
|
272306
|
+
}
|
|
272307
|
+
return {
|
|
272308
|
+
pattern,
|
|
272309
|
+
language,
|
|
272310
|
+
matches,
|
|
272311
|
+
truncated,
|
|
272312
|
+
filesScanned: files.length
|
|
272313
|
+
};
|
|
272314
|
+
}
|
|
272026
272315
|
var removeRepo2 = lensFn(
|
|
272027
272316
|
"engine.removeRepo",
|
|
272028
272317
|
async (db, repoId) => removeRepo(db, repoId)
|
|
@@ -272033,6 +272322,7 @@ var getRepoStatus2 = lensFn(
|
|
|
272033
272322
|
async (db, repoId) => getRepoStatus(db, repoId)
|
|
272034
272323
|
);
|
|
272035
272324
|
var grepRepo = lensFn("engine.grepRepo", grepRepoImpl);
|
|
272325
|
+
var runPattern = lensFn("engine.runPattern", runPatternImpl);
|
|
272036
272326
|
var buildGraphSummary2 = lensFn(
|
|
272037
272327
|
"engine.buildGraphSummary",
|
|
272038
272328
|
async (db, repoId) => buildGraphSummary(db, repoId)
|
|
@@ -272464,7 +272754,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
272464
272754
|
});
|
|
272465
272755
|
if (!chunk) {
|
|
272466
272756
|
if (i === 1) {
|
|
272467
|
-
await new Promise((
|
|
272757
|
+
await new Promise((resolve4) => setTimeout(resolve4));
|
|
272468
272758
|
maxReadCount = 3;
|
|
272469
272759
|
continue;
|
|
272470
272760
|
}
|
|
@@ -275235,6 +275525,75 @@ healthRoutes.get(
|
|
|
275235
275525
|
})
|
|
275236
275526
|
);
|
|
275237
275527
|
|
|
275528
|
+
// apps/daemon/src/routes/pattern.ts
|
|
275529
|
+
import { readFileSync } from "fs";
|
|
275530
|
+
import { resolve as resolve3 } from "path";
|
|
275531
|
+
var patternRoutes = new Hono2();
|
|
275532
|
+
var SUPPORTED = ["typescript", "tsx", "javascript", "csharp"];
|
|
275533
|
+
var EXT_FILTER = {
|
|
275534
|
+
typescript: /\.(ts|cts|mts)$/i,
|
|
275535
|
+
tsx: /\.tsx$/i,
|
|
275536
|
+
javascript: /\.(js|jsx|cjs|mjs)$/i,
|
|
275537
|
+
csharp: /\.cs$/i
|
|
275538
|
+
};
|
|
275539
|
+
patternRoutes.post(
|
|
275540
|
+
"/",
|
|
275541
|
+
lensRoute("pattern.post", async (c) => {
|
|
275542
|
+
const { repoPath, pattern, language, limit = 50, format = "json" } = await c.req.json();
|
|
275543
|
+
if (!repoPath || typeof repoPath !== "string") {
|
|
275544
|
+
return c.json({ error: "repoPath is required (string)" }, 400);
|
|
275545
|
+
}
|
|
275546
|
+
if (!pattern || typeof pattern !== "string") {
|
|
275547
|
+
return c.json({ error: "pattern is required (string)" }, 400);
|
|
275548
|
+
}
|
|
275549
|
+
if (!SUPPORTED.includes(language)) {
|
|
275550
|
+
return c.json({ error: `language must be one of: ${SUPPORTED.join(", ")}` }, 400);
|
|
275551
|
+
}
|
|
275552
|
+
const safeLimit = Math.max(1, Math.min(Number(limit) || 50, 500));
|
|
275553
|
+
const db = getEngineDb();
|
|
275554
|
+
const repos2 = await listRepos2(db);
|
|
275555
|
+
const repo = repos2.find((r) => r.root_path === repoPath || r.root_path === repoPath.replace(/\/$/, ""));
|
|
275556
|
+
if (!repo) {
|
|
275557
|
+
return c.json({ error: "Repo not registered", hint: `Run: lens register ${repoPath}` }, 404);
|
|
275558
|
+
}
|
|
275559
|
+
const extPattern = EXT_FILTER[language];
|
|
275560
|
+
const allMeta = metadataQueries.getAllForRepo(db, repo.id);
|
|
275561
|
+
const candidates = allMeta.filter((m) => extPattern.test(m.path) && !m.path.endsWith(".d.ts"));
|
|
275562
|
+
const files = candidates.map((m) => {
|
|
275563
|
+
const abs = resolve3(repo.root_path, m.path);
|
|
275564
|
+
try {
|
|
275565
|
+
return { path: m.path, content: readFileSync(abs, "utf-8") };
|
|
275566
|
+
} catch {
|
|
275567
|
+
return null;
|
|
275568
|
+
}
|
|
275569
|
+
}).filter((f) => f !== null);
|
|
275570
|
+
const result = await runPattern({
|
|
275571
|
+
pattern,
|
|
275572
|
+
language,
|
|
275573
|
+
files,
|
|
275574
|
+
limit: safeLimit
|
|
275575
|
+
});
|
|
275576
|
+
if (format === "text") {
|
|
275577
|
+
return c.text(formatPatternText(result));
|
|
275578
|
+
}
|
|
275579
|
+
return c.json(result);
|
|
275580
|
+
})
|
|
275581
|
+
);
|
|
275582
|
+
function formatPatternText(result) {
|
|
275583
|
+
if (result.matches.length === 0) {
|
|
275584
|
+
return "0 matches\n";
|
|
275585
|
+
}
|
|
275586
|
+
const lines = result.matches.map((m) => {
|
|
275587
|
+
const captures = Object.entries(m.captures).map(([k, v]) => `${k}=${v}`).join(" ");
|
|
275588
|
+
const head = m.text.split("\n")[0]?.trim().slice(0, 80) ?? "";
|
|
275589
|
+
return `${m.path}:${m.line} ${head}${captures ? ` [${captures}]` : ""}`;
|
|
275590
|
+
});
|
|
275591
|
+
const footer = `
|
|
275592
|
+
${result.matches.length} match${result.matches.length === 1 ? "" : "es"}${result.truncated ? " (truncated)" : ""}`;
|
|
275593
|
+
return `${lines.join("\n")}${footer}
|
|
275594
|
+
`;
|
|
275595
|
+
}
|
|
275596
|
+
|
|
275238
275597
|
// apps/daemon/src/routes/repos.ts
|
|
275239
275598
|
var reposRoutes = new Hono2();
|
|
275240
275599
|
reposRoutes.post(
|
|
@@ -275335,6 +275694,7 @@ app.onError((err, c) => {
|
|
|
275335
275694
|
function mountRoutes(router) {
|
|
275336
275695
|
router.route("/graph", graphRoutes);
|
|
275337
275696
|
router.route("/grep", grepRoutes);
|
|
275697
|
+
router.route("/pattern", patternRoutes);
|
|
275338
275698
|
router.route("/repos", reposRoutes);
|
|
275339
275699
|
router.route("/repos", filesRoutes);
|
|
275340
275700
|
router.route("/traces", tracesRoutes);
|