Craft Anything: understand how any software works, and craft your own.
Rust
Choose a project's approvals from a menu under the prompt box or with /approvals (#1026)
Tanish Manku9017d51c1969
diff --git a/crates/ui-egui/src/approvals.rs b/crates/ui-egui/src/approvals.rsnew file mode 100644index 00000000..d1fcf764--- /dev/null+++ b/crates/ui-egui/src/approvals.rs@@ -0,0 +1,196 @@+//! What the builder may do without asking, per kind of action, in the open project+//! (`project_approvals_set`): a menu under the prompt box, and `/approvals <kind> <choice>` typed in+//! it. A kind left on Default follows Auto mode.++use crate::i18n::{tr, trf};+use crate::slash::{self, Command, Typed};+use crate::theme::{self, Tokens};+use crate::{CraftApp, widgets};+use craft_anything_engine::evidence::ToolError;+use craft_anything_engine::workspace::{ACTION_KINDS, ActionKind, Approval};+use egui::{RichText, Ui};+use serde_json::{Value, json};+use std::path::Path;++/// Each kind as the person reads it.+const LABELS: &[(ActionKind, &str)] = &[+ (ActionKind::Web, "Reading the web"),+ (ActionKind::Commands, "Other commands"),+ (ActionKind::OutsideFiles, "Files outside the project"),+ (ActionKind::Publish, "Pushing and publishing"),+ (ActionKind::DeleteOutside, "Deleting outside the project"),+ (ActionKind::System, "System changes"),+ (ActionKind::OtherTools, "Other tools"),+];++/// Other words for a kind after `/approvals`, as well as its own name (`publish`).+const ALIASES: &[(&str, ActionKind)] = &[+ ("push", ActionKind::Publish),+ ("pushing", ActionKind::Publish),+ ("publishing", ActionKind::Publish),+ ("fetch", ActionKind::Web),+ ("internet", ActionKind::Web),+ ("files", ActionKind::OutsideFiles),+ ("delete", ActionKind::DeleteOutside),+ ("deletes", ActionKind::DeleteOutside),+ ("tools", ActionKind::OtherTools),+];++/// The choices, as shown and as typed after `/approvals` (in any case); none is Default.+const CHOICES: &[(&str, Option<Approval>)] =+ &[("Default", None), ("Allow", Some(Approval::Allow)), ("Ask", Some(Approval::Ask)), ("Refuse", Some(Approval::Refuse))];++fn label(kind: ActionKind) -> &'static str {+ LABELS.iter().find(|(k, _)| *k == kind).map_or("", |(_, l)| l)+}++fn choice_label(choice: Option<Approval>) -> &'static str {+ CHOICES.iter().find(|(_, c)| *c == choice).map_or("", |(l, _)| l)+}++/// The kind a word after `/approvals` names: its own name or another word for it.+fn kind_named(word: &str) -> Option<ActionKind> {+ ActionKind::named(word).or_else(|| ALIASES.iter().find(|(w, _)| w.eq_ignore_ascii_case(word)).map(|(_, k)| *k))+}++/// The kinds' names, to say what can be typed: "web, commands, …".+fn kind_names() -> String {+ ACTION_KINDS.iter().map(|r| r.name).collect::<Vec<_>>().join(", ")+}++/// `/approvals <kind> <choice>` (in either order) when `text` is that command: the kind and the+/// choice (none: Default). `None`: it's another command or a message. An error says what to type,+/// and the text stays in the box to be fixed.+pub fn command_in(text: &str) -> Option<Result<(ActionKind, Option<Approval>), String>> {+ let Typed::Command(Command::Approvals, rest) = slash::read(text) else { return None };+ let usage =+ || trf("After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}.", &[("kinds", &kind_names())]);+ let choice = |w: &str| CHOICES.iter().find(|(n, _)| n.eq_ignore_ascii_case(w)).map(|(_, c)| *c);+ let words: Vec<&str> = rest.split_whitespace().collect();+ let [a, b] = words.as_slice() else { return Some(Err(usage())) };+ let (word, picked) = match (choice(a), choice(b)) {+ (Some(c), None) => (*b, c),+ (None, Some(c)) => (*a, c),+ _ => return Some(Err(usage())),+ };+ Some(match kind_named(word) {+ Some(kind) => Ok((kind, picked)),+ None => Err(trf("There's no kind called {name}. Kinds: {kinds}.", &[("name", word), ("kinds", &kind_names())])),+ })+}++impl CraftApp {+ /// Choose what one kind of the builder's actions gets in this project. Shown at once; saved by+ /// the tool, and from the builder's next action.+ pub fn set_approval(&mut self, root: &Path, kind: ActionKind, choice: Option<Approval>) {+ if let Some(ws) = self.workspace.as_mut().filter(|w| w.root == root) {+ match choice {+ Some(a) => ws.manifest.approvals.insert(kind, a),+ None => ws.manifest.approvals.remove(&kind),+ };+ }+ let mode = choice.map_or(json!("default"), |a| json!(a));+ self.act("project_approvals_set", json!({"project": root, "kind": kind, "mode": mode}), tr("Approvals"));+ }++ /// The tool saved a choice (or couldn't).+ pub(crate) fn approval_set(&mut self, result: Result<Value, ToolError>) {+ match result {+ Ok(v) => {+ // What was saved (the person's other changes on disk come along).+ if let Some(ws) = self.workspace.as_mut().filter(|w| v["project"].as_str().is_some_and(|p| w.root == Path::new(p))) {+ let _ = ws.reload();+ }+ let set = &v["set"];+ let Some(kind) = set["kind"].as_str().and_then(ActionKind::named) else { return };+ let chosen: Option<Approval> = serde_json::from_value(set["chosen"].clone()).ok();+ let gets: Option<Approval> = serde_json::from_value(set["gets"].clone()).ok();+ let choice = match chosen {+ Some(c) => tr(choice_label(Some(c))),+ // Default: say what that is now.+ None => format!("{} ({})", tr(choice_label(None)), gets.map(|g| tr(choice_label(Some(g)))).unwrap_or_default()),+ };+ self.toast(trf("In this project, {kind}: {choice}.", &[("kind", &tr(label(kind))), ("choice", &choice)]), false);+ }+ Err(e) => {+ // The menu showed the choice before it was saved: show what's really kept again.+ if let Some(ws) = self.workspace.as_mut() {+ let _ = ws.reload();+ }+ self.toast(format!("{} {}", tr("Couldn't change the approvals:"), e.for_people()), true);+ }+ }+ }+}++/// Under the prompt box: a menu with one row per kind of action and what it gets in this project.+pub(crate) fn menu(app: &mut CraftApp, ui: &mut Ui, root: &Path) {+ let Some(ws) = &app.workspace else { return };+ let chosen = ws.manifest.approvals.clone();+ let t = Tokens::get(ui.ctx());+ let names: Vec<&str> = CHOICES.iter().map(|(n, _)| *n).collect();+ let button = widgets::link(ui, "Approvals").on_hover_text(tr("What the builder may do without asking you, in this project."));+ let mut picked = None;+ // A named id, so tests (and anything else) can tell whether it's open.+ let popup = egui::Popup::from_toggle_button_response(&button).id(egui::Id::new("project-approvals"));+ popup.close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| {+ egui::Grid::new("approvals").num_columns(2).spacing([12.0, 6.0]).show(ui, |ui| {+ for row in ACTION_KINDS {+ ui.label(RichText::new(tr(label(row.kind))).size(theme::SMALL));+ let now = chosen.get(&row.kind).copied();+ let sel = CHOICES.iter().position(|(_, c)| *c == now).unwrap_or(0);+ // Every row has the same labels, which `segmented` makes its ids from.+ ui.push_id(row.name, |ui| {+ if let Some(c) = widgets::segmented(ui, &names, sel, 24.0).and_then(|i| CHOICES.get(i)) {+ picked = Some((row.kind, c.1));+ }+ });+ ui.end_row();+ }+ });+ ui.add_space(4.0);+ let note = tr("Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks.");+ ui.add(egui::Label::new(RichText::new(note).size(theme::SMALL).color(t.text_faint)).wrap());+ });+ if let Some((kind, choice)) = picked {+ app.set_approval(root, kind, choice);+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn approvals_takes_a_kind_and_a_choice_in_either_order() {+ assert_eq!(command_in("/approvals publish ask"), Some(Ok((ActionKind::Publish, Some(Approval::Ask)))));+ assert_eq!(command_in("/approvals allow push"), Some(Ok((ActionKind::Publish, Some(Approval::Allow)))));+ assert_eq!(command_in(" /APPROVALS Web Refuse "), Some(Ok((ActionKind::Web, Some(Approval::Refuse)))));+ assert_eq!(command_in("/approvals outside_files default"), Some(Ok((ActionKind::OutsideFiles, None))));+ assert_eq!(command_in("/approvals fetch allow"), Some(Ok((ActionKind::Web, Some(Approval::Allow)))));+ }++ #[test]+ fn approvals_says_what_to_type_when_it_cant_read_it() {+ for wrong in ["/approvals", "/approvals publish", "/approvals allow ask", "/approvals publish ask now"] {+ let why = command_in(wrong).unwrap().unwrap_err();+ assert!(why.contains("/approvals publish ask") && why.contains("delete_outside"), "{wrong}: {why}");+ }+ let why = command_in("/approvals everything allow").unwrap().unwrap_err();+ assert!(why.contains("everything"), "{why}");+ }++ #[test]+ fn other_text_isnt_this_command() {+ for other in ["/btw may it push?", "push it to github", "/approve publish allow"] {+ assert_eq!(command_in(other), None, "{other}");+ }+ }++ #[test]+ fn every_kind_has_a_label() {+ for row in ACTION_KINDS {+ assert!(!label(row.kind).is_empty(), "{}", row.name);+ }+ }+}diff --git a/crates/ui-egui/src/fr.tsv b/crates/ui-egui/src/fr.tsvindex 9993ea0f..638bf220 100644--- a/crates/ui-egui/src/fr.tsv+++ b/crates/ui-egui/src/fr.tsv@@ -1444,3 +1444,20 @@ yesterday hierDrag to give the plan more or less room; double-click to reset Faites glisser pour donner plus ou moins de place au plan ; double-cliquez pour rétablirCopy the message Copier le messageChoose what the builder's approvals get Choisir ce que reçoivent les autorisations du constructeur+Reading the web Lecture du web+Other commands Autres commandes+Files outside the project Fichiers hors du projet+Pushing and publishing Push et publication+Deleting outside the project Suppressions hors du projet+System changes Modifications du système+Other tools Autres outils+Allow Autoriser+Ask Demander+Refuse Refuser+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. Après /approvals, tapez un type et allow, ask, refuse ou default, par exemple /approvals publish ask. Types : {kinds}.+There's no kind called {name}. Kinds: {kinds}. Il n'y a pas de type {name}. Types : {kinds}.+Approvals Autorisations+In this project, {kind}: {choice}. Dans ce projet, {kind} : {choice}.+Couldn't change the approvals: Impossible de modifier les autorisations :+What the builder may do without asking you, in this project. Ce que le constructeur peut faire sans vous demander, dans ce projet.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Par défaut suit le mode automatique : activé, ce qui peut être annulé se fait et le reste est refusé ; désactivé, le constructeur demande.diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex 380dcf36..6700aec8 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -1445,3 +1445,20 @@ Bring all to front Vše do popředíDrag to give the plan more or less room; double-click to reset Přetažením dáte plánu víc nebo míň místa; dvojklikem vrátíte výchozí výškuCopy the message Zkopírovat zprávuChoose what the builder's approvals get Vybrat, jak se naloží se schvalováním sestavovacího agenta+Reading the web Čtení webu+Other commands Ostatní příkazy+Files outside the project Soubory mimo projekt+Pushing and publishing Push a publikování+Deleting outside the project Mazání mimo projekt+System changes Změny systému+Other tools Ostatní nástroje+Allow Povolit+Ask Zeptat se+Refuse Odmítnout+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. Za /approvals napište druh a allow, ask, refuse nebo default, například /approvals publish ask. Druhy: {kinds}.+There's no kind called {name}. Kinds: {kinds}. Druh {name} neexistuje. Druhy: {kinds}.+Approvals Schvalování+In this project, {kind}: {choice}. V tomto projektu {kind}: {choice}.+Couldn't change the approvals: Schvalování nešlo změnit:+What the builder may do without asking you, in this project. Co smí sestavovací agent v tomto projektu dělat, aniž by se vás ptal.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Výchozí se řídí automatickým režimem: když je zapnutý, co lze vrátit, proběhne, a zbytek se odmítne; když je vypnutý, sestavovací agent se ptá.diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex 945792d8..90f8ba3c 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -1445,3 +1445,20 @@ Bring all to front Alle nach vorne bringenDrag to give the plan more or less room; double-click to reset Ziehen, um dem Plan mehr oder weniger Platz zu geben; Doppelklick setzt zurückCopy the message Die Nachricht kopierenChoose what the builder's approvals get Festlegen, was die Freigaben des Builders erhalten+Reading the web Im Web lesen+Other commands Andere Befehle+Files outside the project Dateien außerhalb des Projekts+Pushing and publishing Pushen und Veröffentlichen+Deleting outside the project Löschen außerhalb des Projekts+System changes Systemänderungen+Other tools Andere Werkzeuge+Allow Erlauben+Ask Fragen+Refuse Ablehnen+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. Tippe nach /approvals eine Art und allow, ask, refuse oder default, zum Beispiel /approvals publish ask. Arten: {kinds}.+There's no kind called {name}. Kinds: {kinds}. Es gibt keine Art namens {name}. Arten: {kinds}.+Approvals Freigaben+In this project, {kind}: {choice}. In diesem Projekt {kind}: {choice}.+Couldn't change the approvals: Die Freigaben konnten nicht geändert werden:+What the builder may do without asking you, in this project. Was der Builder in diesem Projekt tun darf, ohne dich zu fragen.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Standard folgt dem Automatikmodus: Ist er an, geschieht, was sich rückgängig machen lässt, und der Rest wird abgelehnt; ist er aus, fragt der Builder.diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex e15e7b9c..1b9a904d 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -1445,3 +1445,20 @@ Bring all to front Traer todo al frenteDrag to give the plan more or less room; double-click to reset Arrastra para darle al plan más o menos espacio; doble clic para restablecerCopy the message Copiar el mensajeChoose what the builder's approvals get Elegir qué reciben las aprobaciones del constructor+Reading the web Leer la web+Other commands Otros comandos+Files outside the project Archivos fuera del proyecto+Pushing and publishing Push y publicación+Deleting outside the project Borrar fuera del proyecto+System changes Cambios en el sistema+Other tools Otras herramientas+Allow Permitir+Ask Preguntar+Refuse Rechazar+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. Después de /approvals, escribe un tipo y allow, ask, refuse o default, por ejemplo /approvals publish ask. Tipos: {kinds}.+There's no kind called {name}. Kinds: {kinds}. No hay ningún tipo llamado {name}. Tipos: {kinds}.+Approvals Aprobaciones+In this project, {kind}: {choice}. En este proyecto, {kind}: {choice}.+Couldn't change the approvals: No se pudieron cambiar las aprobaciones:+What the builder may do without asking you, in this project. Lo que el constructor puede hacer sin preguntarte, en este proyecto.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Predeterminado sigue al modo automático: activado, lo que se puede deshacer se hace y el resto se rechaza; desactivado, el constructor pregunta.diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex 9721d5ee..81261541 100644--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@ -1447,3 +1447,20 @@ Bring all to front Porta tutto in primo pianoCopy the message Copia il messaggioDrag to give the plan more or less room; double-click to reset Trascina per dare al piano più o meno spazio; doppio clic per ripristinareChoose what the builder's approvals get Scegli cosa ricevono le approvazioni del costruttore+Reading the web Leggere il web+Other commands Altri comandi+Files outside the project File fuori dal progetto+Pushing and publishing Push e pubblicazione+Deleting outside the project Eliminazioni fuori dal progetto+System changes Modifiche al sistema+Other tools Altri strumenti+Allow Consenti+Ask Chiedi+Refuse Rifiuta+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. Dopo /approvals, scrivi un tipo e allow, ask, refuse o default, per esempio /approvals publish ask. Tipi: {kinds}.+There's no kind called {name}. Kinds: {kinds}. Non esiste un tipo chiamato {name}. Tipi: {kinds}.+Approvals Approvazioni+In this project, {kind}: {choice}. In questo progetto, {kind}: {choice}.+Couldn't change the approvals: Impossibile cambiare le approvazioni:+What the builder may do without asking you, in this project. Cosa può fare il costruttore senza chiedertelo, in questo progetto.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Predefinito segue la modalità automatica: se è attiva, ciò che si può annullare va avanti e il resto è rifiutato; se è spenta, il costruttore chiede.diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsvindex 7862adfe..74c0473e 100644--- a/crates/ui-egui/src/i18n/ka.tsv+++ b/crates/ui-egui/src/i18n/ka.tsv@@ -1445,3 +1445,20 @@ Show model options მოდელის პარამეტრებისStandard სტანდარტულიWhere is your project? სად არის თქვენი პროექტი?Choose what the builder's approvals get აირჩიეთ, რას იღებს ამწყობის ნებართვები+Reading the web ვების კითხვა+Other commands სხვა ბრძანებები+Files outside the project ფაილები პროექტის გარეთ+Pushing and publishing Push და გამოქვეყნება+Deleting outside the project წაშლა პროექტის გარეთ+System changes სისტემის ცვლილებები+Other tools სხვა ხელსაწყოები+Allow დაშვება+Ask კითხვა+Refuse უარყოფა+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. /approvals-ის შემდეგ აკრიფეთ სახე და allow, ask, refuse ან default, მაგალითად /approvals publish ask. სახეები: {kinds}.+There's no kind called {name}. Kinds: {kinds}. სახე {name} არ არსებობს. სახეები: {kinds}.+Approvals ნებართვები+In this project, {kind}: {choice}. ამ პროექტში {kind}: {choice}.+Couldn't change the approvals: ნებართვების შეცვლა ვერ მოხერხდა:+What the builder may do without asking you, in this project. რისი გაკეთება შეუძლია ამწყობს ამ პროექტში თქვენი კითხვის გარეშე.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. ნაგულისხმევი ავტორეჟიმს მიჰყვება: როცა ჩართულია, რისი გაუქმებაც შეიძლება, სრულდება, დანარჩენი კი უარყოფილია; როცა გამორთულია, ამწყობი გეკითხებათ.diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsvindex 5496e7dc..9b2f5cc4 100644--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@ -1445,3 +1445,20 @@ Bring all to front 모두 앞으로 가져오기Drag to give the plan more or less room; double-click to reset 끌어서 계획이 차지하는 공간을 조절하고, 두 번 클릭하면 원래대로 돌아갑니다Copy the message 메시지 복사Choose what the builder's approvals get 빌더의 승인 요청을 어떻게 처리할지 고르기+Reading the web 웹 읽기+Other commands 그 밖의 명령+Files outside the project 프로젝트 밖의 파일+Pushing and publishing 푸시와 게시+Deleting outside the project 프로젝트 밖 삭제+System changes 시스템 변경+Other tools 그 밖의 도구+Allow 허용+Ask 묻기+Refuse 거부+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. /approvals 뒤에 종류와 allow, ask, refuse, default 중 하나를 입력합니다. 예: /approvals publish ask. 종류: {kinds}.+There's no kind called {name}. Kinds: {kinds}. {name}라는 종류는 없습니다. 종류: {kinds}.+Approvals 승인+In this project, {kind}: {choice}. 이 프로젝트에서 {kind}: {choice}.+Couldn't change the approvals: 승인을 바꾸지 못했습니다:+What the builder may do without asking you, in this project. 이 프로젝트에서 빌더가 묻지 않고 해도 되는 일입니다.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. 기본값은 자동 모드를 따릅니다. 켜져 있으면 되돌릴 수 있는 일은 진행하고 나머지는 거부하며, 꺼져 있으면 빌더가 묻습니다.diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsvindex 1b7ae14d..e8636b7b 100644--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@ -1445,3 +1445,20 @@ Drag to give the plan more or less room; double-click to reset Arraste para ajusCopy the message Copiar a mensagem{n} · ${spent} of ${budget} {n} · ${spent} de ${budget}Choose what the builder's approvals get Escolher o que as aprovações do agente recebem+Reading the web Ler a web+Other commands Outros comandos+Files outside the project Arquivos fora do projeto+Pushing and publishing Push e publicação+Deleting outside the project Apagar fora do projeto+System changes Mudanças no sistema+Other tools Outras ferramentas+Allow Permitir+Ask Perguntar+Refuse Recusar+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. Depois de /approvals, digite um tipo e allow, ask, refuse ou default, por exemplo /approvals publish ask. Tipos: {kinds}.+There's no kind called {name}. Kinds: {kinds}. Não existe um tipo chamado {name}. Tipos: {kinds}.+Approvals Aprovações+In this project, {kind}: {choice}. Neste projeto, {kind}: {choice}.+Couldn't change the approvals: Não foi possível mudar as aprovações:+What the builder may do without asking you, in this project. O que o agente pode fazer sem perguntar a você, neste projeto.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Padrão segue o modo automático: ligado, o que pode ser desfeito segue em frente e o resto é recusado; desligado, o agente pergunta.diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex 0df699d2..d272e717 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -1445,3 +1445,20 @@ Bring all to front Все окна — на передний планDrag to give the plan more or less room; double-click to reset Перетащите, чтобы дать плану больше или меньше места; двойной щелчок возвращает как былоCopy the message Скопировать сообщениеChoose what the builder's approvals get Выбрать, что получают разрешения конструктора+Reading the web Чтение веба+Other commands Другие команды+Files outside the project Файлы вне проекта+Pushing and publishing Push и публикация+Deleting outside the project Удаление вне проекта+System changes Изменения системы+Other tools Другие инструменты+Allow Разрешать+Ask Спрашивать+Refuse Отказывать+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. После /approvals введите вид и allow, ask, refuse или default, например /approvals publish ask. Виды: {kinds}.+There's no kind called {name}. Kinds: {kinds}. Вида {name} нет. Виды: {kinds}.+Approvals Разрешения+In this project, {kind}: {choice}. В этом проекте {kind}: {choice}.+Couldn't change the approvals: Не удалось изменить разрешения:+What the builder may do without asking you, in this project. Что конструктор может делать в этом проекте, не спрашивая вас.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. «По умолчанию» следует авторежиму: когда он включён, то, что можно отменить, выполняется, а остальное отклоняется; когда выключен, конструктор спрашивает.diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsvindex fc59d6f7..210b5f60 100644--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@ -1445,3 +1445,20 @@ Bring all to front Tümünü öne getirDrag to give the plan more or less room; double-click to reset Plana daha fazla veya daha az yer vermek için sürükleyin; sıfırlamak için çift tıklayınCopy the message Mesajı kopyalaChoose what the builder's approvals get Oluşturucunun onaylarına ne olacağını seç+Reading the web Web'i okuma+Other commands Diğer komutlar+Files outside the project Proje dışındaki dosyalar+Pushing and publishing Push ve yayınlama+Deleting outside the project Proje dışında silme+System changes Sistem değişiklikleri+Other tools Diğer araçlar+Allow İzin ver+Ask Sor+Refuse Reddet+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. /approvals sonrasına bir tür ve allow, ask, refuse ya da default yazın, örneğin /approvals publish ask. Türler: {kinds}.+There's no kind called {name}. Kinds: {kinds}. {name} adında bir tür yok. Türler: {kinds}.+Approvals Onaylar+In this project, {kind}: {choice}. Bu projede {kind}: {choice}.+Couldn't change the approvals: Onaylar değiştirilemedi:+What the builder may do without asking you, in this project. Oluşturucunun bu projede size sormadan yapabilecekleri.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Varsayılan, otomatik modu izler: açıkken geri alınabilenler yapılır, gerisi reddedilir; kapalıyken oluşturucu sorar.diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsvindex 7e35db06..367a1ca0 100644--- a/crates/ui-egui/src/i18n/vi.tsv+++ b/crates/ui-egui/src/i18n/vi.tsv@@ -1445,3 +1445,20 @@ Bring all to front Đưa tất cả lên trướcDrag to give the plan more or less room; double-click to reset Kéo để mở rộng hoặc thu hẹp phần kế hoạch; nhấp đúp để đặt lạiCopy the message Sao chép tin nhắnChoose what the builder's approvals get Chọn cách xử lý các phê duyệt của trình xây dựng+Reading the web Đọc web+Other commands Lệnh khác+Files outside the project Tệp ngoài dự án+Pushing and publishing Push và xuất bản+Deleting outside the project Xóa ngoài dự án+System changes Thay đổi hệ thống+Other tools Công cụ khác+Allow Cho phép+Ask Hỏi+Refuse Từ chối+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. Sau /approvals, hãy nhập một loại và allow, ask, refuse hoặc default, ví dụ /approvals publish ask. Các loại: {kinds}.+There's no kind called {name}. Kinds: {kinds}. Không có loại nào tên {name}. Các loại: {kinds}.+Approvals Phê duyệt+In this project, {kind}: {choice}. Trong dự án này, {kind}: {choice}.+Couldn't change the approvals: Không thể thay đổi phê duyệt:+What the builder may do without asking you, in this project. Những gì trình xây dựng được làm mà không cần hỏi bạn, trong dự án này.+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. Mặc định theo chế độ tự động: khi bật, việc có thể hoàn tác sẽ được làm và phần còn lại bị từ chối; khi tắt, trình xây dựng sẽ hỏi.diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex e92ae2a5..f9770507 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -1445,3 +1445,20 @@ Bring all to front 前置全部窗口Drag to give the plan more or less room; double-click to reset 拖动以调整计划占用的空间;双击恢复默认Copy the message 复制这条消息Choose what the builder's approvals get 选择如何处理构建助手的审批+Reading the web 读取网页+Other commands 其他命令+Files outside the project 项目以外的文件+Pushing and publishing 推送和发布+Deleting outside the project 在项目以外删除+System changes 系统更改+Other tools 其他工具+Allow 允许+Ask 询问+Refuse 拒绝+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. 在 /approvals 后输入一个类别和 allow、ask、refuse 或 default,例如 /approvals publish ask。类别:{kinds}。+There's no kind called {name}. Kinds: {kinds}. 没有名为 {name} 的类别。类别:{kinds}。+Approvals 审批+In this project, {kind}: {choice}. 在这个项目中,{kind}:{choice}。+Couldn't change the approvals: 无法更改审批:+What the builder may do without asking you, in this project. 在这个项目中,构建助手无需问你就可以做的事。+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. 默认跟随自动模式:开启时,可撤销的操作会执行,其余的会被拒绝;关闭时,构建助手会询问。diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex c3ae49ca..12f6cffb 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -1445,3 +1445,20 @@ Bring all to front 將全部視窗移至最前Drag to give the plan more or less room; double-click to reset 拖曳以調整計畫佔用的空間;按兩下恢復預設Copy the message 複製這則訊息Choose what the builder's approvals get 選擇如何處理建置助手的審核+Reading the web 讀取網頁+Other commands 其他指令+Files outside the project 專案以外的檔案+Pushing and publishing 推送和發布+Deleting outside the project 在專案以外刪除+System changes 系統變更+Other tools 其他工具+Allow 允許+Ask 詢問+Refuse 拒絕+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. 在 /approvals 後輸入一個類別和 allow、ask、refuse 或 default,例如 /approvals publish ask。類別:{kinds}。+There's no kind called {name}. Kinds: {kinds}. 沒有名為 {name} 的類別。類別:{kinds}。+Approvals 審核+In this project, {kind}: {choice}. 在這個專案中,{kind}:{choice}。+Couldn't change the approvals: 無法變更審核:+What the builder may do without asking you, in this project. 在這個專案中,建置助手不必問你就可以做的事。+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. 預設跟隨自動模式:開啟時,可復原的操作會執行,其餘會被拒絕;關閉時,建置助手會詢問。diff --git a/crates/ui-egui/src/ja.tsv b/crates/ui-egui/src/ja.tsvindex a194af95..3ee2be28 100644--- a/crates/ui-egui/src/ja.tsv+++ b/crates/ui-egui/src/ja.tsv@@ -883,3 +883,20 @@ Bring all to front すべてを手前に移動Drag to give the plan more or less room; double-click to reset ドラッグでプランの高さを変更、ダブルクリックで元に戻すCopy the message メッセージをコピーChoose what the builder's approvals get ビルダーの承認の扱いを選ぶ+Reading the web Web の閲覧+Other commands その他のコマンド+Files outside the project プロジェクト外のファイル+Pushing and publishing プッシュと公開+Deleting outside the project プロジェクト外での削除+System changes システムの変更+Other tools その他のツール+Allow 許可+Ask 確認する+Refuse 拒否+After /approvals, type a kind and allow, ask, refuse or default, like /approvals publish ask. Kinds: {kinds}. /approvals の後ろに種類と allow、ask、refuse、default のどれかを入力してください(例: /approvals publish ask)。種類: {kinds}。+There's no kind called {name}. Kinds: {kinds}. {name} という種類はありません。種類: {kinds}。+Approvals 承認+In this project, {kind}: {choice}. このプロジェクトでは {kind}: {choice}。+Couldn't change the approvals: 承認を変更できませんでした:+What the builder may do without asking you, in this project. このプロジェクトでビルダーが確認なしにしてよいこと。+Default follows Auto mode: with it on, what can be undone goes ahead and the rest is refused; with it off, the builder asks. 既定は自動モードに従います。オンのときは元に戻せることは実行し、それ以外は拒否します。オフのときはビルダーが確認します。diff --git a/crates/ui-egui/src/just_ask.rs b/crates/ui-egui/src/just_ask.rsindex 54e7306d..a4f33b8f 100644--- a/crates/ui-egui/src/just_ask.rs+++ b/crates/ui-egui/src/just_ask.rs@@ -52,6 +52,8 @@ pub fn question_in(text: &str, just_ask: bool) -> Result<Option<String>, String>match slash::read(text) {Typed::Command(Command::Btw, "") => Err(tr("Type your question after /btw.")),Typed::Command(Command::Btw, question) => Ok(Some(question.to_string())),+ // Not a question: the prompt box hands it to `approvals::command_in` before asking here.+ Typed::Command(Command::Approvals, _) => Ok(None),Typed::Unknown(name) => Err(trf("There's no /{name} command. You can use {commands}.", &[("name", name), ("commands", &slash::names())])),Typed::Message => Ok(Some(text.trim()).filter(|t| just_ask && !t.is_empty()).map(str::to_string)),}diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 4fdfd218..04910f3a 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -7,6 +7,7 @@//! holding it never freezes a frame; the last snapshot ([`SessionView`]) is shown meanwhile.#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+pub mod approvals;pub mod builders;pub mod chat;pub mod demo;@@ -974,6 +975,7 @@ impl CraftApp {}self.toast(tr("Called done. A new message carries on from here."), false);}+ ("project_approvals_set", r) => self.approval_set(r),("project_questions_set", Ok(v)) => {// What was saved (the person's other changes on disk come along).if let Some(ws) = self.workspace.as_mut().filter(|w| v["project"].as_str().is_some_and(|p| w.root == std::path::Path::new(p))) {diff --git a/crates/ui-egui/src/project.rs b/crates/ui-egui/src/project.rsindex a3c46f11..e825cf1c 100644--- a/crates/ui-egui/src/project.rs+++ b/crates/ui-egui/src/project.rs@@ -1857,21 +1857,35 @@ fn composer(app: &mut CraftApp, ui: &mut Ui, width: f32, t: &Tokens) {app.pause();}if out.send {- // A question (the switch, or /btw) is answered without building.- match crate::just_ask::question_in(&app.state.project_input, app.state.just_ask) {- Ok(Some(q)) => {+ // /approvals changes a choice and sends nothing.+ match crate::approvals::command_in(&app.state.project_input) {+ Some(Ok((kind, choice))) => {app.state.project_input.clear();- app.ask_about_build(q);+ if let Some(root) = app.workspace.as_ref().map(|w| w.root.clone()) {+ app.set_approval(&root, kind, choice);+ }}- Ok(None) => app.send_message(),- // It stays in the box to be fixed.- Err(why) => app.toast(why, true),+ Some(Err(why)) => app.toast(why, true),+ None => send_or_ask(app),}}questions_switch(app, ui);});}+/// Send what's in the prompt box: a question (the switch, or /btw) is answered without building.+fn send_or_ask(app: &mut CraftApp) {+ match crate::just_ask::question_in(&app.state.project_input, app.state.just_ask) {+ Ok(Some(q)) => {+ app.state.project_input.clear();+ app.ask_about_build(q);+ }+ Ok(None) => app.send_message(),+ // It stays in the box to be fixed.+ Err(why) => app.toast(why, true),+ }+}+/// Under the prompt box: what sending does (ask for a change, or just ask about the build), and/// whether the builder's questions come to the person or it decides by itself, for this project/// (`project_questions_set`; it applies from its next question).@@ -1883,7 +1897,10 @@ fn questions_switch(app: &mut CraftApp, ui: &mut Ui) {ui.add_space(4.0);let (sending, asking) = (["Change it", "Just ask"], ["Ask me", "Decide yourself"]);let title = widgets::label_galley(ui, &tr(QUESTIONS_TITLE), theme::SMALL, t.text_dim).size().x;- let gaps = ui.spacing().item_spacing.x * 3.0;+ // The approvals menu's link, the space before it and one more item gap.+ let approvals = widgets::label_galley(ui, &tr("Approvals"), theme::BODY, t.text).size().x + 8.0;+ let gaps = ui.spacing().item_spacing.x * 4.0;+ let title = title + approvals;// Side by side when both switches fit, else one under the other (a longer language, a narrow window).let fits = widgets::segmented_width(ui, &sending) + widgets::segmented_width(ui, &asking) + title + gaps <= ui.available_width();let hint = |ui: &mut Ui| {@@ -1914,6 +1931,9 @@ const QUESTIONS_TITLE: &str = "Builder's questions:";fn questions_controls(app: &mut CraftApp, ui: &mut Ui, now: craft_anything_engine::workspace::Questions, root: &Path, t: &Tokens) {use craft_anything_engine::workspace::Questions;+ // Right to left: the approvals menu at the end of the row.+ crate::approvals::menu(app, ui, root);+ ui.add_space(8.0);{let sel = usize::from(now == Questions::Decide);if let Some(i) = widgets::segmented(ui, &["Ask me", "Decide yourself"], sel, 24.0) {diff --git a/crates/ui-egui/src/slash.rs b/crates/ui-egui/src/slash.rsindex 67726eef..3f200ab2 100644--- a/crates/ui-egui/src/slash.rs+++ b/crates/ui-egui/src/slash.rs@@ -6,10 +6,12 @@pub enum Command {/// Ask about the build without building (see `just_ask`).Btw,+ /// Choose what one kind of the builder's actions gets in this project (see `approvals`).+ Approvals,}/// Every command, by the name typed after the slash.-const COMMANDS: &[(&str, Command)] = &[("btw", Command::Btw)];+const COMMANDS: &[(&str, Command)] = &[("btw", Command::Btw), ("approvals", Command::Approvals)];/// How a message reads.#[derive(Debug, Clone, Copy, PartialEq, Eq)]@@ -36,7 +38,7 @@ pub fn read(text: &str) -> Typed<'_> {}}-/// The commands, to say what can be typed: "/btw".+/// The commands, to say what can be typed: "/btw, /approvals".pub fn names() -> String {COMMANDS.iter().map(|(n, _)| format!("/{n}")).collect::<Vec<_>>().join(", ")}@@ -73,6 +75,7 @@ mod tests {fn a_partial_name_completes_only_when_one_command_matches() {assert_eq!(complete("b"), Some("btw"));assert_eq!(complete("bt"), Some("btw"));+ assert_eq!(complete("ap"), Some("approvals"));assert_eq!(complete(""), None);assert_eq!(complete("x"), None);}diff --git a/crates/ui-egui/tests/headless_parity.rs b/crates/ui-egui/tests/headless_parity.rsindex 9af0db2f..7e4b64e7 100644--- a/crates/ui-egui/tests/headless_parity.rs+++ b/crates/ui-egui/tests/headless_parity.rs@@ -69,6 +69,7 @@ const ACTIONS: &[Action] = &[a("play", "play the built game or start the built app", Tool(&["project_play"])),a("ask_about_build", "a question about the build, answered without building", Tool(&["rebuild_question_ask"])),a("set_questions", "ask me, or let the builder decide its questions", Tool(&["project_questions_set"])),+ a("set_approval", "what one kind of builder action gets: allow, ask or refuse", Tool(&["project_approvals_set"])),a("ask_pin", "pin a build, frozen or light (its size first)", Tool(&["project_pin_create"])),a("refresh_pins", "the sidebar's pinned builds, and which run", Tool(&["project_pins_list"])),a("open_pin", "open a pinned build (or another copy)", Tool(&["project_pin_open"])),diff --git a/crates/ui-egui/tests/smoke.rs b/crates/ui-egui/tests/smoke.rsindex 1a2a5386..c9a63e22 100644--- a/crates/ui-egui/tests/smoke.rs+++ b/crates/ui-egui/tests/smoke.rs@@ -715,6 +715,76 @@ fn the_builders_questions_can_come_to_the_person_for_one_project() {assert!(h.state().settings.auto_mode, "Auto mode itself is unchanged");}+#[test]+fn approvals_are_chosen_from_the_prompt_box_and_its_menu() {+ use craft_anything_engine::workspace::{ActionKind, Approval, TargetRef, Workspace};+ let d = tempfile::tempdir().unwrap();+ let ws = Workspace::create(d.path(), "Notes", "A notes app", TargetRef::None).unwrap();+ let root = ws.root.clone();+ let mut h = harness(move || {+ let mut a = demo::app(demo::engine(Mode::Beginner, true));+ a.workspace = Some(ws);+ a.state.screen = Screen::Project;+ a+ });+ h.run_steps(2);+ let saved = |kind| Workspace::open(&root).unwrap().manifest.approvals.get(&kind).copied();+ let feed_before = h.state().state.feed.len();+ // /approvals changes one kind and sends nothing to the builder.+ h.state_mut().state.project_input = "/approvals push ask".into();+ h.run_steps(1);+ h.get_by_label("Send (Enter)").click();+ assert!(wait(&mut h, |_| saved(ActionKind::Publish) == Some(Approval::Ask)), "saved in the project");+ assert!(h.state().state.project_input.is_empty(), "the box is cleared");+ assert_eq!(h.state().state.feed.len(), feed_before, "nothing joined the build's conversation");+ assert!(!h.state().runs.is_busy(&root), "no build started");+ // One it can't read stays in the box to be fixed.+ h.state_mut().state.project_input = "/approvals push".into();+ h.run_steps(1);+ h.get_by_label("Send (Enter)").click();+ h.run_steps(2);+ assert_eq!(h.state().state.project_input, "/approvals push");+ h.state_mut().state.project_input.clear();+ // The messages those left sit over the row under the box, where a click lands.+ h.state_mut().state.toasts.clear();+ h.run_steps(2);+ // The menu under the box: one row per kind, and a click saves it.+ h.get_by_label("Approvals").click();+ h.run_steps(2);+ assert!(egui::Popup::is_id_open(&h.ctx, egui::Id::new("project-approvals")), "the menu opened");+ h.get_by_label("Reading the web");+ h.get_by_label("Pushing and publishing");+ let refuse = h.get_all_by_label("Refuse").count();+ assert_eq!(refuse, craft_anything_engine::workspace::ACTION_KINDS.len(), "a switch for every kind");+ h.get_all_by_label("Refuse").next().unwrap().click();+ assert!(wait(&mut h, |_| saved(ActionKind::Web) == Some(Approval::Refuse)), "the first row is the web");+ assert_eq!(saved(ActionKind::Publish), Some(Approval::Ask), "the other kinds keep theirs");+}++#[test]+fn an_approval_that_cant_be_saved_isnt_shown_as_chosen() {+ use craft_anything_engine::workspace::{TargetRef, Workspace};+ let d = tempfile::tempdir().unwrap();+ let ws = Workspace::create(d.path(), "Notes", "A notes app", TargetRef::None).unwrap();+ let file = ws.root.join("craft.json");+ let mut h = harness(move || {+ let mut a = demo::app(demo::engine(Mode::Beginner, true));+ a.workspace = Some(ws);+ a.state.screen = Screen::Project;+ a+ });+ h.run_steps(2);+ // A newer Craft Anything saved it meanwhile: this one only reads it, so the choice is refused.+ let newer = std::fs::read_to_string(&file).unwrap().replacen("\"version\": 3", "\"version\": 99", 1);+ assert!(newer.contains("\"version\": 99"));+ std::fs::write(&file, newer).unwrap();+ h.state_mut().state.project_input = "/approvals push allow".into();+ h.run_steps(1);+ h.get_by_label("Send (Enter)").click();+ assert!(wait(&mut h, |a| a.state.toasts.iter().any(|(t, _)| t.starts_with("Couldn't change the approvals:"))), "says it wasn't saved");+ assert!(h.state().workspace.as_ref().unwrap().manifest.approvals.is_empty(), "the menu shows what's kept, not what was asked");+}+#[test]fn a_question_about_the_build_is_answered_without_building() {use craft_anything_engine::workspace::{TargetRef, Workspace};diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex 880ee876..f937ac91 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -841,8 +841,11 @@ Gaps found while using the app for real projects.shell can't write them, or say plainly that "commands: allow" trusts the builder- [ ] A typed note ("yes, push it") still reaches the builder only as text: say in the card'splace, when the builder is refused, how the person can allow that kind-- [ ] The project page and a slash command change those choices (like `/btw`)+- [x] The project page and a slash command change those choices (like `/btw`): the Approvals+ menu under the prompt box and `/approvals <kind> <allow|ask|refuse|default>`— claimed: tanish2k09, branch feature/r2.9-approvals-ui+- [ ] The new approvals strings in every catalog were written with an AI; not reviewed by native+ speakers yet- [x] Keep New project's content column fixed while the vertical scrollbar animates in or out,hiding it when there is nothing to scroll, so switching tabs never shifts the page horizontally— claimed: Codex, branch bugfix/r2.9-home-scrollbar-gutterdiff --git a/docs/STATUS.md b/docs/STATUS.mdindex e78d3e3f..4fba3585 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -86,7 +86,7 @@ workspace clippy, layers, fmt and the secret scan of all history were clean. Chi| Backend context budgets | `context_tokens` in `[[ai.backends]]` controls when an API conversation is trimmed and summarised. Zero or omission retains local/cloud defaults; a nonzero conversation override takes priority. Before each attempt, including a fallback, fitting adds estimated history growth since the last successful request to its reported input size. Trimming resets that reference, and successful requests refresh it; summary usage remains in message totals | Regressions cover settings and model construction, defaults/overrides, smaller fallback budgets, large-budget arithmetic and new tool output growing beyond a fallback budget even when the history estimate alone is below the reported input. The latest tool results are preserved, and a short follow-up does not count already-sent history twice. This does not set server context parameters or guarantee that a complete request fits; no live provider was used || Games | Engine detection for 12 engines (Unreal, Unity, Godot, Source, GameMaker, RPG Maker, Ren'Py, MonoGame, LÖVE, CryEngine, Cocos, Cube) with versions. Unreal and Godot games are rebuilt in the same engine, others in Unity; installed engines are found, Godot installs itself, others get guided installs. Picking an inner folder (Engine, Binaries, Paks…) finds the game's folder. Just look inside a game shows what it's made of (`core_target_triage` on its folder: engine and version, how its code ships, the libraries its Unity assembly names give away, its own code, scenes and size) and opens it in the chat to ask about it. The builder keeps `app/MECHANICS.md` and its structured twin `app/mechanics.json` (checked after each build), in Deep mode only, may reuse the original's readable files for private use (never decrypting; generated pictures and 3D models replace its art when the person turns them on; Clean room copies none of its files), lists them in `CREDITS.md` (checked, with the private-use line in `README.md`); a game is ready only when its `--self-test` shows the player moving, acting and the HUD drawn, and the result can be started from the project page | Unit tests; live runs on Windows || Clean room and Deep mode | Clean room (the default) runs only the tools in `engine/src/clean_room.rs`: ones that touch no target or watch from outside (the website as a visitor sees it, pictures of a window, its controls, recorded runs, a phone's screen). Every other tool, a plugin's included, is refused in the app, CLI, MCP and agents, with a way to turn on Deep mode. A Clean room build studies an app or a game only from the person's pictures and words (and a picture of its window when runtime study is on); its builder's reads and commands go through an approval rule that keeps it out of the original's folder and site (with Claude Code, and with ACP agents for what they ask about; other agents aren't held to it, see roadmap R2.2). Deep mode (`deep_mode` in Settings, `--deep` for one CLI run) uses every tool: the builder sees them all, and a website's study also reads its JavaScript and watches its start page for ten seconds (capture/how-it-works.md). Ghidra adds its decompiler in Deep mode when it's installed: it is found, or installed after asking. Study starts one analysis of the main program, saved and shared with the builder's tool server through a lock file (up to 8 h, Java gets half the machine's memory or the amount set in Settings → Engines, 4 to 31 GB, four slow passes skipped). The builder must decompile before the build is checked; addresses the built-in analysis can't place go to Ghidra, which makes a function on demand (for this run only) where its analysis has none, e.g. code reached only through tables of pointers. Without Ghidra, Deep mode uses the built-in engines | Live runs with Ghidra 12.1.4 on Windows (a shared analysis, and a decompile in seconds on a large program). Live runs with Ghidra 12.2 on Linux x86-64 (decompiles by name in position-independent programs and shared libraries, whose addresses Ghidra moves). The guided install of Ghidra and its Java is offered on Linux and macOS too, but has only been tried on Windows. Clean room and Deep mode: engine, AI, MCP, CLI and app tests; no live Clean room build run yet |-| Auto mode | Settings → Safety, on by default. Builder actions go ahead without asking, except a fixed set that is never done unasked (deleting outside the project, system changes, publishing…); questions get "decide yourself"; asset spending stops at the budget. Each project can choose allow, ask or refuse per kind of action instead (`project_approvals_set`; read-only `gh … view`/`list` count as commands, not publishing); the app's controls for it aren't there yet | Unit tests |+| Auto mode | Settings → Safety, on by default. Builder actions go ahead without asking, except a fixed set that is never done unasked (deleting outside the project, system changes, publishing…); questions get "decide yourself"; asset spending stops at the budget. Each project can choose allow, ask or refuse per kind of action instead (`project_approvals_set`, the Approvals menu under the prompt box, or `/approvals publish ask`; read-only `gh … view`/`list` count as commands, not publishing) | Unit tests, UI tests; not tried in a live build || Generated assets | Off until the person turns them on for a game (the switch on Make and on the project, `project_assets_allow`, `rebuild --generate-assets`, saved in craft.json; turning it on without a fal.ai key asks for one); the brief and the asset tools need both that and a key. `assets_image_generate` (Nano Banana Pro by default) and `assets_model_generate` (picture → Tripo P1 low-poly GLB with a face limit) through the person's key for each asset provider (fal.ai today), with agent apps and API-key builds alike; per-project budget, $5 by default (`[assets] budget_usd` in config.toml); models and prices from the `assets.toml` table (picture model selectable: Nano Banana Pro, FLUX dev or schnell; priced per picture or per megapixel); every call reports its cost | Unit tests; a live 3D generation with a real key (picture, then model) with FLUX dev; Nano Banana Pro not yet run with a real key; an API-key build not yet run with one || Claude Code builder | Runs the person's own `claude` in headless mode (Opus 5.5, high effort unless configured) with our MCP server, a permission-prompt tool and `core_person_ask`; preflights for our CLI (a build stops plainly if it's missing or won't start) and sign-in | Argument and stream-parser tests; live preflight; live builder turns; see [claude-code.md](claude-code.md) || DeepSeek Harness builder | Runs the person's own `dsh --profile headless "<task>"`, which answers one task and prints its last message as text. The harness takes its tool servers from profile patch layers and has no per-run flag for one, so our tool server arrives as a generated `--patch` overlay for that run (the run's project, inbox and mode included); the person's own profile is untouched, a question gets no tool server, and its headless profile keeps no session to resume. An npm `.cmd` shim is unwrapped to its interpreter, so `dsh` found on PATH runs as `node …/dsh/lib/bin.js` | Adapter and YAML-overlay tests; live preflight (`ai test`); live builder turns on a website (follow-up build, 3 min 10 s, 100% alike at 1440/768/390 px, Ready) where the builder's own journal entries show `rebuild_check`, `core_unknown_add`, `core_plan_update` and `core_handoff_write` going through our tool server, and that server started with the run's `--project`/`--inbox`. Not checked: resume (none exists) and a build with the harness's desktop profile. Also verified on macOS arm64 (2026-11-07, DSH 0.2.2-rc.1, stored sign-in restored for the headless profile as its README describes): a static website reached Ready with one check pass, and the builder called our MCP tools |diff --git a/docs/pitfalls.md b/docs/pitfalls.mdindex 2420ac91..39ffe96a 100644--- a/docs/pitfalls.md+++ b/docs/pitfalls.md@@ -766,6 +766,10 @@ command that then wrote and ran a script: 10 minutes lost. Write the script withtool and run only `python -I <file>`.And twice more in one night, each time a `python -I - <<'X'` with an empty body typed as athrowaway step in a longer command. There is no safe use of `python -` here: never type it.+And again as the first step of a `sed` edit (`python -I - 2>/dev/null; sed …`): the command sat+for two minutes and the edit after it never ran. Make an edit with the editor tool, not a shell+line. The same session typed it once more, with `</dev/null` added, and that hung too: the habit+is the problem, not the input. Every Python step names a script file.**A search that ran no search.** `timeout 40 find … 2>/dev/null` on a Mac: there's no `timeout` there,the error went to `/dev/null`, and the empty result read as "no such files on this computer". Don't