Install
openclaw skills install c-supportC Language Support Library for OpenClaw skills. Provides AST parsing, CMake analysis, Unity test generation, and security rule checking for C projects.
openclaw skills install c-supportC语言支持库,为OpenClaw技能提供C代码分析能力。
Version: 1.0
Features: AST解析、CMake分析、Unity测试生成、安全规则库
这个库为其他技能(code-review, security, tdd等)提供共享的C语言基础设施:
from lib.c_parser import CParser, analyze_project
from lib.cmake_parser import CMakeParser, analyze_cmake_project
from lib.unity_templates import UnityTestGenerator
from lib.c_security_rules import CSecurityChecker
# Parse C file
parser = CParser()
info = parser.parse_file("src/main.c")
print(f"Found {len(info.functions)} functions")
# Analyze CMake project
cmake_info = analyze_cmake_project(".")
print(f"Targets: {[t.name for t in cmake_info.targets]}")
# Check security
checker = CSecurityChecker()
issues = checker.check_file("src/main.c")
print(f"Found {len(issues)} security issues")
# Generate Unity tests
generator = UnityTestGenerator()
test_code = generator.generate_test_file(info.functions, "myheader.h")
C代码解析,提取:
CMake分析,提取:
Unity测试框架支持:
安全漏洞检测:
# Install dependencies
pip install tree-sitter tree-sitter-c pycparser
# Or use the requirements.txt
pip install -r requirements.txt
cd skills/c-support
python -m pytest tests/
其他技能可以通过以下方式使用:
import sys
sys.path.insert(0, '/path/to/skills/c-support/lib')
from c_parser import CParser
from cmake_parser import CMakeParser
# ... etc
MIT License