testdriver-agent
How the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
Execute shell or PowerShell commands in the sandbox
Claude Code
$ npx -y skills add testdriverai/testdriverai --skill testdriver-exec --agent claude-code
Codex
$ npx skills add testdriverai/testdriverai --skill testdriver-exec -a codex -y
Cursor
$ npx skills add testdriverai/testdriverai --skill testdriver-exec -a cursor -y
Gemini CLI
$ npx skills add testdriverai/testdriverai --skill testdriver-exec -a gemini-cli -y
GitHub Copilot
$ npx skills add testdriverai/testdriverai --skill testdriver-exec -a github-copilot -y
OpenCode
$ npx skills add testdriverai/testdriverai --skill testdriver-exec -a opencode -y
Windsurf
$ npx skills add testdriverai/testdriverai --skill testdriver-exec -a windsurf -y
name: testdriver:exec description: Execute shell or PowerShell commands in the sandbox
<!-- Generated from exec.mdx. DO NOT EDIT. -->
Run shell commands (Linux) or PowerShell commands (Windows) in the sandbox.
await testdriver.exec(language, code, timeout, silent)
<ParamField path="language" type="string" required> The language to run: `'sh'` (Shell/Linux) or `'pwsh'` (PowerShell/Windows) </ParamField>
<ParamField path="code" type="string" required> The code or the command to run </ParamField>
<ParamField path="timeout" type="number" required> The timeout in milliseconds </ParamField>
<ParamField path="silent" type="boolean" default="false"> If `true`, TestDriver does not show the output </ParamField>
`Promise<string>` - The command output
Run shell commands in the Linux sandbox.
// List files
const files = await testdriver.exec('sh', 'ls -la', 5000);
// Check current directory
const pwd = await testdriver.exec('sh', 'pwd', 5000);
// Run a script
await testdriver.exec('sh', './setup.sh', 60000);// Create a file
await testdriver.exec('sh', 'echo "Hello World" > test.txt', 5000);
// Read a file
const content = await testdriver.exec('sh', 'cat test.txt', 5000);
// Copy files
await testdriver.exec('sh', 'cp source.txt dest.txt', 5000);
// Delete files
await testdriver.exec('sh', 'rm test.txt', 5000);Execute PowerShell commands in the Windows sandbox.
// Install npm package globally
await testdriver.exec('pwsh', 'npm install -g http-server', 30000);
// Install via Chocolatey
await testdriver.exec('pwsh', 'choco install firefox -y', 60000);
// Download and run installer
await testdriver.exec('pwsh', `
Invoke-WebRequest -Uri "https://example.com/setup.exe" -OutFile "C:\\setup.exe"
Start-Process -FilePath "C:\\setup.exe" -ArgumentList "/S" -Wait
`, 120000);// Create a file
await testdriver.exec('pwsh', `
Set-Content -Path "C:\\test.txt" -Value "Hello World"
`, 5000);
// Read a file
const content = await testdriver.exec('pwsh',
'Get-Content -Path "C:\\test.txt"',
5000
);
// Copy files
await testdriver.exec('pwsh',
'Copy-Item -Path "C:\\source.txt" -Destination "C:\\dest.txt"',
5000
);
// Delete files
await testdriver.exec('pwsh',
'Remove-Item -Path "C:\\test.txt"',
5000
);
// List directory
const files = await testdriver.exec('pwsh',
'Get-ChildItem -Path "C:\\Users\\testdriver\\Documents"',
5000
);// List running processes
const processes = await testdriver.exec('pwsh', 'Get-Process', 5000);
// Start application
await testdriver.exec('pwsh', `
Start-Process "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" -ArgumentList "--start-maximized", "https://example.com"
`, 5000);
// Kill a process
await testdriver.exec('pwsh', 'Stop-Process -Name "chrome" -Force', 5000);
// Wait for process
await testdriver.exec('pwsh', 'Start-Process notepad -Wait', 30000);// Set environment variable (session)
await testdriver.exec('pwsh', '$env:MY_VAR = "value"', 5000);
// Get environment variable
const value = await testdriver.exec('pwsh', '$env:MY_VAR', 5000);
// Set persistent environment variable
await testdriver.exec('pwsh', `
[Environment]::SetEnvironmentVariable("MY_VAR", "value", "User")
`, 5000);// Test connectivity
const pingResult = await testdriver.exec('pwsh',
'Test-NetConnection google.com',
10000
);
// Download file
await testdriver.exec('pwsh', `
Invoke-WebRequest -Uri "https://example.com/file.zip" -OutFile "C:\\Downloads\\file.zip"
`, 30000);
// Check if port is open
const portOpen = await testdriver.exec('pwsh',
'Test-NetConnection -ComputerName localhost -Port 3000',
5000
);Suppress output for background operations:
// Silent installation
await testdriver.exec('pwsh', 'npm install -g some-package', 30000, true);
// Start background process
await testdriver.exec('pwsh', 'Start-Process notepad', 5000, true);
// Run setup script silently
await testdriver.exec('pwsh', '.\\setup.ps1', 60000, true);<Check> **Use appropriate timeouts**
// Quick operations: 5000ms
await testdriver.exec('sh', 'ls -la', 5000);
// Installations: 30000-60000ms
await testdriver.exec('pwsh', 'npm install -g package', 30000);
// Downloads or complex operations: 60000-120000ms
await testdriver.exec('pwsh', 'Install-Module Something', 120000);</Check>
<Check> **Handle errors gracefully**
try {
await testdriver.exec('pwsh', 'Some-Command', 5000);
} catch (error) {
console.error('Command failed:', error.message);
// Fallback or retry logic
}</Check>
<Check> **Use silent mode for background tasks**
// Silent install
await testdriver.exec('pwsh', 'npm install -g tool', 30000, true);
// Background service
await testdriver.exec('pwsh', 'Start-Service MyService', 5000, true);</Check>
<Warning> **Escape strings properly in PowerShell**
Use proper escaping for special characters:
// Use backticks for newlines
await testdriver.exec('pwsh', `
Write-Host "Line 1\`nLine 2"
`, 5000);
// Use single quotes to avoid variable expansion
await testdriver.exec('pwsh',
"Write-Host 'Text with $special chars'",
5000
);</Warning>
import { beforeAll, afterAll, describe, it } from 'vitest';
import TestDriver from 'testdriverai';
describe('Code Execution', () => {
let testdriver;
beforeAll(async () => {
client = new TestDriver(proceHow the TestDriver agent behaves on GitHub issues, pull requests, and @mentions
Deploy TestDriver on your AWS infrastructure using CloudFormation
How TestDriver learns your app and caches what it discovers for instant, deterministic replays
Produce the "Playwright 1.xx API Review" artifact for a range of commits - the public API additions and the breaking or behavior…
Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions,…
DeepEval evaluation workflow for AI agents and LLM applications. TRIGGER when the user wants to evaluate or improve an AI agent,…