itismyskillmarket 1.3.46 → 1.3.47

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.
@@ -1264,6 +1264,24 @@ async function publishSkill(skillName, options) {
1264
1264
 
1265
1265
  // src/commands/admin.ts
1266
1266
  import { execSync as execSync2 } from "child_process";
1267
+
1268
+ // src/utils/concurrency.ts
1269
+ async function throttledMap(items, fn, concurrency = 3, batchDelayMs = 200) {
1270
+ const results = [];
1271
+ for (let i = 0; i < items.length; i += concurrency) {
1272
+ const batch = items.slice(i, i + concurrency);
1273
+ const batchResults = await Promise.all(
1274
+ batch.map((item, idx) => fn(item, i + idx))
1275
+ );
1276
+ results.push(...batchResults);
1277
+ if (i + concurrency < items.length) {
1278
+ await new Promise((r) => setTimeout(r, batchDelayMs));
1279
+ }
1280
+ }
1281
+ return results;
1282
+ }
1283
+
1284
+ // src/commands/admin.ts
1267
1285
  async function fetchScopePackages() {
1268
1286
  const all = /* @__PURE__ */ new Set();
1269
1287
  for (const scope of SKILL_SCOPES) {
@@ -1284,8 +1302,9 @@ async function adminList() {
1284
1302
  console.log("No published skills found.");
1285
1303
  return;
1286
1304
  }
1287
- const details = await Promise.all(
1288
- packages.map(async (pkg) => {
1305
+ const details = await throttledMap(
1306
+ packages,
1307
+ async (pkg) => {
1289
1308
  try {
1290
1309
  const info = await fetchNpmPackage(pkg);
1291
1310
  if (!info) return null;
@@ -1302,7 +1321,11 @@ async function adminList() {
1302
1321
  } catch {
1303
1322
  return null;
1304
1323
  }
1305
- })
1324
+ },
1325
+ 3,
1326
+ // 并发 3
1327
+ 200
1328
+ // 批次间 200ms
1306
1329
  );
1307
1330
  const valid = details.filter(Boolean);
1308
1331
  console.log(`\u{1F4E6} ${valid.length} published skill(s):
@@ -1429,15 +1452,20 @@ async function adminStats() {
1429
1452
  console.log("No published skills found.");
1430
1453
  return;
1431
1454
  }
1432
- const infos = (await Promise.all(
1433
- packages.map(async (pkg) => {
1455
+ const infos = (await throttledMap(
1456
+ packages,
1457
+ async (pkg) => {
1434
1458
  try {
1435
1459
  const info = await fetchNpmPackage(pkg);
1436
1460
  return info ? { name: pkg, info } : null;
1437
1461
  } catch {
1438
1462
  return null;
1439
1463
  }
1440
- })
1464
+ },
1465
+ 3,
1466
+ // 并发 3
1467
+ 200
1468
+ // 批次间 200ms
1441
1469
  )).filter(Boolean);
1442
1470
  const totalSkills = infos.length;
1443
1471
  let totalVersions = 0;
@@ -1965,18 +1993,6 @@ function getRepoUrl(repo) {
1965
1993
  if (typeof repo === "string") return repo;
1966
1994
  return repo.url || "";
1967
1995
  }
1968
- async function throttledMap(items, fn, concurrency = 3) {
1969
- const results = [];
1970
- for (let i = 0; i < items.length; i += concurrency) {
1971
- const batch = items.slice(i, i + concurrency);
1972
- const batchResults = await Promise.all(batch.map((item, idx) => fn(item, i + idx)));
1973
- results.push(...batchResults);
1974
- if (i + concurrency < items.length) {
1975
- await new Promise((r) => setTimeout(r, 200));
1976
- }
1977
- }
1978
- return results;
1979
- }
1980
1996
  var MIME_TYPES = {
1981
1997
  ".html": "text/html; charset=utf-8",
1982
1998
  ".js": "application/javascript; charset=utf-8",
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startGuiServer
4
- } from "./chunk-ARRJETWL.js";
4
+ } from "./chunk-KDSWKP7T.js";
5
5
  export {
6
6
  startGuiServer
7
7
  };
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  uninstallAll,
40
40
  uninstallSkill,
41
41
  updateSkill
42
- } from "./chunk-ARRJETWL.js";
42
+ } from "./chunk-KDSWKP7T.js";
43
43
 
44
44
  // src/cli.ts
45
45
  import { Command } from "commander";
@@ -262,9 +262,14 @@ async function syncPlatformLinks() {
262
262
  await fs.remove(platformSkillDir);
263
263
  await fs.symlink(targetPlatformDir, platformSkillDir, "junction");
264
264
  console.log(` Linked: ${platform}/${skillId}`);
265
- } catch {
266
- await fs.copy(targetPlatformDir, platformSkillDir, { overwrite: true });
267
- console.log(` Copied: ${platform}/${skillId}`);
265
+ } catch (err) {
266
+ const nodeErr = err;
267
+ if (nodeErr.code === "EPERM" || nodeErr.code === "EACCES" || nodeErr.code === "ENOTSUP") {
268
+ await fs.copy(targetPlatformDir, platformSkillDir, { overwrite: true });
269
+ console.log(` Copied: ${platform}/${skillId}`);
270
+ } else {
271
+ throw err;
272
+ }
268
273
  }
269
274
  }
270
275
  }
@@ -650,58 +655,7 @@ var packageJson = JSON.parse(readFileSync(resolve(__dirname, "../package.json"),
650
655
  var VERSION = packageJson.version || "1.3.1";
651
656
  var program = new Command();
652
657
  program.name("skm").description("SkillMarket - Cross-platform skill manager for AI coding tools").version(VERSION);
653
- program.hook("preAction", (thisCommand) => {
654
- if (thisCommand.opts().help) {
655
- console.log(`
656
- SkillMarket CLI
657
-
658
- Usage: skm <command> [options]
659
-
660
- Commands:
661
- ls [options] List available skills
662
- --installed Show only installed skills
663
- --updates Check for updates
664
- --page <n> Page number (default: 1)
665
- --limit <n> Items per page (default: 20)
666
- -s, --search Search by keyword
667
- search <keyword> Search skills from npm registry
668
- -l, --limit Max results (default: 20)
669
- info <skill> Display skill information
670
- install <skill> Install a skill from npm or GitHub
671
- @<version> Install specific version
672
- --platform Target platforms (opencode,claude,vscode,codex,...)
673
- --force Overwrite if already installed
674
- -b, --branch GitHub branch to install from
675
- -c, --commit GitHub commit to install from
676
- uninstall <skill> Remove an installed skill
677
- --platform Target platforms
678
- --all Uninstall ALL installed skills
679
- --dry-run Preview without deleting
680
- -y, --yes Skip confirmation
681
- update [skill] Update installed skills (all if no skill specified)
682
- --all Update all skills
683
- publish <skill> Publish a skill to npm
684
- -v, --version Specify version
685
- verify <skill> Verify skill integrity and format
686
- sync [skill] Synchronize platform links (or sync a skill to latest)
687
- platforms Show available platforms
688
- gui [port] Start SkillMarket GUI web interface
689
- config View and manage configuration
690
- config [ls] List all configuration values
691
- config get <key> Get a config value
692
- config set <key> <val> Set a config value
693
- config reset [key] Reset config to defaults
694
- admin Admin: manage published skills
695
- admin ls List all published skills
696
- admin info <skill> Show detailed info for a published skill
697
- admin search <keyword> Search published skills
698
- admin stats Publishing statistics
699
- admin verify <skill> Verify a published skill
700
- admin deprecate <skill> Deprecate a skill (--version, --message)
701
- admin unpublish <skill> Unpublish a skill (--version, --force)
702
- admin tag set/tag rm/tag ls Manage dist-tags
703
- admin owner add/rm Manage package maintainers
704
- admin access <skill> Set package access (public|restricted)
658
+ program.addHelpText("afterAll", `
705
659
 
706
660
  Examples:
707
661
  skm ls List available skills
@@ -736,11 +690,7 @@ Examples:
736
690
  skm config reset --all Reset all config
737
691
  skm admin ls List all published skills
738
692
  skm admin stats Publishing statistics
739
- skm admin deprecate my-skill --message "Use v2" Deprecate a skill
740
- `);
741
- process.exit(0);
742
- }
743
- });
693
+ skm admin deprecate my-skill --message "Use v2" Deprecate a skill`);
744
694
  var lsCmd = program.command("ls").description("List available skills");
745
695
  lsCmd.option("--installed", "Show only installed skills").option("--updates", "Check for updates").option("-p, --page <number>", "Page number (default: 1)", parseInt).option("-l, --limit <number>", "Items per page (default: 20)", parseInt).option("-s, --search <keyword>", "Search by keyword (id, displayName, description)").action((opts) => {
746
696
  const options = {
@@ -762,118 +712,82 @@ infoCmd.argument("<skill-id>", "Skill ID to show info").action((skillId) => {
762
712
  });
763
713
  var installCmd = program.command("install").description("Install a skill from npm or GitHub");
764
714
  installCmd.argument("<skill>", "Skill ID, npm package, or GitHub URL (owner/repo, https://github.com/owner/repo)").option("-p, --platform <platforms>", "Target platforms (comma-separated: opencode,claude,vscode)").option("-f, --force", "Overwrite if already installed").option("-v, --version <version>", "Specific version to install (npm only)").option("-b, --branch <branch>", "GitHub branch to install from").option("-c, --commit <commit>", "GitHub commit hash to install from").action(async (skill, opts) => {
765
- try {
766
- const platforms = opts.platform ? opts.platform.split(",").map((p) => p.trim()) : void 0;
767
- const githubSource = parseGitHubUrl(skill);
768
- if (githubSource) {
769
- await installFromGitHub(skill, {
770
- platforms,
771
- force: opts.force,
772
- branch: opts.branch,
773
- commit: opts.commit
774
- });
775
- } else {
776
- await installSkill(skill, opts.version, {
777
- platforms,
778
- force: opts.force
779
- });
780
- }
781
- } catch (err) {
782
- console.error("Installation failed:", err);
783
- process.exit(1);
715
+ const platforms = opts.platform ? opts.platform.split(",").map((p) => p.trim()) : void 0;
716
+ const githubSource = parseGitHubUrl(skill);
717
+ if (githubSource) {
718
+ await installFromGitHub(skill, {
719
+ platforms,
720
+ force: opts.force,
721
+ branch: opts.branch,
722
+ commit: opts.commit
723
+ });
724
+ } else {
725
+ await installSkill(skill, opts.version, {
726
+ platforms,
727
+ force: opts.force
728
+ });
784
729
  }
785
730
  });
786
731
  var uninstallCmd = program.command("uninstall").description("Remove an installed skill from local and platform directories");
787
732
  uninstallCmd.argument("[skill]", "Skill ID to uninstall (required unless using --all)").option("-p, --platform <platforms>", "Target platforms (comma-separated)").option("-a, --all", "Uninstall ALL installed skills (requires confirmation)").option("-d, --dry-run", "Preview what would be uninstalled without actually deleting").option("-y, --yes", "Skip confirmation prompts").action(async (skill, opts) => {
788
- try {
789
- const platforms = opts.platform ? opts.platform.split(",").map((p) => p.trim()) : void 0;
790
- if (opts.all) {
791
- await uninstallAll({
792
- platforms,
793
- dryRun: opts.dryRun,
794
- yes: opts.yes
795
- });
796
- return;
797
- }
798
- if (!skill) {
799
- console.error("Error: Skill ID is required (or use --all to uninstall all)");
800
- process.exit(1);
801
- }
802
- await uninstallSkill(skill, {
733
+ const platforms = opts.platform ? opts.platform.split(",").map((p) => p.trim()) : void 0;
734
+ if (opts.all) {
735
+ await uninstallAll({
803
736
  platforms,
804
737
  dryRun: opts.dryRun,
805
738
  yes: opts.yes
806
739
  });
807
- } catch (err) {
808
- console.error("Uninstall failed:", err);
809
- process.exit(1);
740
+ return;
741
+ }
742
+ if (!skill) {
743
+ throw new Error("Skill ID is required (or use --all to uninstall all)");
810
744
  }
745
+ await uninstallSkill(skill, {
746
+ platforms,
747
+ dryRun: opts.dryRun,
748
+ yes: opts.yes
749
+ });
811
750
  });
812
751
  var updateCmd = program.command("update").description("Update installed skills");
813
752
  updateCmd.argument("[skill]", "Skill ID to update (optional, updates all if not specified)").option("--all", "Update all skills").action(async (skill, opts) => {
814
- try {
815
- if (opts.all || !skill) {
816
- await updateSkill();
817
- } else {
818
- await updateSkill(skill);
819
- }
820
- } catch (err) {
821
- console.error("Update failed:", err);
822
- process.exit(1);
753
+ if (opts.all || !skill) {
754
+ await updateSkill();
755
+ } else {
756
+ await updateSkill(skill);
823
757
  }
824
758
  });
825
759
  program.command("sync [skill]").description("Synchronize platform links or sync skill to latest version").action(async (skill) => {
826
- try {
827
- if (skill) {
828
- await syncSkill(skill);
829
- } else {
830
- await syncPlatformLinks();
831
- }
832
- } catch (err) {
833
- console.error("Sync failed:", err);
834
- process.exit(1);
760
+ if (skill) {
761
+ await syncSkill(skill);
762
+ } else {
763
+ await syncPlatformLinks();
835
764
  }
836
765
  });
837
766
  var platformsCmd = program.command("platforms").description("Show available platforms");
838
767
  platformsCmd.action(async () => {
839
- try {
840
- const available = await detectPlatforms();
841
- const allAdapters = getAllAdapters();
842
- console.log("\n\u{1F4CD} Available Platforms:\n");
843
- for (const adapter of allAdapters) {
844
- const isAvailable = available.find((a) => a.id === adapter.id);
845
- const installed = await adapter.listInstalled();
846
- if (isAvailable) {
847
- console.log(`${adapter.name.padEnd(15)} \u2705 Available (${installed.length} skills installed)`);
848
- } else {
849
- console.log(`${adapter.name.padEnd(15)} \u274C Not detected`);
850
- }
768
+ const available = await detectPlatforms();
769
+ const allAdapters = getAllAdapters();
770
+ console.log("\n\u{1F4CD} Available Platforms:\n");
771
+ for (const adapter of allAdapters) {
772
+ const isAvailable = available.find((a) => a.id === adapter.id);
773
+ const installed = await adapter.listInstalled();
774
+ if (isAvailable) {
775
+ console.log(`${adapter.name.padEnd(15)} \u2705 Available (${installed.length} skills installed)`);
776
+ } else {
777
+ console.log(`${adapter.name.padEnd(15)} \u274C Not detected`);
851
778
  }
852
- console.log("");
853
- } catch (err) {
854
- console.error("Failed to list platforms:", err);
855
- process.exit(1);
856
779
  }
780
+ console.log("");
857
781
  });
858
782
  program.command("gui [port]").description("Start SkillMarket GUI (web interface)").action(async (port) => {
859
783
  const portNum = port ? parseInt(port) : 18770;
860
784
  startGuiServer(portNum);
861
785
  });
862
786
  program.command("publish <skill>").description("Publish a skill to npm").option("-v, --version <version>", "Specify version (optional, auto-increment patch if not specified)").action(async (skill, options) => {
863
- try {
864
- await publishSkill(skill, options.version ? { version: options.version } : void 0);
865
- } catch (err) {
866
- console.error("Publish failed:", err);
867
- process.exit(1);
868
- }
787
+ await publishSkill(skill, options.version ? { version: options.version } : void 0);
869
788
  });
870
789
  program.command("verify <skill>").description("Verify skill integrity and format").action(async (skill) => {
871
- try {
872
- await verifySkill(skill);
873
- } catch (err) {
874
- console.error("Verify failed:", err);
875
- process.exit(1);
876
- }
790
+ await verifySkill(skill);
877
791
  });
878
792
  var config = program.command("config").description("View and manage configuration");
879
793
  config.command("list").alias("ls").description("List all configuration values").action(async () => {
@@ -893,121 +807,56 @@ config.command("reset [key]").description("Reset configuration to default values
893
807
  });
894
808
  var admin = program.command("admin").description("Admin: manage published skills (cloud)");
895
809
  admin.command("ls").description("List all published skills").action(async () => {
896
- try {
897
- await adminList();
898
- } catch (err) {
899
- console.error("Admin ls failed:", err);
900
- process.exit(1);
901
- }
810
+ await adminList();
902
811
  });
903
812
  admin.command("info <skill>").description("Show detailed info for a published skill").action(async (skill) => {
904
- try {
905
- await adminInfo(skill);
906
- } catch (err) {
907
- console.error("Admin info failed:", err);
908
- process.exit(1);
909
- }
813
+ await adminInfo(skill);
910
814
  });
911
815
  admin.command("search <keyword>").description("Search across published skills").option("-l, --limit <number>", "Max results (default: 20)", parseInt).action(async (keyword, opts) => {
912
- try {
913
- await adminSearch(keyword, opts.limit ?? 20);
914
- } catch (err) {
915
- console.error("Admin search failed:", err);
916
- process.exit(1);
917
- }
816
+ await adminSearch(keyword, opts.limit ?? 20);
918
817
  });
919
818
  admin.command("stats").description("Show publishing statistics").action(async () => {
920
- try {
921
- await adminStats();
922
- } catch (err) {
923
- console.error("Admin stats failed:", err);
924
- process.exit(1);
925
- }
819
+ await adminStats();
926
820
  });
927
821
  admin.command("verify <skill>").description("Verify a published skill structure and metadata").action(async (skill) => {
928
- try {
929
- await adminVerify(skill);
930
- } catch (err) {
931
- console.error("Admin verify failed:", err);
932
- process.exit(1);
933
- }
822
+ await adminVerify(skill);
934
823
  });
935
824
  admin.command("deprecate <skill>").description("Deprecate a published skill (or specific version)").option("-v, --version <version>", "Deprecate a specific version only").option("-m, --message <message>", "Deprecation message").action(async (skill, opts) => {
936
- try {
937
- await adminDeprecate(skill, {
938
- version: opts.version,
939
- message: opts.message
940
- });
941
- } catch (err) {
942
- console.error("Admin deprecate failed:", err);
943
- process.exit(1);
944
- }
825
+ await adminDeprecate(skill, {
826
+ version: opts.version,
827
+ message: opts.message
828
+ });
945
829
  });
946
830
  admin.command("unpublish <skill>").description("Unpublish a skill (or specific version) from npm").option("-v, --version <version>", "Unpublish a specific version only").option("-f, --force", "Force unpublish entire package").action(async (skill, opts) => {
947
- try {
948
- await adminUnpublish(skill, {
949
- version: opts.version,
950
- force: opts.force
951
- });
952
- } catch (err) {
953
- console.error("Admin unpublish failed:", err);
954
- process.exit(1);
955
- }
831
+ await adminUnpublish(skill, {
832
+ version: opts.version,
833
+ force: opts.force
834
+ });
956
835
  });
957
836
  var adminTag = admin.command("tag").description("Manage dist-tags for a skill");
958
837
  adminTag.command("set <skill> <tag> <version>").description("Set a dist-tag for a specific version").action(async (skill, tag, version) => {
959
- try {
960
- await adminTagSet(skill, tag, version);
961
- } catch (err) {
962
- console.error("Admin tag set failed:", err);
963
- process.exit(1);
964
- }
838
+ await adminTagSet(skill, tag, version);
965
839
  });
966
840
  adminTag.command("rm <skill> <tag>").description("Remove a dist-tag").action(async (skill, tag) => {
967
- try {
968
- await adminTagRemove(skill, tag);
969
- } catch (err) {
970
- console.error("Admin tag rm failed:", err);
971
- process.exit(1);
972
- }
841
+ await adminTagRemove(skill, tag);
973
842
  });
974
843
  adminTag.command("ls <skill>").description("List all dist-tags for a skill").action(async (skill) => {
975
- try {
976
- await adminTagList(skill);
977
- } catch (err) {
978
- console.error("Admin tag ls failed:", err);
979
- process.exit(1);
980
- }
844
+ await adminTagList(skill);
981
845
  });
982
846
  var adminOwner = admin.command("owner").description("Manage package owners/maintainers");
983
847
  adminOwner.command("add <skill> <user>").description("Add an owner to a skill package").action(async (skill, user) => {
984
- try {
985
- await adminOwnerAdd(skill, user);
986
- } catch (err) {
987
- console.error("Admin owner add failed:", err);
988
- process.exit(1);
989
- }
848
+ await adminOwnerAdd(skill, user);
990
849
  });
991
850
  adminOwner.command("rm <skill> <user>").description("Remove an owner from a skill package").action(async (skill, user) => {
992
- try {
993
- await adminOwnerRemove(skill, user);
994
- } catch (err) {
995
- console.error("Admin owner rm failed:", err);
996
- process.exit(1);
997
- }
851
+ await adminOwnerRemove(skill, user);
998
852
  });
999
853
  admin.command("access <skill> <level>").description("Set package access (public|restricted)").action(async (skill, level) => {
1000
- try {
1001
- if (level !== "public" && level !== "restricted") {
1002
- console.error('\u274C Access level must be "public" or "restricted"');
1003
- process.exit(1);
1004
- }
1005
- await adminAccess(skill, level);
1006
- } catch (err) {
1007
- console.error("Admin access failed:", err);
1008
- process.exit(1);
854
+ if (level !== "public" && level !== "restricted") {
855
+ throw new Error('Access level must be "public" or "restricted"');
1009
856
  }
857
+ await adminAccess(skill, level);
1010
858
  });
859
+ program.exitOverride();
1011
860
  var hasArgs = process.argv.slice(2).length > 0;
1012
861
  if (!hasArgs) {
1013
862
  const port = 18770;
@@ -1019,5 +868,10 @@ if (!hasArgs) {
1019
868
  }, 1500);
1020
869
  startGuiServer(port);
1021
870
  } else {
1022
- program.parse();
871
+ try {
872
+ await program.parseAsync();
873
+ } catch (err) {
874
+ console.error(err instanceof Error ? err.message : String(err));
875
+ process.exit(1);
876
+ }
1023
877
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itismyskillmarket",
3
- "version": "1.3.46",
3
+ "version": "1.3.47",
4
4
  "description": "Cross-platform skill manager for AI coding tools",
5
5
  "type": "module",
6
6
  "bin": {