Skip to content

refactor: split CLI into modular package#133

Open
ElRobaMichis wants to merge 2 commits into
zigcBenx:masterfrom
ElRobaMichis:refactor/modular-cli-architecture
Open

refactor: split CLI into modular package#133
ElRobaMichis wants to merge 2 commits into
zigcBenx:masterfrom
ElRobaMichis:refactor/modular-cli-architecture

Conversation

@ElRobaMichis
Copy link
Copy Markdown

@ElRobaMichis ElRobaMichis commented May 12, 2026

Summary

Closes #116.

This refactors the monolithic gitHappens.py script into a focused githappens package while keeping the original entry point as a compatibility wrapper.

  • moved argument parsing and command routing into githappens/main.py
  • moved configuration loading into githappens/config.py
  • extracted GitLab API and glab interactions into githappens/gitlab_api.py
  • split git helpers, template lookup, prompts, and command workflows into dedicated modules
  • added command-specific handlers under githappens/commands/, including create_issue.py, review.py, deploy.py, and open_mr.py
  • added unit coverage for config loading, CLI parsing, command workflows, GitLab command construction, git helpers, prompt selection helpers, and templates
  • documented the new project structure and test command in the README

Acceptance criteria mapping

  • gitlab_api.py: GitLab API calls and glab command construction
  • config.py: config.ini and templates.json loading into a typed app context
  • templates.py: issue template lookup behavior
  • commands/: separate modules for issue creation, review, deploy, MR opening, reporting, and summaries
  • existing entry point: gitHappens.py still works as the CLI wrapper
  • tests: 18 unit tests across helper modules and command workflows
  • README: new project structure and development test command documented

Validation

  • python -B -m unittest discover -> 18 tests passing
  • python -B gitHappens.py --help
  • git diff --cached --check before commit

Prepared with AI assistance and manually validated before submission.

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.

Refactor monolithic gitHappens.py into modular architecture

1 participant