Skip to main content

Repositories API

List Repositories

GET /api/v1/repositories
Response:
{
  "repositories": [
    {
      "id": "repo_abc123",
      "name": "acme-api",
      "url": "https://github.com/acme/api",
      "branch": "main",
      "status": "synced",
      "last_synced_at": "2024-01-15T10:30:00Z",
      "last_commit": "abc1234",
      "files_indexed": 245,
      "chunks_indexed": 1523
    }
  ]
}

Connect Repository

POST /api/v1/repositories
Request:
{
  "url": "https://github.com/acme/api",
  "branch": "main",
  "access_token": "ghp_xxx",
  "include_patterns": ["app/**/*.rb", "lib/**/*.rb"],
  "exclude_patterns": ["vendor/**"]
}

Get Repository

GET /api/v1/repositories/:id
Response:
{
  "id": "repo_abc123",
  "name": "acme-api",
  "url": "https://github.com/acme/api",
  "branch": "main",
  "status": "synced",
  "last_synced_at": "2024-01-15T10:30:00Z",
  "last_commit": "abc1234",
  "stats": {
    "files_indexed": 245,
    "chunks_indexed": 1523,
    "wiki_pages": 47,
    "diagrams": 12
  },
  "settings": {
    "auto_sync": true,
    "include_patterns": ["app/**/*.rb"],
    "exclude_patterns": ["vendor/**"]
  }
}

Update Repository

PUT /api/v1/repositories/:id
Request:
{
  "branch": "develop",
  "auto_sync": false,
  "include_patterns": ["app/**/*.rb", "lib/**/*.rb", "spec/**/*.rb"]
}

Delete Repository

DELETE /api/v1/repositories/:id

Sync Repository

POST /api/v1/repositories/:id/sync
Response:
{
  "sync_id": "sync_xyz789",
  "status": "started",
  "started_at": "2024-01-15T10:30:00Z"
}

Get Sync Status

GET /api/v1/repositories/:id/syncs/:sync_id
Response:
{
  "sync_id": "sync_xyz789",
  "status": "completed",
  "started_at": "2024-01-15T10:30:00Z",
  "completed_at": "2024-01-15T10:32:00Z",
  "stats": {
    "files_processed": 245,
    "chunks_created": 1523,
    "pages_generated": 47
  }
}