@cortask/core 0.2.19 → 0.2.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/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3907,10 +3907,10 @@ async function checkEligibility(skill, credentialStore) {
|
|
|
3907
3907
|
return { eligible: true };
|
|
3908
3908
|
}
|
|
3909
3909
|
async function isBinaryAvailable(name) {
|
|
3910
|
-
const { exec:
|
|
3910
|
+
const { exec: exec3 } = await import("child_process");
|
|
3911
3911
|
const cmd = process.platform === "win32" ? `where ${name}` : `which ${name}`;
|
|
3912
3912
|
return new Promise((resolve) => {
|
|
3913
|
-
|
|
3913
|
+
exec3(cmd, (error) => {
|
|
3914
3914
|
resolve(!error);
|
|
3915
3915
|
});
|
|
3916
3916
|
});
|
|
@@ -3963,7 +3963,7 @@ async function readSkillFile(skillsDir, name) {
|
|
|
3963
3963
|
}
|
|
3964
3964
|
|
|
3965
3965
|
// src/skills/installer.ts
|
|
3966
|
-
import {
|
|
3966
|
+
import { execFile as execFile2 } from "child_process";
|
|
3967
3967
|
import fs13 from "fs/promises";
|
|
3968
3968
|
import path13 from "path";
|
|
3969
3969
|
async function installSkillFromGit(gitUrl, skillsDir) {
|
|
@@ -3972,6 +3972,9 @@ async function installSkillFromGit(gitUrl, skillsDir) {
|
|
|
3972
3972
|
if (!repoName) {
|
|
3973
3973
|
throw new Error(`Invalid git URL: ${gitUrl}`);
|
|
3974
3974
|
}
|
|
3975
|
+
if (!/^(https?:\/\/|git@[\w.-]+:|ssh:\/\/)/.test(gitUrl)) {
|
|
3976
|
+
throw new Error(`Invalid git URL format: ${gitUrl}`);
|
|
3977
|
+
}
|
|
3975
3978
|
const targetDir = path13.join(skillsDir, repoName);
|
|
3976
3979
|
try {
|
|
3977
3980
|
await fs13.access(targetDir);
|
|
@@ -3979,7 +3982,7 @@ async function installSkillFromGit(gitUrl, skillsDir) {
|
|
|
3979
3982
|
} catch (err) {
|
|
3980
3983
|
if (err.message.includes("already installed")) throw err;
|
|
3981
3984
|
}
|
|
3982
|
-
await
|
|
3985
|
+
await execFileAsync("git", ["clone", "--depth", "1", gitUrl, targetDir]);
|
|
3983
3986
|
try {
|
|
3984
3987
|
await fs13.access(path13.join(targetDir, "SKILL.md"));
|
|
3985
3988
|
} catch {
|
|
@@ -4015,9 +4018,9 @@ async function removeSkill(skillName, skillsDir) {
|
|
|
4015
4018
|
clearSkillCache();
|
|
4016
4019
|
logger.info(`Removed skill "${skillName}"`, "skills");
|
|
4017
4020
|
}
|
|
4018
|
-
function
|
|
4021
|
+
function execFileAsync(cmd, args) {
|
|
4019
4022
|
return new Promise((resolve, reject) => {
|
|
4020
|
-
|
|
4023
|
+
execFile2(cmd, args, { timeout: 6e4 }, (error, stdout, stderr) => {
|
|
4021
4024
|
if (error) {
|
|
4022
4025
|
reject(new Error(stderr || error.message));
|
|
4023
4026
|
return;
|
|
@@ -4233,7 +4236,10 @@ var EncryptedCredentialStore = class {
|
|
|
4233
4236
|
if (!this.store) return;
|
|
4234
4237
|
await fs15.mkdir(path14.dirname(this.filePath), { recursive: true });
|
|
4235
4238
|
const tmp = `${this.filePath}.${process.pid}.tmp`;
|
|
4236
|
-
await fs15.writeFile(tmp, JSON.stringify(this.store, null, 2),
|
|
4239
|
+
await fs15.writeFile(tmp, JSON.stringify(this.store, null, 2), {
|
|
4240
|
+
encoding: "utf-8",
|
|
4241
|
+
mode: 384
|
|
4242
|
+
});
|
|
4237
4243
|
await fs15.rename(tmp, this.filePath);
|
|
4238
4244
|
}
|
|
4239
4245
|
async get(key) {
|