u-foo 3.0.20 → 3.0.21
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/package.json
CHANGED
|
@@ -13,6 +13,13 @@ const {
|
|
|
13
13
|
|
|
14
14
|
const MANAGED_BLOCK_START = "# >>> ufoo MCP (managed)";
|
|
15
15
|
const MANAGED_BLOCK_END = "# <<< ufoo MCP (managed)";
|
|
16
|
+
const RETIRED_UFOO_SKILL_NAMES = new Set([
|
|
17
|
+
"ubus",
|
|
18
|
+
"uctx",
|
|
19
|
+
"uinit",
|
|
20
|
+
"ustatus",
|
|
21
|
+
"ufoo-poll",
|
|
22
|
+
]);
|
|
16
23
|
|
|
17
24
|
function tomlString(value = "") {
|
|
18
25
|
return JSON.stringify(String(value || ""));
|
|
@@ -83,10 +90,45 @@ function removeLegacyUfooTransportSections(text = "") {
|
|
|
83
90
|
return next;
|
|
84
91
|
}
|
|
85
92
|
|
|
93
|
+
function removeRetiredUfooSkillConfigBlocks(text = "") {
|
|
94
|
+
const source = String(text || "");
|
|
95
|
+
const tables = [];
|
|
96
|
+
const tablePattern = /^\s*(\[{1,2}[^\]\r\n]+\]{1,2})\s*(?:#.*)?$/gm;
|
|
97
|
+
let match;
|
|
98
|
+
while ((match = tablePattern.exec(source)) !== null) {
|
|
99
|
+
tables.push({
|
|
100
|
+
header: match[1],
|
|
101
|
+
start: match.index,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const ranges = [];
|
|
105
|
+
for (let index = 0; index < tables.length; index += 1) {
|
|
106
|
+
if (tables[index].header !== "[[skills.config]]") continue;
|
|
107
|
+
const start = tables[index].start;
|
|
108
|
+
const end = index + 1 < tables.length ? tables[index + 1].start : source.length;
|
|
109
|
+
const block = source.slice(start, end);
|
|
110
|
+
const pathMatch = block.match(/^\s*path\s*=\s*["']([^"']+)["']\s*(?:#.*)?$/m);
|
|
111
|
+
if (!pathMatch) continue;
|
|
112
|
+
const normalizedPath = pathMatch[1].replace(/\\/g, "/");
|
|
113
|
+
const skillMatch = normalizedPath.match(
|
|
114
|
+
/\/u-foo\/(?:modules\/[^/]+\/)?SKILLS\/([^/]+)\/SKILL\.md$/
|
|
115
|
+
);
|
|
116
|
+
if (skillMatch && RETIRED_UFOO_SKILL_NAMES.has(skillMatch[1])) {
|
|
117
|
+
ranges.push([start, end]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
let next = source;
|
|
121
|
+
for (const [start, end] of ranges.sort((a, b) => b[0] - a[0])) {
|
|
122
|
+
next = `${next.slice(0, start)}${next.slice(end)}`;
|
|
123
|
+
}
|
|
124
|
+
return next;
|
|
125
|
+
}
|
|
126
|
+
|
|
86
127
|
function renderCodexConfig(existing, connection) {
|
|
87
128
|
const withoutManaged = removeManagedBlock(existing);
|
|
88
129
|
const withoutLegacy = removeLegacyUfooTransportSections(withoutManaged);
|
|
89
|
-
const
|
|
130
|
+
const withoutRetiredSkills = removeRetiredUfooSkillConfigBlocks(withoutLegacy);
|
|
131
|
+
const trimmed = withoutRetiredSkills.trimEnd();
|
|
90
132
|
return `${trimmed ? `${trimmed}\n\n` : ""}${buildCodexManagedBlock(connection)}\n`;
|
|
91
133
|
}
|
|
92
134
|
|
|
@@ -173,6 +215,7 @@ module.exports = {
|
|
|
173
215
|
findTomlSections,
|
|
174
216
|
removeLegacyUfooTransportSections,
|
|
175
217
|
removeManagedBlock,
|
|
218
|
+
removeRetiredUfooSkillConfigBlocks,
|
|
176
219
|
renderCodexConfig,
|
|
177
220
|
runMcpConfigureCli,
|
|
178
221
|
};
|