context_spook 0.2.0 → 0.4.0

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: 4088e8a4f8de00062dcea1b56b696dd1190731c0c30944a95c60a14cad995fa9
4
- data.tar.gz: 996fb30d8a2542a387451416ece827dd1b8062344317ef798db803c216d39e17
3
+ metadata.gz: acac1bb23044efca6b50d929dfeda70b409cb95fc81f2a18f269d67ca2fb857d
4
+ data.tar.gz: 80c69f95ab2f595daf33eb5646d0cc0133c0752ea74ac73b4737eb0b2f57cd32
5
5
  SHA512:
6
- metadata.gz: df6ce1080b5b98a1e279f945cb0e5934592ea586c15abc24234b1c44aaa0d5aac55308227c2966a1e2e9912f620f4d13a5bda0940726028f589aa0ee522dc3fd
7
- data.tar.gz: 2b787ae025a227d47f7d6ab53d850bc0c2084a6872e16bb2b60d122965d3dcdb17531fc4118371de82da0edcdd29b7a4ebe143b55019d3116bb424117edb85f4
6
+ metadata.gz: c68f160740a7b1af14ce1f6260fd08430745e7f338e4151c88a46da708d8635572471400600ad119fcfdd9c33d7f9944ec9fe5ca8710778d61f919403de8c38d
7
+ data.tar.gz: 20a6c25fc8097d67d6b4111b4d6fd6c15b5ad12512e05b93e68d27f32ca8adb58d9f20255a30b9dfcb679b2c4e89a4108eaaa37fc2388153243ae6812f33b4f7
data/README.md CHANGED
@@ -8,7 +8,7 @@ be exported as structured JSON data.
8
8
  The DSL is general-purpose and can be used for any kind of project or
9
9
  collection of files, whether software development, documentation, research
10
10
  data, educational materials, creative projects, or any other type of organized
11
- information. The `contexts/project.rb` example below demonstrates how to
11
+ information. The `.contexts/project.rb` example below demonstrates how to
12
12
  describe a Ruby project, but the same principles apply across many different
13
13
  domains.
14
14
 
@@ -71,10 +71,10 @@ File.write 'context.json', context.to_json
71
71
 
72
72
  #### From a context definition file
73
73
 
74
- Alternatively store the block's content above to a file `contexts/project.rb`:
74
+ Alternatively store the block's content above to a file `.contexts/project.rb`:
75
75
 
76
76
  ```ruby
77
- # contexts/project.rb
77
+ # .contexts/project.rb
78
78
  context do
79
79
  variable branch: `git rev-parse --abbrev-ref HEAD`.chomp
80
80
 
@@ -114,7 +114,7 @@ Now you can generate the context from the file, and store it as JSON in Ruby or
114
114
  send it to another application.
115
115
 
116
116
  ```ruby
117
- context = ContextSpook::generate_context('contexts/project.rb')
117
+ context = ContextSpook::generate_context('.contexts/project.rb')
118
118
  File.write 'context.json', context.to_json
119
119
  ```
120
120
 
@@ -123,13 +123,13 @@ File.write 'context.json', context.to_json
123
123
  Generate context and save to file:
124
124
 
125
125
  ```bash
126
- ./bin/context_spook contexts/project.rb > context.json
126
+ ./bin/context_spook .contexts/project.rb > context.json
127
127
  ```
128
128
 
129
129
  Or pipe directly to another tool:
130
130
 
131
131
  ```
132
- ./bin/context_spook contexts/project.rb | ollama_chat_send
132
+ ./bin/context_spook .contexts/project.rb | ollama_chat_send
133
133
  ```
134
134
 
135
135
  You will see two orange warning messages, that demonstrates how errors like
data/Rakefile CHANGED
@@ -19,9 +19,9 @@ GemHadar do
19
19
  test_dir 'spec'
20
20
  ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.AppleDouble', '.bundle',
21
21
  '.yardoc', 'doc', 'tags', 'errors.lst', 'cscope.out', 'coverage', 'tmp',
22
- 'yard'
22
+ 'yard', 'TODO.md'
23
23
  package_ignore '.all_images.yml', '.tool-versions', '.gitignore', 'VERSION',
24
- '.rspec', *Dir.glob('.github/**/*', File::FNM_DOTMATCH)
24
+ '.rspec', '.github'
25
25
  readme 'README.md'
26
26
 
27
27
  required_ruby_version '~> 3.1'
@@ -29,9 +29,10 @@ GemHadar do
29
29
  dependency 'tins', '~>1.39'
30
30
  dependency 'json', '~>2.0'
31
31
  dependency 'term-ansicolor', '~> 1.11'
32
- dependency 'mize', '~> 0.6'
33
- development_dependency 'all_images', '~> 0.6'
34
- development_dependency 'rspec', '~> 3.2'
32
+ dependency 'mize', '~> 0.6'
33
+ dependency 'mime-types', '~> 3.0'
34
+ development_dependency 'all_images', '~> 0.6'
35
+ development_dependency 'rspec', '~> 3.2'
35
36
  development_dependency 'debug'
36
37
  development_dependency 'simplecov'
37
38
 
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: context_spook 0.2.0 ruby lib
2
+ # stub: context_spook 0.4.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "context_spook".freeze
6
- s.version = "0.2.0".freeze
6
+ s.version = "0.4.0".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["context_spook".freeze]
15
15
  s.extra_rdoc_files = ["README.md".freeze, "lib/context_spook.rb".freeze, "lib/context_spook/generator.rb".freeze, "lib/context_spook/version.rb".freeze]
16
- s.files = ["Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/context_spook".freeze, "context_spook.gemspec".freeze, "contexts/project.rb".freeze, "hello_world.json".freeze, "lib/context_spook.rb".freeze, "lib/context_spook/generator.rb".freeze, "lib/context_spook/version.rb".freeze, "spec/context_spook/generator_spec.rb".freeze, "spec/spec_helper.rb".freeze]
16
+ s.files = [".contexts/project.rb".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/context_spook".freeze, "context_spook.gemspec".freeze, "hello_world.json".freeze, "lib/context_spook.rb".freeze, "lib/context_spook/generator.rb".freeze, "lib/context_spook/version.rb".freeze, "spec/context_spook/generator_spec.rb".freeze, "spec/spec_helper.rb".freeze]
17
17
  s.homepage = "https://github.com/flori/context_spook".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "ContextSpook - context_spook collects project context for AI".freeze, "--main".freeze, "README.md".freeze]
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.specification_version = 4
26
26
 
27
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.0".freeze])
27
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.2".freeze])
28
28
  s.add_development_dependency(%q<all_images>.freeze, ["~> 0.6".freeze])
29
29
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.2".freeze])
30
30
  s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
@@ -33,4 +33,5 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency(%q<json>.freeze, ["~> 2.0".freeze])
34
34
  s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.11".freeze])
35
35
  s.add_runtime_dependency(%q<mize>.freeze, ["~> 0.6".freeze])
36
+ s.add_runtime_dependency(%q<mime-types>.freeze, ["~> 3.0".freeze])
36
37
  end
@@ -2,6 +2,7 @@ require 'tins/xt'
2
2
  require 'term/ansicolor'
3
3
  require 'json'
4
4
  require 'mize'
5
+ require 'mime-types'
5
6
 
6
7
  # The ContextSpook module serves as a namespace container for collecting and
7
8
  # organizing project information for AI assistance.
@@ -186,6 +187,7 @@ module ContextSpook
186
187
  content:,
187
188
  size: content.size,
188
189
  lines: content.lines.size,
190
+ content_types: MIME::Types.type_for(filename).map(&:content_type).full?,
189
191
  tags: (Array(tags) if tags),
190
192
  }.compact
191
193
  file_size = Tins::Unit.format(
@@ -236,16 +238,19 @@ module ContextSpook
236
238
  # The to_json method converts the object to a JSON representation by
237
239
  # first generating its hash form and then serializing that hash into JSON
238
240
  # format.
241
+ #
242
+ # @param args [ Array ] pass-through arguments
239
243
  memoize method:
240
- def to_json(*)
241
- as_json.to_json(*)
244
+ def to_json(*args)
245
+ as_json.to_json(*args)
242
246
  end
243
247
 
244
248
  # The as_json method converts the context's files, commands, and metadata
245
249
  # into a hash representation.
246
250
  #
251
+ # @param ignored [ Array ] ignored arguments
247
252
  # @return [ Hash ] a hash containing the files, commands, and metadata
248
- def as_json(*)
253
+ def as_json(*ignored)
249
254
  {
250
255
  files:,
251
256
  commands:,
@@ -1,6 +1,6 @@
1
1
  module ContextSpook
2
2
  # ContextSpook version
3
- VERSION = '0.2.0'
3
+ VERSION = '0.4.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe ContextSpook::Generator do
4
4
  let :context do
5
- ContextSpook.generate_context('contexts/project.rb')
5
+ ContextSpook.generate_context('.contexts/project.rb')
6
6
  end
7
7
 
8
8
  it 'context can be generated from block' do
@@ -34,7 +34,7 @@ describe ContextSpook::Generator do
34
34
 
35
35
  it 'cannot do from block and filename' do
36
36
  expect {
37
- ContextSpook.generate_context('contexts/project.rb') { }
37
+ ContextSpook.generate_context('.contexts/project.rb') { }
38
38
  }.to raise_error(ArgumentError, /need either a filename or a &block/)
39
39
  end
40
40
 
@@ -53,6 +53,7 @@ describe ContextSpook::Generator do
53
53
  file = context.files['lib/context_spook.rb']
54
54
  expect(file).to be_present
55
55
  expect(file[:content]).to be_present
56
+ expect(file[:content_types]).to be_present
56
57
  expect(file[:size]).to be > 0
57
58
  expect(file[:lines]).to be > 0
58
59
  expect(file[:namespace]).to eq :lib
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: context_spook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '2.0'
18
+ version: '2.2'
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '2.0'
25
+ version: '2.2'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: all_images
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -135,6 +135,20 @@ dependencies:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0.6'
138
+ - !ruby/object:Gem::Dependency
139
+ name: mime-types
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '3.0'
145
+ type: :runtime
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '3.0'
138
152
  description: |
139
153
  context_spook is a library that collects and organizes project
140
154
  information to help AI assistants understand codebases better.
@@ -148,13 +162,13 @@ extra_rdoc_files:
148
162
  - lib/context_spook/generator.rb
149
163
  - lib/context_spook/version.rb
150
164
  files:
165
+ - ".contexts/project.rb"
151
166
  - Gemfile
152
167
  - LICENSE
153
168
  - README.md
154
169
  - Rakefile
155
170
  - bin/context_spook
156
171
  - context_spook.gemspec
157
- - contexts/project.rb
158
172
  - hello_world.json
159
173
  - lib/context_spook.rb
160
174
  - lib/context_spook/generator.rb
File without changes