context_spook 0.6.1 → 0.7.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 +11 -0
- data/Rakefile +1 -0
- data/bin/context_spook +34 -7
- data/context_spook.gemspec +3 -2
- data/lib/context_spook/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6fb6162c0afe83a80278392b433a3d02736b27a22e8fd565729665f3ba6db97
|
|
4
|
+
data.tar.gz: 98302a7facca6c08627d3572caf4aa0678ce21cc8b6c65a8ad96c3d583064440
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b856851ee22f9df0c56e17c9d287589101c9752859443a31c8d30bc9c0917d7f02424e2a0f785359830c508f221e791f3b4a0aa6976a5e20f30de4d0eb5b8701
|
|
7
|
+
data.tar.gz: c63473ad56525d7ba0d8ffcde23570b1d09ad25044406f299a65a03c416c10864030e83cf4e59920b8c1f0c069146983a8b316ea17ea1cb4afb0cb4c134c2b39
|
data/README.md
CHANGED
|
@@ -154,6 +154,17 @@ The CLI tool also supports file redirection:
|
|
|
154
154
|
./bin/context_spook .contexts/project.rb -o context.json
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
+
You can also use directory globbing to automatically collect files without
|
|
158
|
+
manually specifying each one:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Collect all Ruby files from lib/ and spec/ directories
|
|
162
|
+
./bin/context_spook -d lib -d spec -s rb
|
|
163
|
+
|
|
164
|
+
# Collect Markdown and YAML files from current directory
|
|
165
|
+
./bin/context_spook -s md -s yaml
|
|
166
|
+
```
|
|
167
|
+
|
|
157
168
|
This is how you can show the usage message:
|
|
158
169
|
|
|
159
170
|
```
|
data/Rakefile
CHANGED
|
@@ -37,6 +37,7 @@ GemHadar do
|
|
|
37
37
|
dependency 'mize', '~> 0.6'
|
|
38
38
|
dependency 'mime-types', '~> 3.0'
|
|
39
39
|
dependency 'yaml', '~> 0.4'
|
|
40
|
+
dependency 'pathname', '~> 0.4'
|
|
40
41
|
development_dependency 'all_images', '~> 0.6'
|
|
41
42
|
development_dependency 'rspec', '~> 3.2'
|
|
42
43
|
development_dependency 'debug'
|
data/bin/context_spook
CHANGED
|
@@ -4,6 +4,7 @@ require 'context_spook'
|
|
|
4
4
|
require 'tins/go'
|
|
5
5
|
include Tins::GO
|
|
6
6
|
require 'json'
|
|
7
|
+
require 'pathname'
|
|
7
8
|
|
|
8
9
|
# The usage method displays the command-line interface help text and example
|
|
9
10
|
# usage patterns for the ContextSpook tool.
|
|
@@ -23,29 +24,55 @@ def usage
|
|
|
23
24
|
-o FILE Write output to FILE instead of stdout
|
|
24
25
|
-v Verbose output
|
|
25
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)
|
|
26
30
|
|
|
27
31
|
Examples:
|
|
28
32
|
# Generate context and output to stdout
|
|
29
33
|
#{File.basename($0)} .contexts/project.rb
|
|
30
34
|
|
|
31
|
-
# Generate context
|
|
32
|
-
#{File.basename($0)}
|
|
35
|
+
# Generate context from directory globs
|
|
36
|
+
#{File.basename($0)} -d lib -d spec -s rb
|
|
33
37
|
|
|
34
38
|
# Generate context with verbose output
|
|
35
39
|
#{File.basename($0)} .contexts/project.rb -v
|
|
36
40
|
|
|
37
|
-
# Generate context
|
|
38
|
-
#{File.basename($0)}
|
|
41
|
+
# Generate context from directory globs with verbose output
|
|
42
|
+
#{File.basename($0)} -d lib -d spec -s rb -v
|
|
43
|
+
|
|
44
|
+
# Generate context and save to file
|
|
45
|
+
#{File.basename($0)} .contexts/project.rb -o context.json
|
|
46
|
+
|
|
47
|
+
# Generate context from directory globs and save to file
|
|
48
|
+
#{File.basename($0)} -d lib -d spec -s rb -o context.json
|
|
39
49
|
|
|
40
50
|
EOT
|
|
41
51
|
exit 0
|
|
42
52
|
end
|
|
43
53
|
|
|
44
|
-
opts = go 'o:pvh'
|
|
54
|
+
opts = go 'd:s:o:pvh', defaults: { ?d => ?. }
|
|
45
55
|
opts[?h] and usage
|
|
56
|
+
context = nil
|
|
57
|
+
output = nil
|
|
58
|
+
if opts[?s]
|
|
59
|
+
context = ContextSpook.generate_context(verbose: opts[?v]) do
|
|
60
|
+
context do
|
|
61
|
+
Array(opts[?d]).each do |d|
|
|
62
|
+
dir = Pathname.new(d).expand_path
|
|
63
|
+
Array(opts[?s]).each do |suffix|
|
|
64
|
+
dir_glob = dir + "**/*.#{suffix}"
|
|
65
|
+
Dir[dir_glob].each do |filename|
|
|
66
|
+
file filename
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
else
|
|
46
73
|
filename = ARGV.shift or fail 'require context definition file as an argument'
|
|
47
|
-
|
|
48
|
-
|
|
74
|
+
context = ContextSpook.generate_context(filename, verbose: opts[?v])
|
|
75
|
+
end
|
|
49
76
|
if output_filename = opts[?o]
|
|
50
77
|
if File.exist?(output_filename)
|
|
51
78
|
fail "Filename #{output_filename.inspect} already exists!"
|
data/context_spook.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: context_spook 0.
|
|
2
|
+
# stub: context_spook 0.7.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.7.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]
|
|
@@ -35,4 +35,5 @@ Gem::Specification.new do |s|
|
|
|
35
35
|
s.add_runtime_dependency(%q<mize>.freeze, ["~> 0.6".freeze])
|
|
36
36
|
s.add_runtime_dependency(%q<mime-types>.freeze, ["~> 3.0".freeze])
|
|
37
37
|
s.add_runtime_dependency(%q<yaml>.freeze, ["~> 0.4".freeze])
|
|
38
|
+
s.add_runtime_dependency(%q<pathname>.freeze, ["~> 0.4".freeze])
|
|
38
39
|
end
|
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.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -163,6 +163,20 @@ dependencies:
|
|
|
163
163
|
- - "~>"
|
|
164
164
|
- !ruby/object:Gem::Version
|
|
165
165
|
version: '0.4'
|
|
166
|
+
- !ruby/object:Gem::Dependency
|
|
167
|
+
name: pathname
|
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - "~>"
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0.4'
|
|
173
|
+
type: :runtime
|
|
174
|
+
prerelease: false
|
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
176
|
+
requirements:
|
|
177
|
+
- - "~>"
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: '0.4'
|
|
166
180
|
description: |
|
|
167
181
|
context_spook is a library that collects and organizes project
|
|
168
182
|
information to help AI assistants understand codebases better.
|