kettle-changelog 1.0.16 → 1.0.17
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +24 -1
- data/README.md +15 -1
- data/exe/kettle-changelog +12 -1
- data/lib/kettle/changelog/release.rb +117 -0
- data/lib/kettle/changelog/version.rb +1 -1
- data/lib/kettle/changelog.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +8 -7
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee6b07a027f22c0e6c360ac67be49800b54ffac928d2d73d3454274b85777851
|
|
4
|
+
data.tar.gz: f0d9d01c8cdcb82e7c735a0c291d94eccfa8ad4fc7f8b2579a4303bd9b837ab9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f42ce068435ac53abd52e44db3e96628be8edcb73480bb06b2fd12c31af752141c8510367dccbee022f176e4eaa783b6386c643db72ebca6b7f1c0b7cf563b87
|
|
7
|
+
data.tar.gz: 768171e1a51cccf8d25efa3c20a6ba2aac758eb130a980c5f5b992030b14ac334572c918be4261292c0e46ade5a0e646232922252f58486b6f23d33752ed0622
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,27 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [1.0.17] - 2026-11-08
|
|
34
|
+
|
|
35
|
+
- TAG: [v1.0.17][1.0.17t]
|
|
36
|
+
- COVERAGE: 93.62% -- 1263/1349 lines in 8 files
|
|
37
|
+
- BRANCH COVERAGE: 78.31% -- 462/590 branches in 8 files
|
|
38
|
+
- 36.73% documented
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- Extract a selected changelog release as structured JSON with `--release` or `--latest`, including matching major and minor version ranges.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- [kc] kettle-jem/prepare: updated 11 project files:
|
|
47
|
+
- dependencies (11)
|
|
48
|
+
|
|
49
|
+
- [kc] kettle-jem/template: updated 5 project files:
|
|
50
|
+
- dependencies (3)
|
|
51
|
+
- other (1)
|
|
52
|
+
- workflows (1)
|
|
53
|
+
|
|
33
54
|
## [1.0.16] - 2026-11-03
|
|
34
55
|
|
|
35
56
|
- TAG: [v1.0.16][1.0.16t]
|
|
@@ -368,7 +389,9 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
368
389
|
|
|
369
390
|
- Initial release
|
|
370
391
|
|
|
371
|
-
[Unreleased]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.
|
|
392
|
+
[Unreleased]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.17...HEAD
|
|
393
|
+
[1.0.17]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.16...v1.0.17
|
|
394
|
+
[1.0.17t]: https://github.com/kettle-dev/kettle-changelog/releases/tag/v1.0.17
|
|
372
395
|
[1.0.16]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.15...v1.0.16
|
|
373
396
|
[1.0.16t]: https://github.com/kettle-dev/kettle-changelog/releases/tag/v1.0.16
|
|
374
397
|
[1.0.15]: https://github.com/kettle-dev/kettle-changelog/compare/v1.0.14...v1.0.15
|
data/README.md
CHANGED
|
@@ -132,6 +132,20 @@ Use `--yes` for non-interactive release automation. Add a note without preparing
|
|
|
132
132
|
bundle exec kettle-changelog --add-unreleased-entry --section Fixed --entry "Describe the fix."
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
+
Extract a specific release without modifying the changelog:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
bundle exec kettle-changelog --release v1.2.3 --file CHANGELOG.md
|
|
139
|
+
# Or pipe Markdown to stdin:
|
|
140
|
+
cat CHANGELOG.md | bundle exec kettle-changelog --release 1.2.3
|
|
141
|
+
# Select every release in a major or minor version:
|
|
142
|
+
bundle exec kettle-changelog --release v3.2 --file CHANGELOG.md
|
|
143
|
+
# Select the first published release instead:
|
|
144
|
+
bundle exec kettle-changelog --latest --file CHANGELOG.md
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`--latest` and `--release` are mutually exclusive. A one- or two-segment version (such as `3` or `v3.2`) returns an array of matching releases in changelog order; full versions and `--latest` return one object. Both forms accept an optional `v` prefix. No matches exit nonzero. The command prints JSON with `version`, `date`, `tag`, `markdown`, `coverage`, `branch_coverage`, and `documented`. Missing metadata is `null`. The Markdown body excludes the release heading and contains its referenced link definitions, found anywhere in the changelog. Shared definitions are included independently in each matching release. Release headings must be level two and contain a three-part version, optionally prefixed with `v` and followed by a date and tag link. A subsequent level-two heading or a level-three community, sponsorship, funding, contributing, acknowledgments, or license heading ends the release. Missing or ambiguous releases and invalid input exit nonzero. The Ruby API is `Kettle::Changelog::Release.extract(content: markdown, version: "1.2.3")` and raises `Kettle::Changelog::Error` on failure.
|
|
148
|
+
|
|
135
149
|
Useful queries and maintenance commands include `--pending-release`, `--release-state`, `--release-stats`, `--reformat`, `--update-prep`, `--json`, and `--events=changelog`. Run `bundle exec kettle-changelog --help` for the complete option list.
|
|
136
150
|
|
|
137
151
|
## 🔐 Security
|
|
@@ -383,7 +397,7 @@ Thanks for RTFM. ☺️
|
|
|
383
397
|
[📌gitmoji]: https://gitmoji.dev
|
|
384
398
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
385
399
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
386
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-1.
|
|
400
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-1.349-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
387
401
|
[🔐security]: https://github.com/kettle-dev/kettle-changelog/blob/main/SECURITY.md
|
|
388
402
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
389
403
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
data/exe/kettle-changelog
CHANGED
|
@@ -53,7 +53,7 @@ begin
|
|
|
53
53
|
require "kettle/ndjson"
|
|
54
54
|
require "kettle/dev/executable_version"
|
|
55
55
|
Kettle::Dev::ExecutableVersion.print_and_exit!(script_basename, ARGV, value_option: true)
|
|
56
|
-
machine_output = ARGV.any? { |arg| arg == "--json" || arg.start_with?("--events") }
|
|
56
|
+
machine_output = ARGV.any? { |arg| arg == "--json" || arg == "--latest" || arg == "--release" || arg.start_with?("--release=") || arg.start_with?("--events") }
|
|
57
57
|
Kettle::Dev::ExecutableVersion.print_header(script_basename) unless machine_output
|
|
58
58
|
rescue LoadError => e
|
|
59
59
|
warn("#{script_basename}: could not load dependency: #{e.class}: #{e.message}")
|
|
@@ -82,6 +82,8 @@ if ARGV.include?("-h") || ARGV.include?("--help")
|
|
|
82
82
|
--pending-release Query whether the changelog has release work pending; exits 0 for yes, 1 for no
|
|
83
83
|
--release-state,
|
|
84
84
|
--release-status Print changelog release state, including latest published release and pending sources
|
|
85
|
+
--release VERSION Extract matching release(s) as JSON (full, major, or major.minor; --file or stdin)
|
|
86
|
+
--latest Extract the latest release as JSON (read-only; --file PATH or stdin)
|
|
85
87
|
--release-stats Print the latest released section's coverage/doc stats from a changelog (read-only;
|
|
86
88
|
--file PATH or stdin; add --json; exits 1 when line coverage is not recorded)
|
|
87
89
|
--refresh-cache Bypass cached gem.coop version data for this invocation
|
|
@@ -211,9 +213,18 @@ begin
|
|
|
211
213
|
|
|
212
214
|
historical_backfill_version = extract_option_arg!(ARGV, "--backfill-released-version")
|
|
213
215
|
coverage_gemfile = extract_option_arg!(ARGV, "--coverage-gemfile")
|
|
216
|
+
release_version = extract_option_arg!(ARGV, "--release")
|
|
217
|
+
latest_release = ARGV.delete("--latest")
|
|
214
218
|
release_stats_query = ARGV.delete("--release-stats")
|
|
215
219
|
release_stats_file = extract_option_arg!(ARGV, "--file")
|
|
216
220
|
|
|
221
|
+
if release_version || latest_release
|
|
222
|
+
raise Kettle::Changelog::Error, "--release cannot be combined with other options" unless ARGV.empty? && !release_stats_query && !version_override && !events_output
|
|
223
|
+
text = (release_stats_file.nil? || release_stats_file == "-") ? $stdin.read : File.read(release_stats_file)
|
|
224
|
+
puts JSON.pretty_generate(Kettle::Changelog::Release.extract(content: text, version: release_version, latest: !!latest_release))
|
|
225
|
+
exit 0
|
|
226
|
+
end
|
|
227
|
+
|
|
217
228
|
if release_stats_query
|
|
218
229
|
# Read-only: no project root, git, network or version detection. Reads --file PATH, or stdin when absent/"-".
|
|
219
230
|
text = (release_stats_file.nil? || release_stats_file == "-") ? $stdin.read : File.read(release_stats_file)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Kettle
|
|
4
|
+
module Changelog
|
|
5
|
+
# Extracts releases without changing the input document.
|
|
6
|
+
module Release
|
|
7
|
+
HEADING = /\A(?:\[)?(v?\d+\.\d+\.\d+[0-9A-Za-z.+-]*)(?:\])?(?:\s+(?:-\s+)?(\d{4}-\d{2}-\d{2}))?(?:\s+\([^\n]*\))?\s*\z/
|
|
8
|
+
DEFINITION = /\A {0,3}\[([^\]]+)\]:[ \t]*(.*)$/
|
|
9
|
+
FOOTER = /\A(?:community|sponsors?|sponsorship|support(?:ers| us)?|funding|contributing|contributors|acknowledg(?:e)?ments|license)\b/i
|
|
10
|
+
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
# @param content [String] Markdown changelog
|
|
14
|
+
# @param version [String] release version or tag (with or without v)
|
|
15
|
+
# @return [Hash, Array<Hash>] a release, or matching releases for a partial version
|
|
16
|
+
# @raise [Kettle::Changelog::Error] when extraction is ambiguous or fails
|
|
17
|
+
def extract(content:, version: nil, latest: false, **options)
|
|
18
|
+
raise Error, "changelog must be a valid nonempty UTF-8 string" unless content.is_a?(String) && content.valid_encoding? && !content.strip.empty?
|
|
19
|
+
raise Error, "specify a version or latest" unless latest != !version.nil?
|
|
20
|
+
valid_version = version.is_a?(String) && version.match?(/\Av?(?:\d+|\d+\.\d+|\d+\.\d+\.\d+[0-9A-Za-z.+-]*)\z/)
|
|
21
|
+
raise Error, "version must be a release version or tag" if !latest && !valid_version
|
|
22
|
+
|
|
23
|
+
require "ast/crispr/markdown/markly"
|
|
24
|
+
context = Ast::Crispr::Markdown::Markly.document_context(content: content, source_label: "changelog")
|
|
25
|
+
headings = context.structural_owners(owner_scope: :heading_sections).sort_by { |owner| owner.location.start_line }
|
|
26
|
+
partial = !latest && version.match?(/\Av?\d+(?:\.\d+)?\z/)
|
|
27
|
+
requested = version&.delete_prefix("v")
|
|
28
|
+
matches = headings.select do |heading|
|
|
29
|
+
match = heading.heading_text.to_s.strip.match(HEADING)
|
|
30
|
+
release_version = match && match[1].delete_prefix("v")
|
|
31
|
+
heading.level == 2 && match && (latest || (partial ? release_version.start_with?("#{requested}.") : release_version == requested))
|
|
32
|
+
end
|
|
33
|
+
matches = matches.first(1) if latest
|
|
34
|
+
raise Error, "no release found for #{latest ? "latest" : version.inspect}" if matches.empty?
|
|
35
|
+
versions = matches.map { |heading| heading.heading_text.to_s.strip.match(HEADING)[1].delete_prefix("v") }
|
|
36
|
+
raise Error, "ambiguous release for #{version.inspect}" if versions.uniq.length != versions.length || (!partial && matches.length != 1)
|
|
37
|
+
|
|
38
|
+
releases = matches.map { |selected| extract_heading(content, headings, selected) }
|
|
39
|
+
partial ? releases : releases.first
|
|
40
|
+
rescue LoadError => e
|
|
41
|
+
raise Error, "release extraction requires the Markdown parser: #{e.message}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def extract_heading(content, headings, selected)
|
|
45
|
+
heading_match = selected.heading_text.to_s.strip.match(HEADING)
|
|
46
|
+
start = selected.location.start_line
|
|
47
|
+
boundary = headings.find do |heading|
|
|
48
|
+
heading.location.start_line > start && (heading.level <= 2 || (heading.level == 3 && heading.heading_text.to_s.strip.match?(FOOTER)))
|
|
49
|
+
end
|
|
50
|
+
lines = content.lines
|
|
51
|
+
finish = boundary ? boundary.location.start_line - 1 : lines.length
|
|
52
|
+
body_lines = lines[start...finish].to_a
|
|
53
|
+
# Reference definitions are document scoped; remove them from the body and append only those used.
|
|
54
|
+
definitions = {}
|
|
55
|
+
definition_lines = []
|
|
56
|
+
fence = nil
|
|
57
|
+
lines.each_with_index do |line, index|
|
|
58
|
+
marker = line[/\A {0,3}(`{3,}|~{3,})/, 1]
|
|
59
|
+
if marker
|
|
60
|
+
if fence.nil?
|
|
61
|
+
fence = marker
|
|
62
|
+
elsif marker[0] == fence[0] && marker.length >= fence.length
|
|
63
|
+
fence = nil
|
|
64
|
+
end
|
|
65
|
+
next
|
|
66
|
+
end
|
|
67
|
+
next if fence
|
|
68
|
+
|
|
69
|
+
match = line.match(DEFINITION)
|
|
70
|
+
next unless match
|
|
71
|
+
|
|
72
|
+
definition = line.dup
|
|
73
|
+
indices = [index]
|
|
74
|
+
continuation = index + 1
|
|
75
|
+
if match[2].strip.empty?
|
|
76
|
+
destination = lines[continuation]
|
|
77
|
+
next unless destination&.match?(/\A {1,3}\S/)
|
|
78
|
+
|
|
79
|
+
definition << destination
|
|
80
|
+
indices << continuation
|
|
81
|
+
continuation += 1
|
|
82
|
+
end
|
|
83
|
+
title = lines[continuation]
|
|
84
|
+
if title&.match?(/\A {1,3}(?:"[^"\n]*"|'[^'\n]*'|\([^()\n]*\))[ \t]*\r?\n?\z/)
|
|
85
|
+
definition << title
|
|
86
|
+
indices << continuation
|
|
87
|
+
end
|
|
88
|
+
definitions[normalize_label(match[1])] ||= definition
|
|
89
|
+
definition_lines.concat(indices)
|
|
90
|
+
end
|
|
91
|
+
body_lines = body_lines.each_with_index.reject { |_line, index| definition_lines.include?(start + index) }.map(&:first)
|
|
92
|
+
body = body_lines.join.strip
|
|
93
|
+
used = definitions.select do |label, _line|
|
|
94
|
+
body.scan(/\[([^\]]+)\](?:\[([^\]]*)\])?/).any? do |first, second|
|
|
95
|
+
normalize_label((second.nil? || second.empty?) ? first : second) == label
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
body = ([body] + used.values.map(&:strip)).reject(&:empty?).join("\n\n")
|
|
99
|
+
stats_heading = "## [#{heading_match[1].delete_prefix("v")}]"
|
|
100
|
+
stats_heading += " - #{heading_match[2]}" if heading_match[2]
|
|
101
|
+
stats = ReleaseStats.parse("#{stats_heading}\n#{body}")
|
|
102
|
+
tag = body[/^\s*-\s+TAG:\s*\[([^\]]+)\]/, 1]
|
|
103
|
+
heading_tag_ref = selected.heading_source.to_s[/\[tag\]\[([^\]]+)\]/i, 1]
|
|
104
|
+
if !tag && heading_tag_ref
|
|
105
|
+
tag = definitions[normalize_label(heading_tag_ref)].to_s[%r{/releases/tag/([^\s>]+)}, 1]
|
|
106
|
+
end
|
|
107
|
+
{version: heading_match[1].delete_prefix("v"), date: heading_match[2], tag: tag, markdown: body.empty? ? "" : "#{body}\n", coverage: stats[:coverage], branch_coverage: stats[:branch_coverage], documented: stats[:documented]}
|
|
108
|
+
end
|
|
109
|
+
private_class_method :extract_heading
|
|
110
|
+
|
|
111
|
+
def normalize_label(label)
|
|
112
|
+
label.to_s.strip.gsub(/\s+/, " ").downcase
|
|
113
|
+
end
|
|
114
|
+
private_class_method :normalize_label
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -5,7 +5,7 @@ module Kettle
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION = "1.0.
|
|
8
|
+
VERSION = "1.0.17"
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/kettle/changelog.rb
CHANGED
|
@@ -10,6 +10,7 @@ module Kettle
|
|
|
10
10
|
|
|
11
11
|
autoload :CLI, "kettle/changelog/cli"
|
|
12
12
|
autoload :EntryAdder, "kettle/changelog/entry_adder"
|
|
13
|
+
autoload :Release, "kettle/changelog/release"
|
|
13
14
|
autoload :ReleaseStats, "kettle/changelog/release_stats"
|
|
14
15
|
autoload :KeyedEntryUpserter, "kettle/changelog/keyed_entry_upserter"
|
|
15
16
|
autoload :TransferMerger, "kettle/changelog/transfer_merger"
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kettle-changelog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -66,7 +66,7 @@ dependencies:
|
|
|
66
66
|
version: '3.1'
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: 3.1.
|
|
69
|
+
version: 3.1.27
|
|
70
70
|
type: :runtime
|
|
71
71
|
prerelease: false
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -76,7 +76,7 @@ dependencies:
|
|
|
76
76
|
version: '3.1'
|
|
77
77
|
- - ">="
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: 3.1.
|
|
79
|
+
version: 3.1.27
|
|
80
80
|
- !ruby/object:Gem::Dependency
|
|
81
81
|
name: version_gem
|
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -296,6 +296,7 @@ files:
|
|
|
296
296
|
- lib/kettle/changelog/cli.rb
|
|
297
297
|
- lib/kettle/changelog/entry_adder.rb
|
|
298
298
|
- lib/kettle/changelog/keyed_entry_upserter.rb
|
|
299
|
+
- lib/kettle/changelog/release.rb
|
|
299
300
|
- lib/kettle/changelog/release_stats.rb
|
|
300
301
|
- lib/kettle/changelog/transfer_merger.rb
|
|
301
302
|
- lib/kettle/changelog/version.rb
|
|
@@ -305,10 +306,10 @@ licenses:
|
|
|
305
306
|
- AGPL-3.0-only
|
|
306
307
|
metadata:
|
|
307
308
|
homepage_uri: https://kettle-changelog.galtzo.com
|
|
308
|
-
source_code_uri: https://github.com/kettle-dev/kettle-changelog/tree/v1.0.
|
|
309
|
-
changelog_uri: https://github.com/kettle-dev/kettle-changelog/blob/v1.0.
|
|
309
|
+
source_code_uri: https://github.com/kettle-dev/kettle-changelog/tree/v1.0.17
|
|
310
|
+
changelog_uri: https://github.com/kettle-dev/kettle-changelog/blob/v1.0.17/CHANGELOG.md
|
|
310
311
|
bug_tracker_uri: https://github.com/kettle-dev/kettle-changelog/issues
|
|
311
|
-
documentation_uri: https://www.rubydoc.info/gems/kettle-changelog/1.0.
|
|
312
|
+
documentation_uri: https://www.rubydoc.info/gems/kettle-changelog/1.0.17
|
|
312
313
|
funding_uri: https://github.com/sponsors/pboling
|
|
313
314
|
wiki_uri: https://github.com/kettle-dev/kettle-changelog/wiki
|
|
314
315
|
news_uri: https://www.railsbling.com/tags/kettle-changelog
|
|
@@ -338,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
338
339
|
- !ruby/object:Gem::Version
|
|
339
340
|
version: '0'
|
|
340
341
|
requirements: []
|
|
341
|
-
rubygems_version: 4.0.
|
|
342
|
+
rubygems_version: 4.0.24
|
|
342
343
|
specification_version: 4
|
|
343
344
|
summary: "\U0001F4DD Release and maintain structured CHANGELOG.md files."
|
|
344
345
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|