Skip to content

refactor(codemode): split runtime into focused interpreter modules#36540

Merged
rekram1-node merged 2 commits into
v2from
codemode-runtime-split
Jul 12, 2026
Merged

refactor(codemode): split runtime into focused interpreter modules#36540
rekram1-node merged 2 commits into
v2from
codemode-runtime-split

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

What

Split src/interpreter/runtime.ts (3,840 lines, one ~2,900-line Interpreter class) into focused modules. runtime.ts is now 1,955 lines of the coupled tree-walk core.

Module Lines Contents
interpreter/runtime.ts 1,955 Statements, expressions, member access, call dispatch, function invocation
interpreter/methods.ts 819 String/Array/Map/Set/URLSearchParams method dispatch
interpreter/promises.ts 336 Promise lifecycle, combinators, chaining, and construction
interpreter/execute.ts 224 Execution shell, parsing, and output bounds
interpreter/references.ts 99 Runtime-reference classification and cycle rejection
interpreter/errors.ts 93 Error normalization and sandbox error values
interpreter/scope.ts 84 Scope stack
stdlib/console.ts 122 Pure console formatting

Cleanup

  • Inject narrow callback/runtime capabilities instead of passing the interpreter through extracted modules.
  • Remove blanket filesystem-path rewriting from safe tool errors and console logs; unknown host failures remain sanitized at the tool boundary.
  • Remove obsolete trimLeft, trimRight, and Annex B substr support.
  • Enable noUnusedLocals for the package.
  • Reduce source comments from roughly 500 lines to roughly 110, retaining public API JSDoc and non-obvious security, ordering, and mutation invariants.

Verification

  • Independent move-accounting, code-quality, cleanup, and semantic-diff reviews found no unintended regressions.
  • 782 CodeMode tests pass.
  • CodeMode typecheck and formatting pass.
  • Push hook passed all 31 repository package typechecks.

@rekram1-node rekram1-node merged commit 49cb73b into v2 Jul 12, 2026
10 checks passed
@rekram1-node rekram1-node deleted the codemode-runtime-split branch July 12, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant