greprag 5.85.5 → 5.85.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.
|
@@ -583,12 +583,15 @@ function applyNativeSkillMirror(params) {
|
|
|
583
583
|
const projectRoot = projectDir ? writerOwnedProjectSkillRoot(params.platform, projectDir, homeDir) : null;
|
|
584
584
|
if (projectRoot)
|
|
585
585
|
rootState(projectRoot);
|
|
586
|
+
const keepGlobal = new Set(params.globalRoster || []);
|
|
586
587
|
for (const [root, entry] of roots) {
|
|
587
588
|
if (params.pruneGlobalRoot === false && root === globalRoot)
|
|
588
589
|
continue;
|
|
589
590
|
for (const [skillName, managed] of Object.entries(entry.state.skills)) {
|
|
590
591
|
if (entry.present.has(skillName))
|
|
591
592
|
continue;
|
|
593
|
+
if (root === globalRoot && keepGlobal.has(skillName))
|
|
594
|
+
continue;
|
|
592
595
|
const target = targetPath(root, skillName);
|
|
593
596
|
const currentFiles = (0, skill_mirror_files_1.isSkillFolderOwnedElsewhere)(target) ? null : readManagedFiles(target, managed);
|
|
594
597
|
if (!currentFiles || (0, skill_mirror_files_1.computeSkillFileHash)(currentFiles) !== managed.hash) {
|
|
@@ -668,13 +671,25 @@ async function syncNativeSkillMirror(params) {
|
|
|
668
671
|
throw new Error('skill mirror snapshot incomplete; existing native adapters preserved');
|
|
669
672
|
}
|
|
670
673
|
const skills = fetched;
|
|
674
|
+
// In a project the effective list can hide a replaced global, so the global
|
|
675
|
+
// root is pruned against the plain global list (a skill retired in git).
|
|
676
|
+
let globalRoster;
|
|
677
|
+
if (params.projectId) {
|
|
678
|
+
const globals = await fetch(`${params.apiUrl}/v1/skillmirror?scope=global`, {
|
|
679
|
+
headers: { Authorization: `Bearer ${params.apiKey}` },
|
|
680
|
+
});
|
|
681
|
+
if (!globals.ok)
|
|
682
|
+
throw new Error(`skill mirror list failed: HTTP ${globals.status}`);
|
|
683
|
+
const body = await globals.json();
|
|
684
|
+
globalRoster = (body.skills || []).map(row => row.skillName).filter((n) => typeof n === 'string');
|
|
685
|
+
}
|
|
671
686
|
return applyNativeSkillMirror({
|
|
672
687
|
platform: params.platform,
|
|
673
688
|
skills,
|
|
674
689
|
homeDir: params.homeDir,
|
|
675
690
|
projectDir: params.projectDir,
|
|
676
691
|
prune: true,
|
|
677
|
-
|
|
692
|
+
globalRoster,
|
|
678
693
|
});
|
|
679
694
|
}
|
|
680
695
|
function nativeSkillMirrorSummary(result) {
|
|
@@ -4636,12 +4636,15 @@ function applyNativeSkillMirror(params) {
|
|
|
4636
4636
|
const projectRoot = projectDir ? writerOwnedProjectSkillRoot(params.platform, projectDir, homeDir) : null;
|
|
4637
4637
|
if (projectRoot)
|
|
4638
4638
|
rootState(projectRoot);
|
|
4639
|
+
const keepGlobal = new Set(params.globalRoster || []);
|
|
4639
4640
|
for (const [root, entry] of roots) {
|
|
4640
4641
|
if (params.pruneGlobalRoot === false && root === globalRoot)
|
|
4641
4642
|
continue;
|
|
4642
4643
|
for (const [skillName, managed] of Object.entries(entry.state.skills)) {
|
|
4643
4644
|
if (entry.present.has(skillName))
|
|
4644
4645
|
continue;
|
|
4646
|
+
if (root === globalRoot && keepGlobal.has(skillName))
|
|
4647
|
+
continue;
|
|
4645
4648
|
const target = targetPath(root, skillName);
|
|
4646
4649
|
const currentFiles = isSkillFolderOwnedElsewhere(target) ? null : readManagedFiles(target, managed);
|
|
4647
4650
|
if (!currentFiles || computeSkillFileHash(currentFiles) !== managed.hash) {
|