Migration 0034: two tables. repo_connections carries the workspace's per-provider config (owner, base_url, label, last_synced_at, last_sync_error) and points at an app_connections row for the PAT. repos is the per-connection cache with (connection_id, external_id) unique so upsert is idempotent across re-syncs. Cascading deletes clean up cleanly on connection removal. cm-secrets grows a FetchAuthorized op — GET with the stored PAT injected as bearer, returns status + JSON body without ever exposing the credential to cm-api. This is the least-privilege door for read-only provider APIs (list repos), distinct from the InvokeHttp path that still requires a single-use approval grant for outbound writes. cm-api::routes::repos wires: - POST /api/repos/connections (broker store_secret + insert both rows + initial sync + mark_synced) - GET /api/repos/connections - DELETE /api/repos/connections/:id - POST /api/repos/connections/:id/sync - GET /api/repos (500 cap, newest provider_updated first) - GET /api/repos/:id (full detail incl. clone_url + html_url) GitHub provider inline for v1 — paginated pull of /orgs/:owner/repos (when owner set) or /user/repos (when absent), 100/page, capped at 20 pages (~2k repos) to keep first-sync latency bounded. Non-2xx surface back to the caller as sync_error; parse failures are best-effort per repo (skipped, logged, don't abort the batch). Gitea + GitLab providers land in a follow-up — mostly URL swap + response-shape adapter.
21 lines
503 B
JSON
21 lines
503 B
JSON
{
|
|
"db_name": "PostgreSQL",
|
|
"query": "INSERT INTO repo_connections\n (id, workspace_id, app_connection_id, provider, owner, base_url, label)\n VALUES ($1, $2, $3, $4, $5, $6, $7)",
|
|
"describe": {
|
|
"columns": [],
|
|
"parameters": {
|
|
"Left": [
|
|
"Uuid",
|
|
"Uuid",
|
|
"Uuid",
|
|
"Text",
|
|
"Text",
|
|
"Text",
|
|
"Text"
|
|
]
|
|
},
|
|
"nullable": []
|
|
},
|
|
"hash": "17eddeaae42356fdbf51c9006eff470d3b72391f89be17d683c82cf1a9030605"
|
|
}
|