lex-github 0.3.6 → 0.3.7
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 +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +8 -0
- data/lib/legion/extensions/github/cli/runner.rb +38 -16
- data/lib/legion/extensions/github/runners/app.rb +22 -0
- data/lib/legion/extensions/github/version.rb +1 -1
- data/lib/legion/extensions/github.rb +1 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0f30f6d7eaacb905645b1a057b6e63604eb09fc18373c8e5fa5554fedf74104
|
|
4
|
+
data.tar.gz: 22cef5420322e0d318f37d2deb17710444f0502ac69fa181066b4ef46aaa4a0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ac81a5422067cf2d0b0c552bd92f31c7dc78bb1cad6bda56a3bcc21a62fc7ff1fb66a0ecd526c4dc49cb2e77228cb556908e28b2455a1e71076565ff2bb2c212
|
|
7
|
+
data.tar.gz: 778c8d79bc12f68d9b28dc9b71184530179835b9ca43d8bf89625a290d2e744b2febf892522afa406e424a77bfecb1537a3765983eac138d4f3abc35c6d6b908
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.9
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.3.7] - 2026-04-15
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- `CLI::AppRunner#setup` and `#complete_setup` were posting to `/api/extensions/github/cli/app/*` which is not a valid daemon route; corrected to `/api/extensions/github/runners/app/*`
|
|
9
|
+
- `Runners::App` was missing entirely — added `runners/app.rb` as a proper runner module including `CLI::App` so the daemon auto-registers the routes via `build_routes`
|
|
10
|
+
- Added `require 'legion/extensions/github/runners/app'` to main `github.rb` load chain
|
|
11
|
+
- `AppRunner` now prompts interactively for `name`, `url`, and `webhook_url` when not provided; bumped `read_timeout` to 300s to survive the OAuth callback wait
|
|
12
|
+
|
|
5
13
|
## [0.3.6] - 2026-04-14
|
|
6
14
|
|
|
7
15
|
### Added
|
|
@@ -18,7 +18,7 @@ module Legion
|
|
|
18
18
|
uri = URI("#{DAEMON_URL}#{path}")
|
|
19
19
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
20
20
|
http.open_timeout = 5
|
|
21
|
-
http.read_timeout =
|
|
21
|
+
http.read_timeout = 300
|
|
22
22
|
request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
|
|
23
23
|
request.body = ::JSON.generate(body)
|
|
24
24
|
parse_response(http.request(request))
|
|
@@ -40,14 +40,24 @@ module Legion
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def print_json(result)
|
|
43
|
-
if result.is_a?(Hash) && result[:error]
|
|
44
|
-
warn "Error: #{result[:error]}"
|
|
43
|
+
if result.is_a?(Hash) && (result[:error] || result.dig(:error, :code))
|
|
44
|
+
warn "Error: #{result[:error] || result.dig(:error, :message)}"
|
|
45
45
|
warn " #{result[:description]}" if result[:description]
|
|
46
46
|
else
|
|
47
47
|
puts ::JSON.pretty_generate(result)
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
def prompt(label, default: nil)
|
|
52
|
+
if default
|
|
53
|
+
$stderr.print "#{label} [#{default}]: "
|
|
54
|
+
else
|
|
55
|
+
$stderr.print "#{label}: "
|
|
56
|
+
end
|
|
57
|
+
input = $stdin.gets&.chomp
|
|
58
|
+
input.nil? || input.empty? ? default : input
|
|
59
|
+
end
|
|
60
|
+
|
|
51
61
|
def open_browser(url)
|
|
52
62
|
cmd = case RbConfig::CONFIG['host_os']
|
|
53
63
|
when /darwin/ then 'open'
|
|
@@ -74,28 +84,40 @@ module Legion
|
|
|
74
84
|
include DaemonApi
|
|
75
85
|
|
|
76
86
|
def setup
|
|
77
|
-
|
|
87
|
+
warn 'GitHub App Setup — the daemon will start a local callback server and open your browser.'
|
|
88
|
+
warn ''
|
|
89
|
+
|
|
90
|
+
name = prompt('App name')
|
|
91
|
+
url = prompt('App homepage URL (e.g. https://your-domain.com)')
|
|
92
|
+
webhook_url = prompt('Webhook URL (e.g. https://your-domain.com/webhooks/github)')
|
|
93
|
+
org = prompt('GitHub org (leave blank for personal account)', default: nil)
|
|
94
|
+
|
|
95
|
+
body = { name: name, url: url, webhook_url: webhook_url }
|
|
96
|
+
body[:org] = org if org && !org.empty?
|
|
78
97
|
|
|
79
|
-
|
|
98
|
+
warn ''
|
|
99
|
+
warn 'Sending setup request to daemon...'
|
|
100
|
+
|
|
101
|
+
result = api_post('/api/extensions/github/runners/app/setup', body)
|
|
102
|
+
|
|
103
|
+
if result[:error] || result.dig(:error, :code)
|
|
80
104
|
print_json(result)
|
|
81
105
|
return
|
|
82
106
|
end
|
|
83
107
|
|
|
84
|
-
|
|
85
|
-
if
|
|
86
|
-
warn
|
|
87
|
-
open_browser(
|
|
88
|
-
warn 'Waiting for callback...'
|
|
89
|
-
poll = api_post('/api/extensions/github/cli/app/await_callback',
|
|
90
|
-
{ timeout: 300 })
|
|
91
|
-
print_json(poll)
|
|
92
|
-
else
|
|
93
|
-
print_json(result)
|
|
108
|
+
manifest_url = result.dig(:result, :manifest_url)
|
|
109
|
+
if manifest_url
|
|
110
|
+
warn "Opening browser: #{manifest_url}"
|
|
111
|
+
open_browser(manifest_url)
|
|
112
|
+
warn 'Waiting for GitHub callback (daemon is listening)...'
|
|
94
113
|
end
|
|
114
|
+
|
|
115
|
+
print_json(result)
|
|
95
116
|
end
|
|
96
117
|
|
|
97
118
|
def complete_setup
|
|
98
|
-
|
|
119
|
+
code = prompt('Authorization code from GitHub callback')
|
|
120
|
+
print_json(api_post('/api/extensions/github/runners/app/complete_setup', { code: code }))
|
|
99
121
|
end
|
|
100
122
|
end
|
|
101
123
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/github/cli/app'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Github
|
|
8
|
+
module Runners
|
|
9
|
+
module App
|
|
10
|
+
include Legion::Extensions::Github::CLI::App
|
|
11
|
+
|
|
12
|
+
def self.remote_invocable?
|
|
13
|
+
false
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|
|
17
|
+
Legion::Extensions::Helpers.const_defined?(:Lex, false)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -19,6 +19,7 @@ require 'legion/extensions/github/helpers/callback_server'
|
|
|
19
19
|
require 'legion/extensions/github/helpers/browser_auth'
|
|
20
20
|
require 'legion/extensions/github/cli/auth'
|
|
21
21
|
require 'legion/extensions/github/cli/app'
|
|
22
|
+
require 'legion/extensions/github/runners/app'
|
|
22
23
|
require 'legion/extensions/github/runners/repositories'
|
|
23
24
|
require 'legion/extensions/github/runners/issues'
|
|
24
25
|
require 'legion/extensions/github/runners/pull_requests'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-github
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -162,6 +162,7 @@ files:
|
|
|
162
162
|
- ".gitignore"
|
|
163
163
|
- ".rspec"
|
|
164
164
|
- ".rubocop.yml"
|
|
165
|
+
- ".ruby-version"
|
|
165
166
|
- CHANGELOG.md
|
|
166
167
|
- CLAUDE.md
|
|
167
168
|
- Dockerfile
|
|
@@ -207,6 +208,7 @@ files:
|
|
|
207
208
|
- lib/legion/extensions/github/oauth/transport/exchanges/oauth.rb
|
|
208
209
|
- lib/legion/extensions/github/oauth/transport/queues/auth.rb
|
|
209
210
|
- lib/legion/extensions/github/runners/actions.rb
|
|
211
|
+
- lib/legion/extensions/github/runners/app.rb
|
|
210
212
|
- lib/legion/extensions/github/runners/auth.rb
|
|
211
213
|
- lib/legion/extensions/github/runners/branches.rb
|
|
212
214
|
- lib/legion/extensions/github/runners/checks.rb
|