omniai-tools 0.7.0 → 0.8.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: cc6ea7c9ceed0c7ea84e3dbd8870e649d3c9890cc776663ca81134e5bd40b5da
4
- data.tar.gz: c619e234101b74e420a44a4536565fac17ce9f36a00205875fc89aa7e79df415
3
+ metadata.gz: 5cc5add2c5d444b00147bf86ef80aab2680259169056e0d95dd7be2774e0288e
4
+ data.tar.gz: df22289d9b5d7ac3b4ec931e81adfecba9321f940872ebab0c14db15afc2b94a
5
5
  SHA512:
6
- metadata.gz: 249c297b5d8ee3e69c24e6fa2e594b02766ebd6862f95a52a4491b114d17d5494f06efe98ca602921d76be2937a7e7c57d1864ba323016d50927d58c7cf74b0e
7
- data.tar.gz: 2d0583047e63b56ca62dbc9f6073b12fa5513dc769a770effb5f534f2e485d2c40cbcc4fd52ec9bd19639b9f087f140bbbf1a88e0fb73c4dc69752a944d922c0
6
+ metadata.gz: 014db86e451df68380745099a5137811f7e7775491130835ded603a9fc2c66a56a9b77632347e152bc9c8b260db4f3124979f35f3a43b951f9f6b7c4bd8643d2
7
+ data.tar.gz: 6285ac35f23218d82c8b883d4f4660e730a0555e27b523b08acfea67c6f59987926f0afe4b977901ec4142c4243157ac512712df7782fd42564987d3da6582b1
@@ -63,12 +63,24 @@ module OmniAI
63
63
  * `#{Action::FILE_REPLACE}`
64
64
  TEXT
65
65
 
66
- paramter :to, :string, description: <<~TEXT
66
+ parameter :to, :string, description: <<~TEXT
67
67
  A file or directory path that is required for the following actions:
68
68
  * `#{Action::DIRECTORY_MOVE}`
69
69
  * `#{Action::FILE_MOVE}`
70
70
  TEXT
71
71
 
72
+ parameter :text, :string, description: <<~TEXT
73
+ The text to be written to a file for the `#{Action::FILE_WRITE}` action.
74
+ TEXT
75
+
76
+ parameter :old_text, :string, description: <<~TEXT
77
+ The old text to be replaced in a file for the `#{Action::FILE_REPLACE}` action.
78
+ TEXT
79
+
80
+ parameter :new_text, :string, description: <<~TEXT
81
+ The new text to replace in a few file for the `#{Action::FILE_REPLACE}` action.
82
+ TEXT
83
+
72
84
  # @param driver [Computer::Driver]
73
85
  def initialize(logger: Logger.new(IO::NULL))
74
86
  @logger = logger
@@ -78,7 +90,9 @@ module OmniAI
78
90
  # @param action [String]
79
91
  # @param path [String]
80
92
  # @param to [String]
81
- def execute(action:, path: nil, to: nil)
93
+ # @param old_text [String]
94
+ # @param new_text [String]
95
+ def execute(action:, path: nil, to: nil, old_text: nil, new_text: nil)
82
96
  @logger.info({
83
97
  action:,
84
98
  path:,
@@ -94,8 +108,8 @@ module OmniAI
94
108
  when Action::FILE_DELETE then Disk::FileDeleteTool.new(logger: @logger).execute(path:)
95
109
  when Action::FILE_MOVE then Disk::FileMoveTool.new(logger: @logger).execute(path:, to:)
96
110
  when Action::FILE_READ then Disk::FileReadTool.new(logger: @logger).execute(path:)
97
- when Action::FILE_WRITE then Disk::FileWriteTool.new(logger: @logger).execute(path:)
98
- when Action::FILE_REPLACE then Disk::FileReplaceTool.new(logger: @logger).execute(path:)
111
+ when Action::FILE_WRITE then Disk::FileWriteTool.new(logger: @logger).execute(path:, text:)
112
+ when Action::FILE_REPLACE then Disk::FileReplaceTool.new(logger: @logger).execute(old_text:, new_text:, path:)
99
113
  end
100
114
  end
101
115
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAI
4
4
  module Tools
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre