llmemory 0.2.7 → 0.2.8

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: ecc37d3f00fe0f347b1cf37d17665a84b92fa8a0effdf6f238178651f44f58a9
4
- data.tar.gz: 35dc741e76e12814e6abae4ede8cace697802359892cbb9c419a5e224c5b16f9
3
+ metadata.gz: 03b04e6953a763ad8b6774efe8bc54aac1ce56e0fd19a5eea1804069dcbfad6e
4
+ data.tar.gz: 91c4610f650ecb87e7e584352357a5210051ca5a25f516cd6099bbe8010c790e
5
5
  SHA512:
6
- metadata.gz: 7161647ed2bd7ac8b48a4695cd915fb26e80aee867238f8b40a70d8d2b014af72f3206c0b738738d2429a17760927b486e101ce3e82dae09efa59469bb8b54c8
7
- data.tar.gz: 310bc288d0e6570280dfd78cfe8f002bb2e071275baf47521649ab2ba56d40ce182cdce2b93cc0bc21ba3c2ccebce7122c4e99c4e481a004790fb030634f1a43
6
+ metadata.gz: c9a6ab44ef0537d72e6f06591c607efb1f19551d7e3862369f05a812c082f438ad5a03c1132460e41fa9e8f621f5d908dbdaf76966b6b605b65e214861a73fd6
7
+ data.tar.gz: 1aece179b0454ad05a5d5d0816f43c4dec9a5cf01220d6a0367b56dfe69f01659e193d4742edfbe0832a41e47f3a41e6d85e041dfdd14cd5e048f35819b8e0d2
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "base"
4
- require_relative "../../active_record_helpers"
4
+ require_relative "../active_record_helpers"
5
5
 
6
6
  module Llmemory
7
7
  module VectorStore
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Llmemory
4
- VERSION = "0.2.7"
4
+ VERSION = "0.2.8"
5
5
  end
@@ -1,22 +1,77 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  namespace :release do
4
- desc "Bump version (patch|minor|major). Checks: branch=main, no uncommitted changes, tests pass. Then: Gemfile.lock, CHANGELOG, commit, push, tag"
5
- task :bump, [:bump_type] => [] do |_t, args|
4
+ RELEASE_FILES = %w[lib/llmemory/version.rb Gemfile.lock CHANGELOG.txt].freeze
5
+ DEFAULT_NOTES_PATH = File.expand_path("../../tmp/release_notes.txt", __dir__)
6
+
7
+ def self.resolve_notes_path(arg)
8
+ path = arg.to_s.strip
9
+ path = DEFAULT_NOTES_PATH if path.empty?
10
+ File.expand_path(path)
11
+ end
12
+
13
+ def self.build_changelog_entry(version, date, notes_body)
14
+ body = notes_body.strip
15
+ body = body.sub(/\A#+\s*[^\n]*\n+/, "") # drop optional leading markdown title
16
+
17
+ <<~ENTRY
18
+
19
+ ## [#{version}] - #{date}
20
+
21
+ #{body}
22
+ ENTRY
23
+ end
24
+
25
+ desc "Show commits and diff stat since the last tag (helper before writing release notes)"
26
+ task :since_tag do
27
+ last_tag = `git describe --tags --abbrev=0 2>/dev/null`.strip
28
+ range = last_tag.empty? ? "HEAD" : "#{last_tag}..HEAD"
29
+ puts "Last tag: #{last_tag.empty? ? '(none)' : last_tag}"
30
+ puts "Range: #{range}\n\n"
31
+ puts "Commits:"
32
+ puts(`git log #{range} --oneline`.strip)
33
+ puts "\nDiff stat:"
34
+ puts(`git diff #{range} --stat`.strip)
35
+ end
36
+
37
+ desc "Bump version (patch|minor|major). Requires tmp/release_notes.txt or notes path. Checks: branch=main, clean tree, tests pass. Then: version, CHANGELOG, commit, push, tag"
38
+ task :bump, [:bump_type, :notes_file] => [] do |_t, args|
6
39
  require_relative "../llmemory/version"
7
40
 
8
- # Pre-flight checks
9
41
  current_branch = `git rev-parse --abbrev-ref HEAD`.strip
10
42
  abort "Current branch must be main (got: #{current_branch})" unless current_branch == "main"
11
43
 
12
- # Allow only release-related files to be modified (we'll commit them)
13
- release_files = %w[lib/llmemory/version.rb Gemfile.lock CHANGELOG.txt]
14
- status_lines = `git status --porcelain`.strip.lines
44
+ status_lines = `git status --porcelain --untracked-files=normal`.strip.lines
15
45
  other_changes = status_lines.reject do |line|
16
- path = line.sub(/\A..\s+/, "").strip
17
- release_files.include?(path)
46
+ path = line.sub(/\A..\s+/, "").strip.split(" -> ").last
47
+ RELEASE_FILES.include?(path)
48
+ end
49
+ unless other_changes.empty?
50
+ abort "Working tree has uncommitted changes outside release files. Commit or stash them first.\n#{other_changes.join}"
18
51
  end
19
- abort "Working tree has uncommitted changes outside release files. Commit or stash them first." unless other_changes.empty?
52
+
53
+ notes_path = Release.resolve_notes_path(args[:notes_file])
54
+ unless File.exist?(notes_path)
55
+ abort <<~MSG
56
+ Release notes file not found: #{notes_path}
57
+
58
+ 1. Inspect changes since the last tag:
59
+ bundle exec rake release:since_tag
60
+
61
+ 2. Write a changelog entry (user-visible changes, not raw commits) to:
62
+ tmp/release_notes.txt
63
+
64
+ Use sections such as Added / Changed / Fixed / Removed / Notes.
65
+ Follow the style of recent entries in CHANGELOG.txt (e.g. v0.2.7).
66
+
67
+ 3. Re-run:
68
+ bundle exec rake release:bump[#{args[:bump_type] || 'patch'}]
69
+ bundle exec rake release:bump[#{args[:bump_type] || 'patch'},path/to/notes.txt]
70
+ MSG
71
+ end
72
+
73
+ notes_body = File.read(notes_path).strip
74
+ abort "Release notes file is empty: #{notes_path}" if notes_body.empty?
20
75
 
21
76
  puts "Running tests..."
22
77
  sh "bundle exec rspec"
@@ -36,41 +91,21 @@ namespace :release do
36
91
  new_version_s = new_version.to_s
37
92
 
38
93
  puts "Bumping #{Llmemory::VERSION} -> #{new_version_s} (#{bump_type})"
94
+ puts " Release notes: #{notes_path}"
39
95
 
40
- # 1. Update version.rb
41
96
  version_file = File.expand_path("../llmemory/version.rb", __dir__)
42
97
  content = File.read(version_file)
43
98
  content = content.sub(/VERSION = "[^"]+"/, %(VERSION = "#{new_version_s}"))
44
99
  File.write(version_file, content)
45
100
  puts " Updated lib/llmemory/version.rb"
46
101
 
47
- # 2. bundle install
48
102
  sh "bundle install"
49
103
  puts " Updated Gemfile.lock"
50
104
 
51
- # 3. Update CHANGELOG.txt
52
105
  changelog_path = File.expand_path("../../CHANGELOG.txt", __dir__)
53
- changelog_content = if File.exist?(changelog_path)
54
- File.read(changelog_path)
55
- else
56
- ""
57
- end
58
-
106
+ changelog_content = File.exist?(changelog_path) ? File.read(changelog_path) : ""
59
107
  today = Time.now.strftime("%Y-%m-%d")
60
- last_tag = `git describe --tags --abbrev=0 2>/dev/null`.strip
61
- commits = if last_tag.empty?
62
- `git log --oneline`.strip
63
- else
64
- `git log #{last_tag}..HEAD --oneline`.strip
65
- end
66
-
67
- new_entry = <<~CHANGELOG
68
-
69
- ## [#{new_version_s}] - #{today}
70
-
71
- ### Changes
72
- #{commits.lines.map { |l| "- #{l.strip}" }.join("\n")}
73
- CHANGELOG
108
+ new_entry = Release.build_changelog_entry(new_version_s, today, notes_body)
74
109
 
75
110
  header = "# Changelog\n\n"
76
111
  if changelog_content.empty?
@@ -82,19 +117,13 @@ namespace :release do
82
117
  File.write(changelog_path, changelog_content)
83
118
  puts " Updated CHANGELOG.txt"
84
119
 
85
- # 4. Commit
86
120
  sh "git add lib/llmemory/version.rb Gemfile.lock CHANGELOG.txt"
87
121
  sh "git commit -m 'Release v#{new_version_s}'"
88
-
89
- # 5. Push
90
122
  sh "git push"
91
-
92
- # 6. Tag
93
123
  sh "git tag v#{new_version_s}"
94
-
95
- # 7. Push tag
96
124
  sh "git push origin v#{new_version_s}"
97
125
 
126
+ File.delete(notes_path) if File.expand_path(notes_path) == File.expand_path(DEFAULT_NOTES_PATH) && File.exist?(notes_path)
98
127
  puts "\nDone. Released v#{new_version_s}"
99
128
  end
100
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llmemory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - llmemory