opys_engine/commands/
init.rs1use crate::error::Result;
2use crate::project::start_dir;
3use crate::project_config::DEFAULT_BASE;
4use crate::templates::{CLAUDE_MD_SNIPPET, DEFAULT_OPYS_CONFIG};
5use crate::Ctx;
6
7pub fn run(ctx: &Ctx) -> Result<()> {
8 let root = start_dir(&ctx.root)?;
9 std::fs::create_dir_all(&root)?;
10
11 let cfg = root.join("opys.toml");
12 if cfg.exists() {
13 println!("{} already exists; leaving it untouched", cfg.display());
14 } else {
15 std::fs::write(&cfg, DEFAULT_OPYS_CONFIG)?;
16 println!(
17 "created {} — edit it to model your document types",
18 cfg.display()
19 );
20 }
21
22 std::fs::create_dir_all(root.join(DEFAULT_BASE))?;
24
25 println!("\nAdd this to your CLAUDE.md / agent instructions:\n");
26 println!("{CLAUDE_MD_SNIPPET}");
27 Ok(())
28}