Skip to Content

AST scanner

function runASTScanner(rootDir: string, options?: RunAstScannerOptions): AstMethodResult[]

RunAstScannerOptions

FieldDescription
getAllTsFilesOptionsControls which directories/files are discovered (skips node_modules, dist, etc., by default).
compilerOptionsExtra options merged over the parsed tsconfig.json (or SDK defaults when no config exists).
filesWhen set, build the TypeScript program from only these files (tests / narrow scans).
expandParamTypesWhen true, expands object/union shapes in parameter type strings.
expandParamTypesOptionsTuning knobs (maxDepth, maxProps, maxUnion, maxLen).

Output

An array of scanner rows containing className, fnName, optional paramsFromAst, declaredReturnFromAst, and label/type tuples merged by mergeASTIntoRegistry.

Typical flow

  1. Host registers functions (@Cat, cat, …).
  2. runASTScanner reads sources.
  3. mergeASTIntoRegistry updates existing registry keys.

For the Socket.IO host path, attachCatRPC runs this orchestration internally when building the catalog (via scanRoots and nested bootstrap options). The standalone bootstrap helper is optional tooling with an embedded WebSocket.