itismyskillmarket 1.3.33 → 1.3.35
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/dist/index.js +12 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1608,7 +1608,7 @@ async function verifySkill(skillName) {
|
|
|
1608
1608
|
|
|
1609
1609
|
// src/commands/ui.ts
|
|
1610
1610
|
import { createServer } from "http";
|
|
1611
|
-
import { readFileSync as readFileSync2, existsSync as existsSync3, mkdirSync, rmSync, readdirSync } from "fs";
|
|
1611
|
+
import { readFileSync as readFileSync2, existsSync as existsSync3, mkdirSync, rmSync, readdirSync, renameSync } from "fs";
|
|
1612
1612
|
import { join as join3, extname, dirname, basename } from "path";
|
|
1613
1613
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
1614
1614
|
import AdmZip from "adm-zip";
|
|
@@ -2629,6 +2629,17 @@ API_ROUTES.POST["/api/upload"] = async (req, res, _url) => {
|
|
|
2629
2629
|
}
|
|
2630
2630
|
mkdirSync(skillDir, { recursive: true });
|
|
2631
2631
|
zip.extractAllTo(skillDir, true);
|
|
2632
|
+
const extractedItems = readdirSync(skillDir, { withFileTypes: true });
|
|
2633
|
+
const subDirs = extractedItems.filter((i) => i.isDirectory());
|
|
2634
|
+
const files = extractedItems.filter((i) => !i.isDirectory());
|
|
2635
|
+
if (subDirs.length === 1 && files.length === 0) {
|
|
2636
|
+
const subDirPath = join3(skillDir, subDirs[0].name);
|
|
2637
|
+
const subItems = readdirSync(subDirPath, { withFileTypes: true });
|
|
2638
|
+
for (const item of subItems) {
|
|
2639
|
+
renameSync(join3(subDirPath, item.name), join3(skillDir, item.name));
|
|
2640
|
+
}
|
|
2641
|
+
rmSync(subDirPath, { recursive: true, force: true });
|
|
2642
|
+
}
|
|
2632
2643
|
const skillMdPath = findFileSync(skillDir, "SKILL.md");
|
|
2633
2644
|
const skillMdExists = skillMdPath !== null;
|
|
2634
2645
|
const pkgJsonPath = findFileSync(skillDir, "package.json") || join3(skillDir, "package.json");
|