lazyrails-tui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +30 -0
- data/LICENSE +21 -0
- data/README.md +124 -0
- data/bin/lazyrails +44 -0
- data/lib/lazyrails/app.rb +568 -0
- data/lib/lazyrails/command_annotator.rb +46 -0
- data/lib/lazyrails/command_log.rb +65 -0
- data/lib/lazyrails/command_log_overlay.rb +68 -0
- data/lib/lazyrails/command_runner.rb +51 -0
- data/lib/lazyrails/config.rb +38 -0
- data/lib/lazyrails/confirmation.rb +82 -0
- data/lib/lazyrails/data_loader.rb +308 -0
- data/lib/lazyrails/eval_entry.rb +11 -0
- data/lib/lazyrails/file_cache.rb +19 -0
- data/lib/lazyrails/flash.rb +26 -0
- data/lib/lazyrails/help_overlay.rb +146 -0
- data/lib/lazyrails/input_mode.rb +51 -0
- data/lib/lazyrails/introspect.rb +129 -0
- data/lib/lazyrails/introspect_runner.rb +214 -0
- data/lib/lazyrails/jobs_query_runner.rb +312 -0
- data/lib/lazyrails/log_watcher.rb +99 -0
- data/lib/lazyrails/menu_overlay.rb +237 -0
- data/lib/lazyrails/message_handlers.rb +217 -0
- data/lib/lazyrails/panel.rb +114 -0
- data/lib/lazyrails/panel_handlers.rb +598 -0
- data/lib/lazyrails/parsers/gemfile_lock.rb +62 -0
- data/lib/lazyrails/parsers/log_parser.rb +68 -0
- data/lib/lazyrails/parsers/migration_diff.rb +69 -0
- data/lib/lazyrails/parsers/model_file.rb +84 -0
- data/lib/lazyrails/parsers/rails_about.rb +24 -0
- data/lib/lazyrails/parsers/rails_notes.rb +31 -0
- data/lib/lazyrails/parsers/rails_stats.rb +38 -0
- data/lib/lazyrails/parsers/schema.rb +68 -0
- data/lib/lazyrails/parsers/test_output.rb +41 -0
- data/lib/lazyrails/platform.rb +18 -0
- data/lib/lazyrails/project.rb +119 -0
- data/lib/lazyrails/renderer.rb +325 -0
- data/lib/lazyrails/server_manager.rb +151 -0
- data/lib/lazyrails/structs.rb +165 -0
- data/lib/lazyrails/table_browser.rb +275 -0
- data/lib/lazyrails/table_query_runner.rb +41 -0
- data/lib/lazyrails/user_settings.rb +42 -0
- data/lib/lazyrails/version.rb +5 -0
- data/lib/lazyrails/view_helpers.rb +68 -0
- data/lib/lazyrails/views/command_log_view.rb +77 -0
- data/lib/lazyrails/views/console_view.rb +35 -0
- data/lib/lazyrails/views/credentials_view.rb +43 -0
- data/lib/lazyrails/views/custom_commands_view.rb +31 -0
- data/lib/lazyrails/views/database_view.rb +87 -0
- data/lib/lazyrails/views/error_view.rb +39 -0
- data/lib/lazyrails/views/gems_view.rb +26 -0
- data/lib/lazyrails/views/jobs_view.rb +96 -0
- data/lib/lazyrails/views/log_view.rb +67 -0
- data/lib/lazyrails/views/mailer_view.rb +49 -0
- data/lib/lazyrails/views/models_view.rb +83 -0
- data/lib/lazyrails/views/rake_view.rb +49 -0
- data/lib/lazyrails/views/routes_view.rb +71 -0
- data/lib/lazyrails/views/server_view.rb +44 -0
- data/lib/lazyrails/views/status_view.rb +71 -0
- data/lib/lazyrails/views/tests_view.rb +26 -0
- data/lib/lazyrails/welcome_overlay.rb +115 -0
- data/lib/lazyrails.rb +77 -0
- metadata +152 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4f067de1878cccd54415b2a30297a30418a533563d6e04b7279f0c2b5f591a37
|
|
4
|
+
data.tar.gz: 7388911547568ac6133517d410089eada3180928dc04078b51b900479de21aa2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 7b429462108c2c9675925abd819af28d7a2ce15f9508f72c132d50d84b9171441de002afaa99e1c5d4594ac907d89406f789799641405eedc335194f744a44c5
|
|
7
|
+
data.tar.gz: 54eaf790e1b52e4ebc7e712d45fb838a03acce70b2fb349af337a0853302ebf8d4be7aeae22b4e4a6980ead16eaa7fbba79f7e5190126f7adbeb35163a7a5c0b
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-03-06
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Split-pane TUI with 14 panels: Status, Server, Routes, Database, Models, Tests, Gems, Rake, Console, Credentials, Logs, Mailers, Jobs, Custom Commands
|
|
15
|
+
- Rails introspection via `rails runner` for routes, migrations, models, associations, validations, rake tasks
|
|
16
|
+
- Fallback schema.rb parsing when Rails can't boot
|
|
17
|
+
- Dev server management (start/stop/restart) with bin/dev support
|
|
18
|
+
- Live log tailing with slow request and error filtering
|
|
19
|
+
- Test runner with per-file and full-suite execution (RSpec and Minitest)
|
|
20
|
+
- Interactive table data browser with WHERE, ORDER BY, and pagination
|
|
21
|
+
- Generator menu for models, migrations, controllers, scaffolds, jobs, mailers, channels, and stimulus controllers
|
|
22
|
+
- Rails console integration with expression evaluation
|
|
23
|
+
- Credentials viewer with per-environment decryption
|
|
24
|
+
- Mailer preview rendering
|
|
25
|
+
- Solid Queue jobs panel with retry, discard, dispatch, and status filtering
|
|
26
|
+
- Gem management with update and homepage links
|
|
27
|
+
- Command log with full history and undo support
|
|
28
|
+
- Three-tier confirmation system (green/yellow/red) for destructive operations
|
|
29
|
+
- Custom commands via `.lazyrails.yml` configuration
|
|
30
|
+
- Filterable panels with `/` search
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LazyRails Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# LazyRails
|
|
2
|
+
|
|
3
|
+
A [lazygit](https://github.com/jesseduffield/lazygit)-style terminal UI for Rails. Everything the Rails CLI can do, in one split-pane interface.
|
|
4
|
+
|
|
5
|
+
<!-- TODO: add screenshot or demo GIF here -->
|
|
6
|
+
|
|
7
|
+
Built with [Chamomile](https://github.com/xjackk/chamomile) (chamomile + petals + flourish).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
gem install lazyrails
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or in your Gemfile:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
gem "lazyrails", group: :development
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Requires Ruby >= 3.2.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
cd your-rails-app
|
|
27
|
+
lazyrails
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## What's in it
|
|
31
|
+
|
|
32
|
+
LazyRails has 13 panels you can tab between. Each one wraps a chunk of the Rails CLI:
|
|
33
|
+
|
|
34
|
+
| Panel | What you get |
|
|
35
|
+
|-------------|------------------------------------------------------|
|
|
36
|
+
| Status | Rails/Ruby version, env, app name, git branch, stats |
|
|
37
|
+
| Server | Start/stop/restart your dev server (supports bin/dev)|
|
|
38
|
+
| Routes | All routes — filter, group by controller |
|
|
39
|
+
| Database | Migrations with status, run up/down, browse table data with WHERE/ORDER BY |
|
|
40
|
+
| Models | Columns, associations, validations |
|
|
41
|
+
| Tests | Run individual files or the full suite (RSpec + Minitest) |
|
|
42
|
+
| Gems | Everything in Gemfile.lock — update, open homepage |
|
|
43
|
+
| Rake | All rake tasks |
|
|
44
|
+
| Console | Evaluate Ruby expressions without leaving the TUI |
|
|
45
|
+
| Credentials | Decrypt and view per-environment credentials |
|
|
46
|
+
| Logs | Live request log tailing, filter by slow/errors |
|
|
47
|
+
| Mailers | Preview mailers, render output, open in browser |
|
|
48
|
+
| Jobs | Solid Queue — retry, discard, dispatch, filter by status |
|
|
49
|
+
|
|
50
|
+
If you add a `.lazyrails.yml`, you also get a Custom Commands panel (see below).
|
|
51
|
+
|
|
52
|
+
## Keybindings
|
|
53
|
+
|
|
54
|
+
`?` opens the full help overlay inside the app. Here are the essentials:
|
|
55
|
+
|
|
56
|
+
**Navigation:** `Tab`/`Shift+Tab` cycle panels, `1`-`9` jump, `j`/`k` scroll, `Enter` select, `/` filter, `q` quit.
|
|
57
|
+
|
|
58
|
+
**Global:** `G` generator menu, `x` panel action menu, `R` refresh, `L` command log, `z` undo.
|
|
59
|
+
|
|
60
|
+
Each panel has its own keys — `s`/`S`/`r` for server, `m`/`M` for migrations, `a`/`f` for tests, etc. Press `x` on any panel to see what's available, or `?` for the full list.
|
|
61
|
+
|
|
62
|
+
## Generator menu
|
|
63
|
+
|
|
64
|
+
Press `G` from anywhere to scaffold new code. Pick a type (model, migration, controller, scaffold, job, mailer, channel, stimulus), type the arguments, and it runs `rails generate` for you.
|
|
65
|
+
|
|
66
|
+
## Table browser
|
|
67
|
+
|
|
68
|
+
From the Database panel, press `t` to browse table data. You can set WHERE clauses, ORDER BY, and page through results. It's raw SQL against your dev database — useful for poking around without opening a console.
|
|
69
|
+
|
|
70
|
+
## Jobs (Solid Queue)
|
|
71
|
+
|
|
72
|
+
If your app uses Solid Queue, the Jobs panel shows all queued/running/failed/scheduled jobs. You can retry or discard failed jobs, dispatch scheduled jobs early, and filter by status. If Solid Queue isn't installed, the panel just says so — no crash.
|
|
73
|
+
|
|
74
|
+
## Custom commands
|
|
75
|
+
|
|
76
|
+
Create `.lazyrails.yml` in your Rails root:
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
custom_commands:
|
|
80
|
+
- name: "Seed Database"
|
|
81
|
+
key: "s"
|
|
82
|
+
command: "bin/rails db:seed"
|
|
83
|
+
confirmation: yellow
|
|
84
|
+
- name: "Reset Database"
|
|
85
|
+
key: "r"
|
|
86
|
+
command: "bin/rails db:reset"
|
|
87
|
+
confirmation: red
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Confirmation levels: `green` (runs immediately), `yellow` (y/n prompt), `red` (type the panel name to confirm).
|
|
91
|
+
|
|
92
|
+
## Safety
|
|
93
|
+
|
|
94
|
+
LazyRails won't let you accidentally nuke your database. Destructive commands go through confirmation tiers:
|
|
95
|
+
|
|
96
|
+
- `db:migrate`, `bundle update <gem>` — just runs
|
|
97
|
+
- `db:rollback`, `bundle update` — asks y/n
|
|
98
|
+
- `db:drop`, `db:reset` — you have to type the panel name to confirm
|
|
99
|
+
|
|
100
|
+
Every command is logged. Press `L` to see what ran, and `z` to undo the last reversible action.
|
|
101
|
+
|
|
102
|
+
## How it works
|
|
103
|
+
|
|
104
|
+
LazyRails shells out to `rails runner` to introspect your app — routes, migrations, models, associations, validations, rake tasks — and gets structured JSON back. This is more reliable than parsing CLI text output.
|
|
105
|
+
|
|
106
|
+
If Rails can't boot (missing gems, broken config), it falls back to parsing `db/schema.rb` and model files directly so you still get something useful.
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
git clone https://github.com/xjackk/lazyrails
|
|
112
|
+
cd lazyrails
|
|
113
|
+
bundle install
|
|
114
|
+
bundle exec ruby bin/lazyrails /path/to/rails/app
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
bundle exec rspec
|
|
119
|
+
bundle exec rubocop
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
data/bin/lazyrails
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "lazyrails"
|
|
5
|
+
|
|
6
|
+
case ARGV[0]
|
|
7
|
+
when "--version", "-v"
|
|
8
|
+
puts "lazyrails #{LazyRails::VERSION}"
|
|
9
|
+
exit 0
|
|
10
|
+
when "--help", "-h"
|
|
11
|
+
puts <<~HELP
|
|
12
|
+
Usage: lazyrails [directory]
|
|
13
|
+
|
|
14
|
+
A lazygit-style terminal UI for the Rails command line.
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
-v, --version Show version
|
|
18
|
+
-h, --help Show this help
|
|
19
|
+
|
|
20
|
+
Run without arguments inside a Rails project, or pass a path:
|
|
21
|
+
lazyrails /path/to/rails/app
|
|
22
|
+
HELP
|
|
23
|
+
exit 0
|
|
24
|
+
when /\A-/
|
|
25
|
+
warn "Unknown option: #{ARGV[0]}"
|
|
26
|
+
warn "Run 'lazyrails --help' for usage."
|
|
27
|
+
exit 1
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
dir = ARGV[0] || Dir.pwd
|
|
31
|
+
|
|
32
|
+
project = LazyRails::Project.detect(dir)
|
|
33
|
+
if project.nil?
|
|
34
|
+
warn "Not a Rails project: #{dir}"
|
|
35
|
+
warn "Expected to find bin/rails or a Gemfile with 'rails'"
|
|
36
|
+
exit 1
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
if project.old_rails?
|
|
40
|
+
warn "Warning: Detected Rails #{project.rails_version} — some features may not work"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
app = LazyRails::App.new(project)
|
|
44
|
+
Chamomile.run(app, alt_screen: true)
|