teamix-evo 0.6.1 → 0.7.0
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/core/index.js +45 -21
- package/dist/core/index.js.map +1 -1
- package/dist/index.js +154 -183
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/core/index.js
CHANGED
|
@@ -455,7 +455,7 @@ async function writeMirrorContent(targetFile, sourceContent, managedRegions, sou
|
|
|
455
455
|
if (matchedRegions.length === 0) {
|
|
456
456
|
if (existing !== sourceContent) {
|
|
457
457
|
logger.warn(
|
|
458
|
-
`Mirror drift detected at ${targetFile} \u2014 overwriting from source. Edit ${sourceFile} (not the mirror) and re-run \`teamix-evo skills sync\`.`
|
|
458
|
+
`Mirror drift detected at ${targetFile} \u2014 overwriting from source. Edit ${sourceFile} (not the mirror) and re-run \`npx teamix-evo@latest skills sync\`.`
|
|
459
459
|
);
|
|
460
460
|
await writeFileSafe(targetFile, sourceContent);
|
|
461
461
|
return sourceContent;
|
|
@@ -557,34 +557,56 @@ async function rewriteSkillSource(skill, options, summary) {
|
|
|
557
557
|
if (skill.template && targetFile2.endsWith(".hbs")) {
|
|
558
558
|
targetFile2 = targetFile2.slice(0, -4);
|
|
559
559
|
}
|
|
560
|
-
const
|
|
560
|
+
const newContent2 = skill.template && entry.endsWith(".hbs") ? renderTemplate(await loadTemplateFile(entry), { ...data, skill }) : await fs5.readFile(entry, "utf-8");
|
|
561
561
|
const exists2 = await fileExists(targetFile2);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
562
|
+
const written2 = await rewriteSingleFile({
|
|
563
|
+
targetFile: targetFile2,
|
|
564
|
+
newContent: newContent2,
|
|
565
|
+
exists: exists2,
|
|
566
|
+
updateStrategy: skill.updateStrategy,
|
|
567
|
+
managedRegions: skill.managedRegions,
|
|
568
|
+
projectRoot,
|
|
569
|
+
summary
|
|
570
|
+
});
|
|
569
571
|
const relWritten = path7.relative(targetDir, targetFile2);
|
|
570
|
-
records.push(makeSourceRecord(skill, targetFile2,
|
|
572
|
+
records.push(makeSourceRecord(skill, targetFile2, written2, relWritten));
|
|
571
573
|
}
|
|
572
574
|
return records;
|
|
573
575
|
}
|
|
574
576
|
const targetFile = path7.join(targetDir, "SKILL.md");
|
|
575
577
|
const newContent = await renderSkillContent(sourceAbs, skill, data);
|
|
576
578
|
const exists = await fileExists(targetFile);
|
|
577
|
-
|
|
579
|
+
const written = await rewriteSingleFile({
|
|
580
|
+
targetFile,
|
|
581
|
+
newContent,
|
|
582
|
+
exists,
|
|
583
|
+
updateStrategy: skill.updateStrategy,
|
|
584
|
+
managedRegions: skill.managedRegions,
|
|
585
|
+
projectRoot,
|
|
586
|
+
summary
|
|
587
|
+
});
|
|
588
|
+
return [makeSourceRecord(skill, targetFile, written)];
|
|
589
|
+
}
|
|
590
|
+
async function rewriteSingleFile(args) {
|
|
591
|
+
const {
|
|
592
|
+
targetFile,
|
|
593
|
+
newContent,
|
|
594
|
+
exists,
|
|
595
|
+
updateStrategy,
|
|
596
|
+
managedRegions,
|
|
597
|
+
projectRoot,
|
|
598
|
+
summary
|
|
599
|
+
} = args;
|
|
600
|
+
if (updateStrategy === "frozen") {
|
|
578
601
|
if (exists) {
|
|
579
602
|
summary.skipped++;
|
|
580
|
-
|
|
581
|
-
return [makeSourceRecord(skill, targetFile, current2)];
|
|
603
|
+
return await readFileOrNull(targetFile) ?? newContent;
|
|
582
604
|
}
|
|
583
605
|
await writeFileSafe(targetFile, newContent);
|
|
584
606
|
summary.created++;
|
|
585
|
-
return
|
|
607
|
+
return newContent;
|
|
586
608
|
}
|
|
587
|
-
if (
|
|
609
|
+
if (updateStrategy === "regenerable" || !exists) {
|
|
588
610
|
if (exists) {
|
|
589
611
|
await backupFile(targetFile, projectRoot);
|
|
590
612
|
summary.overwritten++;
|
|
@@ -592,11 +614,11 @@ async function rewriteSkillSource(skill, options, summary) {
|
|
|
592
614
|
summary.created++;
|
|
593
615
|
}
|
|
594
616
|
await writeFileSafe(targetFile, newContent);
|
|
595
|
-
return
|
|
617
|
+
return newContent;
|
|
596
618
|
}
|
|
597
619
|
const current = await readFileOrNull(targetFile);
|
|
598
620
|
let merged = current ?? newContent;
|
|
599
|
-
for (const regionId of
|
|
621
|
+
for (const regionId of managedRegions ?? []) {
|
|
600
622
|
const re = new RegExp(
|
|
601
623
|
`<!-- teamix-evo:managed:start id="${escapeRegExp(
|
|
602
624
|
regionId
|
|
@@ -616,10 +638,12 @@ async function rewriteSkillSource(skill, options, summary) {
|
|
|
616
638
|
}
|
|
617
639
|
}
|
|
618
640
|
}
|
|
619
|
-
|
|
620
|
-
|
|
641
|
+
if (merged !== current) {
|
|
642
|
+
await backupFile(targetFile, projectRoot);
|
|
643
|
+
await writeFileSafe(targetFile, merged);
|
|
644
|
+
}
|
|
621
645
|
summary.managed++;
|
|
622
|
-
return
|
|
646
|
+
return merged;
|
|
623
647
|
}
|
|
624
648
|
function escapeRegExp(str) {
|
|
625
649
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -984,7 +1008,7 @@ async function runTokensInit(options) {
|
|
|
984
1008
|
const known = catalog.variants.map((v) => v.name).join(", ");
|
|
985
1009
|
throw new Error(
|
|
986
1010
|
`Unknown variant "${variant}". Available variants: ${known || "(none)"}.
|
|
987
|
-
Run \`teamix-evo tokens list-variants\` to see all options.`
|
|
1011
|
+
Run \`npx teamix-evo@latest tokens list-variants\` to see all options.`
|
|
988
1012
|
);
|
|
989
1013
|
}
|
|
990
1014
|
const existingConfig = await readProjectConfig(projectRoot);
|