orchestrata_ultimate.refactor.codemod
Reference › orchestrata_ultimate › refactor › codemod
SPEC-110: In-Memory Code Intelligence Platform
The codemod package is the SPEC-110 engine: it loads a repository's Python files into memory, builds a graph of their relationships, applies byte-exact transformations, reviews the result and only then writes it to disk. scripts/codemod.py is the command-line entry and the facade re-exports the main classes. The refactor package narrative records the design and review history packet by packet.
Parts, by role:
- Core: workspace (
load,run,commit), passes (the transforms), txn (atomic write and rollback), report and _types. Source text is handled by the ctok lossless layer. - Graph: _cig, _cig_builder_ast, _csr_index, _parse_cache and _fast_fallback.
- Analysis and review: the analysis subpackage (read-only questions), and the commit-time review in review, review_catalogue, review_checks, review_context and review_engine.
- Daemon: daemon (lifecycle), _daemon_entry, server, client and watcher.
- Observability and persistence: the observability and persistence subpackages.
Control flow: a caller loads a workspace, runs passes (each sees the previous pass's changes), then commits; the commit runs the review engine, writes atomically and rolls back on failure, emitting events throughout. With the daemon, the same steps happen over a socket against a workspace kept warm in memory. Start with workspace.
41 modules, 11,382 lines of code.
Subpackages
| Package | Modules | LOC |
|---|---|---|
analysis |
11 | 967 |
observability |
7 | 732 |
persistence |
2 | 311 |
Modules
| Module | Summary | LOC |
|---|---|---|
__init__ |
SPEC-110: In-Memory Code Intelligence Platform | 74 |
_cig |
Code Intelligence Graph with multihop traversal queries. | 504 |
_cig_builder_ast |
AST-based Code Intelligence Graph extraction — the sole CIG backend. | 838 |
_csr_index |
Compressed Sparse Row (CSR) adjacency arrays for O(1) graph queries. | 94 |
_daemon_entry |
SPEC-110 codemod daemon entry point. | 174 |
_fast_fallback |
Pure-Python fallbacks for codemod_fast C extension functions. | 151 |
_parse_cache |
Content-addressed disk cache for parsed LosslessModules. | 105 |
_types |
Concrete data types for the Code Intelligence Graph and codemod engine. | 203 |
client |
SPEC-110 codemod engine — JSON-RPC 2.0 client for the codemod daemon. | 359 |
daemon |
SPEC-110 codemod engine — daemon lifecycle management. | 578 |
passes |
SPEC-110 codemod engine — built-in transform passes. | 1051 |
report |
SPEC-110 codemod engine — report data structures. | 181 |
review |
SPEC-110 codemod engine — review passes. | 524 |
review_catalogue |
SPEC-110 FR-012 -- the 40-check review catalogue. | 430 |
review_checks |
SPEC-110 FR-012 -- the review check implementations. | 1039 |
review_context |
SPEC-110 FR-012 -- the review-context leaf module. | 84 |
review_engine |
SPEC-110 FR-012 -- the in-memory review engine. | 521 |
server |
SPEC-110 codemod engine — Unix socket JSON-RPC 2.0 server. | 866 |
txn |
Transactional write-back with atomic commits and rollback. | 472 |
watcher |
SPEC-110 codemod engine — inotify file watcher for incremental reload. | 258 |
workspace |
CodemodWorkspace: Main entry point for loading and transforming code. | 866 |