@toolr/seedr 0.1.64 → 0.1.66

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.
@@ -112,15 +112,15 @@ async function fetchItemToDestination(item, destPath) {
112
112
  }
113
113
  const filesToFetch = item.type === "skill" ? ["SKILL.md"] : item.type === "plugin" ? [".claude-plugin/plugin.json"] : [`${item.type}.md`];
114
114
  await mkdir(destPath, { recursive: true });
115
- for (const file of filesToFetch) {
115
+ await Promise.all(filesToFetch.map(async (file) => {
116
116
  const content = await fetchRemote(`${remote}/${file}`);
117
117
  const filePath = join(destPath, file);
118
118
  await mkdir(dirname(filePath), { recursive: true });
119
119
  await writeFile(filePath, content, "utf-8");
120
- }
120
+ }));
121
121
  }
122
122
  async function fetchFileTree(nodes, baseUrl, destPath) {
123
- for (const node of nodes) {
123
+ await Promise.all(nodes.map(async (node) => {
124
124
  const nodePath = join(destPath, node.name);
125
125
  if (node.type === "directory") {
126
126
  await mkdir(nodePath, { recursive: true });
@@ -131,7 +131,7 @@ async function fetchFileTree(nodes, baseUrl, destPath) {
131
131
  const content = await fetchRemote(`${baseUrl}/${node.name}`);
132
132
  await writeFile(nodePath, content, "utf-8");
133
133
  }
134
- }
134
+ }));
135
135
  }
136
136
 
137
137
  // src/config/tools.ts
@@ -320,8 +320,10 @@ async function ensureDir(path) {
320
320
  }
321
321
  async function installFile(source, destination, method) {
322
322
  await ensureDir(dirname2(destination));
323
- if (await exists(destination)) {
323
+ try {
324
324
  await unlink(destination);
325
+ } catch (e) {
326
+ if (e.code !== "ENOENT") throw e;
325
327
  }
326
328
  if (method === "symlink") {
327
329
  const relPath = relative(dirname2(destination), source);
@@ -350,9 +352,7 @@ async function copyDirectory(source, destination) {
350
352
  }
351
353
  async function installDirectory(source, destination, method) {
352
354
  await ensureDir(dirname2(destination));
353
- if (await exists(destination)) {
354
- await rm(destination, { recursive: true });
355
- }
355
+ await rm(destination, { recursive: true, force: true });
356
356
  if (method === "symlink") {
357
357
  const relPath = relative(dirname2(destination), source);
358
358
  await symlink(relPath, destination);
@@ -363,28 +363,24 @@ async function installDirectory(source, destination, method) {
363
363
 
364
364
  // src/utils/detection.ts
365
365
  async function detectInstalledTools(cwd = process.cwd()) {
366
- const detected = [];
367
- for (const tool of ALL_TOOLS) {
366
+ const checks = ALL_TOOLS.flatMap((tool) => {
368
367
  const projectPath = getToolPath(tool, "project", cwd);
369
- if (await exists(projectPath)) {
370
- detected.push({ tool, scope: "project", path: projectPath });
371
- }
372
368
  const userPath = getToolPath(tool, "user", cwd);
373
- if (await exists(userPath)) {
374
- detected.push({ tool, scope: "user", path: userPath });
375
- }
376
- }
377
- return detected;
369
+ return [
370
+ exists(projectPath).then((found) => found ? { tool, scope: "project", path: projectPath } : null),
371
+ exists(userPath).then((found) => found ? { tool, scope: "user", path: userPath } : null)
372
+ ];
373
+ });
374
+ const results = await Promise.all(checks);
375
+ return results.filter((r) => r !== null);
378
376
  }
379
377
  async function detectProjectTools(cwd = process.cwd()) {
380
- const detected = [];
381
- for (const tool of ALL_TOOLS) {
378
+ const checks = ALL_TOOLS.map(async (tool) => {
382
379
  const projectPath = getToolPath(tool, "project", cwd);
383
- if (await exists(projectPath)) {
384
- detected.push(tool);
385
- }
386
- }
387
- return detected;
380
+ return await exists(projectPath) ? tool : null;
381
+ });
382
+ const results = await Promise.all(checks);
383
+ return results.filter((t) => t !== null);
388
384
  }
389
385
  async function isToolInstalled(tool, scope, cwd = process.cwd()) {
390
386
  const effectiveScope = scope === "local" ? "project" : scope;
@@ -423,9 +419,7 @@ import chalk from "chalk";
423
419
  import ora from "ora";
424
420
  async function installToCentralLocation(item, sourcePath, cwd) {
425
421
  const centralPath = getAgentsPath("skill", item.slug, cwd);
426
- if (await exists(centralPath)) {
427
- await rm2(centralPath, { recursive: true });
428
- }
422
+ await rm2(centralPath, { recursive: true, force: true });
429
423
  if (sourcePath && await exists(sourcePath)) {
430
424
  await copyDirectory(sourcePath, centralPath);
431
425
  } else {
@@ -435,9 +429,7 @@ async function installToCentralLocation(item, sourcePath, cwd) {
435
429
  }
436
430
  async function createToolSymlink(centralPath, destPath) {
437
431
  await ensureDir(dirname3(destPath));
438
- if (await exists(destPath)) {
439
- await rm2(destPath, { recursive: true });
440
- }
432
+ await rm2(destPath, { recursive: true, force: true });
441
433
  const relPath = relative2(dirname3(destPath), centralPath);
442
434
  await symlink2(relPath, destPath);
443
435
  }
@@ -503,8 +495,7 @@ async function uninstallSkill(slug, tool, scope, cwd = process.cwd()) {
503
495
  if (!await exists(destPath)) {
504
496
  return false;
505
497
  }
506
- const { rm: rm3 } = await import("fs/promises");
507
- await rm3(destPath, { recursive: true });
498
+ await rm2(destPath, { recursive: true });
508
499
  return true;
509
500
  }
510
501
  async function getInstalledSkills(tool, scope, cwd = process.cwd()) {
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  searchItems,
23
23
  skillHandler,
24
24
  writeTextFile
25
- } from "./chunk-JFTWHQQ7.js";
25
+ } from "./chunk-UJNW6POZ.js";
26
26
 
27
27
  // src/cli.ts
28
28
  import { Command as Command5 } from "commander";
@@ -164,7 +164,7 @@ function trackInstalls(slug, type, results, scope) {
164
164
  type,
165
165
  tool: result.tool,
166
166
  scope,
167
- version: "0.1.64"
167
+ version: "0.1.66"
168
168
  }),
169
169
  signal: AbortSignal.timeout(4e3)
170
170
  }).catch(() => {
@@ -278,11 +278,15 @@ import ora2 from "ora";
278
278
  import { readFile, writeFile } from "fs/promises";
279
279
  import { dirname } from "path";
280
280
  async function readJson(path) {
281
- if (!await exists(path)) {
282
- return {};
281
+ try {
282
+ const content = await readFile(path, "utf-8");
283
+ return JSON.parse(content);
284
+ } catch (error2) {
285
+ if (error2.code === "ENOENT") {
286
+ return {};
287
+ }
288
+ throw error2;
283
289
  }
284
- const content = await readFile(path, "utf-8");
285
- return JSON.parse(content);
286
290
  }
287
291
  async function writeJson(path, data) {
288
292
  await ensureDir(dirname(path));
@@ -457,9 +461,11 @@ async function uninstallHook(slug, tool, scope, cwd = process.cwd()) {
457
461
  const hooksDir = getHooksDir(scope, cwd);
458
462
  const scriptFileName = scriptFile || `${slug}.sh`;
459
463
  const scriptFilePath = join2(hooksDir, scriptFileName);
460
- if (await exists(scriptFilePath)) {
464
+ try {
461
465
  await rm(scriptFilePath);
462
466
  removed = true;
467
+ } catch (e) {
468
+ if (e.code !== "ENOENT") throw e;
463
469
  }
464
470
  return removed;
465
471
  }
@@ -678,6 +684,9 @@ var settingsHandler = {
678
684
  // src/handlers/plugin.ts
679
685
  import { homedir as homedir2 } from "os";
680
686
  import { join as join3 } from "path";
687
+ import { mkdir as mkdir2, rm as rm2 } from "fs/promises";
688
+ import { execFile } from "child_process";
689
+ import { promisify } from "util";
681
690
  import chalk7 from "chalk";
682
691
  import ora5 from "ora";
683
692
  var home = homedir2();
@@ -703,9 +712,6 @@ async function ensureMarketplaceRegistered(marketplace, item) {
703
712
  const repo = item.externalUrl ? extractGitHubRepo(item.externalUrl) : null;
704
713
  if (!repo) return;
705
714
  const installLocation = join3(MARKETPLACES_DIR, marketplace);
706
- const { execFile } = await import("child_process");
707
- const { mkdir: mkdir2 } = await import("fs/promises");
708
- const { promisify } = await import("util");
709
715
  const execFileAsync = promisify(execFile);
710
716
  await mkdir2(MARKETPLACES_DIR, { recursive: true });
711
717
  await execFileAsync("git", [
@@ -746,7 +752,6 @@ async function installPluginForTool(item, tool, scope, method, cwd) {
746
752
  const pluginId = getPluginId(pluginName, marketplace);
747
753
  await ensureMarketplaceRegistered(marketplace, item);
748
754
  const cachePath = getPluginCachePath(marketplace, pluginName, version);
749
- const { rm: rm2 } = await import("fs/promises");
750
755
  await installDirectory(tmpPath, cachePath, "copy");
751
756
  await rm2(tmpPath, { recursive: true, force: true });
752
757
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -972,8 +977,8 @@ var addCommand = new Command("add").description("Install a skill, agent, hook, o
972
977
  error(`No handler found for type "${item.type}"`);
973
978
  process.exit(1);
974
979
  }
975
- const typeCompatible = filterCompatibleTools(item.type, item.compatibility);
976
980
  let tools = resolveTools(options.agents, item);
981
+ const typeCompatible = filterCompatibleTools(item.type, item.compatibility);
977
982
  if (tools.length === 0) {
978
983
  if (typeCompatible.length === 1) {
979
984
  tools = typeCompatible;
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  loadManifest,
16
16
  searchItems,
17
17
  uninstallSkill
18
- } from "./chunk-JFTWHQQ7.js";
18
+ } from "./chunk-UJNW6POZ.js";
19
19
 
20
20
  // src/converters/index.ts
21
21
  import matter from "gray-matter";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolr/seedr",
3
- "version": "0.1.64",
3
+ "version": "0.1.66",
4
4
  "description": "Seed your projects with AI configurations",
5
5
  "type": "module",
6
6
  "bin": {