40 lines
1.3 KiB
Bash
Executable File
40 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
# 探索 Cursor CLI stream-json 輸出格式
|
|
|
|
echo "=== Testing Cursor CLI stream-json output ==="
|
|
echo ""
|
|
|
|
# 檢查 agent 是否可用
|
|
if ! command -v agent &> /dev/null; then
|
|
echo "ERROR: agent command not found"
|
|
echo "Please install Cursor CLI: curl https://cursor.com/install -fsS | bash"
|
|
exit 1
|
|
fi
|
|
|
|
echo "--- agent --version ---"
|
|
agent --version 2>&1 || echo "(version check failed)"
|
|
|
|
echo ""
|
|
echo "--- Simple prompt with stream-json ---"
|
|
echo 'Running: agent -p "say hello in one word" --output-format stream-json --trust'
|
|
agent -p "say hello in one word" --output-format stream-json --trust 2>&1 | head -30
|
|
|
|
echo ""
|
|
echo "--- With model flag ---"
|
|
echo 'Running: agent -p "say hello" --model "claude-sonnet-4-20250514" --output-format stream-json --trust'
|
|
agent -p "say hello" --model "claude-sonnet-4-20250514" --output-format stream-json --trust 2>&1 | head -30
|
|
|
|
echo ""
|
|
echo "--- With stream-partial-output ---"
|
|
echo 'Running: agent -p "say hello" --output-format stream-json --stream-partial-output --trust'
|
|
agent -p "say hello" --output-format stream-json --stream-partial-output --trust 2>&1 | head -30
|
|
|
|
echo ""
|
|
echo "--- Available output formats (from help) ---"
|
|
agent --help 2>&1 | grep -A2 "output-format"
|
|
|
|
echo ""
|
|
echo "--- Available models ---"
|
|
echo 'Running: agent models'
|
|
agent models 2>&1 | head -20
|