gmuse.cli.commit_session#

Interactive commit session orchestration.

Provides a small review loop for generated commit drafts with actions:

  • accept: create commit from draft

  • edit: open user’s editor with draft prefilled

  • regenerate: request a fresh draft from the generation function

  • abort: exit without committing

This module is intentionally minimal and testable: side effects (git commit / editor invocation) are delegated to gmuse.git helpers so they can be mocked in tests.

Module Contents#

Functions#

_exit_after_git_failure

Preserve git’s failure details without wrapping them in raw subprocess text.

run_commit_session

Run the commit review session.

API#

gmuse.cli.commit_session._exit_after_git_failure(error: subprocess.CalledProcessError) NoReturn#

Preserve git’s failure details without wrapping them in raw subprocess text.

gmuse.cli.commit_session.run_commit_session(config: dict, hint: Optional[str], context: gmuse.commit.GenerationContext, generate_fn: Callable[[dict, Optional[str], gmuse.commit.GenerationContext], gmuse.commit.GenerationResult], non_interactive: bool = False, edit_first: bool = False) None#

Run the commit review session.

Args: config: Resolved configuration dict. hint: Optional user hint passed to generator. context: Context object from gather_context. generate_fn: Callable returning a GenerationResult when called with (config, hint, context). non_interactive: If True, accept the generated message and commit immediately. edit_first: If True, open the editor with the generated draft immediately.