f0160618da
- Register skill tool as 'skill' instead of 'skill_tool' - Change parameter name from 'skill_name' to 'name' - Update XML output to include name attribute: <skill_content name="..."> - Update test_tool_skill.sh and test_skill_filter.sh to reflect new names
72 lines
2.0 KiB
Bash
72 lines
2.0 KiB
Bash
#!/bin/bash
|
|
# test_tool_skill.sh - Validates the skill tool
|
|
|
|
# Create test skill directories
|
|
mkdir -p skills
|
|
mkdir -p .skills
|
|
|
|
# Create a test skill
|
|
cat > skills/SKILL.md << 'SKILL'
|
|
---
|
|
name: test-skill
|
|
description: A test skill
|
|
---
|
|
|
|
# Test Skill Content
|
|
This is the skill content.
|
|
SKILL
|
|
|
|
# Create an extra file in the skill directory
|
|
echo "Some other content" > skills/other_file.txt
|
|
|
|
# Mock response: ask for skill
|
|
tool_call skill '{"name":"test-skill"}' >> mock_responses.txt
|
|
be_done 'Done' >> mock_responses.txt
|
|
|
|
OUTPUT=$("${DRHARNESS}" -F chat.json -n -m "Use skill" -t skill -d < "mock_responses.txt" 2>/dev/null)
|
|
|
|
if [ "${OUTPUT}" != "Done" ]; then
|
|
echo "FAIL: Expected 'Done', got '${OUTPUT}'"
|
|
exit 1
|
|
fi
|
|
|
|
RESULT=$(dr_result chat.json 2)
|
|
|
|
# Check for XML structure
|
|
if ! echo "$RESULT" | grep -q '<skill_content name="test-skill">'; then
|
|
echo "FAIL: Missing <skill_content name="test-skill"> in output"
|
|
exit 1
|
|
fi
|
|
if ! echo "$RESULT" | grep -q "</skill_content>"; then
|
|
echo "FAIL: Missing </skill_content> in output"
|
|
exit 1
|
|
fi
|
|
if ! echo "$RESULT" | grep -q "<skill_files>"; then
|
|
echo "FAIL: Missing <skill_files> in output"
|
|
exit 1
|
|
fi
|
|
if ! echo "$RESULT" | grep -q "</skill_files>"; then
|
|
echo "FAIL: Missing </skill_files> in output"
|
|
exit 1
|
|
fi
|
|
if ! echo "$RESULT" | grep -q "This is the skill content"; then
|
|
exit 1
|
|
fi
|
|
|
|
# Check for absolute file paths in <skill_files>
|
|
if ! echo "$RESULT" | grep -q "/skills/other_file.txt"; then
|
|
echo "FAIL: Expected absolute path in <skill_files>"
|
|
exit 1
|
|
fi
|
|
|
|
# Verify that the tool description includes the skill names
|
|
# The tool description is sent to the LLM as part of the tools array.
|
|
# We can verify it by checking the first message in the chat history if it contains the system prompt,
|
|
# or by checking the tool execution result which confirms the skill is loaded.
|
|
if ! echo "$RESULT" | grep -q "This is the skill content"; then
|
|
echo "FAIL: Expected skill content in result"
|
|
exit 1
|
|
fi
|
|
|
|
echo "PASS: tool_skill"
|