aboutsummaryrefslogtreecommitdiffstats
path: root/test_llamachat.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-25 18:28:47 +0200
committerDanilo M. <danix@danix.xyz>2026-08-25 18:28:47 +0200
commit3bbd3b6e95ee06b8d4171196ee4e4cfb6f43ba9e (patch)
tree3cd6012bfd73d22fb8a96a61cba78bb38d2e1d21 /test_llamachat.py
parent63786ca2f15c051ca9d77d98d329b64813f1276a (diff)
downloadllamachat-3bbd3b6e95ee06b8d4171196ee4e4cfb6f43ba9e.tar.gz
llamachat-3bbd3b6e95ee06b8d4171196ee4e4cfb6f43ba9e.zip
feat: inject loaded skills into the system prompt and load from text
Diffstat (limited to 'test_llamachat.py')
-rwxr-xr-xtest_llamachat.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test_llamachat.py b/test_llamachat.py
index ebb90ce..85e69a6 100755
--- a/test_llamachat.py
+++ b/test_llamachat.py
@@ -3160,6 +3160,8 @@ def test_date_note():
class _Win:
cfg = _Cfg()
system_prompt_text = staticmethod(lambda: "Be terse.")
+ skills = None
+ loaded_skills = []
_system_messages = ui.ChatWindow._system_messages
msgs = _Win._system_messages(_Win())
@@ -3684,6 +3686,34 @@ def test_skills_column_migration():
print("ok skills column migration")
+def test_skill_parts():
+ from llamachat import skills
+ from llamachat.ui import _skill_parts, _skills_list
+
+ with tempfile.TemporaryDirectory() as tmp:
+ root = Path(tmp)
+ _write_skills(root, {"finance-cli/SKILL.md": SKILLS_SAMPLE["finance-cli/SKILL.md"]})
+ store = skills.SkillStore(root)
+
+ parts = _skill_parts(store, ["finance-cli"])
+ assert len(parts) == 1, parts
+ 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", "finance-cli"])
+ assert parts2 == [
+ "[skill: finance-cli]\n# finance-cli\nRun `finance auth test` first."
+ ]
+
+ assert _skills_list('["a", "b"]') == ["a", "b"]
+ assert _skills_list("") == []
+ assert _skills_list("not json") == []
+ assert _skills_list("[1, 2]") == []
+ print("ok skill parts")
+
+
if __name__ == "__main__":
test_presets()
test_real_presets()
@@ -3756,4 +3786,5 @@ if __name__ == "__main__":
test_skill_tool_message()
test_skills_db()
test_skills_column_migration()
+ test_skill_parts()
print("\nall checks passed")