@theholocron/cli 3.8.0 → 3.8.1

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/cli.mjs CHANGED
@@ -2693,11 +2693,11 @@ function generateThinCallerContent(name, withOverrides, additionalPaths) {
2693
2693
  if (!base) return "";
2694
2694
  const fmt = (k, v) => ` ${k}: ${v === true ? "true" : v === false ? "false" : String(v)}`;
2695
2695
  let result = base;
2696
- if (additionalPaths && additionalPaths.length > 0) {
2697
- const pathsBlockRe = /( {4}paths:\n)((?:[ ]{6}- [^\n]+\n)+)/;
2698
- const newEntries = additionalPaths.map((p) => ` - ${p}\n`).join("");
2699
- result = result.replace(pathsBlockRe, (_, header, existing) => header + existing + newEntries);
2700
- }
2696
+ if (additionalPaths && additionalPaths.length > 0) result = result.replace(/( {4}paths:\n)((?:[ ]{6}- [^\n]+\n)+)/, (_, header, existing) => {
2697
+ const existingPaths = new Set([...existing.matchAll(/- (.+)/g)].map((m) => m[1]));
2698
+ const newEntries = additionalPaths.filter((p) => !existingPaths.has(p)).map((p) => ` - ${p}\n`).join("");
2699
+ return header + existing + newEntries;
2700
+ });
2701
2701
  if (!withOverrides || Object.keys(withOverrides).length === 0) return result;
2702
2702
  const withBlockRe = /( {4}with:\n)((?:[ ]{6}[^\n]+\n)*)/;
2703
2703
  const existingMatch = result.match(withBlockRe);