appydave-tools 0.3.8 → 0.4.1
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/.rubocop.yml +8 -1
- data/CHANGELOG.md +21 -0
- data/bin/gpt_context.rb +8 -2
- data/lib/appydave/tools/configuration/_doc.md +5 -1
- data/lib/appydave/tools/configuration/config.rb +1 -0
- data/lib/appydave/tools/configuration/models/channel_projects_config.rb +67 -0
- data/lib/appydave/tools/configuration/models/channels_config.rb +76 -0
- data/lib/appydave/tools/configuration/models/config_base.rb +58 -0
- data/lib/appydave/tools/configuration/models/settings_config.rb +34 -0
- data/lib/appydave/tools/configuration/openai.rb +15 -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 +7 -5
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +37 -7
- data/lib/appydave/tools/configuration/channel_projects_config.rb +0 -65
- data/lib/appydave/tools/configuration/channels_config.rb +0 -74
- data/lib/appydave/tools/configuration/config_base.rb +0 -56
- data/lib/appydave/tools/configuration/settings_config.rb +0 -32
- /data/lib/appydave/tools/configuration/{settings_config copy.xrb → models/settings_config copy.xrb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adaf87989c7386fc11d7e2b29a9578b7920a913232e606169b67406f0ddb819a
|
4
|
+
data.tar.gz: af6c9502a2b8a66bbe26a0f483109f417c168eeb8c26d8805549e439dff0d437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6334c9279ca5e2f6fd5cf1de4973470dd4dfb2e74e5346e0b0f86a9b1a7fb5594940236e22785123887e6df03a2f009feb677ebb975be3f59606522f23ea1ac0
|
7
|
+
data.tar.gz: 5856609b0464a50f23e1ab700a8995ff86cde4f00dc4c75b9fd81f13d0dfd5dc89cac09c04d72f4026e888bd884009156bb110e1e5bf0e41510ee81dd0b5d54f
|
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,24 @@
|
|
1
|
+
# [0.4.0](https://github.com/klueless-io/appydave-tools/compare/v0.3.8...v0.4.0) (2024-05-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* remove from ci for now ([e4c9e22](https://github.com/klueless-io/appydave-tools/commit/e4c9e225e6fe35a00a7b4d83ff9f2795da737589))
|
7
|
+
* remove from ci for now ([30a114c](https://github.com/klueless-io/appydave-tools/commit/30a114c7cd0085ab92aeb906e1962ca3618631e8))
|
8
|
+
* remove from ci for now ([7062c3d](https://github.com/klueless-io/appydave-tools/commit/7062c3d69634ab281107b755533f3332b708eb56))
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* Add line limit option and update default format handling ([a0eb426](https://github.com/klueless-io/appydave-tools/commit/a0eb426329ee2a997081cf1a5c219c05d07ff824))
|
14
|
+
|
15
|
+
## [0.3.8](https://github.com/klueless-io/appydave-tools/compare/v0.3.7...v0.3.8) (2024-05-25)
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* update settings ([0b0c256](https://github.com/klueless-io/appydave-tools/commit/0b0c256793b607db87001752071b0476c6390c5f))
|
21
|
+
|
1
22
|
## [0.3.7](https://github.com/klueless-io/appydave-tools/compare/v0.3.6...v0.3.7) (2024-05-19)
|
2
23
|
|
3
24
|
|
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
|
|
@@ -1,7 +1,11 @@
|
|
1
1
|
# Configuration Component
|
2
2
|
|
3
3
|
[ChatGPT conversation](https://chatgpt.com/g/g-4dMsIRK3E-ruby-script-assistant/c/d8ea5960-071b-48aa-9fd9-554ca302c7dd)
|
4
|
-
[ChatGPT
|
4
|
+
[ChatGPT conversation for Schema](https://chatgpt.com/c/bb93e7ac-f139-44f9-8b9c-4e74ac2fa461)
|
5
|
+
|
6
|
+
attr_accessor :code,
|
7
|
+
:narration
|
8
|
+
|
5
9
|
|
6
10
|
## Schema
|
7
11
|
|
@@ -29,6 +29,7 @@ module Appydave
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def method_missing(method_name, *_args)
|
32
|
+
raise Appydave::Tools::Error, 'Configuration has never been registered' if @configurations.nil?
|
32
33
|
raise Appydave::Tools::Error, "Configuration not available: #{method_name}" unless @configurations.key?(method_name)
|
33
34
|
|
34
35
|
@configurations[method_name]
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appydave
|
4
|
+
module Tools
|
5
|
+
module Configuration
|
6
|
+
module Models
|
7
|
+
# Channel projects configuration
|
8
|
+
class ChannelProjectsConfig < ConfigBase
|
9
|
+
# Retrieve channel information by channel name (string or symbol)
|
10
|
+
def get_channel_info(channel_name)
|
11
|
+
channel_name = channel_name.to_s
|
12
|
+
ChannelInfo.new(data['channel_projects'][channel_name] || default_channel_info)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Set channel information
|
16
|
+
def set_channel_info(channel_name, channel_info)
|
17
|
+
data['channel_projects'] ||= {}
|
18
|
+
data['channel_projects'][channel_name.to_s] = channel_info.to_h
|
19
|
+
end
|
20
|
+
|
21
|
+
# Retrieve a list of all channel projects
|
22
|
+
def channel_projects
|
23
|
+
data['channel_projects'].map do |_name, info|
|
24
|
+
ChannelInfo.new(info)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def default_data
|
31
|
+
{ 'channel_projects' => {} }
|
32
|
+
end
|
33
|
+
|
34
|
+
def default_channel_info
|
35
|
+
{
|
36
|
+
'content_projects' => '',
|
37
|
+
'video_projects' => '',
|
38
|
+
'published_projects' => '',
|
39
|
+
'abandoned_projects' => ''
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Type-safe class to access channel info properties
|
44
|
+
class ChannelInfo
|
45
|
+
attr_accessor :content_projects, :video_projects, :published_projects, :abandoned_projects
|
46
|
+
|
47
|
+
def initialize(data)
|
48
|
+
@content_projects = data['content_projects']
|
49
|
+
@video_projects = data['video_projects']
|
50
|
+
@published_projects = data['published_projects']
|
51
|
+
@abandoned_projects = data['abandoned_projects']
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_h
|
55
|
+
{
|
56
|
+
'content_projects' => @content_projects,
|
57
|
+
'video_projects' => @video_projects,
|
58
|
+
'published_projects' => @published_projects,
|
59
|
+
'abandoned_projects' => @abandoned_projects
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appydave
|
4
|
+
module Tools
|
5
|
+
module Configuration
|
6
|
+
module Models
|
7
|
+
# Channels configuration
|
8
|
+
class ChannelsConfig < ConfigBase
|
9
|
+
# Retrieve channel information by channel code (string or symbol)
|
10
|
+
def get_channel(channel_key)
|
11
|
+
channel_key = channel_key.to_s
|
12
|
+
info = data['channels'][channel_key] || default_channel_info
|
13
|
+
ChannelInfo.new(channel_key, info)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Set channel information
|
17
|
+
def set_channel(channel_key, channel_info)
|
18
|
+
data['channels'] ||= {}
|
19
|
+
data['channels'][channel_key.to_s] = channel_info.to_h
|
20
|
+
end
|
21
|
+
|
22
|
+
# Retrieve a list of all channels
|
23
|
+
def channels
|
24
|
+
data['channels'].map do |key, info|
|
25
|
+
ChannelInfo.new(key, info)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def key?(key)
|
30
|
+
key = key.to_s
|
31
|
+
data['channels'].key?(key)
|
32
|
+
end
|
33
|
+
|
34
|
+
def code?(code)
|
35
|
+
code = code.to_s
|
36
|
+
data['channels'].values.any? { |info| info['code'] == code }
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def default_data
|
42
|
+
{ 'channels' => {} }
|
43
|
+
end
|
44
|
+
|
45
|
+
def default_channel_info
|
46
|
+
{
|
47
|
+
'code' => '',
|
48
|
+
'name' => '',
|
49
|
+
'youtube_handle' => ''
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Type-safe class to access channel properties
|
54
|
+
class ChannelInfo
|
55
|
+
attr_accessor :key, :code, :name, :youtube_handle
|
56
|
+
|
57
|
+
def initialize(key, data)
|
58
|
+
@key = key
|
59
|
+
@code = data['code']
|
60
|
+
@name = data['name']
|
61
|
+
@youtube_handle = data['youtube_handle']
|
62
|
+
end
|
63
|
+
|
64
|
+
def to_h
|
65
|
+
{
|
66
|
+
'code' => @code,
|
67
|
+
'name' => @name,
|
68
|
+
'youtube_handle' => @youtube_handle
|
69
|
+
}
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Appydave
|
7
|
+
module Tools
|
8
|
+
module Configuration
|
9
|
+
module Models
|
10
|
+
# Base class for handling common configuration tasks
|
11
|
+
class ConfigBase
|
12
|
+
include KLog::Logging
|
13
|
+
|
14
|
+
attr_reader :config_path, :data
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@config_path = File.join(Config.config_path, "#{config_name}.json")
|
18
|
+
@data = load
|
19
|
+
end
|
20
|
+
|
21
|
+
def save
|
22
|
+
File.write(config_path, JSON.pretty_generate(data))
|
23
|
+
end
|
24
|
+
|
25
|
+
def load
|
26
|
+
return JSON.parse(File.read(config_path)) if File.exist?(config_path)
|
27
|
+
|
28
|
+
default_data
|
29
|
+
rescue JSON::ParserError
|
30
|
+
# log.exception e
|
31
|
+
default_data
|
32
|
+
end
|
33
|
+
|
34
|
+
def name
|
35
|
+
self.class.name.split('::')[-1].gsub(/Config$/, '')
|
36
|
+
end
|
37
|
+
|
38
|
+
def config_name
|
39
|
+
name.gsub(/([a-z])([A-Z])/, '\1-\2').downcase
|
40
|
+
end
|
41
|
+
|
42
|
+
def debug
|
43
|
+
log.kv 'Config', name
|
44
|
+
log.kv 'Path', config_path
|
45
|
+
|
46
|
+
log.json data
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def default_data
|
52
|
+
{}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appydave
|
4
|
+
module Tools
|
5
|
+
module Configuration
|
6
|
+
module Models
|
7
|
+
# Global settings that can be referenced by other configurations or tools
|
8
|
+
class SettingsConfig < ConfigBase
|
9
|
+
def set(key, value)
|
10
|
+
data[key] = value
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(key, default = nil)
|
14
|
+
data.fetch(key, default)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Well known settings
|
18
|
+
|
19
|
+
def ecamm_recording_folder
|
20
|
+
get('ecamm-recording-folder')
|
21
|
+
end
|
22
|
+
|
23
|
+
def download_folder
|
24
|
+
get('download-folder')
|
25
|
+
end
|
26
|
+
|
27
|
+
def download_image_folder
|
28
|
+
get('download-image-folder') || download_folder
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -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
|
@@ -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,23 +4,25 @@ 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
|
-
require 'appydave/tools/configuration/config_base'
|
15
16
|
require 'appydave/tools/configuration/config'
|
16
|
-
require 'appydave/tools/configuration/
|
17
|
-
require 'appydave/tools/configuration/
|
18
|
-
require 'appydave/tools/configuration/
|
17
|
+
require 'appydave/tools/configuration/models/config_base'
|
18
|
+
require 'appydave/tools/configuration/models/settings_config'
|
19
|
+
require 'appydave/tools/configuration/models/channel_projects_config'
|
20
|
+
require 'appydave/tools/configuration/models/channels_config'
|
19
21
|
require 'appydave/tools/name_manager/project_name'
|
20
22
|
|
21
23
|
Appydave::Tools::Configuration::Config.set_default do |config|
|
22
24
|
config.config_path = File.expand_path('~/.config/appydave')
|
23
|
-
config.register(:settings, Appydave::Tools::Configuration::SettingsConfig)
|
25
|
+
config.register(:settings, Appydave::Tools::Configuration::Models::SettingsConfig)
|
24
26
|
config.register(:channels, Appydave::Tools::Configuration::ChannelsConfig)
|
25
27
|
config.register(:channel_projects, Appydave::Tools::Configuration::ChannelProjectsConfig)
|
26
28
|
end
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "appydave-tools",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.4.1",
|
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.1",
|
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.1
|
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
|
@@ -64,13 +92,15 @@ files:
|
|
64
92
|
- images.log
|
65
93
|
- lib/appydave/tools.rb
|
66
94
|
- lib/appydave/tools/configuration/_doc.md
|
67
|
-
- lib/appydave/tools/configuration/channel_projects_config.rb
|
68
|
-
- lib/appydave/tools/configuration/channels_config.rb
|
69
95
|
- lib/appydave/tools/configuration/config.rb
|
70
|
-
- lib/appydave/tools/configuration/config_base.rb
|
71
96
|
- lib/appydave/tools/configuration/configurable.rb
|
72
|
-
- lib/appydave/tools/configuration/
|
73
|
-
- lib/appydave/tools/configuration/
|
97
|
+
- lib/appydave/tools/configuration/models/channel_projects_config.rb
|
98
|
+
- lib/appydave/tools/configuration/models/channels_config.rb
|
99
|
+
- lib/appydave/tools/configuration/models/config_base.rb
|
100
|
+
- lib/appydave/tools/configuration/models/settings_config copy.xrb
|
101
|
+
- lib/appydave/tools/configuration/models/settings_config.rb
|
102
|
+
- lib/appydave/tools/configuration/openai.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
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appydave
|
4
|
-
module Tools
|
5
|
-
module Configuration
|
6
|
-
# Channel projects configuration
|
7
|
-
class ChannelProjectsConfig < ConfigBase
|
8
|
-
# Retrieve channel information by channel name (string or symbol)
|
9
|
-
def get_channel_info(channel_name)
|
10
|
-
channel_name = channel_name.to_s
|
11
|
-
ChannelInfo.new(data['channel_projects'][channel_name] || default_channel_info)
|
12
|
-
end
|
13
|
-
|
14
|
-
# Set channel information
|
15
|
-
def set_channel_info(channel_name, channel_info)
|
16
|
-
data['channel_projects'] ||= {}
|
17
|
-
data['channel_projects'][channel_name.to_s] = channel_info.to_h
|
18
|
-
end
|
19
|
-
|
20
|
-
# Retrieve a list of all channel projects
|
21
|
-
def channel_projects
|
22
|
-
data['channel_projects'].map do |_name, info|
|
23
|
-
ChannelInfo.new(info)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def default_data
|
30
|
-
{ 'channel_projects' => {} }
|
31
|
-
end
|
32
|
-
|
33
|
-
def default_channel_info
|
34
|
-
{
|
35
|
-
'content_projects' => '',
|
36
|
-
'video_projects' => '',
|
37
|
-
'published_projects' => '',
|
38
|
-
'abandoned_projects' => ''
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# Type-safe class to access channel info properties
|
43
|
-
class ChannelInfo
|
44
|
-
attr_accessor :content_projects, :video_projects, :published_projects, :abandoned_projects
|
45
|
-
|
46
|
-
def initialize(data)
|
47
|
-
@content_projects = data['content_projects']
|
48
|
-
@video_projects = data['video_projects']
|
49
|
-
@published_projects = data['published_projects']
|
50
|
-
@abandoned_projects = data['abandoned_projects']
|
51
|
-
end
|
52
|
-
|
53
|
-
def to_h
|
54
|
-
{
|
55
|
-
'content_projects' => @content_projects,
|
56
|
-
'video_projects' => @video_projects,
|
57
|
-
'published_projects' => @published_projects,
|
58
|
-
'abandoned_projects' => @abandoned_projects
|
59
|
-
}
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appydave
|
4
|
-
module Tools
|
5
|
-
module Configuration
|
6
|
-
# Channels configuration
|
7
|
-
class ChannelsConfig < ConfigBase
|
8
|
-
# Retrieve channel information by channel code (string or symbol)
|
9
|
-
def get_channel(channel_key)
|
10
|
-
channel_key = channel_key.to_s
|
11
|
-
info = data['channels'][channel_key] || default_channel_info
|
12
|
-
ChannelInfo.new(channel_key, info)
|
13
|
-
end
|
14
|
-
|
15
|
-
# Set channel information
|
16
|
-
def set_channel(channel_key, channel_info)
|
17
|
-
data['channels'] ||= {}
|
18
|
-
data['channels'][channel_key.to_s] = channel_info.to_h
|
19
|
-
end
|
20
|
-
|
21
|
-
# Retrieve a list of all channels
|
22
|
-
def channels
|
23
|
-
data['channels'].map do |key, info|
|
24
|
-
ChannelInfo.new(key, info)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def key?(key)
|
29
|
-
key = key.to_s
|
30
|
-
data['channels'].key?(key)
|
31
|
-
end
|
32
|
-
|
33
|
-
def code?(code)
|
34
|
-
code = code.to_s
|
35
|
-
data['channels'].values.any? { |info| info['code'] == code }
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def default_data
|
41
|
-
{ 'channels' => {} }
|
42
|
-
end
|
43
|
-
|
44
|
-
def default_channel_info
|
45
|
-
{
|
46
|
-
'code' => '',
|
47
|
-
'name' => '',
|
48
|
-
'youtube_handle' => ''
|
49
|
-
}
|
50
|
-
end
|
51
|
-
|
52
|
-
# Type-safe class to access channel properties
|
53
|
-
class ChannelInfo
|
54
|
-
attr_accessor :key, :code, :name, :youtube_handle
|
55
|
-
|
56
|
-
def initialize(key, data)
|
57
|
-
@key = key
|
58
|
-
@code = data['code']
|
59
|
-
@name = data['name']
|
60
|
-
@youtube_handle = data['youtube_handle']
|
61
|
-
end
|
62
|
-
|
63
|
-
def to_h
|
64
|
-
{
|
65
|
-
'code' => @code,
|
66
|
-
'name' => @name,
|
67
|
-
'youtube_handle' => @youtube_handle
|
68
|
-
}
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'fileutils'
|
5
|
-
|
6
|
-
module Appydave
|
7
|
-
module Tools
|
8
|
-
module Configuration
|
9
|
-
# Base class for handling common configuration tasks
|
10
|
-
class ConfigBase
|
11
|
-
include KLog::Logging
|
12
|
-
|
13
|
-
attr_reader :config_path, :data
|
14
|
-
|
15
|
-
def initialize
|
16
|
-
@config_path = File.join(Config.config_path, "#{config_name}.json")
|
17
|
-
@data = load
|
18
|
-
end
|
19
|
-
|
20
|
-
def save
|
21
|
-
File.write(config_path, JSON.pretty_generate(data))
|
22
|
-
end
|
23
|
-
|
24
|
-
def load
|
25
|
-
return JSON.parse(File.read(config_path)) if File.exist?(config_path)
|
26
|
-
|
27
|
-
default_data
|
28
|
-
rescue JSON::ParserError
|
29
|
-
# log.exception e
|
30
|
-
default_data
|
31
|
-
end
|
32
|
-
|
33
|
-
def name
|
34
|
-
self.class.name.split('::')[-1].gsub(/Config$/, '')
|
35
|
-
end
|
36
|
-
|
37
|
-
def config_name
|
38
|
-
name.gsub(/([a-z])([A-Z])/, '\1-\2').downcase
|
39
|
-
end
|
40
|
-
|
41
|
-
def debug
|
42
|
-
log.kv 'Config', name
|
43
|
-
log.kv 'Path', config_path
|
44
|
-
|
45
|
-
log.json data
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
def default_data
|
51
|
-
{}
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Appydave
|
4
|
-
module Tools
|
5
|
-
module Configuration
|
6
|
-
# Global settings that can be referenced by other configurations or tools
|
7
|
-
class SettingsConfig < ConfigBase
|
8
|
-
def set(key, value)
|
9
|
-
data[key] = value
|
10
|
-
end
|
11
|
-
|
12
|
-
def get(key, default = nil)
|
13
|
-
data.fetch(key, default)
|
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
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
/data/lib/appydave/tools/configuration/{settings_config copy.xrb → models/settings_config copy.xrb}
RENAMED
File without changes
|