sqdash 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6331093df3973dab4ab641090a1065e284147718c0475f104f831553b6ce106
4
- data.tar.gz: 974aada0730279565ca8c7f24d9bc79d644052c960af4fe98725d0b771e9f9a3
3
+ metadata.gz: dbf32880457e6d0e0ee135bdedcd9c4011bcf4a446c195eaa18a296e2afc20c6
4
+ data.tar.gz: e1dfaf39989e034e60c48932dc7a0599d0c3a1b42db79b7058e49b7325450f64
5
5
  SHA512:
6
- metadata.gz: 85d9f93d466ef2731a851c34375a6675b9e94a965752614a730825593f2641168e3cf522b2ca82338b235a7346b9e5df88391866fef1598c5892e1eb67a553ce
7
- data.tar.gz: bfe3cfe773ea0cca2aa708ffd87c216012d93985d91eaef90784be752e5d529b5d5a52f3ede55d4dc818a905da54e7b1c34acc138009b32db3ff1d631ae8d584
6
+ metadata.gz: bf714d16853aab1ccdf74e756dfdb0477b459903fa5c6f20d8984673946562cb693c3f51bde983882a8add79107d44ecdce7fb872e7f49a1c63c77b812d1048e
7
+ data.tar.gz: d06062de2d0d589685e015b8da084414460c38b9688069cf0b73ba2973704f6d33606cc3e1df7a609acea3ccd0fb8b5f9985a41e53d41055a16debf062838046
data/README.md CHANGED
@@ -13,6 +13,7 @@ Solid Queue is the default Active Job backend in Rails 8, but it ships with no b
13
13
  - Retry or discard failed jobs with a single keypress
14
14
  - k9s-style `:` command bar with Tab autocomplete
15
15
  - `/` search with inline autocomplete hints
16
+ - Job detail view with arguments, timestamps, and error backtraces
16
17
 
17
18
  ## Installation
18
19
 
@@ -42,6 +43,11 @@ gem install sqlite3 # SQLite
42
43
 
43
44
  ## Usage
44
45
 
46
+ ```bash
47
+ sqdash --help # Show usage and keybindings
48
+ sqdash --version # Show version
49
+ ```
50
+
45
51
  ```bash
46
52
  # PostgreSQL
47
53
  sqdash postgres://user:pass@localhost:5432/myapp_queue
@@ -67,6 +73,7 @@ Connection priority: **CLI argument** > **`DATABASE_URL` env var** > **built-in
67
73
  | Key | Action |
68
74
  |-----|--------|
69
75
  | `↑` `↓` | Navigate job list |
76
+ | `Enter` | Open job detail view |
70
77
  | `/` | Filter jobs (fuzzy search across all columns) |
71
78
  | `:` | Command bar (sort, switch views) |
72
79
  | `Tab` | Autocomplete (in filter or command mode) |
data/lib/sqdash/cli.rb CHANGED
@@ -7,6 +7,39 @@ module Sqdash
7
7
  class CLI
8
8
  DEFAULT_DB_URL = "postgres://sqd:sqd@localhost:5432/sqd_web_development_queue"
9
9
 
10
+ HELP_TEXT = <<~HELP
11
+ Usage: sqdash [database-url]
12
+
13
+ A terminal dashboard for Rails 8's Solid Queue.
14
+
15
+ Arguments:
16
+ database-url Database connection URL (optional)
17
+ Defaults to $DATABASE_URL or a local dev database
18
+
19
+ Options:
20
+ -h, --help Show this help message
21
+ -v, --version Show version
22
+
23
+ Keybindings:
24
+ ↑/↓ Navigate job list
25
+ Enter View job details
26
+ / Filter jobs (by class, queue, or ID)
27
+ : Command mode (sort, view)
28
+ r Retry failed job
29
+ d Discard failed job
30
+ Space Refresh data
31
+ q Quit
32
+
33
+ Commands (in : mode):
34
+ sort created|id asc|desc Sort jobs
35
+ view all|failed|completed|pending Filter by status
36
+
37
+ Examples:
38
+ sqdash
39
+ sqdash postgres://user:pass@host:5432/myapp_production
40
+ DATABASE_URL=postgres://... sqdash
41
+ HELP
42
+
10
43
  COMMANDS = {
11
44
  "sort" => {
12
45
  "created" => ["asc", "desc"],
@@ -21,6 +54,14 @@ module Sqdash
21
54
  }.freeze
22
55
 
23
56
  def self.start
57
+ case ARGV[0]
58
+ when "-h", "--help"
59
+ puts HELP_TEXT
60
+ exit
61
+ when "-v", "--version"
62
+ puts "sqdash #{Sqdash::VERSION}"
63
+ exit
64
+ end
24
65
  new.run
25
66
  end
26
67
 
@@ -93,10 +134,14 @@ module Sqdash
93
134
 
94
135
  def terminal_height
95
136
  $stdout.winsize[0]
137
+ rescue
138
+ 24
96
139
  end
97
140
 
98
141
  def terminal_width
99
142
  $stdout.winsize[1]
143
+ rescue
144
+ 80
100
145
  end
101
146
 
102
147
  def visible_rows
@@ -251,8 +296,14 @@ module Sqdash
251
296
  end
252
297
  end
253
298
 
254
- # Clear remaining rows
255
- (rows - visible_jobs.length).times { puts "\e[K" }
299
+ # Empty state
300
+ if visible_jobs.empty?
301
+ puts " \e[90mNo jobs found\e[0m\e[K"
302
+ (rows - 1).times { puts "\e[K" }
303
+ else
304
+ # Clear remaining rows
305
+ (rows - visible_jobs.length).times { puts "\e[K" }
306
+ end
256
307
 
257
308
  # Scrollbar hint
258
309
  puts "\e[90m#{"─" * w}\e[0m"
@@ -635,11 +686,15 @@ module Sqdash
635
686
  lines << ""
636
687
 
637
688
  lines << "\e[1mArguments:\e[0m"
638
- begin
639
- args = JSON.parse(job.arguments)
640
- JSON.pretty_generate(args).each_line { |l| lines << " #{l.chomp}" }
641
- rescue JSON::ParserError
642
- lines << " #{job.arguments}"
689
+ if job.arguments.nil? || job.arguments.empty?
690
+ lines << " —"
691
+ else
692
+ begin
693
+ args = JSON.parse(job.arguments)
694
+ JSON.pretty_generate(args).each_line { |l| lines << " #{l.chomp}" }
695
+ rescue JSON::ParserError, TypeError
696
+ lines << " #{job.arguments}"
697
+ end
643
698
  end
644
699
 
645
700
  if status == :failed && job.failed_execution
@@ -15,8 +15,10 @@ module Sqdash
15
15
  require_adapter!(url)
16
16
  ActiveRecord::Base.establish_connection(url)
17
17
  ActiveRecord::Base.connection
18
- rescue ActiveRecord::ConnectionNotEstablished => e
19
- abort "\e[31mFailed to connect to database: #{e.message}\e[0m"
18
+ rescue => e
19
+ abort "\e[31mFailed to connect: #{e.message}\e[0m\n\n" \
20
+ "Usage: sqdash <database-url>\n" \
21
+ "Run sqdash --help for details."
20
22
  end
21
23
 
22
24
  def self.require_adapter!(url)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sqdash
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqdash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nuha
@@ -52,7 +52,6 @@ licenses:
52
52
  metadata:
53
53
  homepage_uri: https://github.com/nuhasami/sqdash
54
54
  source_code_uri: https://github.com/nuhasami/sqdash
55
- changelog_uri: https://github.com/nuhasami/sqdash/blob/main/CHANGELOG.md
56
55
  post_install_message:
57
56
  rdoc_options: []
58
57
  require_paths: