Git Plugin — commit and push as a service #45

Open
opened 2026-02-20 17:23:59 +00:00 by doxios · 0 comments
Collaborator

Summary

A plugin providing git operations as a reusable service for other plugins.

Split from #3 (Logbot infrastructure).

Interface

class GitProvider(ABC):
    @abstractmethod
    def commit_and_push(self, paths: list[str], message: str) -> dict:
        """Commit paths and push.
        
        Returns:
            {"success": bool, "commit_hash": str, "error": str | None}
        """
        pass
    
    @abstractmethod
    def status(self) -> dict:
        """Get repository status.
        
        Returns:
            {"clean": bool, "changed": list[str], "branch": str}
        """
        pass

Configuration

git:
  repo_path: .           # Repository root
  auto_push: true        # Push after commit
  remote: origin         # Remote name
  branch: main           # Branch to push

Use Cases

  • Scheduled archive commits (via cron)
  • Memory backup
  • Workspace sync
  • Heartbeat: "commit workspace changes"

Integration with Cron

Requires #45 (cron direct mode) for:

cron:
  jobs:
    - name: commit-archive
      schedule: "0 */12 * * *"
      mode: direct
      action: git.commit_and_push
      args:
        paths: ["./archive"]
        message: "chore: archive sync"
  • #3 (original logbot issue)
  • #44 (archive plugin)
  • #45 (cron direct mode)
## Summary A plugin providing git operations as a reusable service for other plugins. Split from #3 (Logbot infrastructure). ## Interface ```python class GitProvider(ABC): @abstractmethod def commit_and_push(self, paths: list[str], message: str) -> dict: """Commit paths and push. Returns: {"success": bool, "commit_hash": str, "error": str | None} """ pass @abstractmethod def status(self) -> dict: """Get repository status. Returns: {"clean": bool, "changed": list[str], "branch": str} """ pass ``` ## Configuration ```yaml git: repo_path: . # Repository root auto_push: true # Push after commit remote: origin # Remote name branch: main # Branch to push ``` ## Use Cases - Scheduled archive commits (via cron) - Memory backup - Workspace sync - Heartbeat: "commit workspace changes" ## Integration with Cron Requires #45 (cron direct mode) for: ```yaml cron: jobs: - name: commit-archive schedule: "0 */12 * * *" mode: direct action: git.commit_and_push args: paths: ["./archive"] message: "chore: archive sync" ``` ## Related - #3 (original logbot issue) - #44 (archive plugin) - #45 (cron direct mode)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot#45
No description provided.