summaryrefslogtreecommitdiff
path: root/packages/cli/src/tools/ls.tool.ts
diff options
context:
space:
mode:
authorTaylor Mullen <[email protected]>2025-04-18 18:08:43 -0400
committerN. Taylor Mullen <[email protected]>2025-04-18 18:10:57 -0400
commit383b9177848eeefb8c123a7a7ecc0ee391380eea (patch)
tree4b1e06d5e74500ad81a61f9442581648063f86c0 /packages/cli/src/tools/ls.tool.ts
parentfa264e42863474a809d06ef569f7ad5388d48072 (diff)
Run `npm run format`
- This has the entirety of the changes. Part of https://b.corp.google.com/issues/411720532
Diffstat (limited to 'packages/cli/src/tools/ls.tool.ts')
-rw-r--r--packages/cli/src/tools/ls.tool.ts23
1 files changed, 16 insertions, 7 deletions
diff --git a/packages/cli/src/tools/ls.tool.ts b/packages/cli/src/tools/ls.tool.ts
index d2f6a3c7..4b015fa5 100644
--- a/packages/cli/src/tools/ls.tool.ts
+++ b/packages/cli/src/tools/ls.tool.ts
@@ -116,8 +116,12 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
* @returns An error message string if invalid, null otherwise
*/
validateToolParams(params: LSToolParams): string | null {
- if (this.schema.parameters &&
- !SchemaValidator.validate(this.schema.parameters as Record<string, unknown>, params)
+ if (
+ this.schema.parameters &&
+ !SchemaValidator.validate(
+ this.schema.parameters as Record<string, unknown>,
+ params,
+ )
) {
return 'Parameters failed schema validation.';
}
@@ -181,7 +185,8 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
if (validationError) {
return this.errorResult(
`Error: Invalid parameters provided. Reason: ${validationError}`,
- `Failed to execute tool.`);
+ `Failed to execute tool.`,
+ );
}
try {
@@ -189,12 +194,14 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
if (!stats) {
return this.errorResult(
`Directory does not exist: ${params.path}`,
- `Directory does not exist.`);
+ `Directory does not exist.`,
+ );
}
if (!stats.isDirectory()) {
return this.errorResult(
`Path is not a directory: ${params.path}`,
- `Path is not a directory.`);
+ `Path is not a directory.`,
+ );
}
const files = fs.readdirSync(params.path);
@@ -202,7 +209,8 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
if (files.length === 0) {
return this.errorResult(
`Directory is empty: ${params.path}`,
- `Directory is empty.`);
+ `Directory is empty.`,
+ );
}
for (const file of files) {
@@ -249,7 +257,8 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
} catch (error) {
return this.errorResult(
`Error listing directory: ${error instanceof Error ? error.message : String(error)}`,
- 'Failed to list directory.');
+ 'Failed to list directory.',
+ );
}
}
}