Skip to content

Railway provider support#144

Merged
rafeegnash merged 20 commits intomasterfrom
feat/railway-cli
Apr 22, 2026
Merged

Railway provider support#144
rafeegnash merged 20 commits intomasterfrom
feat/railway-cli

Conversation

@rafeegnash
Copy link
Copy Markdown
Collaborator

Summary

Full Railway provider integration for the CLI mirroring the Vercel implementation.

  • New internal/railway/ package: GraphQL client (curl shell-out to backboard.railway.com/graphql/v2), types, static cobra command tree (list, get, logs, analytics, deploy, redeploy, cancel, variable, domain, environment), conversation history with atomic writes.
  • internal/maker/exec_railway.go + railway_prompts.go: plan execution with command validation (first arg must be railway, shell metacharacter rejection, destructive verb guarding, unresolved placeholder detection). LLM prompt examples covering railway up, redeploy, cancel, variable set/rm, domain add/rm, environment new/rm, link.
  • cmd/ask.go: --railway flag + handleRailwayQuery with per-workspace conversation history and context gathering, mirrors handleVercelQuery.
  • cmd/credentials.go: storeRailwayCredentials / testRailwayCredentials via GraphQL me query, backend round-trip.
  • cmd/mcp.go: clanker_railway_ask and clanker_railway_list tools (projects, services, deployments, domains, variables, volumes, workspaces).
  • internal/routing/routing.go: railwayKeywords, ServiceContext.Railway field, classifier + LLM-disambiguation branch.
  • cmd/railway.go: phase-1 ask stub subcommand.
  • Backend client types/methods for RailwayCredentials.
  • CLI shell-out uses RAILWAY_API_TOKEN (account/workspace scope), not RAILWAY_TOKEN which is project-scoped.

Test plan

  • clanker credentials store railway --api-token \$TOKEN stores successfully
  • clanker credentials test railway reports PASSED: authenticated as <name>
  • clanker railway list projects prints project list
  • clanker railway list services --project <id> prints services
  • clanker railway logs <deployment-id> streams log entries
  • clanker ask --railway "what projects do we have?" returns AI summary from Railway context
  • Follow-up clanker ask --railway "..." sees prior conversation
  • Auto-router: a query containing "railway" keyword routes to Railway agent
  • clanker ask "deploy this to railway" in maker mode generates a railway up plan, validates, executes
  • MCP: clanker_railway_list with resource=projects returns workspace projects
  • Crash during conversation save leaves file uncorrupted (atomic rename)

Paired with desktop PR: https://github.com/clankercloud/clanker-cloud/pull/371

nash added 20 commits April 22, 2026 00:55
Adds the internal/railway package with a GraphQL client against Railway's
Backboard v2 endpoint, strongly-typed models covering the full
Workspace->Project->Environment->Service->Deployment hierarchy, and a
per-workspace conversation history store with atomic persistence.
Adds RailwayCredentials struct, ProviderRailway constant, and
StoreRailwayCredentials / GetRailwayCredentials on the backend client so
the credentials subcommand can round-trip Railway account tokens
through the clanker backend like the other providers.
…mmand

storeRailwayCredentials resolves the account token from flags, config,
or RAILWAY_API_TOKEN and persists via the backend client.
testRailwayCredentials verifies the token by POSTing a minimal
GraphQL me query to backboard.railway.com/graphql/v2 and decoding
the response envelope (honouring Railway's 200-with-errors shape).
Adds Railway to ServiceContext, registers railway-specific keywords
(railway, railway.app, railway project/service/deployment/volume/
environment/plugin, nixpacks, railway.json/.toml), triggers LLM
classification when Railway is inferred, and clears other cloud
flags when classification lands on railway.
Adds --railway flag and the handleRailwayQuery path (mirrors Vercel):
resolve token -> create client -> fetch context -> load per-workspace
conversation history -> build system prompt -> dispatch to configured
AI provider -> persist exchange. Registers clanker_railway_ask /
clanker_railway_list MCP tools covering projects, services,
deployments, domains, variables, volumes, and workspaces. Registers
the railway cobra tree and the phase-1 railway ask stub so the
subcommand is discoverable alongside vercel.
The --railway flag was read via cmd.Flags().GetBool but never registered
with Flags().Bool, so `clanker ask --railway ...` surfaced as an unknown
flag instead of routing to handleRailwayQuery. Also threads Railway
through the credentials-subcommand long descriptions so help output
lists it alongside the other providers.
…tion)

Adds the --railway branch to --maker mode explicit provider routing,
keyword-based provider inference, LLM classification prompt, plan
prompt dispatcher (RailwayPlanPromptWithMode), and plan execution
dispatcher (ExecuteRailwayPlan). Without these glue points the
maker pipeline could not emit or apply Railway plans even though
exec_railway.go and railway_prompts.go were already in place.
@rafeegnash rafeegnash merged commit 83beab9 into master Apr 22, 2026
5 checks passed
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.

1 participant