@supa-magic/spm 0.4.0 → 0.4.2
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/bin/spm.js +24 -12
- package/package.json +1 -1
package/dist/bin/spm.js
CHANGED
|
@@ -50,7 +50,14 @@ var detectProviders = (root) => Object.entries(knownProviders).reduce((providers
|
|
|
50
50
|
//#region src/core/config/project-root.ts
|
|
51
51
|
var getGitRoot = () => {
|
|
52
52
|
try {
|
|
53
|
-
return execSync("git rev-parse --show-toplevel", {
|
|
53
|
+
return execSync("git rev-parse --show-toplevel", {
|
|
54
|
+
encoding: "utf-8",
|
|
55
|
+
stdio: [
|
|
56
|
+
"pipe",
|
|
57
|
+
"pipe",
|
|
58
|
+
"pipe"
|
|
59
|
+
]
|
|
60
|
+
}).trim();
|
|
54
61
|
} catch {
|
|
55
62
|
return;
|
|
56
63
|
}
|
|
@@ -490,7 +497,7 @@ var stripProviderPrefix = (file, prefix) => {
|
|
|
490
497
|
};
|
|
491
498
|
//#endregion
|
|
492
499
|
//#region src/core/installer/shared/copy-files.ts
|
|
493
|
-
var copyFilesToProvider = (files, targetDir, stepper, entityLabel) => {
|
|
500
|
+
var copyFilesToProvider = (files, targetDir, providerDir, stepper, entityLabel) => {
|
|
494
501
|
if (files.length === 0) {
|
|
495
502
|
stepper.succeed(`${entityLabel} is up to date`);
|
|
496
503
|
return {
|
|
@@ -504,8 +511,9 @@ var copyFilesToProvider = (files, targetDir, stepper, entityLabel) => {
|
|
|
504
511
|
const targetPath = safePath(targetDir, file.path);
|
|
505
512
|
mkdirSync(dirname(targetPath), { recursive: true });
|
|
506
513
|
writeFileSync(targetPath, file.content, "utf-8");
|
|
507
|
-
|
|
508
|
-
|
|
514
|
+
const relativePath = relative(providerDir, targetPath).replace(/\\/g, "/");
|
|
515
|
+
stepper.item(relativePath);
|
|
516
|
+
return relativePath;
|
|
509
517
|
});
|
|
510
518
|
stepper.succeed(`${entityLabel} was integrated (${writtenFiles.length} file(s))`);
|
|
511
519
|
return {
|
|
@@ -955,6 +963,11 @@ var providerPrefixes = [
|
|
|
955
963
|
".codeium/",
|
|
956
964
|
".cody/"
|
|
957
965
|
];
|
|
966
|
+
var providerSkillPathPattern = /^\.?\/?(?:claude|cursor|copilot|aider|codeium|cody)\/skills\/[^/]+\/(.+)/;
|
|
967
|
+
var toRelativeSkillPath = (ref) => {
|
|
968
|
+
const normalized = ref.replace(/^\.\//, "");
|
|
969
|
+
return providerSkillPathPattern.exec(normalized)?.[1];
|
|
970
|
+
};
|
|
958
971
|
var isExcluded = (ref) => {
|
|
959
972
|
const normalized = ref.replace(/^\.\//, "");
|
|
960
973
|
return ref.startsWith("http://") || ref.startsWith("https://") || ref.startsWith("/") || ref.includes("..") || /\{[^}]+\}/.test(ref) || providerPrefixes.some((prefix) => normalized.startsWith(prefix));
|
|
@@ -965,11 +978,10 @@ var parseSkillRefs = (content, fileDir) => {
|
|
|
965
978
|
const stripped = stripCodeBlocks(content);
|
|
966
979
|
const collect = (pattern) => {
|
|
967
980
|
for (const match of stripped.matchAll(pattern)) {
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
}
|
|
981
|
+
const raw = match[1];
|
|
982
|
+
const skillRelative = toRelativeSkillPath(raw);
|
|
983
|
+
if (skillRelative) refs.add(posix.normalize(posix.join(fileDir, skillRelative)));
|
|
984
|
+
else if (!isExcluded(raw)) refs.add(posix.normalize(posix.join(fileDir, raw)));
|
|
973
985
|
}
|
|
974
986
|
};
|
|
975
987
|
collect(markdownLinkPattern);
|
|
@@ -1165,7 +1177,7 @@ var installSkillFlow = async (identifier, stepper, startedAt) => {
|
|
|
1165
1177
|
const remainingFiles = collectRemainingFiles(downloadDir);
|
|
1166
1178
|
const { newFiles, conflictFiles } = detectConflicts(remainingFiles, skillProviderDir);
|
|
1167
1179
|
let result;
|
|
1168
|
-
if (conflictFiles.length === 0) result = copyFilesToProvider(newFiles, skillProviderDir, stepper, "Skill");
|
|
1180
|
+
if (conflictFiles.length === 0) result = copyFilesToProvider(newFiles, skillProviderDir, providerFullPath, stepper, "Skill");
|
|
1169
1181
|
else {
|
|
1170
1182
|
const model = providerName === "claude" ? "sonnet" : void 0;
|
|
1171
1183
|
const embedded = {
|
|
@@ -1239,7 +1251,7 @@ var installSkillsetFlow = async (input, stepper, startedAt) => {
|
|
|
1239
1251
|
const remainingFiles = collectRemainingFiles(downloadDir);
|
|
1240
1252
|
const { newFiles, conflictFiles } = detectConflicts(remainingFiles, providerFullPath);
|
|
1241
1253
|
let result;
|
|
1242
|
-
if (conflictFiles.length === 0) result = copyFilesToProvider(newFiles, providerFullPath, stepper, "Skillset");
|
|
1254
|
+
if (conflictFiles.length === 0) result = copyFilesToProvider(newFiles, providerFullPath, providerFullPath, stepper, "Skillset");
|
|
1243
1255
|
else {
|
|
1244
1256
|
const model = skillset.provider === "claude" ? "sonnet" : void 0;
|
|
1245
1257
|
const embedded = {
|
|
@@ -1358,7 +1370,7 @@ var banner = (version) => [
|
|
|
1358
1370
|
].join("\n");
|
|
1359
1371
|
//#endregion
|
|
1360
1372
|
//#region src/bin/spm.ts
|
|
1361
|
-
var version = "0.4.
|
|
1373
|
+
var version = "0.4.2";
|
|
1362
1374
|
var program = new Command();
|
|
1363
1375
|
var gray = "\x1B[90m";
|
|
1364
1376
|
var reset = "\x1B[0m";
|