lex-github 0.3.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 528c32f26f0baa590aa8084482cf2c006633669ed182df0e2288198fb509deb4
4
- data.tar.gz: 453260cf722e2b8463816e4b9227ac2e6c70996063f68886f062e9710b01eda0
3
+ metadata.gz: 8ea69decf68b91f650186b1719a7e29646ce4f7308bd2d90eebeadcd6048718d
4
+ data.tar.gz: 3bdf52e0d20f137e7efb2f7c7330905de6b924d184edb4007c616435d679f44a
5
5
  SHA512:
6
- metadata.gz: 4060b46c5f83856954a7c49e542351558202f855fe0d471a1984d59522e4d178fe78c2bfcc58d8a254b52bff4e763ff3ec233b16a8d2046fbbeb2b44cf089f4c
7
- data.tar.gz: 7d148064e9e9b5225589f6c0d73e30938bc2d56beea9d4f89f2cb0443a2cc03d71f48fbe0b14a8a74ff150e44c4e94450185877c2539127da9ca2daa99507e2a
6
+ metadata.gz: 2cc5f719ed57a84ebc740a0009a0836fecfcfaa162794e64806e9770dc653e2368ac37d44ef3655d29bd132ed1957148be691dd4544fadb05e969250949144ce
7
+ data.tar.gz: 9bccdb81c9b7f52348c623b19473db41bc36f3d5539680789eceb7d50997136abafe3d42dcccb3010dacb57db8fb7c53998b1ea0374adfedab54e0414b7364af
data/CHANGELOG.md CHANGED
@@ -2,40 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.3.2] - 2026-03-31
6
+
5
7
  ### Added
6
- - GitHub App authentication (JWT generation, installation tokens, manifest flow)
7
- - OAuth delegated authentication (Authorization Code + PKCE, device code fallback)
8
- - Scope-aware credential resolution chain (8 sources, rate limit + scope fallback)
9
- - `ScopeRegistry` for caching credential-to-owner/repo authorization status
10
- - `CredentialFallback` Faraday middleware (transparent 403/429 retry with next credential)
11
- - `RateLimit` Faraday middleware with automatic credential exhaustion tracking
12
- - `ScopeProbe` Faraday middleware for passive scope learning from API responses
13
- - `Helpers::Cache` for two-tier API response caching (global Redis + local in-memory)
14
- - `Helpers::TokenCache` for token lifecycle management with per-installation keying
15
- - `App::Runners::Auth` (JWT generation, installation token exchange)
16
- - `App::Runners::Webhooks` (signature verification, event parsing, scope invalidation)
17
- - `App::Runners::Manifest` (GitHub App manifest flow)
18
- - `App::Runners::Installations` (list, get, suspend, unsuspend, delete)
19
- - `App::Runners::CredentialStore` (Vault persistence after manifest flow)
20
- - `OAuth::Runners::Auth` (authorize_url, exchange_code, refresh, device_code, revoke)
21
- - `Runners::Actions` (GitHub Actions workflow management)
22
- - `Runners::Checks` (check runs and check suites)
23
- - `Runners::Releases` (release and asset management)
24
- - `Runners::Deployments` (deployment and status management)
25
- - `Runners::RepositoryWebhooks` (programmatic webhook management)
26
- - `Helpers::CallbackServer` for standalone OAuth redirect handling
27
- - `Helpers::BrowserAuth` for browser-based OAuth with PKCE
28
- - `CLI::Auth` for `legion lex exec github auth login/status`
29
- - `CLI::App` for `legion lex exec github app setup`
30
- - `RateLimitError`, `AuthorizationError`, `ScopeDeniedError` error classes
31
- - `jwt` (~> 2.7) and `base64` (>= 0.1) runtime dependencies
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
+
13
+ ## [0.3.1] - 2026-03-30
32
14
 
33
15
  ### Changed
34
- - `Helpers::Client` now uses scope-aware credential resolution (`owner:`, `repo:` context)
35
- - All existing runners forward `owner:` and `repo:` to `connection()` for scope-aware resolution
36
- - All existing runners now include `Helpers::Cache` for two-tier API response caching
37
- - `Client` class includes App and OAuth runner modules
38
- - Version bump to 0.3.0
16
+ - Unpin jwt dependency from `~> 2.7` to `>= 2.7` to resolve conflict with jwt 3.x
39
17
 
40
18
  ## [0.3.0] - 2026-03-30
41
19
 
data/lex-github.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency 'base64', '>= 0.1'
30
30
  spec.add_dependency 'faraday', '>= 2.0'
31
- spec.add_dependency 'jwt', '~> 2.7'
31
+ spec.add_dependency 'jwt', '>= 2.7'
32
32
  spec.add_dependency 'legion-cache', '>= 1.3.11'
33
33
  spec.add_dependency 'legion-crypt', '>= 1.4.9'
34
34
  spec.add_dependency 'legion-data', '>= 1.4.17'
@@ -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
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module Github
6
- VERSION = '0.3.0'
6
+ VERSION = '0.3.2'
7
7
  end
8
8
  end
9
9
  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
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Redirect for `require 'lex/github'` (used by `legionio lex exec`)
4
+ require 'legion/extensions/github'
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.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -41,14 +41,14 @@ dependencies:
41
41
  name: jwt
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '2.7'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '2.7'
54
54
  - !ruby/object:Gem::Dependency
@@ -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