Skip to content

feat: add service list subcommand#850

Open
LiamCoop wants to merge 3 commits intorailwayapp:masterfrom
LiamCoop:feature/service-list-command
Open

feat: add service list subcommand#850
LiamCoop wants to merge 3 commits intorailwayapp:masterfrom
LiamCoop:feature/service-list-command

Conversation

@LiamCoop
Copy link
Copy Markdown
Contributor

Summary

  • Adds railway service list subcommand to list all services in a project.
  • Supports --project flag to filter by project (defaulting to linked project)
  • Supports --environment flag to specify environment (defaulting to linked env)
  • Supports --json flag for machine-readable output

Example Output
Default

client (280794af-f5db-4f94-900c-53afafd5ecec)
Postgres (33bacc3e-80b7-4739-8473-b308bae72181)
sync-server (c8b51d04-6507-4b9a-979a-78d26083c05e)

JSON (--json)

[
  {
    "id": "280794af-f5db-4f94-900c-53afafd5ecec",
    "name": "client"
  },
  {
    "id": "33bacc3e-80b7-4739-8473-b308bae72181",
    "name": "Postgres"
  },
  {
    "id": "c8b51d04-6507-4b9a-979a-78d26083c05e",
    "name": "sync-server"
  }
]

Help (--help)

Manage services

Usage: railway service [SERVICE] [COMMAND]

Commands:
  list      List services in the current project
  link      Link a service to the current project
  status    Show deployment status for services
  logs      View logs from a service
  redeploy  Redeploy the latest deployment of a service
  restart   Restart the latest deployment of a service
  scale     Scale a service across regions
  help      Print this message or the help of the given subcommand(s)

Arguments:
  [SERVICE]  The service ID/name to link (deprecated: use 'service link' instead)

Options:
  -h, --help     Print help
  -V, --version  Print version

Test Plan

No --project flag

  • railway service list w/ linked project + linked environment → lists services in that environment
  • railway service list w/ no linked project → errors with No linked project found. Run railway link to connect to a project

--project flag

  • railway service list --project <name> w/ --environment specified → lists services in that environment
  • railway service list --project <name> w/ invalid --environment → errors with Environment not found
  • railway service list --project <name> w/ no --environment, one environment in project → auto-selects it
  • railway service list --project <name> w/ no --environment, multiple environments → prompts to select (interactive) or errors (non-interactive)
  • railway service list --project <invalid> → errors with Project not found

Output

  • railway service list --json → outputs valid JSON with service fields (id, name)
  • railway service list w/ no services in environment → shows No services found
  • railway service list w/ services present → shows name and ID for each service

Fixes #817

@LiamCoop LiamCoop marked this pull request as ready for review April 19, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add service list command to enumerate services in a project

1 participant