Skip to main content

construct/commands/
install.rs

1//! `construct install` — unified post-build install flow.
2//!
3//! Today only the `--sidecars-only` path is implemented: it provisions the
4//! Kumiho + Operator Python MCP sidecars under `~/.construct/`. The full
5//! install flow (prerequisite checks, onboard, dashboard launch) will migrate
6//! into this module over time; until then, `install.sh` / `setup.bat` remain
7//! canonical for a full install.
8
9use anyhow::{Result, anyhow};
10
11use crate::sidecars::{self, SidecarInstallOptions};
12
13/// Options for `construct install`.
14#[derive(Debug, Default, Clone)]
15pub struct InstallOptions {
16    /// Install only the Python MCP sidecars (Kumiho + Operator).
17    pub sidecars_only: bool,
18    /// Skip installing the Kumiho sidecar.
19    pub skip_kumiho: bool,
20    /// Skip installing the Operator sidecar.
21    pub skip_operator: bool,
22    /// Print what would be done without executing.
23    pub dry_run: bool,
24    /// Optional explicit Python interpreter.
25    pub python: Option<String>,
26}
27
28/// Run the install command with the given options.
29pub async fn run(opts: InstallOptions) -> Result<()> {
30    if !opts.sidecars_only {
31        return Err(anyhow!(
32            "Full install is not yet implemented as a Rust subcommand.\n\
33             Use one of:\n  \
34               construct install --sidecars-only    # install Kumiho + Operator Python MCP sidecars\n  \
35               ./install.sh                         # full POSIX install (source build + sidecars + onboard)\n  \
36               setup.bat                            # full Windows install"
37        ));
38    }
39
40    sidecars::install_sidecars(&SidecarInstallOptions {
41        skip_kumiho: opts.skip_kumiho,
42        skip_operator: opts.skip_operator,
43        dry_run: opts.dry_run,
44        python: opts.python,
45    })
46    .await
47}