fix: am ai avec aichat >= 0.30 — rôles index.yaml + agents.txt, contexte filtré, generation --code (v1.1.5)
- roles.rs: aichat 0.30 a remplace les agents markdown agents/<name>.md
par functions/agents/<name>/index.yaml + registre functions/agents.txt;
generate_all ecrit les DEUX formats (compat <= 0.29 et >= 0.30)
- ai_cmd.rs: role_args detecte la definition index.yaml en premier
('Unknown agent am-copilot' corrige) ; contexte par defaut (dossier
courant) filtre par am (.git, target, node_modules, binaires non-UTF-8,
.env*, > 64 KiB, budget 128 KiB, 40 fichiers max) — aichat ne filtre
rien et echouait sur .git/index ; exec mode utilise le role am-do
par defaut (commande brute)
- shell_ai.rs: generation via --code au lieu de --execute --dry-run
(aichat 0.30: --dry-run echo la requete sans appeler l'API)
- version 1.1.5, man pages et ROADMAP maj
This commit is contained in:
+10
-3
@@ -7,8 +7,9 @@
|
||||
//! - conversational mode (no `--exec`): `aichat -f <ctx> "<prompt>"` is
|
||||
//! spawned in the foreground, exactly as the user would run it;
|
||||
//! - exec mode (`--exec`): aichat is asked to generate the command with
|
||||
//! `--dry-run` (it prints the command and never runs it), then the
|
||||
//! generated command is classified (safe / risky), a confidence score
|
||||
//! `--code` (it prints only the command and never runs it — aichat is
|
||||
//! invoked without `--execute`), then the generated command is
|
||||
//! classified (safe / risky), a confidence score
|
||||
//! is estimated, the configured safety policy is applied (dry-run by
|
||||
//! default), and only then — after confirmation when required — is the
|
||||
//! command executed through the user's shell.
|
||||
@@ -283,7 +284,13 @@ pub fn generate(
|
||||
role_args: &[String],
|
||||
) -> Result<String> {
|
||||
let agent = require_agent(app, "aichat")?;
|
||||
let mut extra_args: Vec<String> = vec!["--exec".to_string(), "--dry-run".to_string()];
|
||||
// aichat >= 0.30 renamed --exec to --execute AND changed --dry-run to
|
||||
// skip the API call entirely (it echoes the request), so the old
|
||||
// `--execute --dry-run` no longer yields the generated command. Plain
|
||||
// chat with `--code` extracts and prints only the command (same output
|
||||
// shape, works on every aichat version). aichat NEVER executes here —
|
||||
// am enforces the safety policy before running the command itself.
|
||||
let mut extra_args: Vec<String> = vec!["--code".to_string()];
|
||||
extra_args.extend(role_args.iter().cloned());
|
||||
for f in files {
|
||||
extra_args.push("-f".to_string());
|
||||
|
||||
Reference in New Issue
Block a user