@iceinvein/agent-skills 0.1.2 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +22 -139
  2. package/package.json +2 -2
package/dist/cli/index.js CHANGED
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env bun
2
- // @bun
1
+ #!/usr/bin/env node
3
2
  import { createRequire } from "node:module";
4
3
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
4
 
@@ -61,7 +60,7 @@ function validateManifest(data) {
61
60
 
62
61
  // src/cli/github.ts
63
62
  var REPO = "iceinvein/agent-skills";
64
- var BRANCH = "main";
63
+ var BRANCH = "master";
65
64
  var BASE = `https://raw.githubusercontent.com/${REPO}/${BRANCH}`;
66
65
  function buildRawUrl(skillName, filePath) {
67
66
  return `${BASE}/skills/${skillName}/${filePath}`;
@@ -450,53 +449,6 @@ async function installSkill(cwd, manifest, files, targetTools) {
450
449
  return { ok: true, installed, skipped };
451
450
  }
452
451
 
453
- // src/cli/github.ts
454
- var REPO2 = "iceinvein/agent-skills";
455
- var BRANCH2 = "main";
456
- var BASE2 = `https://raw.githubusercontent.com/${REPO2}/${BRANCH2}`;
457
- function buildRawUrl2(skillName, filePath) {
458
- return `${BASE2}/skills/${skillName}/${filePath}`;
459
- }
460
- async function fetchSkillManifest2(skillName) {
461
- const url = buildRawUrl2(skillName, "skill.json");
462
- const res = await fetch(url);
463
- if (res.status === 404) {
464
- return { ok: false, error: `Skill '${skillName}' not found` };
465
- }
466
- if (!res.ok) {
467
- return { ok: false, error: `Failed to fetch manifest: HTTP ${res.status}` };
468
- }
469
- const data = await res.json();
470
- return validateManifest(data);
471
- }
472
- async function fetchSkillFile2(skillName, filePath) {
473
- const url = buildRawUrl2(skillName, filePath);
474
- const res = await fetch(url);
475
- if (!res.ok) {
476
- return { ok: false, error: `Failed to fetch '${filePath}': HTTP ${res.status}` };
477
- }
478
- const content = await res.text();
479
- return { ok: true, content };
480
- }
481
- async function fetchAllSkillFiles2(skillName, manifest) {
482
- const files = new Map;
483
- if (manifest.files?.prompt) {
484
- const result = await fetchSkillFile2(skillName, manifest.files.prompt);
485
- if (!result.ok)
486
- return { error: result.error };
487
- files.set(manifest.files.prompt, result.content);
488
- }
489
- if (manifest.files?.supporting) {
490
- for (const supportFile of manifest.files.supporting) {
491
- const result = await fetchSkillFile2(skillName, supportFile);
492
- if (!result.ok)
493
- return { error: result.error };
494
- files.set(supportFile, result.content);
495
- }
496
- }
497
- return files;
498
- }
499
-
500
452
  // src/cli/commands/remove.ts
501
453
  async function removeSkill(cwd, skillName) {
502
454
  const lockfile = await readLockfile(cwd);
@@ -504,7 +456,7 @@ async function removeSkill(cwd, skillName) {
504
456
  if (!entry) {
505
457
  return { ok: false, error: `Skill '${skillName}' is not installed` };
506
458
  }
507
- const manifestResult = await fetchSkillManifest2(skillName);
459
+ const manifestResult = await fetchSkillManifest(skillName);
508
460
  if (manifestResult.ok) {
509
461
  for (const tool of entry.tools) {
510
462
  const adapter = getAdapter(tool);
@@ -537,9 +489,9 @@ async function removeSkill(cwd, skillName) {
537
489
  }
538
490
 
539
491
  // src/cli/commands/list.ts
540
- var REPO3 = "iceinvein/agent-skills";
541
- var BRANCH3 = "main";
542
- var INDEX_URL = `https://raw.githubusercontent.com/${REPO3}/${BRANCH3}/skills/index.json`;
492
+ var REPO2 = "iceinvein/agent-skills";
493
+ var BRANCH2 = "master";
494
+ var INDEX_URL = `https://raw.githubusercontent.com/${REPO2}/${BRANCH2}/skills/index.json`;
543
495
  async function listSkills() {
544
496
  const res = await fetch(INDEX_URL);
545
497
  if (!res.ok) {
@@ -551,73 +503,7 @@ async function listSkills() {
551
503
 
552
504
  // src/cli/commands/info.ts
553
505
  async function infoSkill(skillName) {
554
- return fetchSkillManifest2(skillName);
555
- }
556
-
557
- // src/cli/commands/remove.ts
558
- async function removeSkill2(cwd, skillName) {
559
- const lockfile = await readLockfile(cwd);
560
- const entry = lockfile.skills[skillName];
561
- if (!entry) {
562
- return { ok: false, error: `Skill '${skillName}' is not installed` };
563
- }
564
- const manifestResult = await fetchSkillManifest2(skillName);
565
- if (manifestResult.ok) {
566
- for (const tool of entry.tools) {
567
- const adapter = getAdapter(tool);
568
- const toolFiles = entry.files.filter((f) => {
569
- const config = manifestResult.manifest.install[tool];
570
- if (!config)
571
- return false;
572
- if (config.prompt && f === config.prompt)
573
- return true;
574
- if (config.supporting && Object.values(config.supporting).includes(f))
575
- return true;
576
- if (config.mcpServers && (f.includes(".claude/settings") || f.includes(".cursor/mcp") || f.includes(".gemini/settings")))
577
- return true;
578
- return false;
579
- });
580
- await adapter.remove(cwd, manifestResult.manifest, toolFiles);
581
- }
582
- } else {
583
- const { unlinkSync: unlinkSync4, existsSync: existsSync6 } = await import("node:fs");
584
- const { join: join7 } = await import("node:path");
585
- for (const file of entry.files) {
586
- const fullPath = join7(cwd, file);
587
- if (existsSync6(fullPath)) {
588
- unlinkSync4(fullPath);
589
- }
590
- }
591
- }
592
- await removeSkillFromLockfile(cwd, skillName);
593
- return { ok: true, removed: entry.files };
594
- }
595
-
596
- // src/cli/commands/install.ts
597
- async function installSkill2(cwd, manifest, files, targetTools) {
598
- const compatibleTools = targetTools.filter((t) => manifest.tools.includes(t));
599
- const skipped = targetTools.filter((t) => !manifest.tools.includes(t));
600
- if (compatibleTools.length === 0) {
601
- return {
602
- ok: false,
603
- error: `Skill '${manifest.name}' does not support any of: ${targetTools.join(", ")}. Supported: ${manifest.tools.join(", ")}`
604
- };
605
- }
606
- const installed = {};
607
- const allFiles = [];
608
- for (const tool of compatibleTools) {
609
- const adapter = getAdapter(tool);
610
- const toolFiles = await adapter.install(cwd, manifest, files);
611
- installed[tool] = toolFiles;
612
- allFiles.push(...toolFiles);
613
- }
614
- await addSkillToLockfile(cwd, manifest.name, {
615
- version: manifest.version,
616
- tools: compatibleTools,
617
- installedAt: new Date().toISOString(),
618
- files: allFiles
619
- });
620
- return { ok: true, installed, skipped };
506
+ return fetchSkillManifest(skillName);
621
507
  }
622
508
 
623
509
  // src/cli/commands/update.ts
@@ -629,25 +515,22 @@ async function updateSkill(cwd, skillName) {
629
515
  }
630
516
  const oldVersion = entry.version;
631
517
  const tools = entry.tools;
632
- const manifestResult = await fetchSkillManifest2(skillName);
518
+ const manifestResult = await fetchSkillManifest(skillName);
633
519
  if (!manifestResult.ok) {
634
520
  return { ok: false, error: manifestResult.error };
635
521
  }
636
- const filesResult = await fetchAllSkillFiles2(skillName, manifestResult.manifest);
522
+ const filesResult = await fetchAllSkillFiles(skillName, manifestResult.manifest);
637
523
  if ("error" in filesResult) {
638
524
  return { ok: false, error: filesResult.error };
639
525
  }
640
- await removeSkill2(cwd, skillName);
641
- const installResult = await installSkill2(cwd, manifestResult.manifest, filesResult, tools);
526
+ await removeSkill(cwd, skillName);
527
+ const installResult = await installSkill(cwd, manifestResult.manifest, filesResult, tools);
642
528
  if (!installResult.ok) {
643
529
  return { ok: false, error: installResult.error };
644
530
  }
645
531
  return { ok: true, from: oldVersion, to: manifestResult.manifest.version };
646
532
  }
647
533
 
648
- // src/cli/types.ts
649
- var TOOL_NAMES2 = ["claude", "cursor", "codex", "gemini"];
650
-
651
534
  // src/cli/index.ts
652
535
  function parseArgs(argv) {
653
536
  if (argv.length === 0)
@@ -667,7 +550,7 @@ function parseArgs(argv) {
667
550
  }
668
551
  function printHelp() {
669
552
  console.log(`
670
- @iceinvein/agent-skills \u2014 Install agent skills into AI coding tools
553
+ @iceinvein/agent-skills Install agent skills into AI coding tools
671
554
 
672
555
  Usage:
673
556
  agent-skills install <skill> [--tool <tool>] Install a skill
@@ -676,20 +559,20 @@ Usage:
676
559
  agent-skills list List available skills
677
560
  agent-skills info <skill> Show skill details
678
561
 
679
- Tools: ${TOOL_NAMES2.join(", ")}
562
+ Tools: ${TOOL_NAMES.join(", ")}
680
563
 
681
564
  If --tool is omitted, auto-detects tools in the current directory.
682
565
  `);
683
566
  }
684
567
  function printInstalled(result, skipped) {
685
568
  for (const [tool, files] of Object.entries(result)) {
686
- console.log(` \u2713 ${tool}`);
569
+ console.log(` ${tool}`);
687
570
  for (const file of files) {
688
- console.log(` \u2192 ${file}`);
571
+ console.log(` ${file}`);
689
572
  }
690
573
  }
691
574
  for (const tool of skipped) {
692
- console.log(` \u2298 ${tool} (skill does not support this tool)`);
575
+ console.log(` ${tool} (skill does not support this tool)`);
693
576
  }
694
577
  }
695
578
  async function main() {
@@ -714,8 +597,8 @@ async function main() {
714
597
  }
715
598
  let tools;
716
599
  if (flags.tool) {
717
- if (!TOOL_NAMES2.includes(flags.tool)) {
718
- console.error(`Error: unknown tool '${flags.tool}'. Must be one of: ${TOOL_NAMES2.join(", ")}`);
600
+ if (!TOOL_NAMES.includes(flags.tool)) {
601
+ console.error(`Error: unknown tool '${flags.tool}'. Must be one of: ${TOOL_NAMES.join(", ")}`);
719
602
  process.exit(1);
720
603
  }
721
604
  tools = [flags.tool];
@@ -733,7 +616,7 @@ async function main() {
733
616
  process.exit(1);
734
617
  }
735
618
  console.log(`
736
- \u2713 Installed '${skillName}' v${manifestResult.manifest.version}:`);
619
+ Installed '${skillName}' v${manifestResult.manifest.version}:`);
737
620
  printInstalled(result.installed, result.skipped);
738
621
  break;
739
622
  }
@@ -748,7 +631,7 @@ async function main() {
748
631
  console.error(`Error: ${result.error}`);
749
632
  process.exit(1);
750
633
  }
751
- console.log(`\u2713 Removed '${skillName}'`);
634
+ console.log(`✓ Removed '${skillName}'`);
752
635
  break;
753
636
  }
754
637
  case "update": {
@@ -763,7 +646,7 @@ async function main() {
763
646
  console.error(`Error: ${result.error}`);
764
647
  process.exit(1);
765
648
  }
766
- console.log(`\u2713 Updated '${skillName}' from v${result.from} to v${result.to}`);
649
+ console.log(`✓ Updated '${skillName}' from v${result.from} to v${result.to}`);
767
650
  break;
768
651
  }
769
652
  case "list": {
@@ -775,7 +658,7 @@ async function main() {
775
658
  process.exit(1);
776
659
  }
777
660
  for (const skill of result.skills) {
778
- const typeTag = skill.type === "prompt" ? "\uD83D\uDCDD" : skill.type === "code" ? "\u2699\uFE0F" : "\uD83D\uDD00";
661
+ const typeTag = skill.type === "prompt" ? "\uD83D\uDCDD" : skill.type === "code" ? "⚙️" : "\uD83D\uDD00";
779
662
  console.log(` ${typeTag} ${skill.name} (v${skill.version})`);
780
663
  console.log(` ${skill.description}
781
664
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iceinvein/agent-skills",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Install agent skills into AI coding tools",
5
5
  "author": "iceinvein",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  "skills"
14
14
  ],
15
15
  "scripts": {
16
- "build": "bun build src/cli/index.ts --outdir dist/cli --target node",
16
+ "build": "bun build src/cli/index.ts --outdir dist/cli --target node && sed -i'' -e '1s|#!/usr/bin/env bun|#!/usr/bin/env node|' dist/cli/index.js",
17
17
  "test": "bun test",
18
18
  "dev": "bun run src/cli/index.ts"
19
19
  },