use std::sync::OnceLock;
use clap::CommandFactory;
use crate::style;
use super::Cli;
pub(crate) fn build_cli() -> clap::Command {
let cmd = Cli::command();
cmd.override_help(help_template()).version(version_string())
}
static HELP_TEMPLATE: OnceLock<String> = OnceLock::new();
static VERSION_STRING: OnceLock<String> = OnceLock::new();
fn version_string() -> &'static str {
VERSION_STRING
.get_or_init(|| env!("CARGO_PKG_VERSION").to_owned())
.as_str()
}
fn help_template() -> &'static str {
HELP_TEMPLATE
.get_or_init(|| {
let start = style::pewter("START").to_string();
let use_ = style::pewter("USE").to_string();
let support = style::pewter("SUPPORT").to_string();
let more = format!(
"{} Run any command with --help for details · docs.difflore.dev",
style::emerald(style::sym::TIP),
);
format!(
"\
AI review memory for local coding agents.
Agents remember team judgment before they code, so reviews repeat less.
USAGE
difflore [COMMAND]
difflore {tip} show local memory status
{start}
try See it work on a bundled sample
init First-time setup for this repo
status Show local memory status and the next command
agents Wire local agents and inspect install state
cloud Log in, sync, and view team impact
providers Choose the local AI backend for fixes
embeddings Optional semantic search for better recall
import-reviews Draft local rules from past GitHub PR reviews
{use_}
recall Preview memories agents would see on this change
fix Preview/apply local patches, including PR diffs
ask Ask why the team usually reviews something
{support}
doctor Diagnose readiness and blockers
{more}
",
tip = style::emerald(style::sym::TIP),
)
})
.as_str()
}