diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-25 18:25:40 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-25 18:25:40 +0200 |
| commit | 63786ca2f15c051ca9d77d98d329b64813f1276a (patch) | |
| tree | 78a1cbe9a294584e4f5b1ec9d3e7f72baa2c1b03 | |
| parent | 3e61d483675c486ebbf3ade30562b1ca94f4bb46 (diff) | |
| download | llamachat-63786ca2f15c051ca9d77d98d329b64813f1276a.tar.gz llamachat-63786ca2f15c051ca9d77d98d329b64813f1276a.zip | |
docs: generic skill names in plan test fixtures
| -rw-r--r-- | docs/superpowers/plans/2026-08-25-skills.md | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/docs/superpowers/plans/2026-08-25-skills.md b/docs/superpowers/plans/2026-08-25-skills.md index 3ad154d..79553f1 100644 --- a/docs/superpowers/plans/2026-08-25-skills.md +++ b/docs/superpowers/plans/2026-08-25-skills.md @@ -92,18 +92,18 @@ Append these functions to `test_llamachat.py` (near the other skill tests will b ```python SKILLS_SAMPLE = { - "firefly-cli/SKILL.md": ( + "finance-cli/SKILL.md": ( "---\n" - "name: firefly-cli\n" - "description: Operate a Firefly III instance from the command line.\n" + "name: finance-cli\n" + "description: Operate a finance CLI from the command line.\n" "---\n" "\n" - "# firefly-cli\n" - "Run `firefly auth test` first.\n" + "# finance-cli\n" + "Run `finance auth test` first.\n" ), - "test-build-slackbuild/SKILL.md": ( + "build-helper/SKILL.md": ( "---\n" - "name: test-build-slackbuild\n" + "name: build-helper\n" "description: Drive the sbo-dockerbuild test-build tool.\n" "---\n" "\n" @@ -133,14 +133,14 @@ def test_skills_store(): store = skills.SkillStore(root) assert store.names() == [ - "firefly-cli", "no-frontmatter", "test-build-slackbuild" + "finance-cli", "no-frontmatter", "build-helper" ] - skill = store.load("firefly-cli") + skill = store.load("finance-cli") assert skill is not None - assert skill.name == "firefly-cli" - assert skill.description == "Operate a Firefly III instance from the command line." - assert skill.text.startswith("# firefly-cli") + assert skill.name == "finance-cli" + assert skill.description == "Operate a finance CLI from the command line." + assert skill.text.startswith("# finance-cli") # A name that does not exist, and an absent directory, both yield None. assert store.load("nope") is None @@ -151,11 +151,11 @@ def test_skills_store(): assert function["name"] == "load_skill" assert function["parameters"]["required"] == ["name"] assert function["parameters"]["properties"]["name"]["enum"] == store.names() - assert "firefly-cli" in function["description"] + assert "finance-cli" in function["description"] directory = store.directory() - assert "firefly-cli" in directory - assert "test-build-slackbuild" in directory + assert "finance-cli" in directory + assert "build-helper" in directory print("ok skills store") @@ -164,13 +164,13 @@ def test_skills_mentions(): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) - _write_skills(root, {"firefly-cli/SKILL.md": SKILLS_SAMPLE["firefly-cli/SKILL.md"]}) + _write_skills(root, {"finance-cli/SKILL.md": SKILLS_SAMPLE["finance-cli/SKILL.md"]}) store = skills.SkillStore(root) - assert store.match_mentions("use firefly-cli for this") == ["firefly-cli"] - assert store.match_mentions("USE FIREFLY-CLI now") == ["firefly-cli"] + assert store.match_mentions("use finance-cli for this") == ["finance-cli"] + assert store.match_mentions("USE FINANCE-CLI now") == ["finance-cli"] # No word boundary, no mention: a substring must not load a skill. - assert store.match_mentions("firefly-cli2 rocks") == [] + assert store.match_mentions("finance-cli2 rocks") == [] assert store.match_mentions("the fireflies are out") == [] assert store.match_mentions("nothing here") == [] print("ok skills mentions") @@ -179,11 +179,11 @@ def test_skills_mentions(): def test_skills_parse_commands(): from llamachat import skills - known = {"firefly-cli", "handoff"} + known = {"finance-cli", "handoff"} text, loaded = skills.parse_commands( - "/firefly-cli fix my budget /unknown stays", known + "/finance-cli fix my budget /unknown stays", known ) - assert loaded == ["firefly-cli"] + assert loaded == ["finance-cli"] assert text == "fix my budget /unknown stays" text, loaded = skills.parse_commands("no commands here", known) @@ -205,11 +205,11 @@ def test_skills_parse_commands(): def test_skill_tool_message(): from llamachat import skills - skill = skills.Skill(name="firefly-cli", description="d", text="body text") + skill = skills.Skill(name="finance-cli", description="d", text="body text") msg = skills.tool_message("call_1", skill) assert msg["role"] == "tool" assert msg["tool_call_id"] == "call_1" - assert "[skill: firefly-cli]" in msg["content"] + assert "[skill: finance-cli]" in msg["content"] assert "body text" in msg["content"] err = skills.tool_message("call_1", None, error="No such skill") @@ -218,7 +218,7 @@ def test_skill_tool_message(): last = skills.tool_message("call_1", skill, last=True) assert skills.NO_MORE_TOOLS in last["content"] - assert skills.parse_name('{"name": "firefly-cli"}') == "firefly-cli" + assert skills.parse_name('{"name": "finance-cli"}') == "finance-cli" assert skills.parse_name("not json") == "" assert skills.parse_name('{"query": "x"}') == "" assert skills.parse_name("") == "" @@ -459,9 +459,9 @@ git commit -m "feat: skill store parsing for SKILL.md instruction files" def test_skills_config(): with tempfile.TemporaryDirectory() as tmp: skills_dir = Path(tmp) / "skills" - (skills_dir / "firefly-cli").mkdir(parents=True) - (skills_dir / "firefly-cli" / "SKILL.md").write_text( - "---\nname: firefly-cli\ndescription: d\n---\n\nbody\n" + (skills_dir / "finance-cli").mkdir(parents=True) + (skills_dir / "finance-cli" / "SKILL.md").write_text( + "---\nname: finance-cli\ndescription: d\n---\n\nbody\n" ) path = Path(tmp) / "config.toml" path.write_text(f'skills_enabled = true\nskills_dir = "{skills_dir}"\n') @@ -567,9 +567,9 @@ def test_skills_db(): with tempfile.TemporaryDirectory() as tmp: history = db.History(Path(tmp) / "history.db") sid = history.create_session("chat", "m") - history.set_skills(sid, ["firefly-cli", "handoff"]) + history.set_skills(sid, ["finance-cli", "handoff"]) session = history.get_session(sid) - assert json.loads(session["skills"]) == ["firefly-cli", "handoff"] + assert json.loads(session["skills"]) == ["finance-cli", "handoff"] history.set_skills(sid, []) assert json.loads(history.get_session(sid)["skills"]) == [] @@ -598,8 +598,8 @@ def test_skills_column_migration(): history = db.History(path) sid = history.create_session("chat", "m") - history.set_skills(sid, ["firefly-cli"]) - assert json.loads(history.get_session(sid)["skills"]) == ["firefly-cli"] + history.set_skills(sid, ["finance-cli"]) + assert json.loads(history.get_session(sid)["skills"]) == ["finance-cli"] print("ok skills column migration") ``` @@ -663,7 +663,7 @@ git commit -m "feat: persist loaded skills per session" - [ ] **Step 1: Write the failing tests** ```python -def _skill_round(name: str = "firefly-cli"): +def _skill_round(name: str = "finance-cli"): """One streamed round that asks to load a skill.""" return [ ( @@ -690,7 +690,7 @@ def test_skill_tool_round(): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) - _write_skills(root, {"firefly-cli/SKILL.md": SKILLS_SAMPLE["firefly-cli/SKILL.md"]}) + _write_skills(root, {"finance-cli/SKILL.md": SKILLS_SAMPLE["finance-cli/SKILL.md"]}) store = skills.SkillStore(root) client = backend.Client("http://x") @@ -712,7 +712,7 @@ def test_skill_tool_round(): )) # The load is reported and the answer flows through. - assert ("skill_loaded", "firefly-cli") in out, out + assert ("skill_loaded", "finance-cli") in out, out assert ("content", "answered") in out, out # The offered schema is the load_skill one; the final round has none. @@ -728,8 +728,8 @@ def test_skill_tool_round(): assert assistant["tool_calls"][0]["function"]["name"] == "load_skill" tool_msg = next(m for m in second if m["role"] == "tool") assert tool_msg["tool_call_id"] == "call_2" - assert "run `firefly auth test` first" in tool_msg["content"].lower() - assert "[skill: firefly-cli]" in tool_msg["content"] + assert "run `finance auth test` first" in tool_msg["content"].lower() + assert "[skill: finance-cli]" in tool_msg["content"] print("ok skill tool round") @@ -738,13 +738,13 @@ def test_skill_tool_errors(): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) - _write_skills(root, {"firefly-cli/SKILL.md": SKILLS_SAMPLE["firefly-cli/SKILL.md"]}) + _write_skills(root, {"finance-cli/SKILL.md": SKILLS_SAMPLE["finance-cli/SKILL.md"]}) store = skills.SkillStore(root) client = backend.Client("http://x") cfg = backend.SkillsConfig(enabled=True, store=store, max_searches=1) # Unknown skill name -> error tool message, no skill_loaded yield. - rounds = [_skill_round("vault-librarian"), [("content", "done")]] + rounds = [_skill_round("notes-keeper"), [("content", "done")]] seen = [] def scripted(model, messages, tools): @@ -758,7 +758,7 @@ def test_skill_tool_errors(): assert ("content", "done") in out, out assert not any(k == "skill_loaded" for k, _ in out), out tool_msg = next(m for m in seen[1] if m["role"] == "tool") - assert "No such skill: vault-librarian" in tool_msg["content"] + assert "No such skill: notes-keeper" in tool_msg["content"] # Malformed arguments are answered rather than left dangling. bad = {"id": "call_9", "name": "load_skill", "arguments": "{not json"} @@ -797,7 +797,7 @@ def test_skill_round_cap(): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) - _write_skills(root, {"firefly-cli/SKILL.md": SKILLS_SAMPLE["firefly-cli/SKILL.md"]}) + _write_skills(root, {"finance-cli/SKILL.md": SKILLS_SAMPLE["finance-cli/SKILL.md"]}) store = skills.SkillStore(root) client = backend.Client("http://x") @@ -1039,18 +1039,18 @@ def test_skill_parts(): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) - _write_skills(root, {"firefly-cli/SKILL.md": SKILLS_SAMPLE["firefly-cli/SKILL.md"]}) + _write_skills(root, {"finance-cli/SKILL.md": SKILLS_SAMPLE["finance-cli/SKILL.md"]}) store = skills.SkillStore(root) - parts = _skill_parts(store, ["firefly-cli"]) + parts = _skill_parts(store, ["finance-cli"]) assert len(parts) == 1, parts - assert "[skill: firefly-cli]" in parts[0] - assert "firefly auth test" in parts[0] + assert "[skill: finance-cli]" in parts[0] + assert "finance auth test" in parts[0] # A name that no longer exists contributes nothing, and the parts # keep load order. - parts2 = _skill_parts(store, ["gone", "firefly-cli"]) - assert parts2 == ["[skill: firefly-cli]\nRun `firefly auth test` first."] + parts2 = _skill_parts(store, ["gone", "finance-cli"]) + assert parts2 == ["[skill: finance-cli]\nRun `finance auth test` first."] assert _skills_list('["a", "b"]') == ["a", "b"] assert _skills_list("") == [] |
