Skip to main content

chronicle/cli/
setup.rs

1use crate::error::chronicle_error::SetupSnafu;
2use crate::error::Result;
3use crate::setup::{SetupOptions, SetupReport};
4use snafu::ResultExt;
5
6pub fn run(
7    force: bool,
8    dry_run: bool,
9    skip_skills: bool,
10    skip_hooks: bool,
11    skip_claude_md: bool,
12) -> Result<()> {
13    let options = SetupOptions {
14        force,
15        dry_run,
16        skip_skills,
17        skip_hooks,
18        skip_claude_md,
19    };
20
21    let report = crate::setup::run_setup(&options).context(SetupSnafu)?;
22    print_report(&report, dry_run);
23    Ok(())
24}
25
26fn print_report(report: &SetupReport, dry_run: bool) {
27    if dry_run {
28        return;
29    }
30    eprintln!();
31    eprintln!("Chronicle setup complete!");
32    eprintln!();
33    eprintln!("  Provider:    {}", report.provider_type);
34    eprintln!("  Config:      {}", report.config_path.display());
35
36    if !report.skills_installed.is_empty() {
37        eprintln!(
38            "  Skills:      {}",
39            report.skills_installed[0].parent().unwrap().display()
40        );
41    }
42
43    for hook in &report.hooks_installed {
44        eprintln!("  Hook:        {}", hook.display());
45    }
46
47    if report.claude_md_updated {
48        eprintln!("  CLAUDE.md:   updated (Chronicle section added)");
49    }
50
51    eprintln!();
52    eprintln!("Next: cd your-project && git chronicle init");
53}