Add skill definitions (SKILL.md + run.py) for all agent tools
This commit is contained in:
27
skills/run_command/run.py
Normal file
27
skills/run_command/run.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import sys
|
||||
import json
|
||||
|
||||
args = json.loads(sys.stdin.read())
|
||||
command = args.get("command", "")
|
||||
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["bash", "-c", command],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120,
|
||||
)
|
||||
output = result.stdout
|
||||
if result.stderr:
|
||||
output += f"\n[stderr] {result.stderr}"
|
||||
if result.returncode != 0:
|
||||
output += f"\n[exit code: {result.returncode}]"
|
||||
if len(output) > 2000:
|
||||
output = output[:2000] + "\n[output truncated]"
|
||||
print(output.strip() or "[no output]")
|
||||
except subprocess.TimeoutExpired:
|
||||
print("[command timed out after 120s]")
|
||||
except Exception as e:
|
||||
print(f"[error: {e}]")
|
||||
Reference in New Issue
Block a user