Loading...
Loading...
Execute ArkTS-Sta code snippets and files via the Playground HTTP API. Use this for testing ArkTS syntax, learning ArkTS features, verifying code logic, or demonstrating code execution results.
npx skill4agent add openharmonyinsight/openharmony-skills arkts-sta-playgroundpython3 scripts/run_playground.py path/to/code.etspython3 scripts/run_playground.py --code "let x: number = 42; console.log(x);"python3 scripts/run_playground.py --json --code "console.log('Hello');"pip install -r scripts/requirements.txtrequests>=2.31.0python3 scripts/run_playground.py --code "
enum Numbers {
A = 10,
B = 2.57,
C = 0x2B7F,
D = -1.5,
E = 12
}
"for file in test/*.ets; do
python3 scripts/run_playground.py --json "$file" > "results/$(basename $file .ets).json"
donehttps://arkts-play.cn.bz-openlab.ru:10443/compilehttps://arkts-play.cn.bz-openlab.ru:10443/compile{
"code": "your ArkTS-Sta code here"
}{
"output": "execution output or empty",
"error": "error message if compilation failed, null otherwise"
}# Test connectivity
curl -X POST https://arkts-play.cn.bz-openlab.ru:10443/compile \
-H "Content-Type: application/json" \
-d '{"code":"let x: number = 42;"}'python3 scripts/run_playground.py --timeout 60 path/to/code.etspython3 scripts/run_playground.py --code "
// Test union types
let value: string | number = 'hello';
value = 42;
console.log(value);
"python3 scripts/run_playground.py --code "
function calculateSum(a: number, b: number): number {
return a + b;
}
console.log('Sum:', calculateSum(10, 20));
"# Run with JSON output for programmatic checking
python3 scripts/run_playground.py --json problem.ets
# Check exit status
if python3 scripts/run_playground.py code.ets; then
echo "Compilation successful"
else
echo "Compilation failed"
fi--json{
"success": true,
"output": "Execution result here...",
"error": null,
"has_error": false
}successoutputerrornullhas_errorpython3 scripts/run_playground.py --code "
enum Numbers {
A = 10,
B = 2.57,
C = 0x2B7F,
D = -1.5,
E = 12
}
"--json