feat(auto-commit-service): Add config options for local commit control and dry-run mode in the tray application

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-17 21:37:32 -07:00
parent 8db4afe869
commit 9325131db3

View file

@ -49,6 +49,9 @@ class CommitsTrayApp(rumps.App):
daemon_url: str = "http://localhost:8200",
repos_paths: list[Path] | None = None,
cycle_seconds: int = DEFAULT_CYCLE_SECONDS,
commit_local: bool = True,
dry_run: bool = False,
max_diff_bytes: int = 131072,
):
super().__init__(
name="Commits",
@ -58,6 +61,7 @@ class CommitsTrayApp(rumps.App):
self._daemon_url = daemon_url
self._repos_paths = repos_paths or [Path.home() / "Code"]
self._commit_local = commit_local
# Remote daemon client (for status + LLM health checks)
self.client = DaemonClient(base_url=daemon_url)
@ -67,6 +71,8 @@ class CommitsTrayApp(rumps.App):
acs_url=daemon_url,
repos_paths=self._repos_paths,
cycle_seconds=cycle_seconds,
dry_run=dry_run,
max_diff_bytes=max_diff_bytes,
)
# For local commit history display
@ -111,8 +117,11 @@ class CommitsTrayApp(rumps.App):
self._quit_item,
]
# Start the local agent
self.agent.start()
# Start the local agent only when explicitly enabled
if self._commit_local:
self.agent.start()
else:
logger.info("commit_local=False — tray in monitor-only mode, agent not started")
# Start polling
self._poll_timer = rumps.Timer(self._poll, POLL_INTERVAL)
@ -310,12 +319,28 @@ def run_tray(
daemon_url: str = "http://localhost:8200",
repos_paths: list[Path] | None = None,
cycle_seconds: int = DEFAULT_CYCLE_SECONDS,
commit_local: bool = True,
dry_run: bool = False,
max_diff_bytes: int = 131072,
) -> None:
"""Launch the menu bar application with local commit agent."""
"""Launch the menu bar application with local commit agent.
Args:
daemon_url: URL of the remote ACS daemon (for LLM message generation).
repos_paths: Base paths to scan for local git repos.
cycle_seconds: Seconds between commit cycles.
commit_local: If True (default), start the local commit agent on launch.
Pass False to run tray in monitor-only mode (no local commits).
dry_run: If True, scan and generate messages but skip git commit/push.
max_diff_bytes: Per-repo diff size cap before truncation.
"""
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(name)s %(message)s")
app = CommitsTrayApp(
daemon_url=daemon_url,
repos_paths=repos_paths,
cycle_seconds=cycle_seconds,
commit_local=commit_local,
dry_run=dry_run,
max_diff_bytes=max_diff_bytes,
)
app.run()