@toolr/seedr 0.1.15 → 0.1.17
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-N3QN4Y4R.js → chunk-GBM42TSU.js} +1 -1
- package/dist/cli.js +46 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -106,7 +106,7 @@ async function fetchItemToDestination(item, destPath) {
|
|
|
106
106
|
await fetchFileTree(item.contents.files, remote, destPath);
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
const filesToFetch = item.type === "skill" ? ["SKILL.md"] : [`${item.type}.md`];
|
|
109
|
+
const filesToFetch = item.type === "skill" ? ["SKILL.md"] : item.type === "plugin" ? [".claude-plugin/plugin.json", ".claude-plugin/marketplace.json"] : [`${item.type}.md`];
|
|
110
110
|
await mkdir2(destPath, { recursive: true });
|
|
111
111
|
for (const file of filesToFetch) {
|
|
112
112
|
const content = await fetchRemote(`${remote}/${file}`);
|
package/dist/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
skillHandler,
|
|
24
24
|
uninstallSkill,
|
|
25
25
|
writeTextFile
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-GBM42TSU.js";
|
|
27
27
|
|
|
28
28
|
// src/cli.ts
|
|
29
29
|
import { Command as Command5 } from "commander";
|
|
@@ -95,12 +95,12 @@ async function selectScope() {
|
|
|
95
95
|
});
|
|
96
96
|
return result;
|
|
97
97
|
}
|
|
98
|
-
async function selectMethod() {
|
|
98
|
+
async function selectMethod(symlinkPath) {
|
|
99
99
|
const result = await p.select({
|
|
100
100
|
message: "Installation method",
|
|
101
101
|
options: [
|
|
102
|
-
{ label: "Symlink", value: "symlink", hint:
|
|
103
|
-
{ label: "Copy", value: "copy", hint: "standalone copy
|
|
102
|
+
{ label: "Symlink", value: "symlink", hint: `shared at ${symlinkPath}` },
|
|
103
|
+
{ label: "Copy", value: "copy", hint: "standalone copy per tool" }
|
|
104
104
|
]
|
|
105
105
|
});
|
|
106
106
|
return result;
|
|
@@ -313,7 +313,7 @@ function findScriptFile(item) {
|
|
|
313
313
|
}
|
|
314
314
|
return null;
|
|
315
315
|
}
|
|
316
|
-
async function installHookForTool(item, tool, scope,
|
|
316
|
+
async function installHookForTool(item, tool, scope, _method, cwd) {
|
|
317
317
|
const spinner = ora2(
|
|
318
318
|
`Installing ${item.name} for ${AI_TOOLS[tool].name}...`
|
|
319
319
|
).start();
|
|
@@ -568,12 +568,45 @@ import ora5 from "ora";
|
|
|
568
568
|
var home = homedir();
|
|
569
569
|
var PLUGINS_CACHE_DIR = join3(home, ".claude/plugins/cache");
|
|
570
570
|
var INSTALLED_PLUGINS_PATH = join3(home, ".claude/plugins/installed_plugins.json");
|
|
571
|
+
var KNOWN_MARKETPLACES_PATH = join3(home, ".claude/plugins/known_marketplaces.json");
|
|
572
|
+
var MARKETPLACES_DIR = join3(home, ".claude/plugins/marketplaces");
|
|
571
573
|
function getPluginCachePath(marketplace, name, version) {
|
|
572
574
|
return join3(PLUGINS_CACHE_DIR, marketplace, name, version);
|
|
573
575
|
}
|
|
574
576
|
function getPluginId(name, marketplace) {
|
|
575
577
|
return `${name}@${marketplace}`;
|
|
576
578
|
}
|
|
579
|
+
function extractGitHubRepo(url) {
|
|
580
|
+
const match = url.match(/github\.com\/([^/]+\/[^/]+)/);
|
|
581
|
+
return match?.[1]?.replace(/\.git$/, "") ?? null;
|
|
582
|
+
}
|
|
583
|
+
async function ensureMarketplaceRegistered(marketplace, item) {
|
|
584
|
+
const known = await readJson(
|
|
585
|
+
KNOWN_MARKETPLACES_PATH
|
|
586
|
+
);
|
|
587
|
+
if (known[marketplace]) return;
|
|
588
|
+
const repo = item.externalUrl ? extractGitHubRepo(item.externalUrl) : null;
|
|
589
|
+
if (!repo) return;
|
|
590
|
+
const installLocation = join3(MARKETPLACES_DIR, marketplace);
|
|
591
|
+
const { execFile } = await import("child_process");
|
|
592
|
+
const { mkdir: mkdir2 } = await import("fs/promises");
|
|
593
|
+
const { promisify } = await import("util");
|
|
594
|
+
const execFileAsync = promisify(execFile);
|
|
595
|
+
await mkdir2(MARKETPLACES_DIR, { recursive: true });
|
|
596
|
+
await execFileAsync("git", [
|
|
597
|
+
"clone",
|
|
598
|
+
"--depth",
|
|
599
|
+
"1",
|
|
600
|
+
`https://github.com/${repo}.git`,
|
|
601
|
+
installLocation
|
|
602
|
+
]);
|
|
603
|
+
known[marketplace] = {
|
|
604
|
+
source: { source: "github", repo },
|
|
605
|
+
installLocation,
|
|
606
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
607
|
+
};
|
|
608
|
+
await writeJson(KNOWN_MARKETPLACES_PATH, known);
|
|
609
|
+
}
|
|
577
610
|
async function installPluginForTool(item, tool, scope, method, cwd) {
|
|
578
611
|
const spinner = ora5(
|
|
579
612
|
`Installing ${item.name} for ${AI_TOOLS[tool].name}...`
|
|
@@ -599,6 +632,10 @@ async function installPluginForTool(item, tool, scope, method, cwd) {
|
|
|
599
632
|
const pluginName = pluginJson.name || item.slug;
|
|
600
633
|
const version = pluginJson.version || "1.0.0";
|
|
601
634
|
const pluginId = getPluginId(pluginName, marketplace);
|
|
635
|
+
try {
|
|
636
|
+
await ensureMarketplaceRegistered(marketplace, item);
|
|
637
|
+
} catch {
|
|
638
|
+
}
|
|
602
639
|
const cachePath = getPluginCachePath(marketplace, pluginName, version);
|
|
603
640
|
const { rm } = await import("fs/promises");
|
|
604
641
|
await installDirectory(tmpPath, cachePath, "copy");
|
|
@@ -851,8 +888,11 @@ var addCommand = new Command("add").description("Install a skill, agent, hook, o
|
|
|
851
888
|
let method;
|
|
852
889
|
if (options.method) {
|
|
853
890
|
method = options.method;
|
|
891
|
+
} else if (tools.length === 1) {
|
|
892
|
+
method = "copy";
|
|
854
893
|
} else {
|
|
855
|
-
const
|
|
894
|
+
const symlinkPath = getAgentsPath(item.type, item.slug, process.cwd());
|
|
895
|
+
const selected = await selectMethod(symlinkPath);
|
|
856
896
|
if (p.isCancel(selected)) {
|
|
857
897
|
cancelled();
|
|
858
898
|
return;
|
package/dist/index.js
CHANGED