@brucewaynedecoy/make-docs 2.0.5 → 2.0.7

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.
Files changed (43) hide show
  1. package/dist/{backup-2OT4A6LR.js → backup-M5RBOM6F.js} +4 -4
  2. package/dist/{chunk-VMKG3H4B.js → chunk-3ZFX5456.js} +2 -2
  3. package/dist/{chunk-46MGH32G.js → chunk-5WR4D6HH.js} +2 -2
  4. package/dist/{chunk-UNR4CYVX.js → chunk-65TAUWTC.js} +3 -3
  5. package/dist/{chunk-I4FADOUK.js → chunk-7AVGITZK.js} +2 -2
  6. package/dist/{chunk-CLSOY7NV.js → chunk-B6HJRHWL.js} +179 -103
  7. package/dist/chunk-B6HJRHWL.js.map +1 -0
  8. package/dist/{chunk-HXWD2EUD.js → chunk-C67WJWVP.js} +278 -74
  9. package/dist/chunk-C67WJWVP.js.map +1 -0
  10. package/dist/{chunk-CCYP5NU2.js → chunk-O27AYYF3.js} +3 -3
  11. package/dist/{chunk-XDSWX4Y4.js → chunk-OSS4NT6N.js} +88 -8
  12. package/dist/chunk-OSS4NT6N.js.map +1 -0
  13. package/dist/{chunk-CMNKQM7L.js → chunk-YJLVHT4J.js} +3 -3
  14. package/dist/{chunk-ISSMVKIA.js → chunk-Z4KZ4JTE.js} +2 -2
  15. package/dist/index.js +397 -36
  16. package/dist/index.js.map +1 -1
  17. package/dist/{registry-PC5GKAKM.js → registry-7L26WFZP.js} +7 -7
  18. package/dist/{self-WYVXO23B.js → self-4HOKEXBV.js} +7 -7
  19. package/dist/{server-BQOG6FTA.js → server-VXVGDWRY.js} +13 -9
  20. package/dist/server-VXVGDWRY.js.map +1 -0
  21. package/dist/{setup-system-KN7FTTLT.js → setup-system-CJESBAQ5.js} +7 -7
  22. package/dist/{skills-command-KEW7MOEW.js → skills-command-YXPOHXI2.js} +6 -6
  23. package/dist/{uninstall-45XF4CHD.js → uninstall-R2QK7XPK.js} +7 -7
  24. package/dist/{virtual_make-docs-first-party-skills-ECJESFL2.js → virtual_make-docs-first-party-skills-POWW3OI3.js} +2 -2
  25. package/dist/{virtual_make-docs-first-party-skills-ECJESFL2.js.map → virtual_make-docs-first-party-skills-POWW3OI3.js.map} +1 -1
  26. package/package.json +1 -1
  27. package/dist/chunk-CLSOY7NV.js.map +0 -1
  28. package/dist/chunk-HXWD2EUD.js.map +0 -1
  29. package/dist/chunk-XDSWX4Y4.js.map +0 -1
  30. package/dist/server-BQOG6FTA.js.map +0 -1
  31. /package/dist/{backup-2OT4A6LR.js.map → backup-M5RBOM6F.js.map} +0 -0
  32. /package/dist/{chunk-VMKG3H4B.js.map → chunk-3ZFX5456.js.map} +0 -0
  33. /package/dist/{chunk-46MGH32G.js.map → chunk-5WR4D6HH.js.map} +0 -0
  34. /package/dist/{chunk-UNR4CYVX.js.map → chunk-65TAUWTC.js.map} +0 -0
  35. /package/dist/{chunk-I4FADOUK.js.map → chunk-7AVGITZK.js.map} +0 -0
  36. /package/dist/{chunk-CCYP5NU2.js.map → chunk-O27AYYF3.js.map} +0 -0
  37. /package/dist/{chunk-CMNKQM7L.js.map → chunk-YJLVHT4J.js.map} +0 -0
  38. /package/dist/{chunk-ISSMVKIA.js.map → chunk-Z4KZ4JTE.js.map} +0 -0
  39. /package/dist/{registry-PC5GKAKM.js.map → registry-7L26WFZP.js.map} +0 -0
  40. /package/dist/{self-WYVXO23B.js.map → self-4HOKEXBV.js.map} +0 -0
  41. /package/dist/{setup-system-KN7FTTLT.js.map → setup-system-CJESBAQ5.js.map} +0 -0
  42. /package/dist/{skills-command-KEW7MOEW.js.map → skills-command-YXPOHXI2.js.map} +0 -0
  43. /package/dist/{uninstall-45XF4CHD.js.map → uninstall-R2QK7XPK.js.map} +0 -0
@@ -7,18 +7,19 @@ import {
7
7
  prepareInstallationRemoval,
8
8
  pruneInstallationParents,
9
9
  removeInstallationPath
10
- } from "./chunk-VMKG3H4B.js";
10
+ } from "./chunk-3ZFX5456.js";
11
11
  import {
12
12
  NO_ACCESS,
13
13
  getFirstPartyHarnessAdapter,
14
14
  validateHarnessMethodSelection
15
- } from "./chunk-ISSMVKIA.js";
15
+ } from "./chunk-Z4KZ4JTE.js";
16
16
  import {
17
17
  CONFLICTS_RELATIVE_DIR,
18
18
  DEFAULT_SYSTEM_ASSET_MATERIALIZATION_MODE,
19
19
  HARNESS_TO_INSTRUCTION,
20
20
  INSTRUCTION_KINDS,
21
21
  MANIFEST_RELATIVE_PATH,
22
+ PROJECT_RESOURCE_TYPES,
22
23
  RETIRED_PLAYBOOK_CONTRACT_HASH,
23
24
  RETIRED_PLAYBOOK_CONTRACT_PATH,
24
25
  TEMPLATE_ROOT,
@@ -75,7 +76,7 @@ import {
75
76
  withInstallationOperation,
76
77
  writeContentFile,
77
78
  writeManifest
78
- } from "./chunk-HXWD2EUD.js";
79
+ } from "./chunk-C67WJWVP.js";
79
80
 
80
81
  // src/config.ts
81
82
  import { existsSync, readFileSync } from "fs";
@@ -115,6 +116,7 @@ var TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
115
116
  "generatedProse",
116
117
  "harnessCapabilities",
117
118
  "harnessIntegrations",
119
+ "resourceProjection",
118
120
  "prd_authority"
119
121
  ]);
120
122
  var LABEL_GROUP_KEYS = /* @__PURE__ */ new Set(["lifecycle", "documentKinds", "coordinates"]);
@@ -300,6 +302,13 @@ function loadMakeDocsConfig(targetDir) {
300
302
  applyPersonas(parsed.personas, config, configPath, diagnostics);
301
303
  applyHarnessCapabilities(parsed.harnessCapabilities, config, configPath, diagnostics);
302
304
  applyHarnessIntegrations(parsed.harnessIntegrations, config, configPath, diagnostics);
305
+ if (parsed.resourceProjection !== void 0) {
306
+ if (!Array.isArray(parsed.resourceProjection) || parsed.resourceProjection.some((type) => !PROJECT_RESOURCE_TYPES.includes(type)) || new Set(parsed.resourceProjection).size !== parsed.resourceProjection.length) {
307
+ diagnostics.push({ code: "invalid-type", filePath: configPath, keyPath: "resourceProjection", message: "resourceProjection must be a list of distinct system resource types." });
308
+ } else {
309
+ config.resourceProjection = [...parsed.resourceProjection];
310
+ }
311
+ }
303
312
  if (diagnostics.length > 0) {
304
313
  return invalidConfigResult(configPath, diagnostics);
305
314
  }
@@ -325,7 +334,8 @@ function planProjectHarnessIntegrationWrite(input) {
325
334
  const beforeContent = existsSync(configPath) ? readFileSync(configPath, "utf8") : null;
326
335
  const updated = updateProjectHarnessIntegrationsYaml(
327
336
  beforeContent ?? input.contentWhenMissing,
328
- input.reviewed
337
+ input.reviewed,
338
+ input.reviewedResourceProjection
329
339
  );
330
340
  return {
331
341
  configPath,
@@ -335,10 +345,11 @@ function planProjectHarnessIntegrationWrite(input) {
335
345
  reviewed: input.reviewed.map((record) => ({
336
346
  ...record,
337
347
  ...record.accessCeiling ? { accessCeiling: { ...record.accessCeiling } } : {}
338
- }))
348
+ })),
349
+ ...input.reviewedResourceProjection !== void 0 ? { reviewedResourceProjection: [...input.reviewedResourceProjection] } : {}
339
350
  };
340
351
  }
341
- function updateProjectHarnessIntegrationsYaml(raw, reviewed) {
352
+ function updateProjectHarnessIntegrationsYaml(raw, reviewed, reviewedResourceProjection) {
342
353
  const document = parseDocument(raw);
343
354
  if (document.errors.length > 0) {
344
355
  throw new Error(`Invalid make-docs config YAML: ${document.errors.map((error) => error.message).join("; ")}`);
@@ -396,6 +407,19 @@ function updateProjectHarnessIntegrationsYaml(raw, reviewed) {
396
407
  setYamlScalar(access, "project", record.accessCeiling.project);
397
408
  setYamlScalar(access, "hostConfig", record.accessCeiling.hostConfig);
398
409
  }
410
+ if (reviewedResourceProjection !== void 0) {
411
+ if (reviewedResourceProjection.some((type) => !PROJECT_RESOURCE_TYPES.includes(type)) || new Set(reviewedResourceProjection).size !== reviewedResourceProjection.length) {
412
+ throw new Error("Reviewed resource projection has an invalid or duplicate type.");
413
+ }
414
+ const existing = getYamlMapValueNode(document.contents, "resourceProjection");
415
+ if (existing !== void 0 && existing !== null && !isSeq(existing)) {
416
+ throw new Error("resourceProjection must be a YAML sequence.");
417
+ }
418
+ const current = isSeq(existing) ? existing.items.map((item) => isScalar(item) ? item.value : null) : null;
419
+ if (!current || current.length !== reviewedResourceProjection.length || current.some((type, index) => type !== reviewedResourceProjection[index])) {
420
+ document.set("resourceProjection", document.createNode([...reviewedResourceProjection]));
421
+ }
422
+ }
399
423
  const content = document.toString();
400
424
  return { content, changed: content !== raw };
401
425
  }
@@ -1011,7 +1035,7 @@ function cloneMcpToolMetadata(metadata) {
1011
1035
  // src/install.ts
1012
1036
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
1013
1037
  import { existsSync as existsSync5, mkdirSync, readFileSync as readFileSync5, symlinkSync } from "fs";
1014
- import path6 from "path";
1038
+ import path7 from "path";
1015
1039
 
1016
1040
  // src/retired-path-helper.ts
1017
1041
  import { existsSync as existsSync2, lstatSync, readdirSync, readFileSync as readFileSync2 } from "fs";
@@ -1077,12 +1101,14 @@ function getRetiredResourceReplacement(relativePath) {
1077
1101
  }
1078
1102
 
1079
1103
  // src/planner.ts
1080
- import { existsSync as existsSync4, lstatSync as lstatSync3, readFileSync as readFileSync4, readdirSync as readdirSync3, readlinkSync, statSync as statSync2 } from "fs";
1081
- import path5 from "path";
1104
+ import { existsSync as existsSync4, lstatSync as lstatSync4, readFileSync as readFileSync4, readdirSync as readdirSync3, readlinkSync, statSync as statSync2 } from "fs";
1105
+ import path6 from "path";
1082
1106
  import { homedir } from "os";
1083
1107
 
1084
1108
  // src/project-projection.ts
1085
1109
  import { Buffer as Buffer2 } from "buffer";
1110
+ import { lstatSync as lstatSync3 } from "fs";
1111
+ import path5 from "path";
1086
1112
 
1087
1113
  // src/operations/resource/provider.ts
1088
1114
  import { createHash } from "crypto";
@@ -1745,6 +1771,23 @@ var RESOURCE_PROJECTION_AUTHORITIES = Object.freeze({
1745
1771
  function normalizeProjectResourceSelection(values) {
1746
1772
  return Array.from(new Set(values)).sort(compareCodeUnits2);
1747
1773
  }
1774
+ function inferLocalResourceProjection(targetDir) {
1775
+ const provider = unwrapProvider(loadInstalledSystemResourceProvider());
1776
+ const types = [];
1777
+ for (const type of PROJECT_RESOURCE_TYPES) {
1778
+ const resources = provider.resources.filter((resource) => resource.identity.type === type);
1779
+ if (resources.length === 0) continue;
1780
+ let present = 0;
1781
+ for (const resource of resources) {
1782
+ const relativePath = projectionPath(type, resource.identity.path);
1783
+ assertManagedPathHasNoSymlinks(targetDir, relativePath);
1784
+ if (lstatSync3(path5.join(targetDir, relativePath), { throwIfNoEntry: false })?.isFile()) present += 1;
1785
+ }
1786
+ if (present > 0 && present < resources.length) return { status: "partial", types };
1787
+ if (present === resources.length) types.push(type);
1788
+ }
1789
+ return { status: types.length ? "complete" : "none", types };
1790
+ }
1748
1791
  function buildSelectedResourceProjection(options) {
1749
1792
  const selectedTypes = normalizeProjectResourceSelection(
1750
1793
  options.profile.selections.resourceProjection ?? []
@@ -2186,7 +2229,16 @@ async function createInstallPlan(options) {
2186
2229
  });
2187
2230
  continue;
2188
2231
  }
2189
- if (asset.sourceId.startsWith("resource:") && !hasVerifiedResourceOwnership(existingManifest, asset.relativePath, asset.sourceId)) {
2232
+ const conflictClassification = classifyReviewableManagedFileConflictPath(
2233
+ asset.relativePath,
2234
+ { isDesiredSkillAsset: desiredSkillFileSet.has(asset.relativePath) }
2235
+ );
2236
+ const conflictResolution = getManagedFileConflictResolution(
2237
+ asset.relativePath,
2238
+ conflictClassification,
2239
+ managedFileConflictResolutions
2240
+ );
2241
+ if (asset.sourceId.startsWith("resource:") && !hasVerifiedResourceOwnership(existingManifest, asset.relativePath, asset.sourceId) && !conflictResolution) {
2190
2242
  conflictsRunId ??= createRunId();
2191
2243
  actions.push({
2192
2244
  type: "skip-conflict",
@@ -2210,6 +2262,18 @@ async function createInstallPlan(options) {
2210
2262
  });
2211
2263
  continue;
2212
2264
  }
2265
+ if (isInstructionPath(asset.relativePath) && manifestEntry?.ownershipClass === "project-owned" && manifestEntry.sourceId === asset.sourceId && currentHash !== null && currentHash === manifestEntry.hash && parseManagedBlock(currentContent).state === "valid" && managedFileConflictResolutions?.[asset.relativePath] !== "overwrite") {
2266
+ desiredFiles[asset.relativePath] = manifestEntry;
2267
+ actions.push({
2268
+ type: "noop",
2269
+ relativePath: asset.relativePath,
2270
+ sourceId: asset.sourceId,
2271
+ reviewedConflictResolution: "skip",
2272
+ contentHash: currentHash,
2273
+ reason: "Preserve the verified project-owned router block."
2274
+ });
2275
+ continue;
2276
+ }
2213
2277
  const migrationContent = getInstructionMigrationContent(
2214
2278
  asset,
2215
2279
  currentContent,
@@ -2238,15 +2302,6 @@ async function createInstallPlan(options) {
2238
2302
  });
2239
2303
  continue;
2240
2304
  }
2241
- const conflictClassification = classifyReviewableManagedFileConflictPath(
2242
- asset.relativePath,
2243
- { isDesiredSkillAsset: desiredSkillFileSet.has(asset.relativePath) }
2244
- );
2245
- const conflictResolution = getManagedFileConflictResolution(
2246
- asset.relativePath,
2247
- conflictClassification,
2248
- managedFileConflictResolutions
2249
- );
2250
2305
  if (conflictClassification && conflictResolution === "overwrite") {
2251
2306
  const content = getPlannedUpdateContent(asset, currentContent);
2252
2307
  actions.push({
@@ -2263,18 +2318,20 @@ async function createInstallPlan(options) {
2263
2318
  if (conflictClassification && conflictResolution === "skip") {
2264
2319
  const resourceUri = asset.sourceId.startsWith("resource:") ? asset.sourceId.slice("resource:".length) : null;
2265
2320
  const projectedResource = resourceUri ? selectedProjection.state.resources[resourceUri] : void 0;
2266
- if (manifestEntry && resourceUri && currentHash !== null && projectedResource?.managedDestination === asset.relativePath) {
2321
+ if (currentHash !== null && (options.adopt || manifestEntry && resourceUri && projectedResource?.managedDestination === asset.relativePath)) {
2267
2322
  desiredFiles[asset.relativePath] = {
2268
2323
  hash: currentHash,
2269
2324
  sourceId: asset.sourceId,
2270
2325
  ownershipClass: "project-owned"
2271
2326
  };
2272
- selectedProjection.state.resources[resourceUri] = {
2273
- ...projectedResource,
2274
- ownershipClass: "project-owned",
2275
- installedDigest: currentHash,
2276
- lastVerifiedAt: verifiedAt
2277
- };
2327
+ if (resourceUri && projectedResource?.managedDestination === asset.relativePath) {
2328
+ selectedProjection.state.resources[resourceUri] = {
2329
+ ...projectedResource,
2330
+ ownershipClass: "project-owned",
2331
+ installedDigest: currentHash,
2332
+ lastVerifiedAt: verifiedAt
2333
+ };
2334
+ }
2278
2335
  forceManifestWrite = true;
2279
2336
  actions.push({
2280
2337
  type: "noop",
@@ -2338,7 +2395,7 @@ async function createInstallPlan(options) {
2338
2395
  try {
2339
2396
  assertManagedPathHasNoSymlinks(targetDir, relativePath);
2340
2397
  const retiredPath = relativePathToTarget(targetDir, relativePath);
2341
- clean = hasTrustedRetiredPlaybookContractOwnership(manifestEntry) && (!existsSync4(retiredPath) || lstatSync3(retiredPath).isFile() && hashText(readTextFile(retiredPath)) === RETIRED_PLAYBOOK_CONTRACT_HASH);
2398
+ clean = hasTrustedRetiredPlaybookContractOwnership(manifestEntry) && (!existsSync4(retiredPath) || lstatSync4(retiredPath).isFile() && hashText(readTextFile(retiredPath)) === RETIRED_PLAYBOOK_CONTRACT_HASH);
2342
2399
  } catch {
2343
2400
  }
2344
2401
  actions.push({
@@ -2355,7 +2412,7 @@ async function createInstallPlan(options) {
2355
2412
  assertManagedPathHasNoSymlinks(targetDir, relativePath);
2356
2413
  }
2357
2414
  if (isPreservedLegacyPlaybook(relativePath) && existsSync4(absolutePath)) {
2358
- if (!lstatSync3(absolutePath).isFile()) {
2415
+ if (!lstatSync4(absolutePath).isFile()) {
2359
2416
  conflictsRunId ??= createRunId();
2360
2417
  actions.push({
2361
2418
  type: "skip-conflict",
@@ -2403,7 +2460,7 @@ async function createInstallPlan(options) {
2403
2460
  actions.push(action);
2404
2461
  continue;
2405
2462
  }
2406
- if (!lstatSync3(absolutePath).isFile()) {
2463
+ if (!lstatSync4(absolutePath).isFile()) {
2407
2464
  conflictsRunId ??= createRunId();
2408
2465
  actions.push({
2409
2466
  type: "skip-conflict",
@@ -2525,6 +2582,24 @@ async function createInstallPlan(options) {
2525
2582
  ...resourceProjectionStops(annotatedActions),
2526
2583
  ...annotatedActions.filter((action) => action.reason?.includes("managed block is malformed")).map((action) => action.relativePath)
2527
2584
  ])).sort();
2585
+ const routerOwnership = createRouterOwnershipManifestState(profile, routerAssets, {
2586
+ packageMeta,
2587
+ verifiedAt,
2588
+ existingState: existingManifest?.routerOwnership
2589
+ });
2590
+ for (const [relativePath, router] of Object.entries(routerOwnership.routers)) {
2591
+ const file2 = desiredFiles[relativePath];
2592
+ if (file2?.ownershipClass === "project-owned") {
2593
+ router.ownershipClass = "project-owned";
2594
+ router.installedHash = file2.hash;
2595
+ router.adoptionReceipt = existingManifest?.routerOwnership?.routers[relativePath]?.adoptionReceipt ?? {
2596
+ receiptId: hashText(`portable-router:${relativePath}:${file2.hash}`),
2597
+ adoptedAt: verifiedAt,
2598
+ priorOwnershipClass: existingManifest ? "managed-snapshot" : "unregistered",
2599
+ evidenceRefs: [`project-file:${relativePath}`]
2600
+ };
2601
+ }
2602
+ }
2528
2603
  return {
2529
2604
  packageName: packageMeta.name,
2530
2605
  packageVersion: packageMeta.version,
@@ -2535,11 +2610,7 @@ async function createInstallPlan(options) {
2535
2610
  desiredSkillFiles: desiredSkillFiles.sort(),
2536
2611
  conflictsRunId,
2537
2612
  operation,
2538
- routerOwnership: createRouterOwnershipManifestState(profile, routerAssets, {
2539
- packageMeta,
2540
- verifiedAt,
2541
- existingState: existingManifest?.routerOwnership
2542
- }),
2613
+ routerOwnership,
2543
2614
  resourceProjection: selectedProjection.state,
2544
2615
  classificationSnapshot: createLifecyclePlanSnapshot(
2545
2616
  targetDir,
@@ -2673,7 +2744,7 @@ function planDesiredSkillAsset(options) {
2673
2744
  const { targetDir, asset, existingManifest, existingSkillFiles, previousSkillContent } = options;
2674
2745
  const root = asset.relativePath.match(/^(.*(?:^|\/)(?:\.make-docs\/agentics|\.agents|\.claude|\.codex)\/skills\/[^/]+)(?:\/|$)/)?.[1];
2675
2746
  const guardedRoots = [...new Set((isSkillExposureAsset(asset) ? [asset.relativePath, asset.skillExposure.canonicalPayloadPath] : [root]).filter((p) => !!p))];
2676
- if (guardedRoots.some((root2) => lstatSync3(relativePathToTarget(targetDir, root2), { throwIfNoEntry: false }) && !Object.keys(existingManifest?.files ?? {}).some((p) => p === root2 || p.startsWith(root2 + "/")) && ![...existingSkillFiles].some((p) => p === root2 || p.startsWith(root2 + "/")))) {
2747
+ if (guardedRoots.some((root2) => lstatSync4(relativePathToTarget(targetDir, root2), { throwIfNoEntry: false }) && !Object.keys(existingManifest?.files ?? {}).some((p) => p === root2 || p.startsWith(root2 + "/")) && ![...existingSkillFiles].some((p) => p === root2 || p.startsWith(root2 + "/")))) {
2677
2748
  return {
2678
2749
  type: "skip-conflict",
2679
2750
  relativePath: asset.relativePath,
@@ -2810,13 +2881,13 @@ function planDesiredSkillExposure(options) {
2810
2881
  }
2811
2882
  function isCleanOwnedSkillCopy(targetDir, asset, manifest) {
2812
2883
  const absolute = relativePathToTarget(targetDir, asset.relativePath);
2813
- if (!manifest || !lstatSync3(absolute).isDirectory()) return false;
2884
+ if (!manifest || !lstatSync4(absolute).isDirectory()) return false;
2814
2885
  const canonicalRoot = asset.skillExposure.canonicalPayloadPath;
2815
2886
  const expected = Object.keys(manifest.files).filter((p) => p.startsWith(canonicalRoot + "/"));
2816
2887
  const files = [];
2817
2888
  const visit = (directory) => readdirSync3(directory, { withFileTypes: true }).every((entry) => {
2818
- const target = path5.join(directory, entry.name);
2819
- const ownedPath = canonicalRoot + "/" + path5.relative(absolute, target).split(path5.sep).join("/");
2889
+ const target = path6.join(directory, entry.name);
2890
+ const ownedPath = canonicalRoot + "/" + path6.relative(absolute, target).split(path6.sep).join("/");
2820
2891
  if (entry.isDirectory()) return expected.some((p) => p.startsWith(ownedPath + "/")) && visit(target);
2821
2892
  if (!entry.isFile()) return false;
2822
2893
  files.push(target);
@@ -2825,8 +2896,8 @@ function isCleanOwnedSkillCopy(targetDir, asset, manifest) {
2825
2896
  if (!visit(absolute)) return false;
2826
2897
  if (files.length !== expected.length) return false;
2827
2898
  return files.every((p) => {
2828
- if (!lstatSync3(p).isFile()) return false;
2829
- const canonicalPath = canonicalRoot + "/" + path5.relative(absolute, p).split(path5.sep).join("/");
2899
+ if (!lstatSync4(p).isFile()) return false;
2900
+ const canonicalPath = canonicalRoot + "/" + path6.relative(absolute, p).split(path6.sep).join("/");
2830
2901
  const entry = manifest.files[canonicalPath];
2831
2902
  return entry !== void 0 && hashText(readFileSync4(p)) === entry.hash;
2832
2903
  });
@@ -2842,7 +2913,7 @@ function planStaleSkillFile(options) {
2842
2913
  sourceId: manifestEntry?.sourceId ?? `skill:${relativePath}`
2843
2914
  };
2844
2915
  }
2845
- const stats = lstatSync3(absolutePath);
2916
+ const stats = lstatSync4(absolutePath);
2846
2917
  if (!stats.isFile()) {
2847
2918
  if ((manifestEntry?.skillExposure || isSkillExposurePath(relativePath)) && (manifestEntry?.skillExposure && isCleanOwnedSkillCopy(targetDir, { relativePath, skillExposure: manifestEntry.skillExposure }, existingManifest) || isManagedSkillExposurePath(
2848
2919
  absolutePath,
@@ -2911,17 +2982,17 @@ async function getPreviousSkillContentByPath(existingManifest) {
2911
2982
  }
2912
2983
  function classifyExistingSkillExposure(targetDir, asset) {
2913
2984
  const absolutePath = relativePathToTarget(targetDir, asset.relativePath);
2914
- const stats = lstatSync3(absolutePath);
2985
+ const stats = lstatSync4(absolutePath);
2915
2986
  if (stats.isSymbolicLink()) {
2916
- const currentTarget = path5.resolve(
2917
- path5.dirname(absolutePath),
2987
+ const currentTarget = path6.resolve(
2988
+ path6.dirname(absolutePath),
2918
2989
  readlinkSync(absolutePath)
2919
2990
  );
2920
2991
  const expectedTarget = relativePathToTarget(
2921
2992
  targetDir,
2922
2993
  asset.skillExposure.canonicalPayloadPath
2923
2994
  );
2924
- return path5.resolve(currentTarget) === path5.resolve(expectedTarget) ? "symlink" : "conflict";
2995
+ return path6.resolve(currentTarget) === path6.resolve(expectedTarget) ? "symlink" : "conflict";
2925
2996
  }
2926
2997
  if (!stats.isDirectory()) {
2927
2998
  return "conflict";
@@ -2933,7 +3004,7 @@ function classifyExistingSkillExposure(targetDir, asset) {
2933
3004
  }
2934
3005
  function isCleanManifestOwnedLegacySkillExposureDirectory(targetDir, relativePath, existingManifest) {
2935
3006
  const absolutePath = relativePathToTarget(targetDir, relativePath);
2936
- if (!existingManifest || !existsSync4(absolutePath) || !lstatSync3(absolutePath).isDirectory()) {
3007
+ if (!existingManifest || !existsSync4(absolutePath) || !lstatSync4(absolutePath).isDirectory()) {
2937
3008
  return false;
2938
3009
  }
2939
3010
  const descendantPaths = listDescendantFilePaths(absolutePath).map(
@@ -2955,7 +3026,7 @@ function isLegacySkillSourceId(sourceId) {
2955
3026
  }
2956
3027
  function isCleanLegacySkillExposureDirectory(targetDir, relativePath, previousSkillContent) {
2957
3028
  const absolutePath = relativePathToTarget(targetDir, relativePath);
2958
- if (!existsSync4(absolutePath) || !lstatSync3(absolutePath).isDirectory()) {
3029
+ if (!existsSync4(absolutePath) || !lstatSync4(absolutePath).isDirectory()) {
2959
3030
  return false;
2960
3031
  }
2961
3032
  const descendantPaths = listDescendantFilePaths(absolutePath).map(
@@ -2971,7 +3042,7 @@ function isCleanLegacySkillExposureDirectory(targetDir, relativePath, previousSk
2971
3042
  }
2972
3043
  function copyMirrorMatches(copyMirrorAssets, targetDir, exposurePath) {
2973
3044
  const absoluteExposurePath = relativePathToTarget(targetDir, exposurePath);
2974
- if (!existsSync4(absoluteExposurePath) || !lstatSync3(absoluteExposurePath).isDirectory()) {
3045
+ if (!existsSync4(absoluteExposurePath) || !lstatSync4(absoluteExposurePath).isDirectory()) {
2975
3046
  return false;
2976
3047
  }
2977
3048
  const expectedContentByPath = new Map(
@@ -2991,7 +3062,7 @@ function copyMirrorMatches(copyMirrorAssets, targetDir, exposurePath) {
2991
3062
  function listDescendantFilePaths(root) {
2992
3063
  const entries = readdirSync3(root, { withFileTypes: true });
2993
3064
  return entries.flatMap((entry) => {
2994
- const entryPath = path5.join(root, entry.name);
3065
+ const entryPath = path6.join(root, entry.name);
2995
3066
  if (entry.isDirectory()) {
2996
3067
  return listDescendantFilePaths(entryPath);
2997
3068
  }
@@ -3002,7 +3073,7 @@ function listDescendantFilePaths(root) {
3002
3073
  });
3003
3074
  }
3004
3075
  function isManagedSkillExposurePath(absolutePath, targetDir, relativePath, previousSkillContent, manifestSkillExposure) {
3005
- const stats = lstatSync3(absolutePath);
3076
+ const stats = lstatSync4(absolutePath);
3006
3077
  if (stats.isSymbolicLink()) {
3007
3078
  if (manifestSkillExposure?.canonicalPayloadPath) {
3008
3079
  return skillExposureSymlinkTargetMatches(
@@ -3016,9 +3087,9 @@ function isManagedSkillExposurePath(absolutePath, targetDir, relativePath, previ
3016
3087
  return stats.isDirectory() && isCleanLegacySkillExposureDirectory(targetDir, relativePath, previousSkillContent);
3017
3088
  }
3018
3089
  function skillExposureSymlinkTargetMatches(absolutePath, targetDir, canonicalPayloadPath) {
3019
- const currentTarget = path5.resolve(path5.dirname(absolutePath), readlinkSync(absolutePath));
3090
+ const currentTarget = path6.resolve(path6.dirname(absolutePath), readlinkSync(absolutePath));
3020
3091
  const expectedTarget = relativePathToTarget(targetDir, canonicalPayloadPath);
3021
- return path5.resolve(currentTarget) === path5.resolve(expectedTarget);
3092
+ return path6.resolve(currentTarget) === path6.resolve(expectedTarget);
3022
3093
  }
3023
3094
  function skillExposureDescendantsMatch(targetDir, relativePath, previousSkillContent) {
3024
3095
  const absolutePath = relativePathToTarget(targetDir, relativePath);
@@ -3034,7 +3105,7 @@ function skillExposureDescendantsMatch(targetDir, relativePath, previousSkillCon
3034
3105
  });
3035
3106
  }
3036
3107
  function normalizeSkillDescendantPath(targetDir, skillRootPath, descendantPath) {
3037
- return path5.isAbsolute(skillRootPath) ? normalizePlanPath(descendantPath) : normalizePlanPath(path5.relative(targetDir, descendantPath));
3108
+ return path6.isAbsolute(skillRootPath) ? normalizePlanPath(descendantPath) : normalizePlanPath(path6.relative(targetDir, descendantPath));
3038
3109
  }
3039
3110
  function isSkillExposurePath(relativePath) {
3040
3111
  const normalizedPath = normalizePlanPath(relativePath);
@@ -3133,7 +3204,7 @@ function classifyReviewableManagedFileConflictPath(relativePath, options = {}) {
3133
3204
  };
3134
3205
  }
3135
3206
  function getInstructionKindForPath(relativePath) {
3136
- const basename = path5.posix.basename(relativePath);
3207
+ const basename = path6.posix.basename(relativePath);
3137
3208
  return INSTRUCTION_KINDS.includes(basename) ? basename : null;
3138
3209
  }
3139
3210
  function isSkillAssetPath(relativePath) {
@@ -3208,7 +3279,7 @@ function getSkillExposureHash(asset) {
3208
3279
  JSON.stringify({
3209
3280
  canonicalPayloadPath: normalizePlanPath(asset.skillExposure.canonicalPayloadPath),
3210
3281
  copyMirrorHashes: asset.copyMirrorAssets.map((copyAsset) => [
3211
- normalizePlanPath(path5.relative(asset.relativePath, copyAsset.relativePath)),
3282
+ normalizePlanPath(path6.relative(asset.relativePath, copyAsset.relativePath)),
3212
3283
  hashText(copyAsset.content)
3213
3284
  ]),
3214
3285
  exposurePath: normalizePlanPath(asset.skillExposure.exposurePath),
@@ -3254,6 +3325,9 @@ function getInstructionMigrationContent(asset, currentContent, manifestEntry, cu
3254
3325
  if (!isInstructionPath(asset.relativePath)) {
3255
3326
  return null;
3256
3327
  }
3328
+ if (manifestEntry?.ownershipClass === "project-owned") {
3329
+ return null;
3330
+ }
3257
3331
  const currentBlock = parseManagedBlock(currentContent);
3258
3332
  if (currentBlock.state !== "absent") {
3259
3333
  if (currentBlock.state === "valid" && currentHash !== null && manifestEntry?.hash === currentHash) {
@@ -3335,15 +3409,15 @@ function isLegacySamePathSource(sourceId, relativePath) {
3335
3409
  return sourceId === `file:${relativePath}` || sourceId === `build:${relativePath}`;
3336
3410
  }
3337
3411
  function schemaOneSurfaceHasPreservedContent(options) {
3338
- const surfaceRoot = path5.join(options.targetDir, options.directory);
3412
+ const surfaceRoot = path6.join(options.targetDir, options.directory);
3339
3413
  if (!existsSync4(surfaceRoot)) return false;
3340
- const surfaceStat = lstatSync3(surfaceRoot);
3414
+ const surfaceStat = lstatSync4(surfaceRoot);
3341
3415
  if (!surfaceStat.isDirectory() || surfaceStat.isSymbolicLink()) return false;
3342
3416
  const visit = (directory) => readdirSync3(directory, { withFileTypes: true }).some((entry) => {
3343
- const absolutePath = path5.join(directory, entry.name);
3417
+ const absolutePath = path6.join(directory, entry.name);
3344
3418
  if (entry.isDirectory()) return visit(absolutePath);
3345
3419
  const relativePath = normalizePlanPath(
3346
- path5.relative(options.targetDir, absolutePath)
3420
+ path6.relative(options.targetDir, absolutePath)
3347
3421
  );
3348
3422
  const manifestEntry = options.manifest.files[relativePath];
3349
3423
  if (!manifestEntry || manifestEntry.ownershipClass === "project-owned") {
@@ -3365,7 +3439,7 @@ function getCarriedOnDemandRouterAssets(options) {
3365
3439
  };
3366
3440
  const assets = [];
3367
3441
  for (const [surface, directory] of Object.entries(surfaceDirectories)) {
3368
- const surfaceExists = existsSync4(path5.join(options.targetDir, directory));
3442
+ const surfaceExists = existsSync4(path6.join(options.targetDir, directory));
3369
3443
  const schemaOneSurfaceNeedsRouters = manifest.schemaVersion === 1 && schemaOneSurfaceHasPreservedContent({
3370
3444
  targetDir: options.targetDir,
3371
3445
  directory,
@@ -3391,8 +3465,8 @@ function assertTextDocumentAsset(asset) {
3391
3465
  function assertStandardSkillLayout(manifest, targetDir, selections) {
3392
3466
  if (selections && (!selections.skills || selections.selectedSkills.length === 0)) return;
3393
3467
  if (targetDir && selections) {
3394
- const oldRoot = path5.join(selections.skillScope === "global" ? homedir() : targetDir, ".make-docs/agentics");
3395
- if (lstatSync3(oldRoot, { throwIfNoEntry: false })) throw new Error(`Existing legacy directory needs inspection and reviewed cutover before Skill changes: ${oldRoot}. Preserve its content. Review named owned Skills with setup skills --adopt-existing <selected names> --dry-run, then --review <digest>. Unowned or unknown legacy content needs an explicit resolution before normal setup.`);
3468
+ const oldRoot = path6.join(selections.skillScope === "global" ? homedir() : targetDir, ".make-docs/agentics");
3469
+ if (lstatSync4(oldRoot, { throwIfNoEntry: false })) throw new Error(`Existing legacy directory needs inspection and reviewed cutover before Skill changes: ${oldRoot}. Preserve its content. Review named owned Skills with setup skills --adopt-existing <selected names> --dry-run, then --review <digest>. Unowned or unknown legacy content needs an explicit resolution before normal setup.`);
3396
3470
  }
3397
3471
  if ((manifest?.skillFiles ?? []).some((p) => /(?:^|\/)\.make-docs\/agentics\/skills(?:\/|$)/.test(p.replace(/\\/g, "/"))) || Object.entries(manifest?.files ?? {}).some(([p, entry]) => /(?:^|\/)\.make-docs\/agentics\/skills(?:\/|$)/.test(p.replace(/\\/g, "/")) || /(?:^|\/)\.make-docs\/agentics\/skills(?:\/|$)/.test(entry.skillExposure?.canonicalPayloadPath ?? ""))) {
3398
3472
  throw new Error("Legacy Skill layout needs reviewed cutover. Run setup skills --adopt-existing <selected names> --dry-run with the same target, scope, and tools; review the result, then repeat with --review <digest>. Existing content is preserved.");
@@ -3421,7 +3495,8 @@ async function planInstall(options) {
3421
3495
  systemAssetMaterializationMode: options.systemAssetMaterializationMode,
3422
3496
  skillRegistry: options.skillRegistry,
3423
3497
  preserveExistingSkills: options.preserveExistingSkills,
3424
- operation: options.operation
3498
+ operation: options.operation,
3499
+ adopt: options.adopt
3425
3500
  });
3426
3501
  }
3427
3502
  async function planSkillsOnlyInstall(options) {
@@ -3653,8 +3728,8 @@ function prepareInstallAction(targetDir, plan, action, conflictFiles) {
3653
3728
  }
3654
3729
  if (action.type === "remove-managed") return prepareInstallationRemoval(targetDir, action.relativePath);
3655
3730
  if (action.type === "skip-conflict" && action.content !== void 0 && plan.conflictsRunId) {
3656
- const relative = path6.join(CONFLICTS_RELATIVE_DIR, plan.conflictsRunId, toConflictRelativePath(action.relativePath));
3657
- const conflictPath = path6.join(targetDir, relative);
3731
+ const relative = path7.join(CONFLICTS_RELATIVE_DIR, plan.conflictsRunId, toConflictRelativePath(action.relativePath));
3732
+ const conflictPath = path7.join(targetDir, relative);
3658
3733
  return [preparePlannedFileChange(targetDir, relative, { kind: "file", content: action.content }, () => {
3659
3734
  writeContentFile(conflictPath, action.content);
3660
3735
  conflictFiles.push(conflictPath);
@@ -3729,13 +3804,13 @@ function applyAction(options) {
3729
3804
  }
3730
3805
  case "skip-conflict": {
3731
3806
  if (action.content !== void 0 && plan.conflictsRunId) {
3732
- const conflictPath = path6.join(
3807
+ const conflictPath = path7.join(
3733
3808
  targetDir,
3734
3809
  CONFLICTS_RELATIVE_DIR,
3735
3810
  plan.conflictsRunId,
3736
3811
  toConflictRelativePath(action.relativePath)
3737
3812
  );
3738
- recordPlannedFileChange(targetDir, path6.relative(targetDir, conflictPath), { kind: "file", content: action.content }, () => writeContentFile(conflictPath, action.content));
3813
+ recordPlannedFileChange(targetDir, path7.relative(targetDir, conflictPath), { kind: "file", content: action.content }, () => writeContentFile(conflictPath, action.content));
3739
3814
  conflictFiles.push(conflictPath);
3740
3815
  }
3741
3816
  return;
@@ -3809,10 +3884,10 @@ function writeCopyMirror(assets, targetDir) {
3809
3884
  }
3810
3885
  for (const asset of assets) {
3811
3886
  const parents = [];
3812
- let parent = path6.dirname(asset.relativePath);
3813
- while (!existsSync5(relativePathToTarget(targetDir, parent)) && parent !== "." && parent !== path6.dirname(parent)) {
3887
+ let parent = path7.dirname(asset.relativePath);
3888
+ while (!existsSync5(relativePathToTarget(targetDir, parent)) && parent !== "." && parent !== path7.dirname(parent)) {
3814
3889
  parents.unshift(parent);
3815
- parent = path6.dirname(parent);
3890
+ parent = path7.dirname(parent);
3816
3891
  }
3817
3892
  for (const directory of parents) recordPlannedFileChange(targetDir, directory, { kind: "directory" }, () => mkdirSync(relativePathToTarget(targetDir, directory)));
3818
3893
  recordPlannedFileChange(targetDir, asset.relativePath, { kind: "file", content: asset.content }, () => writeContentFile(relativePathToTarget(targetDir, asset.relativePath), asset.content));
@@ -3823,25 +3898,25 @@ function pruneRemovedManagedPathParents(targetDir, relativePath, absolutePath) {
3823
3898
  if (!boundary) {
3824
3899
  return;
3825
3900
  }
3826
- pruneInstallationParents(targetDir, path6.dirname(absolutePath), boundary);
3901
+ pruneInstallationParents(targetDir, path7.dirname(absolutePath), boundary);
3827
3902
  }
3828
3903
  function getRemoveManagedPruneBoundary(targetDir, relativePath, absolutePath) {
3829
- if (relativePath === ".make-docs/scripts/check_path_hygiene.py") return path6.join(targetDir, ".make-docs");
3830
- if (!path6.isAbsolute(relativePath)) {
3904
+ if (relativePath === ".make-docs/scripts/check_path_hygiene.py") return path7.join(targetDir, ".make-docs");
3905
+ if (!path7.isAbsolute(relativePath)) {
3831
3906
  return targetDir;
3832
3907
  }
3833
3908
  return getGlobalSelectedAgenticsPruneBoundary(absolutePath);
3834
3909
  }
3835
3910
  function getGlobalSelectedAgenticsPruneBoundary(absolutePath) {
3836
- const currentRoots = [path6.join(homedir2(), ".agents/skills"), getHarnessSkillDirectory("codex", "global"), getHarnessSkillDirectory("claude-code", "global")];
3837
- const root = currentRoots.find((root2) => absolutePath.startsWith(root2 + path6.sep));
3838
- if (root) return path6.dirname(root);
3839
- const segments = path6.resolve(absolutePath).split(path6.sep);
3911
+ const currentRoots = [path7.join(homedir2(), ".agents/skills"), getHarnessSkillDirectory("codex", "global"), getHarnessSkillDirectory("claude-code", "global")];
3912
+ const root = currentRoots.find((root2) => absolutePath.startsWith(root2 + path7.sep));
3913
+ if (root) return path7.dirname(root);
3914
+ const segments = path7.resolve(absolutePath).split(path7.sep);
3840
3915
  const agenticsIndex = segments.lastIndexOf("agentics");
3841
3916
  if (agenticsIndex < 1 || segments[agenticsIndex - 1] !== ".make-docs") {
3842
3917
  return null;
3843
3918
  }
3844
- return segments.slice(0, agenticsIndex).join(path6.sep) || path6.sep;
3919
+ return segments.slice(0, agenticsIndex).join(path7.sep) || path7.sep;
3845
3920
  }
3846
3921
  function compareReviewableManagedFileConflicts(left, right) {
3847
3922
  const leftGroup = MANAGED_FILE_CONFLICT_GROUP_ORDER[left.group];
@@ -3859,25 +3934,25 @@ var MANAGED_FILE_CONFLICT_GROUP_ORDER = {
3859
3934
  function toConflictRelativePath(relativePath) {
3860
3935
  const segments = relativePath.split(/[/\\]+/).filter(Boolean);
3861
3936
  const safeSegments = segments.filter((segment) => segment !== "." && segment !== "..");
3862
- if (path6.isAbsolute(relativePath)) {
3937
+ if (path7.isAbsolute(relativePath)) {
3863
3938
  const [first, ...rest] = safeSegments;
3864
3939
  const drive = first?.replace(/:$/, "");
3865
- return path6.join("__absolute__", ...drive ? [drive, ...rest] : rest);
3940
+ return path7.join("__absolute__", ...drive ? [drive, ...rest] : rest);
3866
3941
  }
3867
- return path6.join(...safeSegments);
3942
+ return path7.join(...safeSegments);
3868
3943
  }
3869
3944
  function toErrorMessage(error) {
3870
3945
  return error instanceof Error ? error.message : String(error);
3871
3946
  }
3872
3947
 
3873
3948
  // src/skills-adoption.ts
3874
- import { lstatSync as lstatSync4, readFileSync as readFileSync6, readdirSync as readdirSync4, readlinkSync as readlinkSync2 } from "fs";
3875
- import path7 from "path";
3949
+ import { lstatSync as lstatSync5, readFileSync as readFileSync6, readdirSync as readdirSync4, readlinkSync as readlinkSync2 } from "fs";
3950
+ import path8 from "path";
3876
3951
  import os from "os";
3877
3952
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "util";
3878
3953
  var OPERATION = "setup.skills.adopt";
3879
3954
  var missing = () => ({ kind: "missing" });
3880
- var normalized = (p) => p.split(path7.sep).join("/");
3955
+ var normalized = (p) => p.split(path8.sep).join("/");
3881
3956
  var under = (p, root) => p === root || p.startsWith(root + "/");
3882
3957
  var depth = (p) => p.split("/").length;
3883
3958
  function canonical(value) {
@@ -3897,7 +3972,7 @@ function file(content, mode = 420) {
3897
3972
  }
3898
3973
  function inspect(root, p) {
3899
3974
  const absolute = relativePathToTarget(root, p);
3900
- const st = lstatSync4(absolute, { throwIfNoEntry: false });
3975
+ const st = lstatSync5(absolute, { throwIfNoEntry: false });
3901
3976
  if (!st) return missing();
3902
3977
  if (st.isSymbolicLink()) return { kind: "symlink", target: readlinkSync2(absolute) };
3903
3978
  if (st.isDirectory()) return { kind: "directory", mode: st.mode & 511 };
@@ -3919,13 +3994,13 @@ function snapshot(root, roots, exact) {
3919
3994
  function checkParents(root, roots) {
3920
3995
  const issues = [];
3921
3996
  for (const p of roots) {
3922
- let parent = path7.dirname(relativePathToTarget(root, p));
3923
- while (parent !== path7.dirname(parent)) {
3924
- const st = lstatSync4(parent, { throwIfNoEntry: false });
3997
+ let parent = path8.dirname(relativePathToTarget(root, p));
3998
+ while (parent !== path8.dirname(parent)) {
3999
+ const st = lstatSync5(parent, { throwIfNoEntry: false });
3925
4000
  if (st?.isSymbolicLink()) issues.push(`Unsafe link parent: ${parent}.`);
3926
4001
  if (st && !st.isDirectory()) issues.push(`Non-directory parent: ${parent}.`);
3927
4002
  if (parent === root || parent === os.homedir()) break;
3928
- parent = path7.dirname(parent);
4003
+ parent = path8.dirname(parent);
3929
4004
  }
3930
4005
  }
3931
4006
  return [...new Set(issues)];
@@ -3933,13 +4008,13 @@ function checkParents(root, roots) {
3933
4008
  function skillRoot(p) {
3934
4009
  return p.match(/^(.*(?:^|\/)(?:\.make-docs\/agentics|\.agents|\.claude|\.codex)\/skills\/[^/]+)(?:\/|$)/)?.[1] ?? null;
3935
4010
  }
3936
- var legacySkillRoot = (p) => p.startsWith(".make-docs/agentics/skills/") || path7.isAbsolute(p) && [os.homedir(), canonicalInstallationPath(os.homedir())].some((home) => p.startsWith(normalized(path7.join(home, ".make-docs/agentics/skills")) + "/"));
4011
+ var legacySkillRoot = (p) => p.startsWith(".make-docs/agentics/skills/") || path8.isAbsolute(p) && [os.homedir(), canonicalInstallationPath(os.homedir())].some((home) => p.startsWith(normalized(path8.join(home, ".make-docs/agentics/skills")) + "/"));
3937
4012
  function addParents(map, before, p, boundary) {
3938
- let parent = normalized(path7.dirname(p));
4013
+ let parent = normalized(path8.dirname(p));
3939
4014
  while (under(parent, boundary)) {
3940
4015
  map[parent] ??= before[parent]?.kind === "directory" ? before[parent] : { kind: "directory", mode: 493 };
3941
4016
  if (parent === boundary) break;
3942
- parent = normalized(path7.dirname(parent));
4017
+ parent = normalized(path8.dirname(parent));
3943
4018
  }
3944
4019
  }
3945
4020
  function setAsset(map, before, asset, boundary) {
@@ -3983,7 +4058,7 @@ async function buildSkillAdoptionReview(options) {
3983
4058
  const exposures = assets.filter((a) => a.kind === "skill-exposure");
3984
4059
  const payloads = assets.filter((a) => a.kind !== "skill-exposure");
3985
4060
  const roots = [...new Set([...assets.map((a) => a.kind === "skill-exposure" ? a.relativePath : skillRoot(a.relativePath)), ...(beforeLedger?.skillFiles ?? []).map((p) => beforeLedger?.files[p]?.skillExposure ? p : skillRoot(p))].filter((p) => p !== null))].sort();
3986
- const legacyContainers = [".make-docs/agentics", ...selections.skillScope === "global" || beforeLedger?.selections.skillScope === "global" ? [normalized(path7.join(os.homedir(), ".make-docs/agentics"))] : []];
4061
+ const legacyContainers = [".make-docs/agentics", ...selections.skillScope === "global" || beforeLedger?.selections.skillScope === "global" ? [normalized(path8.join(os.homedir(), ".make-docs/agentics"))] : []];
3987
4062
  const unownedLegacy = [];
3988
4063
  for (const container of legacyContainers) {
3989
4064
  const parentIssues = checkParents(targetRoot, [container]);
@@ -4012,7 +4087,7 @@ async function buildSkillAdoptionReview(options) {
4012
4087
  for (const claim of claims) if (canonicalInstallationPath(claim.rootPath) !== targetRoot || claim.kind === "pending") blockers.push(`Another ${claim.kind === "pending" ? "pending operation" : "checkout owner"} claims ${claim.path}: ${claim.rootPath}${claim.operationId ? ` (${claim.operationId})` : ""}.`);
4013
4088
  const after = {};
4014
4089
  const cleanupPaths = [];
4015
- for (const oldRoot of roots.filter(legacySkillRoot)) if (!names.includes(path7.basename(oldRoot))) blockers.push(`Legacy Skill ${path7.basename(oldRoot)} must be named in --adopt-existing for its reviewed layout cutover.`);
4090
+ for (const oldRoot of roots.filter(legacySkillRoot)) if (!names.includes(path8.basename(oldRoot))) blockers.push(`Legacy Skill ${path8.basename(oldRoot)} must be named in --adopt-existing for its reviewed layout cutover.`);
4016
4091
  for (const oldName of beforeLedger?.selections.selectedSkills ?? []) if (!selections.selectedSkills.includes(oldName)) blockers.push(`Adoption cannot also deselect ${oldName}. Use normal setup skills to remove it, then create a new adoption review.`);
4017
4092
  const alternatives = {};
4018
4093
  const known = /* @__PURE__ */ new Set([...payloads.map((a) => a.relativePath), ...exposures.flatMap((a) => a.copyMirrorAssets.map((f) => f.relativePath)), ...Object.keys(beforeLedger?.files ?? {}).filter((p) => skillRoot(p))]);
@@ -4084,7 +4159,7 @@ async function buildSkillAdoptionReview(options) {
4084
4159
  const prior = owned?.skillExposure;
4085
4160
  const desired = exposures.find((exposure) => exposure.relativePath === action.relativePath);
4086
4161
  const current = before[action.relativePath];
4087
- const reviewedLegacyRetarget = prior && desired && current?.kind === "symlink" && prior.mode === "symlink" && current.target === prior.symlinkTarget && names.includes(prior.skillName) && beforeLedger?.skillFiles?.includes(action.relativePath) && owned.sourceId === desired.sourceId && prior.exposurePath === action.relativePath && prior.skillName === desired.skillExposure.skillName && prior.installName === desired.skillExposure.installName && prior.harness === desired.skillExposure.harness && prior.scope === desired.skillExposure.scope && legacySkillRoot(prior.canonicalPayloadPath) && roots.includes(prior.canonicalPayloadPath) && path7.resolve(path7.dirname(relativePathToTarget(targetRoot, action.relativePath)), prior.symlinkTarget) === path7.resolve(targetRoot, prior.canonicalPayloadPath);
4162
+ const reviewedLegacyRetarget = prior && desired && current?.kind === "symlink" && prior.mode === "symlink" && current.target === prior.symlinkTarget && names.includes(prior.skillName) && beforeLedger?.skillFiles?.includes(action.relativePath) && owned.sourceId === desired.sourceId && prior.exposurePath === action.relativePath && prior.skillName === desired.skillExposure.skillName && prior.installName === desired.skillExposure.installName && prior.harness === desired.skillExposure.harness && prior.scope === desired.skillExposure.scope && legacySkillRoot(prior.canonicalPayloadPath) && roots.includes(prior.canonicalPayloadPath) && path8.resolve(path8.dirname(relativePathToTarget(targetRoot, action.relativePath)), prior.symlinkTarget) === path8.resolve(targetRoot, prior.canonicalPayloadPath);
4088
4163
  if (!adoptedRoots.has(root) || owned && !reviewedLegacyRetarget) blockers.push(`Protected managed or unselected adoption conflict: ${action.relativePath}.`);
4089
4164
  }
4090
4165
  if (action.type === "remove-managed") delete desiredFiles[action.relativePath];
@@ -4097,7 +4172,7 @@ async function buildSkillAdoptionReview(options) {
4097
4172
  const backupRoot = `.make-docs/backup/skill-adoption-${inventoryDigest.slice(0, 12)}`;
4098
4173
  const backups = [];
4099
4174
  for (const [p, old] of Object.entries(before)) if (old.kind === "file" && roots.some((root) => under(p, root)) && !same(old, after[p] ?? missing())) {
4100
- const destination = backupRoot + "/" + (path7.isAbsolute(p) ? "_global/" + p.replace(/^\/+/, "") : p);
4175
+ const destination = backupRoot + "/" + (path8.isAbsolute(p) ? "_global/" + p.replace(/^\/+/, "") : p);
4101
4176
  backups.push({ source: p, destination, digest: old.digest });
4102
4177
  after[destination] = old;
4103
4178
  addParents(after, before, destination, backupRoot);
@@ -4108,20 +4183,20 @@ async function buildSkillAdoptionReview(options) {
4108
4183
  before[backupRoot] = existingBackup;
4109
4184
  }
4110
4185
  for (const p of Object.keys(after)) {
4111
- let parent = normalized(path7.dirname(p));
4186
+ let parent = normalized(path8.dirname(p));
4112
4187
  while (parent !== "." && parent !== "/" && !roots.some((r) => under(parent, r))) {
4113
- if (path7.isAbsolute(parent) && !roots.some((r) => r.startsWith(parent + "/"))) break;
4114
- if (path7.isAbsolute(parent) && parent === os.homedir()) break;
4115
- if (path7.isAbsolute(parent) && parent === path7.join(os.homedir(), ".make-docs")) break;
4188
+ if (path8.isAbsolute(parent) && !roots.some((r) => r.startsWith(parent + "/"))) break;
4189
+ if (path8.isAbsolute(parent) && parent === os.homedir()) break;
4190
+ if (path8.isAbsolute(parent) && parent === path8.join(os.homedir(), ".make-docs")) break;
4116
4191
  const current = inspect(targetRoot, parent);
4117
4192
  before[parent] ??= current;
4118
4193
  if (current.kind === "missing") after[parent] ??= { kind: "directory", mode: 493 };
4119
4194
  else if (current.kind === "directory") after[parent] ??= current;
4120
4195
  else blockers.push(`Unsafe parent for planned output: ${parent}.`);
4121
- parent = normalized(path7.dirname(parent));
4196
+ parent = normalized(path8.dirname(parent));
4122
4197
  }
4123
4198
  }
4124
- const legacyParents = [...new Set(roots.filter(legacySkillRoot).flatMap((p) => [normalized(path7.dirname(p)), normalized(path7.dirname(path7.dirname(p)))]))].sort((a, b) => depth(b) - depth(a));
4199
+ const legacyParents = [...new Set(roots.filter(legacySkillRoot).flatMap((p) => [normalized(path8.dirname(p)), normalized(path8.dirname(path8.dirname(p)))]))].sort((a, b) => depth(b) - depth(a));
4125
4200
  for (const parent of legacyParents) {
4126
4201
  const inventory = snapshot(targetRoot, [parent], []);
4127
4202
  const unknown = Object.keys(inventory).filter((p) => p !== parent && !legacyParents.includes(p) && !roots.some((r) => under(p, r)));
@@ -4267,6 +4342,7 @@ export {
4267
4342
  getSystemResourceMcpProfiles,
4268
4343
  loadInstalledSystemResourceProvider,
4269
4344
  matchesSystemResourceCatalogPath,
4345
+ inferLocalResourceProjection,
4270
4346
  createRouterOwnershipManifestEntry,
4271
4347
  createProjectSurfaceRouterAssets,
4272
4348
  getThinRouterManagedBody,
@@ -4280,4 +4356,4 @@ export {
4280
4356
  registerSkillAdoptionRecovery,
4281
4357
  applySkillAdoptionReview
4282
4358
  };
4283
- //# sourceMappingURL=chunk-CLSOY7NV.js.map
4359
+ //# sourceMappingURL=chunk-B6HJRHWL.js.map