From 6a6676fc5d9a8a62b968a3a28b3135a78e7dcfe6 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Tue, 18 Aug 2026 10:08:20 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20phase=202=20=E2=80=94=20sessions=20expo?= =?UTF-8?q?rt=20+=20r=C3=A9tention,=20init=20--template=20(closes=20#52=20?= =?UTF-8?q?#53)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Axe 3 (#52) : templates embarqués dans le binaire (web, python, rust, cli) - am init --template génère une config pré-remplie : groupe dev, profil par défaut, hooks projet (npm install / uv sync / cargo fetch) - substitution {project} {dir} au rendu ; --template list pour lister - fallback détection automatique de stack quand aucun template - config générée validée (parse YAML + validate) par les tests Axe 4 (#53) : am sessions export + rétention configurable - am sessions --export [--output ] : JSON complet et reproductible (métadonnées + commandes history/.jsonl + extrait de log 4 Ko + rendu lisible 'readable'), compatible archivage manuel - settings.sessions_retention_days (défaut 90) : purge au démarrage (silencieuse) et am sessions --retention - purge limitée à l'index dérivé sessions.json — le journal d'événements primaire n'est jamais touché ; EventKind::Prune journalisé (visibilité am audit) - sessions en cours (running) jamais purgées ; erreur claire si id inconnu REPL : sessions --export/--retention/--output + init --template ; help specs, tip cheat sheet, config.yaml, README, man pages régénérées. Version 0.4.7, ROADMAP cochée, 276 tests verts. --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 4 +- ROADMAP.md | 4 +- config.yaml | 1 + man/am-init.1 | 5 +- man/am-sessions.1 | 11 ++- man/am.1 | 4 +- src/cli.rs | 13 +++ src/commands/init_cmd.rs | 83 ++++++++++++------ src/commands/mod.rs | 10 ++- src/commands/sessions_cmd.rs | 61 +++++++++++++ src/commands/tip_cmd.rs | 15 ++++ src/config.rs | 6 ++ src/events.rs | 3 + src/help.rs | 22 +++-- src/history.rs | 13 +++ src/lib.rs | 41 ++++++--- src/repl.rs | 8 +- src/sessions.rs | 166 +++++++++++++++++++++++++++++++++++ src/templates.rs | 138 +++++++++++++++++++++++++++++ tests/init_test.rs | 10 +-- tests/sessions_test.rs | 10 +-- 23 files changed, 561 insertions(+), 71 deletions(-) create mode 100644 src/templates.rs diff --git a/Cargo.lock b/Cargo.lock index dc3ca41..7ac7085 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,7 +21,7 @@ dependencies = [ [[package]] name = "agent-manager" -version = "0.4.6" +version = "0.4.7" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 7376808..bc2ddf8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agent-manager" -version = "0.4.6" +version = "0.4.7" edition = "2021" description = "Manage local AI coding agents: list, install, start, stop, update — with automatic dependency handling and a YAML-driven catalog." license = "MIT" diff --git a/README.md b/README.md index b4b213d..cb4a2d6 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,9 @@ plateforme, il compile automatiquement depuis les sources. | am models --prune | purge des modèles inutilisés (--dry-run : simulation) | | am catalog update / add | catalogue distant : rafraîchit l'officiel ou ajoute un catalogue d'équipe | | am audit | qui a modifié quoi, quand (checksums config + journal) | -| am update --rollback | annule la dernière mise à jour (backup automatique avant chaque update) | +| am sessions --export | export d'une session (métadonnées + commandes + extrait de log) | +| am sessions --retention | purge des sessions terminées au-delà de N jours | +| am init --template | génère une config pré-remplie (web, python, rust, cli) | **Statuts** : 🟢 running · 🔵 installed (géré par am) · 🟡 external (trouvé sur le PATH) · ⚪ not-installed · 🔴 not-installable (SaaS/desktop) diff --git a/ROADMAP.md b/ROADMAP.md index 6548c49..d488522 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -433,8 +433,8 @@ moins de 2 secondes. | [#49](https://git.dracodev.net/Projets/agent-manager/issues/49) | Suivi des coûts — tokens/€ par session | M | | [#50](https://git.dracodev.net/Projets/agent-manager/issues/50) | am monitor — TUI temps réel (CPU/mémoire par PID, alertes) | L | | [#51](https://git.dracodev.net/Projets/agent-manager/issues/51) | Playbooks — am history --save + am playbook | L | -| [#52](https://git.dracodev.net/Projets/agent-manager/issues/52) | Templates — am init --template web | M | -| [#53](https://git.dracodev.net/Projets/agent-manager/issues/53) | am sessions export + rétention configurable | M | +| [#52](https://git.dracodev.net/Projets/agent-manager/issues/52) | ✅ Templates — am init --template web/python/rust/cli (substitution + validation) | M | +| [#53](https://git.dracodev.net/Projets/agent-manager/issues/53) | ✅ am sessions export + rétention configurable (sessions_retention_days) | M | | [#54](https://git.dracodev.net/Projets/agent-manager/issues/54) | am web — serveur local + API JSON + graphiques | XL | | [#55](https://git.dracodev.net/Projets/agent-manager/issues/55) | Services système — am service install (systemd/launchd/tâches Windows) | L | | [#56](https://git.dracodev.net/Projets/agent-manager/issues/56) | Planification — am schedule (--daily update --all, check santé) | M | diff --git a/config.yaml b/config.yaml index 0abf73a..7cbc21b 100644 --- a/config.yaml +++ b/config.yaml @@ -24,6 +24,7 @@ settings: catalog_cache_ttl_secs: 3600 # TTL du cache des catalogues distants (#60 #67) catalog_url: null # URL officielle du catalogue distant (défaut: config.yaml du repo) (#60) backups_keep: 5 # nombre de backups conservés pour am update --rollback (#64) + sessions_retention_days: 90 # purge des sessions terminées au-delà de N jours (#53) # --- Command aliases ---------------------------------------------------------- aliases: diff --git a/man/am-init.1 b/man/am-init.1 index 1a3a8e4..fdda246 100644 --- a/man/am-init.1 +++ b/man/am-init.1 @@ -4,7 +4,7 @@ .SH NAME init \- Generate a local agent\-manager.yaml for the current directory .SH SYNOPSIS -\fBinit\fR [\fB\-\-force\fR] [\fB\-h\fR|\fB\-\-help\fR] +\fBinit\fR [\fB\-\-force\fR] [\fB\-\-template\fR] [\fB\-h\fR|\fB\-\-help\fR] .SH DESCRIPTION Generate a local agent\-manager.yaml for the current directory .SH OPTIONS @@ -12,5 +12,8 @@ Generate a local agent\-manager.yaml for the current directory \fB\-\-force\fR Overwrite an existing agent\-manager.yaml .TP +\fB\-\-template\fR \fI