Repository navigation
11 Install Flow
croft install is the project-bootstrap surface: a teammate
clones the repo, runs one command, and gets a working dev
environment. You define an ordered list of steps once; croft runs
them with progress display, remembers what succeeded, and resumes
where it left off if something fails.
1. Drop a step file in .croft/install/:
# .croft/install/10-deps.sh
#!/usr/bin/env bash
# @desc: Install dependencies
set -euo pipefail
composer install
npm ciNumeric prefix sets order; the description shows in the progress display.
2. Run it:
croft installEach step shows a row that updates in place (spinner → ✓ / ✗, plus duration). Tail output for the active step shows below its row. Re-running is safe — successful steps don't re-execute unless you ask.
3. Add more steps as the project grows:
.croft/install/
├── 10-deps.sh
├── 20-db-up.sh
├── 30-migrate.sh
└── 40-seed.sh
That's it. Hook shims and agent files are installed automatically as synthetic steps around your plan (see below).
-
Two ways to define a step. A file under
.croft/install/(most common), or a[install].steps = [...]entry incroft.tomlreferencing a recipe or inline command. Files and the config list are alternatives, not layers — when[install].stepsis set, it wins. -
Two synthetic steps wrap your plan. croft auto-appends
apply-agentsat the start (if[agents]is declared) andinstall-hooksat the end. You don't write or order these — they're managed for you. -
State remembers progress. Every step's last outcome is
recorded in
.croft/install.state.json. On the nextcroft install, if any step is unresolved, croft prompts "Resume from<step>?" so a half-finished setup doesn't redo the slow parts.
Drop a shell file in .croft/install/. Numeric prefix sets
order:
# .croft/install/25-rebuild-search.sh
#!/usr/bin/env bash
# @desc: Rebuild search index
set -euo pipefail
php artisan scout:importHidden files (.foo) and files starting with _ are skipped, so
helper scripts can live alongside.
Set @in: <service> (same key as recipes):
# .croft/install/20-composer.sh
#!/usr/bin/env bash
# @desc: Install PHP deps
# @in: app
set -euo pipefail
composer install@in routes through the configured [runtime].backend. Devcontainer
users get the devcontainer automatically for steps without @in.
Mark the step interactive so it gets the terminal:
# .croft/install/50-secrets.sh
#!/usr/bin/env bash
# @desc: Configure first-run secrets
# @interactive: yes
EMAIL=$(croft lib ask "Admin email")
PASS=$(croft lib password "Admin password")
echo "ADMIN_EMAIL=$EMAIL" >> .env
echo "ADMIN_PASS=$PASS" >> .envcroft lib ask | confirm | password | select | filter give you
prompt helpers without an extra dependency. See Shell Library.
# .croft/install/60-fixtures.sh
#!/usr/bin/env bash
# @desc: Pull the latest fixtures
# @optional: yes
make pull-fixturesA non-zero exit is recorded as skipped, not failed. The plan
continues. Use for nice-to-haves that might fail in some
environments (no network access, missing credentials, etc.).
croft install 30-migrateUseful when a maintainer adds a new step that every teammate
needs to apply ("everyone please run croft install rebuild-search-index once"). Updates only that step's state
record.
If a step fails, croft exits non-zero and records failed. Fix
the underlying issue and re-run:
croft install # prompts "Resume from <step>?"
croft install --resume # non-interactive resume
croft install --restart # wipe state and start overIn CI / piped invocations, the resume prompt defaults to "yes" so non-interactive runs do the right thing.
croft install --dry-run # print steps, don't execute
croft install --list # plan + last-known status per stepcroft install --update-hooksForces a re-clone of every external repo in
.pre-commit-config.yaml. Useful when an upstream moves a tag.
If your steps are mostly recipes you already have, declare them directly:
[install]
steps = ["copy-env", "deps", "db:migrate", { name = "seed", optional = true }]Each entry is either a recipe / script name or an inline table
with { name, run, in, env, cwd, optional, interactive }.
[install].steps is the plan; .croft/install/ files are
ignored when it's set.
For shell-file steps, the optional # @key: value block at the
top (terminated by the first non-# @ line) sets the same
fields as [command.*] recipes plus a couple of install-only
ones:
| Key | Notes |
|---|---|
@desc |
One-line description, shown in the renderer. |
@in |
Service to exec inside (compose backend). Absent → host. |
@tty |
Allocate a TTY. |
@env |
Comma-separated K=V pairs added to the step env. |
@cwd |
Working directory. Relative to project root. |
@optional |
true → non-zero exit is skipped, not failed. |
@interactive |
true hands the terminal to the step. |
Two steps are auto-appended:
-
apply-agents— runs first, when[agents].install_with_setup = true(default) and at least one[[agents.sources]]is declared. See Agents. -
install-hooks— runs last, when[install].install_git_hooks = true(default). Installs git hook shims and prefetches.pre-commit-config.yamlexternal repos into.croft/cache/hooks/<rev>/. See Hooks.
In precedence:
-
[install].steps = [...]incroft.toml. Each entry is a name (recipe / discovered file) or an inline{ name, run, in, env, cwd, optional, interactive }table. -
Files discovered under
.croft/install/. Same# @key:parser as.croft/commands/. When[install].stepsis empty, discovered files are the plan, file-name sorted.
Install steps are intentionally separate from croft list /
.croft/commands/ — they don't surface in the TUI sidebar or the
command resolver.
Each step runs with CROFT_PROJECT_DIR set to the host path of
the worktree project root. Script-source steps also get
CROFT_SCRIPT_DIR pointing at the parent directory of the step
file (typically .croft/install/). Both sit alongside the
resolved Environments layers and @env:
declarations. Inline install steps in [install].steps get
CROFT_PROJECT_DIR only — there's no script file for
CROFT_SCRIPT_DIR to point at.
A small line-redraw printer (not a TUI). Each step gets a row that updates in place; the active step's tail output (last 3 lines) shows below its row:
✓ 01-copy-env (12 ms)
✓ 02-install-deps (3.4 s)
◐ 03-migrate (running)
Running migration 2026_05_10_create_users_table
Running migration 2026_05_11_create_sessions_table
| Flag | Notes |
|---|---|
--resume |
Non-interactive resume from the first unresolved step. |
--restart |
Wipe state, run from step one. |
--dry-run |
Print the plan without executing. |
--list |
Plan + last-known status per step. |
--update-hooks |
Force-refresh the external hook cache. |
croft install writes a marker-delimited managed block in
.croft/.gitignore covering local.toml, worktrees/, cache/,
install.state.json, and agents.state.json. Idempotent —
when the file is already correct, the mtime stays put. Path is
configurable via [install].gitignore = "...".
-
examples/install-flow/— runnable demo with ordered + optional + interactive steps. - Hooks and Agents — the synthetic steps that bookend your plan.
- Shell Library — prompts inside interactive steps.
croft is dual-licensed under MIT or Apache 2.0. Source: github.com/nsrosenqvist/croft. Back to Home.