@theronap/cortex-mcp 0.9.85 → 0.9.86
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/lib/skills.mjs +22 -5
- package/package.json +1 -1
package/lib/skills.mjs
CHANGED
|
@@ -261,7 +261,10 @@ export async function syncOrgSkills(opts = {}) {
|
|
|
261
261
|
|
|
262
262
|
const { install, skipped } = planOrgInstall(served, bundledSkills().map((s) => s.name))
|
|
263
263
|
summary.skipped = skipped
|
|
264
|
-
|
|
264
|
+
// Only a cache written by this personal-sync implementation owns local files it may retire. An
|
|
265
|
+
// older/cache-shaped-alike file is not proof of ownership; treating it as one deleted source
|
|
266
|
+
// skills that had not yet been accepted by the server. First sync after an upgrade is additive.
|
|
267
|
+
const prevNames = cache?.version === 1 && Array.isArray(cache?.installed) ? cache.installed : []
|
|
265
268
|
const currentNames = install.map((s) => s.name)
|
|
266
269
|
const removeNames = prevNames.filter((n) => !currentNames.includes(n))
|
|
267
270
|
|
|
@@ -345,7 +348,7 @@ export async function syncPersonalSkills(opts = {}) {
|
|
|
345
348
|
}
|
|
346
349
|
if (summary.source === 'server') {
|
|
347
350
|
ensureDir(dirname(PERSONAL_CACHE))
|
|
348
|
-
writeFileSync(PERSONAL_CACHE, JSON.stringify({ fetchedAt: new Date().toISOString(), skills: served, installed: currentNames }, null, 2))
|
|
351
|
+
writeFileSync(PERSONAL_CACHE, JSON.stringify({ version: 1, fetchedAt: new Date().toISOString(), skills: served, installed: currentNames }, null, 2))
|
|
349
352
|
}
|
|
350
353
|
|
|
351
354
|
const changed = [...new Set([...summary.installed, ...summary.repaired])]
|
|
@@ -452,9 +455,23 @@ export async function runSkillsPush(argv) {
|
|
|
452
455
|
|
|
453
456
|
export function discoverSkillFiles(root) {
|
|
454
457
|
if (!root || !existsSync(root)) return []
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
+
const out = []
|
|
459
|
+
const walk = (dir) => {
|
|
460
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
461
|
+
if (!entry.isDirectory() || entry.name.startsWith('.')) continue
|
|
462
|
+
const child = join(dir, entry.name)
|
|
463
|
+
const skill = join(child, 'SKILL.md')
|
|
464
|
+
if (existsSync(skill)) out.push(skill)
|
|
465
|
+
walk(child)
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
walk(root)
|
|
469
|
+
// Prefer a direct skill over an equally named nested vendor copy. This gives a user override
|
|
470
|
+
// priority while still discovering bundled sub-skills such as gstack's long-form workflows.
|
|
471
|
+
return out.sort((a, b) => {
|
|
472
|
+
const depth = (path) => path.slice(root.length).split('/').filter(Boolean).length
|
|
473
|
+
return depth(a) - depth(b) || a.localeCompare(b)
|
|
474
|
+
})
|
|
458
475
|
}
|
|
459
476
|
|
|
460
477
|
// `skills import --from claude` is the deliberate migration command. It uploads only the user's
|