feat(services): load service plugins from git repos

Allow directories.services entries to be git repo specs (URL/owner-repo/ @branch) alongside local paths: clone + TTL-pull as cache, list-order priority with a duplicate-ignored summary, a refresh-services command that force-syncs and reports the per-service diff, and a dirty-clone guard that protects local edits on the automated path. Adds binaries.Git and a redact_paths config toggle.
This commit is contained in:
imSp4rky
2026-06-24 08:59:03 -06:00
parent 6294566823
commit 66638ead6b
11 changed files with 704 additions and 12 deletions
+28
View File
@@ -19,6 +19,34 @@ def util() -> None:
"""Various helper scripts and programs."""
@util.command(name="refresh-services")
def refresh_services() -> None:
"""Force a refresh (git pull) of all service repos configured in directories.services."""
from unshackle.core.config import config
from unshackle.core.service_repo import is_repo_spec, refresh_repo
from unshackle.core.utils.redact import redact_path
entries = config.directories.services
if not isinstance(entries, list):
entries = [entries]
specs = [e for e in entries if isinstance(e, str) and is_repo_spec(e)]
if not specs:
click.echo("No service repos configured in directories.services.")
return
# manual refresh force-overwrites local changes (hard reset to upstream), then reports the diff
for spec in specs:
dest, changes = refresh_repo(spec)
if not dest:
click.echo(f"Failed to update {spec} (see log).")
continue
if changes:
click.echo(f"Updated {spec} → {redact_path(str(dest))}")
for line in changes:
click.echo(f" {line}")
else:
click.echo(f"No changes {spec}")
@util.command()
@click.argument("path", type=Path)
@click.argument("aspect", type=str)