@neyugn/agent-kits 0.2.7 → 0.2.8
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/cli.js +30 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -154,7 +154,7 @@ async function installKit(options) {
|
|
|
154
154
|
const kitSourcePath = path2.join(KITS_DIR, kitId);
|
|
155
155
|
const kitTargetPath = path2.join(targetPath, aiTool.path);
|
|
156
156
|
await fs.mkdir(kitTargetPath, { recursive: true });
|
|
157
|
-
await copyDirectory(kitSourcePath, kitTargetPath, ["rules"]);
|
|
157
|
+
await copyDirectory(kitSourcePath, kitTargetPath, ["rules"], aiTool.path);
|
|
158
158
|
const rulesSource = path2.join(kitSourcePath, "rules", aiTool.kitRulesFile);
|
|
159
159
|
const rulesTarget = options.scope === "global" || aiTool.rulesInsideKit ? path2.join(kitTargetPath, aiTool.rulesFile) : path2.join(targetPath, aiTool.rulesFile);
|
|
160
160
|
try {
|
|
@@ -182,12 +182,22 @@ async function installKit(options) {
|
|
|
182
182
|
const commonDocPath = path2.join(COMMON_DIR, "COMMON.md");
|
|
183
183
|
const targetSkillsPath = path2.join(kitTargetPath, "skills");
|
|
184
184
|
await fs.mkdir(targetSkillsPath, { recursive: true });
|
|
185
|
-
await copyDirectory(commonSkillsPath, targetSkillsPath);
|
|
185
|
+
await copyDirectory(commonSkillsPath, targetSkillsPath, [], aiTool.path);
|
|
186
186
|
const targetWorkflowsPath = path2.join(kitTargetPath, "workflows");
|
|
187
187
|
await fs.mkdir(targetWorkflowsPath, { recursive: true });
|
|
188
|
-
await copyDirectory(
|
|
188
|
+
await copyDirectory(
|
|
189
|
+
commonWorkflowsPath,
|
|
190
|
+
targetWorkflowsPath,
|
|
191
|
+
[],
|
|
192
|
+
aiTool.path
|
|
193
|
+
);
|
|
189
194
|
const targetCommonDoc = path2.join(kitTargetPath, "COMMON.md");
|
|
190
|
-
await fs.
|
|
195
|
+
const commonContent = await fs.readFile(commonDocPath, "utf-8");
|
|
196
|
+
const updatedCommonContent = commonContent.replace(
|
|
197
|
+
/\.(agent|claude|gemini|cursor|codex)\//g,
|
|
198
|
+
`${aiTool.path}/`
|
|
199
|
+
);
|
|
200
|
+
await fs.writeFile(targetCommonDoc, updatedCommonContent);
|
|
191
201
|
} catch {
|
|
192
202
|
}
|
|
193
203
|
const agents = await countItems(path2.join(kitTargetPath, "agents"));
|
|
@@ -202,7 +212,17 @@ async function installKit(options) {
|
|
|
202
212
|
}
|
|
203
213
|
return results;
|
|
204
214
|
}
|
|
205
|
-
|
|
215
|
+
function replaceToolPaths(content, targetPath) {
|
|
216
|
+
return content.replace(
|
|
217
|
+
/\.(agent|claude|gemini|cursor|codex)\//g,
|
|
218
|
+
`${targetPath}/`
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
function shouldReplacePaths(filename) {
|
|
222
|
+
const ext = path2.extname(filename).toLowerCase();
|
|
223
|
+
return [".md", ".py", ".sh", ".txt", ".json"].includes(ext);
|
|
224
|
+
}
|
|
225
|
+
async function copyDirectory(src, dest, exclude = [], toolPath) {
|
|
206
226
|
await fs.mkdir(dest, { recursive: true });
|
|
207
227
|
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
208
228
|
for (const entry of entries) {
|
|
@@ -212,7 +232,11 @@ async function copyDirectory(src, dest, exclude = []) {
|
|
|
212
232
|
const srcPath = path2.join(src, entry.name);
|
|
213
233
|
const destPath = path2.join(dest, entry.name);
|
|
214
234
|
if (entry.isDirectory()) {
|
|
215
|
-
await copyDirectory(srcPath, destPath, exclude);
|
|
235
|
+
await copyDirectory(srcPath, destPath, exclude, toolPath);
|
|
236
|
+
} else if (toolPath && shouldReplacePaths(entry.name)) {
|
|
237
|
+
const content = await fs.readFile(srcPath, "utf-8");
|
|
238
|
+
const updatedContent = replaceToolPaths(content, toolPath);
|
|
239
|
+
await fs.writeFile(destPath, updatedContent);
|
|
216
240
|
} else {
|
|
217
241
|
await fs.copyFile(srcPath, destPath);
|
|
218
242
|
}
|