Skip to main content

oxibrain_cli/cmd/
entity_split.rs

1use oxibrain::Brain;
2use oxibrain::BrainConfig;
3use oxibrain_store::project::{Declaration, EntityRef};
4use std::path::Path;
5
6pub async fn run(dir: &Path, surface: &str, ty: &str, space: &str) -> anyhow::Result<()> {
7    let brain = Brain::open(BrainConfig::at(dir)).await?;
8    let space_id = brain.ensure_space(space).await?;
9    let decl = Declaration::Split {
10        entity: EntityRef {
11            surface: surface.to_string(),
12            ty: ty.to_string(),
13        },
14    };
15    let ep_id = brain.declare(&space_id, decl).await?;
16    println!("split as episode: {ep_id}");
17    Ok(())
18}