orchestrata_ast
Reference › orchestrata_ast
orchestrata_ast — the canonical code-AST generation component.
orchestrata_ast is the standard-library-only component that turns a Python source tree into the serialized code AST: modules, classes, functions, imports, inheritance and dependency graphs, located environment reads and spawn-site program names. Orchestrata's code intelligence reads this snapshot, including the gate fact extractor and the knowledge-graph live sync, and the orchestrata_tools library reads it through its JSON loader. The package is deployed to /opt/orchestrata-tools/lib/orchestrata_ast. The ast launcher in /opt/orchestrata-tools/bin runs the serializer script, which imports it.
Parts, by role:
- Data model: models defines the dataclasses and serialize turns them into dictionaries.
- Producer: analyzer parses files into the model and computes the derived graphs. It also offers a warm-start cache and subtree projection.
- Root set: roots parses the declared root list from
ORCHESTRATA_AST_ROOTS, and scope narrows a wide snapshot to its primary tree. - Queries: inheritance answers ancestor and subclass questions.
Data flow: roots yields the trees, the analyzer parses each file into ModuleInfo records, derived graphs are computed, serialize produces JSON, and consumers load it back. Start reading at models, then analyzer. The related query layer is described in the tools package narrative.
7 modules, 2,258 lines of code.
Modules
| Module | Summary | LOC |
|---|---|---|
__init__ |
orchestrata_ast — the canonical code-AST generation component. | 35 |
analyzer |
Source-tree -> CodebaseAST analyzer — stdlib-only. | 1655 |
inheritance |
Inheritance queries over the AST's own inheritance_graph — stdlib-only. |
118 |
models |
Data model for the serialized code AST — stdlib-only. | 286 |
roots |
The ONE reader of the declared AST root set. | 73 |
scope |
Narrowing a wide snapshot back to the production package. | 75 |
serialize |
Dataclass-tree -> dict serialization for the code AST — stdlib-only. | 16 |