appydave-tools 0.3.8 → 0.4.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: abcb7832a0081b43eae1e469b3afad533e09ff21db73512682090de44be185a9
4
- data.tar.gz: a093d21f86dd3ca4d84b4e4c924176b37d92efd63cb579936f435368263cfabd
3
+ metadata.gz: 460c13d4f34c24b621d28cd677bc2682a7e402b6829e668148532e3745c2f1d2
4
+ data.tar.gz: 3fb21998fd595b476dde7a89e85b5db1454eebe9e8f9116e68a59f7e10879611
5
5
  SHA512:
6
- metadata.gz: bb0a732b2d46d87d84e3537cbc80a91288652341a35e49cb9b491542c00bab0583d15fb72b40e6fbbf468455f768f4ba61957c0931819016e47aad3fb6da47de
7
- data.tar.gz: facc58c71da799e70b0dc6e55de2578a411a736093f2dd0f7e2360f9ce81672c9faa224c093bda8442e4d8491a80d00b98ba1a98649c05d543c5a08f15732a21
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,10 @@
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
+
1
8
  ## [0.3.7](https://github.com/klueless-io/appydave-tools/compare/v0.3.6...v0.3.7) (2024-05-19)
2
9
 
3
10
 
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: nil,
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: default or tree') do |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
@@ -0,0 +1,4 @@
1
+ # GPT Context Gather
2
+
3
+ [ChatGPT conversation](https://chatgpt.com/c/efba7b3c-21e7-415c-97eb-92994c3e49fc)
4
+
@@ -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: nil, working_directory: nil)
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
- result = case format
22
- when 'tree'
23
- build_tree
24
- when 'both'
25
- "#{build_tree}\n\n#{build_content}"
26
- else
27
- build_content
28
- end
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#{File.read(file_path)}"
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.3.8'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
@@ -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.8",
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.3.8",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "AppyDave YouTube Automation Tools",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.3.8
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-25 00:00:00.000000000 Z
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