crewship apply
Apply a YAML manifest that describes a crew or workspace. Re-running apply is idempotent and convergent: missing resources are created, drifted ones updated, and resources that disappeared from the manifest are deleted (with confirmation). Mutations go through normal REST endpoints so RBAC, audit logging, and WebSocket events fire the same way they would for an interactive user.Flags
--strict and --replace are mutually exclusive. Apply also requires an authenticated session (crewship login) and a workspace context — both are inherited from the current CLI profile.
Use --skip-test-gate when applying a manifest whose routine depends on credentials that are still PENDING from the same apply: the test_run would attempt to invoke the routine before its credentials exist, fail, and block save. Operators with OWNER/ADMIN role bypass the gate; everyone else must seed the credentials first and re-run apply without the flag.
Examples
Idempotent re-apply
env: entry in the manifest. Re-running converges drift.
Dry-run as a CI check
Strict mode for ephemeral workspaces
Replace an existing crew
Read from stdin
sed, op inject, or a templating step.
KEY=VALUE secrets file
secrets.env:
--env-file: no env-var expansion happens, the file is the source of truth.
Plan + confirm flow
Apply is two-pass: it computes the full plan first, prints it, asks for confirmation on anything destructive, and only then executes.Reading a failed run
Apply is fail-fast: the first error aborts the run, and every plan item behind it is left untouched. That makes the counters a prefix, so a failed run never printsApplied: — it prints what it managed, says
it failed, and then names what it did not do:
NOT APPLIED block exists because the counters cannot answer the
only question you have at that moment — which of them landed? Nothing
was attempted for the listed items, so re-running after fixing the cause
is safe.
Grepping for Applied: is a valid success check. Grepping for the
absence of a non-zero exit code is better.
Refusing deletes outright
Sync mode makes deletion the default for anything that fell out of the manifest, and some deletions are not a rollback away: removing an agent takes its memory and its Composio OAuth binding with it, and that binding is a browser consent no manifest can replay.--no-delete turns “this run deletes nothing” from a claim a human
makes by reading the plan carefully into one the machine checks:
--yes (the flag
every automated invocation already carries, so a guard --yes could
switch off would not be one), and it fails --dry-run too, so the
rehearsal and the performance agree.
The check runs twice, against two different plans. The CLI refuses
against the plan it rendered for you; manifest.Apply refuses again
against the plan it builds from its own fresh read of the server,
immediately before executing it. Without the second one a resource that
disappeared between the two reads would add a delete to the second plan
that the first never showed, and --yes would wave it through. SDK
callers get the same guarantee via manifest.Options{NoDelete: true},
which returns manifest.ErrDeletesRefused.
Worth making the default on production manifests.
Credential resolution
Manifests never carry secret values.crewship apply resolves the env: slot through a chain of sources, in order:
--secrets-file <path>if supplied--from-env(process environment) if supplied- Otherwise the credential is created as
status=PENDINGand printed at the end
credential not configured until you set the value through the UI or crewship credential update.
What gets deleted on sync
Resources synced (= deleted when missing from the manifest, with confirmation):- crews (in workspace bundles)
- agents within each declared crew
- agent skill bindings
- agent credential bindings
- MCP servers on each declared crew
- skills at workspace scope — drop them via
crewship skill rm - credentials themselves — drop them via UI or
crewship credential delete
Exit codes
apply doesn’t surface a “code 2 = changes applied” because every CI pipeline already knows the previous state via git. Use --dry-run for the “did anything change?” check.
Common errors
crew "code-review" already exists— drop--strictto update in place, or pass--replaceto recreate.aborted: destructive plan requires confirmation (pass --yes)—applysaw a-line in the plan and stdin isn’t a TTY. Pass-y/--yesin CI, or run interactively.invalid services_json: services["xyz"]: name must be a DNS label— service names must be valid RFC 1035 DNS labels (1–63 chars, lowercase letters/digits/-, starting with a letter and ending with letter or digit) since they become bridge-network DNS aliases.skill "X" references unknown credential env "Y"— everyenv_refs:entry must point at a credential declared in the same manifest (in the crew or at workspace scope).
Next step after apply
When the manifest declaresspec.devcontainer on any crew, apply prints a hint at the end:
See also
- Guides → Workspace Manifests — the narrative tour
- CLI → export — round-trip back to YAML
- CLI → crew provision — chained step for crews with devcontainers
- Configuration → Manifest Schema — every field, every default