llmemory 0.2.8 → 0.2.10

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: 03b04e6953a763ad8b6774efe8bc54aac1ce56e0fd19a5eea1804069dcbfad6e
4
- data.tar.gz: 91c4610f650ecb87e7e584352357a5210051ca5a25f516cd6099bbe8010c790e
3
+ metadata.gz: 5cc4e7d547ef03649a17696bda31fd75bf9ac2062f70bde092e9e2fd0f084c3e
4
+ data.tar.gz: 4468f29da8808641c04145637876909e75a077fb3b5186b47b8e488354cb8d5b
5
5
  SHA512:
6
- metadata.gz: c9a6ab44ef0537d72e6f06591c607efb1f19551d7e3862369f05a812c082f438ad5a03c1132460e41fa9e8f621f5d908dbdaf76966b6b605b65e214861a73fd6
7
- data.tar.gz: 1aece179b0454ad05a5d5d0816f43c4dec9a5cf01220d6a0367b56dfe69f01659e193d4742edfbe0832a41e47f3a41e6d85e041dfdd14cd5e048f35819b8e0d2
6
+ metadata.gz: 01372cdc24c73fff3ec18862d52a7a7c7cca43de954ab785693e2473a5bd420b3f5354ec816e40c0f80f561d4b9ef0db3bb5e9851bb3c6d3cac2515aebf880a3
7
+ data.tar.gz: a68cc51d1779de9bc4f21b304670e253c3d254d4a3eb1fb2577ba790aca66acd9587b7eda1f22847fea422fe12f0ac08e60069d717e1892c6a1564cb4c61ad3c
@@ -71,6 +71,10 @@ module Llmemory
71
71
  end
72
72
 
73
73
  def load_active_record_models!
74
+ require_relative "../long_term/file_based/storages/active_record_storage"
75
+ require_relative "../long_term/episodic/storages/active_record_storage"
76
+ require_relative "../long_term/procedural/storages/active_record_storage"
77
+
74
78
  LongTerm::FileBased::Storages::ActiveRecordStorage.load_models!
75
79
  LongTerm::Episodic::Storages::ActiveRecordStorage.load_models!
76
80
  LongTerm::Procedural::Storages::ActiveRecordStorage.load_models!
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Llmemory
4
+ class Railtie < ::Rails::Railtie
5
+ rake_tasks do
6
+ load File.expand_path("../tasks/llmemory.rake", __dir__)
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Llmemory
4
- VERSION = "0.2.8"
4
+ VERSION = "0.2.10"
5
5
  end
data/lib/llmemory.rb CHANGED
@@ -28,3 +28,4 @@ module Llmemory
28
28
  end
29
29
 
30
30
  require_relative "llmemory/crypto/cipher"
31
+ require_relative "llmemory/railtie" if defined?(Rails::Railtie)
@@ -3,7 +3,9 @@
3
3
  namespace :llmemory do
4
4
  desc "Backfill search_tokens blind index (and name_det on skills) for encrypted keyword search. " \
5
5
  "Env: FORCE=1 (re-backfill all rows), DRY_RUN=1 (count only), STORE=active_record|postgres"
6
- task :backfill_search_tokens, [:user_id] do |_t, args|
6
+ task_deps = Rake::Task.task_defined?(:environment) ? [:environment] : []
7
+
8
+ task :backfill_search_tokens, [:user_id] => task_deps do |_t, args|
7
9
  require "llmemory"
8
10
  require_relative "../llmemory/maintenance/search_tokens_backfill"
9
11
 
@@ -1,18 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- namespace :release do
3
+ module Release
4
4
  RELEASE_FILES = %w[lib/llmemory/version.rb Gemfile.lock CHANGELOG.txt].freeze
5
5
  DEFAULT_NOTES_PATH = File.expand_path("../../tmp/release_notes.txt", __dir__)
6
6
 
7
- def self.resolve_notes_path(arg)
7
+ module_function
8
+
9
+ def resolve_notes_path(arg)
8
10
  path = arg.to_s.strip
9
11
  path = DEFAULT_NOTES_PATH if path.empty?
10
12
  File.expand_path(path)
11
13
  end
12
14
 
13
- def self.build_changelog_entry(version, date, notes_body)
15
+ def build_changelog_entry(version, date, notes_body)
14
16
  body = notes_body.strip
15
- body = body.sub(/\A#+\s*[^\n]*\n+/, "") # drop optional leading markdown title
17
+ # Drop an optional top-level title only (# / ##), keep ### section headers.
18
+ body = body.sub(/\A(?:#|##)\s+[^\n]*\n+/, "")
16
19
 
17
20
  <<~ENTRY
18
21
 
@@ -22,6 +25,12 @@ namespace :release do
22
25
  ENTRY
23
26
  end
24
27
 
28
+ def allowed_dirty_path?(path, notes_path)
29
+ RELEASE_FILES.include?(path) || File.expand_path(path) == File.expand_path(notes_path)
30
+ end
31
+ end
32
+
33
+ namespace :release do
25
34
  desc "Show commits and diff stat since the last tag (helper before writing release notes)"
26
35
  task :since_tag do
27
36
  last_tag = `git describe --tags --abbrev=0 2>/dev/null`.strip
@@ -41,16 +50,17 @@ namespace :release do
41
50
  current_branch = `git rev-parse --abbrev-ref HEAD`.strip
42
51
  abort "Current branch must be main (got: #{current_branch})" unless current_branch == "main"
43
52
 
53
+ notes_path = Release.resolve_notes_path(args[:notes_file])
54
+
44
55
  status_lines = `git status --porcelain --untracked-files=normal`.strip.lines
45
56
  other_changes = status_lines.reject do |line|
46
57
  path = line.sub(/\A..\s+/, "").strip.split(" -> ").last
47
- RELEASE_FILES.include?(path)
58
+ Release.allowed_dirty_path?(path, notes_path)
48
59
  end
49
60
  unless other_changes.empty?
50
61
  abort "Working tree has uncommitted changes outside release files. Commit or stash them first.\n#{other_changes.join}"
51
62
  end
52
63
 
53
- notes_path = Release.resolve_notes_path(args[:notes_file])
54
64
  unless File.exist?(notes_path)
55
65
  abort <<~MSG
56
66
  Release notes file not found: #{notes_path}
@@ -123,7 +133,8 @@ namespace :release do
123
133
  sh "git tag v#{new_version_s}"
124
134
  sh "git push origin v#{new_version_s}"
125
135
 
126
- File.delete(notes_path) if File.expand_path(notes_path) == File.expand_path(DEFAULT_NOTES_PATH) && File.exist?(notes_path)
136
+ default_notes = Release::DEFAULT_NOTES_PATH
137
+ File.delete(notes_path) if File.expand_path(notes_path) == File.expand_path(default_notes) && File.exist?(notes_path)
127
138
  puts "\nDone. Released v#{new_version_s}"
128
139
  end
129
140
  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.8
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - llmemory
@@ -246,6 +246,7 @@ files:
246
246
  - lib/llmemory/memory_module.rb
247
247
  - lib/llmemory/noise_filter.rb
248
248
  - lib/llmemory/provenance.rb
249
+ - lib/llmemory/railtie.rb
249
250
  - lib/llmemory/reflection.rb
250
251
  - lib/llmemory/reflection/reflector.rb
251
252
  - lib/llmemory/retrieval.rb