Skip to content

feat(cli): add --no-wait and --no-prompt flags to coder create command #21245

@jasonwbarnett

Description

@jasonwbarnett

Summary

When automating workspace creation (e.g., from GitHub Actions triggered by PR labels), the coder create command can hang waiting for user input or take longer than necessary by waiting for the build to complete.

Use Case

We want to automatically create workspaces on behalf of users from a GitHub Action when a specific label is added to a PR. In this automation context:

  1. No interactive prompts: The CLI should fail fast with a clear error if any required input is missing, rather than hanging indefinitely waiting for user input that will never come.

  2. Async creation: We don't need to wait for the workspace build to complete - we just need to trigger the creation and return immediately so the GitHub Action can complete quickly.

Proposed Solution

Add two new flags to coder create:

--no-wait

Returns immediately after triggering workspace creation. The workspace build continues in the background.

coder create my-workspace --template my-template -y --no-wait

--no-prompt

Disables all interactive prompts. The command will:

  • Use default values for parameters that have defaults
  • Fail with a clear error message if:
    • Workspace name is not provided
    • Template name is not provided
    • Required parameters without defaults are missing
    • Preset selection is needed but no default preset exists
coder create my-workspace --template my-template --no-prompt -y

Combined usage for automation

coder create my-workspace --template my-template --no-prompt --no-wait -y

Additional Context

The --no-wait flag already exists on coder start, so this would bring consistency to the CLI. The --no-prompt flag provides explicit control over non-interactive behavior beyond what -y offers (which only skips confirmation prompts, not selection prompts).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions