Skip to content

Setup

setup_crux

Crux setup — fresh install and migration from old layout.

Provides run_setup() which: 1. Creates the ~/.crux/ directory structure. 2. Writes config.toml with platform defaults. 3. Installs the bundled Crux skill to ~/.claude/skills/crux/SKILL.md. 4. Detects and reports missing external dependencies. 5. Optionally migrates data from the old marketplace/ repo layout.

LauncherInstallResult dataclass

LauncherInstallResult(installed=list())

Summary of shared launcher script installation.

SetupResult dataclass

SetupResult(dirs_created=list(), config_written=False, skill_installed=False, launchers=LauncherInstallResult(), missing_deps=list(), migration=None)

Collects everything run_setup did so callers can report it.

MigrationResult dataclass

MigrationResult(detected=False, mcps_copied=list(), skills_copied=list(), registry_entries=0)

Summary of what the migration step copied.

install_skill

install_skill(*, bundled_path=None, target_dir=None)

Copy the bundled Crux skill to the Claude skills directory.

Source code in src/crux_cli/setup_crux.py
def install_skill(
    *,
    bundled_path: Path | None = None,
    target_dir: Path | None = None,
) -> bool:
    """Copy the bundled Crux skill to the Claude skills directory."""
    src = bundled_path or _BUNDLED_SKILL
    dest_dir = target_dir or _claude_skill_dir()

    if not src.exists():
        return False

    dest_dir.mkdir(parents=True, exist_ok=True)
    shutil.copy2(src, dest_dir / "SKILL.md")
    return True

check_dependencies

check_dependencies()

Return a list of missing required tools.

Source code in src/crux_cli/setup_crux.py
def check_dependencies() -> list[str]:
    """Return a list of missing required tools."""
    import sys

    missing: list[str] = []

    if sys.version_info < MIN_PYTHON:
        missing.append(f"python>={MIN_PYTHON[0]}.{MIN_PYTHON[1]}")

    for tool in REQUIRED_TOOLS:
        if shutil.which(tool) is None:
            missing.append(tool)

    return missing

run_setup

run_setup(*, search_path=None, skill_target_dir=None, bundled_skill_path=None, launcher_target_dir=None, bundled_launcher_path=None)

Run the full Crux setup sequence.

Source code in src/crux_cli/setup_crux.py
def run_setup(
    *,
    search_path: Path | None = None,
    skill_target_dir: Path | None = None,
    bundled_skill_path: Path | None = None,
    launcher_target_dir: Path | None = None,
    bundled_launcher_path: Path | None = None,
) -> SetupResult:
    """Run the full Crux setup sequence."""
    result = SetupResult()

    _ensure_dirs(result)
    _ensure_config(result)

    result.skill_installed = install_skill(
        bundled_path=bundled_skill_path,
        target_dir=skill_target_dir,
    )

    _install_launchers(
        result,
        bundled_path=bundled_launcher_path,
        target_dir=launcher_target_dir,
    )

    result.missing_deps = check_dependencies()
    _migrate_old_layout(result, search_path=search_path)

    return result