From 0b023482d7c69704200807c938437c16f3d4be39 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sat, 6 Jun 2026 16:45:07 +0545 Subject: [PATCH] feat(devgen/cli): introduce --max-groups and --max-diff-size options for commit command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add limits to prevent token‑limit errors during commit generation. - New `--max-groups` option to cap the number of commit groups. - New `--max-diff-size` option to set maximum diff size per group (default 8000 chars). Update logging to reflect the new options and pass them to the engine. --- devgen/cli/commit.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/devgen/cli/commit.py b/devgen/cli/commit.py index e1c1324..d9b455e 100644 --- a/devgen/cli/commit.py +++ b/devgen/cli/commit.py @@ -58,12 +58,28 @@ def run_commit( help="Review/edit commit message before committing.", ), ] = False, + max_groups: Annotated[ + int | None, + typer.Option( + "--max-groups", + help="Maximum number of commit groups. Lower this if you hit token-limit errors.", + ), + ] = None, + max_diff_size: Annotated[ + int | None, + typer.Option( + "--max-diff-size", + help="Maximum diff size in chars per group (default 8000). " + "Lower this if you hit token-limit errors.", + ), + ] = None, ) -> None: log_file = get_main_log_path() logger = configure_logger("devgen.cli.commit", log_file, console=debug) logger.info(f"Log file: {log_file}") logger.info( - f"Options: dry_run={dry_run}, push={push}, debug={debug}, force={force_rebuild}, check={check}" + f"Options: dry_run={dry_run}, push={push}, debug={debug}, force={force_rebuild}, " + f"check={check}, max_groups={max_groups}, max_diff_size={max_diff_size}" ) run_commit_engine( @@ -73,6 +89,8 @@ def run_commit( force_rebuild=force_rebuild, check=check, logger=logger, + max_groups=max_groups, + max_diff_size=max_diff_size, )