context_spook 0.7.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ba5ed78117075d6742c646d759dd08152f967b0482e01a732ef44eea965fa44
4
- data.tar.gz: 7714e9ca69a6fbbc454f400927ca40c86bedad4df79f5ca154696edc29f98ea6
3
+ metadata.gz: 301e8fe3e37e6107d6f84e5ec3b683cc4dc70a6acd6e70677681eba91223973a
4
+ data.tar.gz: 0f53a0fd1559ea843833c07fd4ea6445c8ca38161db77caa9d44c861cc17b04a
5
5
  SHA512:
6
- metadata.gz: 272d7e1125b67b6f2de2a3360f420f393cbcaae4fd887182ad9de227f0d8317b272a7b309cbd745f340d1ffa435334a6b85144f9bbaf71b95903e207fda3cc2a
7
- data.tar.gz: 79f9289ef65f0179bc5bbdb53fd7302c37a7ce7e6df4a41724ad290e3c369fced720fda80a3df60c9c410dd6b2607bb79486afe1bd9e96da19507cb79e9100e4
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 with verbose output
144
- ./bin/context_spook .contexts/project.rb -v
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 Write output to FILE instead of stdout
25
- -v Verbose output
26
- -h Show this help message
27
- -d DIR Directory to search for files (defaults to current dir, can be
28
- used multiple times)
29
- -s SUFFIX File suffix to include (can be used multiple times)
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 with verbose output
39
- #{File.basename($0)} .contexts/project.rb -v
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: { ?d => ?. }
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[?s]
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].each do |d|
62
- dir = Pathname.new(d).expand_path
63
- opts[?s].each do |suffix|
64
- dir_glob = dir + "**/*.#{suffix}"
65
- Dir[dir_glob].each do |filename|
66
- file filename
67
- end
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]
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: context_spook 0.7.1 ruby lib
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.7.1".freeze
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]
@@ -1,6 +1,6 @@
1
1
  module ContextSpook
2
2
  # ContextSpook version
3
- VERSION = '0.7.1'
3
+ VERSION = '0.8.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: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank