crewship server
crewship server manages server profiles: named targets stored in a single
~/.crewship/cli-config.yaml, each with its own server URL, auth token, and
default workspace. One config can address dev1/dev2/dev3, staging, and
prod, and you switch between them without juggling config files or environment
variables.
Each profile’s token is bound to that profile’s host. Selecting a profile
can never send another instance’s bearer to the wrong server — the same
host-mismatch guard that protects
--server applies (see
crewship login).Subcommands
Quick start
The minimum is onelogin per instance — login --profile <name> --server <url>
creates the profile if it doesn’t exist. If no default profile is set yet,
it also becomes current, so you don’t need a separate server add (logging
into another profile later does not re-point an existing default):
crewship server list then shows:
How the active profile is resolved
For every command, the active profile is chosen in this order (first match wins):--profile <name>flag — one-off override.CREWSHIP_PROFILEenv var — scopes to a shell.- Directory match —
directory_profilesin the config (see below). current— the persisted default set bycrewship server use.
server/token/workspace fields (single-server mode), so existing configs
keep working unchanged.
The selected profile’s server, token, and workspace then flow through the
normal resolution chain. An explicit --server still overrides the dial target;
CREWSHIP_SERVER is only consulted when the active profile does not already
define a server URL (and a host mismatch still fails if the token was minted for
a different host).
Because a directory match (layer 3) outranks the persisted
current default
(layer 4), crewship server use <name> can appear to silently “not work” when
run inside a directory-mapped clone — the directory binding keeps winning.
crewship server current surfaces this explicitly when it happens
(directory override for <dir> — persisted default (server use) is "<name>"), and
crewship server list’s active marker shows *d instead of plain * for a
directory-resolved profile. If you actually want the persisted default to win
in that directory, crewship server remove the directory binding (or edit
directory_profiles in the config) rather than repeating server use.Directory auto-select
directory_profiles maps a directory to a profile, so the CLI picks the right
target automatically based on where you run it. Bind a directory from the CLI
with server add --dir (no YAML editing) — . means the current directory:
crewship inside /work/crewship_2 (or any subdirectory)
automatically targets dev2 — no --profile flag, no env var. The longest
matching path wins, and matching is on path boundaries (so /work/crewship_1
never matches /work/crewship_10). server remove also prunes a profile’s
directory bindings, so no cwd resolves to a deleted profile.
This is the native replacement for shell hooks that exported
CREWSHIP_SERVER/CREWSHIP_CONFIG based on $PWD.
Migrating from CREWSHIP_CONFIG
Earlier multi-instance setups pinned a separate config file per directory via
the CREWSHIP_CONFIG env var. Profiles fold all of those into one file:
CREWSHIP_CONFIG still works (it points the CLI at a specific file) and remains
useful for fully isolated configs, but it is no longer required to target
multiple instances.
See also
crewship login— authenticate a profile with--profile.crewship config— top-level settings andconfig validate.- Authentication — how the CLI token is minted, bound to a host, and validated.