diff options
| author | soryu <soryu@soryu.co> | 2026-02-05 00:48:38 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-05 00:48:38 +0000 |
| commit | 0302b4596e14210884df5d645df9a179d8f0c1c6 (patch) | |
| tree | 46efe027dffa25a30e4eab87fd62de249c3075ad /makima/src/daemon/chain/parser.rs | |
| parent | e16d49b52a393aa9a762edf57f93434a4bd7844e (diff) | |
| download | soryu-0302b4596e14210884df5d645df9a179d8f0c1c6.tar.gz soryu-0302b4596e14210884df5d645df9a179d8f0c1c6.zip | |
Add multi-repository support for chains
Chains can now have multiple repositories attached, with one marked as
primary. Repositories are used by contracts created from chain definitions.
Backend changes:
- Add chain_repositories table migration
- Add ChainRepository model with CRUD operations
- Add API endpoints for listing, adding, deleting repositories
- Add endpoint to set a repository as primary
- Update Chain and ChainEditorData models to use repositories
- Update chain parser to support repositories in YAML format
- Remove deprecated repository_url/local_path from Chain
Frontend changes:
- Add ChainRepository interface and API functions
- Add repository section to ChainEditor showing attached repos
- Add modal for adding new repositories (remote or local)
- Support setting primary repository and removing repositories
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/daemon/chain/parser.rs')
| -rw-r--r-- | makima/src/daemon/chain/parser.rs | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/makima/src/daemon/chain/parser.rs b/makima/src/daemon/chain/parser.rs index 0f16710..3851d1f 100644 --- a/makima/src/daemon/chain/parser.rs +++ b/makima/src/daemon/chain/parser.rs @@ -20,6 +20,27 @@ pub enum ParseError { ValidationError(String), } +/// Repository definition in a chain. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct RepositoryDefinition { + /// Name of the repository + pub name: String, + /// Repository URL (for remote repos) + pub repository_url: Option<String>, + /// Local path (for local repos) + pub local_path: Option<String>, + /// Source type: remote, local, or managed + #[serde(default = "default_source_type")] + pub source_type: String, + /// Whether this is the primary repository + #[serde(default)] + pub is_primary: bool, +} + +fn default_source_type() -> String { + "remote".to_string() +} + /// Chain definition parsed from YAML. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ChainDefinition { @@ -27,11 +48,9 @@ pub struct ChainDefinition { pub name: String, /// Optional description pub description: Option<String>, - /// Repository URL (optional - contracts may have their own repos) - #[serde(alias = "repo")] - pub repository_url: Option<String>, - /// Local path for repository - pub local_path: Option<String>, + /// Repositories for this chain + #[serde(default)] + pub repositories: Vec<RepositoryDefinition>, /// Contracts in this chain pub contracts: Vec<ContractDefinition>, /// Loop configuration |
