API reference
AST API
Parse, walk, extract and edit TypeScript and JSX.
21 modules, 134 documented exports. Version next. All packages.
packages/ast
- backendEffectsAST package: the effects and configuration reads of one Node module for `construct summarize --backend`: file-system, child-process, network and timer calls, `process.env` names, and the trivially detectable `if (url... Exports: collectEffects, collectEnvReads, collectHttpRoutes
- backendFactsAST package: the per-file facts `construct summarize --backend` is built from -- what one Node/Express module declares, imports, exports and registers. Exports: ROUTE_METHODS, collectBackendFacts, importEdgesOf, memberPath, unwrapExpression
- clientBoundaryAST package: the facts CLIENT-001 is built from -- a module's leading directive, the value edges it draws to other modules, and the non-public environment variables it reads. Exports: collectModuleEdges, collectSecretEnvReads, readModuleDirective
- domainPurityAST package: domain purity allowlist detection, additive alongside the existing DOMAIN-001 denylist in packages/core/architecture-enforcer.mjs. Exports: BUILTIN_GLOBALS, collectImpureDomainReferences, collectLocallyBoundNames
- extractAST package: extraction. Exports: extractExports, extractImports, extractJsdoc, lineOf, staticImportEntries
- importsAST package: inserting a brand-new top-level import statement -- the missing primitive the existing edit ops (jsxEdit.mjs) don't cover: every function there edits an EXISTING JSX node's text; this adds a whole new Imp... Exports: insertNamedImport
- jsxComplexityAST package: JSX shape/complexity detection. Exports: collectInlineJsxLogic, computeJsxComplexity
- jsxEditAST package: deterministic text edits on JSX nodes located by parseJsxTree. Exports: NEW_CHILD_SNIPPET, addChildText, insertStatementBeforeJsx, removeAttributeText, removeNodeText, renderAttrValue, setAttributeText, setSpreadText, ...
- jsxParseAST package: strict JSX parsing on typescript-estree (the JSX edit/analysis family, ). Exports: checkJsxReplacement, jsxParseError, parseJsx
- jsxScopeAST package: what a page component has in scope, and what a child component declares. Exports: collectComponentScopeNames, collectScopeDeclarations, declaredPropNames, findImportOfName, findTypeMembers
- jsxTreeAST package: the JSX element tree with stable node ids. Exports: findParentRecord, jsxAttributes, jsxNameToString, parseJsxTree
- lazyAST package: load the TypeScript compiler and the typescript-estree parser on first use, not at import. Exports: ts, estreeParse
- parseAST package: parsing. Exports: parseToAst, parseTsSource
- pureExportEquivalenceAST package: fast-check equivalence for pure exports touched by a staged edit. Exports: pureExportEquivalence
- semanticDiffAST package: behaviour-preserving verdict for a staged edit. Exports: SEMANTIC_DIFF_OPERATIONS, SEMANTIC_DIFF_VERDICTS, semanticDiff
- stalenessAST package: the three "stale input" shapes of story (docs/staleness-by-layer.md), one collector each, all deterministic and narrow (a heuristic, not a data-flow analysis): - CONTROLLER-003: `collectControllerStateCal... Exports: CONTROLLER_STATE_HOOKS, collectControllerStateCalls, collectParamsReads, collectUncleanedSubscriptions
- stateShapeAST package: "bag of flags" state-shape detection -- the shape STATE-001 flags in workflow and hook files: state typed (or initialised) as one object whose fields are several co-occurring status-style booleans (`loadi... Exports: classifyStateFields, collectBagOfFlagsStates
- tsNodesAST package: TypeScript compiler API helpers -- searching a ts.SourceFile and printing `ts.factory` nodes back to source. Exports: findAllNodes, findNode, printNode, ts
- typedBoundaryAST package: typed-boundary detection for TYPE-002 (LIN-148 ask ). Exports: collectUntypedExportedBoundaries
- walkAST package: traversal. Exports: CONTROL_FLOW_TYPES, collectBareIdentifierUsages, collectCalls, collectControlFlowNodes, isNonUsagePosition, walkForUsage