Skip to content

feat: add railway agent subcommand for natural-language chat#841

Merged
codyde merged 8 commits intomasterfrom
cody/natural-language-prompt
Apr 16, 2026
Merged

feat: add railway agent subcommand for natural-language chat#841
codyde merged 8 commits intomasterfrom
cody/natural-language-prompt

Conversation

@codyde
Copy link
Copy Markdown
Collaborator

@codyde codyde commented Apr 13, 2026

Summary

  • Adds a new railway agent subcommand that sends natural language prompts to the Railway AI chat API via SSE streaming
  • railway agent enters an interactive REPL with thread continuity
  • railway agent -p "message" sends a single-shot prompt and exits
  • --json flag emits a single machine-parseable JSON object (response text, thread id, tool calls)
  • --thread-id, --service, and --environment flags scope and continue chats
  • Adds randomized train-themed "Thinking..." spinner, "Railway Agent:" response header, git-tree style connector (╰─) from thinking to tool calls, and grey-box tool-call rendering
  • TTY-aware output — no spinner/ANSI artifacts when piped
  • Uses get_or_prompt_service() for interactive service selection when no service is linked

Test plan

  • railway agent -p "what services do I have?" — streams a response with tool call indicators
  • railway agent — enters interactive REPL; exit/quit/Ctrl+C ends it
  • railway agent -p "status" --json — outputs a single JSON object
  • railway agent -p "..." | cat — no spinner artifacts in output
  • railway agent --thread-id <id> -p "follow up" — continues an existing thread
  • Run without a linked project — shows NoLinkedProject error
  • Run with multiple services and no linked service — prompts for service selection

🤖 Generated with Claude Code

codyde and others added 3 commits April 12, 2026 09:33
Adds a top-level `-p` / `--prompt` flag that sends natural language
prompts to the Railway AI chat API via SSE streaming. Supports
single-shot mode (`railway -p "message"`) and interactive REPL
(`railway -p`).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add "Thinking..." spinner on initial request
- Add "Railway AI:" header before response text
- Dim tool call spinners and suppress them in non-TTY mode
- Use get_or_prompt_service() for interactive service selection
- Add --json root flag that outputs accumulated response as a single
  JSON object with threadId, response text, and toolCalls
- Add telemetry tracking for the -p flag path
- Improve non-interactive error message with flag hint

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codyde codyde added the release/minor Author minor release label Apr 14, 2026
codyde and others added 4 commits April 13, 2026 21:58
- Skip project access tokens in build_chat_client() — the chat API
  requires user OAuth tokens and rejects RAILWAY_TOKEN
- Fix error event parsing: API sends `error` field, not `message`
- Handle `aborted` events from the agent stream
- Add fallback for both `error` and `message` field names for
  forward compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move from root-level `-p` flag to `railway agent` subcommand
- `railway agent` enters interactive REPL
- `railway agent -p "message"` sends a single prompt
- Rename "Railway AI" to "Railway Agent" throughout
- Add train-themed randomized thinking messages
- Add git-tree style connector (╰─) linking thinking to tool calls
- Tool calls render in grey box with white text
- Reset "Railway Agent:" prefix for each new response block
- Telemetry now handled automatically via commands! macro

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codyde codyde marked this pull request as ready for review April 16, 2026 17:13
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codyde codyde changed the title feat: add natural language prompt flag (railway -p) feat: add railway agent subcommand for natural-language chat Apr 16, 2026
@codyde codyde merged commit 2ee9277 into master Apr 16, 2026
6 checks passed
@codyde codyde deleted the cody/natural-language-prompt branch April 16, 2026 17:57
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.

2 participants