@cleocode/caamp 2026.10.5 → 2026.10.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.
@@ -251,7 +251,7 @@ function resetExclusivityModeOverride() {
251
251
  import { randomBytes } from "crypto";
252
252
  import { existsSync as existsSync2, lstatSync, readlinkSync } from "fs";
253
253
  import { cp, mkdir, rename, rm, symlink } from "fs/promises";
254
- import { basename, dirname, join as join2 } from "path";
254
+ import { basename, dirname, join as join2, resolve, sep } from "path";
255
255
  import { resolveSkillsRoot } from "@cleocode/core/skills/skill-root.js";
256
256
  async function ensureCanonicalDir() {
257
257
  await mkdir(resolveSkillsRoot(), { recursive: true });
@@ -329,6 +329,18 @@ async function installToCanonical(sourcePath, skillName) {
329
329
  function skillInstallResolves(path) {
330
330
  return existsSync2(join2(path, "SKILL.md")) || existsSync2(path);
331
331
  }
332
+ function isReplaceableEntry(linkPath) {
333
+ let stat3;
334
+ try {
335
+ stat3 = lstatSync(linkPath);
336
+ } catch {
337
+ return true;
338
+ }
339
+ if (!stat3.isSymbolicLink()) return false;
340
+ const target = resolve(dirname(linkPath), readlinkSync(linkPath));
341
+ const root = resolveSkillsRoot();
342
+ return target.startsWith(`${root}${sep}`) || target.includes(`${sep}.cleo${sep}skills${sep}`);
343
+ }
332
344
  function isLinkTo(linkPath, canonicalPath) {
333
345
  try {
334
346
  return lstatSync(linkPath).isSymbolicLink() && readlinkSync(linkPath) === canonicalPath && skillInstallResolves(linkPath);
@@ -353,6 +365,10 @@ async function linkToAgent(canonicalPath, provider, skillName, isGlobal, project
353
365
  anySuccess = true;
354
366
  continue;
355
367
  }
368
+ if (!isReplaceableEntry(linkPath)) {
369
+ errors.push(`${linkPath} exists and is not a CLEO skill link; left unchanged`);
370
+ continue;
371
+ }
356
372
  const stagedPath = siblingPath(linkPath, "staging");
357
373
  const symlinkType = process.platform === "win32" ? "junction" : "dir";
358
374
  let linked = false;
@@ -976,7 +992,7 @@ var PiHarness = class {
976
992
  task.signal.addEventListener("abort", onAbort, { once: true });
977
993
  }
978
994
  }
979
- const exitPromise = new Promise((resolve) => {
995
+ const exitPromise = new Promise((resolve2) => {
980
996
  child.on("close", (exitCode, signal) => {
981
997
  flushStdoutBuffer(true);
982
998
  flushStderrBuffer(true);
@@ -998,7 +1014,7 @@ var PiHarness = class {
998
1014
  };
999
1015
  Promise.allSettled(pendingWrites).then(() => {
1000
1016
  safeOnStream({ kind: "exit", subagentId, payload: result2 });
1001
- resolve(result2);
1017
+ resolve2(result2);
1002
1018
  });
1003
1019
  });
1004
1020
  child.on("error", () => {
@@ -1728,11 +1744,11 @@ async function terminateSubagent(child, graceMs) {
1728
1744
  }
1729
1745
  const pollInterval = Math.min(25, Math.max(1, graceMs));
1730
1746
  const deadline = Date.now() + graceMs;
1731
- await new Promise((resolve) => {
1747
+ await new Promise((resolve2) => {
1732
1748
  const timer = setInterval(() => {
1733
1749
  if (child.exitCode !== null || child.signalCode !== null) {
1734
1750
  clearInterval(timer);
1735
- resolve();
1751
+ resolve2();
1736
1752
  return;
1737
1753
  }
1738
1754
  if (Date.now() >= deadline) {
@@ -1741,12 +1757,12 @@ async function terminateSubagent(child, graceMs) {
1741
1757
  child.kill("SIGKILL");
1742
1758
  } catch {
1743
1759
  }
1744
- resolve();
1760
+ resolve2();
1745
1761
  }
1746
1762
  }, pollInterval);
1747
1763
  child.once("close", () => {
1748
1764
  clearInterval(timer);
1749
- resolve();
1765
+ resolve2();
1750
1766
  });
1751
1767
  });
1752
1768
  }
@@ -4202,8 +4218,8 @@ async function syncGlobalInstructions(options = {}) {
4202
4218
  result.status = "no-providers";
4203
4219
  return result;
4204
4220
  }
4205
- if (options.dryRun) {
4206
- result.status = "dry-run";
4221
+ if (options.dryRun || options.userRequested !== true) {
4222
+ result.status = options.dryRun ? "dry-run" : "refused";
4207
4223
  for (const [path, ids] of targets) {
4208
4224
  result.files.push({ path, providers: ids, action: "planned" });
4209
4225
  }
@@ -5496,4 +5512,4 @@ export {
5496
5512
  recommendSkills2 as recommendSkills,
5497
5513
  validateSkill
5498
5514
  };
5499
- //# sourceMappingURL=chunk-E2QFVEIS.js.map
5515
+ //# sourceMappingURL=chunk-YZ5CCUQX.js.map