shepherd-cli 6.6.0

The canonical shepherd command-line interface over the per-project registry, run artifacts, and sprint pipeline.
/*
    Appellation: cmd <module>
    Created At: 2026.08.12:15:10:28
    Contrib: @FL03
*/
#[doc(inline)]
pub use self::prelude::*;

pub mod bootstrap;
pub mod candidate;
pub mod compile;
pub mod coordination;
pub mod dispatch;
mod eval_manifest;
pub mod execution;
pub mod guard;
mod harness_evidence;
mod harness_matrix;
pub mod hook;
pub mod knowledge;
pub mod lock;
pub mod mem;
pub mod models;
pub mod planning;
pub mod run;
pub mod seed;
pub mod status;

mod native_broker;
mod native_hook;
mod transport_bind;

pub(crate) mod prelude {
    pub use super::ShepherdCommand;
    pub use super::bootstrap::{ConfigCmd, DoctorCmd, HomeCmd, InitCmd};
    pub use super::candidate::CandidateCmd;
    pub use super::compile::CompileCmd;
    pub use super::coordination::{SignalCmd, SyncCmd, TeammateCmd, WorktreeCmd};
    pub use super::dispatch::DispatchCmd;
    pub use super::execution::{DeliverableCmd, IssuesCmd, LintCmd, ReadyCmd, SprintCmd};
    pub use super::guard::GuardCmd;
    pub use super::hook::HookCmd;
    pub use super::knowledge::{DupsCmd, EvalCmd, ExportCmd, InsightsCmd, QueryCmd, SearchCmd};
    pub use super::lock::LockCmd;
    pub use super::mem::MemCmd;
    pub use super::models::ModelsCmd;
    pub use super::planning::{
        AuditCmd, CloseLaneCmd, DiscoveryCmd, GraphCmd, PlanCmd, RenderCmd, ReportCmd,
    };
    pub use super::run::RunCmd;
    pub use super::seed::SeedCmd;
    pub use super::status::{HandoffCmd, StatusCmd};
    pub use crate::migrate::MigrateCmd;
}

#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, clap::Subcommand)]
pub enum ShepherdCommand {
    /// Freeze and attest an exact product candidate through native run custody.
    Candidate(CandidateCmd),
    /// Inspect the canonical audit artifacts for one run.
    Audit(AuditCmd),
    /// Compile canonical roles and skills for one harness.
    Compile(CompileCmd),
    /// Translate one host's hook envelopes through the canonical native engine.
    Hook(HookCmd),
    /// Close one canonical run lane through the typed run ledger.
    CloseLane(CloseLaneCmd),
    /// Inspect or initialize the canonical typed project configuration.
    Config(ConfigCmd),
    Dispatch(DispatchCmd),
    /// Inspect the canonical discovery artifacts for one run.
    Discovery(DiscoveryCmd),
    /// Diagnose the canonical project, registry, and layout-v5 namespace.
    Doctor(DoctorCmd),
    /// Record canonical deliverable lifecycle facts.
    Deliverable(DeliverableCmd),
    /// Inspect canonical duplicate declarations and registry shapes.
    Dups(DupsCmd),
    /// Inspect recorded evaluation results without invoking a second engine.
    Eval(EvalCmd),
    /// Export canonical typed registry views through stdout.
    Export(ExportCmd),
    Guard(GuardCmd),
    /// Inspect canonical run topology without recreating retired graph state.
    Graph(GraphCmd),
    /// Inspect canonical handoff artifacts in the active project.
    Handoff(HandoffCmd),
    /// Initialize the canonical layout-v5 project namespace.
    Init(InitCmd),
    /// Inspect immutable insights from the flat canonical docs root.
    Insights(InsightsCmd),
    /// Inspect the canonical issue ledger.
    Issues(IssuesCmd),
    /// Run deterministic native lint checks.
    Lint(LintCmd),
    /// Manage the canonical project coordination lock.
    Lock(LockCmd),
    /// Inspect or initialize the separately-owned Shepherd user home.
    Home(HomeCmd),
    /// Plan or apply the canonical layout-v5 namespace migration.
    Migrate(MigrateCmd),
    /// Manage canonical project memory in the typed registry.
    Mem(MemCmd),
    /// Inspect or resolve the canonical model map.
    Models(ModelsCmd),
    /// Inspect and verify one canonical run plan.
    Plan(PlanCmd),
    /// Run an allowlisted typed registry query.
    Query(QueryCmd),
    /// Render one canonical template without a legacy interpreter.
    Render(RenderCmd),
    /// Evaluate canonical sprint readiness.
    Ready(ReadyCmd),
    /// Inspect canonical run reports.
    Report(ReportCmd),
    /// Report canonical project and run status without mutating state.
    Status(StatusCmd),
    /// Search canonical symbols and artifacts through the typed registry.
    Search(SearchCmd),
    /// Verify a seed deterministically before plan engineering begins.
    Seed(SeedCmd),
    /// Exchange durable cross-session signals through the typed registry.
    Signal(SignalCmd),
    /// Manage the canonical sprint lifecycle.
    Sprint(SprintCmd),
    /// Run the native context refresh pipeline.
    Sync(SyncCmd),
    /// Inspect teammate liveness, status, and declared state.
    Teammate(TeammateCmd),
    /// Own the canonical run lifecycle and lane/wave ledger.
    Run(RunCmd),
    /// Manage the native git worktree lifecycle.
    Worktree(WorktreeCmd),
    /// Reject removed legacy commands at the one canonical CLI boundary.
    #[command(external_subcommand)]
    Unsupported(Vec<String>),
}

impl ShepherdCommand {
    pub(crate) fn run(
        self,
        globals: crate::interface::CliGlobals,
    ) -> Result<(), crate::interface::CliError> {
        match self {
            Self::Candidate(command) => command.run(globals),
            Self::Audit(command) => command.run(globals),
            Self::Compile(command) => command.run(),
            Self::Hook(command) => command.run(globals),
            Self::CloseLane(command) => command.run(globals),
            Self::Config(command) => command.run(globals),
            Self::Dispatch(command) => command.run(globals),
            Self::Discovery(command) => command.run(globals),
            Self::Deliverable(command) => command.run(globals),
            Self::Doctor(command) => command.run(globals),
            Self::Dups(command) => command.run(globals),
            Self::Eval(command) => command.run(globals),
            Self::Export(command) => command.run(globals),
            Self::Guard(command) => command.run(),
            Self::Graph(command) => command.run(globals),
            Self::Handoff(command) => command.run(globals),
            Self::Init(command) => command.run(globals),
            Self::Insights(command) => command.run(globals),
            Self::Issues(command) => command.run(globals),
            Self::Lint(command) => command.run(globals),
            Self::Home(command) => command.run(globals),
            Self::Lock(command) => command.run(globals),
            Self::Migrate(command) => command.run(globals),
            Self::Mem(command) => command.run(globals),
            Self::Models(command) => command.run(globals),
            Self::Plan(command) => command.run(globals),
            Self::Query(command) => command.run(globals),
            Self::Render(command) => command.run(globals),
            Self::Ready(command) => command.run(globals),
            Self::Report(command) => command.run(globals),
            Self::Status(command) => command.run(globals),
            Self::Search(command) => command.run(globals),
            Self::Seed(command) => command.run(),
            Self::Signal(command) => command.run(globals),
            Self::Sprint(command) => command.run(globals),
            Self::Sync(command) => command.run(globals),
            Self::Teammate(command) => command.run(globals),
            Self::Run(command) => command.run(globals),
            Self::Worktree(command) => command.run(globals),
            Self::Unsupported(arguments) => {
                let command = arguments.first().map(String::as_str).unwrap_or("<empty>");
                Err(crate::interface::CliError::message(format!(
                    "command `{command}` is unavailable in the canonical Rust CLI; legacy Python, Bash, and Node command authorities are retired"
                )))
            }
        }
    }
}