Add dev demo seed for busy HUD previews
tessera-demo crate, seed-demo CLI, TESSERA_SEED_DEMO hub hook, 12 orbits and 30 historical snapshots.
This commit is contained in:
@@ -11,6 +11,7 @@ path = "src/main.rs"
|
||||
[dependencies]
|
||||
tessera-core = { path = "../tessera-core" }
|
||||
tessera-store = { path = "../tessera-store" }
|
||||
tessera-demo = { path = "../tessera-demo" }
|
||||
tessera-providers = { path = "../tessera-providers" }
|
||||
anyhow.workspace = true
|
||||
clap.workspace = true
|
||||
|
||||
@@ -50,6 +50,15 @@ enum Commands {
|
||||
#[command(subcommand)]
|
||||
cmd: WormholeCmd,
|
||||
},
|
||||
/// Dev-only: populate demo orbits and snapshot history for UI previews.
|
||||
SeedDemo {
|
||||
/// Replace existing demo seed data.
|
||||
#[arg(long)]
|
||||
force: bool,
|
||||
/// Remove demo data (orbits/snapshots marker) only.
|
||||
#[arg(long)]
|
||||
reset: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Clone)]
|
||||
@@ -84,6 +93,29 @@ fn main() -> Result<()> {
|
||||
Commands::Wormhole { ref cmd } => match cmd {
|
||||
WormholeCmd::Pair { code, name } => wormhole_pair(&cli, code, name)?,
|
||||
},
|
||||
Commands::SeedDemo { force, reset } => cmd_seed_demo(&cli, force, reset)?,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn cmd_seed_demo(cli: &Cli, force: bool, reset: bool) -> Result<()> {
|
||||
let data = std::path::Path::new(&cli.data_dir);
|
||||
if reset {
|
||||
tessera_demo::clear_demo(data, &cli.vault_pass)?;
|
||||
println!("Demo seed cleared.");
|
||||
return Ok(());
|
||||
}
|
||||
let report = tessera_demo::apply(data, &cli.vault_pass, force)?;
|
||||
if report.skipped {
|
||||
println!(
|
||||
"Demo seed already applied ({} orbits, {} snapshots). Use --force to re-seed.",
|
||||
report.orbits, report.snapshots
|
||||
);
|
||||
} else {
|
||||
println!(
|
||||
"Demo seed complete: {} orbits, {} snapshots, {} outposts.",
|
||||
report.orbits, report.snapshots, report.outposts
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user