@brucewaynedecoy/make-docs 2.0.7 → 2.0.9

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 (65) hide show
  1. package/dist/{backup-M5RBOM6F.js → backup-EBZZZL74.js} +4 -4
  2. package/dist/{chunk-Z4KZ4JTE.js → chunk-2Z7KRD4H.js} +2 -2
  3. package/dist/{chunk-OSS4NT6N.js → chunk-5XKMSGMS.js} +428 -29
  4. package/dist/{chunk-OSS4NT6N.js.map → chunk-5XKMSGMS.js.map} +1 -1
  5. package/dist/{chunk-O27AYYF3.js → chunk-ABKEBYCF.js} +3 -3
  6. package/dist/{chunk-B6HJRHWL.js → chunk-DZ3SA3JA.js} +70 -12
  7. package/dist/chunk-DZ3SA3JA.js.map +1 -0
  8. package/dist/{chunk-65TAUWTC.js → chunk-HZ4QLB7L.js} +3 -3
  9. package/dist/{chunk-YJLVHT4J.js → chunk-KKXJTVMH.js} +13 -9
  10. package/dist/chunk-KKXJTVMH.js.map +1 -0
  11. package/dist/{chunk-7AVGITZK.js → chunk-MESLJI5A.js} +2 -2
  12. package/dist/{chunk-5WR4D6HH.js → chunk-USVCSYS5.js} +13 -2
  13. package/dist/chunk-USVCSYS5.js.map +1 -0
  14. package/dist/{chunk-3ZFX5456.js → chunk-VCC4D5I3.js} +2 -2
  15. package/dist/{chunk-C67WJWVP.js → chunk-X6TAWRTO.js} +148 -127
  16. package/dist/chunk-X6TAWRTO.js.map +1 -0
  17. package/dist/index.js +41 -24
  18. package/dist/index.js.map +1 -1
  19. package/dist/{registry-7L26WFZP.js → registry-XNCQALXP.js} +7 -7
  20. package/dist/{self-4HOKEXBV.js → self-LDLIIKFW.js} +7 -7
  21. package/dist/{server-VXVGDWRY.js → server-G2UO2NOT.js} +10 -10
  22. package/dist/{server-VXVGDWRY.js.map → server-G2UO2NOT.js.map} +1 -1
  23. package/dist/{setup-system-CJESBAQ5.js → setup-system-2MZMQ3MX.js} +7 -7
  24. package/dist/{skills-command-YXPOHXI2.js → skills-command-VE4GRWI2.js} +53 -17
  25. package/dist/skills-command-VE4GRWI2.js.map +1 -0
  26. package/dist/{uninstall-R2QK7XPK.js → uninstall-EJF6HCYI.js} +7 -7
  27. package/dist/virtual_make-docs-first-party-skills-CLTQEIKC.js +11 -0
  28. package/dist/virtual_make-docs-first-party-skills-CLTQEIKC.js.map +1 -0
  29. package/package.json +1 -1
  30. package/template/.make-docs/system/contracts/design-contract.md +1 -1
  31. package/template/.make-docs/system/contracts/output-contract.md +3 -2
  32. package/template/.make-docs/system/prompts/designs-to-plan-change.prompt.md +2 -2
  33. package/template/.make-docs/system/prompts/prd-change-to-work.prompt.md +2 -2
  34. package/template/.make-docs/system/references/execution-workflow.md +5 -5
  35. package/template/.make-docs/system/references/lifecycle.md +3 -0
  36. package/template/.make-docs/system/references/planning-workflow.md +8 -8
  37. package/template/.make-docs/system/references/prd-change-management.md +2 -2
  38. package/template/.make-docs/system/references/wave-model.md +126 -14
  39. package/template/.make-docs/system/templates/plan-overview.md +17 -2
  40. package/template/.make-docs/system/templates/plan-prd-change.md +21 -6
  41. package/template/.make-docs/system/templates/plan-prd-decompose.md +17 -2
  42. package/template/.make-docs/system/templates/plan-prd.md +17 -2
  43. package/template/.make-docs/system/templates/work-index.md +15 -0
  44. package/template/.make-docs/system/templates/work-phase.md +3 -0
  45. package/template/docs/plans/AGENTS.md +1 -1
  46. package/template/docs/plans/CLAUDE.md +1 -1
  47. package/template/docs/work/AGENTS.md +1 -0
  48. package/template/docs/work/CLAUDE.md +1 -0
  49. package/dist/chunk-5WR4D6HH.js.map +0 -1
  50. package/dist/chunk-B6HJRHWL.js.map +0 -1
  51. package/dist/chunk-C67WJWVP.js.map +0 -1
  52. package/dist/chunk-YJLVHT4J.js.map +0 -1
  53. package/dist/skills-command-YXPOHXI2.js.map +0 -1
  54. package/dist/virtual_make-docs-first-party-skills-POWW3OI3.js +0 -11
  55. package/dist/virtual_make-docs-first-party-skills-POWW3OI3.js.map +0 -1
  56. /package/dist/{backup-M5RBOM6F.js.map → backup-EBZZZL74.js.map} +0 -0
  57. /package/dist/{chunk-Z4KZ4JTE.js.map → chunk-2Z7KRD4H.js.map} +0 -0
  58. /package/dist/{chunk-O27AYYF3.js.map → chunk-ABKEBYCF.js.map} +0 -0
  59. /package/dist/{chunk-65TAUWTC.js.map → chunk-HZ4QLB7L.js.map} +0 -0
  60. /package/dist/{chunk-7AVGITZK.js.map → chunk-MESLJI5A.js.map} +0 -0
  61. /package/dist/{chunk-3ZFX5456.js.map → chunk-VCC4D5I3.js.map} +0 -0
  62. /package/dist/{registry-7L26WFZP.js.map → registry-XNCQALXP.js.map} +0 -0
  63. /package/dist/{self-4HOKEXBV.js.map → self-LDLIIKFW.js.map} +0 -0
  64. /package/dist/{setup-system-CJESBAQ5.js.map → setup-system-2MZMQ3MX.js.map} +0 -0
  65. /package/dist/{uninstall-R2QK7XPK.js.map → uninstall-EJF6HCYI.js.map} +0 -0
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  createAuditReport,
4
4
  getProjectBackupRoot
5
- } from "./chunk-5WR4D6HH.js";
5
+ } from "./chunk-USVCSYS5.js";
6
6
  import {
7
7
  confirm,
8
8
  intro,
@@ -16,7 +16,7 @@ import {
16
16
  preparePlannedFileChange,
17
17
  sealInstallationOperation,
18
18
  withInstallationOperation
19
- } from "./chunk-C67WJWVP.js";
19
+ } from "./chunk-X6TAWRTO.js";
20
20
 
21
21
  // src/backup.ts
22
22
  import {
@@ -520,4 +520,4 @@ export {
520
520
  executePreparedBackup,
521
521
  resolveBackupDestinationPlan
522
522
  };
523
- //# sourceMappingURL=chunk-O27AYYF3.js.map
523
+ //# sourceMappingURL=chunk-ABKEBYCF.js.map
@@ -7,12 +7,12 @@ import {
7
7
  prepareInstallationRemoval,
8
8
  pruneInstallationParents,
9
9
  removeInstallationPath
10
- } from "./chunk-3ZFX5456.js";
10
+ } from "./chunk-VCC4D5I3.js";
11
11
  import {
12
12
  NO_ACCESS,
13
13
  getFirstPartyHarnessAdapter,
14
14
  validateHarnessMethodSelection
15
- } from "./chunk-Z4KZ4JTE.js";
15
+ } from "./chunk-2Z7KRD4H.js";
16
16
  import {
17
17
  CONFLICTS_RELATIVE_DIR,
18
18
  DEFAULT_SYSTEM_ASSET_MATERIALIZATION_MODE,
@@ -73,10 +73,11 @@ import {
73
73
  sealInstallationOperation,
74
74
  stringify,
75
75
  upsertManagedBlock,
76
+ validateAndMigrateManifest,
76
77
  withInstallationOperation,
77
78
  writeContentFile,
78
79
  writeManifest
79
- } from "./chunk-C67WJWVP.js";
80
+ } from "./chunk-X6TAWRTO.js";
80
81
 
81
82
  // src/config.ts
82
83
  import { existsSync, readFileSync } from "fs";
@@ -2039,8 +2040,13 @@ async function createInstallPlan(options) {
2039
2040
  targetDir,
2040
2041
  profile,
2041
2042
  existingManifest,
2043
+ adopt: options.adopt,
2042
2044
  completedRemovalHandoff: options.completedRemovalHandoff
2043
2045
  });
2046
+ const carriedOnDemandRouterPaths = new Set(
2047
+ carriedOnDemandRouterAssets.map((asset) => asset.relativePath)
2048
+ );
2049
+ const priorPortableAdoption = hasPriorPortableAdoptionProof(existingManifest);
2044
2050
  const routerAssets = [...thinRouterAssets, ...carriedOnDemandRouterAssets];
2045
2051
  const thinRouterPaths = new Set(
2046
2052
  thinRouterAssets.map((asset) => asset.relativePath)
@@ -2186,6 +2192,34 @@ async function createInstallPlan(options) {
2186
2192
  });
2187
2193
  continue;
2188
2194
  }
2195
+ const priorAdoptionGapRouter = priorPortableAdoption && carriedOnDemandRouterPaths.has(asset.relativePath) && !manifestEntry && !existingManifest?.routerOwnership?.routers[asset.relativePath];
2196
+ if (priorAdoptionGapRouter) {
2197
+ if (currentHash !== null && parseManagedBlock(currentContent).state === "valid") {
2198
+ desiredFiles[asset.relativePath] = {
2199
+ hash: currentHash,
2200
+ sourceId: asset.sourceId,
2201
+ ownershipClass: "project-owned"
2202
+ };
2203
+ forceManifestWrite = true;
2204
+ actions.push({
2205
+ type: "noop",
2206
+ relativePath: asset.relativePath,
2207
+ sourceId: asset.sourceId,
2208
+ reviewedConflictResolution: "skip",
2209
+ contentHash: currentHash,
2210
+ reason: "Keep the router omitted from the prior portable-adoption ledger."
2211
+ });
2212
+ } else {
2213
+ conflictsRunId ??= createRunId();
2214
+ actions.push({
2215
+ type: "skip-conflict",
2216
+ relativePath: asset.relativePath,
2217
+ sourceId: asset.sourceId,
2218
+ reason: "The router omitted from the prior adoption has no valid managed block."
2219
+ });
2220
+ }
2221
+ continue;
2222
+ }
2189
2223
  if (currentHash === desiredHash) {
2190
2224
  actions.push({
2191
2225
  type: "noop",
@@ -2280,7 +2314,7 @@ async function createInstallPlan(options) {
2280
2314
  manifestEntry,
2281
2315
  currentHash
2282
2316
  );
2283
- if (migrationContent) {
2317
+ if (migrationContent && !(options.adopt && conflictResolution === "skip")) {
2284
2318
  actions.push({
2285
2319
  type: "update",
2286
2320
  relativePath: asset.relativePath,
@@ -2347,6 +2381,7 @@ async function createInstallPlan(options) {
2347
2381
  });
2348
2382
  continue;
2349
2383
  }
2384
+ if (options.adopt) delete desiredFiles[asset.relativePath];
2350
2385
  actions.push({
2351
2386
  type: "skip",
2352
2387
  relativePath: asset.relativePath,
@@ -2589,13 +2624,17 @@ async function createInstallPlan(options) {
2589
2624
  });
2590
2625
  for (const [relativePath, router] of Object.entries(routerOwnership.routers)) {
2591
2626
  const file2 = desiredFiles[relativePath];
2627
+ if (options.adopt && !file2) {
2628
+ delete routerOwnership.routers[relativePath];
2629
+ continue;
2630
+ }
2592
2631
  if (file2?.ownershipClass === "project-owned") {
2593
2632
  router.ownershipClass = "project-owned";
2594
2633
  router.installedHash = file2.hash;
2595
2634
  router.adoptionReceipt = existingManifest?.routerOwnership?.routers[relativePath]?.adoptionReceipt ?? {
2596
2635
  receiptId: hashText(`portable-router:${relativePath}:${file2.hash}`),
2597
2636
  adoptedAt: verifiedAt,
2598
- priorOwnershipClass: existingManifest ? "managed-snapshot" : "unregistered",
2637
+ priorOwnershipClass: existingManifest?.routerOwnership?.routers[relativePath] ? "managed-snapshot" : "unregistered",
2599
2638
  evidenceRefs: [`project-file:${relativePath}`]
2600
2639
  };
2601
2640
  }
@@ -3428,9 +3467,16 @@ function schemaOneSurfaceHasPreservedContent(options) {
3428
3467
  });
3429
3468
  return visit(surfaceRoot);
3430
3469
  }
3470
+ function hasPriorPortableAdoptionProof(manifest) {
3471
+ if (manifest?.packageVersion !== "2.0.7") return false;
3472
+ return Object.entries(manifest.routerOwnership?.routers ?? {}).some(([relativePath, router]) => {
3473
+ const file2 = manifest.files[relativePath];
3474
+ return router.ownershipClass === "project-owned" && router.provenanceState === "verified" && router.lifecycleDisposition === "active" && router.adoptionReceipt?.priorOwnershipClass === "unregistered" && router.installedHash === file2?.hash && router.sourceId === file2?.sourceId && file2?.ownershipClass === "project-owned";
3475
+ });
3476
+ }
3431
3477
  function getCarriedOnDemandRouterAssets(options) {
3432
3478
  const manifest = options.existingManifest;
3433
- if (!manifest || !manifest.routerOwnership && !options.completedRemovalHandoff && manifest.schemaVersion !== 1) {
3479
+ if (!manifest && !options.adopt || manifest && !manifest.routerOwnership && !options.completedRemovalHandoff && manifest.schemaVersion !== 1) {
3434
3480
  return [];
3435
3481
  }
3436
3482
  const surfaceDirectories = {
@@ -3440,7 +3486,7 @@ function getCarriedOnDemandRouterAssets(options) {
3440
3486
  const assets = [];
3441
3487
  for (const [surface, directory] of Object.entries(surfaceDirectories)) {
3442
3488
  const surfaceExists = existsSync4(path6.join(options.targetDir, directory));
3443
- const schemaOneSurfaceNeedsRouters = manifest.schemaVersion === 1 && schemaOneSurfaceHasPreservedContent({
3489
+ const schemaOneSurfaceNeedsRouters = manifest?.schemaVersion === 1 && schemaOneSurfaceHasPreservedContent({
3444
3490
  targetDir: options.targetDir,
3445
3491
  directory,
3446
3492
  manifest
@@ -3449,10 +3495,10 @@ function getCarriedOnDemandRouterAssets(options) {
3449
3495
  options.profile,
3450
3496
  surface
3451
3497
  )) {
3452
- const proof = manifest.routerOwnership?.routers[asset.relativePath];
3453
- const file2 = manifest.files[asset.relativePath];
3498
+ const proof = manifest?.routerOwnership?.routers[asset.relativePath];
3499
+ const file2 = manifest?.files[asset.relativePath];
3454
3500
  const completedRemovalFileProof = options.completedRemovalHandoff === true && file2?.sourceId === asset.sourceId && (file2.ownershipClass === void 0 || file2.ownershipClass === "managed-block");
3455
- if (completedRemovalFileProof || schemaOneSurfaceNeedsRouters || surfaceExists && (!proof || proof.routerClass === "bootstrap" || proof.routerClass === "on-demand-surface") && (!proof || proof.provenanceState === "verified" && proof.ownershipClass === "managed-snapshot" && proof.lifecycleDisposition === "active" && proof.sourceId === asset.sourceId && file2?.sourceId === asset.sourceId && file2.ownershipClass === "managed-block")) {
3501
+ if (options.adopt && surfaceExists || completedRemovalFileProof || schemaOneSurfaceNeedsRouters || surfaceExists && (!proof || proof.routerClass === "bootstrap" || proof.routerClass === "on-demand-surface") && (!proof || proof.provenanceState === "verified" && proof.ownershipClass === "managed-snapshot" && proof.lifecycleDisposition === "active" && proof.sourceId === asset.sourceId && file2?.sourceId === asset.sourceId && file2.ownershipClass === "managed-block" || proof.provenanceState === "verified" && proof.ownershipClass === "project-owned" && proof.lifecycleDisposition === "active" && proof.sourceId === asset.sourceId && proof.installedHash === file2?.hash && Boolean(proof.adoptionReceipt) && file2?.sourceId === asset.sourceId && file2.ownershipClass === "project-owned")) {
3456
3502
  assets.push(asset);
3457
3503
  }
3458
3504
  }
@@ -4215,6 +4261,11 @@ async function buildSkillAdoptionReview(options) {
4215
4261
  for (const p of Object.keys(files)) if (legacySkillRoot(p) || beforeLedger?.files[p]?.skillExposure && !desiredFiles[p] && after[p]?.kind === "directory") delete files[p];
4216
4262
  const skillFiles = [.../* @__PURE__ */ new Set([...beforeLedger?.skillFiles ?? [], ...normal.desiredSkillFiles])].filter((p) => !!files[p] && !normal.actions.some((a) => a.relativePath === p && a.type === "remove-managed"));
4217
4263
  const afterLedger = createManifest(packageMeta, normal.profile, files, skillFiles, beforeLedger?.systemAssetMaterialization ?? normal.systemAssetMaterialization, projectId, normal.routerOwnership, normal.resourceProjection);
4264
+ try {
4265
+ validateAndMigrateManifest(JSON.parse(JSON.stringify(afterLedger)), "Prepared Skill adoption ledger");
4266
+ } catch (error) {
4267
+ blockers.push(beforeLedger && beforeLedger.packageVersion !== packageMeta.version ? `This install was recorded by make-docs ${beforeLedger.packageVersion}, and this CLI is ${packageMeta.version}. Run \`make-docs setup\` first so the install records ${packageMeta.version}, then create a new adoption review.` : `The prepared Skill adoption ledger is not valid: ${error instanceof Error ? error.message : String(error)}`);
4268
+ }
4218
4269
  const ownershipChanges = [.../* @__PURE__ */ new Set([...Object.keys(beforeLedger?.files ?? {}), ...Object.keys(files)])].filter((p) => roots.some((root) => under(p, root))).map((p) => ({ path: p, effect: !beforeLedger?.files[p] ? "register" : !files[p] ? "remove" : isDeepStrictEqual3(beforeLedger.files[p], files[p]) ? "retain" : "update", before: beforeLedger?.files[p] ?? null, after: files[p] ?? null }));
4219
4270
  const changes = changesBetween(before, after);
4220
4271
  const filtered = changes.filter((c) => !(c.after.kind === "missing" && !roots.some((root) => under(c.path, root)) && !exactPaths.includes(c.path) && !cleanupPaths.includes(c.path)));
@@ -4226,6 +4277,9 @@ async function buildSkillAdoptionReview(options) {
4226
4277
  const intermediateStates = {};
4227
4278
  for (const change of filteredChanges) (intermediateStates[change.path] ??= []).push(change.before, change.after);
4228
4279
  const review = { schemaVersion: 1, targetRoot, digest, packageDigest, package: packageMeta, selections, adoptExisting: names, roots, cleanupPaths, bootstrapPaths, before, after, alternatives, intermediateStates, backups, claims, beforeLedger, blockers: [...new Set(blockers)].sort(), ownershipChanges, plan: void 0 };
4280
+ for (const exposure of Object.keys(copyFallbacks)) {
4281
+ if (!filteredChanges.some((change) => change.path === exposure && change.before.kind === "missing" && change.after.kind === "symlink")) delete copyFallbacks[exposure];
4282
+ }
4229
4283
  review.plan = { schemaVersion: 1, reviewDigest: digest, mode: "cli", metadata: void 0, changes: filteredChanges, afterLedger, skillScope: { roots, symlinkTargets, beforeSymlinkTargets, bootstrapPaths, backupRoots: backups.length ? [backupRoot] : [] }, copyFallbacks };
4230
4284
  review.plan.metadata = { ...review, plan: void 0 };
4231
4285
  return review;
@@ -4293,13 +4347,16 @@ function verifySkillAdoptionBeforeCleanup(root, metadata) {
4293
4347
  }
4294
4348
  return verifySkillAdoption(root, { ...review, after }, "after");
4295
4349
  }
4350
+ function skillAdoptionRecoveryAction(root, operationId) {
4351
+ return `Inspect make-docs project state recover ${operationId} --resume --dry-run --target-root ${JSON.stringify(root)}.`;
4352
+ }
4296
4353
  var recoveryRegistered = false;
4297
4354
  function registerSkillAdoptionRecovery() {
4298
4355
  if (recoveryRegistered) return;
4299
4356
  registerDetachedInstallationOperation(OPERATION, {
4300
4357
  validate: verifySkillAdoption,
4301
4358
  beforeRetiredCleanup: verifySkillAdoptionBeforeCleanup,
4302
- nextAction: (root, id) => `Inspect make-docs project state recover ${id} --resume --dry-run --target-root ${JSON.stringify(root)}.`
4359
+ nextAction: skillAdoptionRecoveryAction
4303
4360
  });
4304
4361
  recoveryRegistered = true;
4305
4362
  }
@@ -4353,7 +4410,8 @@ export {
4353
4410
  applySkillsOnlyInstallPlan,
4354
4411
  buildSkillAdoptionReview,
4355
4412
  presentSkillAdoptionReview,
4413
+ skillAdoptionRecoveryAction,
4356
4414
  registerSkillAdoptionRecovery,
4357
4415
  applySkillAdoptionReview
4358
4416
  };
4359
- //# sourceMappingURL=chunk-B6HJRHWL.js.map
4417
+ //# sourceMappingURL=chunk-DZ3SA3JA.js.map