coach_zed 0.5.3 → 0.5.4

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: bab6c7be80897a3d1672f65a41af5ee6d3aeb399053a212302a156a5f895bdec
4
- data.tar.gz: b2fb1223166a76a6e3f5ff55dbecbf6898acaec41b9ba2d5409bfd56968a3f82
3
+ metadata.gz: ed1678c76dbab07b672635ea8f4f2642bca6ea4c339913a1bb4c26d9d107e352
4
+ data.tar.gz: f7de5dd2c274db6434d3207fc2c8a2623098682839530f908026043a6cab178d
5
5
  SHA512:
6
- metadata.gz: 76be85ce593d071c2653895d19ed2debb5782077e39ef88c733de366837baa2acd520762164a2c05d6dc72b98d940b3fc8d08afd211312ba0cdd957eb3d8d34f
7
- data.tar.gz: bf3d000c3bd677f24ec921c61b87c431840664f638bf0aaa68e29b4946ed4ba60ddeba31538955539337fecb817f21e38c91b3dc438e63b43076de3ca92c5a52
6
+ metadata.gz: 9611d02c22a0334fd49dce684d4545d777798dd6a76de72ff234cda80776b335ca166aacc565105b42b982a48e334ddd490fafc8162310d7c51e24b796c8c650
7
+ data.tar.gz: 807a3a945eeb72ee436093acd22add82ee104472227dd38f353c6f24f2f86015d9d85892a79e16054b0c9c0b72403c26a4a6f6f674eff5784de32a5630f55e9e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [](https://github.com/rossta/coach_zed/compare/v0.5.3...v) (2026-06-17)
2
+
3
+ ### Bug Fixes
4
+
5
+ * internalize schedule validation contract ([cf2a5c3](https://github.com/rossta/coach_zed/commit/cf2a5c3566873b4d4d8fe47f3826eb5810af5781))
1
6
  ## [](https://github.com/rossta/coach_zed/compare/v0.5.2...v) (2026-06-17)
2
7
 
3
8
  ### Bug Fixes
@@ -17,6 +17,7 @@ class CoachZed
17
17
  def build
18
18
  <<~PROMPT
19
19
  You are a training coach. Build a daily training schedule for the athlete using only the provided catalog.
20
+ CoachZed manages the scheduling contract, so follow the rules below without requiring the end user to restate them.
20
21
 
21
22
  Return strict JSON only. Do not wrap it in markdown fences or commentary.
22
23
  Every string value must be valid JSON text on a single line. Do not emit literal newlines, tabs, or other control characters inside string values.
@@ -9,6 +9,7 @@ class CoachZed
9
9
  def self.parse(raw_schedule)
10
10
  json = extract_json(raw_schedule)
11
11
  schedule = JSON.parse(json)
12
+ normalize!(schedule)
12
13
  validate!(schedule)
13
14
  schedule
14
15
  rescue JSON::ParserError => e
@@ -23,6 +24,15 @@ class CoachZed
23
24
  fenced ? fenced[1].to_s.strip : text
24
25
  end
25
26
 
27
+ def self.normalize!(schedule)
28
+ return unless schedule.is_a?(Hash)
29
+
30
+ days = schedule["days"]
31
+ return unless days.is_a?(Array) && !days.empty?
32
+
33
+ schedule["program_length_days"] = days.length
34
+ end
35
+
26
36
  def self.validate!(schedule)
27
37
  raise Error, "schedule must be a JSON object" unless schedule.is_a?(Hash)
28
38
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class CoachZed
4
- VERSION = "0.5.3"
4
+ VERSION = "0.5.4"
5
5
  end
data/sig/coach_zed.rbs CHANGED
@@ -240,6 +240,7 @@ class CoachZed
240
240
 
241
241
  def self.parse: (String) -> Hash[String, untyped]
242
242
  def self.extract_json: (String raw_schedule) -> String
243
+ def self.normalize!: (Hash[String, untyped] schedule) -> void
243
244
  def self.validate!: (Hash[String, untyped] schedule) -> void
244
245
  def self.validate_day!: (Hash[String, untyped] day, Integer expected_day_number) -> void
245
246
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coach_zed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Kaffenberger