INNER CODE UNIT · Python
check_portable_execution
uvwt/agentdock · core-skills/skill-authoring/run.py:247
def check_portable_execution(source: Path, skill_md: str) -> list[dict[str, object]]:
entry = source / "run.py"
if not entry.is_file():
return []
if re.search(r"(?:python3?|\./)\s+(?:\./)?run\.py\b", skill_md):
return []
return [{
"code": "MISSING_PORTABLE_EXECUTION",
"severity": "warning",
"file": "SKILL.md",
"line": 1,
"message": "包内存在 run.py,但 SKILL.md 没有说明从 Skill 根目录使用相对路径执行。",
"suggestion": "增加通用执行示例,例如 `python3 run.py`,并说明环境由运行宿主注入。",
}]
def lint(source_value: object) -> dict[str, object]:
if not isinstance(source_value, str) or not source_value.strip():