generated from coulomb/repo-seed
Adds a JSONB column `host_paths` to managed_repos mapping
hostname → absolute local path. Fixes the consistency-checker
failure when the same repo lives at different paths on different
machines (e.g. /home/worsch/marki-docx on the workstation vs
/home/tegwick/marki-docx on custodiancore).
Changes:
- Migration g4b5c6d7e8f9: adds host_paths JSONB (default {})
- Model: host_paths Mapped[dict] column
- Schemas: host_paths in RepoRead; new RepoPathRegister schema
- Router: POST /repos/{slug}/paths/ — merges one host entry
- consistency_check.py: resolve_repo_path() prefers host_paths
[hostname] over local_path; --repo-path CLI override added
- MCP: update_repo_path(slug, path, host?) tool
- Makefile: register-path target; REPO_PATH passthrough on
check-consistency and fix-consistency targets
- TOOLS.md: documents update_repo_path
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
74 lines
1.7 KiB
Python
74 lines
1.7 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class RepoCreate(BaseModel):
|
|
domain_slug: str
|
|
slug: str
|
|
name: str
|
|
local_path: str | None = None
|
|
remote_url: str | None = None
|
|
description: str | None = None
|
|
topic_id: uuid.UUID | None = None
|
|
|
|
|
|
class RepoUpdate(BaseModel):
|
|
name: str | None = None
|
|
local_path: str | None = None
|
|
remote_url: str | None = None
|
|
description: str | None = None
|
|
topic_id: uuid.UUID | None = None
|
|
last_state_synced_at: datetime | None = None
|
|
|
|
|
|
class RepoPathRegister(BaseModel):
|
|
"""Register a machine-local path for a repo on a specific host."""
|
|
host: str
|
|
path: str
|
|
|
|
|
|
class RepoRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: uuid.UUID
|
|
domain_id: uuid.UUID
|
|
domain_slug: str # derived from domain relationship
|
|
slug: str
|
|
name: str
|
|
local_path: str | None = None
|
|
host_paths: dict = {}
|
|
remote_url: str | None = None
|
|
description: str | None = None
|
|
status: str
|
|
topic_id: uuid.UUID | None = None
|
|
sbom_source: str | None = None
|
|
last_sbom_at: datetime | None = None
|
|
last_state_synced_at: datetime | None = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class DispatchTask(BaseModel):
|
|
id: uuid.UUID
|
|
title: str
|
|
priority: str
|
|
status: str
|
|
needs_human: bool
|
|
|
|
|
|
class DispatchWorkstream(BaseModel):
|
|
id: uuid.UUID
|
|
title: str
|
|
status: str
|
|
pending_tasks: list[DispatchTask]
|
|
|
|
|
|
class RepoDispatch(BaseModel):
|
|
repo_slug: str
|
|
active_goal: dict[str, Any] | None
|
|
active_workstreams: list[DispatchWorkstream]
|
|
human_interventions: list[DispatchTask]
|
|
last_state_synced_at: datetime | None
|