dsh-skill-hub 0.3.19 → 0.3.20
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/CONTRIBUTING.md +1 -1
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +10 -6
- package/lib/client.js.map +1 -1
- package/lib/index.js +132 -94
- package/lib/types/client/api.d.ts +3 -3
- package/lib/types/protocol/config.d.ts +17 -11
- package/lib/types/protocol/market.d.ts +11 -0
- package/lib/types/protocol.d.ts +1 -1
- package/lib/types/repo/github-client.d.ts +11 -4
- package/lib/types/repo.d.ts +1 -1
- package/lib/types/routes/deps.d.ts +6 -1
- package/lib/types/skillfs/scan.d.ts +6 -5
- package/lib/types/skillfs.d.ts +25 -1
- package/package.json +21 -20
- package/src/client/api.ts +4 -3
- package/src/client/panel/hooks/useMarketFlow.ts +4 -2
- package/src/client/settings-card.tsx +2 -1
- package/src/client/settings-form.ts +6 -3
- package/src/index.ts +1 -1
- package/src/protocol/config.ts +27 -24
- package/src/protocol/market.ts +12 -0
- package/src/protocol.ts +1 -0
- package/src/repo/github-client.ts +26 -14
- package/src/repo.test.ts +20 -1
- package/src/repo.ts +1 -1
- package/src/routes/catalog-data.ts +7 -4
- package/src/routes/catalog.ts +4 -9
- package/src/routes/deps.ts +7 -2
- package/src/routes/market.ts +13 -2
- package/src/routes/repo-import.ts +4 -7
- package/src/routes.test.ts +68 -0
- package/src/skillfs/scan.ts +30 -17
- package/src/skillfs.test.ts +64 -3
- package/src/skillfs.ts +39 -8
- package/src/update.ts +6 -6
package/CONTRIBUTING.md
CHANGED
|
@@ -39,7 +39,7 @@ src/client/locales/ dictionaries by view (common/skills/market/sources/detai
|
|
|
39
39
|
```bash
|
|
40
40
|
npm install
|
|
41
41
|
npm run typecheck # tsc --noEmit
|
|
42
|
-
npm test # vitest (
|
|
42
|
+
npm test # vitest (266 tests across 14 suites)
|
|
43
43
|
npm run build # tsc declarations + tsdown bundles (lib/index.js + lib/client.js)
|
|
44
44
|
```
|
|
45
45
|
|
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ Host uses only `ctx.skills.snapshot/get`, `ctx.webServer.register`, `ctx.systemP
|
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
110
|
npm run typecheck # tsc --noEmit
|
|
111
|
-
npm test #
|
|
111
|
+
npm test # 266 tests, 14 suites
|
|
112
112
|
npm run build # tsc + tsdown → lib/index.js + lib/client.js
|
|
113
113
|
```
|
|
114
114
|
|
package/README.zh.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -61,6 +61,10 @@ window.__ModuleLoader__.load({
|
|
|
61
61
|
* `ctx.settings.update(HUB_ENTRY_ID, …)`.
|
|
62
62
|
*/
|
|
63
63
|
const HUB_ENTRY_ID = "skill-hub";
|
|
64
|
+
/** HEX color validation shared by host routes and the settings card. */
|
|
65
|
+
const HEX_COLOR_RE = /^#[0-9a-f]{6}$/i;
|
|
66
|
+
/** GitHub token validation shared by host routes and the settings card. */
|
|
67
|
+
const GITHUB_TOKEN_RE = /^[A-Za-z0-9_\-]{8,255}$/;
|
|
64
68
|
//#endregion
|
|
65
69
|
//#region src/protocol/sources.ts
|
|
66
70
|
/** 项目级技能来源(它们有 workspace 归属,不属于「个人」组)。 */
|
|
@@ -161,7 +165,7 @@ window.__ModuleLoader__.load({
|
|
|
161
165
|
market() {
|
|
162
166
|
return this.get(SKILL_HUB_API.market);
|
|
163
167
|
}
|
|
164
|
-
/** Add a market source repo; resolves with the fresh list. */
|
|
168
|
+
/** Add a market source repo; resolves with the fresh list plus the resolved slug. */
|
|
165
169
|
addMarketSource(repo) {
|
|
166
170
|
return this.post(SKILL_HUB_API.marketSource, { repo });
|
|
167
171
|
}
|
|
@@ -1542,7 +1546,7 @@ window.__ModuleLoader__.load({
|
|
|
1542
1546
|
});
|
|
1543
1547
|
}
|
|
1544
1548
|
function ColorField(props) {
|
|
1545
|
-
const value =
|
|
1549
|
+
const value = HEX_COLOR_RE.test(props.text) ? props.text : props.defaultColor;
|
|
1546
1550
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1547
1551
|
className: settings_card_module_css_default.field,
|
|
1548
1552
|
children: [
|
|
@@ -2360,9 +2364,9 @@ window.__ModuleLoader__.load({
|
|
|
2360
2364
|
function colorField(field) {
|
|
2361
2365
|
return {
|
|
2362
2366
|
field,
|
|
2363
|
-
format: (value) => typeof value === "string" &&
|
|
2367
|
+
format: (value) => typeof value === "string" && HEX_COLOR_RE.test(value) ? value : "",
|
|
2364
2368
|
parse: (text) => {
|
|
2365
|
-
if (
|
|
2369
|
+
if (HEX_COLOR_RE.test(text)) return {
|
|
2366
2370
|
kind: "set",
|
|
2367
2371
|
value: text
|
|
2368
2372
|
};
|
|
@@ -2381,7 +2385,7 @@ window.__ModuleLoader__.load({
|
|
|
2381
2385
|
parse: (text) => {
|
|
2382
2386
|
const trimmed = text.trim();
|
|
2383
2387
|
if (trimmed === "") return void 0;
|
|
2384
|
-
if (
|
|
2388
|
+
if (!GITHUB_TOKEN_RE.test(trimmed)) return void 0;
|
|
2385
2389
|
return {
|
|
2386
2390
|
kind: "set",
|
|
2387
2391
|
value: trimmed
|
|
@@ -6424,7 +6428,7 @@ window.__ModuleLoader__.load({
|
|
|
6424
6428
|
setNewSourceName("");
|
|
6425
6429
|
setRepoResult(null);
|
|
6426
6430
|
setRepoSelected(/* @__PURE__ */ new Set());
|
|
6427
|
-
const slug = result.
|
|
6431
|
+
const slug = result.repo;
|
|
6428
6432
|
setScanningRepo(slug);
|
|
6429
6433
|
setRepoDiscoverState({ status: "scanning" });
|
|
6430
6434
|
try {
|