appydave-tools 0.3.7 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -1
- data/CHANGELOG.md +14 -0
- data/bin/gpt_context.rb +8 -2
- data/lib/appydave/tools/configuration/openai.rb +15 -0
- data/lib/appydave/tools/configuration/settings_config.rb +14 -0
- data/lib/appydave/tools/gpt_context/_doc.md +4 -0
- data/lib/appydave/tools/gpt_context/file_collector.rb +22 -11
- data/lib/appydave/tools/version.rb +1 -1
- data/lib/appydave/tools.rb +2 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 460c13d4f34c24b621d28cd677bc2682a7e402b6829e668148532e3745c2f1d2
|
4
|
+
data.tar.gz: 3fb21998fd595b476dde7a89e85b5db1454eebe9e8f9116e68a59f7e10879611
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6b483e278c8550a21caffe2aa7a41dc09662e86bff1676713a98102b118bae09765162b22e5ecdcaa63b4182e6ed523b0b65d533146d89f46cc31af77bf86ef
|
7
|
+
data.tar.gz: 47c6de40aa8f3fe86acc72d137cae0218e6b6f1d269b62853a73b3f72a20a0a85bd0cbe63218105e667e74249d0eb1168c135d0a7a46db19f9dc35d7a6708d38
|
data/.rubocop.yml
CHANGED
@@ -19,6 +19,7 @@ Metrics/BlockLength:
|
|
19
19
|
Exclude:
|
20
20
|
- "**/spec/**/*"
|
21
21
|
- "*.gemspec"
|
22
|
+
- "bin/gpt_context.rb"
|
22
23
|
AllowedMethods:
|
23
24
|
- configure
|
24
25
|
- context
|
@@ -107,4 +108,10 @@ RSpec/MultipleExpectations:
|
|
107
108
|
Max: 5
|
108
109
|
|
109
110
|
RSpec/NestedGroups:
|
110
|
-
Max: 8
|
111
|
+
Max: 8
|
112
|
+
|
113
|
+
RSpec/DescribeClass:
|
114
|
+
Enabled: false
|
115
|
+
|
116
|
+
RSpec/PendingWithoutReason:
|
117
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [0.3.8](https://github.com/klueless-io/appydave-tools/compare/v0.3.7...v0.3.8) (2024-05-25)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* update settings ([0b0c256](https://github.com/klueless-io/appydave-tools/commit/0b0c256793b607db87001752071b0476c6390c5f))
|
7
|
+
|
8
|
+
## [0.3.7](https://github.com/klueless-io/appydave-tools/compare/v0.3.6...v0.3.7) (2024-05-19)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* add test for project_name generation ([3a87d9b](https://github.com/klueless-io/appydave-tools/commit/3a87d9b6f942e1b4e6576adaea58eaf799f5d74f))
|
14
|
+
|
1
15
|
## [0.3.6](https://github.com/klueless-io/appydave-tools/compare/v0.3.5...v0.3.6) (2024-05-19)
|
2
16
|
|
3
17
|
|
data/bin/gpt_context.rb
CHANGED
@@ -14,7 +14,8 @@ require 'appydave/tools'
|
|
14
14
|
options = {
|
15
15
|
include_patterns: [],
|
16
16
|
exclude_patterns: [],
|
17
|
-
format:
|
17
|
+
format: 'tree,content',
|
18
|
+
line_limit: nil,
|
18
19
|
debug: 'none'
|
19
20
|
}
|
20
21
|
|
@@ -29,10 +30,14 @@ OptionParser.new do |opts|
|
|
29
30
|
options[:exclude_patterns] << pattern
|
30
31
|
end
|
31
32
|
|
32
|
-
opts.on('-f', '--format FORMAT', 'Output format:
|
33
|
+
opts.on('-f', '--format FORMAT', 'Output format: content or tree, if not provided then both are used') do |format|
|
33
34
|
options[:format] = format
|
34
35
|
end
|
35
36
|
|
37
|
+
opts.on('-l', '--line-limit LIMIT', 'Limit the number of lines included from each file') do |limit|
|
38
|
+
options[:line_limit] = limit.to_i
|
39
|
+
end
|
40
|
+
|
36
41
|
# None - No debug output
|
37
42
|
# Output - Output the content to the console, this is the same as found in the clipboard
|
38
43
|
# Params - Output the options that were passed to the script
|
@@ -68,6 +73,7 @@ gatherer = Appydave::Tools::GptContext::FileCollector.new(
|
|
68
73
|
include_patterns: options[:include_patterns],
|
69
74
|
exclude_patterns: options[:exclude_patterns],
|
70
75
|
format: options[:format],
|
76
|
+
line_limit: options[:line_limit],
|
71
77
|
working_directory: Dir.pwd
|
72
78
|
)
|
73
79
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dotenv'
|
4
|
+
# Dotenv.load(".env.#{ENV['APP_ENV']}") # Loads environment-specific dotenv file.
|
5
|
+
Dotenv.load('.env')
|
6
|
+
|
7
|
+
OpenAI.configure do |config|
|
8
|
+
tools_enabled = ENV.fetch('TOOLS_ENABLED', 'false')
|
9
|
+
|
10
|
+
if tools_enabled == 'true'
|
11
|
+
puts 'OpenAI Tools are enabled'
|
12
|
+
config.access_token = ENV.fetch('OPENAI_ACCESS_TOKEN')
|
13
|
+
config.organization_id = ENV.fetch('OPENAI_ORGANIZATION_ID', nil)
|
14
|
+
end
|
15
|
+
end
|
@@ -12,6 +12,20 @@ module Appydave
|
|
12
12
|
def get(key, default = nil)
|
13
13
|
data.fetch(key, default)
|
14
14
|
end
|
15
|
+
|
16
|
+
# Well known settings
|
17
|
+
|
18
|
+
def ecamm_recording_folder
|
19
|
+
get('ecamm-recording-folder')
|
20
|
+
end
|
21
|
+
|
22
|
+
def download_folder
|
23
|
+
get('download-folder')
|
24
|
+
end
|
25
|
+
|
26
|
+
def download_image_folder
|
27
|
+
get('download-image-folder') || download_folder
|
28
|
+
end
|
15
29
|
end
|
16
30
|
end
|
17
31
|
end
|
@@ -6,26 +6,30 @@ module Appydave
|
|
6
6
|
module GptContext
|
7
7
|
# Gathers file names and content based on include and exclude patterns
|
8
8
|
class FileCollector
|
9
|
-
attr_reader :include_patterns, :exclude_patterns, :format, :working_directory
|
9
|
+
attr_reader :include_patterns, :exclude_patterns, :format, :working_directory, :line_limit
|
10
10
|
|
11
|
-
def initialize(include_patterns: [], exclude_patterns: [], format:
|
11
|
+
def initialize(include_patterns: [], exclude_patterns: [], format: 'tree,content', working_directory: nil, line_limit: nil)
|
12
12
|
@include_patterns = include_patterns
|
13
13
|
@exclude_patterns = exclude_patterns
|
14
14
|
@format = format
|
15
15
|
@working_directory = working_directory
|
16
|
+
@line_limit = line_limit
|
16
17
|
end
|
17
18
|
|
18
19
|
def build
|
19
20
|
FileUtils.cd(working_directory) if working_directory && Dir.exist?(working_directory)
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
formats = format.split(',')
|
23
|
+
result = formats.map do |fmt|
|
24
|
+
case fmt
|
25
|
+
when 'tree'
|
26
|
+
build_tree
|
27
|
+
when 'content'
|
28
|
+
build_content
|
29
|
+
else
|
30
|
+
''
|
31
|
+
end
|
32
|
+
end.join("\n\n")
|
29
33
|
|
30
34
|
FileUtils.cd(Dir.home) if working_directory
|
31
35
|
|
@@ -41,7 +45,7 @@ module Appydave
|
|
41
45
|
Dir.glob(pattern).each do |file_path|
|
42
46
|
next if excluded?(file_path) || File.directory?(file_path)
|
43
47
|
|
44
|
-
content = "# file: #{file_path}\n\n#{
|
48
|
+
content = "# file: #{file_path}\n\n#{read_file_content(file_path)}"
|
45
49
|
concatenated_content << content
|
46
50
|
end
|
47
51
|
end
|
@@ -49,6 +53,13 @@ module Appydave
|
|
49
53
|
concatenated_content.join("\n\n")
|
50
54
|
end
|
51
55
|
|
56
|
+
def read_file_content(file_path)
|
57
|
+
lines = File.readlines(file_path)
|
58
|
+
return lines.first(line_limit).join if line_limit
|
59
|
+
|
60
|
+
lines.join
|
61
|
+
end
|
62
|
+
|
52
63
|
def build_tree
|
53
64
|
tree_view = {}
|
54
65
|
|
data/lib/appydave/tools.rb
CHANGED
@@ -4,12 +4,14 @@ require 'clipboard'
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'json'
|
6
6
|
require 'open3'
|
7
|
+
require 'openai'
|
7
8
|
require 'optparse'
|
8
9
|
require 'k_log'
|
9
10
|
|
10
11
|
require 'appydave/tools/version'
|
11
12
|
require 'appydave/tools/gpt_context/file_collector'
|
12
13
|
|
14
|
+
require 'appydave/tools/configuration/openai'
|
13
15
|
require 'appydave/tools/configuration/configurable'
|
14
16
|
require 'appydave/tools/configuration/config_base'
|
15
17
|
require 'appydave/tools/configuration/config'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "appydave-tools",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.4.0",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "appydave-tools",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.4.0",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.3",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appydave-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotenv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: k_log
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ruby-openai
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '7'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '7'
|
41
69
|
description: " AppyDave YouTube Automation Tools\n"
|
42
70
|
email:
|
43
71
|
- david@ideasmen.com.au
|
@@ -69,8 +97,10 @@ files:
|
|
69
97
|
- lib/appydave/tools/configuration/config.rb
|
70
98
|
- lib/appydave/tools/configuration/config_base.rb
|
71
99
|
- lib/appydave/tools/configuration/configurable.rb
|
100
|
+
- lib/appydave/tools/configuration/openai.rb
|
72
101
|
- lib/appydave/tools/configuration/settings_config copy.xrb
|
73
102
|
- lib/appydave/tools/configuration/settings_config.rb
|
103
|
+
- lib/appydave/tools/gpt_context/_doc.md
|
74
104
|
- lib/appydave/tools/gpt_context/file_collector.rb
|
75
105
|
- lib/appydave/tools/name_manager/_doc.md
|
76
106
|
- lib/appydave/tools/name_manager/project_name.rb
|