lex-github 0.3.1 → 0.3.2
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/CHANGELOG.md +8 -0
- data/lib/legion/extensions/github/cli/runner.rb +93 -0
- data/lib/legion/extensions/github/version.rb +1 -1
- data/lib/legion/extensions/github.rb +37 -0
- data/lib/lex/github.rb +4 -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: 8ea69decf68b91f650186b1719a7e29646ce4f7308bd2d90eebeadcd6048718d
|
|
4
|
+
data.tar.gz: 3bdf52e0d20f137e7efb2f7c7330905de6b924d184edb4007c616435d679f44a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2cc5f719ed57a84ebc740a0009a0836fecfcfaa162794e64806e9770dc653e2368ac37d44ef3655d29bd132ed1957148be691dd4544fadb05e969250949144ce
|
|
7
|
+
data.tar.gz: 9bccdb81c9b7f52348c623b19473db41bc36f3d5539680789eceb7d50997136abafe3d42dcccb3010dacb57db8fb7c53998b1ea0374adfedab54e0414b7364af
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.3.2] - 2026-03-31
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- CLI command registration: `legionio lex exec github auth status|login` and `legionio lex exec github app setup|complete_setup`
|
|
9
|
+
- `CLI::AuthRunner` and `CLI::AppRunner` wrapper classes for `lex exec` dispatch
|
|
10
|
+
- Self-registering CLI manifest at `~/.legionio/cache/cli/lex-github.json` (written on first require)
|
|
11
|
+
- Require redirect `lib/lex/github.rb` for `lex exec` compatibility
|
|
12
|
+
|
|
5
13
|
## [0.3.1] - 2026-03-30
|
|
6
14
|
|
|
7
15
|
### Changed
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/github/cli/auth'
|
|
4
|
+
require 'legion/extensions/github/cli/app'
|
|
5
|
+
require 'legion/extensions/github/app/runners/credential_store'
|
|
6
|
+
|
|
7
|
+
module Legion
|
|
8
|
+
module Extensions
|
|
9
|
+
module Github
|
|
10
|
+
module CLI
|
|
11
|
+
class AuthRunner
|
|
12
|
+
include Legion::Logging::Helper if defined?(Legion::Logging::Helper)
|
|
13
|
+
include Github::CLI::Auth
|
|
14
|
+
include Github::App::Runners::CredentialStore
|
|
15
|
+
|
|
16
|
+
def credential_fingerprint(auth_type:, identifier:)
|
|
17
|
+
"#{auth_type}:#{identifier}"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def vault_get(path)
|
|
21
|
+
return nil unless defined?(Legion::Crypt)
|
|
22
|
+
|
|
23
|
+
::Legion::Crypt.get(path)
|
|
24
|
+
rescue StandardError => e
|
|
25
|
+
log.warn("[lex-github] vault_get failed: #{e.message}")
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def cache_connected?
|
|
30
|
+
defined?(Legion::Cache) && ::Legion::Cache.connected?
|
|
31
|
+
rescue StandardError => e
|
|
32
|
+
log.debug("[lex-github] cache_connected? check failed: #{e.message}")
|
|
33
|
+
false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def local_cache_connected?
|
|
37
|
+
defined?(Legion::Cache::Local) && ::Legion::Cache::Local.connected?
|
|
38
|
+
rescue StandardError => e
|
|
39
|
+
log.debug("[lex-github] local_cache_connected? check failed: #{e.message}")
|
|
40
|
+
false
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def cache_get(key)
|
|
44
|
+
::Legion::Cache.get(key)
|
|
45
|
+
rescue StandardError => e
|
|
46
|
+
log.debug("[lex-github] cache_get failed: #{e.message}")
|
|
47
|
+
nil
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def local_cache_get(key)
|
|
51
|
+
::Legion::Cache::Local.get(key)
|
|
52
|
+
rescue StandardError => e
|
|
53
|
+
log.debug("[lex-github] local_cache_get failed: #{e.message}")
|
|
54
|
+
nil
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def cache_set(key, value, ttl: 300)
|
|
58
|
+
::Legion::Cache.set(key, value, ttl)
|
|
59
|
+
rescue StandardError => e
|
|
60
|
+
log.debug("[lex-github] cache_set failed: #{e.message}")
|
|
61
|
+
nil
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def local_cache_set(key, value, ttl: 300)
|
|
65
|
+
::Legion::Cache::Local.set(key, value, ttl)
|
|
66
|
+
rescue StandardError => e
|
|
67
|
+
log.debug("[lex-github] local_cache_set failed: #{e.message}")
|
|
68
|
+
nil
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
class AppRunner
|
|
73
|
+
include Legion::Logging::Helper if defined?(Legion::Logging::Helper)
|
|
74
|
+
include Github::CLI::App
|
|
75
|
+
include Github::App::Runners::CredentialStore
|
|
76
|
+
|
|
77
|
+
def credential_fingerprint(auth_type:, identifier:)
|
|
78
|
+
"#{auth_type}:#{identifier}"
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def vault_get(path)
|
|
82
|
+
return nil unless defined?(Legion::Crypt)
|
|
83
|
+
|
|
84
|
+
::Legion::Crypt.get(path)
|
|
85
|
+
rescue StandardError => e
|
|
86
|
+
log.warn("[lex-github] vault_get failed: #{e.message}")
|
|
87
|
+
nil
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -37,11 +37,48 @@ require 'legion/extensions/github/runners/releases'
|
|
|
37
37
|
require 'legion/extensions/github/runners/deployments'
|
|
38
38
|
require 'legion/extensions/github/runners/repository_webhooks'
|
|
39
39
|
require 'legion/extensions/github/client'
|
|
40
|
+
require 'legion/extensions/github/cli/runner'
|
|
40
41
|
|
|
41
42
|
module Legion
|
|
42
43
|
module Extensions
|
|
43
44
|
module Github
|
|
44
45
|
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core, false
|
|
46
|
+
|
|
47
|
+
CLI_COMMANDS = {
|
|
48
|
+
'auth' => {
|
|
49
|
+
class_name: 'Legion::Extensions::Github::CLI::AuthRunner',
|
|
50
|
+
methods: {
|
|
51
|
+
'login' => { desc: 'Authenticate with GitHub via OAuth browser flow', args: '' },
|
|
52
|
+
'status' => { desc: 'Show current GitHub authentication status', args: '' }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
'app' => {
|
|
56
|
+
class_name: 'Legion::Extensions::Github::CLI::AppRunner',
|
|
57
|
+
methods: {
|
|
58
|
+
'setup' => { desc: 'Create a new GitHub App via manifest flow', args: '' },
|
|
59
|
+
'complete_setup' => { desc: 'Complete GitHub App setup with authorization code', args: '' }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}.freeze
|
|
63
|
+
|
|
64
|
+
begin
|
|
65
|
+
manifest_dir = ::File.expand_path('~/.legionio/cache/cli')
|
|
66
|
+
manifest_path = ::File.join(manifest_dir, 'lex-github.json')
|
|
67
|
+
unless ::File.exist?(manifest_path) && ::File.read(manifest_path).include?(VERSION)
|
|
68
|
+
require 'fileutils'
|
|
69
|
+
::FileUtils.mkdir_p(manifest_dir)
|
|
70
|
+
serialized = CLI_COMMANDS.transform_values do |cmd|
|
|
71
|
+
{ 'class' => cmd[:class_name],
|
|
72
|
+
'methods' => cmd[:methods].transform_values { |m| { 'desc' => m[:desc], 'args' => m[:args] } } }
|
|
73
|
+
end
|
|
74
|
+
::File.write(manifest_path, ::JSON.pretty_generate(
|
|
75
|
+
'gem' => 'lex-github', 'version' => VERSION,
|
|
76
|
+
'alias' => 'github', 'commands' => serialized
|
|
77
|
+
))
|
|
78
|
+
end
|
|
79
|
+
rescue StandardError => e
|
|
80
|
+
warn "[lex-github] CLI manifest write skipped: #{e.message}" if ENV['LEGION_DEBUG']
|
|
81
|
+
end
|
|
45
82
|
end
|
|
46
83
|
end
|
|
47
84
|
end
|
data/lib/lex/github.rb
ADDED
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.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -185,6 +185,7 @@ files:
|
|
|
185
185
|
- lib/legion/extensions/github/app/transport/queues/webhooks.rb
|
|
186
186
|
- lib/legion/extensions/github/cli/app.rb
|
|
187
187
|
- lib/legion/extensions/github/cli/auth.rb
|
|
188
|
+
- lib/legion/extensions/github/cli/runner.rb
|
|
188
189
|
- lib/legion/extensions/github/client.rb
|
|
189
190
|
- lib/legion/extensions/github/errors.rb
|
|
190
191
|
- lib/legion/extensions/github/helpers/browser_auth.rb
|
|
@@ -219,6 +220,7 @@ files:
|
|
|
219
220
|
- lib/legion/extensions/github/runners/search.rb
|
|
220
221
|
- lib/legion/extensions/github/runners/users.rb
|
|
221
222
|
- lib/legion/extensions/github/version.rb
|
|
223
|
+
- lib/lex/github.rb
|
|
222
224
|
homepage: https://github.com/LegionIO/lex-github
|
|
223
225
|
licenses:
|
|
224
226
|
- MIT
|