legion-settings 1.3.7 → 1.3.9

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: 0646cd4b6cfc444c7a7468206df6a2ebb4148c82f561a6f8df47e663199cc776
4
- data.tar.gz: 9eb1f3e56f4af70ba7df5dd8a494998ad9e3e1ace96bf2141eae8dbbaed60afb
3
+ metadata.gz: c0fcaa25c5784c19c1c6af9e6b566eccd3a955ae8701a09e20b9c628b7bfa2fd
4
+ data.tar.gz: d2c376b14cae93615e734267a29336e689327078195dd604ed7bf3c3c8e981b0
5
5
  SHA512:
6
- metadata.gz: bca6f0949cf3e29992894d3b2d05a9f41283df50d8f4cf1f2d911048c5de95f66d3dbf76bca2eda9cc4c2124a888808c73ca3a4477499c22fec2a428a9a0b525
7
- data.tar.gz: b55b543a2f387c813703d5276ff4975237c93dbe66b8281ecb05d4991645d793c0d413c1d929cc7497f63aae6d90975921444a6d1eba8159f3ab56cacd60fcb6
6
+ metadata.gz: 143dab0104ef8757c0768832f6cba3494e0d32fadf7deb213d69e06bc89c8de12b7203db3448fef5181e022c671fc23cf6876fdf9e4a36f4e55dc2ce24ae81fc
7
+ data.tar.gz: '0879c1aff38d66f3decedc96f0f8b0efdb38939a62a5ed71de2085c614f4e8e1da61740bfb03ad1c7cc88d4e92eca8ea4fa8493447adef07fdf2d213749c2751'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Legion::Settings Changelog
2
2
 
3
+ ## [1.3.9] - 2026-03-21
4
+
5
+ ### Added
6
+ - `region` settings block: `current`, `primary`, `failover`, `peers`, `default_affinity` (prefer_local), `data_residency`
7
+ - `process` settings block: `role` (default: 'full') for process role configuration
8
+ - `:region` and `:process` added to `CORE_MODULES` for schema validation coverage
9
+ - 16 new specs (262 total, 0 failures)
10
+
11
+ ## [1.3.8] - 2026-03-20
12
+
13
+ ### Added
14
+ - `AgentLoader` module for loading YAML/JSON agent definitions from a directory
15
+ - `AgentLoader.load_agents(directory)` — returns validated agent definitions as symbol-keyed hashes
16
+ - `AgentLoader.load_file(path)` — parses `.yaml`, `.yml`, and `.json` agent definition files
17
+ - `AgentLoader.valid?(definition)` — validates required `name` and `runner.functions` keys
18
+
3
19
  ## [1.3.7] - 2026-03-20
4
20
 
5
21
  ### Added
data/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @Esity
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'json'
5
+
6
+ module Legion
7
+ module Settings
8
+ module AgentLoader
9
+ EXTENSIONS = %w[.yaml .yml .json].freeze
10
+ GLOB = '*.{yaml,yml,json}'
11
+
12
+ class << self
13
+ def load_agents(directory)
14
+ return [] unless directory && Dir.exist?(directory)
15
+
16
+ Dir.glob(File.join(directory, GLOB)).filter_map do |path|
17
+ definition = load_file(path)
18
+ next unless definition && valid?(definition)
19
+
20
+ definition.merge(_source_path: path, _source_mtime: File.mtime(path))
21
+ end
22
+ end
23
+
24
+ def load_file(path)
25
+ content = File.read(path)
26
+ case File.extname(path).downcase
27
+ when '.yaml', '.yml' then YAML.safe_load(content, symbolize_names: true)
28
+ when '.json' then ::JSON.parse(content, symbolize_names: true)
29
+ end
30
+ rescue StandardError
31
+ nil
32
+ end
33
+
34
+ def valid?(definition)
35
+ return false unless definition.is_a?(Hash)
36
+ return false unless definition[:name].is_a?(String) && !definition[:name].empty?
37
+ return false unless definition.dig(:runner, :functions).is_a?(Array)
38
+ return false if definition[:runner][:functions].empty?
39
+
40
+ true
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -85,6 +85,9 @@ module Legion
85
85
  transport: { connected: false },
86
86
  data: { connected: false },
87
87
  role: { profile: nil, extensions: [] },
88
+ region: { current: nil, primary: nil, failover: nil, peers: [],
89
+ default_affinity: 'prefer_local', data_residency: {} },
90
+ process: { role: 'full' },
88
91
  dns: dns_defaults
89
92
  }
90
93
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Settings
5
- VERSION = '1.3.7'
5
+ VERSION = '1.3.9'
6
6
  end
7
7
  end
@@ -9,7 +9,7 @@ require 'legion/settings/validation_error'
9
9
 
10
10
  module Legion
11
11
  module Settings
12
- CORE_MODULES = %i[transport cache crypt data logging client].freeze
12
+ CORE_MODULES = %i[transport cache crypt data logging client region process].freeze
13
13
 
14
14
  class << self
15
15
  attr_accessor :loader
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.7
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -39,6 +39,7 @@ files:
39
39
  - ".rubocop.yml"
40
40
  - CHANGELOG.md
41
41
  - CLAUDE.md
42
+ - CODEOWNERS
42
43
  - Gemfile
43
44
  - LICENSE
44
45
  - README.md
@@ -46,6 +47,7 @@ files:
46
47
  - docs/plans/2026-03-17-config-error-filename-implementation.md
47
48
  - legion-settings.gemspec
48
49
  - lib/legion/settings.rb
50
+ - lib/legion/settings/agent_loader.rb
49
51
  - lib/legion/settings/dns_bootstrap.rb
50
52
  - lib/legion/settings/loader.rb
51
53
  - lib/legion/settings/os.rb