Skip to content

Add CLI support for creating and publishing templates#906

Open
m-abdelwahab wants to merge 11 commits into
masterfrom
mahmoud/template-publish
Open

Add CLI support for creating and publishing templates#906
m-abdelwahab wants to merge 11 commits into
masterfrom
mahmoud/template-publish

Conversation

@m-abdelwahab
Copy link
Copy Markdown
Collaborator

@m-abdelwahab m-abdelwahab commented May 17, 2026

Summary

Adds CLI support for creating, publishing/updating, unpublishing, and deleting Railway templates, matching the dashboard lifecycle while keeping the workflow usable for agents.

Changes

  • Add railway templates create / generate

    • Creates an unpublished template draft from a project via templateGenerate
    • Matches the dashboard Generate Template action by passing project/environment context
    • Prompts for an omitted project in interactive mode
    • Supports --json output for agent workflows
  • Add railway templates publish [template]

    • Publishes or updates a template via templatePublish
    • Accepts category, description, README, image, demo project, and workspace
    • Prompts for omitted template/metadata fields in interactive mode
    • Supports README via inline text, file, or stdin
    • Includes dashboard-aligned validation for category, description, README, and image
    • Supports clearing optional fields like --image ""
  • Add railway templates update [template] as an alias for publish

    • Mirrors the dashboard behavior: marketplace template info updates go through templatePublish
    • Keeps the CLI wording clear when replacing metadata on an already published template
    • Uses the same user-auth refresh path as templates publish
  • Add railway templates unpublish [template]

    • Unpublishes a published template via templateUnpublish
    • Prompts for template and confirmation in interactive mode
    • Requires --yes for non-interactive use
    • Supports --2fa-code and --json
  • Add railway templates delete [template]

    • Deletes a template via templateDelete
    • Exposes delete, remove, and rm
    • Prompts for confirmation in interactive mode
    • Requires --yes for non-interactive use
    • Supports --2fa-code and --json
  • Use user-scoped auth for template create/publish/update/unpublish/delete

    • Uses OAuth or RAILWAY_API_TOKEN
    • Avoids accidentally using project-scoped RAILWAY_TOKEN, since these template operations require user context
    • Threads the same user-auth client through project/workspace/template resolution used by these flows
  • Add GraphQL operations for template generate, publish, unpublish, delete, lookup, and workspace-template lookup

Notes:

  • A truly source-less empty service cannot currently generate a template; the backend returns that the service has no source usable for template generation. The live lifecycle test used nginx:latest as the smallest source-backed service.
  • The dashboard also uses templatePublish for marketplace info updates; templateUpdateV2 exists, but it updates serialized template config/editor state rather than the publish metadata fields exposed by this CLI flow.

@m-abdelwahab m-abdelwahab added the release/minor Author minor release label May 17, 2026
@m-abdelwahab m-abdelwahab marked this pull request as ready for review May 22, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/minor Author minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant