ansible port: git role (remote-sync + github<->forgejo mirror-drift) #209

Closed
opened 2026-06-04 07:49:09 +00:00 by coilysiren · 0 comments
Owner

Part of the up-to-date.py -> ansible port. Serial chain step 1 of 4. Dispatch in order; this one first.

Context

  • Converger lives in infrastructure/ansible: playbooks/freshen.yml runs roles homebrew, agent-compose, repos. Run via coily ansible-freshen (check) / action=apply.
  • The repos role + library/repo_registry.py (discovery) already landed (#208). Read them for the pattern: a read-only custom module under ansible/library/ (shebang #!/usr/bin/python, found via library = library in ansible.cfg) plus a role that loops.
  • Legacy source to port: agentic-os-kai/scripts/up-to-date.py, the git step (step 6) and helpers sync_repo, ensure_remote_topology, remote_branch, in_progress_op, stale_branches, worktrees.

Task

Add a git role (+ library/repo_status.py if a module is cleaner than tasks) that, per local repo across the repos_known_orgs dirs:

  • git fetch --all --prune, report ahead/behind vs each remote, uncommitted/untracked, in-progress op, detached HEAD, worktrees, stash, stale unmerged branches.
  • pull --ff-only from each remote (apply mode only; check mode reports).
  • github<->forgejo mirror-drift: compare the HEAD sha across the github and forgejo remotes and flag divergence. No force, no push - drift is reported, never resolved (matches up-to-date.py).
    Wire into freshen.yml with tag git, after repos.

Acceptance

  • coily exec ansible-freshen (check) runs the role clean; --tags git scopes it.
  • pre-commit passes (pylint "matches the CI lint job" is strict: f-strings, dict-literals, <=5 boolean exprs).
  • docs/ansible.md + FEATURES.md + ansible/README updated.
  • Commit closes this issue.
Part of the up-to-date.py -> ansible port. **Serial chain step 1 of 4.** Dispatch in order; this one first. ## Context - Converger lives in `infrastructure/ansible`: `playbooks/freshen.yml` runs roles `homebrew`, `agent-compose`, `repos`. Run via `coily ansible-freshen` (check) / `action=apply`. - The `repos` role + `library/repo_registry.py` (discovery) already landed (#208). Read them for the pattern: a read-only custom module under `ansible/library/` (shebang `#!/usr/bin/python`, found via `library = library` in ansible.cfg) plus a role that loops. - Legacy source to port: `agentic-os-kai/scripts/up-to-date.py`, the **git step (step 6)** and helpers `sync_repo`, `ensure_remote_topology`, `remote_branch`, `in_progress_op`, `stale_branches`, `worktrees`. ## Task Add a `git` role (+ `library/repo_status.py` if a module is cleaner than tasks) that, per local repo across the `repos_known_orgs` dirs: - `git fetch --all --prune`, report ahead/behind vs each remote, uncommitted/untracked, in-progress op, detached HEAD, worktrees, stash, stale unmerged branches. - `pull --ff-only` from each remote (apply mode only; check mode reports). - **github<->forgejo mirror-drift**: compare the HEAD sha across the github and forgejo remotes and flag divergence. No force, no push - drift is reported, never resolved (matches up-to-date.py). Wire into `freshen.yml` with tag `git`, after `repos`. ## Acceptance - `coily exec ansible-freshen` (check) runs the role clean; `--tags git` scopes it. - pre-commit passes (pylint "matches the CI lint job" is strict: f-strings, dict-literals, <=5 boolean exprs). - docs/ansible.md + FEATURES.md + ansible/README updated. - Commit closes this issue.
Sign in to join this conversation.
No description provided.