fix(skills): require manage_skills action (#5856)
Some checks are pending
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
ci / docker publish / build (amd64) (push) Waiting to run
ci / docker publish / build (arm64) (push) Waiting to run
ci / docker publish / merge manifest + tag (push) Blocked by required conditions

This commit is contained in:
adabarbulescu 2026-08-04 13:17:45 +03:00 committed by GitHub
parent 9d686180dd
commit 20e7fc0164
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 2 deletions

View file

@ -46,7 +46,9 @@ async def do_manage_skills(content: str, owner: Optional[str] = None) -> Dict:
except ValueError:
return {"error": "Invalid JSON arguments", "exit_code": 1}
action = (args.get("action") or "").lower()
action = (args.get("action") or "").strip().lower()
if not action:
return {"error": "action is required (list|view|view_ref|add|edit|patch|publish|delete|search)", "exit_code": 1}
from services.memory.skills import SkillsManager
from services.memory.skill_format import Skill, slugify
from src.constants import DATA_DIR
@ -55,7 +57,7 @@ async def do_manage_skills(content: str, owner: Optional[str] = None) -> Dict:
# Accept legacy `skill_id` as an alias for `name`.
name = (args.get("name") or args.get("skill_id") or "").strip()
if action in ("list", "index", ""):
if action in ("list", "index"):
all_skills = sm.load(owner=owner)
if not all_skills:
return {"results": "No skills yet. Create one with action='add'."}

View file

@ -0,0 +1,24 @@
import json
import pytest
from src.tools.system import do_manage_skills
@pytest.mark.asyncio
@pytest.mark.parametrize(
"payload",
[
{},
{"action": ""},
{"action": " "},
{"name": "demo", "description": "x", "procedure": ["step"]},
],
)
async def test_manage_skills_requires_action(payload):
result = await do_manage_skills(json.dumps(payload), owner="test")
assert result == {
"error": "action is required (list|view|view_ref|add|edit|patch|publish|delete|search)",
"exit_code": 1,
}