Implementation:23blocks OS Ai maestro Agents Repos Service
| Knowledge Sources | |
|---|---|
| Domains | Git_Introspection, Services |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Concrete tool for managing agent git repositories — detecting repos, reading remote URLs and branches, syncing the registry, and CRUD of repository records, provided by AI Maestro's `services/agents-repos-service.ts`.
Description
The agents-repos-service manages git repositories associated with agents. `getGitRepoInfo` detects if a directory is a git repo (`.git` exists), reads the remote URL (`git config --get remote.origin.url`), current branch (`git rev-parse --abbrev-ref HEAD`), and default branch. `listRepos` returns all repos for an agent. `addRepo`/`updateRepo`/`removeRepo` manage the registry's repository list. Repos can be synced from the agent's working directory.
Usage
Call `listRepos(agentId)` from a GET route, `addRepo(agentId, params)` from a POST route. Use `getGitRepoInfo(dirPath)` standalone to inspect a directory.
Code Reference
Source Location
- Repository: ai-maestro
- File: services/agents-repos-service.ts
- Lines: L1-L211
Signature
export async function listRepos(agentId: string): Promise<ServiceResult<Repository[]>>
export async function addRepo(agentId: string, params: { path: string; name?: string }): Promise<ServiceResult<Repository>>
export async function removeRepo(agentId: string, repoId: string): Promise<ServiceResult<boolean>>
export async function syncRepos(agentId: string): Promise<ServiceResult<Repository[]>>
Import
import { listRepos, addRepo, syncRepos } from '@/services/agents-repos-service'
I/O Contract
| Name | Type | Description |
|---|---|---|
| Repository | object | name, path, remoteUrl, currentBranch, defaultBranch |
Usage Examples
import { listRepos, syncRepos } from '@/services/agents-repos-service'
await syncRepos(agentId) // Detect repos from working dir
const { data } = await listRepos(agentId)