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/README.md +5 -1
- package/lib/client.js +103 -15
- package/lib/client.js.map +3 -3
- package/lib/index.js +15 -3
- package/lib/index.js.map +4 -4
- package/market/mcp.json +24 -12
- package/market/skills.json +6 -3
- package/package.json +1 -1
- package/src/client/MarketTab.tsx +107 -9
- package/src/client/css.ts +6 -1
- package/src/client/index.ts +2 -0
- package/src/client/locales.ts +8 -0
- package/src/market.test.ts +12 -3
- package/src/market.ts +6 -0
- package/src/opener.ts +9 -1
- package/src/routes.ts +4 -0
- package/src/smoke.test.ts +4 -3
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"
|
|
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" });
|