* Add per-command telemetry via cliEventTrack mutation
Sends command name, subcommand, duration, success/error, OS, arch,
CLI version, and CI flag to the Railway API after each invocation.
Silently skipped when unauthenticated, on network failure, or when
the user opts out via DO_NOT_TRACK=1.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Migrate telemetry to typed graphql_client mutation
Pull updated schema with cliEventTrack mutation and replace the raw
JSON POST with typed codegen via graphql_client, matching the rest
of the codebase. Also adds DNS_RECORD_TYPE_TXT from the schema update.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add one-time telemetry notice on first run
Shows a notice to stderr informing users about CLI usage data
collection, with DO_NOT_TRACK=1 opt-out. Persisted to
~/.railway/notices.json so it only displays once. Suppressed
in CI/non-TTY and when telemetry is already disabled.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Support RAILWAY_NO_TELEMETRY env var for opting out of telemetry
Adds RAILWAY_NO_TELEMETRY=1 as a Railway-specific alternative to
DO_NOT_TRACK=1 for disabling CLI telemetry. Updates the notice
text to mention both variables.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix telemetry docs link to /cli/telemetry
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix cargo fmt --all formatting in telemetry notice
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Build logs were using simple output mode which only displayed the raw
message without any formatting. This meant error-level logs from the
build process (like Docker build failures) didn't show the [ERRO]
indicator that helps users quickly identify problems.
Changes:
- Add LogFormat enum with Simple, LevelOnly, and Full modes
- Build logs now use LevelOnly mode to show level indicators without
the noisy buildkit metadata (digest, source, inputs, etc.)
- Deploy logs continue to use Full mode with all attributes
This brings CLI build log output closer to what the dashboard shows.
Co-authored-by: Warp <agent@warp.dev>
* Add `environment config` subcommand
Shows environment configuration with service/volume/variable summary.
Supports --json for machine-readable output and -e to specify environment.
* fmt
* Show service names instead of IDs in human output
* Improve service display with multi-line format
* Show more service config: root, builder, regions, domains
* Remove duplicate environment display
* Remove unused environment_name
* Allow null variables for deletion
Change BTreeMap<String, Variable> to BTreeMap<String, Option<Variable>>
for shared_variables and variables fields, matching existing pattern
for domains/tcp_proxies.
* Add --2fa-code flag for non-interactive 2FA verification
When 2FA is enabled, destructive operations (project delete, environment
delete, volume delete) now support a --2fa-code flag to provide the
verification code non-interactively.
Commands updated:
- `railway delete --2fa-code <CODE>`
- `railway environment delete --2fa-code <CODE>`
- `railway volume delete --2fa-code <CODE>`
This enables fully automated workflows even when 2FA is enabled on the account.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix rustfmt formatting
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Improve error messages when running commands non-interactively
When running CLI commands without a TTY (e.g., from scripts or AI assistants),
commands that require interactive prompts now fail with helpful error messages
that explain which flags to use instead.
Changes:
- `railway service`: Now tells users to run `railway service <name>`
- `railway link`: Now tells users which flags (--workspace, --project,
--environment) are required when multiple options exist
- `railway add`: Now lists all available flags (--database, --service,
--repo, --image) instead of failing cryptically
- `railway connect`: Improved error message with usage example
This makes the CLI much more usable for automation and AI-assisted workflows.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix rustfmt formatting
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* Add `environment config` subcommand
Shows environment configuration with service/volume/variable summary.
Supports --json for machine-readable output and -e to specify environment.
* fmt
* Show service names instead of IDs in human output
* Improve service display with multi-line format
* Show more service config: root, builder, regions, domains
* Remove duplicate environment display
* Remove unused environment_name
* it works
* remove useless comment
* fix conflicts, make it work again
* update schema
* cli side work is becoming a lot closer
* organise environment command
* more cleanup
* todos
* filter out old regions from scale non-interactively
* add non-interactive options for everything
* make trait variable handling more consistent for things that require custom value parsers
* begin work on porting to other way non-interactively
* it works
* add all interactive options and fix issue with --service flag in scale command
* add build command and start command and fix some parsing errors in non-interactive
* add placeholders for env being duplicated
* add edit command
* simplify and ux
* address comments
* remove interactive auto update
* feat: Add mouse-based text selection in TUI logs
Implement custom text selection with mouse drag support in the `railway dev` TUI:
- Click and drag to select log text with visual highlighting
- Auto-copy selected text to clipboard on mouse release
- Auto-follow when scrolling back to bottom while paused
- Prevent screen flicker when scrolling down in follow mode
- Restore log buffering for better selection and scroll support
* fix: address code review issues in TUI text selection
- Consolidate LogRef enum to log_store.rs (was duplicated)
- Add clipboard failure feedback to user
- Fix prefix color logic when selection spans across prefix
- Make convert_color private
- Add comment explaining .take(2) limit in info pane
* refactor: optimize TUI log rendering and simplify selection
- Add LogRef::parts() to reduce duplication in log extraction
- Only collect visible logs instead of all logs (skip/take)
- Simplify selection rendering with explicit span regions
- Fix magic number defaults for log area bounds
- Remove unused Selection::contains method
Absorb additional Ctrl+C presses during shutdown to prevent abrupt termination
before child processes can be properly stopped. Add spinners to show shutdown
progress for both code and image services.
* feat: wait for workflow completion when adding templates/databases
- Poll workflowStatus after TemplateDeploy to wait for completion
- Auto-link service when adding a single database
- Show workflow errors with context instead of failing silently
- Improve JSON output to include serviceId/serviceName
* refactor: cleanup workflow waiting code
- remove unnecessary clone in wait_for_workflow
- improve timeout error message
- remove unused detach flag
* refactor: make wait_for_workflow generic with WorkflowError enum
Callers now map WorkflowError variants to their own messages
* fmt
* feat: add --json flag and non-interactive mode support to commands
- Add --json flag to: add, init, delete, environment, redeploy, restart, scale, unlink, up, volume
- Add --yes flag to volume attach/detach/delete for confirmation bypass
- Add terminal checks for interactive prompts in connect and volume commands
- Add 2FA bail in non-interactive mode for delete, environment delete, volume delete
- Suppress spinners/progress bars in JSON mode
- up --json outputs JSON logs like logs --json and implies CI mode behavior
* refactor: extract spinner helper, fix --json/--yes semantics
- Add create_spinner_if helper to reduce duplicated spinner code
- Add TWO_FACTOR_REQUIRES_INTERACTIVE constant for consistent 2FA errors
- Fix --json no longer implying --yes in unlink/volume commands
- Add JSON output for template deploy
- Add volume ID to volume create JSON output
- Remove unwrap in restart.rs by restructuring flow
- Pass region_data by reference in scale.rs to avoid clone
* fix: add terminal checks before confirmation prompts
Add is_terminal checks to redeploy, restart, and environment delete
commands to bail with helpful error in non-interactive mode without --yes
* fix(add): remove redundant db json output, fix typo
When a workspace has 2FA enforcement enabled and the user hasn't set up
2FA, display a user-friendly error message with the workspace name and
a direct link to the account security page.
When there's a single code service and multiple image services, tabs now display as:
code | Image | img1 | img2 (instead of Images | code | img1 | img2)
The tab order is now: Local (if shown) → code services → Image (if shown) → image services