/**
 * olam setup — substrate-aware fresh-host wizard.
 *
 * Phase C2 of olam-operator-onboarding-parity (plan
 * ~/.claude/plans/olam-operator-onboarding-parity.md).
 *
 * Substrate-aware orchestration. Default substrate = kubernetes (k3d on all
 * platforms — macOS and Linux alike). Existing installs whose ~/.olam/config.json
 * carries host.substrate: 'compose' are protected — they continue on docker/compose
 * and see a one-line migration hint; no auto-migration.
 *
 * Kubernetes substrate phases (default for fresh installs):
 *   Phase 1:   System check     (kubectl on PATH + docker daemon + Node ≥20)
 *   Phase 1.5: Install k3d      (brew install k3d when available; else upstream install.sh)
 *   Phase 2:   olam CLI sanity  (--version returns)
 *   Phase 2.5: Provision cluster (k3d cluster create olam-dev; k3d updates ~/.kube/config)
 *   Phase 2.6: Pin kubectl context (writes host.kubectl_context_pinned = k3d-olam-dev)
 *   Phase 3:   Bootstrap        (subprocess: olam bootstrap with kubernetes substrate)
 *   …        same as docker thereafter
 *
 * Docker substrate phases (existing compose installs or --substrate=docker):
 *   Phase 1:   System check     (Docker daemon reachable + Node ≥20)
 *   Phase 1.5: (no-op for docker)
 *   Phase 2:   olam CLI sanity  (--version returns)
 *   Phase 2.5: (no-op for docker)
 *   Phase 3:   Bootstrap        (subprocess: olam bootstrap)
 *   Phase 4:   Shell init       (idempotent append of completion eval-line)
 *   Phase 5:   Init project     (offer `olam init` if .olam/config.yaml missing)
 *   Phase 5a:  Skill source picker
 *   Phase 5b:  Project sweep
 *   Phase 6:   Auth prompt      (offer interactive `olam auth login`)
 *   Phase 7:   Final verify     (subprocess: olam doctor; halt on non-zero)
 *
 * End-state prints "next steps" pointing at the 3-contract docs per
 * CLAUDE.md's "Reading order for new orgs."
 *
 * Failure semantics: setup fails fast at the first failed phase + prints
 * a named remedy. All phases are idempotent so re-running is safe.
 *
 * Flags:
 *   --substrate=<docker|kubernetes>  substrate to target (default: kubernetes; alias k3s→kubernetes)
 *   --cluster-name=<name>            k3d cluster name (default: olam-dev). Useful for operators with
 *                                    pre-existing clusters or running multiple olam stacks side-by-side.
 *   --skip-shell-init                skip Phase 4 (operator manages shell rc manually)
 *   --skip-auth                      skip Phase 6 (operator will run `olam auth login` later)
 *   --yes / -y                       auto-affirm every prompt (non-interactive)
 *
 * Reversibility: clean-revert; each phase delegates to a separately-
 * tested primitive. Phase 4 keeps a `<rc>.olam-bak.<ts>` backup.
 */
import type { Command } from 'commander';
import { type DockerExec } from '../lib/health-probes.js';
import { type KubeContextDeps, type KubeContextProbe } from '../lib/k8s-context-discovery.js';
import { type AddSkillSourceFn, type CloneSkillSourceFn, type AppendTrustAuditFn, type RedactUrlFn, type SelectPromptFn, type InputPromptFn } from './setup-phase-5a-skill-source.js';
/** k3d cluster name provisioned by olam setup --substrate=kubernetes. */
export declare const SETUP_K3D_CLUSTER_NAME = "olam-dev";
/** Exported type so callers can reference the substrate union. */
export type SetupSubstrate = 'docker' | 'kubernetes';
export interface RunSetupOptions {
    readonly skipShellInit?: boolean;
    readonly skipAuth?: boolean;
    readonly yes?: boolean;
    readonly skipSkillSource?: boolean;
    readonly skipProjectSweep?: boolean;
    /** Non-interactive skill-source selection: a curated name/value or a git URL. */
    readonly skillSource?: string;
    /** Phase 5b: project root path to walk (default: ~/Projects). */
    readonly projects?: string;
    /** Phase 5b: print matches without registering or building (no side effects). */
    readonly dryRun?: boolean;
    /** Phase 5b: additional skip patterns for the walker (additive to defaults). */
    readonly exclude?: string[];
    /** Phase 5b: skip KG eager-build sub-step (sources still registered). */
    readonly skipKg?: boolean;
    /**
     * Substrate to target. Default: 'kubernetes' for fresh installs;
     * auto-detected from ~/.olam/config.json when present. Existing installs
     * with host.substrate='compose' in config stay on docker and see a migration
     * hint. Explicit --substrate=kubernetes (or alias --substrate=k3s) targets
     * the k3d path. --substrate=docker forces docker even on fresh machines.
     */
    readonly substrate?: SetupSubstrate;
    /**
     * k3d cluster name to create/use (kubernetes substrate only).
     * Default: SETUP_K3D_CLUSTER_NAME ('olam-dev').
     * Use a different name to avoid colliding with a pre-existing olam-dev cluster
     * or to run multiple olam stacks side-by-side on the same machine.
     * Ignored when --substrate=docker.
     * Must match DNS-label rules: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$
     */
    readonly clusterName?: string;
    /**
     * Phase 7: skip final `olam doctor` verification.
     * Useful in CI where doctor probes expect a fully-wired production stack
     * (credentials, docker-socket-proxy, etc.) that is not present in the
     * smoke-test environment. The real stack health is verified by the
     * subsequent `kubectl wait deployment --all` and `curl /health` steps.
     */
    readonly skipDoctor?: boolean;
    /**
     * Phase 0.5 (ADR 021): reuse an existing kubeconfig context instead of
     * provisioning a new k3d cluster. When set, Phase 1.5 (k3d install) and
     * Phase 2.5 (cluster provision) are skipped. Phase 2.6 pins to this context.
     * Pair with --substrate=kubernetes. Operator owns lifecycle (teardown not
     * handled by olam setup).
     */
    readonly reuseCluster?: string;
}
export type SpawnSubprocess = (cmd: string, args: ReadonlyArray<string>) => Promise<{
    readonly status: number | null;
}>;
export type PromptYesNo = (question: string, defaultYes: boolean) => Promise<boolean>;
export interface RunSetupDeps {
    readonly dockerExec?: DockerExec;
    readonly spawnSubprocess?: SpawnSubprocess;
    readonly prompt?: PromptYesNo;
    readonly home?: string;
    readonly cwd?: string;
    readonly shellEnv?: string | undefined;
    readonly nodeVersion?: string;
    readonly olamCliVersion?: string;
    readonly clock?: () => Date;
    readonly addSkillSourceFn?: AddSkillSourceFn;
    readonly cloneSkillSourceFn?: CloneSkillSourceFn;
    readonly appendTrustAuditFn?: AppendTrustAuditFn;
    readonly redactUrlFn?: RedactUrlFn;
    readonly selectPromptFn?: SelectPromptFn;
    readonly inputPromptFn?: InputPromptFn;
    /**
     * Injectable platform detection.
     * Default: os.platform(). Inject 'darwin' | 'linux' in tests.
     */
    readonly osPlatform?: NodeJS.Platform;
    /**
     * Override config path for substrate auto-detection.
     * Default: ~/.olam/config.json. Inject in tests to pin substrate.
     */
    readonly configPath?: string;
    /**
     * Injectable kubeconfig context discovery deps (Phase 0.5).
     * Default: real kubectl-based implementations in k8s-context-discovery.ts.
     */
    readonly kubeContextDeps?: KubeContextDeps;
    /**
     * Injectable cluster-info probe used when --reuse-cluster=<name> is passed.
     * Default: defaultClusterInfo from k8s-context-discovery.ts.
     */
    readonly kubectlClusterInfo?: (context: string) => KubeContextProbe;
}
export interface PhaseResult {
    readonly ok: boolean;
    readonly skipped?: boolean;
    readonly message: string;
    readonly remedy?: string;
}
export interface SetupReport {
    readonly phases: ReadonlyArray<{
        name: string;
        result: PhaseResult;
    }>;
    readonly failureAt: number | null;
    readonly exitCode: number;
}
/**
 * Validate the --cluster-name value.
 * Returns an error message when invalid, or null when valid.
 */
export declare function validateClusterName(name: string): string | null;
/** Migration hint printed once when an existing docker/compose install is detected. */
export declare const DOCKER_MIGRATION_HINT: string;
export declare function runSetup(opts: RunSetupOptions, deps?: RunSetupDeps): Promise<SetupReport>;
export declare function registerSetup(program: Command): void;
//# sourceMappingURL=setup.d.ts.map