(a: z.infer<typeof S3Args>)
| 31 | isReadOnly = false; isDestructive = true; argsSchema = S3Args; |
| 32 | |
| 33 | async execute(a: z.infer<typeof S3Args>): Promise<ToolResult> { |
| 34 | const mode = a.mode ?? 'sync'; |
| 35 | const args = ['s3', mode, a.source, a.dest]; |
| 36 | if (a.dryrun) args.push('--dryrun'); |
| 37 | if (mode === 'sync' && a.delete) args.push('--delete'); |
| 38 | if (mode === 'cp' && a.recursive) args.push('--recursive'); |
| 39 | |
| 40 | const r = await runProcess('aws', args, { timeoutMs: (a.timeout_seconds ?? 600) * 1000 }); |
| 41 | if (r.notFound) return { content: notInstalledMessage('aws', 'Install the AWS CLI v2 from https://aws.amazon.com/cli/ and run `aws configure`.'), isError: true }; |
| 42 | if (r.timedOut) return { content: 'aws s3 timed out — for large transfers use background_job_start with a shell aws command.', isError: true }; |
| 43 | const out = [r.stdout.trim(), r.stderr.trim()].filter(Boolean).join('\n'); |
| 44 | if (!r.ok) return { content: out || 'aws s3 failed', isError: true }; |
| 45 | return { content: `${a.dryrun ? '(dry run) ' : ''}✓ ${mode} ${a.source} → ${a.dest}\n${out}`.trim() }; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // ---- ci_status ---- |
nothing calls this directly
no test coverage detected