dsh-plugin-capabilities 0.2.0 → 0.3.0

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/lib/index.js CHANGED
@@ -769,6 +769,9 @@ function profileDir(profile, dshHome = process.env.DSH_HOME) {
769
769
  return join2(home, "profiles", profile);
770
770
  }
771
771
 
772
+ // src/routes.ts
773
+ import { mkdirSync as mkdirSync6 } from "node:fs";
774
+
772
775
  // src/http.ts
773
776
  async function readJsonBody(request) {
774
777
  const chunks = [];
@@ -830,7 +833,8 @@ function parseSkillsIndex(parsed) {
830
833
  ...isString(record.descriptionZh) ? { descriptionZh: record.descriptionZh } : {},
831
834
  url: record.url,
832
835
  ...isString(record.homepage) ? { homepage: record.homepage } : {},
833
- ...typeof record.skillCount === "number" ? { skillCount: record.skillCount } : {}
836
+ ...typeof record.skillCount === "number" ? { skillCount: record.skillCount } : {},
837
+ ...isStringArray(record.skills) ? { skills: record.skills } : {}
834
838
  });
835
839
  }
836
840
  return out.length > 0 ? out : null;
@@ -860,7 +864,8 @@ function parseMcpIndex(parsed) {
860
864
  ...isString(record.url) ? { url: record.url } : {},
861
865
  homepage: record.homepage,
862
866
  ...isString(record.category) ? { category: record.category } : {},
863
- ...isString(record.runtime) ? { runtime: record.runtime } : {}
867
+ ...isString(record.runtime) ? { runtime: record.runtime } : {},
868
+ ...isStringArray(record.tools) ? { tools: record.tools } : {}
864
869
  });
865
870
  }
866
871
  return out.length > 0 ? out : null;
@@ -907,9 +912,14 @@ function openDirectory(dir) {
907
912
  } catch {
908
913
  return false;
909
914
  }
915
+ if (process.platform === "win32") {
916
+ dir = dir.split("/").join("\\");
917
+ }
910
918
  const launcher = process.platform === "win32" ? "explorer" : process.platform === "darwin" ? "open" : "xdg-open";
911
919
  try {
912
- const child = spawn(launcher, [dir], { detached: true, stdio: "ignore", windowsHide: true });
920
+ const child = spawn(launcher, [dir], { detached: true, stdio: "ignore" });
921
+ child.once("error", () => {
922
+ });
913
923
  child.unref();
914
924
  return true;
915
925
  } catch {
@@ -1685,8 +1695,10 @@ function mountCapabilitiesRoutes(host, config) {
1685
1695
  let dir;
1686
1696
  if (body.target === "user-skills") {
1687
1697
  dir = userSkillsDir();
1698
+ mkdirSync6(dir, { recursive: true });
1688
1699
  } else if (body.target === "plugin-state") {
1689
1700
  dir = pluginStateDir();
1701
+ mkdirSync6(dir, { recursive: true });
1690
1702
  } else if (body.target === "skill") {
1691
1703
  if (typeof body.name !== "string") {
1692
1704
  sendJson(response, 400, { error: "name is required" });