@happyvertical/smrt-scanner 0.45.3 → 0.47.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/AGENTS.md +15 -0
- package/dist/chunks/{scanner-C3VqXyzB.js → scanner-9p-PUN-X.js} +143 -23
- package/dist/chunks/scanner-9p-PUN-X.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +92 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +58 -0
- package/package.json +1 -1
- package/dist/chunks/scanner-C3VqXyzB.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as ManifestAdapter, t as OxcScanner } from "./chunks/scanner-
|
|
2
|
+
import { n as ManifestAdapter, t as OxcScanner } from "./chunks/scanner-9p-PUN-X.js";
|
|
3
3
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
package/dist/index.d.ts
CHANGED
|
@@ -863,11 +863,19 @@ declare interface MethodDefinition {
|
|
|
863
863
|
type: string;
|
|
864
864
|
optional: boolean;
|
|
865
865
|
default?: unknown;
|
|
866
|
+
/** See `RawParameterDefinition.typeUnresolved` (#2686). */
|
|
867
|
+
typeUnresolved?: boolean;
|
|
868
|
+
/** See `RawParameterDefinition.memberTypes` (#2686). */
|
|
869
|
+
memberTypes?: string[];
|
|
870
|
+
/** See `RawParameterDefinition.unionBranches` (#2686). */
|
|
871
|
+
unionBranches?: ParameterTypeBranch[];
|
|
866
872
|
}>;
|
|
867
873
|
returnType: string;
|
|
868
874
|
description?: string;
|
|
869
875
|
isStatic: boolean;
|
|
870
876
|
isPublic: boolean;
|
|
877
|
+
/** Config of an `@method()` decorator on this method (#2686). */
|
|
878
|
+
decoratorConfig?: Record<string, unknown>;
|
|
871
879
|
}
|
|
872
880
|
|
|
873
881
|
declare interface MethodDefinition_2 extends BaseNode {
|
|
@@ -878,6 +886,7 @@ declare interface MethodDefinition_2 extends BaseNode {
|
|
|
878
886
|
computed: boolean;
|
|
879
887
|
static: boolean;
|
|
880
888
|
accessibility?: 'public' | 'private' | 'protected';
|
|
889
|
+
decorators?: Decorator[];
|
|
881
890
|
}
|
|
882
891
|
|
|
883
892
|
declare interface NewExpression extends BaseNode {
|
|
@@ -1218,6 +1227,14 @@ export declare interface OxcScannerOptions {
|
|
|
1218
1227
|
agentSurfaceInclude?: string[];
|
|
1219
1228
|
}
|
|
1220
1229
|
|
|
1230
|
+
/** One branch of a top-level union parameter type (#2686). */
|
|
1231
|
+
export declare interface ParameterTypeBranch {
|
|
1232
|
+
/** The branch's own type name, e.g. `string` or `object`. */
|
|
1233
|
+
type: string;
|
|
1234
|
+
/** Inline object members declared by THIS branch only. */
|
|
1235
|
+
memberTypes?: string[];
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1221
1238
|
/**
|
|
1222
1239
|
* Read one file for agent-surface declarations ONLY (#2591).
|
|
1223
1240
|
*
|
|
@@ -1456,6 +1473,17 @@ export declare interface RawMethodDefinition {
|
|
|
1456
1473
|
returnType: string | null;
|
|
1457
1474
|
/** JSDoc description if present */
|
|
1458
1475
|
description: string | null;
|
|
1476
|
+
/**
|
|
1477
|
+
* Config object of an `@method()` decorator on this method, when one is
|
|
1478
|
+
* present. `{}` for a bare `@method()`; `undefined` when the method carries
|
|
1479
|
+
* no `@method()` decorator at all — the two are distinct, because an
|
|
1480
|
+
* explicit bare decorator still marks the method as deliberately reviewed.
|
|
1481
|
+
*
|
|
1482
|
+
* Values are extracted with the same literal-only rules the class-level
|
|
1483
|
+
* `@smrt()` config uses, so an expression the scanner cannot resolve becomes
|
|
1484
|
+
* a scan error rather than a silently dropped `expose: false`.
|
|
1485
|
+
*/
|
|
1486
|
+
decoratorConfig?: Record<string, unknown>;
|
|
1459
1487
|
/** Start line in source */
|
|
1460
1488
|
line: number;
|
|
1461
1489
|
}
|
|
@@ -1472,6 +1500,45 @@ export declare interface RawParameterDefinition {
|
|
|
1472
1500
|
optional: boolean;
|
|
1473
1501
|
/** Default value as string */
|
|
1474
1502
|
defaultValue: string | null;
|
|
1503
|
+
/**
|
|
1504
|
+
* True when the parameter carries a type annotation the scanner could not
|
|
1505
|
+
* express as a string — an intersection, tuple, conditional, mapped,
|
|
1506
|
+
* `typeof`, or indexed-access type — or when an inline object literal
|
|
1507
|
+
* contains such a member.
|
|
1508
|
+
*
|
|
1509
|
+
* This is the provenance that separates "the author wrote `any`" from "the
|
|
1510
|
+
* scanner gave up": both previously reached the manifest as the string
|
|
1511
|
+
* `'any'`. Consumers that must fail closed on an uncertain type (the API
|
|
1512
|
+
* wire-ability gate) read this rather than trusting `type`.
|
|
1513
|
+
*
|
|
1514
|
+
* `type: null` with `typeUnresolved` absent means the parameter simply has
|
|
1515
|
+
* no annotation, which is an implicit — and genuinely authored — `any`.
|
|
1516
|
+
*/
|
|
1517
|
+
typeUnresolved?: boolean;
|
|
1518
|
+
/**
|
|
1519
|
+
* Resolved member types of an INLINE object-literal annotation
|
|
1520
|
+
* (`{ onDone: () => void; target: Content }` → `['Function', 'Content']`),
|
|
1521
|
+
* flattened across nested literals, arrays, and unions.
|
|
1522
|
+
*
|
|
1523
|
+
* `extractTypeName` collapses every inline literal to the single string
|
|
1524
|
+
* `'object'`, which erases exactly the members a caller needs to judge
|
|
1525
|
+
* whether the bag can cross a wire. NAMED bags (an interface, type alias,
|
|
1526
|
+
* `Partial<>`/`Pick<>`) are deliberately NOT expanded — resolving them needs
|
|
1527
|
+
* cross-file type resolution this AST layer does not do, and they are
|
|
1528
|
+
* accepted heuristically by the consumers that care.
|
|
1529
|
+
*/
|
|
1530
|
+
memberTypes?: string[];
|
|
1531
|
+
/**
|
|
1532
|
+
* For a top-level UNION, each branch with the inline members IT declared.
|
|
1533
|
+
*
|
|
1534
|
+
* `memberTypes` above flattens across branches, which lets one branch veto
|
|
1535
|
+
* another: `{ callback: () => void } | string` is wire-able through its
|
|
1536
|
+
* string branch, but the flattened `Function` rejected the whole parameter.
|
|
1537
|
+
* A consumer that understands this field MUST prefer it over `memberTypes`
|
|
1538
|
+
* for unions. Absent on a non-union parameter and on manifests generated
|
|
1539
|
+
* before #2686.
|
|
1540
|
+
*/
|
|
1541
|
+
unionBranches?: ParameterTypeBranch[];
|
|
1475
1542
|
}
|
|
1476
1543
|
|
|
1477
1544
|
/** Preserve relative glob escapes; normalize separators only after rewriting. */
|
|
@@ -1659,6 +1726,10 @@ declare interface TSArrayType extends BaseNode {
|
|
|
1659
1726
|
elementType: TSType;
|
|
1660
1727
|
}
|
|
1661
1728
|
|
|
1729
|
+
declare interface TSBigIntKeyword extends BaseNode {
|
|
1730
|
+
type: 'TSBigIntKeyword';
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1662
1733
|
declare interface TSBooleanKeyword extends BaseNode {
|
|
1663
1734
|
type: 'TSBooleanKeyword';
|
|
1664
1735
|
}
|
|
@@ -1702,6 +1773,10 @@ declare interface TSMethodSignature extends BaseNode {
|
|
|
1702
1773
|
returnType?: TSTypeAnnotation;
|
|
1703
1774
|
}
|
|
1704
1775
|
|
|
1776
|
+
declare interface TSNeverKeyword extends BaseNode {
|
|
1777
|
+
type: 'TSNeverKeyword';
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1705
1780
|
declare interface TSNullKeyword extends BaseNode {
|
|
1706
1781
|
type: 'TSNullKeyword';
|
|
1707
1782
|
}
|
|
@@ -1710,6 +1785,10 @@ declare interface TSNumberKeyword extends BaseNode {
|
|
|
1710
1785
|
type: 'TSNumberKeyword';
|
|
1711
1786
|
}
|
|
1712
1787
|
|
|
1788
|
+
declare interface TSObjectKeyword extends BaseNode {
|
|
1789
|
+
type: 'TSObjectKeyword';
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1713
1792
|
declare interface TSPropertySignature extends BaseNode {
|
|
1714
1793
|
type: 'TSPropertySignature';
|
|
1715
1794
|
key: Expression;
|
|
@@ -1728,7 +1807,15 @@ declare interface TSStringKeyword extends BaseNode {
|
|
|
1728
1807
|
type: 'TSStringKeyword';
|
|
1729
1808
|
}
|
|
1730
1809
|
|
|
1731
|
-
declare
|
|
1810
|
+
declare interface TSSymbolKeyword extends BaseNode {
|
|
1811
|
+
type: 'TSSymbolKeyword';
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
declare interface TSThisType extends BaseNode {
|
|
1815
|
+
type: 'TSThisType';
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
declare type TSType = TSStringKeyword | TSNumberKeyword | TSBooleanKeyword | TSAnyKeyword | TSUnknownKeyword | TSNeverKeyword | TSObjectKeyword | TSBigIntKeyword | TSSymbolKeyword | TSVoidKeyword | TSNullKeyword | TSUndefinedKeyword | TSThisType | TSTypeReference | TSArrayType | TSUnionType | TSTypeLiteral | TSLiteralType | TSFunctionType;
|
|
1732
1819
|
|
|
1733
1820
|
declare interface TSTypeAliasDeclaration extends BaseNode {
|
|
1734
1821
|
type: 'TSTypeAliasDeclaration';
|
|
@@ -1769,6 +1856,10 @@ declare interface TSUnionType extends BaseNode {
|
|
|
1769
1856
|
types: TSType[];
|
|
1770
1857
|
}
|
|
1771
1858
|
|
|
1859
|
+
declare interface TSUnknownKeyword extends BaseNode {
|
|
1860
|
+
type: 'TSUnknownKeyword';
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1772
1863
|
declare interface TSVoidKeyword extends BaseNode {
|
|
1773
1864
|
type: 'TSVoidKeyword';
|
|
1774
1865
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as sourceMayDeclareAgentSurface, a as parseFile, c as discoverSourceFiles, d as emptyAgentSurface, f as extractAgentSurface, g as scanSvelteAgentSurface, h as mergeAgentSurfaces, i as parseAgentSurfaceFile, l as normalizeGlobSeparators, m as isPrunedAgentSurfacePath, n as ManifestAdapter, o as parseSource, p as isAgentSurfaceSourcePath, r as extractSmrtImports, s as InheritanceResolver, t as OxcScanner, u as relativeGlobToCwd } from "./chunks/scanner-
|
|
1
|
+
import { _ as sourceMayDeclareAgentSurface, a as parseFile, c as discoverSourceFiles, d as emptyAgentSurface, f as extractAgentSurface, g as scanSvelteAgentSurface, h as mergeAgentSurfaces, i as parseAgentSurfaceFile, l as normalizeGlobSeparators, m as isPrunedAgentSurfacePath, n as ManifestAdapter, o as parseSource, p as isAgentSurfaceSourcePath, r as extractSmrtImports, s as InheritanceResolver, t as OxcScanner, u as relativeGlobToCwd } from "./chunks/scanner-9p-PUN-X.js";
|
|
2
2
|
import "./types.js";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { basename, resolve } from "node:path";
|
package/dist/types.d.ts
CHANGED
|
@@ -250,6 +250,14 @@ export declare interface OxcScannerOptions {
|
|
|
250
250
|
agentSurfaceInclude?: string[];
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
/** One branch of a top-level union parameter type (#2686). */
|
|
254
|
+
export declare interface ParameterTypeBranch {
|
|
255
|
+
/** The branch's own type name, e.g. `string` or `object`. */
|
|
256
|
+
type: string;
|
|
257
|
+
/** Inline object members declared by THIS branch only. */
|
|
258
|
+
memberTypes?: string[];
|
|
259
|
+
}
|
|
260
|
+
|
|
253
261
|
/**
|
|
254
262
|
* Type definitions for OXC-based SMRT scanner
|
|
255
263
|
*
|
|
@@ -377,6 +385,17 @@ export declare interface RawMethodDefinition {
|
|
|
377
385
|
returnType: string | null;
|
|
378
386
|
/** JSDoc description if present */
|
|
379
387
|
description: string | null;
|
|
388
|
+
/**
|
|
389
|
+
* Config object of an `@method()` decorator on this method, when one is
|
|
390
|
+
* present. `{}` for a bare `@method()`; `undefined` when the method carries
|
|
391
|
+
* no `@method()` decorator at all — the two are distinct, because an
|
|
392
|
+
* explicit bare decorator still marks the method as deliberately reviewed.
|
|
393
|
+
*
|
|
394
|
+
* Values are extracted with the same literal-only rules the class-level
|
|
395
|
+
* `@smrt()` config uses, so an expression the scanner cannot resolve becomes
|
|
396
|
+
* a scan error rather than a silently dropped `expose: false`.
|
|
397
|
+
*/
|
|
398
|
+
decoratorConfig?: Record<string, unknown>;
|
|
380
399
|
/** Start line in source */
|
|
381
400
|
line: number;
|
|
382
401
|
}
|
|
@@ -393,6 +412,45 @@ export declare interface RawParameterDefinition {
|
|
|
393
412
|
optional: boolean;
|
|
394
413
|
/** Default value as string */
|
|
395
414
|
defaultValue: string | null;
|
|
415
|
+
/**
|
|
416
|
+
* True when the parameter carries a type annotation the scanner could not
|
|
417
|
+
* express as a string — an intersection, tuple, conditional, mapped,
|
|
418
|
+
* `typeof`, or indexed-access type — or when an inline object literal
|
|
419
|
+
* contains such a member.
|
|
420
|
+
*
|
|
421
|
+
* This is the provenance that separates "the author wrote `any`" from "the
|
|
422
|
+
* scanner gave up": both previously reached the manifest as the string
|
|
423
|
+
* `'any'`. Consumers that must fail closed on an uncertain type (the API
|
|
424
|
+
* wire-ability gate) read this rather than trusting `type`.
|
|
425
|
+
*
|
|
426
|
+
* `type: null` with `typeUnresolved` absent means the parameter simply has
|
|
427
|
+
* no annotation, which is an implicit — and genuinely authored — `any`.
|
|
428
|
+
*/
|
|
429
|
+
typeUnresolved?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Resolved member types of an INLINE object-literal annotation
|
|
432
|
+
* (`{ onDone: () => void; target: Content }` → `['Function', 'Content']`),
|
|
433
|
+
* flattened across nested literals, arrays, and unions.
|
|
434
|
+
*
|
|
435
|
+
* `extractTypeName` collapses every inline literal to the single string
|
|
436
|
+
* `'object'`, which erases exactly the members a caller needs to judge
|
|
437
|
+
* whether the bag can cross a wire. NAMED bags (an interface, type alias,
|
|
438
|
+
* `Partial<>`/`Pick<>`) are deliberately NOT expanded — resolving them needs
|
|
439
|
+
* cross-file type resolution this AST layer does not do, and they are
|
|
440
|
+
* accepted heuristically by the consumers that care.
|
|
441
|
+
*/
|
|
442
|
+
memberTypes?: string[];
|
|
443
|
+
/**
|
|
444
|
+
* For a top-level UNION, each branch with the inline members IT declared.
|
|
445
|
+
*
|
|
446
|
+
* `memberTypes` above flattens across branches, which lets one branch veto
|
|
447
|
+
* another: `{ callback: () => void } | string` is wire-able through its
|
|
448
|
+
* string branch, but the flattened `Function` rejected the whole parameter.
|
|
449
|
+
* A consumer that understands this field MUST prefer it over `memberTypes`
|
|
450
|
+
* for unions. Absent on a non-union parameter and on manifests generated
|
|
451
|
+
* before #2686.
|
|
452
|
+
*/
|
|
453
|
+
unionBranches?: ParameterTypeBranch[];
|
|
396
454
|
}
|
|
397
455
|
|
|
398
456
|
/**
|