Fix plan approval gate and add "Create a plan:" prefix for first message

- Fix build warnings: add #[allow(dead_code)] to unused deserialization fields
- Fix plan approval gate bug: block file changes when no plan exists (not just
  when plan exists but is unapproved)
- Add "Create a plan: " prefix to first user message in plan mode
- Add prepare_plan_mode_input() helper function for testability
- Reset is_first_plan_message flag when entering plan mode via /plan command
- Add tests for approval gate (no plan + no changes, no plan + changes)
- Add tests for prepare_plan_mode_input (happy, negative, boundary cases)
This commit is contained in:
Dhanji R. Prasanna
2026-02-05 19:43:38 +11:00
parent 06d75f613c
commit b2fbcf33d0
3 changed files with 149 additions and 7 deletions

View File

@@ -716,6 +716,7 @@ impl UiWriter for ConsoleUiWriter {
#[derive(serde::Deserialize)]
struct PlanCompact {
plan_id: String,
#[allow(dead_code)]
revision: u32,
approved_revision: Option<u32>,
items: Vec<PlanItemCompact>,
@@ -731,6 +732,7 @@ impl UiWriter for ConsoleUiWriter {
#[serde(default)]
evidence: Vec<String>,
#[serde(default)]
#[allow(dead_code)]
notes: Option<String>,
}
#[derive(serde::Deserialize)]