leash-integration-filesystem 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1a3cc6c1633289e78a59b95f69d0a92945b8cd7dcdce37a360eaaf06c406af5d
4
+ data.tar.gz: 2f2c380565f76ca832015f88ee036a470b314af71ff39ec2b3573271f42b3c4f
5
+ SHA512:
6
+ metadata.gz: c9c99989e4bfa10bae1440e03a77ffb3157fecd268ca794fdfe3b4657fbd1cb9338f963b4f7ed912caa11e6c68db89672cc3c1280e4b2984dd6e159e682cfed4
7
+ data.tar.gz: e1f0dbc38b933261c5692152fc6c62f756ef71040910b33e5d0a859ac6c5d64140fdc47ff999f9b7109240b839b297a9e836099b1d1b6fd0d0de2024721fab02
@@ -0,0 +1,191 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated by leash-codegen — do not edit manually
4
+
5
+ module Leash
6
+ module Integration
7
+ class FilesystemClient
8
+ # Create a new Filesystem integration client.
9
+ #
10
+ # @param leash [Leash::Client] the Leash SDK client
11
+ def initialize(leash)
12
+ @leash = leash
13
+ end
14
+
15
+ # Read the complete contents of a file as text. DEPRECATED: Use read_text_file instead.
16
+ #
17
+ # @param path [String]
18
+ # @param tail [Float, nil] If provided, returns only the last N lines of the file
19
+ # @param head [Float, nil] If provided, returns only the first N lines of the file
20
+ # @return [Object]
21
+ def read_file(path, tail: nil, head: nil)
22
+ params = {
23
+ 'path' => path,
24
+ 'tail' => tail,
25
+ 'head' => head
26
+ }.compact
27
+ @leash.call('filesystem', 'read_file', params)
28
+ end
29
+
30
+ # Read the complete contents of a file from the file system as text. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to exa...
31
+ #
32
+ # @param path [String]
33
+ # @param tail [Float, nil] If provided, returns only the last N lines of the file
34
+ # @param head [Float, nil] If provided, returns only the first N lines of the file
35
+ # @return [Object]
36
+ def read_text_file(path, tail: nil, head: nil)
37
+ params = {
38
+ 'path' => path,
39
+ 'tail' => tail,
40
+ 'head' => head
41
+ }.compact
42
+ @leash.call('filesystem', 'read_text_file', params)
43
+ end
44
+
45
+ # Read an image or audio file. Returns the base64 encoded data and MIME type. Only works within allowed directories.
46
+ #
47
+ # @param path [String]
48
+ # @return [Object]
49
+ def read_media_file(path)
50
+ params = {
51
+ 'path' => path
52
+ }.compact
53
+ @leash.call('filesystem', 'read_media_file', params)
54
+ end
55
+
56
+ # Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its...
57
+ #
58
+ # @param paths [Array] Array of file paths to read. Each path must be a string pointing to a valid file within allowed directories.
59
+ # @return [Object]
60
+ def read_multiple_files(paths)
61
+ params = {
62
+ 'paths' => paths
63
+ }.compact
64
+ @leash.call('filesystem', 'read_multiple_files', params)
65
+ end
66
+
67
+ # Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only wo...
68
+ #
69
+ # @param path [String]
70
+ # @param content [String]
71
+ # @return [Object]
72
+ def write_file(path, content)
73
+ params = {
74
+ 'path' => path,
75
+ 'content' => content
76
+ }.compact
77
+ @leash.call('filesystem', 'write_file', params)
78
+ end
79
+
80
+ # Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.
81
+ #
82
+ # @param path [String]
83
+ # @param edits [Array]
84
+ # @param dryrun [Boolean, nil] Preview changes using git-style diff format
85
+ # @return [Object]
86
+ def edit_file(path, edits, dryrun: nil)
87
+ params = {
88
+ 'path' => path,
89
+ 'edits' => edits,
90
+ 'dryRun' => dryrun
91
+ }.compact
92
+ @leash.call('filesystem', 'edit_file', params)
93
+ end
94
+
95
+ # Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for sett...
96
+ #
97
+ # @param path [String]
98
+ # @return [Object]
99
+ def create_directory(path)
100
+ params = {
101
+ 'path' => path
102
+ }.compact
103
+ @leash.call('filesystem', 'create_directory', params)
104
+ end
105
+
106
+ # Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for underst...
107
+ #
108
+ # @param path [String]
109
+ # @return [Object]
110
+ def list_directory(path)
111
+ params = {
112
+ 'path' => path
113
+ }.compact
114
+ @leash.call('filesystem', 'list_directory', params)
115
+ end
116
+
117
+ # Get a detailed listing of all files and directories in a specified path, including sizes. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is usef...
118
+ #
119
+ # @param path [String]
120
+ # @param sortby [String, nil] Sort entries by name or size
121
+ # @return [Object]
122
+ def list_directory_with_sizes(path, sortby: nil)
123
+ params = {
124
+ 'path' => path,
125
+ 'sortBy' => sortby
126
+ }.compact
127
+ @leash.call('filesystem', 'list_directory_with_sizes', params)
128
+ end
129
+
130
+ # Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while dire...
131
+ #
132
+ # @param path [String]
133
+ # @param excludepatterns [Array, nil]
134
+ # @return [Object]
135
+ def directory_tree(path, excludepatterns: nil)
136
+ params = {
137
+ 'path' => path,
138
+ 'excludePatterns' => excludepatterns
139
+ }.compact
140
+ @leash.call('filesystem', 'directory_tree', params)
141
+ end
142
+
143
+ # Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directorie...
144
+ #
145
+ # @param source [String]
146
+ # @param destination [String]
147
+ # @return [Object]
148
+ def move_file(source, destination)
149
+ params = {
150
+ 'source' => source,
151
+ 'destination' => destination
152
+ }.compact
153
+ @leash.call('filesystem', 'move_file', params)
154
+ end
155
+
156
+ # Recursively search for files and directories matching a pattern. The patterns should be glob-style patterns that match paths relative to the working directory. Use pattern like '*.ext' to match fil...
157
+ #
158
+ # @param path [String]
159
+ # @param pattern [String]
160
+ # @param excludepatterns [Array, nil]
161
+ # @return [Object]
162
+ def search_files(path, pattern, excludepatterns: nil)
163
+ params = {
164
+ 'path' => path,
165
+ 'pattern' => pattern,
166
+ 'excludePatterns' => excludepatterns
167
+ }.compact
168
+ @leash.call('filesystem', 'search_files', params)
169
+ end
170
+
171
+ # Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understand...
172
+ #
173
+ # @param path [String]
174
+ # @return [Object]
175
+ def get_file_info(path)
176
+ params = {
177
+ 'path' => path
178
+ }.compact
179
+ @leash.call('filesystem', 'get_file_info', params)
180
+ end
181
+
182
+ # Returns the list of directories that this server is allowed to access. Subdirectories within these allowed directories are also accessible. Use this to understand which directories and their nested...
183
+ #
184
+ # @return [Object]
185
+ def list_allowed_directories
186
+ params = {}
187
+ @leash.call('filesystem', 'list_allowed_directories', params)
188
+ end
189
+ end
190
+ end
191
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leash-integration-filesystem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Leash
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-04-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: leash-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.0
27
+ description: Auto-generated typed client for the Filesystem integration on Leash.
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/leash/integration/filesystem.rb
34
+ homepage: https://github.com/leash-build/leash-codegen
35
+ licenses:
36
+ - Apache-2.0
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.7.0
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubygems_version: 3.0.3.1
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Typed Filesystem integration for Leash
57
+ test_files: []