@toolr/seedr 0.1.71 → 0.1.73
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-DI5Z3O3G.js → chunk-OYOVC7VN.js} +188 -69
- package/dist/cli.js +252 -346
- package/dist/index.d.ts +20 -20
- package/dist/index.js +15 -15
- package/package.json +1 -1
|
@@ -145,11 +145,11 @@ async function fetchFileTree(nodes, baseUrl, destPath) {
|
|
|
145
145
|
}));
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
// src/config/
|
|
148
|
+
// src/config/agents.ts
|
|
149
149
|
import { homedir } from "os";
|
|
150
150
|
import { join as join2 } from "path";
|
|
151
151
|
var home = homedir();
|
|
152
|
-
var
|
|
152
|
+
var CODING_AGENTS = {
|
|
153
153
|
claude: {
|
|
154
154
|
name: "Claude Code",
|
|
155
155
|
shortName: "claude",
|
|
@@ -257,15 +257,15 @@ var AI_TOOLS = {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
-
var
|
|
261
|
-
function
|
|
262
|
-
return
|
|
260
|
+
var ALL_AGENTS = Object.keys(CODING_AGENTS);
|
|
261
|
+
function getAgentConfig(agent) {
|
|
262
|
+
return CODING_AGENTS[agent];
|
|
263
263
|
}
|
|
264
|
-
function getContentTypeConfig(
|
|
265
|
-
return
|
|
264
|
+
function getContentTypeConfig(agent, type) {
|
|
265
|
+
return CODING_AGENTS[agent].contentTypes[type];
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
const config =
|
|
267
|
+
function getAgentRoot(agent, scope, cwd = process.cwd()) {
|
|
268
|
+
const config = CODING_AGENTS[agent];
|
|
269
269
|
switch (scope) {
|
|
270
270
|
case "project":
|
|
271
271
|
case "local":
|
|
@@ -274,10 +274,10 @@ function getToolRoot(tool, scope, cwd = process.cwd()) {
|
|
|
274
274
|
return config.userRoot;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
function getContentPath(
|
|
278
|
-
const typeConfig = getContentTypeConfig(
|
|
277
|
+
function getContentPath(agent, type, scope, cwd = process.cwd()) {
|
|
278
|
+
const typeConfig = getContentTypeConfig(agent, type);
|
|
279
279
|
if (!typeConfig) return void 0;
|
|
280
|
-
const root =
|
|
280
|
+
const root = getAgentRoot(agent, scope, cwd);
|
|
281
281
|
return typeConfig.path ? join2(root, typeConfig.path) : root;
|
|
282
282
|
}
|
|
283
283
|
function getSettingsPath(scope, cwd = process.cwd()) {
|
|
@@ -299,8 +299,8 @@ function getMcpPath(scope, cwd = process.cwd()) {
|
|
|
299
299
|
return join2(home, ".claude.json");
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
return getContentPath(
|
|
302
|
+
function getAgentPath(agent, scope, cwd = process.cwd()) {
|
|
303
|
+
return getContentPath(agent, "skill", scope, cwd) || "";
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
// src/utils/fs.ts
|
|
@@ -373,34 +373,34 @@ async function installDirectory(source, destination, method) {
|
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
// src/utils/detection.ts
|
|
376
|
-
async function
|
|
377
|
-
const checks =
|
|
378
|
-
const projectPath =
|
|
379
|
-
const userPath =
|
|
376
|
+
async function detectInstalledAgents(cwd = process.cwd()) {
|
|
377
|
+
const checks = ALL_AGENTS.flatMap((agent) => {
|
|
378
|
+
const projectPath = getAgentPath(agent, "project", cwd);
|
|
379
|
+
const userPath = getAgentPath(agent, "user", cwd);
|
|
380
380
|
return [
|
|
381
|
-
exists(projectPath).then((found) => found ? {
|
|
382
|
-
exists(userPath).then((found) => found ? {
|
|
381
|
+
exists(projectPath).then((found) => found ? { agent, scope: "project", path: projectPath } : null),
|
|
382
|
+
exists(userPath).then((found) => found ? { agent, scope: "user", path: userPath } : null)
|
|
383
383
|
];
|
|
384
384
|
});
|
|
385
385
|
const results = await Promise.all(checks);
|
|
386
386
|
return results.filter((r) => r !== null);
|
|
387
387
|
}
|
|
388
|
-
async function
|
|
389
|
-
const checks =
|
|
390
|
-
const projectPath =
|
|
391
|
-
return await exists(projectPath) ?
|
|
388
|
+
async function detectProjectAgents(cwd = process.cwd()) {
|
|
389
|
+
const checks = ALL_AGENTS.map(async (agent) => {
|
|
390
|
+
const projectPath = getAgentPath(agent, "project", cwd);
|
|
391
|
+
return await exists(projectPath) ? agent : null;
|
|
392
392
|
});
|
|
393
393
|
const results = await Promise.all(checks);
|
|
394
|
-
return results.filter((
|
|
394
|
+
return results.filter((a) => a !== null);
|
|
395
395
|
}
|
|
396
|
-
async function
|
|
396
|
+
async function isAgentInstalled(agent, scope, cwd = process.cwd()) {
|
|
397
397
|
const effectiveScope = scope === "local" ? "project" : scope;
|
|
398
|
-
const path =
|
|
398
|
+
const path = getAgentPath(agent, effectiveScope, cwd);
|
|
399
399
|
return exists(path);
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function parseAgentArg(arg) {
|
|
402
402
|
const normalized = arg.toLowerCase().trim();
|
|
403
|
-
if (
|
|
403
|
+
if (ALL_AGENTS.includes(normalized)) {
|
|
404
404
|
return normalized;
|
|
405
405
|
}
|
|
406
406
|
const aliases = {
|
|
@@ -416,17 +416,120 @@ function parseToolArg(arg) {
|
|
|
416
416
|
};
|
|
417
417
|
return aliases[normalized] ?? null;
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function parseAgentsArg(agents, allAgents) {
|
|
420
420
|
if (agents === "all") {
|
|
421
|
-
return
|
|
421
|
+
return allAgents;
|
|
422
422
|
}
|
|
423
|
-
return agents.split(",").map((
|
|
423
|
+
return agents.split(",").map((a) => parseAgentArg(a.trim())).filter((a) => a !== null);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// src/utils/ui.ts
|
|
427
|
+
import * as p from "@clack/prompts";
|
|
428
|
+
import chalk from "chalk";
|
|
429
|
+
var brand = chalk.hex("#22c55e");
|
|
430
|
+
var bgBrand = chalk.bgHex("#22c55e").black;
|
|
431
|
+
var LOGO = `
|
|
432
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
433
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
434
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
435
|
+
\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
436
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
437
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D`;
|
|
438
|
+
var URLS = {
|
|
439
|
+
toolr: "https://toolr.dev",
|
|
440
|
+
seedr: "https://seedr.toolr.dev"
|
|
441
|
+
};
|
|
442
|
+
function printLogo() {
|
|
443
|
+
console.log(brand(LOGO));
|
|
444
|
+
console.log(brand(" Seed your projects with capabilities"));
|
|
445
|
+
console.log(chalk.gray(` ${URLS.seedr}`));
|
|
446
|
+
console.log();
|
|
447
|
+
}
|
|
448
|
+
async function selectSkill(items) {
|
|
449
|
+
const result = await p.select({
|
|
450
|
+
message: "Select a skill to install",
|
|
451
|
+
options: items.map((item) => ({
|
|
452
|
+
label: item.name,
|
|
453
|
+
value: item,
|
|
454
|
+
hint: item.description
|
|
455
|
+
}))
|
|
456
|
+
});
|
|
457
|
+
return result;
|
|
458
|
+
}
|
|
459
|
+
async function selectAgents(compatible) {
|
|
460
|
+
const allOption = await p.select({
|
|
461
|
+
message: "Which coding agents do you want to install for?",
|
|
462
|
+
options: [
|
|
463
|
+
{ label: `All (${compatible.length} agents)`, value: "all" },
|
|
464
|
+
{ label: "Select specific agents...", value: "select" }
|
|
465
|
+
]
|
|
466
|
+
});
|
|
467
|
+
if (p.isCancel(allOption)) return allOption;
|
|
468
|
+
if (allOption === "all") return compatible;
|
|
469
|
+
const result = await p.multiselect({
|
|
470
|
+
message: "Select agents",
|
|
471
|
+
options: compatible.map((agent) => ({
|
|
472
|
+
label: CODING_AGENTS[agent].name,
|
|
473
|
+
value: agent,
|
|
474
|
+
hint: CODING_AGENTS[agent].projectRoot
|
|
475
|
+
})),
|
|
476
|
+
initialValues: ["claude"],
|
|
477
|
+
required: true
|
|
478
|
+
});
|
|
479
|
+
return result;
|
|
480
|
+
}
|
|
481
|
+
async function selectScope(includeLocal = false) {
|
|
482
|
+
const options = [
|
|
483
|
+
{ label: "Project", value: "project", hint: includeLocal ? "current directory, settings.json" : "current directory" },
|
|
484
|
+
{ label: "User", value: "user", hint: "home directory" },
|
|
485
|
+
...includeLocal ? [{ label: "Local", value: "local", hint: "current directory, settings.local.json" }] : []
|
|
486
|
+
];
|
|
487
|
+
const result = await p.select({ message: "Installation scope", options });
|
|
488
|
+
return result;
|
|
489
|
+
}
|
|
490
|
+
async function selectMethod(symlinkPath) {
|
|
491
|
+
const result = await p.select({
|
|
492
|
+
message: "Installation method",
|
|
493
|
+
options: [
|
|
494
|
+
{ label: "Symlink", value: "symlink", hint: `shared at ${symlinkPath}` },
|
|
495
|
+
{ label: "Copy", value: "copy", hint: "standalone copy per agent" }
|
|
496
|
+
]
|
|
497
|
+
});
|
|
498
|
+
return result;
|
|
499
|
+
}
|
|
500
|
+
async function confirm2(message) {
|
|
501
|
+
return p.confirm({ message });
|
|
502
|
+
}
|
|
503
|
+
function cancelled() {
|
|
504
|
+
p.cancel("Operation cancelled");
|
|
505
|
+
process.exit(0);
|
|
506
|
+
}
|
|
507
|
+
function intro2(message) {
|
|
508
|
+
p.intro(bgBrand(` ${message} `));
|
|
509
|
+
}
|
|
510
|
+
function outro2(message) {
|
|
511
|
+
p.outro(brand(message));
|
|
512
|
+
}
|
|
513
|
+
function step(message) {
|
|
514
|
+
p.log.step(message);
|
|
515
|
+
}
|
|
516
|
+
function info(message) {
|
|
517
|
+
p.log.info(message);
|
|
518
|
+
}
|
|
519
|
+
function success(message) {
|
|
520
|
+
p.log.success(message);
|
|
521
|
+
}
|
|
522
|
+
function warn(message) {
|
|
523
|
+
p.log.warn(message);
|
|
524
|
+
}
|
|
525
|
+
function error(message) {
|
|
526
|
+
p.log.error(message);
|
|
424
527
|
}
|
|
425
528
|
|
|
426
529
|
// src/handlers/skill.ts
|
|
427
530
|
import { join as join4, relative as relative2, dirname as dirname3 } from "path";
|
|
428
531
|
import { readdir as readdir2, symlink as symlink2, rm as rm2 } from "fs/promises";
|
|
429
|
-
import
|
|
532
|
+
import chalk2 from "chalk";
|
|
430
533
|
import ora from "ora";
|
|
431
534
|
async function installToCentralLocation(item, sourcePath, cwd) {
|
|
432
535
|
const centralPath = getAgentsPath("skill", item.slug, cwd);
|
|
@@ -438,58 +541,58 @@ async function installToCentralLocation(item, sourcePath, cwd) {
|
|
|
438
541
|
}
|
|
439
542
|
return centralPath;
|
|
440
543
|
}
|
|
441
|
-
async function
|
|
544
|
+
async function createAgentSymlink(centralPath, destPath) {
|
|
442
545
|
await ensureDir(dirname3(destPath));
|
|
443
546
|
await rm2(destPath, { recursive: true, force: true });
|
|
444
547
|
const relPath = relative2(dirname3(destPath), centralPath);
|
|
445
548
|
await symlink2(relPath, destPath);
|
|
446
549
|
}
|
|
447
|
-
async function
|
|
550
|
+
async function installSkillForAgent(item, agent, scope, method, cwd, centralPath) {
|
|
448
551
|
const spinner = ora(
|
|
449
|
-
`Installing ${item.name} for ${
|
|
552
|
+
`Installing ${item.name} for ${CODING_AGENTS[agent].name}...`
|
|
450
553
|
).start();
|
|
451
554
|
try {
|
|
452
|
-
const destDir = getContentPath(
|
|
555
|
+
const destDir = getContentPath(agent, "skill", scope, cwd);
|
|
453
556
|
if (!destDir) {
|
|
454
|
-
throw new Error(`${
|
|
557
|
+
throw new Error(`${CODING_AGENTS[agent].name} does not support skills`);
|
|
455
558
|
}
|
|
456
559
|
const destPath = join4(destDir, item.slug);
|
|
457
560
|
const sourcePath = getItemSourcePath(item);
|
|
458
561
|
if (method === "symlink" && centralPath) {
|
|
459
|
-
await
|
|
562
|
+
await createAgentSymlink(centralPath, destPath);
|
|
460
563
|
} else if (sourcePath && await exists(sourcePath)) {
|
|
461
564
|
await installDirectory(sourcePath, destPath, "copy");
|
|
462
565
|
} else {
|
|
463
566
|
await fetchItemToDestination(item, destPath);
|
|
464
567
|
}
|
|
465
568
|
spinner.succeed(
|
|
466
|
-
|
|
569
|
+
brand(`Installed ${item.name} for ${CODING_AGENTS[agent].name}`)
|
|
467
570
|
);
|
|
468
|
-
return {
|
|
469
|
-
} catch (
|
|
470
|
-
const errorMsg =
|
|
571
|
+
return { agent, success: true, path: destPath };
|
|
572
|
+
} catch (error2) {
|
|
573
|
+
const errorMsg = error2 instanceof Error ? error2.message : "Unknown error";
|
|
471
574
|
spinner.fail(
|
|
472
|
-
|
|
575
|
+
chalk2.red(`Failed to install for ${CODING_AGENTS[agent].name}: ${errorMsg}`)
|
|
473
576
|
);
|
|
474
|
-
return {
|
|
577
|
+
return { agent, success: false, path: "", error: errorMsg };
|
|
475
578
|
}
|
|
476
579
|
}
|
|
477
|
-
async function installSkill(item,
|
|
580
|
+
async function installSkill(item, agents, scope, method, cwd = process.cwd()) {
|
|
478
581
|
const results = [];
|
|
479
582
|
const sourcePath = getItemSourcePath(item);
|
|
480
583
|
let centralPath;
|
|
481
584
|
if (method === "symlink") {
|
|
482
585
|
centralPath = await installToCentralLocation(item, sourcePath, cwd);
|
|
483
586
|
}
|
|
484
|
-
for (const
|
|
485
|
-
const readsAgentsDir =
|
|
587
|
+
for (const agent of agents) {
|
|
588
|
+
const readsAgentsDir = agent === "gemini" || agent === "codex" || agent === "opencode";
|
|
486
589
|
if (readsAgentsDir && method === "symlink" && centralPath) {
|
|
487
|
-
results.push({
|
|
590
|
+
results.push({ agent, success: true, path: centralPath });
|
|
488
591
|
continue;
|
|
489
592
|
}
|
|
490
|
-
const result = await
|
|
593
|
+
const result = await installSkillForAgent(
|
|
491
594
|
item,
|
|
492
|
-
|
|
595
|
+
agent,
|
|
493
596
|
scope,
|
|
494
597
|
method,
|
|
495
598
|
cwd,
|
|
@@ -499,8 +602,8 @@ async function installSkill(item, tools, scope, method, cwd = process.cwd()) {
|
|
|
499
602
|
}
|
|
500
603
|
return results;
|
|
501
604
|
}
|
|
502
|
-
async function uninstallSkill(slug,
|
|
503
|
-
const destDir = getContentPath(
|
|
605
|
+
async function uninstallSkill(slug, agent, scope, cwd = process.cwd()) {
|
|
606
|
+
const destDir = getContentPath(agent, "skill", scope, cwd);
|
|
504
607
|
if (!destDir) return false;
|
|
505
608
|
const destPath = join4(destDir, slug);
|
|
506
609
|
if (!await exists(destPath)) {
|
|
@@ -509,8 +612,8 @@ async function uninstallSkill(slug, tool, scope, cwd = process.cwd()) {
|
|
|
509
612
|
await rm2(destPath, { recursive: true });
|
|
510
613
|
return true;
|
|
511
614
|
}
|
|
512
|
-
async function getInstalledSkills(
|
|
513
|
-
const destDir = getContentPath(
|
|
615
|
+
async function getInstalledSkills(agent, scope, cwd = process.cwd()) {
|
|
616
|
+
const destDir = getContentPath(agent, "skill", scope, cwd);
|
|
514
617
|
if (!destDir || !await exists(destDir)) {
|
|
515
618
|
return [];
|
|
516
619
|
}
|
|
@@ -519,14 +622,14 @@ async function getInstalledSkills(tool, scope, cwd = process.cwd()) {
|
|
|
519
622
|
}
|
|
520
623
|
var skillHandler = {
|
|
521
624
|
type: "skill",
|
|
522
|
-
async install(item,
|
|
523
|
-
return installSkill(item,
|
|
625
|
+
async install(item, agents, scope, method, cwd) {
|
|
626
|
+
return installSkill(item, agents, scope, method, cwd);
|
|
524
627
|
},
|
|
525
|
-
async uninstall(slug,
|
|
526
|
-
return uninstallSkill(slug,
|
|
628
|
+
async uninstall(slug, agent, scope, cwd) {
|
|
629
|
+
return uninstallSkill(slug, agent, scope, cwd);
|
|
527
630
|
},
|
|
528
|
-
async listInstalled(
|
|
529
|
-
return getInstalledSkills(
|
|
631
|
+
async listInstalled(agent, scope, cwd) {
|
|
632
|
+
return getInstalledSkills(agent, scope, cwd);
|
|
530
633
|
}
|
|
531
634
|
};
|
|
532
635
|
|
|
@@ -545,17 +648,33 @@ export {
|
|
|
545
648
|
writeTextFile,
|
|
546
649
|
getAgentsPath,
|
|
547
650
|
installDirectory,
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
651
|
+
CODING_AGENTS,
|
|
652
|
+
ALL_AGENTS,
|
|
653
|
+
getAgentConfig,
|
|
551
654
|
getContentPath,
|
|
552
655
|
getSettingsPath,
|
|
553
656
|
getMcpPath,
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
657
|
+
getAgentPath,
|
|
658
|
+
detectInstalledAgents,
|
|
659
|
+
detectProjectAgents,
|
|
660
|
+
isAgentInstalled,
|
|
661
|
+
parseAgentsArg,
|
|
662
|
+
p,
|
|
663
|
+
brand,
|
|
664
|
+
printLogo,
|
|
665
|
+
selectSkill,
|
|
666
|
+
selectAgents,
|
|
667
|
+
selectScope,
|
|
668
|
+
selectMethod,
|
|
669
|
+
confirm2 as confirm,
|
|
670
|
+
cancelled,
|
|
671
|
+
intro2 as intro,
|
|
672
|
+
outro2 as outro,
|
|
673
|
+
step,
|
|
674
|
+
info,
|
|
675
|
+
success,
|
|
676
|
+
warn,
|
|
677
|
+
error,
|
|
559
678
|
installSkill,
|
|
560
679
|
uninstallSkill,
|
|
561
680
|
getInstalledSkills,
|