/**
 * Bun + shadcn Application Scaffolder
 *
 * Produces a ready-to-code Vite + React + TypeScript + Tailwind +
 * shadcn project tree at a given repository path, running entirely
 * inside the Shep process — not inside an agent turn. This is the
 * replacement for the old workflow "scaffold" agent step, which had
 * three recurring failure modes:
 *
 *   1. `bunx shadcn init --template vite` creates a child project
 *      directory even with `--yes`, and a bash flatten one-liner run
 *      from the agent turn was fragile and sometimes skipped.
 *   2. `bun` might not be on PATH on a first-ever run, and bootstrap
 *      inside the agent turn consumed tool calls and thinking tokens.
 *   3. `bun add` for the app-specific extras had to be explicitly
 *      asked for in the prompt — agents sometimes skipped it.
 *
 * This adapter makes the scaffold deterministic by doing all four
 * phases in code with real process calls and real `fs.renameSync`:
 *
 *   Phase 1 — Bootstrap bun:
 *     `bun --version` and, on failure, `npm install -g bun`. This
 *     runs at most once per Shep installation (subsequent scaffolds
 *     hit Phase 1 in microseconds because `bun --version` succeeds).
 *
 *   Phase 2 — Scaffold the base project:
 *     `bunx --bun shadcn@latest init --preset b0 --base base
 *     --template vite --yes` run with `cwd = repositoryPath`. shadcn
 *     chooses a child directory name and drops a complete project
 *     there.
 *
 *   Phase 3 — Flatten:
 *     `flattenSingleChildProject(repositoryPath)` moves the child's
 *     contents up and removes the empty shell. After this step,
 *     `repositoryPath/package.json` is guaranteed.
 *
 *   Phase 4 — Install app-specific extras:
 *     `bun add react-router-dom react-hook-form zod lucide-react`
 *     in a single call. Matches the set the "components" prompt
 *     expects to be available.
 *
 *   Phase 5 — Fat-template overlay:
 *     Copies every file under
 *     `packages/core/src/infrastructure/templates/vite-shadcn-base/`
 *     on top of the scaffolded project. Ships the dark-mode palette,
 *     pre-built `src/components/common/*` pieces (Avatar, StatusDot,
 *     Badge, EmptyState, LoadingSpinner, ErrorBoundary, BottomNav,
 *     TopBar, IconButton, SectionHeader), the `src/lib/*` helpers
 *     (theme, format, mock), `src/types/common.ts`, and `TEMPLATE.md`
 *     at the project root. Eliminates per-app re-invention of
 *     palette, types, and leaf components.
 */
import type { IApplicationScaffolder, ScaffoldOptions, ScaffoldResult } from '../../../application/ports/output/services/application-scaffolder.interface.js';
export declare class BunShadcnScaffolder implements IApplicationScaffolder {
    scaffold(options: ScaffoldOptions): Promise<ScaffoldResult>;
    /**
     * Check `bun --version`. On failure, install bun globally via
     * `npm install -g bun` and verify again. Runs synchronously because
     * the whole scaffold pipeline must block on a working bun.
     */
    private ensureBunOnPath;
    /**
     * Remove every entry inside `dirPath` without removing the directory
     * itself. Idempotent and cross-platform — uses `fs.rmSync(..., {
     * recursive, force })` per entry instead of `fs.rm` on the parent so
     * we don't delete the directory the caller is about to write into.
     *
     * Called before moving the scaffolded output from the temp scratch
     * directory so the target path starts clean. Anything
     * `FsProjectScaffoldService` pre-created (currently a `.git/`
     * directory + first commit) is wiped — the workflow `commit` step
     * re-initializes git itself, so nothing downstream depends on the
     * pre-existing repo.
     */
    /** Absolute path to the versioned scaffold cache directory. */
    private getCacheDir;
    /** True when the cache directory contains a valid `package.json`. */
    private isCacheValid;
    /**
     * Persist scaffold source files to the cache, skipping `node_modules`
     * and `.git` — only source files and the lockfile are needed.
     */
    private saveToCache;
    /**
     * Recursively copy every entry from `srcDir` to `destDir`,
     * skipping entries listed in `CACHE_SKIP`.
     */
    private copyDirectory;
    private emptyDirectory;
    /**
     * Resolve the directory inside `scratchDir` that actually contains
     * the scaffolded project. Handles both layouts shadcn might produce:
     *
     *   1. FLAT — `scratchDir/package.json` exists. Return `scratchDir`.
     *   2. SUBDIR — exactly one child directory under `scratchDir`
     *      contains `package.json`. Return that child.
     *
     * Throws with a clear message when the layout is ambiguous (no
     * `package.json` anywhere, or multiple candidate children) so we
     * don't silently ship a broken scaffold into the user's project.
     */
    private findScaffoldRoot;
    /**
     * Move every entry from `srcDir` into `destDir`, preserving dotfiles.
     * `destDir` must be empty (call `emptyDirectory` first). Uses
     * `fs.renameSync` so the move is atomic on POSIX and cheap on
     * Windows — source and destination live on the same filesystem
     * (both under `/tmp` and the Shep home dir, which are usually the
     * same mount point).
     *
     * If rename fails with EXDEV (cross-device), falls back to a
     * recursive copy + delete so the adapter still works when `/tmp`
     * is on a different filesystem than the Shep home directory
     * (common on Linux where `/tmp` is often `tmpfs`).
     */
    private moveDirectoryContents;
    private hasBun;
    /**
     * Run a command to completion. Pipes stdout/stderr so progress lines
     * can be tee'd to both the parent process's stdout/stderr (so the
     * dev server log still shows live progress) AND to `onLog` (so the
     * UI's operation-log drawer streams the same content).
     *
     * When `stdinInput` is set, a piped stdin is attached and the string
     * is written to it up front, then closed — used as a safety net for
     * interactive prompts that slip past `--yes`.
     *
     * When `timeoutMs` is set, the child is killed with SIGKILL (or
     * taskkill on Windows) if it hasn't exited before the deadline.
     * This is a hard ceiling: any hang — stuck interactive prompt,
     * network stall inside `bunx`, broken registry mirror — fails the
     * scaffold loudly instead of wedging the Shep process forever.
     *
     * Throws on non-zero exit, spawn error, or timeout.
     */
    private runSpawn;
}
//# sourceMappingURL=bun-shadcn-scaffolder.service.d.ts.map