test-full-functionality.shโข4.54 kB
#!/bin/bash
echo "๐ฏ Testing Full Sentinel Functionality"
echo "====================================="
# Check prerequisites
if [ ! -d "../test-game" ]; then
echo "โ Test game project not found. Run ./create-test-project.sh first"
exit 1
fi
if [ ! -f ".env" ]; then
echo "โ ๏ธ Creating .env file..."
cp .env.example .env
sed -i.bak 's|GODOT_PROJECT_ROOT=../game|GODOT_PROJECT_ROOT=../test-game|' .env
echo "โ
Updated .env with test project path"
fi
echo "1. Testing CLI compilation..."
npm run build
if [ $? -ne 0 ]; then
echo "โ Build failed"
exit 1
fi
echo "2. Testing CLI link..."
npm link
echo "โ
CLI linked globally"
echo "3. Testing project map functionality..."
echo "Getting project structure..."
node -e "
const { Context } = require('./dist/adapters/context');
const context = new Context('../test-game');
context.getProjectMap().then(map => {
console.log('๐ Scripts found:', map.scripts.length);
console.log('๐ Scenes found:', map.scenes.length);
console.log('๐ Data files found:', map.data.length);
if (map.scripts.length > 0) {
console.log('โ
Project mapping works');
} else {
console.log('โ No scripts found');
process.exit(1);
}
}).catch(err => {
console.log('โ Project mapping failed:', err.message);
process.exit(1);
});
"
echo "4. Testing context reading..."
echo "Reading context around the error..."
node -e "
const { Context } = require('./dist/adapters/context');
const context = new Context('../test-game');
context.getContext('res://scripts/combat/fighter.gd', 9, 5).then(result => {
if (result.valid_path) {
console.log('โ
Context reading works');
console.log('๐ File:', result.file);
console.log('๐ Line:', result.line);
console.log('๐ Context lines:', result.numbered_lines.length);
result.numbered_lines.forEach(line => console.log(line));
} else {
console.log('โ Could not read file context');
process.exit(1);
}
}).catch(err => {
console.log('โ Context reading failed:', err.message);
process.exit(1);
});
"
echo "5. Testing log parsing..."
echo "Parsing mock Godot error output..."
node -e "
const { ParserGodot4 } = require('./dist/adapters/parser_godot4');
const parser = new ParserGodot4();
const mockLog = \`=== Mock gdUnit4 Test Runner ===
Running tests...
Loading test scene: res://scenes/test_scene.tscn
ERROR: Invalid call. Nonexistent function 'get_damage_value' in base 'Node'.
At: res://scripts/combat/fighter.gd:9 @ _ready()
Test Results:
1 test failed
0 tests passed
=== Test Run Complete ===\`;
const error = parser.parseFirstError(mockLog);
if (error) {
console.log('โ
Error parsing works');
console.log('๐ Found error in:', error.file + ':' + error.line);
console.log('๐ Message:', error.message);
console.log('๐ Type:', error.type);
} else {
console.log('โ Failed to parse error');
process.exit(1);
}
"
echo "6. Testing moveset operations..."
echo "Reading moveset data..."
sentinel moveset list
echo ""
sentinel moveset read basic_attacks
echo "7. Testing MCP server (background)..."
timeout 10s npm start &
SERVER_PID=$!
sleep 3
echo "Testing MCP tools..."
curl -s -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{"method":"tools/list","id":"test"}' | jq '.result.tools[].name' 2>/dev/null || echo "jq not available, raw response:"
echo ""
echo "Testing context tool via MCP..."
curl -s -X POST http://localhost:8787/mcp \
-H "Content-Type: application/json" \
-d '{
"method": "get_context",
"params": {
"file": "res://scripts/combat/fighter.gd",
"line": 9,
"radius": 3
},
"id": "test"
}' | head -10
kill $SERVER_PID 2>/dev/null
echo ""
echo "8. Testing CLI commands..."
echo "Running sentinel ctx command..."
sentinel ctx res://scripts/combat/fighter.gd 9 3
echo ""
echo "๐ Full functionality test completed!"
echo ""
echo "๐ง What we've verified:"
echo " โ
TypeScript compilation and CLI linking"
echo " โ
Project structure reading"
echo " โ
File context extraction"
echo " โ
Godot error log parsing"
echo " โ
Moveset JSON operations"
echo " โ
MCP server HTTP/tool protocol"
echo " โ
CLI command execution"
echo ""
echo "๐ Ready to test with real Godot project!"
echo "๐ Next steps for full testing:"
echo " 1. Point to real Godot project: edit .env"
echo " 2. Install gdUnit4 in your project"
echo " 3. Run: sentinel test"
echo " 4. Run: sentinel fix (needs ANTHROPIC_API_KEY)"