Skip to content

refactor: split 5 large files into smaller modules#141

Merged
ako merged 7 commits intomendixlabs:mainfrom
engalar:refactor/split-large-files
Apr 9, 2026
Merged

refactor: split 5 large files into smaller modules#141
ako merged 7 commits intomendixlabs:mainfrom
engalar:refactor/split-large-files

Conversation

@engalar
Copy link
Copy Markdown
Contributor

@engalar engalar commented Apr 8, 2026

Summary

  • Split 5 highest-churn files (800-1500 lines each) into smaller, focused files
  • Pure file reorganization — no logic changes, no API changes
  • All files stay within their original packages

Files split

Original file Lines Split into
mdl/executor/executor.go 903 executor.go, executor_dispatch.go, executor_query.go, executor_connect.go
cmd/mxcli/tui/app.go 1475 app.go, app_update.go, app_keys.go, app_view.go
mdl/executor/widget_engine.go 1165 widget_engine.go, widget_operations.go, widget_defaults.go, widget_templates.go
mdl/executor/cmd_entities.go 1505 cmd_entities.go, cmd_entities_describe.go, cmd_entities_access.go
cmd/mxcli/init.go 1267 init.go, init_claudemd.go, init_vscode.go

18 files changed, 3833 insertions(+), 3718 deletions(-)

Test plan

  • make build passes
  • make test passes
  • Verify no import cycles introduced
  • Spot-check that function signatures are unchanged

engalar added 6 commits April 8, 2026 21:32
- executor.go: core types, lifecycle, cache tracking
- executor_dispatch.go: statement routing (executeInner switch)
- executor_query.go: query dispatchers (execShow, execDescribe)
- executor_connect.go: connection management (connect, reconnect, disconnect, status)
- init.go: command definition, global vars, findMprFile(), init()
- init_claudemd.go: generateClaudeMD(), yamlSingleQuote(), wrapSkillContent(), extractSkillDescription()
- init_vscode.go: installVSCodeExtension(), findCodeCLI()
- app.go: core types, NewApp, watcher/agent setup, tab management, Init, session restore
- app_update.go: Update() message dispatcher
- app_keys.go: handleBrowserAppKeys(), dispatchPaletteKey()
- app_view.go: View(), rendering helpers, agent state/change parsing, BSON helpers
- cmd_entities.go: CRUD operations (create, alter, drop)
- cmd_entities_describe.go: display and describe (show, describe, microflow resolution)
- cmd_entities_access.go: access control (GRANT output, member access resolution)
Copy link
Copy Markdown
Collaborator

@ako ako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pure file reorganization — verified no logic changes. The 5 modified files only have deletions (plus 2 added section-header comments). The +115 line surplus is file headers on 13 new files.

Splits are sensible:

  • executor.go → dispatch, query, connect (clear separation of concerns)
  • tui/app.go → update, keys, view (MVC-ish split)
  • widget_engine.go → operations, defaults, templates (by responsibility)
  • cmd_entities.go → describe, access (by command type)
  • init.go → claudemd, vscode (by output target)

LGTM.

…e-files

# Conflicts:
#	mdl/executor/cmd_entities.go
#	mdl/executor/executor.go
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

AI Code Review

What Looks Good

This PR is a pure file reorganization effort that splits 5 large files into smaller, focused modules without changing any logic or APIs. The changes are clean and follow good software engineering practices:

  • Clear separation of concerns: Each split file has a specific responsibility (e.g., executor_dispatch.go for dispatch logic, app_keys.go for keyboard handling)
  • Logical grouping: Related functions are kept together (query operations in executor_query.go, connection handling in executor_connect.go)
  • Package integrity: All files remain within their original packages as stated
  • Test compliance: make build and make test both pass as reported
  • No behavior changes: The PR explicitly states there are no logic or API changes

The CLAUDE.md generation code was appropriately moved from init.go to a new init_claudemd.go file, which improves maintainability since this is a distinct responsibility from the CLI initialization logic.

Recommendation

Approve the PR. This is a valuable refactoring that improves code readability and maintainability without introducing any functional changes. The two unchecked items in the test plan (import cycles and function signature verification) are low-risk for this type of reorganization, but the reviewer should still verify them if possible before merging. Given that all files stay in their original packages and no imports were added/removed, import cycles are unlikely to have been introduced.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

@ako ako merged commit 0cf649f into mendixlabs:main Apr 9, 2026
1 of 2 checks passed
@github-actions github-actions bot mentioned this pull request Apr 9, 2026
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.

2 participants