@happyvertical/smrt-scanner 0.57.32 → 0.57.34
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/AGENTS.md +2 -2
- package/dist/chunks/{scanner-FB4nRHQB.js → scanner-C1rTEfa8.js} +33 -12
- package/dist/chunks/scanner-C1rTEfa8.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/manifest-adapter.d.ts +2 -0
- package/dist/manifest-adapter.d.ts.map +1 -1
- package/dist/scanner.d.ts +3 -3
- package/package.json +4 -4
- package/dist/chunks/scanner-FB4nRHQB.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -6,7 +6,7 @@ executes the source.
|
|
|
6
6
|
|
|
7
7
|
## Key Exports
|
|
8
8
|
|
|
9
|
-
- `OxcScanner` — class that globs `.ts` files (`
|
|
9
|
+
- `OxcScanner` — class that globs `.ts` files (`tinyglobby`) and parses each into
|
|
10
10
|
raw class/field/method metadata. `scan()` parses; `scanAndResolve()` parses
|
|
11
11
|
then resolves inheritance in one call.
|
|
12
12
|
- `InheritanceResolver` — resolves class inheritance chains across files
|
|
@@ -241,7 +241,7 @@ place, `toKnowledgeAgentSurface` in `vite-plugin/index.ts`.
|
|
|
241
241
|
|
|
242
242
|
## How It Works
|
|
243
243
|
|
|
244
|
-
1. `
|
|
244
|
+
1. `tinyglobby` finds `.ts` files matching include/exclude patterns.
|
|
245
245
|
2. `oxc-parser` parses each file's AST (TS-ESTree shape).
|
|
246
246
|
3. Extracts: `@smrt()` config, class hierarchy, field defaults (0 vs 0.0
|
|
247
247
|
heuristic, including negative initializers via `UnaryExpression` unwrap),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute, relative, resolve, sep, win32 } from "node:path";
|
|
3
|
-
import
|
|
3
|
+
import { glob } from "tinyglobby";
|
|
4
4
|
import { parseSync } from "oxc-parser";
|
|
5
5
|
//#region src/source-location.ts
|
|
6
6
|
function getLineColumn(sourceText, offset) {
|
|
@@ -725,8 +725,9 @@ var MANDATORY_DISCOVERY_EXCLUDES = Object.freeze([
|
|
|
725
725
|
]);
|
|
726
726
|
async function discoverSourceFiles(options) {
|
|
727
727
|
const cwd = resolve(options.cwd);
|
|
728
|
-
return
|
|
728
|
+
return glob(options.include.map((pattern) => relativeGlobToCwd(pattern, cwd)), {
|
|
729
729
|
cwd,
|
|
730
|
+
expandDirectories: false,
|
|
730
731
|
ignore: [...options.exclude.map((pattern) => relativeGlobToCwd(pattern, cwd)), ...MANDATORY_DISCOVERY_EXCLUDES],
|
|
731
732
|
absolute: true,
|
|
732
733
|
onlyFiles: true,
|
|
@@ -4225,10 +4226,17 @@ var ManifestAdapter = class ManifestAdapter {
|
|
|
4225
4226
|
return options;
|
|
4226
4227
|
}
|
|
4227
4228
|
parseReportFieldDecorator(decorator, field) {
|
|
4228
|
-
if (decorator.name === "groupBy")
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4229
|
+
if (decorator.name === "groupBy") {
|
|
4230
|
+
const options = this.parseFieldDecoratorOptions(decorator.arguments[0]);
|
|
4231
|
+
if (options && typeof options.expr === "object" && options.expr) return {
|
|
4232
|
+
kind: "group",
|
|
4233
|
+
expr: options.expr
|
|
4234
|
+
};
|
|
4235
|
+
return {
|
|
4236
|
+
kind: "group",
|
|
4237
|
+
sourceColumn: stripQuotes(decorator.arguments[0]?.trim()) ?? field.name
|
|
4238
|
+
};
|
|
4239
|
+
}
|
|
4232
4240
|
if ((/* @__PURE__ */ new Set([
|
|
4233
4241
|
"minute",
|
|
4234
4242
|
"hour",
|
|
@@ -4253,6 +4261,7 @@ var ManifestAdapter = class ManifestAdapter {
|
|
|
4253
4261
|
kind: "aggregate",
|
|
4254
4262
|
fn: parsed.fn,
|
|
4255
4263
|
...typeof parsed.column === "string" ? { column: parsed.column } : {},
|
|
4264
|
+
...this.reportOperandOptions(parsed),
|
|
4256
4265
|
...typeof parsed.distinct === "boolean" ? { distinct: parsed.distinct } : {}
|
|
4257
4266
|
};
|
|
4258
4267
|
}
|
|
@@ -4262,12 +4271,14 @@ var ManifestAdapter = class ManifestAdapter {
|
|
|
4262
4271
|
"min",
|
|
4263
4272
|
"max"
|
|
4264
4273
|
])).has(decorator.name)) {
|
|
4265
|
-
const
|
|
4266
|
-
const
|
|
4274
|
+
const firstOptions = this.parseFieldDecoratorOptions(decorator.arguments[0]);
|
|
4275
|
+
const column = firstOptions ? void 0 : stripQuotes(decorator.arguments[0]?.trim());
|
|
4276
|
+
const parsedOptions = firstOptions ?? this.parseFieldDecoratorOptions(decorator.arguments[1]);
|
|
4267
4277
|
return {
|
|
4268
4278
|
kind: "aggregate",
|
|
4269
4279
|
fn: decorator.name,
|
|
4270
4280
|
...column ? { column } : {},
|
|
4281
|
+
...this.reportOperandOptions(parsedOptions),
|
|
4271
4282
|
...typeof parsedOptions?.distinct === "boolean" ? { distinct: parsedOptions.distinct } : {}
|
|
4272
4283
|
};
|
|
4273
4284
|
}
|
|
@@ -4281,11 +4292,21 @@ var ManifestAdapter = class ManifestAdapter {
|
|
|
4281
4292
|
kind: "aggregate",
|
|
4282
4293
|
fn: "count",
|
|
4283
4294
|
...column ? { column } : {},
|
|
4295
|
+
...this.reportOperandOptions(options),
|
|
4284
4296
|
...typeof options?.distinct === "boolean" ? { distinct: options.distinct } : {}
|
|
4285
4297
|
};
|
|
4286
4298
|
}
|
|
4287
4299
|
return null;
|
|
4288
4300
|
}
|
|
4301
|
+
/** The `expr` and `filter` of an aggregate decorator: literal expression nodes. */
|
|
4302
|
+
reportOperandOptions(options) {
|
|
4303
|
+
const out = {};
|
|
4304
|
+
for (const key of ["expr", "filter"]) {
|
|
4305
|
+
const value = options?.[key];
|
|
4306
|
+
if (value && typeof value === "object" && !Array.isArray(value)) out[key] = value;
|
|
4307
|
+
}
|
|
4308
|
+
return out;
|
|
4309
|
+
}
|
|
4289
4310
|
parseFieldDecoratorOptions(rawArgument) {
|
|
4290
4311
|
if (!rawArgument) return null;
|
|
4291
4312
|
const parsed = parseLiteralInitializer(rawArgument);
|
|
@@ -4665,7 +4686,7 @@ var OxcScanner = class {
|
|
|
4665
4686
|
/**
|
|
4666
4687
|
* Phase 1 — Discover and parse TypeScript files using OXC.
|
|
4667
4688
|
*
|
|
4668
|
-
* Uses `
|
|
4689
|
+
* Uses `tinyglobby` to enumerate matching files and then parses them in
|
|
4669
4690
|
* parallel with OXC (Rust). The raw class definitions are registered with
|
|
4670
4691
|
* the internal {@link InheritanceResolver} for use in the subsequent
|
|
4671
4692
|
* {@link resolve} call.
|
|
@@ -4835,7 +4856,7 @@ var OxcScanner = class {
|
|
|
4835
4856
|
};
|
|
4836
4857
|
}
|
|
4837
4858
|
/**
|
|
4838
|
-
* Discover files to scan using
|
|
4859
|
+
* Discover files to scan using tinyglobby.
|
|
4839
4860
|
*
|
|
4840
4861
|
* Two settings here decide whether discovery terminates at all when the
|
|
4841
4862
|
* scanner is pointed at an application root rather than a package `src/`:
|
|
@@ -4852,7 +4873,7 @@ var OxcScanner = class {
|
|
|
4852
4873
|
* Together they were enough to exhaust a 4 GB heap on a consumer app that
|
|
4853
4874
|
* installs the published packages (#2275).
|
|
4854
4875
|
*
|
|
4855
|
-
* Patterns are rewritten relative to `cwd` first.
|
|
4876
|
+
* Patterns are rewritten relative to `cwd` first. tinyglobby matches `ignore`
|
|
4856
4877
|
* in whatever space the patterns use, so an absolute pattern would hand
|
|
4857
4878
|
* `**\/.*\/**` the project's own ancestors — a checkout under `~/.worktrees`
|
|
4858
4879
|
* or `~/.cache` would then match nothing at all, silently.
|
|
@@ -5004,4 +5025,4 @@ var OxcScanner = class {
|
|
|
5004
5025
|
//#endregion
|
|
5005
5026
|
export { isPrunedAgentSurfacePath as C, sourceMayDeclareAgentSurface as E, isAgentSurfaceSourcePath as S, scanSvelteAgentSurface as T, normalizeGlobSeparators as _, extractSmrtImports as a, emptyAgentSurface as b, parseRecipeFile as c, extractRecipes as d, resolveRecipes as f, discoverSourceFiles as g, resolveEnumValues as h, defaultCollectionName as i, parseSource as l, InheritanceResolver as m, parseUiSelectorsFile as n, parseAgentSurfaceFile as o, sourceMayDeclareRecipe as p, ManifestAdapter as r, parseFile as s, OxcScanner as t, deriveHelpFieldRefs as u, relativeGlobToCwd as v, mergeAgentSurfaces as w, extractAgentSurface as x, checkAgentSurfaceToolNames as y };
|
|
5006
5027
|
|
|
5007
|
-
//# sourceMappingURL=scanner-
|
|
5028
|
+
//# sourceMappingURL=scanner-C1rTEfa8.js.map
|