From c3b361c45ac8dd898d5c83a161abed5fc138b6c0 Mon Sep 17 00:00:00 2001 From: Doan Luu Duc Tai Date: Fri, 30 Oct 2026 22:12:54 -0500 Subject: Refine chat controls and add explicit owner recovery reset Simplify the ASCII interface, expose owner setup, and load any selected number of messages using bounded history batches. Add backend-only owner reset with a matching public fingerprint and stopped-service guards, and document the loss of old history and key continuity. --- src/main.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 08c88f5..4c528da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,8 +51,17 @@ struct Cli { enum Action { #[command(about = "Run the experimental local chat or initialize its single .env")] Chat { - #[arg(long)] + #[arg(long, conflicts_with_all = ["reset_owner", "owner_fingerprint"])] init: bool, + #[arg( + long, + value_name = "FINGERPRINT", + conflicts_with = "owner_fingerprint", + help = "Permanently clear owner registration and chat history after key loss" + )] + reset_owner: Option, + #[arg(long, help = "Print the registered owner's public fingerprint")] + owner_fingerprint: bool, }, #[command(about = "Start the local development services")] Dev { @@ -132,7 +141,12 @@ fn execute(arguments: Cli) -> Result<()> { return archive::restore(&absolute(archive)?, &absolute(destination)?); } let project = Project::discover(arguments.root.as_deref())?; - if let Action::Chat { init } = arguments.command { + if let Action::Chat { + init, + reset_owner, + owner_fingerprint, + } = arguments.command + { let mut command = project.command("cargo")?; command .args(["run", "--locked", "-p", "stack-chat-server", "--", "--root"]) @@ -140,6 +154,12 @@ fn execute(arguments: Cli) -> Result<()> { if init { command.arg("--init"); } + if let Some(fingerprint) = reset_owner { + command.arg("--reset-owner").arg(fingerprint); + } + if owner_fingerprint { + command.arg("--owner-fingerprint"); + } return process::run(&mut command); } let _operation = project.lock()?; -- cgit v1.2.3