compose 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2431419357d7c817741c34e2f795e85ef015127e0e8d3e42b1f59c726b62f8f
4
- data.tar.gz: 0e97b8ac1259e62671019195fe10425abfcfd87756a88673bf9c935eedb1f2ce
3
+ metadata.gz: d36eebaf01309fb4c0762dcbc6665e48704c47efdcc53d705a959eca780cbc2f
4
+ data.tar.gz: d109de09f9b08947aa5b17a3f67ce4e050854cc123a69d4ae95c791586e0e719
5
5
  SHA512:
6
- metadata.gz: 2aa977b296f3bb5ad630f8689727955ffcdc067254e5ffcc88491e84233f1814436bac94ab083211aa9871f0c3c334aeec982314799d9f23a4d5bb061d3367ac
7
- data.tar.gz: 71c0bbccdc9da5a9edaad609a8afbac268734203e1f2f815c481c23137649a3ac60e54e2789a2e785b40b6ea79275b4e21fd6a486752ad41f2f1663e21e9ffa8
6
+ metadata.gz: 657a0b56b8e25976c901be35c47d531947f524eef84e2696d9ebd0cdea8468b19ec1517b3eca803d49d4dac88e4a37b819695d3a8226bb323171fdeff8d38dd8
7
+ data.tar.gz: 72e63f67707c80f0287d5faab11e611e08f4910640e02be9c570738a11bfa939f4adba9c64a2ecd1cf9684c06fcdd5327f181fd1ebce40d2e1bde61ceee8c70e
@@ -22,7 +22,7 @@ Facts:
22
22
  "fromLineNumber": number;
23
23
  "toLineNumber": number;
24
24
  };
25
- "code": string; // Code to insert or replace, make sure \n and " are double escaped.
25
+ "code": string; // Code to insert or replace, make sure " are double escaped.
26
26
  }
27
27
  ```
28
28
 
data/lib/compose/cli.rb CHANGED
@@ -22,7 +22,7 @@ module Compose
22
22
  ApiKeyUtils.setup(verifier_model)
23
23
 
24
24
  file_processor = FileProcessor.new(files, include_imports: options[:include_imports], model: code_model)
25
- puts "Loaded #{file_processor.files.count} file(s)."
25
+ puts "Loaded #{file_processor.files.count} file(s): #{file_processor.files.keys.map { |path| File.exist?(path) ? Pathname.new(path).relative_path_from(Pathname.pwd).to_s : path }.join(', ')}"
26
26
 
27
27
  task = ask('What do you need me to do? (Type \'ask\' followed by your question to ask a question instead):')
28
28
 
@@ -80,7 +80,22 @@ module Compose
80
80
  private
81
81
 
82
82
  def find_files_in_directory(directory)
83
- Find.find(directory).select { |path| File.file?(path) && path =~ /\.(rb|py|js|ts)$/ }
83
+ tracked_files = `git ls-files #{directory}`.split("\n")
84
+ tracked_files.select do |path|
85
+ File.file?(path) && text_file?(path)
86
+ end
87
+ end
88
+
89
+ def text_file?(path)
90
+ return false if File.zero?(path)
91
+
92
+ bytes = File.read(path, 1024) or return false
93
+ bytes.each_byte do |byte|
94
+ return false if [0, 1, 2, 3, 4, 5, 6, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31].include?(byte)
95
+ end
96
+ true
97
+ rescue
98
+ false
84
99
  end
85
100
  end
86
101
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Compose
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dreaming Tulpa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-10 00:00:00.000000000 Z
11
+ date: 2024-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-openai