feat: persist & restore per-project input mode (#14)

The input mode always started in simple; a learner who quit in advanced
had to re-toggle every launch. Store the mode per-project in project.yaml
(project.mode:, optional, default simple) and restore it on every open.

Mode is live UI state, not schema: the worker stamps the current mode
into project.yaml on every write, so a later command rewrites the live
value rather than clobbering it — no db round-trip needed. The mode is
persisted on unload (quit + project switch) so the mode you leave a
project in is always what reopens; the `mode` command also persists
immediately. A switch saves the outgoing mode, then restores the
incoming project's stored mode.

New --mode simple|advanced CLI flag (precedence --mode > stored >
simple; combines with --resume). A teacher can ship a project that
opens in advanced mode and export it to students (the mode travels in
the zip).

ADR-0015 Amendment 1; ADR-0003 note; help banner; requirements L1b.
This commit is contained in:
claude@clouddev1
2026-06-02 06:47:34 +00:00
parent ae57c6fc82
commit 4cd574b909
16 changed files with 769 additions and 14 deletions
+6 -2
View File
@@ -214,13 +214,17 @@ pub enum AppEvent {
},
/// A project switch (load / new / save-as / import)
/// succeeded. Carries the new display name, the temp
/// flag (drives the `[TEMP]` status-bar prefix), and the
/// flag (drives the `[TEMP]` status-bar prefix), the
/// seed entries for input-history hydration off the new
/// project's `history.log` (I2-persist, ADR-0015 §12).
/// project's `history.log` (I2-persist, ADR-0015 §12), and
/// the mode to restore for the switched-to project (its
/// stored mode, ADR-0015 mode-restore amendment, issue #14 —
/// "loading triggers the mode switch each time").
ProjectSwitched {
display_name: String,
is_temp: bool,
history_entries: Vec<String>,
mode: crate::mode::Mode,
},
/// A project switch failed in a non-fatal way (target
/// already exists, path unreadable, …). Surfaced as an