#include "SkillsPanel.hpp" namespace tp::taskboard { using namespace ui; namespace { constexpr const char* kSkillFile = "SKILL.md"; std::string skillTemplate(const std::string& name) { return "---\nname: " + name + "\ndescription: >-\n One-line summary of what this skill does and when an agent should load it.\n---\n\n# " + name + "\n\n## Required secrets\n\nList the secret keys this skill needs (names only); fetch each value at run time with get_secret.\n\n## Instructions\n\n"; } } SkillsPanel::SkillsPanel(std::string skillsDirectory, FileSystem& files) : DocumentFolderPanel(std::move(skillsDirectory), "Skills", files) { setDebugName("skills panel"); } bool SkillsPanel::createSkill(const std::string& name) { const bool valid = !name.empty() && name.find('/') == std::string::npos && name.find('\\') == std::string::npos && name.front() != '.'; if (!valid) return false; const std::string folder = joinPath(rootDirectory(), name); if (mFiles.exists(folder)) return false; if (!createDirectories(mFiles, folder) || !mFiles.writeText(joinPath(folder, kSkillFile), skillTemplate(name))) return false; refresh(); openDocument(joinPath(folder, kSkillFile)); return true; } }