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
34    if !report.skills_installed.is_empty() {
35        eprintln!(
36            "  Skills:      {}",
37            report.skills_installed[0]
38                .parent()
39                .expect("skill path always has parent")
40                .display()
41        );
42    }
43
44    for hook in &report.hooks_installed {
45        eprintln!("  Hook:        {}", hook.display());
46    }
47
48    if report.claude_md_updated {
49        eprintln!("  CLAUDE.md:   updated (Chronicle section added)");
50    }
51
52    eprintln!();
53    eprintln!("Next: cd your-project && git chronicle init");
54}