@dyml/skill-manager 1.0.4 → 1.0.6
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/skill-manager.mjs +44 -34
- package/package.json +1 -1
package/dist/skill-manager.mjs
CHANGED
|
@@ -26564,14 +26564,24 @@ async function findPluginSkillDirs(dirPath, maxDepth = 6) {
|
|
|
26564
26564
|
}
|
|
26565
26565
|
return skillDirs;
|
|
26566
26566
|
}
|
|
26567
|
+
function extractPluginName(skillPath, pluginsCacheDir) {
|
|
26568
|
+
const relativePath = path2.relative(pluginsCacheDir, skillPath);
|
|
26569
|
+
const parts = relativePath.split(path2.sep);
|
|
26570
|
+
if (parts.length > 0) {
|
|
26571
|
+
return parts[0];
|
|
26572
|
+
}
|
|
26573
|
+
return void 0;
|
|
26574
|
+
}
|
|
26567
26575
|
async function scanPluginsCache() {
|
|
26568
26576
|
const skills = [];
|
|
26569
26577
|
const pluginsDir = getPluginsCacheDir();
|
|
26570
26578
|
try {
|
|
26571
26579
|
const skillDirs = await findPluginSkillDirs(pluginsDir);
|
|
26572
26580
|
for (const skillDir of skillDirs) {
|
|
26581
|
+
const pluginName = extractPluginName(skillDir, pluginsDir);
|
|
26573
26582
|
const skill = await scanSkill(skillDir, "system", "plugins");
|
|
26574
26583
|
if (skill) {
|
|
26584
|
+
skill.pluginName = pluginName;
|
|
26575
26585
|
skills.push(skill);
|
|
26576
26586
|
}
|
|
26577
26587
|
}
|
|
@@ -26714,7 +26724,10 @@ function SkillTable({ skills, selectedIndex, width, maxVisibleRows = 15 }) {
|
|
|
26714
26724
|
locationDisplay = truncatePath(skill.path, pathWidth);
|
|
26715
26725
|
locationColor = "blue";
|
|
26716
26726
|
} else {
|
|
26717
|
-
if (skill.source === "plugins") {
|
|
26727
|
+
if (skill.source === "plugins" && skill.pluginName) {
|
|
26728
|
+
locationDisplay = `Plugin/${skill.pluginName}`;
|
|
26729
|
+
locationColor = "magenta";
|
|
26730
|
+
} else if (skill.source === "plugins") {
|
|
26718
26731
|
locationDisplay = "Plugin";
|
|
26719
26732
|
locationColor = "magenta";
|
|
26720
26733
|
} else if (skill.source === "agents") {
|
|
@@ -26788,7 +26801,7 @@ function StatusBar({ selectedSkill, width }) {
|
|
|
26788
26801
|
// src/ui/components/ActionBar.tsx
|
|
26789
26802
|
var import_react25 = __toESM(require_react(), 1);
|
|
26790
26803
|
function ActionBar({ canUninstall, canUpdate }) {
|
|
26791
|
-
return /* @__PURE__ */ import_react25.default.createElement(Box_default, { paddingX: 1, gap: 2 }, /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "cyan" }, "[i]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u5B89\u88C5")), canUninstall && /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "red" }, "[d]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u5378\u8F7D")), canUpdate && /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "
|
|
26804
|
+
return /* @__PURE__ */ import_react25.default.createElement(Box_default, { paddingX: 1, gap: 2 }, /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "cyan" }, "[i]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u5B89\u88C5")), canUninstall && /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "red" }, "[d]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u5378\u8F7D")), canUpdate && /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "green" }, "[p]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u66F4\u65B0\u9009\u4E2D")), /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "cyan" }, "[v]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u8BE6\u60C5")), /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "cyan" }, "[s]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u641C\u7D22")), /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "cyan" }, "[r]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u5237\u65B0")), /* @__PURE__ */ import_react25.default.createElement(Text, null, /* @__PURE__ */ import_react25.default.createElement(Text, { bold: true, color: "cyan" }, "[q]"), /* @__PURE__ */ import_react25.default.createElement(Text, { dimColor: true }, " \u9000\u51FA")));
|
|
26792
26805
|
}
|
|
26793
26806
|
|
|
26794
26807
|
// src/ui/components/TabBar.tsx
|
|
@@ -26982,45 +26995,34 @@ function execSafe2(command, args, cwd2, timeout) {
|
|
|
26982
26995
|
if (code === 0) {
|
|
26983
26996
|
resolve({ stdout, stderr });
|
|
26984
26997
|
} else {
|
|
26985
|
-
reject(new Error(
|
|
26998
|
+
reject(new Error(`Command failed (code ${code}): ${stderr || stdout}`));
|
|
26986
26999
|
}
|
|
26987
27000
|
});
|
|
26988
27001
|
});
|
|
26989
27002
|
}
|
|
26990
|
-
function
|
|
26991
|
-
|
|
26992
|
-
if (!path4.isAbsolute(resolved)) {
|
|
26993
|
-
return { valid: false, error: "\u9879\u76EE\u8DEF\u5F84\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84" };
|
|
26994
|
-
}
|
|
26995
|
-
if (resolved.includes("..")) {
|
|
26996
|
-
return { valid: false, error: "\u65E0\u6548\u7684\u8DEF\u5F84" };
|
|
26997
|
-
}
|
|
26998
|
-
return { valid: true };
|
|
26999
|
-
}
|
|
27000
|
-
async function updateAllSkills(projectRoot = process.cwd()) {
|
|
27001
|
-
const validation = validatePath(projectRoot);
|
|
27002
|
-
if (!validation.valid) {
|
|
27003
|
+
async function updateSkill(skill) {
|
|
27004
|
+
if (skill.location === "system") {
|
|
27003
27005
|
return {
|
|
27004
27006
|
success: false,
|
|
27005
|
-
message:
|
|
27007
|
+
message: "\u7CFB\u7EDF\u7EA7\u6280\u80FD\u65E0\u6CD5\u76F4\u63A5\u66F4\u65B0\uFF0C\u8BF7\u4F7F\u7528 add-skill \u5DE5\u5177\u66F4\u65B0"
|
|
27006
27008
|
};
|
|
27007
27009
|
}
|
|
27008
27010
|
try {
|
|
27009
|
-
logger.info(
|
|
27010
|
-
const { stdout, stderr } = await execSafe2("npx", ["
|
|
27011
|
+
logger.info(`Updating skill: ${skill.name}...`);
|
|
27012
|
+
const { stdout, stderr } = await execSafe2("npx", ["add-skill", skill.name], process.cwd(), 12e4);
|
|
27011
27013
|
if (stderr && !stderr.includes("npm warn")) {
|
|
27012
|
-
logger.warn("
|
|
27014
|
+
logger.warn("Update output:", stderr);
|
|
27013
27015
|
}
|
|
27014
27016
|
return {
|
|
27015
27017
|
success: true,
|
|
27016
|
-
message: stdout.trim() ||
|
|
27018
|
+
message: stdout.trim() || `Skill ${skill.name} updated successfully`
|
|
27017
27019
|
};
|
|
27018
27020
|
} catch (error) {
|
|
27019
27021
|
const message = error instanceof Error ? error.message : String(error);
|
|
27020
|
-
logger.error("
|
|
27022
|
+
logger.error("Update failed:", message);
|
|
27021
27023
|
return {
|
|
27022
27024
|
success: false,
|
|
27023
|
-
message:
|
|
27025
|
+
message: `Failed to update skill ${skill.name}: ${message}`
|
|
27024
27026
|
};
|
|
27025
27027
|
}
|
|
27026
27028
|
}
|
|
@@ -27186,17 +27188,25 @@ function MainScreen() {
|
|
|
27186
27188
|
} else {
|
|
27187
27189
|
setScreen("confirm-uninstall");
|
|
27188
27190
|
}
|
|
27189
|
-
} else if (input === "p") {
|
|
27190
|
-
|
|
27191
|
-
|
|
27192
|
-
|
|
27193
|
-
|
|
27194
|
-
|
|
27195
|
-
|
|
27196
|
-
}
|
|
27197
|
-
|
|
27198
|
-
|
|
27199
|
-
await
|
|
27191
|
+
} else if (input === "p" && selectedSkill) {
|
|
27192
|
+
if (selectedSkill.location === "system") {
|
|
27193
|
+
setMessage({
|
|
27194
|
+
text: "\u7CFB\u7EDF\u7EA7\u6280\u80FD\u65E0\u6CD5\u76F4\u63A5\u66F4\u65B0",
|
|
27195
|
+
type: "error"
|
|
27196
|
+
});
|
|
27197
|
+
setScreen("message");
|
|
27198
|
+
} else {
|
|
27199
|
+
setMessage({ text: `\u6B63\u5728\u66F4\u65B0 ${selectedSkill.name}...`, type: "info" });
|
|
27200
|
+
setScreen("message");
|
|
27201
|
+
const result = await updateSkill(selectedSkill);
|
|
27202
|
+
setMessage({
|
|
27203
|
+
text: result.message,
|
|
27204
|
+
type: result.success ? "success" : "error"
|
|
27205
|
+
});
|
|
27206
|
+
setScreen("message");
|
|
27207
|
+
if (result.success) {
|
|
27208
|
+
await refresh();
|
|
27209
|
+
}
|
|
27200
27210
|
}
|
|
27201
27211
|
} else if (input === "v" && selectedSkill) {
|
|
27202
27212
|
setScreen("detail");
|