@stacksjs/skills 0.75.515 → 0.75.519
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/skills.js +2 -2
- package/package.json +4 -4
package/dist/skills.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{existsSync,readdirSync,readFileSync,statSync}from"node:fs";import{appPath,frameworkPath,join}from"@stacksjs/path";function skillSources(){return[appPath("Skills"),frameworkPath("defaults/ai/skills")]}function resolveSkillDir(name){for(const source of skillSources()){const dir=join(source,name);if(existsSync(join(dir,"SKILL.md")))return dir}return null}function parseFrontmatter(content){const match=content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!match)return{metadata:{name:"",description:""},body:content}
|
|
2
|
-
`)){const colonIndex=line.indexOf(":");if(colonIndex===-1)continue;const key=line.slice(0,colonIndex).trim()
|
|
1
|
+
import{existsSync,readdirSync,readFileSync,statSync}from"node:fs";import{appPath,frameworkPath,join}from"@stacksjs/path";function skillSources(){return[appPath("Skills"),frameworkPath("defaults/ai/skills")]}function resolveSkillDir(name){for(const source of skillSources()){const dir=join(source,name);if(existsSync(join(dir,"SKILL.md")))return dir}return null}function parseFrontmatter(content){const match=content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);if(!match){return{metadata:{name:"",description:""},body:content}}const[,frontmatterStr,body]=match;const metadata={};for(const line of(frontmatterStr??"").split(`
|
|
2
|
+
`)){const colonIndex=line.indexOf(":");if(colonIndex===-1)continue;const key=line.slice(0,colonIndex).trim();const value=line.slice(colonIndex+1).trim();metadata[key]=value}return{metadata,body:body??""}}export function listSkills(){const names=new Set;for(const source of skillSources()){if(!existsSync(source))continue;for(const entry of readdirSync(source)){const entryPath=join(source,entry);if(statSync(entryPath).isDirectory()&&existsSync(join(entryPath,"SKILL.md")))names.add(entry)}}return[...names].sort()}export function getSkill(name){const skillDir=resolveSkillDir(name);if(!skillDir)return null;const skillPath=join(skillDir,"SKILL.md");const content=readFileSync(skillPath,"utf-8");const{metadata,body}=parseFrontmatter(content);const listDir=(dir)=>existsSync(join(skillDir,dir))?readdirSync(join(skillDir,dir)):[];return{metadata,instructions:body,path:skillPath,scripts:listDir("scripts"),references:listDir("references"),assets:listDir("assets")}}export function loadSkillMetadata(name){const skill=getSkill(name);return skill?.metadata??null}export function validateSkill(name){const errors=[];const skillDir=resolveSkillDir(name);if(!skillDir){errors.push(`Skill not found in any source: ${skillSources().map((source)=>join(source,name)).join(", ")}`);return{valid:false,errors}}const content=readFileSync(join(skillDir,"SKILL.md"),"utf-8");const{metadata}=parseFrontmatter(content);if(!metadata.name){errors.push("Missing required field: name")}else{if(metadata.name.length>64)errors.push("Name must be 1-64 characters");if(!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(metadata.name))errors.push("Name must be lowercase letters, numbers, and hyphens only");if(metadata.name!==name)errors.push(`Name "${metadata.name}" must match directory name "${name}"`)}if(!metadata.description){errors.push("Missing required field: description")}else if(metadata.description.length>1024){errors.push("Description must be 1-1024 characters")}return{valid:errors.length===0,errors}}export function bundledSkillsPath(){return frameworkPath("defaults/ai/skills")}export function projectSkillsPath(){return appPath("Skills")}export function resolveSkillPath(name){return resolveSkillDir(name)}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/skills",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.519",
|
|
6
6
|
"description": "Reads the Stacks framework's agent skills, following the agentskills.io standard. The skills themselves ship in storage/framework/defaults/ai/skills.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"prepublishOnly": "bun run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@stacksjs/path": "0.75.
|
|
62
|
-
"@stacksjs/storage": "0.75.
|
|
61
|
+
"@stacksjs/path": "0.75.519",
|
|
62
|
+
"@stacksjs/storage": "0.75.519"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"better-dx": "^0.2.24",
|
|
66
|
-
"@stacksjs/types": "0.75.
|
|
66
|
+
"@stacksjs/types": "0.75.519"
|
|
67
67
|
}
|
|
68
68
|
}
|