@workskills/getskill 1.2.0 → 2.1.0
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/EXAMPLES.md +98 -72
- package/README.md +167 -200
- package/dist/lib/config.d.ts +81 -4
- package/dist/lib/config.js +473 -21
- package/dist/lib/skill-manager.d.ts +7 -4
- package/dist/lib/skill-manager.js +55 -118
- package/dist/lib/state.d.ts +11 -0
- package/dist/lib/state.js +126 -14
- package/dist/lib/system.d.ts +0 -6
- package/dist/lib/system.js +0 -159
- package/dist/lib/types.d.ts +14 -28
- package/dist/main.d.ts +9 -5
- package/dist/main.js +280 -89
- package/package.json +9 -4
- package/dist/lib/skill-validator.d.ts +0 -4
- package/dist/lib/skill-validator.js +0 -107
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workskills/getskill",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"description": "A skill management CLI for any AI agent (Claude Code, OpenClaw, Codex, Cursor, or a custom skills directory) that searches, installs, and updates skill files from the getskill.work registry",
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
7
7
|
"bin": {
|
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/work-skills/getskill#readme",
|
|
34
34
|
"keywords": [
|
|
35
|
+
"agent",
|
|
36
|
+
"agents",
|
|
37
|
+
"agent-skills",
|
|
35
38
|
"openclaw",
|
|
36
39
|
"workskills",
|
|
37
40
|
"skill",
|
|
@@ -39,9 +42,11 @@
|
|
|
39
42
|
"search",
|
|
40
43
|
"install",
|
|
41
44
|
"update",
|
|
42
|
-
"git",
|
|
43
45
|
"cli",
|
|
44
46
|
"claude",
|
|
47
|
+
"claude-code",
|
|
48
|
+
"codex",
|
|
49
|
+
"cursor",
|
|
45
50
|
"ai",
|
|
46
51
|
"automation"
|
|
47
52
|
],
|
|
@@ -51,7 +56,7 @@
|
|
|
51
56
|
},
|
|
52
57
|
"license": "MIT",
|
|
53
58
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
59
|
+
"node": ">=18.0.0"
|
|
55
60
|
},
|
|
56
61
|
"os": [
|
|
57
62
|
"darwin",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SkillValidationResult } from './types';
|
|
2
|
-
export declare function sanitizeRepositoryName(input: string): string;
|
|
3
|
-
export declare function validateSkillMarkdownContent(content: string): SkillValidationResult;
|
|
4
|
-
export declare function validateSkillDirectory(skillPath: string): SkillValidationResult;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sanitizeRepositoryName = sanitizeRepositoryName;
|
|
7
|
-
exports.validateSkillMarkdownContent = validateSkillMarkdownContent;
|
|
8
|
-
exports.validateSkillDirectory = validateSkillDirectory;
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const REQUIRED_FRONTMATTER_KEYS = [
|
|
12
|
-
'name',
|
|
13
|
-
'description',
|
|
14
|
-
'license',
|
|
15
|
-
'compatibility'
|
|
16
|
-
];
|
|
17
|
-
const REQUIRED_METADATA_KEYS = ['author', 'version', 'category'];
|
|
18
|
-
const REQUIRED_SECTIONS = ['## 何时使用此 Skill', '## 指令'];
|
|
19
|
-
function cleanYamlValue(value) {
|
|
20
|
-
if (!value) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
return value.trim().replace(/^['"]|['"]$/g, '');
|
|
24
|
-
}
|
|
25
|
-
function extractFrontMatter(content) {
|
|
26
|
-
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
27
|
-
if (!match) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
frontMatter: match[1],
|
|
32
|
-
body: match[2]
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function readTopLevelValue(frontMatter, key) {
|
|
36
|
-
const match = frontMatter.match(new RegExp(`^${key}:\\s*(.+)$`, 'm'));
|
|
37
|
-
return cleanYamlValue(match?.[1]);
|
|
38
|
-
}
|
|
39
|
-
function readMetadataValue(frontMatter, key) {
|
|
40
|
-
const match = frontMatter.match(new RegExp(`^\\s+${key}:\\s*(.+)$`, 'm'));
|
|
41
|
-
return cleanYamlValue(match?.[1]);
|
|
42
|
-
}
|
|
43
|
-
function sanitizeRepositoryName(input) {
|
|
44
|
-
return input
|
|
45
|
-
.trim()
|
|
46
|
-
.replace(/\.git$/i, '')
|
|
47
|
-
.replace(/[^a-zA-Z0-9._-]+/g, '-')
|
|
48
|
-
.replace(/-{2,}/g, '-')
|
|
49
|
-
.replace(/^-+|-+$/g, '')
|
|
50
|
-
.toLowerCase();
|
|
51
|
-
}
|
|
52
|
-
function validateSkillMarkdownContent(content) {
|
|
53
|
-
const errors = [];
|
|
54
|
-
const metadata = {};
|
|
55
|
-
const parsed = extractFrontMatter(content);
|
|
56
|
-
if (!parsed) {
|
|
57
|
-
return {
|
|
58
|
-
valid: false,
|
|
59
|
-
errors: ['SKILL.md 必须包含 YAML front matter(使用 --- 包裹)'],
|
|
60
|
-
metadata
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
for (const key of REQUIRED_FRONTMATTER_KEYS) {
|
|
64
|
-
const value = readTopLevelValue(parsed.frontMatter, key);
|
|
65
|
-
if (!value) {
|
|
66
|
-
errors.push(`front matter 缺少必填字段: ${key}`);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
metadata[key] = value;
|
|
70
|
-
}
|
|
71
|
-
if (!/^metadata:\s*$/m.test(parsed.frontMatter)) {
|
|
72
|
-
errors.push('front matter 缺少 metadata 区块');
|
|
73
|
-
}
|
|
74
|
-
for (const key of REQUIRED_METADATA_KEYS) {
|
|
75
|
-
const value = readMetadataValue(parsed.frontMatter, key);
|
|
76
|
-
if (!value) {
|
|
77
|
-
errors.push(`metadata 缺少必填字段: ${key}`);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
metadata[key] = value;
|
|
81
|
-
}
|
|
82
|
-
if (!/^#\s+.+$/m.test(parsed.body)) {
|
|
83
|
-
errors.push('正文缺少一级标题(例如 # My Skill)');
|
|
84
|
-
}
|
|
85
|
-
for (const section of REQUIRED_SECTIONS) {
|
|
86
|
-
if (!parsed.body.includes(section)) {
|
|
87
|
-
errors.push(`正文缺少必填章节: ${section}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
valid: errors.length === 0,
|
|
92
|
-
errors,
|
|
93
|
-
metadata
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function validateSkillDirectory(skillPath) {
|
|
97
|
-
const skillFilePath = path_1.default.join(skillPath, 'SKILL.md');
|
|
98
|
-
if (!fs_1.default.existsSync(skillFilePath)) {
|
|
99
|
-
return {
|
|
100
|
-
valid: false,
|
|
101
|
-
errors: ['publish 目录中缺少 SKILL.md'],
|
|
102
|
-
metadata: {}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
const content = fs_1.default.readFileSync(skillFilePath, 'utf8');
|
|
106
|
-
return validateSkillMarkdownContent(content);
|
|
107
|
-
}
|