context_spook 0.7.2 → 0.8.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 +4 -4
- data/README.md +10 -3
- data/bin/context_spook +28 -21
- data/context_spook.gemspec +2 -2
- data/lib/context_spook/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 301e8fe3e37e6107d6f84e5ec3b683cc4dc70a6acd6e70677681eba91223973a
|
|
4
|
+
data.tar.gz: 0f53a0fd1559ea843833c07fd4ea6445c8ca38161db77caa9d44c861cc17b04a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d860faee9e18f7a017f5668cd5295bdda5d49fc9811cec0408a125edfdb408ae8ced67c273074a1428a8157ff0b73d427ea1861184ba12f26dce2f8d8f3099b
|
|
7
|
+
data.tar.gz: a92f142f03429f1a2c0be60a2bec4506d281c25ab4bc21315b10da1458f9b136cb1e182b5e8051a05f4595eacc1f88c1a5c5ad30bab312bf762d919edad88b56
|
data/README.md
CHANGED
|
@@ -136,12 +136,11 @@ Or pipe directly to another tool:
|
|
|
136
136
|
./bin/context_spook .contexts/project.rb | ollama_chat_send
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
|
|
140
139
|
The CLI tool also supports verbose output:
|
|
141
140
|
|
|
142
141
|
```bash
|
|
143
|
-
# Generate context
|
|
144
|
-
./bin/context_spook .contexts/project.rb
|
|
142
|
+
# Generate context without verbose output
|
|
143
|
+
./bin/context_spook .contexts/project.rb ~v
|
|
145
144
|
```
|
|
146
145
|
|
|
147
146
|
Now you can see two orange warning messages, that demonstrates how errors like
|
|
@@ -163,6 +162,14 @@ manually specifying each one:
|
|
|
163
162
|
|
|
164
163
|
# Collect Markdown and YAML files from current directory
|
|
165
164
|
./bin/context_spook -s md -s yaml
|
|
165
|
+
|
|
166
|
+
# Generate context with explicit suffix hints
|
|
167
|
+
# -d lib:rb collects only .rb files from lib/
|
|
168
|
+
# -d bin:all collects all files from bin/ (no suffix filtering)
|
|
169
|
+
./bin/context_spook -d lib:rb -d bin:all
|
|
170
|
+
|
|
171
|
+
# Same result using default -s suffix all
|
|
172
|
+
./bin/context_spook -d lib:rb -d bin
|
|
166
173
|
```
|
|
167
174
|
|
|
168
175
|
This is how you can show the usage message:
|
data/bin/context_spook
CHANGED
|
@@ -21,12 +21,13 @@ def usage
|
|
|
21
21
|
Usage: #{File.basename($0)} [options] <context_definition_file>
|
|
22
22
|
|
|
23
23
|
Options:
|
|
24
|
-
-o FILE
|
|
25
|
-
|
|
26
|
-
-h
|
|
27
|
-
-d DIR
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
-o FILE Write output to FILE instead of stdout
|
|
25
|
+
~v Disable verbose output, enabled by default
|
|
26
|
+
-h Show this help message
|
|
27
|
+
-d DIR[:SFX] Directory to search for files (can be used multiple times),
|
|
28
|
+
if SFX is given will only consider files with this suffix,
|
|
29
|
+
otherwise the -s argument value is used.
|
|
30
|
+
-s SUFFIX File suffix to include, defaults to all
|
|
30
31
|
|
|
31
32
|
Examples:
|
|
32
33
|
# Generate context and output to stdout
|
|
@@ -35,11 +36,8 @@ def usage
|
|
|
35
36
|
# Generate context from directory globs
|
|
36
37
|
#{File.basename($0)} -d lib -d spec -s rb
|
|
37
38
|
|
|
38
|
-
# Generate context
|
|
39
|
-
#{File.basename($0)} .contexts/project.rb
|
|
40
|
-
|
|
41
|
-
# Generate context from directory globs with verbose output
|
|
42
|
-
#{File.basename($0)} -d lib -d spec -s rb -v
|
|
39
|
+
# Generate context without verbose output
|
|
40
|
+
#{File.basename($0)} .contexts/project.rb ~v
|
|
43
41
|
|
|
44
42
|
# Generate context and save to file
|
|
45
43
|
#{File.basename($0)} .contexts/project.rb -o context.json
|
|
@@ -47,30 +45,39 @@ def usage
|
|
|
47
45
|
# Generate context from directory globs and save to file
|
|
48
46
|
#{File.basename($0)} -d lib -d spec -s rb -o context.json
|
|
49
47
|
|
|
48
|
+
# Generate context with explicit suffix hints
|
|
49
|
+
# -d lib:rb collects only .rb files from lib/
|
|
50
|
+
# -d bin:all collects all files from bin/ (no suffix filtering)
|
|
51
|
+
#{File.basename($0)} -d lib:rb -d bin:all
|
|
52
|
+
|
|
53
|
+
# Same result using default -s suffix all
|
|
54
|
+
#{File.basename($0)} -d lib:rb -d bin
|
|
50
55
|
EOT
|
|
51
56
|
exit 0
|
|
52
57
|
end
|
|
53
58
|
|
|
54
|
-
opts = go 'd:s:o:pvh', defaults: { ?
|
|
59
|
+
opts = go 'd:s:o:pvh', defaults: { ?v => true, ?s => 'all' }
|
|
55
60
|
opts[?h] and usage
|
|
56
61
|
context = nil
|
|
57
62
|
output = nil
|
|
58
|
-
if opts[?
|
|
63
|
+
if opts[?d]
|
|
64
|
+
suffix_arg = opts[?s]
|
|
59
65
|
context = ContextSpook.generate_context(verbose: opts[?v]) do
|
|
60
66
|
context do
|
|
61
|
-
opts[?d].to_a.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
dirs_sfx = opts[?d].to_a.map { |d| d =~ /:/ ? d : "#{d}:#{suffix_arg}" }
|
|
68
|
+
dirs_sfx.each do |ds|
|
|
69
|
+
dir, suffix = ds.split(?:, 2)
|
|
70
|
+
dir = Pathname.new(dir).expand_path
|
|
71
|
+
dir_glob = dir + (suffix == 'all' ? '**/*' : "**/*.#{suffix}")
|
|
72
|
+
Dir[dir_glob].each do |filename|
|
|
73
|
+
Pathname.new(filename).file? or next
|
|
74
|
+
file filename
|
|
68
75
|
end
|
|
69
76
|
end
|
|
70
77
|
end
|
|
71
78
|
end
|
|
72
79
|
else
|
|
73
|
-
filename = ARGV.shift or fail 'require context definition file as an argument'
|
|
80
|
+
filename = ARGV.shift or fail 'require context definition file as an argument'
|
|
74
81
|
context = ContextSpook.generate_context(filename, verbose: opts[?v])
|
|
75
82
|
end
|
|
76
83
|
if output_filename = opts[?o]
|
data/context_spook.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: context_spook 0.
|
|
2
|
+
# stub: context_spook 0.8.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "context_spook".freeze
|
|
6
|
-
s.version = "0.
|
|
6
|
+
s.version = "0.8.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]
|