@skillkit/core 1.6.2 → 1.6.4
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/index.d.ts +184 -11
- package/dist/index.js +780 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65,6 +65,203 @@ var SkillkitConfig = z.object({
|
|
|
65
65
|
defaultTimeout: z.number().optional()
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
// src/agent-config.ts
|
|
69
|
+
var AGENT_CONFIG = {
|
|
70
|
+
// Claude Code - all Claude products use the same format
|
|
71
|
+
"claude-code": {
|
|
72
|
+
skillsDir: ".claude/skills",
|
|
73
|
+
configFile: "CLAUDE.md",
|
|
74
|
+
globalSkillsDir: "~/.claude/skills",
|
|
75
|
+
configFormat: "xml",
|
|
76
|
+
usesFrontmatter: true,
|
|
77
|
+
frontmatterFields: [
|
|
78
|
+
"name",
|
|
79
|
+
"description",
|
|
80
|
+
"allowed-tools",
|
|
81
|
+
"model",
|
|
82
|
+
"context",
|
|
83
|
+
"agent",
|
|
84
|
+
"disable-model-invocation",
|
|
85
|
+
"user-invocable",
|
|
86
|
+
"argument-hint"
|
|
87
|
+
],
|
|
88
|
+
supportsAutoDiscovery: true
|
|
89
|
+
},
|
|
90
|
+
// Cursor - uses MDC format in .cursor/rules/
|
|
91
|
+
cursor: {
|
|
92
|
+
skillsDir: ".cursor/skills",
|
|
93
|
+
configFile: ".cursor/rules/skills.mdc",
|
|
94
|
+
altSkillsDirs: [".cursor/commands"],
|
|
95
|
+
globalSkillsDir: "~/.cursor/skills",
|
|
96
|
+
configFormat: "mdc",
|
|
97
|
+
usesFrontmatter: true,
|
|
98
|
+
frontmatterFields: ["description", "globs", "alwaysApply"],
|
|
99
|
+
supportsAutoDiscovery: true
|
|
100
|
+
},
|
|
101
|
+
// Codex (OpenAI)
|
|
102
|
+
codex: {
|
|
103
|
+
skillsDir: ".codex/skills",
|
|
104
|
+
configFile: "AGENTS.md",
|
|
105
|
+
globalSkillsDir: "~/.codex/skills",
|
|
106
|
+
configFormat: "markdown-table",
|
|
107
|
+
usesFrontmatter: true,
|
|
108
|
+
supportsAutoDiscovery: true
|
|
109
|
+
},
|
|
110
|
+
// Gemini CLI
|
|
111
|
+
"gemini-cli": {
|
|
112
|
+
skillsDir: ".gemini/skills",
|
|
113
|
+
configFile: "GEMINI.md",
|
|
114
|
+
globalSkillsDir: "~/.gemini/skills",
|
|
115
|
+
configFormat: "json",
|
|
116
|
+
usesFrontmatter: true,
|
|
117
|
+
supportsAutoDiscovery: true
|
|
118
|
+
},
|
|
119
|
+
// OpenCode
|
|
120
|
+
opencode: {
|
|
121
|
+
skillsDir: ".opencode/skills",
|
|
122
|
+
configFile: "AGENTS.md",
|
|
123
|
+
altSkillsDirs: [".opencode/agent"],
|
|
124
|
+
globalSkillsDir: "~/.config/opencode/skills",
|
|
125
|
+
configFormat: "xml",
|
|
126
|
+
usesFrontmatter: true,
|
|
127
|
+
supportsAutoDiscovery: true
|
|
128
|
+
},
|
|
129
|
+
// Antigravity
|
|
130
|
+
antigravity: {
|
|
131
|
+
skillsDir: ".antigravity/skills",
|
|
132
|
+
configFile: "AGENTS.md",
|
|
133
|
+
configFormat: "xml",
|
|
134
|
+
usesFrontmatter: true,
|
|
135
|
+
supportsAutoDiscovery: true
|
|
136
|
+
},
|
|
137
|
+
// Amp - uses .amp/ directory
|
|
138
|
+
amp: {
|
|
139
|
+
skillsDir: ".amp/skills",
|
|
140
|
+
configFile: "AGENTS.md",
|
|
141
|
+
configFormat: "xml",
|
|
142
|
+
usesFrontmatter: true,
|
|
143
|
+
supportsAutoDiscovery: true
|
|
144
|
+
},
|
|
145
|
+
// Clawdbot
|
|
146
|
+
clawdbot: {
|
|
147
|
+
skillsDir: ".clawdbot/skills",
|
|
148
|
+
configFile: "AGENTS.md",
|
|
149
|
+
altSkillsDirs: ["skills"],
|
|
150
|
+
configFormat: "xml",
|
|
151
|
+
usesFrontmatter: true,
|
|
152
|
+
supportsAutoDiscovery: true
|
|
153
|
+
},
|
|
154
|
+
// Droid (Factory)
|
|
155
|
+
droid: {
|
|
156
|
+
skillsDir: ".factory/skills",
|
|
157
|
+
configFile: "AGENTS.md",
|
|
158
|
+
configFormat: "xml",
|
|
159
|
+
usesFrontmatter: true,
|
|
160
|
+
supportsAutoDiscovery: true
|
|
161
|
+
},
|
|
162
|
+
// GitHub Copilot
|
|
163
|
+
"github-copilot": {
|
|
164
|
+
skillsDir: ".github/skills",
|
|
165
|
+
configFile: ".github/copilot-instructions.md",
|
|
166
|
+
altSkillsDirs: [".github/instructions"],
|
|
167
|
+
configFormat: "markdown",
|
|
168
|
+
usesFrontmatter: true,
|
|
169
|
+
supportsAutoDiscovery: true
|
|
170
|
+
},
|
|
171
|
+
// Goose
|
|
172
|
+
goose: {
|
|
173
|
+
skillsDir: ".goose/skills",
|
|
174
|
+
configFile: "AGENTS.md",
|
|
175
|
+
globalSkillsDir: "~/.goose/skills",
|
|
176
|
+
configFormat: "xml",
|
|
177
|
+
usesFrontmatter: true,
|
|
178
|
+
supportsAutoDiscovery: true
|
|
179
|
+
},
|
|
180
|
+
// Kilo
|
|
181
|
+
kilo: {
|
|
182
|
+
skillsDir: ".kilocode/skills",
|
|
183
|
+
configFile: "AGENTS.md",
|
|
184
|
+
altSkillsDirs: [".kilocode/modes"],
|
|
185
|
+
globalSkillsDir: "~/.kilocode/skills",
|
|
186
|
+
configFormat: "xml",
|
|
187
|
+
usesFrontmatter: true,
|
|
188
|
+
supportsAutoDiscovery: true
|
|
189
|
+
},
|
|
190
|
+
// Kiro CLI
|
|
191
|
+
"kiro-cli": {
|
|
192
|
+
skillsDir: ".kiro/skills",
|
|
193
|
+
configFile: "AGENTS.md",
|
|
194
|
+
globalSkillsDir: "~/.kiro/skills",
|
|
195
|
+
configFormat: "xml",
|
|
196
|
+
usesFrontmatter: true,
|
|
197
|
+
supportsAutoDiscovery: true
|
|
198
|
+
},
|
|
199
|
+
// Roo Code
|
|
200
|
+
roo: {
|
|
201
|
+
skillsDir: ".roo/skills",
|
|
202
|
+
configFile: "AGENTS.md",
|
|
203
|
+
altSkillsDirs: [".roo/modes"],
|
|
204
|
+
globalSkillsDir: "~/.roo/skills",
|
|
205
|
+
configFormat: "xml",
|
|
206
|
+
usesFrontmatter: true,
|
|
207
|
+
supportsAutoDiscovery: true
|
|
208
|
+
},
|
|
209
|
+
// Trae
|
|
210
|
+
trae: {
|
|
211
|
+
skillsDir: ".trae/skills",
|
|
212
|
+
configFile: ".trae/rules/project_rules.md",
|
|
213
|
+
altSkillsDirs: [".trae/agent"],
|
|
214
|
+
configFormat: "markdown",
|
|
215
|
+
usesFrontmatter: true,
|
|
216
|
+
supportsAutoDiscovery: true
|
|
217
|
+
},
|
|
218
|
+
// Windsurf
|
|
219
|
+
windsurf: {
|
|
220
|
+
skillsDir: ".windsurf/skills",
|
|
221
|
+
configFile: ".windsurf/rules/skills.md",
|
|
222
|
+
altSkillsDirs: [".windsurf/workflows"],
|
|
223
|
+
globalSkillsDir: "~/.codeium/windsurf/skills",
|
|
224
|
+
configFormat: "markdown",
|
|
225
|
+
usesFrontmatter: true,
|
|
226
|
+
supportsAutoDiscovery: true
|
|
227
|
+
},
|
|
228
|
+
// Universal - works with any agent
|
|
229
|
+
universal: {
|
|
230
|
+
skillsDir: "skills",
|
|
231
|
+
configFile: "AGENTS.md",
|
|
232
|
+
altSkillsDirs: [".agent/skills", ".agents/skills"],
|
|
233
|
+
configFormat: "xml",
|
|
234
|
+
usesFrontmatter: true,
|
|
235
|
+
supportsAutoDiscovery: true
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
function getAgentDirectoryConfig(agent) {
|
|
239
|
+
return AGENT_CONFIG[agent];
|
|
240
|
+
}
|
|
241
|
+
function getSkillsDir(agent) {
|
|
242
|
+
return AGENT_CONFIG[agent].skillsDir;
|
|
243
|
+
}
|
|
244
|
+
function getConfigFile(agent) {
|
|
245
|
+
return AGENT_CONFIG[agent].configFile;
|
|
246
|
+
}
|
|
247
|
+
function getAllSkillsDirs(agent) {
|
|
248
|
+
const config = AGENT_CONFIG[agent];
|
|
249
|
+
const dirs = [config.skillsDir];
|
|
250
|
+
if (config.altSkillsDirs) {
|
|
251
|
+
dirs.push(...config.altSkillsDirs);
|
|
252
|
+
}
|
|
253
|
+
return dirs;
|
|
254
|
+
}
|
|
255
|
+
function getGlobalSkillsDir(agent) {
|
|
256
|
+
return AGENT_CONFIG[agent].globalSkillsDir;
|
|
257
|
+
}
|
|
258
|
+
function supportsAutoDiscovery(agent) {
|
|
259
|
+
return AGENT_CONFIG[agent].supportsAutoDiscovery;
|
|
260
|
+
}
|
|
261
|
+
function getConfigFormat(agent) {
|
|
262
|
+
return AGENT_CONFIG[agent].configFormat;
|
|
263
|
+
}
|
|
264
|
+
|
|
68
265
|
// src/skills.ts
|
|
69
266
|
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
70
267
|
import { join, basename } from "path";
|
|
@@ -324,8 +521,8 @@ function validateSkill(skillPath) {
|
|
|
324
521
|
return { valid: errors.length === 0, errors, warnings };
|
|
325
522
|
}
|
|
326
523
|
function isPathInside(child, parent) {
|
|
327
|
-
const
|
|
328
|
-
return !
|
|
524
|
+
const relative4 = child.replace(parent, "");
|
|
525
|
+
return !relative4.startsWith("..") && !relative4.includes("/..");
|
|
329
526
|
}
|
|
330
527
|
|
|
331
528
|
// src/config.ts
|
|
@@ -2770,25 +2967,6 @@ function initContext(projectPath, options) {
|
|
|
2770
2967
|
// src/context/sync.ts
|
|
2771
2968
|
import { existsSync as existsSync10, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, copyFileSync, readdirSync as readdirSync3 } from "fs";
|
|
2772
2969
|
import { join as join9 } from "path";
|
|
2773
|
-
var AGENT_DIRS = {
|
|
2774
|
-
"claude-code": { skillsDir: ".claude/skills", configFile: "AGENTS.md" },
|
|
2775
|
-
"cursor": { skillsDir: ".cursor/skills", configFile: ".cursorrules" },
|
|
2776
|
-
"codex": { skillsDir: ".codex/skills", configFile: "AGENTS.md" },
|
|
2777
|
-
"gemini-cli": { skillsDir: ".gemini/skills", configFile: "GEMINI.md" },
|
|
2778
|
-
"opencode": { skillsDir: ".opencode/skills", configFile: "AGENTS.md" },
|
|
2779
|
-
"antigravity": { skillsDir: ".antigravity/skills", configFile: "AGENTS.md" },
|
|
2780
|
-
"amp": { skillsDir: ".agents/skills", configFile: "AGENTS.md" },
|
|
2781
|
-
"clawdbot": { skillsDir: "skills", configFile: "AGENTS.md" },
|
|
2782
|
-
"droid": { skillsDir: ".factory/skills", configFile: "AGENTS.md" },
|
|
2783
|
-
"github-copilot": { skillsDir: ".github/skills", configFile: "AGENTS.md" },
|
|
2784
|
-
"goose": { skillsDir: ".goose/skills", configFile: "AGENTS.md" },
|
|
2785
|
-
"kilo": { skillsDir: ".kilocode/skills", configFile: "AGENTS.md" },
|
|
2786
|
-
"kiro-cli": { skillsDir: ".kiro/skills", configFile: "AGENTS.md" },
|
|
2787
|
-
"roo": { skillsDir: ".roo/skills", configFile: "AGENTS.md" },
|
|
2788
|
-
"trae": { skillsDir: ".trae/skills", configFile: "AGENTS.md" },
|
|
2789
|
-
"windsurf": { skillsDir: ".windsurf/skills", configFile: "AGENTS.md" },
|
|
2790
|
-
"universal": { skillsDir: ".agent/skills", configFile: "AGENTS.md" }
|
|
2791
|
-
};
|
|
2792
2970
|
var ContextSync = class {
|
|
2793
2971
|
projectPath;
|
|
2794
2972
|
contextManager;
|
|
@@ -2801,7 +2979,7 @@ var ContextSync = class {
|
|
|
2801
2979
|
*/
|
|
2802
2980
|
detectAgents() {
|
|
2803
2981
|
const detected = [];
|
|
2804
|
-
for (const [agent, config] of Object.entries(
|
|
2982
|
+
for (const [agent, config] of Object.entries(AGENT_CONFIG)) {
|
|
2805
2983
|
const skillsPath = join9(this.projectPath, config.skillsDir);
|
|
2806
2984
|
const configPath = join9(this.projectPath, config.configFile);
|
|
2807
2985
|
if (existsSync10(skillsPath) || existsSync10(configPath)) {
|
|
@@ -2870,7 +3048,7 @@ var ContextSync = class {
|
|
|
2870
3048
|
files: []
|
|
2871
3049
|
};
|
|
2872
3050
|
const sourceSkills = skills || this.getSourceSkills();
|
|
2873
|
-
const agentConfig =
|
|
3051
|
+
const agentConfig = AGENT_CONFIG[agent];
|
|
2874
3052
|
if (!agentConfig) {
|
|
2875
3053
|
result.success = false;
|
|
2876
3054
|
result.errors.push(`Unknown agent: ${agent}`);
|
|
@@ -2961,8 +3139,8 @@ var ContextSync = class {
|
|
|
2961
3139
|
const context = this.contextManager.get();
|
|
2962
3140
|
const primaryAgent = context?.agents?.primary;
|
|
2963
3141
|
const searchDirs = [];
|
|
2964
|
-
if (primaryAgent &&
|
|
2965
|
-
searchDirs.push(join9(this.projectPath,
|
|
3142
|
+
if (primaryAgent && AGENT_CONFIG[primaryAgent]) {
|
|
3143
|
+
searchDirs.push(join9(this.projectPath, AGENT_CONFIG[primaryAgent].skillsDir));
|
|
2966
3144
|
}
|
|
2967
3145
|
const commonDirs = [
|
|
2968
3146
|
".claude/skills",
|
|
@@ -2984,7 +3162,7 @@ var ContextSync = class {
|
|
|
2984
3162
|
*/
|
|
2985
3163
|
checkStatus() {
|
|
2986
3164
|
const status = {};
|
|
2987
|
-
for (const [agent, config] of Object.entries(
|
|
3165
|
+
for (const [agent, config] of Object.entries(AGENT_CONFIG)) {
|
|
2988
3166
|
const skillsPath = join9(this.projectPath, config.skillsDir);
|
|
2989
3167
|
const skills = [];
|
|
2990
3168
|
if (existsSync10(skillsPath)) {
|
|
@@ -3913,8 +4091,8 @@ async function buildSkillIndex(repos = KNOWN_SKILL_REPOS, onProgress) {
|
|
|
3913
4091
|
onProgress?.("No skills fetched, using sample index...");
|
|
3914
4092
|
allSkills.push(...getSampleSkills());
|
|
3915
4093
|
sources.push({
|
|
3916
|
-
name: "
|
|
3917
|
-
url: "https://github.com/skillkit
|
|
4094
|
+
name: "built-in",
|
|
4095
|
+
url: "https://github.com/rohitg00/skillkit",
|
|
3918
4096
|
lastFetched: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3919
4097
|
skillCount: allSkills.length
|
|
3920
4098
|
});
|
|
@@ -3960,7 +4138,7 @@ function getSampleSkills() {
|
|
|
3960
4138
|
{
|
|
3961
4139
|
name: "react-best-practices",
|
|
3962
4140
|
description: "Modern React patterns including Server Components, hooks best practices, and performance optimization",
|
|
3963
|
-
source: "
|
|
4141
|
+
source: "built-in",
|
|
3964
4142
|
tags: ["react", "frontend", "typescript", "nextjs", "performance"],
|
|
3965
4143
|
compatibility: {
|
|
3966
4144
|
frameworks: ["react", "nextjs"],
|
|
@@ -3975,7 +4153,7 @@ function getSampleSkills() {
|
|
|
3975
4153
|
{
|
|
3976
4154
|
name: "tailwind-patterns",
|
|
3977
4155
|
description: "Tailwind CSS utility patterns, responsive design, and component styling best practices",
|
|
3978
|
-
source: "
|
|
4156
|
+
source: "built-in",
|
|
3979
4157
|
tags: ["tailwind", "css", "styling", "frontend", "responsive"],
|
|
3980
4158
|
compatibility: {
|
|
3981
4159
|
frameworks: [],
|
|
@@ -3990,7 +4168,7 @@ function getSampleSkills() {
|
|
|
3990
4168
|
{
|
|
3991
4169
|
name: "typescript-strict-patterns",
|
|
3992
4170
|
description: "TypeScript strict mode patterns, type safety, and advanced type utilities",
|
|
3993
|
-
source: "
|
|
4171
|
+
source: "built-in",
|
|
3994
4172
|
tags: ["typescript", "types", "safety", "patterns"],
|
|
3995
4173
|
compatibility: {
|
|
3996
4174
|
frameworks: [],
|
|
@@ -4005,7 +4183,7 @@ function getSampleSkills() {
|
|
|
4005
4183
|
{
|
|
4006
4184
|
name: "security-best-practices",
|
|
4007
4185
|
description: "Security patterns for web applications including XSS prevention, CSRF, and secure headers",
|
|
4008
|
-
source: "
|
|
4186
|
+
source: "built-in",
|
|
4009
4187
|
tags: ["security", "xss", "csrf", "headers", "owasp"],
|
|
4010
4188
|
compatibility: {
|
|
4011
4189
|
frameworks: [],
|
|
@@ -4020,7 +4198,7 @@ function getSampleSkills() {
|
|
|
4020
4198
|
{
|
|
4021
4199
|
name: "testing-patterns",
|
|
4022
4200
|
description: "Testing patterns with Vitest/Jest including mocking, assertions, and test organization",
|
|
4023
|
-
source: "
|
|
4201
|
+
source: "built-in",
|
|
4024
4202
|
tags: ["vitest", "jest", "testing", "typescript", "mocking", "tdd"],
|
|
4025
4203
|
compatibility: {
|
|
4026
4204
|
frameworks: [],
|
|
@@ -4914,7 +5092,7 @@ var SkillExecutionEngine = class {
|
|
|
4914
5092
|
const startTime = /* @__PURE__ */ new Date();
|
|
4915
5093
|
const taskId = task.id || randomUUID6();
|
|
4916
5094
|
try {
|
|
4917
|
-
await new Promise((
|
|
5095
|
+
await new Promise((resolve4) => setTimeout(resolve4, 100));
|
|
4918
5096
|
const endTime = /* @__PURE__ */ new Date();
|
|
4919
5097
|
return {
|
|
4920
5098
|
taskId,
|
|
@@ -5251,7 +5429,7 @@ async function executeWithAgent(agentType, prompt, options = {}) {
|
|
|
5251
5429
|
});
|
|
5252
5430
|
}
|
|
5253
5431
|
async function executeCommand(command, args, options = {}) {
|
|
5254
|
-
return new Promise((
|
|
5432
|
+
return new Promise((resolve4) => {
|
|
5255
5433
|
const startTime = Date.now();
|
|
5256
5434
|
let stdout = "";
|
|
5257
5435
|
let stderr = "";
|
|
@@ -5274,7 +5452,7 @@ async function executeCommand(command, args, options = {}) {
|
|
|
5274
5452
|
});
|
|
5275
5453
|
child.on("error", (error) => {
|
|
5276
5454
|
if (timeoutId) clearTimeout(timeoutId);
|
|
5277
|
-
|
|
5455
|
+
resolve4({
|
|
5278
5456
|
success: false,
|
|
5279
5457
|
output: stdout,
|
|
5280
5458
|
error: error.message,
|
|
@@ -5284,7 +5462,7 @@ async function executeCommand(command, args, options = {}) {
|
|
|
5284
5462
|
});
|
|
5285
5463
|
child.on("close", (code) => {
|
|
5286
5464
|
if (timeoutId) clearTimeout(timeoutId);
|
|
5287
|
-
|
|
5465
|
+
resolve4({
|
|
5288
5466
|
success: code === 0 && !timedOut,
|
|
5289
5467
|
output: stdout,
|
|
5290
5468
|
error: timedOut ? "Execution timed out" : stderr || void 0,
|
|
@@ -5479,7 +5657,7 @@ function createSimulatedSkillExecutor(options = {}) {
|
|
|
5479
5657
|
const { delay = 100, shouldFail, onExecute } = options;
|
|
5480
5658
|
return async (skillName, _config) => {
|
|
5481
5659
|
onExecute?.(skillName);
|
|
5482
|
-
await new Promise((
|
|
5660
|
+
await new Promise((resolve4) => setTimeout(resolve4, delay));
|
|
5483
5661
|
const failed = shouldFail?.(skillName) ?? false;
|
|
5484
5662
|
return {
|
|
5485
5663
|
success: !failed,
|
|
@@ -5928,12 +6106,12 @@ function assertEnvVarSet(assertion, startTime) {
|
|
|
5928
6106
|
};
|
|
5929
6107
|
}
|
|
5930
6108
|
async function checkPortAvailable(port) {
|
|
5931
|
-
return new Promise((
|
|
6109
|
+
return new Promise((resolve4) => {
|
|
5932
6110
|
const server = createServer();
|
|
5933
|
-
server.once("error", () =>
|
|
6111
|
+
server.once("error", () => resolve4(false));
|
|
5934
6112
|
server.once("listening", () => {
|
|
5935
6113
|
server.close();
|
|
5936
|
-
|
|
6114
|
+
resolve4(true);
|
|
5937
6115
|
});
|
|
5938
6116
|
server.listen(port, "127.0.0.1");
|
|
5939
6117
|
});
|
|
@@ -6455,9 +6633,9 @@ var MarketplaceAggregator = class {
|
|
|
6455
6633
|
const context = readme.slice(contextStart, contextEnd);
|
|
6456
6634
|
const descMatch = context.match(/[-*]\s*\[.*?\]\(.*?\)\s*[-:]\s*(.+?)(?:\n|$)/);
|
|
6457
6635
|
const description = descMatch ? descMatch[1].trim() : "";
|
|
6458
|
-
const
|
|
6459
|
-
const normalizedPath =
|
|
6460
|
-
const rawUrl =
|
|
6636
|
+
const isAbsolute3 = this.isAbsoluteUrl(path2);
|
|
6637
|
+
const normalizedPath = isAbsolute3 ? path2 : path2.startsWith("/") ? path2 : `/${path2}`;
|
|
6638
|
+
const rawUrl = isAbsolute3 ? this.toRawUrl(path2) : `https://raw.githubusercontent.com/${source.owner}/${source.repo}/${branch}/${path2}`;
|
|
6461
6639
|
skills.push({
|
|
6462
6640
|
id: `${source.owner}/${source.repo}/${path2}`,
|
|
6463
6641
|
name,
|
|
@@ -14332,8 +14510,8 @@ var PlanExecutor = class {
|
|
|
14332
14510
|
pause() {
|
|
14333
14511
|
if (!this.isPaused) {
|
|
14334
14512
|
this.isPaused = true;
|
|
14335
|
-
this.resumePromise = new Promise((
|
|
14336
|
-
this.resumeResolve =
|
|
14513
|
+
this.resumePromise = new Promise((resolve4) => {
|
|
14514
|
+
this.resumeResolve = resolve4;
|
|
14337
14515
|
});
|
|
14338
14516
|
this.emit("plan:paused", {});
|
|
14339
14517
|
}
|
|
@@ -15865,21 +16043,21 @@ var AgentMetadata = z5.object({
|
|
|
15865
16043
|
});
|
|
15866
16044
|
var AGENT_DISCOVERY_PATHS = {
|
|
15867
16045
|
"claude-code": [".claude/agents"],
|
|
15868
|
-
"cursor": [".cursor/agents"],
|
|
16046
|
+
"cursor": [".cursor/agents", ".cursor/commands"],
|
|
15869
16047
|
"codex": [".codex/agents"],
|
|
15870
16048
|
"gemini-cli": [".gemini/agents"],
|
|
15871
|
-
"opencode": [".opencode/agents"],
|
|
16049
|
+
"opencode": [".opencode/agents", ".opencode/agent"],
|
|
15872
16050
|
"antigravity": [".antigravity/agents"],
|
|
15873
16051
|
"amp": [".amp/agents"],
|
|
15874
16052
|
"clawdbot": [".clawdbot/agents", "agents"],
|
|
15875
16053
|
"droid": [".factory/agents"],
|
|
15876
|
-
"github-copilot": [".github/agents", ".github/
|
|
16054
|
+
"github-copilot": [".github/agents", ".github/instructions", ".github/custom-agents"],
|
|
15877
16055
|
"goose": [".goose/agents"],
|
|
15878
|
-
"kilo": [".kilocode/agents"],
|
|
16056
|
+
"kilo": [".kilocode/agents", ".kilocode/modes"],
|
|
15879
16057
|
"kiro-cli": [".kiro/agents"],
|
|
15880
|
-
"roo": [".roo/agents"],
|
|
15881
|
-
"trae": [".trae/agents"],
|
|
15882
|
-
"windsurf": [".windsurf/agents"],
|
|
16058
|
+
"roo": [".roo/agents", ".roo/modes"],
|
|
16059
|
+
"trae": [".trae/agents", ".trae/agent"],
|
|
16060
|
+
"windsurf": [".windsurf/agents", ".windsurf/workflows"],
|
|
15883
16061
|
"universal": ["agents", ".agents"]
|
|
15884
16062
|
};
|
|
15885
16063
|
var ALL_AGENT_DISCOVERY_PATHS = [
|
|
@@ -15887,21 +16065,28 @@ var ALL_AGENT_DISCOVERY_PATHS = [
|
|
|
15887
16065
|
".agents",
|
|
15888
16066
|
".claude/agents",
|
|
15889
16067
|
".cursor/agents",
|
|
16068
|
+
".cursor/commands",
|
|
15890
16069
|
".codex/agents",
|
|
15891
16070
|
".gemini/agents",
|
|
15892
16071
|
".opencode/agents",
|
|
16072
|
+
".opencode/agent",
|
|
15893
16073
|
".antigravity/agents",
|
|
15894
16074
|
".amp/agents",
|
|
15895
16075
|
".clawdbot/agents",
|
|
15896
16076
|
".factory/agents",
|
|
15897
16077
|
".github/agents",
|
|
15898
|
-
".github/
|
|
16078
|
+
".github/instructions",
|
|
16079
|
+
".github/custom-agents",
|
|
15899
16080
|
".goose/agents",
|
|
15900
16081
|
".kilocode/agents",
|
|
16082
|
+
".kilocode/modes",
|
|
15901
16083
|
".kiro/agents",
|
|
15902
16084
|
".roo/agents",
|
|
16085
|
+
".roo/modes",
|
|
15903
16086
|
".trae/agents",
|
|
15904
|
-
".
|
|
16087
|
+
".trae/agent",
|
|
16088
|
+
".windsurf/agents",
|
|
16089
|
+
".windsurf/workflows"
|
|
15905
16090
|
];
|
|
15906
16091
|
var CUSTOM_AGENT_FORMAT_MAP = {
|
|
15907
16092
|
"claude-code": "claude-agent",
|
|
@@ -16368,6 +16553,81 @@ function getAgentStats(searchDirs) {
|
|
|
16368
16553
|
disabled: allAgents.filter((a) => !a.enabled).length
|
|
16369
16554
|
};
|
|
16370
16555
|
}
|
|
16556
|
+
function discoverAgentsRecursive(rootDir, location = "project") {
|
|
16557
|
+
const agents = [];
|
|
16558
|
+
const seen = /* @__PURE__ */ new Set();
|
|
16559
|
+
if (!existsSync31(rootDir)) {
|
|
16560
|
+
return agents;
|
|
16561
|
+
}
|
|
16562
|
+
function scanDirectory(dir) {
|
|
16563
|
+
try {
|
|
16564
|
+
const entries = readdirSync9(dir, { withFileTypes: true });
|
|
16565
|
+
for (const entry of entries) {
|
|
16566
|
+
const entryPath = join31(dir, entry.name);
|
|
16567
|
+
if (entry.isFile() && extname3(entry.name) === ".md") {
|
|
16568
|
+
const agent = parseAgentFile(entryPath, location);
|
|
16569
|
+
if (agent && !seen.has(agent.name)) {
|
|
16570
|
+
seen.add(agent.name);
|
|
16571
|
+
agents.push(agent);
|
|
16572
|
+
}
|
|
16573
|
+
} else if (entry.isDirectory()) {
|
|
16574
|
+
if (entry.name.startsWith(".") && !entry.name.startsWith(".claude") && !entry.name.startsWith(".cursor") && !entry.name.startsWith(".codex")) {
|
|
16575
|
+
continue;
|
|
16576
|
+
}
|
|
16577
|
+
const agent = parseAgentDir(entryPath, location);
|
|
16578
|
+
if (agent && !seen.has(agent.name)) {
|
|
16579
|
+
seen.add(agent.name);
|
|
16580
|
+
agents.push(agent);
|
|
16581
|
+
} else {
|
|
16582
|
+
scanDirectory(entryPath);
|
|
16583
|
+
}
|
|
16584
|
+
}
|
|
16585
|
+
}
|
|
16586
|
+
} catch {
|
|
16587
|
+
}
|
|
16588
|
+
}
|
|
16589
|
+
scanDirectory(rootDir);
|
|
16590
|
+
return agents;
|
|
16591
|
+
}
|
|
16592
|
+
function discoverAgentsFromPath(sourcePath, recursive = false, location = "project") {
|
|
16593
|
+
if (!existsSync31(sourcePath)) {
|
|
16594
|
+
return [];
|
|
16595
|
+
}
|
|
16596
|
+
const stats = statSync8(sourcePath);
|
|
16597
|
+
if (stats.isFile()) {
|
|
16598
|
+
if (extname3(sourcePath) === ".md") {
|
|
16599
|
+
const agent = parseAgentFile(sourcePath, location);
|
|
16600
|
+
return agent ? [agent] : [];
|
|
16601
|
+
}
|
|
16602
|
+
return [];
|
|
16603
|
+
}
|
|
16604
|
+
if (stats.isDirectory()) {
|
|
16605
|
+
if (recursive) {
|
|
16606
|
+
return discoverAgentsRecursive(sourcePath, location);
|
|
16607
|
+
}
|
|
16608
|
+
const agent = parseAgentDir(sourcePath, location);
|
|
16609
|
+
if (agent) {
|
|
16610
|
+
return [agent];
|
|
16611
|
+
}
|
|
16612
|
+
const agents = [];
|
|
16613
|
+
try {
|
|
16614
|
+
const entries = readdirSync9(sourcePath, { withFileTypes: true });
|
|
16615
|
+
for (const entry of entries) {
|
|
16616
|
+
const entryPath = join31(sourcePath, entry.name);
|
|
16617
|
+
if (entry.isFile() && extname3(entry.name) === ".md") {
|
|
16618
|
+
const a = parseAgentFile(entryPath, location);
|
|
16619
|
+
if (a) agents.push(a);
|
|
16620
|
+
} else if (entry.isDirectory()) {
|
|
16621
|
+
const a = parseAgentDir(entryPath, location);
|
|
16622
|
+
if (a) agents.push(a);
|
|
16623
|
+
}
|
|
16624
|
+
}
|
|
16625
|
+
} catch {
|
|
16626
|
+
}
|
|
16627
|
+
return agents;
|
|
16628
|
+
}
|
|
16629
|
+
return [];
|
|
16630
|
+
}
|
|
16371
16631
|
|
|
16372
16632
|
// src/agents/translator.ts
|
|
16373
16633
|
import { join as join32 } from "path";
|
|
@@ -16626,10 +16886,457 @@ function isAgentCompatible(sourceFormat, targetFormat) {
|
|
|
16626
16886
|
}
|
|
16627
16887
|
return { compatible: true, warnings };
|
|
16628
16888
|
}
|
|
16889
|
+
|
|
16890
|
+
// src/skill-translator.ts
|
|
16891
|
+
import { readFileSync as readFileSync24, existsSync as existsSync32, writeFileSync as writeFileSync17, mkdirSync as mkdirSync18 } from "fs";
|
|
16892
|
+
import { join as join33, basename as basename11, dirname as dirname11, resolve as resolve3, relative as relative3, isAbsolute as isAbsolute2 } from "path";
|
|
16893
|
+
import { parse as parseYaml11, stringify as stringifyYaml8 } from "yaml";
|
|
16894
|
+
var AGENT_SKILL_FORMATS = Object.fromEntries(
|
|
16895
|
+
Object.entries(AGENT_CONFIG).map(([agent, config]) => [
|
|
16896
|
+
agent,
|
|
16897
|
+
{ ...config, invokeCommand: "skillkit read" }
|
|
16898
|
+
])
|
|
16899
|
+
);
|
|
16900
|
+
function parseSkillToCanonical(skillPath, sourceAgent) {
|
|
16901
|
+
const skillMdPath = skillPath.endsWith("SKILL.md") ? skillPath : join33(skillPath, "SKILL.md");
|
|
16902
|
+
if (!existsSync32(skillMdPath)) {
|
|
16903
|
+
return null;
|
|
16904
|
+
}
|
|
16905
|
+
try {
|
|
16906
|
+
const content = readFileSync24(skillMdPath, "utf-8");
|
|
16907
|
+
return parseSkillContentToCanonical(content, skillPath, sourceAgent);
|
|
16908
|
+
} catch {
|
|
16909
|
+
return null;
|
|
16910
|
+
}
|
|
16911
|
+
}
|
|
16912
|
+
function parseSkillContentToCanonical(content, sourcePath, sourceAgent) {
|
|
16913
|
+
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
16914
|
+
let frontmatter = {};
|
|
16915
|
+
let bodyContent = content;
|
|
16916
|
+
if (frontmatterMatch) {
|
|
16917
|
+
try {
|
|
16918
|
+
frontmatter = parseYaml11(frontmatterMatch[1]);
|
|
16919
|
+
bodyContent = content.slice(frontmatterMatch[0].length).trim();
|
|
16920
|
+
} catch {
|
|
16921
|
+
}
|
|
16922
|
+
}
|
|
16923
|
+
const name = frontmatter.name || basename11(sourcePath.endsWith(".md") ? dirname11(sourcePath) : sourcePath);
|
|
16924
|
+
const description = frontmatter.description || extractDescriptionFromContent(bodyContent);
|
|
16925
|
+
return {
|
|
16926
|
+
name,
|
|
16927
|
+
description,
|
|
16928
|
+
content: bodyContent,
|
|
16929
|
+
frontmatter,
|
|
16930
|
+
sourcePath,
|
|
16931
|
+
sourceAgent,
|
|
16932
|
+
version: frontmatter.version,
|
|
16933
|
+
author: frontmatter.author,
|
|
16934
|
+
tags: frontmatter.tags,
|
|
16935
|
+
allowedTools: parseAllowedTools(frontmatter["allowed-tools"]),
|
|
16936
|
+
agentFields: extractAgentSpecificFields(frontmatter, sourceAgent)
|
|
16937
|
+
};
|
|
16938
|
+
}
|
|
16939
|
+
function extractDescriptionFromContent(content) {
|
|
16940
|
+
const lines = content.split("\n").filter((line) => line.trim());
|
|
16941
|
+
for (const line of lines) {
|
|
16942
|
+
const trimmed = line.trim();
|
|
16943
|
+
if (trimmed.startsWith("#")) continue;
|
|
16944
|
+
if (trimmed.startsWith("```")) continue;
|
|
16945
|
+
if (trimmed.length > 10) {
|
|
16946
|
+
return trimmed.slice(0, 200) + (trimmed.length > 200 ? "..." : "");
|
|
16947
|
+
}
|
|
16948
|
+
}
|
|
16949
|
+
return "No description available";
|
|
16950
|
+
}
|
|
16951
|
+
function parseAllowedTools(value) {
|
|
16952
|
+
if (!value) return void 0;
|
|
16953
|
+
if (Array.isArray(value)) return value;
|
|
16954
|
+
if (typeof value === "string") {
|
|
16955
|
+
return value.split(",").map((t) => t.trim()).filter(Boolean);
|
|
16956
|
+
}
|
|
16957
|
+
return void 0;
|
|
16958
|
+
}
|
|
16959
|
+
function extractAgentSpecificFields(frontmatter, _sourceAgent) {
|
|
16960
|
+
const agentFields = {};
|
|
16961
|
+
const specialFields = [
|
|
16962
|
+
"disable-model-invocation",
|
|
16963
|
+
"user-invocable",
|
|
16964
|
+
"argument-hint",
|
|
16965
|
+
"model",
|
|
16966
|
+
"context",
|
|
16967
|
+
"agent",
|
|
16968
|
+
"globs",
|
|
16969
|
+
"alwaysApply",
|
|
16970
|
+
"applyTo",
|
|
16971
|
+
"mode",
|
|
16972
|
+
"hooks",
|
|
16973
|
+
"permissionMode"
|
|
16974
|
+
];
|
|
16975
|
+
for (const field of specialFields) {
|
|
16976
|
+
if (field in frontmatter) {
|
|
16977
|
+
agentFields[field] = frontmatter[field];
|
|
16978
|
+
}
|
|
16979
|
+
}
|
|
16980
|
+
return agentFields;
|
|
16981
|
+
}
|
|
16982
|
+
function translateSkillToAgent(canonical, targetAgent, options) {
|
|
16983
|
+
const format = AGENT_SKILL_FORMATS[targetAgent];
|
|
16984
|
+
const warnings = [];
|
|
16985
|
+
const incompatible = [];
|
|
16986
|
+
if (canonical.agentFields?.["hooks"] && targetAgent !== "claude-code") {
|
|
16987
|
+
incompatible.push("hooks (only supported in Claude Code)");
|
|
16988
|
+
}
|
|
16989
|
+
if (canonical.agentFields?.["permissionMode"] && !["claude-code", "roo"].includes(targetAgent)) {
|
|
16990
|
+
warnings.push("permissionMode may not be fully supported");
|
|
16991
|
+
}
|
|
16992
|
+
const content = generateSkillContent(canonical, targetAgent, format, options);
|
|
16993
|
+
const filename = options?.outputFilename || "SKILL.md";
|
|
16994
|
+
const targetDir = options?.outputDir || join33(format.skillsDir, canonical.name);
|
|
16995
|
+
return {
|
|
16996
|
+
success: true,
|
|
16997
|
+
content,
|
|
16998
|
+
filename,
|
|
16999
|
+
targetDir,
|
|
17000
|
+
warnings,
|
|
17001
|
+
incompatible,
|
|
17002
|
+
targetAgent
|
|
17003
|
+
};
|
|
17004
|
+
}
|
|
17005
|
+
function generateSkillContent(canonical, targetAgent, format, options) {
|
|
17006
|
+
const lines = [];
|
|
17007
|
+
const frontmatter = {
|
|
17008
|
+
name: canonical.name,
|
|
17009
|
+
description: canonical.description
|
|
17010
|
+
};
|
|
17011
|
+
if (canonical.version) {
|
|
17012
|
+
frontmatter.version = canonical.version;
|
|
17013
|
+
}
|
|
17014
|
+
if (canonical.author) {
|
|
17015
|
+
frontmatter.author = canonical.author;
|
|
17016
|
+
}
|
|
17017
|
+
if (canonical.tags && canonical.tags.length > 0) {
|
|
17018
|
+
frontmatter.tags = canonical.tags;
|
|
17019
|
+
}
|
|
17020
|
+
if (canonical.allowedTools && canonical.allowedTools.length > 0) {
|
|
17021
|
+
frontmatter["allowed-tools"] = canonical.allowedTools.join(", ");
|
|
17022
|
+
}
|
|
17023
|
+
addAgentSpecificFields(frontmatter, canonical, targetAgent, format);
|
|
17024
|
+
if (options?.addMetadata && canonical.sourceAgent) {
|
|
17025
|
+
frontmatter["_translated-from"] = canonical.sourceAgent;
|
|
17026
|
+
frontmatter["_translated-at"] = (/* @__PURE__ */ new Date()).toISOString();
|
|
17027
|
+
}
|
|
17028
|
+
lines.push("---");
|
|
17029
|
+
lines.push(stringifyYaml8(frontmatter).trim());
|
|
17030
|
+
lines.push("---");
|
|
17031
|
+
lines.push("");
|
|
17032
|
+
lines.push(canonical.content);
|
|
17033
|
+
return lines.join("\n");
|
|
17034
|
+
}
|
|
17035
|
+
function addAgentSpecificFields(frontmatter, canonical, targetAgent, _format) {
|
|
17036
|
+
if (targetAgent === "claude-code") {
|
|
17037
|
+
if ("model" in (canonical.agentFields ?? {})) {
|
|
17038
|
+
frontmatter.model = canonical.agentFields["model"];
|
|
17039
|
+
}
|
|
17040
|
+
if ("context" in (canonical.agentFields ?? {})) {
|
|
17041
|
+
frontmatter.context = canonical.agentFields["context"];
|
|
17042
|
+
}
|
|
17043
|
+
if ("agent" in (canonical.agentFields ?? {})) {
|
|
17044
|
+
frontmatter.agent = canonical.agentFields["agent"];
|
|
17045
|
+
}
|
|
17046
|
+
if ("disable-model-invocation" in (canonical.agentFields ?? {})) {
|
|
17047
|
+
frontmatter["disable-model-invocation"] = canonical.agentFields["disable-model-invocation"];
|
|
17048
|
+
}
|
|
17049
|
+
if ("user-invocable" in (canonical.agentFields ?? {})) {
|
|
17050
|
+
frontmatter["user-invocable"] = canonical.agentFields["user-invocable"];
|
|
17051
|
+
}
|
|
17052
|
+
if ("argument-hint" in (canonical.agentFields ?? {})) {
|
|
17053
|
+
frontmatter["argument-hint"] = canonical.agentFields["argument-hint"];
|
|
17054
|
+
}
|
|
17055
|
+
if ("hooks" in (canonical.agentFields ?? {})) {
|
|
17056
|
+
frontmatter.hooks = canonical.agentFields["hooks"];
|
|
17057
|
+
}
|
|
17058
|
+
if ("permissionMode" in (canonical.agentFields ?? {})) {
|
|
17059
|
+
frontmatter.permissionMode = canonical.agentFields["permissionMode"];
|
|
17060
|
+
}
|
|
17061
|
+
}
|
|
17062
|
+
if (["cursor", "trae", "windsurf"].includes(targetAgent)) {
|
|
17063
|
+
if ("globs" in (canonical.agentFields ?? {})) {
|
|
17064
|
+
frontmatter.globs = canonical.agentFields["globs"];
|
|
17065
|
+
}
|
|
17066
|
+
if ("alwaysApply" in (canonical.agentFields ?? {})) {
|
|
17067
|
+
frontmatter.alwaysApply = canonical.agentFields["alwaysApply"];
|
|
17068
|
+
}
|
|
17069
|
+
if (targetAgent === "windsurf" && "mode" in (canonical.agentFields ?? {})) {
|
|
17070
|
+
frontmatter.mode = canonical.agentFields["mode"];
|
|
17071
|
+
}
|
|
17072
|
+
}
|
|
17073
|
+
if (targetAgent === "github-copilot") {
|
|
17074
|
+
if ("applyTo" in (canonical.agentFields ?? {})) {
|
|
17075
|
+
frontmatter.applyTo = canonical.agentFields["applyTo"];
|
|
17076
|
+
}
|
|
17077
|
+
}
|
|
17078
|
+
if (targetAgent === "roo") {
|
|
17079
|
+
if ("disable-model-invocation" in (canonical.agentFields ?? {})) {
|
|
17080
|
+
frontmatter["disable-model-invocation"] = canonical.agentFields["disable-model-invocation"];
|
|
17081
|
+
}
|
|
17082
|
+
if ("user-invocable" in (canonical.agentFields ?? {})) {
|
|
17083
|
+
frontmatter["user-invocable"] = canonical.agentFields["user-invocable"];
|
|
17084
|
+
}
|
|
17085
|
+
if ("permissionMode" in (canonical.agentFields ?? {})) {
|
|
17086
|
+
frontmatter.permissionMode = canonical.agentFields["permissionMode"];
|
|
17087
|
+
}
|
|
17088
|
+
}
|
|
17089
|
+
}
|
|
17090
|
+
function translateSkillToAll(skillPath, sourceAgent, options) {
|
|
17091
|
+
const canonical = parseSkillToCanonical(skillPath, sourceAgent);
|
|
17092
|
+
if (!canonical) {
|
|
17093
|
+
return /* @__PURE__ */ new Map();
|
|
17094
|
+
}
|
|
17095
|
+
const results = /* @__PURE__ */ new Map();
|
|
17096
|
+
const agents = [
|
|
17097
|
+
"claude-code",
|
|
17098
|
+
"cursor",
|
|
17099
|
+
"codex",
|
|
17100
|
+
"gemini-cli",
|
|
17101
|
+
"opencode",
|
|
17102
|
+
"antigravity",
|
|
17103
|
+
"amp",
|
|
17104
|
+
"clawdbot",
|
|
17105
|
+
"droid",
|
|
17106
|
+
"github-copilot",
|
|
17107
|
+
"goose",
|
|
17108
|
+
"kilo",
|
|
17109
|
+
"kiro-cli",
|
|
17110
|
+
"roo",
|
|
17111
|
+
"trae",
|
|
17112
|
+
"windsurf",
|
|
17113
|
+
"universal"
|
|
17114
|
+
];
|
|
17115
|
+
for (const agent of agents) {
|
|
17116
|
+
if (agent !== sourceAgent) {
|
|
17117
|
+
results.set(agent, translateSkillToAgent(canonical, agent, options));
|
|
17118
|
+
}
|
|
17119
|
+
}
|
|
17120
|
+
return results;
|
|
17121
|
+
}
|
|
17122
|
+
function writeTranslatedSkill(result, rootDir, options) {
|
|
17123
|
+
if (!result.success) {
|
|
17124
|
+
return {
|
|
17125
|
+
success: false,
|
|
17126
|
+
path: "",
|
|
17127
|
+
error: "Translation failed"
|
|
17128
|
+
};
|
|
17129
|
+
}
|
|
17130
|
+
try {
|
|
17131
|
+
const rootPath = resolve3(rootDir);
|
|
17132
|
+
const filePath = resolve3(rootDir, result.targetDir, result.filename);
|
|
17133
|
+
const targetPath = dirname11(filePath);
|
|
17134
|
+
const relPath = relative3(rootPath, filePath);
|
|
17135
|
+
if (relPath.startsWith("..") || isAbsolute2(relPath)) {
|
|
17136
|
+
return {
|
|
17137
|
+
success: false,
|
|
17138
|
+
path: filePath,
|
|
17139
|
+
error: "Resolved output path escapes rootDir"
|
|
17140
|
+
};
|
|
17141
|
+
}
|
|
17142
|
+
if (existsSync32(filePath) && options?.overwrite === false) {
|
|
17143
|
+
return {
|
|
17144
|
+
success: false,
|
|
17145
|
+
path: filePath,
|
|
17146
|
+
error: "File exists and overwrite=false",
|
|
17147
|
+
skipped: true
|
|
17148
|
+
};
|
|
17149
|
+
}
|
|
17150
|
+
if (!existsSync32(targetPath)) {
|
|
17151
|
+
mkdirSync18(targetPath, { recursive: true });
|
|
17152
|
+
}
|
|
17153
|
+
writeFileSync17(filePath, result.content, "utf-8");
|
|
17154
|
+
return { success: true, path: filePath };
|
|
17155
|
+
} catch (error) {
|
|
17156
|
+
return {
|
|
17157
|
+
success: false,
|
|
17158
|
+
path: "",
|
|
17159
|
+
error: error instanceof Error ? error.message : String(error)
|
|
17160
|
+
};
|
|
17161
|
+
}
|
|
17162
|
+
}
|
|
17163
|
+
function generateSkillsConfig(skills, targetAgent) {
|
|
17164
|
+
const format = AGENT_SKILL_FORMATS[targetAgent];
|
|
17165
|
+
const enabledSkills = skills.filter((s) => s.enabled);
|
|
17166
|
+
if (enabledSkills.length === 0) {
|
|
17167
|
+
return "";
|
|
17168
|
+
}
|
|
17169
|
+
switch (format.configFormat) {
|
|
17170
|
+
case "xml":
|
|
17171
|
+
return generateXmlConfig(enabledSkills, format);
|
|
17172
|
+
case "mdc":
|
|
17173
|
+
return generateMdcConfig(enabledSkills, format);
|
|
17174
|
+
case "markdown-table":
|
|
17175
|
+
return generateMarkdownTableConfig(enabledSkills, format);
|
|
17176
|
+
case "json":
|
|
17177
|
+
return generateJsonConfig(enabledSkills, format);
|
|
17178
|
+
case "markdown":
|
|
17179
|
+
return generateMarkdownConfig(enabledSkills, format);
|
|
17180
|
+
default:
|
|
17181
|
+
return generateMarkdownConfig(enabledSkills, format);
|
|
17182
|
+
}
|
|
17183
|
+
}
|
|
17184
|
+
function generateXmlConfig(skills, format) {
|
|
17185
|
+
const skillsXml = skills.map((s) => `<skill>
|
|
17186
|
+
<name>${escapeXml(s.name)}</name>
|
|
17187
|
+
<description>${escapeXml(s.description)}</description>
|
|
17188
|
+
<location>${escapeXml(s.path)}</location>
|
|
17189
|
+
</skill>`).join("\n\n");
|
|
17190
|
+
return `<skills_system priority="1">
|
|
17191
|
+
|
|
17192
|
+
## Available Skills
|
|
17193
|
+
|
|
17194
|
+
<!-- SKILLS_TABLE_START -->
|
|
17195
|
+
<usage>
|
|
17196
|
+
When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
|
17197
|
+
|
|
17198
|
+
How to use skills:
|
|
17199
|
+
- Invoke: \`${format.invokeCommand} <skill-name>\` or \`npx ${format.invokeCommand} <skill-name>\`
|
|
17200
|
+
- The skill content will load with detailed instructions on how to complete the task
|
|
17201
|
+
- Base directory provided in output for resolving bundled resources (references/, scripts/, assets/)
|
|
17202
|
+
|
|
17203
|
+
Usage notes:
|
|
17204
|
+
- Only use skills listed in <available_skills> below
|
|
17205
|
+
- Do not invoke a skill that is already loaded in your context
|
|
17206
|
+
- Each skill invocation is stateless
|
|
17207
|
+
</usage>
|
|
17208
|
+
|
|
17209
|
+
<available_skills>
|
|
17210
|
+
|
|
17211
|
+
${skillsXml}
|
|
17212
|
+
|
|
17213
|
+
</available_skills>
|
|
17214
|
+
<!-- SKILLS_TABLE_END -->
|
|
17215
|
+
|
|
17216
|
+
</skills_system>`;
|
|
17217
|
+
}
|
|
17218
|
+
function generateMdcConfig(skills, format) {
|
|
17219
|
+
const skillsList = skills.map((s) => `- **${s.name}**: ${s.description}`).join("\n");
|
|
17220
|
+
const skillsXml = skills.map((s) => `<skill>
|
|
17221
|
+
<name>${escapeXml(s.name)}</name>
|
|
17222
|
+
<description>${escapeXml(s.description)}</description>
|
|
17223
|
+
<location>${escapeXml(s.path)}</location>
|
|
17224
|
+
</skill>`).join("\n\n");
|
|
17225
|
+
return `---
|
|
17226
|
+
description: SkillKit skills integration - provides specialized capabilities and domain knowledge
|
|
17227
|
+
globs: "**/*"
|
|
17228
|
+
alwaysApply: true
|
|
17229
|
+
---
|
|
17230
|
+
# Skills System
|
|
17231
|
+
|
|
17232
|
+
You have access to specialized skills that can help complete tasks. Use the skillkit CLI to load skill instructions when needed.
|
|
17233
|
+
|
|
17234
|
+
## Available Skills
|
|
17235
|
+
|
|
17236
|
+
${skillsList}
|
|
17237
|
+
|
|
17238
|
+
## How to Use Skills
|
|
17239
|
+
|
|
17240
|
+
When a task matches a skill's description, load it with:
|
|
17241
|
+
\`\`\`bash
|
|
17242
|
+
${format.invokeCommand} <skill-name>
|
|
17243
|
+
\`\`\`
|
|
17244
|
+
|
|
17245
|
+
The skill will provide detailed instructions for completing the task.
|
|
17246
|
+
|
|
17247
|
+
<!-- SKILLS_DATA_START -->
|
|
17248
|
+
${skillsXml}
|
|
17249
|
+
<!-- SKILLS_DATA_END -->
|
|
17250
|
+
`;
|
|
17251
|
+
}
|
|
17252
|
+
function generateMarkdownTableConfig(skills, format) {
|
|
17253
|
+
const skillsList = skills.map((s) => `| ${s.name} | ${s.description} | \`${format.invokeCommand} ${s.name}\` |`).join("\n");
|
|
17254
|
+
return `# Skills
|
|
17255
|
+
|
|
17256
|
+
You have access to specialized skills for completing complex tasks.
|
|
17257
|
+
|
|
17258
|
+
| Skill | Description | Command |
|
|
17259
|
+
|-------|-------------|---------|
|
|
17260
|
+
${skillsList}
|
|
17261
|
+
|
|
17262
|
+
## Usage
|
|
17263
|
+
|
|
17264
|
+
When a task matches a skill's capability, run the command to load detailed instructions:
|
|
17265
|
+
|
|
17266
|
+
\`\`\`bash
|
|
17267
|
+
${format.invokeCommand} <skill-name>
|
|
17268
|
+
\`\`\`
|
|
17269
|
+
|
|
17270
|
+
Skills are loaded on-demand to keep context clean. Only load skills when relevant to the current task.
|
|
17271
|
+
`;
|
|
17272
|
+
}
|
|
17273
|
+
function generateJsonConfig(skills, format) {
|
|
17274
|
+
const skillsJson = skills.map((s) => ({
|
|
17275
|
+
name: s.name,
|
|
17276
|
+
description: s.description,
|
|
17277
|
+
invoke: `${format.invokeCommand} ${s.name}`,
|
|
17278
|
+
location: s.path
|
|
17279
|
+
}));
|
|
17280
|
+
return `# Skills Configuration
|
|
17281
|
+
|
|
17282
|
+
You have access to specialized skills that extend your capabilities.
|
|
17283
|
+
|
|
17284
|
+
## Available Skills
|
|
17285
|
+
|
|
17286
|
+
${skills.map((s) => `### ${s.name}
|
|
17287
|
+
${s.description}
|
|
17288
|
+
|
|
17289
|
+
Invoke: \`${format.invokeCommand} ${s.name}\``).join("\n\n")}
|
|
17290
|
+
|
|
17291
|
+
## Skills Data
|
|
17292
|
+
|
|
17293
|
+
\`\`\`json
|
|
17294
|
+
${JSON.stringify(skillsJson, null, 2)}
|
|
17295
|
+
\`\`\`
|
|
17296
|
+
|
|
17297
|
+
## Usage Instructions
|
|
17298
|
+
|
|
17299
|
+
1. When a task matches a skill's description, load it using the invoke command
|
|
17300
|
+
2. Skills provide step-by-step instructions for complex tasks
|
|
17301
|
+
3. Each skill is self-contained with its own resources
|
|
17302
|
+
`;
|
|
17303
|
+
}
|
|
17304
|
+
function generateMarkdownConfig(skills, format) {
|
|
17305
|
+
const skillsList = skills.map((s) => `### ${s.name}
|
|
17306
|
+
|
|
17307
|
+
${s.description}
|
|
17308
|
+
|
|
17309
|
+
**Invoke:** \`${format.invokeCommand} ${s.name}\``).join("\n\n");
|
|
17310
|
+
return `# Skills System
|
|
17311
|
+
|
|
17312
|
+
You have access to specialized skills that can help complete tasks.
|
|
17313
|
+
|
|
17314
|
+
## Available Skills
|
|
17315
|
+
|
|
17316
|
+
${skillsList}
|
|
17317
|
+
|
|
17318
|
+
## How to Use Skills
|
|
17319
|
+
|
|
17320
|
+
When a task matches a skill's description, load it:
|
|
17321
|
+
|
|
17322
|
+
\`\`\`bash
|
|
17323
|
+
${format.invokeCommand} <skill-name>
|
|
17324
|
+
\`\`\`
|
|
17325
|
+
|
|
17326
|
+
Skills provide detailed instructions for completing complex tasks.
|
|
17327
|
+
`;
|
|
17328
|
+
}
|
|
17329
|
+
function escapeXml(text) {
|
|
17330
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
17331
|
+
}
|
|
17332
|
+
var getAgentSkillsDir = getSkillsDir;
|
|
17333
|
+
var getAgentConfigFile = getConfigFile;
|
|
16629
17334
|
export {
|
|
16630
17335
|
AGENT_CLI_CONFIGS,
|
|
17336
|
+
AGENT_CONFIG,
|
|
16631
17337
|
AGENT_DISCOVERY_PATHS,
|
|
16632
17338
|
AGENT_FORMAT_MAP,
|
|
17339
|
+
AGENT_SKILL_FORMATS,
|
|
16633
17340
|
AIManager,
|
|
16634
17341
|
AISearch,
|
|
16635
17342
|
AISkillGenerator,
|
|
@@ -16763,6 +17470,8 @@ export {
|
|
|
16763
17470
|
detectSkillFormat,
|
|
16764
17471
|
discoverAgents,
|
|
16765
17472
|
discoverAgentsForAgent,
|
|
17473
|
+
discoverAgentsFromPath,
|
|
17474
|
+
discoverAgentsRecursive,
|
|
16766
17475
|
discoverGlobalAgents,
|
|
16767
17476
|
discoverSkills,
|
|
16768
17477
|
dryRunExecutor,
|
|
@@ -16781,19 +17490,27 @@ export {
|
|
|
16781
17490
|
findSkill,
|
|
16782
17491
|
formatSkillAsPrompt,
|
|
16783
17492
|
fromCanonicalAgent,
|
|
17493
|
+
generateSkillsConfig,
|
|
16784
17494
|
getAgentCLIConfig,
|
|
17495
|
+
getAgentConfigFile,
|
|
16785
17496
|
getAgentConfigPath,
|
|
17497
|
+
getAgentDirectoryConfig,
|
|
16786
17498
|
getAgentFilename,
|
|
16787
17499
|
getAgentFormat,
|
|
17500
|
+
getAgentSkillsDir,
|
|
16788
17501
|
getAgentStats,
|
|
16789
17502
|
getAgentTargetDirectory,
|
|
16790
17503
|
getAgentsDirectory,
|
|
16791
17504
|
getAllProviders,
|
|
17505
|
+
getAllSkillsDirs,
|
|
16792
17506
|
getAvailableCLIAgents,
|
|
16793
17507
|
getBuiltinPacksDir,
|
|
16794
17508
|
getCICDTemplate,
|
|
17509
|
+
getConfigFile,
|
|
17510
|
+
getConfigFormat,
|
|
16795
17511
|
getExecutionStrategy,
|
|
16796
17512
|
getGlobalConfigPath,
|
|
17513
|
+
getGlobalSkillsDir,
|
|
16797
17514
|
getIndexStatus,
|
|
16798
17515
|
getInstallDir,
|
|
16799
17516
|
getManualExecutionInstructions,
|
|
@@ -16802,6 +17519,7 @@ export {
|
|
|
16802
17519
|
getProjectConfigPath,
|
|
16803
17520
|
getProvider,
|
|
16804
17521
|
getSearchDirs,
|
|
17522
|
+
getSkillsDir,
|
|
16805
17523
|
getStackTags,
|
|
16806
17524
|
getSupportedTranslationAgents,
|
|
16807
17525
|
getTechTags,
|
|
@@ -16834,6 +17552,8 @@ export {
|
|
|
16834
17552
|
parseShorthand,
|
|
16835
17553
|
parseSkill,
|
|
16836
17554
|
parseSkillContent,
|
|
17555
|
+
parseSkillContentToCanonical,
|
|
17556
|
+
parseSkillToCanonical,
|
|
16837
17557
|
parseSource,
|
|
16838
17558
|
parseWorkflow,
|
|
16839
17559
|
readAgentContent,
|
|
@@ -16847,6 +17567,7 @@ export {
|
|
|
16847
17567
|
setSkillEnabled,
|
|
16848
17568
|
shellExecutor,
|
|
16849
17569
|
skillMdTranslator,
|
|
17570
|
+
supportsAutoDiscovery,
|
|
16850
17571
|
supportsSlashCommands,
|
|
16851
17572
|
syncToAgent,
|
|
16852
17573
|
syncToAllAgents,
|
|
@@ -16857,6 +17578,8 @@ export {
|
|
|
16857
17578
|
translateCanonicalAgent,
|
|
16858
17579
|
translateSkill,
|
|
16859
17580
|
translateSkillFile,
|
|
17581
|
+
translateSkillToAgent,
|
|
17582
|
+
translateSkillToAll,
|
|
16860
17583
|
translatorRegistry,
|
|
16861
17584
|
validateAgent,
|
|
16862
17585
|
validateBuiltinPacks,
|
|
@@ -16867,6 +17590,7 @@ export {
|
|
|
16867
17590
|
validateSkillContent,
|
|
16868
17591
|
validateWorkflow,
|
|
16869
17592
|
windsurfTranslator,
|
|
16870
|
-
wrapProgressCallbackWithMemory
|
|
17593
|
+
wrapProgressCallbackWithMemory,
|
|
17594
|
+
writeTranslatedSkill
|
|
16871
17595
|
};
|
|
16872
17596
|
//# sourceMappingURL=index.js.map
|