1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-3.0-only
//! `install_config` — the `[install]` section of `doctrine.toml` (SL-152 PHASE-06).
//!
//! Parameterises the printed post-install delegation instructions: the git repo
//! slug the Claude plugin marketplace (`/plugin marketplace add <repo>`) and the
//! universal npx skills command (`npx skills add <repo> …`) resolve against.
//! A pure leaf (ADR-001): serde defaults only, no IO and no domain knowledge —
//! mirrors the `dispatch_config` precedent.
use serde::Deserialize;
const DEFAULT_REPO: &str = "davidlee/doctrine";
fn default_repo() -> String {
DEFAULT_REPO.to_string()
}
/// The `[install]` table from `doctrine.toml`.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
#[serde(default)]
pub(crate) struct InstallConfig {
/// The git repo slug for the plugin marketplace / npx skills commands.
/// Defaults to `davidlee/doctrine`.
#[serde(default = "default_repo")]
pub(crate) repo: String,
}
impl Default for InstallConfig {
fn default() -> Self {
Self {
repo: default_repo(),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn absent_repo_defaults() {
let cfg: InstallConfig = toml::from_str("").unwrap();
assert_eq!(cfg.repo, "davidlee/doctrine");
}
#[test]
fn explicit_repo_overrides_default() {
let cfg: InstallConfig = toml::from_str("repo = \"acme/doctrine\"").unwrap();
assert_eq!(cfg.repo, "acme/doctrine");
}
}