Skip to main content

Workflow

cmd/crewship/cmd_workflow.go exposes the workflow-template surface. A workflow template defines a reusable issue lifecycle — the ordered list of stages (e.g. backlog → in_progress → review → done) that crews attach to their issue trackers. Backed by /api/v1/workflow-templates (see internal/api/workflow_templates_handler.go). Aliases: workflows, workflow-template, workflow-templates. All commands operate on the active workspace (crewship workspace use) and resolve <slug> arguments against the stored template name — both an exact-name hit (case-insensitive) and a kebab-cased form like engineering-standard are accepted. Ambiguous slugs that match multiple templates fail with a hint to retry using the exact name.

crewship workflow list

GET /api/v1/workflow-templates. Lists every template visible to the workspace — built-in rows first, then user-created.
Output columns: ID, NAME, BUILTIN, STAGES, ICON, COLOR. The STAGES column counts entries inside the stored template_json blob — a value of 0 indicates a corrupt row that should be inspected via workflow get.

crewship workflow get <slug>

GET /api/v1/workflow-templates/{id} after resolving <slug> via the list endpoint. Prints every column including the full template_json so you can pipe it through jq to inspect the stage list.

crewship workflow create --file <manifest.yaml>

POST /api/v1/workflow-templates. The CLI reads a SPEC-2 YAML manifest, validates the minimum shape locally, and posts the canonical template_json to the server (which re-validates the stage list).

Validation rules

Enforced both client- and server-side (validateTemplateJSON in internal/api/workflow_templates_handler.go):
  • spec.stages must contain at least one stage.
  • Every stage requires name, type, and position.
  • stage.type must be one of open, started, completed, cancelled.
  • Exactly one stage with type: open; at least one with type: completed.
  • name and position values are unique within the template; position must be > 0.
  • stage.color (if set) must be a hex string like #3B82F6.
A name collision with an existing template in the same workspace returns 409 Conflict.

crewship workflow update <slug> --file <manifest.yaml>

PATCH /api/v1/workflow-templates/{id}. Resolves <slug> against the stored template name (same matching as get/delete), then PATCHes the parsed manifest onto that row. The manifest uses the exact same SPEC-2 envelope as create, and the server re-runs the full stage validation — a manifest rejected on create is rejected on update too.
Built-in templates (is_builtin: true) and rows in another workspace surface as 404 Not found; renaming into an existing template’s name returns 409 Conflict.

crewship workflow delete <slug>

DELETE /api/v1/workflow-templates/{id} after resolving <slug>. Aliases: remove, rm. Prompts for confirmation unless -y/--yes is passed.
Workflow templates are reference data — crews that still point at the deleted template fall back to the runtime default lifecycle rather than failing.

See also