use context_forge::{kind, Config, ContextForge, SaveOptions};
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), context_forge::Error> {
let mut config = Config::default();
config.db_path = PathBuf::from("basic-example.db");
let cf = ContextForge::open(config).await?;
let opts = SaveOptions {
scope: Some("project:demo".to_owned()),
..SaveOptions::default()
};
cf.save(
"the deploy failure was caused by a missing env var",
kind::SNAPSHOT,
&opts,
)
.await?;
let hits = cf
.query("deploy failure", Some("project:demo"), 2048)
.await?;
for hit in &hits {
println!("{}: {}", hit.id, hit.content);
}
Ok(())
}