feat: phase 2 — audit config + update --rollback (closes #63 #64)

Axe 8 (sécurité) :
- am audit : checksums SHA-256 des configs (embarquée, utilisateur,
  locale) stockés dans state.json, croisement avec events.jsonl pour
  dater les changements, détection des modifications manuelles hors de
  am (statut MANUAL), rapport lisible + --json stable (contrat)
- backup automatique avant chaque am update (agent ou --all) : état +
  config utilisateur + répertoires d'installation + shims dans
  <state>/backups/<ts>/ avec manifest.json
- am update --rollback [point] : restaure le dernier backup (ou un id
  précis, préfixe accepté), arrête les agents concernés d'abord,
  événement EventKind::Rollback journalisé
- am update --rollback list : liste les points de restauration
- rétention settings.backups_keep (défaut 5) appliquée après chaque backup
- événements EventKind::Backup / EventKind::Rollback pour l'audit

REPL : commande audit + update --rollback (parse, complétion), help specs,
tip cheat sheet, man pages régénérées (50 pages). Version 0.4.6,
ROADMAP cases cochées, 272 tests verts.
This commit is contained in:
2026-08-18 09:44:16 -04:00
parent 22bc529818
commit d9ffc34156
21 changed files with 971 additions and 33 deletions
+16
View File
@@ -24,6 +24,21 @@ pub struct StateFile {
/// Personal annotations per agent: favorite, note, tags (issue #39).
#[serde(default)]
pub annotations: BTreeMap<String, Annotation>,
/// Config file checksums used by 'am audit' (axe 8, issue #63).
#[serde(default)]
pub config_checksums: BTreeMap<String, ConfigChecksum>,
}
/// One recorded config checksum: the baseline 'am audit' compares against
/// to detect manual modifications (issue #63).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ConfigChecksum {
/// SHA-256 of the file content (hex).
pub sha256: String,
/// File modification time (seconds since epoch) at recording time.
pub mtime_secs: u64,
/// RFC 3339 timestamp of the recording.
pub recorded_at: String,
}
/// Personal annotations attached to an agent by the user (issue #39).
@@ -48,6 +63,7 @@ impl Default for StateFile {
sessions_count: 0,
last_used: None,
annotations: BTreeMap::new(),
config_checksums: BTreeMap::new(),
}
}
}