appydave-tools 0.9.2 → 0.9.3
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 +10 -5
- data/CHANGELOG.md +9 -0
- data/bin/youtube_automation.rb +38 -0
- data/lib/appydave/tools/configuration/_doc.md +1 -0
- data/lib/appydave/tools/configuration/models/config_base.rb +1 -0
- data/lib/appydave/tools/configuration/models/youtube_automation_config.rb +103 -0
- data/lib/appydave/tools/version.rb +1 -1
- data/lib/appydave/tools/youtube_automation/_doc.md +12 -0
- data/lib/appydave/tools/youtube_automation/gpt_agent.rb +65 -0
- data/lib/appydave/tools/youtube_manager/_doc.md +3 -0
- data/lib/appydave/tools.rb +3 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7d25de201fe246c80fe143f7414bfa76a4c8dc35a4d4ba26086ad4597b699a26
|
|
4
|
+
data.tar.gz: 9785e23d8743eb724082ceb7d9b699df06ca88e9ebc81401dc00f0af457527d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83964602096a76ca0dde6ad5362e5e521ac2fae2c2041f1cb1a989b11ac351892e9a47cc1b4d00afb3ed08d76b108a3192b04437a675c6bcf1d75ad19c423de0
|
|
7
|
+
data.tar.gz: a902575b0e19003e6326b2605ee3a31636a0d70b399b7180a3464c532e5b3ca603bed1cded2b1999b4406905b584cae3cc40eff0946d1bdf44395223527a67a2
|
data/.rubocop.yml
CHANGED
|
@@ -75,8 +75,17 @@ Naming/MethodParameterName:
|
|
|
75
75
|
Style/EmptyMethod:
|
|
76
76
|
Exclude:
|
|
77
77
|
- "**/spec/**/*"
|
|
78
|
-
|
|
78
|
+
Lint/EmptyFile:
|
|
79
79
|
Enabled: false
|
|
80
|
+
|
|
81
|
+
RSpec/SpecFilePathFormat:
|
|
82
|
+
Exclude:
|
|
83
|
+
- "**/spec/**/*"
|
|
84
|
+
|
|
85
|
+
RSpec/SpecFilePathSuffix:
|
|
86
|
+
Exclude:
|
|
87
|
+
- "**/spec/**/*"
|
|
88
|
+
|
|
80
89
|
Metrics/ParameterLists:
|
|
81
90
|
Exclude:
|
|
82
91
|
- "**/spec/**/*"
|
|
@@ -97,10 +106,6 @@ Layout/SpaceBeforeComma:
|
|
|
97
106
|
# My Preferences - End
|
|
98
107
|
|
|
99
108
|
# RSpec Cops
|
|
100
|
-
RSpec/FilePath:
|
|
101
|
-
Exclude:
|
|
102
|
-
- "**/spec/**/*"
|
|
103
|
-
|
|
104
109
|
RSpec/NamedSubject:
|
|
105
110
|
Exclude:
|
|
106
111
|
- "**/spec/**/*"
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.9.2](https://github.com/klueless-io/appydave-tools/compare/v0.9.1...v0.9.2) (2024-06-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* check for ci errors with openai ([2a9d549](https://github.com/klueless-io/appydave-tools/commit/2a9d549eb95246568ca54c1ec0fb9735cc26cac9))
|
|
7
|
+
* prepare openai for CI testing ([09c0d5a](https://github.com/klueless-io/appydave-tools/commit/09c0d5a998d00abb52eb3f09125bb955af1917d9))
|
|
8
|
+
* prepare openai for CI testing [#2](https://github.com/klueless-io/appydave-tools/issues/2) ([82247fc](https://github.com/klueless-io/appydave-tools/commit/82247fc2f421bd88859d25b0fbe88493b6e6d87e))
|
|
9
|
+
|
|
1
10
|
## [0.9.1](https://github.com/klueless-io/appydave-tools/compare/v0.9.0...v0.9.1) (2024-06-11)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
|
|
5
|
+
|
|
6
|
+
require 'appydave/tools'
|
|
7
|
+
|
|
8
|
+
options = {
|
|
9
|
+
sequence: nil,
|
|
10
|
+
debug: false
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
OptionParser.new do |opts|
|
|
14
|
+
opts.banner = 'Usage: youtube_automation.rb [options]'
|
|
15
|
+
|
|
16
|
+
opts.on('-s', '--sequence SEQUENCE', 'Sequence number (e.g., 01-1)') do |sequence|
|
|
17
|
+
options[:sequence] = sequence
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
opts.on('-d', '--debug', 'Enable debug mode') do
|
|
21
|
+
options[:debug] = true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
|
25
|
+
puts opts
|
|
26
|
+
exit
|
|
27
|
+
end
|
|
28
|
+
end.parse!
|
|
29
|
+
|
|
30
|
+
if options[:sequence].nil?
|
|
31
|
+
puts 'Error: Sequence number is required. Use -h for help.'
|
|
32
|
+
exit 1
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
Appydave::Tools::Configuration::Config.configure
|
|
36
|
+
|
|
37
|
+
automation = Appydave::Tools::YoutubeAutomation::GptAgent.new(options[:sequence], options[:debug])
|
|
38
|
+
automation.run
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[ChatGPT conversation](https://chatgpt.com/g/g-4dMsIRK3E-ruby-script-assistant/c/d8ea5960-071b-48aa-9fd9-554ca302c7dd)
|
|
4
4
|
[ChatGPT conversation for Schema](https://chatgpt.com/c/bb93e7ac-f139-44f9-8b9c-4e74ac2fa461)
|
|
5
|
+
[ChatGPT conversation for the YoutubeAutomationConfig][https://chatgpt.com/c/a7993d3f-35c9-4ec6-8cd6-5a506bfa22df]
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
## Schema
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appydave
|
|
4
|
+
module Tools
|
|
5
|
+
module Configuration
|
|
6
|
+
module Models
|
|
7
|
+
# Configuration model for Youtube automation
|
|
8
|
+
class YoutubeAutomationConfig < ConfigBase
|
|
9
|
+
def workflow_groups
|
|
10
|
+
data['workflow_groups'].map do |group|
|
|
11
|
+
WorkflowGroup.new(group)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def workflow_steps
|
|
16
|
+
data['workflow_steps'].map do |step|
|
|
17
|
+
WorkflowStep.new(step)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_workflow_group(group_id)
|
|
22
|
+
group_data = data['workflow_groups'].find { |group| group['group'] == group_id }
|
|
23
|
+
WorkflowGroup.new(group_data) if group_data
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get_workflow_steps(group_id)
|
|
27
|
+
data['workflow_steps'].select { |step| step['group'] == group_id }.map do |step|
|
|
28
|
+
WorkflowStep.new(step)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_sequence(sequence)
|
|
33
|
+
group, seq = sequence.split('-')
|
|
34
|
+
workflow_steps.find { |step| step.group == group && step.sequence == seq }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def next_sequence(sequence)
|
|
38
|
+
group, seq = sequence.split('-')
|
|
39
|
+
current_index = workflow_steps.find_index { |step| step.group == group && step.sequence == seq }
|
|
40
|
+
workflow_steps[current_index + 1] if current_index && current_index < workflow_steps.size - 1
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def previous_sequence(sequence)
|
|
44
|
+
group, seq = sequence.split('-')
|
|
45
|
+
current_index = workflow_steps.find_index { |step| step.group == group && step.sequence == seq }
|
|
46
|
+
workflow_steps[current_index - 1] if current_index&.positive?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def default_data
|
|
52
|
+
{
|
|
53
|
+
'workflow_groups' => [],
|
|
54
|
+
'workflow_steps' => []
|
|
55
|
+
}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Model for workflow groups
|
|
59
|
+
class WorkflowGroup
|
|
60
|
+
attr_accessor :group, :description
|
|
61
|
+
|
|
62
|
+
def initialize(data)
|
|
63
|
+
@group = data['group']
|
|
64
|
+
@description = data['description']
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def to_h
|
|
68
|
+
{
|
|
69
|
+
'group' => @group,
|
|
70
|
+
'description' => @description
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Model for workflow steps
|
|
76
|
+
class WorkflowStep
|
|
77
|
+
attr_accessor :group, :sequence, :name, :description
|
|
78
|
+
|
|
79
|
+
def initialize(data)
|
|
80
|
+
@group = data['group']
|
|
81
|
+
@sequence = data['sequence']
|
|
82
|
+
@name = data['name']
|
|
83
|
+
@description = data['description']
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def filename(ext)
|
|
87
|
+
"#{@group}-#{@sequence}-#{@name}.#{ext}"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def to_h
|
|
91
|
+
{
|
|
92
|
+
'group' => @group,
|
|
93
|
+
'sequence' => @sequence,
|
|
94
|
+
'name' => @name,
|
|
95
|
+
'description' => @description
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Youtube Automation
|
|
2
|
+
|
|
3
|
+
ChatGPT: https://chatgpt.com/c/2971aaeb-71f7-4981-9c85-21f1dabef9d9
|
|
4
|
+
|
|
5
|
+
YouTube automation is a set of tools for building YouTube videos automatically. The tools are designed to help with the following tasks:
|
|
6
|
+
|
|
7
|
+
[REWRITE THIS INFORMATION ONCE WE HAVE MORE DETAILS]
|
|
8
|
+
|
|
9
|
+
- Take a video concept or topic as simple
|
|
10
|
+
- Build out a simple title based on the topic
|
|
11
|
+
- Develop basic research around the area of keyboards
|
|
12
|
+
- Develop a fat sheet that has the basic information about the topic
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appydave
|
|
4
|
+
module Tools
|
|
5
|
+
module YoutubeAutomation
|
|
6
|
+
# GPT Agent interacts with OpenAI's GPT API to generate responses based on prompts for YouTube automation.
|
|
7
|
+
class GptAgent
|
|
8
|
+
include Appydave::Tools::Configuration::Configurable
|
|
9
|
+
|
|
10
|
+
def initialize(sequence, debug: false)
|
|
11
|
+
@sequence = sequence
|
|
12
|
+
@debug = debug
|
|
13
|
+
@prompts_path = '/Users/davidcruwys/Library/CloudStorage/Dropbox/team-tldr/_common/raw_prompts'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def run
|
|
17
|
+
step = config.youtube_automation.get_sequence(@sequence)
|
|
18
|
+
unless step
|
|
19
|
+
puts "Error: Step #{@sequence} not found in the configuration."
|
|
20
|
+
exit 1
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
prompt_content = read_prompt(step)
|
|
24
|
+
|
|
25
|
+
puts "Running sequence: #{@sequence}"
|
|
26
|
+
puts "Prompt file: #{prompt_file}"
|
|
27
|
+
puts "Prompt content:\n#{prompt_content}" if @debug
|
|
28
|
+
|
|
29
|
+
response = run_prompt(prompt_content)
|
|
30
|
+
|
|
31
|
+
puts "Response:\n#{response}"
|
|
32
|
+
save_response(prompt_file, response)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def read_prompt(_step)
|
|
38
|
+
File.read(filename)
|
|
39
|
+
rescue Errno::ENOENT
|
|
40
|
+
puts "Error: Prompt file #{filename} not found."
|
|
41
|
+
exit 1
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def run_prompt(prompt_content)
|
|
45
|
+
client = OpenAI::Client.new(access_token: ENV.fetch('OPENAI_ACCESS_TOKEN', nil))
|
|
46
|
+
response = client.completions(
|
|
47
|
+
engine: 'davinci-codex',
|
|
48
|
+
prompt: prompt_content,
|
|
49
|
+
max_tokens: 1000
|
|
50
|
+
)
|
|
51
|
+
response['choices'][0]['text'].strip
|
|
52
|
+
rescue StandardError => e
|
|
53
|
+
puts "Error: Failed to run prompt. #{e.message}"
|
|
54
|
+
exit 1
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def save_response(filename, response)
|
|
58
|
+
output_filename = filename.gsub('.md', '-output.md')
|
|
59
|
+
File.write(output_filename, response)
|
|
60
|
+
puts "Response saved to #{output_filename}"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
data/lib/appydave/tools.rb
CHANGED
|
@@ -28,6 +28,7 @@ require 'appydave/tools/configuration/models/config_base'
|
|
|
28
28
|
require 'appydave/tools/configuration/models/settings_config'
|
|
29
29
|
require 'appydave/tools/configuration/models/bank_reconciliation_config'
|
|
30
30
|
require 'appydave/tools/configuration/models/channels_config'
|
|
31
|
+
require 'appydave/tools/configuration/models/youtube_automation_config'
|
|
31
32
|
require 'appydave/tools/name_manager/project_name'
|
|
32
33
|
require 'appydave/tools/bank_reconciliation/clean/clean_transactions'
|
|
33
34
|
require 'appydave/tools/bank_reconciliation/clean/read_transactions'
|
|
@@ -36,6 +37,7 @@ require 'appydave/tools/bank_reconciliation/models/transaction'
|
|
|
36
37
|
|
|
37
38
|
require 'appydave/tools/subtitle_master/clean'
|
|
38
39
|
|
|
40
|
+
require 'appydave/tools/youtube_automation/gpt_agent'
|
|
39
41
|
require 'appydave/tools/youtube_manager/youtube_base'
|
|
40
42
|
require 'appydave/tools/youtube_manager/authorization'
|
|
41
43
|
require 'appydave/tools/youtube_manager/get_video'
|
|
@@ -47,6 +49,7 @@ Appydave::Tools::Configuration::Config.set_default do |config|
|
|
|
47
49
|
config.register(:settings, Appydave::Tools::Configuration::Models::SettingsConfig)
|
|
48
50
|
config.register(:bank_reconciliation, Appydave::Tools::Configuration::Models::BankReconciliationConfig)
|
|
49
51
|
config.register(:channels, Appydave::Tools::Configuration::Models::ChannelsConfig)
|
|
52
|
+
config.register(:youtube_automation, Appydave::Tools::Configuration::Models::YoutubeAutomationConfig)
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
module Appydave
|
data/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appydave-tools",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appydave-tools",
|
|
9
|
-
"version": "0.9.
|
|
9
|
+
"version": "0.9.3",
|
|
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.9.
|
|
4
|
+
version: 0.9.3
|
|
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-06-
|
|
11
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: clipboard
|
|
@@ -148,6 +148,7 @@ files:
|
|
|
148
148
|
- bin/gpt_context.rb
|
|
149
149
|
- bin/setup
|
|
150
150
|
- bin/subtitle_master.rb
|
|
151
|
+
- bin/youtube_automation.rb
|
|
151
152
|
- bin/youtube_manager.rb
|
|
152
153
|
- images.log
|
|
153
154
|
- lib/appydave/tools.rb
|
|
@@ -164,6 +165,7 @@ files:
|
|
|
164
165
|
- lib/appydave/tools/configuration/models/config_base.rb
|
|
165
166
|
- lib/appydave/tools/configuration/models/settings_config copy.xrb
|
|
166
167
|
- lib/appydave/tools/configuration/models/settings_config.rb
|
|
168
|
+
- lib/appydave/tools/configuration/models/youtube_automation_config.rb
|
|
167
169
|
- lib/appydave/tools/configuration/openai.rb
|
|
168
170
|
- lib/appydave/tools/gpt_context/_doc.md
|
|
169
171
|
- lib/appydave/tools/gpt_context/file_collector.rb
|
|
@@ -173,6 +175,9 @@ files:
|
|
|
173
175
|
- lib/appydave/tools/subtitle_master/_doc.md
|
|
174
176
|
- lib/appydave/tools/subtitle_master/clean.rb
|
|
175
177
|
- lib/appydave/tools/version.rb
|
|
178
|
+
- lib/appydave/tools/youtube_automation/_doc.md
|
|
179
|
+
- lib/appydave/tools/youtube_automation/gpt_agent.rb
|
|
180
|
+
- lib/appydave/tools/youtube_manager/_doc.md
|
|
176
181
|
- lib/appydave/tools/youtube_manager/authorization.rb
|
|
177
182
|
- lib/appydave/tools/youtube_manager/get_video.rb
|
|
178
183
|
- lib/appydave/tools/youtube_manager/reports/video_content_report.rb
|