Files
imeai-aKode/akode-rs/prompts/src/update_plan_instructions.rs
andrea.difonzo 7c1c6dfa8d Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
  nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 12:37:52 +01:00

64 lines
2.2 KiB
Rust

//! Purely omits checklist-tool guidance from Codex-owned prompts, before adding caller text.
/// Call only for Codex-owned prompt text; custom instructions must remain unchanged.
pub fn without_update_plan_instructions(instructions: &str) -> String {
let lines = instructions.split_inclusive('\n').collect::<Vec<_>>();
let mut rendered = String::with_capacity(instructions.len());
let mut index = 0;
while index < lines.len() {
let line = lines[index].trim_end();
if matches!(
line,
"## Planning"
| "## `update_plan`"
| "## Plan tool"
| "## Plan Mode vs update_plan tool"
) {
let end = (index + 1..lines.len())
.find(|&next| lines[next].starts_with("# ") || lines[next].starts_with("## "))
.unwrap_or(lines.len());
let is_checklist_section = line != "## Planning"
|| lines[index..end].iter().any(|line| {
line.starts_with("You have access to an `update_plan` tool")
|| line.starts_with("When `update_plan` is available, follow this section")
});
if is_checklist_section {
index = end;
continue;
}
}
if line == "Progress visibility:"
&& lines
.get(index + 1)
.is_some_and(|line| line.starts_with("If update_plan is available"))
{
index += 2;
if lines.get(index).is_some_and(|line| line.trim().is_empty()) {
index += 1;
}
continue;
}
if line.starts_with("- Use the plan tool ")
|| line.starts_with("- If you create a checklist or task list,")
{
index += 1;
while index < lines.len()
&& (lines[index].starts_with(' ') || lines[index].starts_with('\t'))
{
index += 1;
}
continue;
}
rendered.push_str(lines[index]);
index += 1;
}
rendered
}
#[cfg(test)]
#[path = "update_plan_instructions_tests.rs"]
mod tests;