aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDoan Luu Duc Tai <doan@luuduct.ai>2026-10-30 22:12:54 -0500
committerDoan Luu Duc Tai <doan@luuduct.ai>2026-10-30 22:12:54 -0500
commitc3b361c45ac8dd898d5c83a161abed5fc138b6c0 (patch)
tree3eeabb31508f98a6753a2492238581f888769b4a /src/main.rs
parent3034705b6679bff1802c4180b7b4711b94fed7f9 (diff)
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.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs24
1 files changed, 22 insertions, 2 deletions
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<String>,
+ #[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()?;