@toolr/seedr 0.1.7 → 0.1.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/{chunk-7GIETJRD.js → chunk-NDYSR7CD.js} +21 -4
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -97,6 +97,19 @@ function getItemSourcePath(item) {
|
|
|
97
97
|
const typeDir = item.type + "s";
|
|
98
98
|
return join(REGISTRY_PATH, typeDir, item.slug);
|
|
99
99
|
}
|
|
100
|
+
async function fetchItemToDestination(item, destPath) {
|
|
101
|
+
const { writeFile: writeFile2, mkdir: mkdir2 } = await import("fs/promises");
|
|
102
|
+
const { dirname: dirname4, join: join5 } = await import("path");
|
|
103
|
+
const { remote } = getItemBaseUrl(item);
|
|
104
|
+
const filesToFetch = item.type === "skill" ? ["SKILL.md"] : [`${item.type}.md`];
|
|
105
|
+
await mkdir2(destPath, { recursive: true });
|
|
106
|
+
for (const file of filesToFetch) {
|
|
107
|
+
const content = await fetchRemote(`${remote}/${file}`);
|
|
108
|
+
const filePath = join5(destPath, file);
|
|
109
|
+
await mkdir2(dirname4(filePath), { recursive: true });
|
|
110
|
+
await writeFile2(filePath, content, "utf-8");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
100
113
|
|
|
101
114
|
// src/config/tools.ts
|
|
102
115
|
import { homedir } from "os";
|
|
@@ -391,7 +404,11 @@ async function installToCentralLocation(item, sourcePath, cwd) {
|
|
|
391
404
|
const { rm } = await import("fs/promises");
|
|
392
405
|
await rm(centralPath, { recursive: true });
|
|
393
406
|
}
|
|
394
|
-
await
|
|
407
|
+
if (sourcePath && await exists(sourcePath)) {
|
|
408
|
+
await copyDirectory(sourcePath, centralPath);
|
|
409
|
+
} else {
|
|
410
|
+
await fetchItemToDestination(item, centralPath);
|
|
411
|
+
}
|
|
395
412
|
return centralPath;
|
|
396
413
|
}
|
|
397
414
|
async function createToolSymlink(centralPath, destPath) {
|
|
@@ -416,10 +433,10 @@ async function installSkillForTool(item, tool, scope, method, cwd, centralPath)
|
|
|
416
433
|
const sourcePath = getItemSourcePath(item);
|
|
417
434
|
if (method === "symlink" && centralPath) {
|
|
418
435
|
await createToolSymlink(centralPath, destPath);
|
|
419
|
-
} else if (sourcePath) {
|
|
436
|
+
} else if (sourcePath && await exists(sourcePath)) {
|
|
420
437
|
await installDirectory(sourcePath, destPath, "copy");
|
|
421
438
|
} else {
|
|
422
|
-
|
|
439
|
+
await fetchItemToDestination(item, destPath);
|
|
423
440
|
}
|
|
424
441
|
spinner.succeed(
|
|
425
442
|
chalk.green(`Installed ${item.name} for ${AI_TOOLS[tool].name}`)
|
|
@@ -437,7 +454,7 @@ async function installSkill(item, tools, scope, method, cwd = process.cwd()) {
|
|
|
437
454
|
const results = [];
|
|
438
455
|
const sourcePath = getItemSourcePath(item);
|
|
439
456
|
let centralPath;
|
|
440
|
-
if (method === "symlink"
|
|
457
|
+
if (method === "symlink") {
|
|
441
458
|
centralPath = await installToCentralLocation(item, sourcePath, cwd);
|
|
442
459
|
}
|
|
443
460
|
for (const tool of tools) {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED