mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
fix: install standalone .md skills by wrapping in a directory
Standalone .md skills (e.g. doc_explanation.md) were copied as plain files, then saveSkillMetadata tried to write .skillkit.json inside them causing ENOTDIR. Now detects file sources via statSync and creates a directory with SKILL.md inside instead.
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
cpSync,
|
||||
rmSync,
|
||||
symlinkSync,
|
||||
statSync,
|
||||
readFileSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
@@ -499,7 +500,13 @@ export class InstallCommand extends Command {
|
||||
if (useSymlink && primaryPath) {
|
||||
symlinkSync(primaryPath, targetPath, "dir");
|
||||
} else {
|
||||
cpSync(sourcePath, targetPath, { recursive: true, dereference: true });
|
||||
const isStandaloneFile = statSync(sourcePath).isFile();
|
||||
if (isStandaloneFile) {
|
||||
mkdirSync(targetPath, { recursive: true });
|
||||
cpSync(sourcePath, join(targetPath, "SKILL.md"));
|
||||
} else {
|
||||
cpSync(sourcePath, targetPath, { recursive: true, dereference: true });
|
||||
}
|
||||
if (isSymlinkMode && primaryPath === null) {
|
||||
primaryPath = targetPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user