- Commande am ai (alias CLI: am shell) : conversationnel par defaut (aichat -f <ctx> "<prompt>"), mode --exec avec generation aichat --dry-run - Securite (issue #97) : classification safe/risky + certainite affichee, politique dry-run par defaut (settings.shell_ai.default_safety: dry-run | confirm | auto), confirmation y/N pour les commandes risky, --yes pour executer, --dry-run force la simulation - Flags : --exec/-e, --files/-f (defaut: dossier courant), --provider, --model (registre providers -> env aichat + modele, token via keyring) - Execution via le shell utilisateur (default_shell > SHELL > COMSPEC) - Journalisation : EventKind::ShellAi (mode, risk, certainty, executed) - Module src/shell_ai.rs (classification, politique, generation, execution) - Câblage complet : cli, dispatch, help, REPL (parseur+completer+banner), tip, man pages (am-ai.1), i18n EN, config.yaml (bloc shell_ai) - Tests : 7 unitaires (classification, certainty, extraction, decision) + 4 integration (shim aichat.cmd : dry-run par defaut, --yes, mode conversationnel, mode confirm) — 339 tests verts - v1.0.5 ; ROADMAP axe 13.3 coche (6 lignes), epic #93 clôturee closes #93 closes #96 closes #97
This commit is contained in:
+32
@@ -214,6 +214,9 @@ pub enum Command {
|
||||
#[arg(long)]
|
||||
yes: bool,
|
||||
},
|
||||
/// Langage naturel → action shell via AIChat (issues #96 #97); alias: shell
|
||||
#[command(alias = "shell")]
|
||||
Ai(AiArgs),
|
||||
/// Start an agent (foreground by default, or detached with --background)
|
||||
Start(StartArgs),
|
||||
/// Stop a background agent (SIGTERM, then SIGKILL after the timeout)
|
||||
@@ -700,6 +703,35 @@ pub struct WebArgs {
|
||||
pub no_open: bool,
|
||||
}
|
||||
|
||||
/// Arguments of am ai (issues #96 #97): natural language → shell action
|
||||
/// via AIChat. The global flags --dry-run and --yes/-y apply as well.
|
||||
#[derive(Args, Debug, Clone, Default)]
|
||||
pub struct AiArgs {
|
||||
/// The request in natural language
|
||||
#[arg(value_name = "PROMPT", num_args = 1.., required = true)]
|
||||
pub prompt: Vec<String>,
|
||||
/// Execute the generated shell command (after the safety policy)
|
||||
#[arg(short = 'e', long, action = ArgAction::SetTrue)]
|
||||
pub exec: bool,
|
||||
/// Files or directories passed as context (repeatable; default: the
|
||||
/// current directory)
|
||||
#[arg(short = 'f', long = "files", value_name = "PATH", action = ArgAction::Append)]
|
||||
pub files: Vec<std::path::PathBuf>,
|
||||
/// Provider of the registry used by aichat (env vars + model)
|
||||
#[arg(long, value_name = "ID")]
|
||||
pub provider: Option<String>,
|
||||
/// Force a model (aichat --model)
|
||||
#[arg(long, value_name = "MODEL")]
|
||||
pub model: Option<String>,
|
||||
/// REPL-only: --yes given on the REPL line (the CLI global -y/--yes is
|
||||
/// handled by clap directly).
|
||||
#[arg(skip)]
|
||||
pub yes: bool,
|
||||
/// REPL-only: --dry-run given on the REPL line.
|
||||
#[arg(skip)]
|
||||
pub dry_run: bool,
|
||||
}
|
||||
|
||||
/// Arguments of am serve (issue #80).
|
||||
#[derive(Args, Debug, Clone, Default)]
|
||||
pub struct ServeArgs {
|
||||
|
||||
Reference in New Issue
Block a user