projects : am projects (agregats par depot depuis le journal) + profils de projet dans la config (issue #29) - agent dominant, sessions, durees, cache projects.json rafraichi par doctor --fix

This commit is contained in:
2026-08-17 08:10:42 -04:00
parent 81c69db17b
commit dc7372f277
11 changed files with 418 additions and 1 deletions
+23
View File
@@ -35,6 +35,9 @@ pub struct Config {
pub include: Vec<String>,
#[serde(default)]
pub agents: Vec<AgentDef>,
/// Per-project profiles: root, default agent, env and hooks.
#[serde(default)]
pub projects: BTreeMap<String, ProjectProfile>,
}
fn default_version() -> String {
@@ -72,6 +75,23 @@ pub struct Settings {
pub theme: Option<String>,
}
/// A project profile: everything am needs to know about one project.
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(deny_unknown_fields)]
pub struct ProjectProfile {
/// Root directory of the project (accepts ~ and env variables).
pub root: String,
/// Agent launched by 'am start' without arguments inside the project.
#[serde(default)]
pub default_agent: Option<String>,
/// Environment variables injected when launching the default agent.
#[serde(default)]
pub env: BTreeMap<String, String>,
/// Hooks: on_start / on_stop / on_install / on_update command lines.
#[serde(default)]
pub hooks: BTreeMap<String, Vec<String>>,
}
impl Settings {
pub fn auto_install_deps(&self) -> bool {
self.auto_install_deps.unwrap_or(true)
@@ -490,6 +510,9 @@ pub fn merge(base: &mut Config, overlay: Config) {
base.agents.push(agent);
}
}
for (k, v) in overlay.projects {
base.projects.insert(k, v);
}
}
/// Validate a merged config. Returns a list of human-readable problems.