context_spook 1.0.1 → 1.1.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: 94058fa45fd85552ea4e54d5f67d991d90d7d29a8a344490c71942a568032755
4
- data.tar.gz: a12296d4822f6cc01294ecc8c6bb3d544f894eebcaaaddc83956420b33c28c56
3
+ metadata.gz: 41d55af33ce0adb0f4950f6a24b43fdc6d5c6d7401e6c6eb59bdce08d149043f
4
+ data.tar.gz: fa121dce3b5c17f234a51133e93c947420609849bcc048676e4f0d5f9e718d42
5
5
  SHA512:
6
- metadata.gz: b9f81bb6d859590f83b7febf9dbfeac3223da9624d4d6851204ad5e255b22dcff2db3d4c0eb4c741228edaac07a23565ab56abe9946b2e8b9059973c6f82de2e
7
- data.tar.gz: 3439f27cac24f0d78e3a3fa99586d6d20aa9b3a33ebe4892a2757614c27eaba9073cffeb5da81d5502c5e245d8c38c282e6964656227e24e42d90a512ea686b7
6
+ metadata.gz: 812003a9986f5ca5bad980b57fececfc09085de3787dd671197453f977feaa249c67a1af858e93ba2be810ae941b1389dbc28e222fac853550b33b6e3d2076ac
7
+ data.tar.gz: 6579a56156f1e6deaf64427d2038de99a2e68749e397fc57860fdf4b6c33359f467d72e7a2cc1a0effd691c7c8411666f23c8b414334d5ab0e55e6540ee39d98
data/README.md CHANGED
@@ -127,20 +127,20 @@ File.write 'context.json', context.to_json
127
127
  Generate context and save to file:
128
128
 
129
129
  ```bash
130
- ./bin/context_spook .contexts/project.rb > context.json
130
+ context_spook .contexts/project.rb > context.json
131
131
  ```
132
132
 
133
133
  Or pipe directly to another tool:
134
134
 
135
135
  ```bash
136
- ./bin/context_spook .contexts/project.rb | ollama_chat_send
136
+ context_spook .contexts/project.rb | ollama_chat_send
137
137
  ```
138
138
 
139
139
  The CLI tool also supports verbose output:
140
140
 
141
141
  ```bash
142
142
  # Generate context without verbose output
143
- ./bin/context_spook .contexts/project.rb ~v
143
+ context_spook .contexts/project.rb ~v
144
144
  ```
145
145
 
146
146
  Now you can see two orange warning messages, that demonstrates how errors like
@@ -150,7 +150,7 @@ The CLI tool also supports file redirection:
150
150
 
151
151
  ```bash
152
152
  # Generate context and save to file
153
- ./bin/context_spook .contexts/project.rb -o context.json
153
+ context_spook .contexts/project.rb -o context.json
154
154
  ```
155
155
 
156
156
  You can also use include patterns to automatically collect files without
@@ -158,22 +158,33 @@ manually specifying each one:
158
158
 
159
159
  ```bash
160
160
  # Collect all Ruby files from lib/ and spec/ directories
161
- ./bin/context_spook -i 'lib/**/*.rb' -i 'spec/**/*.rb'
161
+ context_spook -i 'lib/**/*.rb' -i 'spec/**/*.rb'
162
162
 
163
163
  # Collect Markdown and YAML files from current directory
164
- ./bin/context_spook -i '*.md' -i '*.yaml' -i '*.yml'
164
+ context_spook -i '*.md' -i '*.yaml' -i '*.yml'
165
165
 
166
166
  # Collect files with complex patterns
167
- ./bin/context_spook -i 'lib/**/{*.rb,*.rake}' # Brace expansion
168
- ./bin/context_spook -i 'lib/**/*_spec.rb' # Pattern matching
169
- ./bin/context_spook -i 'lib/**/*.rb' -i 'spec/**/*_spec.rb' # Mixed patterns
167
+ context_spook -i 'lib/**/{*.rb,*.rake}' # Brace expansion
168
+ context_spook -i 'lib/**/*_spec.rb' # Pattern matching
169
+ context_spook -i 'lib/**/*.rb' -i 'spec/**/*_spec.rb' # Mixed patterns
170
170
  ```
171
171
 
172
+ ### Size Estimation
173
+
174
+ To estimate the size of your context without generating the large output file:
175
+
176
+ ```bash
177
+ # Show context size information only
178
+ context_spook .contexts/project.rb -S
179
+ ```
180
+
181
+ This is useful for optimizing context size before committing to large output files.
182
+
172
183
  This is how you can show the usage message:
173
184
 
174
185
  ```
175
186
  # Show help
176
- ./bin/context_spook -h
187
+ context_spook -h
177
188
  ```
178
189
 
179
190
  ## What Gets Collected
@@ -232,4 +243,4 @@ assistants understand:
232
243
 
233
244
  ## License
234
245
 
235
- The gem is available as open source under the terms of the [MIT License](./LICENSE)
246
+ The gem is available as open source under the terms of the [MIT License](LICENSE)
data/bin/context_spook CHANGED
@@ -22,10 +22,11 @@ def usage
22
22
 
23
23
  Options:
24
24
  -o FILE Write output to FILE instead of stdout
25
- ~v Disable verbose output, enabled by default
26
- -h Show this help message
25
+ ~v Disable verbose informational output, enabled by default
26
+ -S suppress output (just show informational output)
27
27
  -i PATTERN Include files matching PATTERN (can be used multiple times)
28
28
  Supports glob patterns like **, *, ?, [abc], {a,b,c}
29
+ -h Show this help message
29
30
 
30
31
  Examples:
31
32
  # Generate context and output to stdout
@@ -44,13 +45,16 @@ def usage
44
45
  # Generate context without verbose output
45
46
  #{File.basename($0)} .contexts/project.rb ~v
46
47
 
48
+ # Generate informational output only to estimate context size
49
+ #{File.basename($0)} .contexts/project.rb -S
50
+
47
51
  # Generate context and save to file
48
52
  #{File.basename($0)} .contexts/project.rb -o context.json
49
53
  EOT
50
54
  exit 0
51
55
  end
52
56
 
53
- opts = go 'o:i:pvh', defaults: { ?v => true }
57
+ opts = go 'o:i:pvSh', defaults: { ?v => true }
54
58
  opts[?h] and usage
55
59
  context = nil
56
60
  output = nil
@@ -72,12 +76,16 @@ else
72
76
  context = ContextSpook.generate_context(filename, verbose: opts[?v])
73
77
  end
74
78
 
75
- if output_filename = opts[?o]
76
- if File.exist?(output_filename)
77
- fail "Filename #{output_filename.inspect} already exists!"
78
- end
79
- output = File.new output_filename, ?w
79
+ if opts[?S]
80
+ output = NULL
80
81
  else
81
- output = STDOUT
82
+ if output_filename = opts[?o]
83
+ if File.exist?(output_filename)
84
+ fail "Filename #{output_filename.inspect} already exists!"
85
+ end
86
+ output = File.new output_filename, ?w
87
+ else
88
+ output = STDOUT
89
+ end
82
90
  end
83
91
  JSON.dump(context.as_json, output)
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: context_spook 1.0.1 ruby lib
2
+ # stub: context_spook 1.1.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "context_spook".freeze
6
- s.version = "1.0.1".freeze
6
+ s.version = "1.1.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]
@@ -1,6 +1,6 @@
1
1
  module ContextSpook
2
2
  # ContextSpook version
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.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:
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: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank