Crewship is an Ansible playbook with a Python CLI wrapper (scripts/ship.py). The source of truth is:
blueprint/config/default.yml— ship defaults (every field the schema requires)blueprint/schemas/crewship.schema.json— JSON Schema for the host configblueprint/ansible/group_vars/all/*.yml— Jinja vars consumed by tasks, one file per topicblueprint/ansible/tasks/*.yml— the tasks themselves (one file per concern)blueprint/ansible/templates/*.j2— systemd unit templatesscripts/ship.py- CLI; see Commandsscripts/provisions.py— latest-release tool installer (idempotent)blueprint/fleet/— runtime scripts deployed to~/oss-fleet/on the target hostblueprint/config/— per-tool config templates deployed to Firstmate homes
Every task is idempotent.
An unchanged launch reports changed=0 when no upstream tool has published a new release or source update since the last apply.
A newer release or source update shows as an expected change in the toolchain step.
Keep every task check-mode safe; follow the chart contract.
Remote-source copies need existing parent directories even in check mode.
Follow Dependencies for tool release selection, download verification, and exceptions.
Only the repository's own development environments (uv.lock, apps/crewboard/Cargo.lock) stay locked.
CI pins each GitHub Action to the commit SHA of its latest release, kept current by Dependabot.
Do not add unconditional restarts or bare commands.
start_services: false suppresses every linger, daemon-reload, and systemd start action while still writing unit files and enabling them via static symlinks.
Users install Crewship with the one-line installers in SETUP.md. Clone the repository only to change Crewship or to run the playbook from a checkout.
You need Ubuntu 24.04 or 26.04 on x86_64 or aarch64 with systemd, a non-root account with sudo, Python 3.12+, git, and gh. blueprint/cloud-init/user-data.yaml can preinstall the OS packages on first boot.
-
Authenticate GitHub (for private repositories and gh-axi):
gh auth login
-
Clone the repository:
git clone https://github.com/i098/Crewship.git cd Crewship -
Install the repository tooling (the latest uv, then the locked Python environment with Ansible):
./onboard.sh
-
Create your host config, then review its profiles, user, and paths:
./ship.sh dock ${EDITOR:-nano} .local/host.yml -
Validate the config and preview the changes.
chartuses Ansible check mode; the first config read can rewrite old keys and keep a backup:./ship.sh inspect ./ship.sh chart
-
Run
launchto provision the host; it may ask for your sudo password. Follow New-host questions for the setup requirements:./ship.sh launch
-
Check setup readiness:
./ship.sh setup
Follow the printed commands and the manual sign-in steps, then repeat setup.
Credentials are never copied from another host; see Migration and recovery.
# Install dev deps
uv sync --group dev
# Lint
uv run ruff check .
# Test, in parallel as CI runs it (the Koncreet apply tests need root or fakeroot; unprivileged without it they skip)
uv run pytest -n auto --dist worksteal
# Only the tests that your change affects (pytest-testmon; the validation step runs this in cf-sandbox).
# The first run on a host has no data and runs everything. A change that touches any other non-.py file
# (compared with the merge base, untracked files included; changelog.d/ does not count, and apps/imessage/ changes also run its bun tests and tests/test_imessage*.py), or an unknown merge base, also runs everything. CREWSHIP_TEST_TIMEOUT_SCALE multiplies test subprocess timeouts on slow hosts. Data: $CF_TESTMON_DIR, default ~/.cache/crewship-testmon/<hash of the checkout path> (one database per checkout, so parallel runs do not collide; a new checkout starts from a seed copied from the last fully passing run, and checkout dirs unused for 14 days are deleted).
scripts/test-affected
# Ansible syntax check
uv run ansible-playbook -i blueprint/ansible/inventory.yml blueprint/ansible/site.yml --syntax-check
# Optional pre-push hook: ruff and bash -n on the files you changed, about 2 s
ln -sf "$PWD/scripts/pre-push" "$(git rev-parse --git-path hooks)/pre-push"See the CI reference for documentation-only skips, required check reporting, and event exceptions.
After every failed no-mistakes run or CI gate, append a post-mortem with the command below. Land the linked prevention change; a log entry alone does not complete the work.
uv run scripts/validation_postmortem.py --run "RUN_ID_OR_URL" --step "FAILED_STEP" \
--root-cause "VERIFIED_CAUSE" --fix "FIX_APPLIED" --prevention "CHANGE_LINK"The operator's Herdr runs the default session on the same host, and its workspace labels route Firstmate's work.
A test or smoke must never send a call to that session.
- In pytest, stub
herdr(put the stub first inPATH, or setHERDR_BIN_PATH).tests/conftest.pyputs aherdrthat refuses every call first inPATH, so a test without a stub fails and changes nothing. - For a real Herdr, use a named lab session
fm-lab-*. Start it with Firstmate'sbin/fm-herdr-lab.sh provision <session>and remove it withbin/fm-herdr-lab.sh teardown <session>. - Send every other call through
tests/herdr-lab<session> <herdr arguments...>, includingworkspace create,renameandclose. For a script such as the Spaces reporter, setHERDR_BIN_PATHto a wrapper that runsexec env -u HERDR_BIN_PATH <checkout>/tests/herdr-lab <session> "$@":tests/herdr-labrunsHERDR_BIN_PATHitself, so the wrapper must clear it. It adds--session <session>and clearsHERDR_SOCKET_PATH. It refuses, before it runs Herdr, a session that is empty,defaultor notfm-lab-*, anHERDR_SESSIONthat names another session, a leading option, a--sessionof your own, andserverorsessionoperations. tests/container-smoke.shruns its real Herdr server in a namedfm-lab-*session inside the smoke image, and refuses--in-containeroutside that image.- On the host, run a test command that could start, stop or signal sessions or daemons as
cf-sandbox -- <command>(Test sandbox). It gives the command a privateHOME, runtime directory,/tmpand pid space, so it cannot reach the live socket. The no-mistakes test step of this repository already runs that way. - Do not isolate with
HOME,XDG_CONFIG_HOME,HERDR_CONFIG_PATH,HERDR_SESSIONor an environment file. One call that runs without them reaches thedefaultsession.
- Add it to
GITHUB_LATEST(a GitHub release whose assets carry a SHA-256 digest; when the release publishes its own<asset>.sha256files, also list it inSHA256_FILEto verify against those) orNPM_LATESTinscripts/provisions.py. A tool from elsewhere needs its own resolver inresolve_release_groupthat reads the checksum its publisher posts for the release. - Register where it installs:
crewship_core_toolsinblueprint/ansible/group_vars/all/tools.ymlfor every host,AGENT_TOOLSinscripts/provisions.pyfor theagentsprofile's native tools (npm tools inNPM_LATESTneed no step), orcrewship_installer_alsoinblueprint/ansible/group_vars/all/for a source Ansible installs itself. - If it needs a systemd unit, add a
.j2template inblueprint/ansible/templates/and wire it in the relevant task file. - If it needs environment variables, add them to
blueprint/ansible/group_vars/all/(not to shell rc files). - Update
docs/architecture.mddiagrams anddocs/agents/architecture.mddetails if the tool changes the host's architecture. - Add or update a test in
tests/.
Fleet guards (blueprint/fleet/) are runtime scripts deployed to ~/oss-fleet/ on the box. They are not Ansible modules — they are plain shell/TypeScript that systemd units run.
- Write the script in
blueprint/fleet/doctor/orblueprint/fleet/browsers/. - Add a
.j2unit template inblueprint/ansible/templates/. - Wire it in
blueprint/ansible/tasks/fleet_guards.yml(orfleet-browsers.yml). - Add guard units to
crewship_fleet_guard_unitsand enabled units tocrewship_fleet_guard_enabled_unitsinblueprint/ansible/group_vars/all/fleet.yml. Usecrewship_fleet_browser_unitsandcrewship_fleet_browser_enabled_unitsfor the browser ladder. - Update
docs/fleet-guards.md.
Commits follow Conventional Commits 1.0.0:
- The subject line is
type(scope): subject. The type isfeat,fix,docs,refactor,test,ci, orchore; the scope is optional. - Mark a breaking change with
!after the type or scope, or with aBREAKING CHANGE:footer. - Write the subject in the imperative, in 72 characters or fewer, with no period at the end.
- Wrap the body at 72 characters and tell why the change is necessary.
A good commit:
fix(provisions): check the digest before install
The installer moved the binary into place and then checked its
SHA-256 digest. A bad download could replace a good tool before
the check failed. Check the digest first and stop on a mismatch.
Branch names are type/short-description, with a type from the list above, for example feat/one-command-install.
These issue and pull request rules apply to people and agents.
Use a plain sentence-case issue title, such as Explain the fresh-server install requirements.
Do not use a commit prefix such as docs: in an issue title.
Use the bug report or feature request form:
| Form | Label | Required fields | Optional fields |
|---|---|---|---|
| Bug report | bug |
what-happened, steps, version |
host, logs |
| Feature request | enhancement |
problem, proposal |
None |
For bugs, describe the actual and expected results, reproduction commands, and the release tag or commit. Include the operating system and logs when useful; remove secrets first. For features, describe the problem and the proposed change. Ask questions in Discussions Q&A, not an issue.
Agents must use scripts/new-issue; people can use it or the web forms.
Run these examples from the repository with the development dependencies installed:
uv run scripts/new-issue bug --title "The installer stops before setup" \
--field "what-happened=Setup stops; I expected it to finish." \
--field "steps=Run the README install command on a fresh server." \
--field "version=vX.Y.Z" --field "host=Ubuntu 24.04" --dry-run
uv run scripts/new-issue feature --title "Explain the fresh-server install requirements" \
--field "problem=New users cannot find the server requirements." \
--field "proposal=List the requirements before the install command." --dry-runReplace the example values with observed facts.
Review the printed title, labels, and body, then remove --dry-run to create the issue.
The script always targets i098/Crewship, regardless of the current directory or GH_REPO.
Use --field logs=@/path/to/redacted-log.txt to read a field from a file.
The script applies the form's label and rejects missing required fields or commit-prefixed titles.
- One concern per PR.
- The title uses the commit format, for example
docs(contributing): add git conventions and branch rules. - The body starts with
Refs #Nfor the issue that the PR addresses. Never write a closing keyword (Closes,Fixes,Resolves) with an issue reference in the body, the PR title, or a commit message on the branch: a merge never closes an issue. An issue closes only after the change is deployed where it runs and tested there for real; the closing comment holds the deploy proof and the test proof. The PR template fills in the other sections. Put the opening reference on its own line, outside a code block. FillSummary,What changed and why,Test evidence, andChecklist. Follow the Review evidence guide for what to capture and where to put it. Name the commands you ran and their results underTest evidence; do not claim checks you did not run. Keep each checklist item and mark completed items with[x]. Leave an inapplicable item unchecked and explain why beside it, such asNot applicable: no Ansible files changed. Use visible text in sections and reasons; comments, empty markup, link definitions, and whitespace entities alone do not count. Inline and fenced code can supply content. A commit message that quotes a closing keyword fails the check: write the keyword without an issue number, or reword the commit withgit commit --amendor a rebase on the PR branch. - Tests pass (
uv run pytest). - Lint clean (
uv run ruff check). - Ansible syntax clean (
--syntax-check). - Idempotent: an unchanged second
launchreportschanged=0when no upstream tool has published a new release or source update since the last apply. A newer release or source update shows as an expected change in the toolchain step. - Running
/no-mistakeson the branch when the PR work is done is welcome but optional. You may open a direct PR without it; a maintainer then runs/no-mistakeson that PR. - Describe what changed and why in the PR body.
- Add a changelog fragment,
changelog.d/<issue>.<type>.md, and never edit CHANGELOG.md (see Changelog and releases). Fragments are separate files, so PRs that run at the same time do not conflict. CI fails a PR without a fragment, unless the PR has theno changeloglabel. - PRs merge with a merge commit; squash and rebase merging are off.
The no-mistakes pipeline uses .github/PULL_REQUEST_TEMPLATE.md through .no-mistakes.yaml.
It omits generated intent and puts validation evidence in a collapsed section after the public body.
The pipeline reads these settings from the default branch.
The required pull request body check validates the opening issue reference, filled sections, and completed or explained checklist items.
It rejects a closing keyword in the body, the PR title, or a commit message on the branch.
It also runs the automatic screenshot check.
It runs for every PR, including Dependabot and release PRs.
Body edits rerun this small check without restarting the full build.
Check a body file before publication:
python3 scripts/check_pr_body.py /tmp/pr-body.mdPass --base origin/main to enable the screenshot check and the commit-message check for the current branch.
Pass --head <revision> with --base to check a revision other than HEAD.
Pass --title "<PR title>" to check the PR title.
Match the template headings and checklist text exactly, and run the body checker before each PR publication or body edit.
Every ship worker also runs the pre-push PR check before opening a PR:
python3 scripts/check_pr.py /tmp/pr-body.md [--base origin/main] [--no-ui] [--title "<PR title>"]It fails when a commit subject in base..HEAD is not Conventional Commits (<type>[(<scope>)][!]: <text>, 100 characters at most, no final period).
The allowed types are build, chore, ci, docs, feat, fix, perf, refactor, revert, style, and test.
It also fails when the body does not start with Refs #N, has no Review plan: <text> line, fails the same screenshot check as CI, or when the body, the PR title given with --title, or a commit message holds a closing keyword.
Use --ui or --no-ui to override UI detection for the local pre-push check only.
GitHub rulesets enforce these rules, with no bypass:
mainchanges only through a pull request. Before a merge,pull request body,configuration and python checks,quality gate, andworker image behavior smokemust pass or report an allowed skip. See the CI reference for skip conditions. No approval is necessary.maincannot be force-pushed or deleted.- GitHub deletes the head branch after the merge.
- A
v*tag cannot be deleted or moved.
CHANGELOG.md follows Keep a Changelog 1.1.0, and versions follow Semantic Versioning 2.0.0.
Releases use vX.Y.Z tags; prereleases add a suffix such as v0.4.8-rc.1.
Stable releases and promotion from prerelease to stable require the owner's explicit word.
Routine fixes can use prereleases without that approval.
Prereleases use npm next, an exact GHCR version tag, and a GitHub prerelease with make_latest=false.
They never move npm latest, GHCR latest, or GitHub's latest release.
See Prerelease opt-in for installer selection and explicit opt-in.
Keep patch-only numbering; use the next patch version and increase rc.N for successive candidates.
Do not change published releases, including 0.4.7.
-
Every PR adds one fragment file,
changelog.d/<issue>.<type>.md, where<issue>is the number of the issue it resolves and<type>is the section that fits:added,changed,deprecated,removed,fixed, orsecurity. The file holds one sentence, without the issue link; the release step adds the link. For example,changelog.d/58.fixed.md:`scripts/stow-secrets.sh` no longer fails once `super.env` has more than 100 variables.A PR with nothing to note, for example a test-only change, gets the
no changeloglabel instead. -
Prepare a release on a new branch with
uv run towncrier build --version X.Y.Z, then open a PR. The command writes a dated version section belowUnreleasedand deletes the fragments it uses. Preview it first withuv run towncrier build --draft --version X.Y.Z. Update the changelog's link references and settools/npm/package.jsonto the same version. For a prerelease, include the suffix in both versions, for example0.4.8-rc.1. Use the next patch number for a new release series; keep that number for its prerelease candidates. Batch changes and publish at most once per day.Bump the minor or major number only with the owner's approval.
-
After that PR merges, tag its merge commit on
mainasvX.Y.Z. Never move or reuse a published tag. -
Create a draft GitHub release with the version's changelog section as its notes. For a prerelease, use
gh release create v0.4.8-rc.1 --draft --prerelease --latest=false --verify-tag --title v0.4.8-rc.1 --notes-file <section.md>. For an approved stable release, usegh release create vX.Y.Z --draft --verify-tag --title vX.Y.Z --notes-file <section.md>. -
Attach the install artifact before publication; published releases are immutable. Run
gh workflow run release-artifact.yml -f tag=v0.4.8-rc.1for a prerelease. For an approved stable release, rungh workflow run release-artifact.yml -f tag=vX.Y.Z -f stable=true. The workflow rejects a tag that does not match the selected channel and rejects releases that are already published. It sets the draft's prerelease flag from the selected channel; the latest flag is set when you publish. Check that the draft listscrewship-<tag>.tar.gz,install.sh, and both.sha256files before publication. The installer asset comes fromscripts/install.shat the tag, not from the workflow's branch. -
Publish a prerelease with
gh release edit v0.4.8-rc.1 --draft=false --prerelease --latest=false. Only with the owner's word, publish a stable release withgh release edit vX.Y.Z --draft=false --prerelease=false --latest. Publication startsnpm-publish.yml; the package version must match the tag and the GitHub prerelease flag. The npm tag isnextfor prereleases andlatestfor stable releases. -
Publication also starts
release-image. It pushesghcr.io/i098/crewship:<version>for either channel andghcr.io/i098/crewship:latestonly for stable releases. When the package is public, anyone can pull an exact version without a login:docker pull ghcr.io/i098/crewship:0.4.8-rc.1.The first push creates the package as private, and the REST API cannot change package visibility. Do this one time: on the crewship package, click Package settings, then under Danger Zone click Change visibility, select Public, and confirm with the package name.