@brucewaynedecoy/make-docs 2.0.6 → 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 (41) hide show
  1. package/dist/{backup-P5NUPAJL.js → backup-M5RBOM6F.js} +4 -4
  2. package/dist/{chunk-XFFESINU.js → chunk-3ZFX5456.js} +2 -2
  3. package/dist/{chunk-KFYUB4AX.js → chunk-5WR4D6HH.js} +2 -2
  4. package/dist/{chunk-TDB6UW4M.js → chunk-65TAUWTC.js} +3 -3
  5. package/dist/{chunk-PI7W5QDB.js → chunk-7AVGITZK.js} +2 -2
  6. package/dist/{chunk-B7QF7XZT.js → chunk-B6HJRHWL.js} +179 -103
  7. package/dist/chunk-B6HJRHWL.js.map +1 -0
  8. package/dist/{chunk-SFKYGFUV.js → chunk-C67WJWVP.js} +23 -12
  9. package/dist/chunk-C67WJWVP.js.map +1 -0
  10. package/dist/{chunk-DNPFQB24.js → chunk-O27AYYF3.js} +3 -3
  11. package/dist/{chunk-EF47XIIR.js → chunk-OSS4NT6N.js} +8 -7
  12. package/dist/{chunk-EF47XIIR.js.map → chunk-OSS4NT6N.js.map} +1 -1
  13. package/dist/{chunk-LK6BLVZA.js → chunk-YJLVHT4J.js} +3 -3
  14. package/dist/{chunk-2WC74W66.js → chunk-Z4KZ4JTE.js} +2 -2
  15. package/dist/index.js +200 -37
  16. package/dist/index.js.map +1 -1
  17. package/dist/{registry-44WLX4F5.js → registry-7L26WFZP.js} +7 -7
  18. package/dist/{self-WRWI5XNE.js → self-4HOKEXBV.js} +7 -7
  19. package/dist/{server-FYRDPOBR.js → server-VXVGDWRY.js} +9 -9
  20. package/dist/{setup-system-XX6NSVXZ.js → setup-system-CJESBAQ5.js} +7 -7
  21. package/dist/{skills-command-YAQP24JM.js → skills-command-YXPOHXI2.js} +6 -6
  22. package/dist/{uninstall-3YJKZ6UF.js → uninstall-R2QK7XPK.js} +7 -7
  23. package/dist/{virtual_make-docs-first-party-skills-5TYTCD5U.js → virtual_make-docs-first-party-skills-POWW3OI3.js} +2 -2
  24. package/dist/{virtual_make-docs-first-party-skills-5TYTCD5U.js.map → virtual_make-docs-first-party-skills-POWW3OI3.js.map} +1 -1
  25. package/package.json +1 -1
  26. package/dist/chunk-B7QF7XZT.js.map +0 -1
  27. package/dist/chunk-SFKYGFUV.js.map +0 -1
  28. /package/dist/{backup-P5NUPAJL.js.map → backup-M5RBOM6F.js.map} +0 -0
  29. /package/dist/{chunk-XFFESINU.js.map → chunk-3ZFX5456.js.map} +0 -0
  30. /package/dist/{chunk-KFYUB4AX.js.map → chunk-5WR4D6HH.js.map} +0 -0
  31. /package/dist/{chunk-TDB6UW4M.js.map → chunk-65TAUWTC.js.map} +0 -0
  32. /package/dist/{chunk-PI7W5QDB.js.map → chunk-7AVGITZK.js.map} +0 -0
  33. /package/dist/{chunk-DNPFQB24.js.map → chunk-O27AYYF3.js.map} +0 -0
  34. /package/dist/{chunk-LK6BLVZA.js.map → chunk-YJLVHT4J.js.map} +0 -0
  35. /package/dist/{chunk-2WC74W66.js.map → chunk-Z4KZ4JTE.js.map} +0 -0
  36. /package/dist/{registry-44WLX4F5.js.map → registry-7L26WFZP.js.map} +0 -0
  37. /package/dist/{self-WRWI5XNE.js.map → self-4HOKEXBV.js.map} +0 -0
  38. /package/dist/{server-FYRDPOBR.js.map → server-VXVGDWRY.js.map} +0 -0
  39. /package/dist/{setup-system-XX6NSVXZ.js.map → setup-system-CJESBAQ5.js.map} +0 -0
  40. /package/dist/{skills-command-YAQP24JM.js.map → skills-command-YXPOHXI2.js.map} +0 -0
  41. /package/dist/{uninstall-3YJKZ6UF.js.map → uninstall-R2QK7XPK.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createAuditReport
4
- } from "./chunk-KFYUB4AX.js";
4
+ } from "./chunk-5WR4D6HH.js";
5
5
  import {
6
6
  MANIFEST_RELATIVE_PATH,
7
7
  acquireInstallationLock,
@@ -20,7 +20,7 @@ import {
20
20
  relativePathToTarget,
21
21
  releaseInstallationLock,
22
22
  validateAndMigrateManifest
23
- } from "./chunk-SFKYGFUV.js";
23
+ } from "./chunk-C67WJWVP.js";
24
24
 
25
25
  // src/store/legacy-installation.ts
26
26
  import { createHash } from "crypto";
@@ -872,4 +872,4 @@ export {
872
872
  scopeCompatibilityToInstallPlan,
873
873
  formatCompatibilityClassification
874
874
  };
875
- //# sourceMappingURL=chunk-LK6BLVZA.js.map
875
+ //# sourceMappingURL=chunk-YJLVHT4J.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  assertManagedPathHasNoSymlinks,
4
4
  platform
5
- } from "./chunk-SFKYGFUV.js";
5
+ } from "./chunk-C67WJWVP.js";
6
6
 
7
7
  // src/harness-access/contract.ts
8
8
  import { createHash } from "crypto";
@@ -2541,4 +2541,4 @@ export {
2541
2541
  cloneOperationAccess,
2542
2542
  assertOperationAccess
2543
2543
  };
2544
- //# sourceMappingURL=chunk-2WC74W66.js.map
2544
+ //# sourceMappingURL=chunk-Z4KZ4JTE.js.map
package/dist/index.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  COMPLETE_PROJECT_CAPABILITIES,
4
4
  describeHarnessSupport,
5
5
  resolveUnifiedSetupState
6
- } from "./chunk-PI7W5QDB.js";
6
+ } from "./chunk-7AVGITZK.js";
7
7
  import {
8
8
  classifyCompatibilityState,
9
9
  formatCompatibilityClassification,
10
10
  importLegacyInstallationState,
11
11
  previewLegacyInstallationState,
12
12
  scopeCompatibilityToInstallPlan
13
- } from "./chunk-LK6BLVZA.js";
13
+ } from "./chunk-YJLVHT4J.js";
14
14
  import {
15
15
  Checkpoint9ReceiptProjectionError,
16
16
  MigrationSafetyError,
@@ -26,7 +26,7 @@ import {
26
26
  operationCliProjection,
27
27
  resolveCliOperationLaunch,
28
28
  serializeOperationError
29
- } from "./chunk-EF47XIIR.js";
29
+ } from "./chunk-OSS4NT6N.js";
30
30
  import {
31
31
  MCP_SERVER_PROFILES,
32
32
  applyInstallPlan,
@@ -34,17 +34,18 @@ import {
34
34
  findReviewableManagedFileConflicts,
35
35
  getConfigRenderingLabels,
36
36
  getDocumentKindLabel,
37
+ inferLocalResourceProjection,
37
38
  loadMakeDocsConfigOrThrow,
38
39
  parseMcpServerProfile,
39
40
  planInstall,
40
41
  planProjectHarnessIntegrationWrite,
41
42
  registerSkillAdoptionRecovery
42
- } from "./chunk-B7QF7XZT.js";
43
+ } from "./chunk-B6HJRHWL.js";
43
44
  import {
44
45
  runBackupCommand
45
- } from "./chunk-DNPFQB24.js";
46
- import "./chunk-KFYUB4AX.js";
47
- import "./chunk-XFFESINU.js";
46
+ } from "./chunk-O27AYYF3.js";
47
+ import "./chunk-5WR4D6HH.js";
48
+ import "./chunk-3ZFX5456.js";
48
49
  import {
49
50
  S_BAR,
50
51
  S_BAR_END,
@@ -68,7 +69,7 @@ import {
68
69
  previewStoreCompatibilityBridge,
69
70
  resolveProjectIdentity,
70
71
  writeGlobalConfig
71
- } from "./chunk-TDB6UW4M.js";
72
+ } from "./chunk-65TAUWTC.js";
72
73
  import {
73
74
  HARNESS_CALLER_IDENTITY_ARG,
74
75
  HARNESS_CALLER_IDENTITY_ENV,
@@ -83,7 +84,7 @@ import {
83
84
  redactMcpNativeValue,
84
85
  sha256,
85
86
  verifyMakeDocsExecutable
86
- } from "./chunk-2WC74W66.js";
87
+ } from "./chunk-Z4KZ4JTE.js";
87
88
  import {
88
89
  CAPABILITIES,
89
90
  CAPABILITY_DEPENDENCIES,
@@ -105,6 +106,7 @@ import {
105
106
  loadManifest,
106
107
  loadSqliteDriver,
107
108
  previewInstallationCheckoutMove,
109
+ readDeclarativeProjectId,
108
110
  readInstallationStatus,
109
111
  readPackageMeta,
110
112
  recoverInstallationOperation,
@@ -114,7 +116,7 @@ import {
114
116
  validateAndMigrateManifest,
115
117
  withStoreDatabase,
116
118
  writeTextFile
117
- } from "./chunk-SFKYGFUV.js";
119
+ } from "./chunk-C67WJWVP.js";
118
120
  import "./chunk-D4HDZEJT.js";
119
121
 
120
122
  // src/cli.ts
@@ -2691,12 +2693,12 @@ async function runCli(argv = process.argv.slice(2), priorProjectRecovery = null,
2691
2693
  return;
2692
2694
  }
2693
2695
  if (parsed.command === "mcp") {
2694
- const { runMcpServer } = await import("./server-FYRDPOBR.js");
2696
+ const { runMcpServer } = await import("./server-VXVGDWRY.js");
2695
2697
  await runMcpServer({ profile: parsed.mcpProfile ?? "all" });
2696
2698
  return;
2697
2699
  }
2698
2700
  if (parsed.command === "update") {
2699
- const { runToolUpdateCommand } = await import("./self-WRWI5XNE.js");
2701
+ const { runToolUpdateCommand } = await import("./self-4HOKEXBV.js");
2700
2702
  await runToolUpdateCommand({
2701
2703
  yes: parsed.yes,
2702
2704
  ...parsed.targetDir ? { targetDir: path4.resolve(parsed.targetDir) } : {}
@@ -2704,13 +2706,13 @@ async function runCli(argv = process.argv.slice(2), priorProjectRecovery = null,
2704
2706
  return;
2705
2707
  }
2706
2708
  if (parsed.command === "uninstall") {
2707
- const { runToolUninstallCommand } = await import("./self-WRWI5XNE.js");
2709
+ const { runToolUninstallCommand } = await import("./self-4HOKEXBV.js");
2708
2710
  await runToolUninstallCommand({ yes: parsed.yes, removeStore: parsed.removeStore });
2709
2711
  return;
2710
2712
  }
2711
2713
  validateParsedArgs(parsed);
2712
2714
  if (parsed.setupSubcommand === "system") {
2713
- const { runSystemSetupCommand } = await import("./setup-system-XX6NSVXZ.js");
2715
+ const { runSystemSetupCommand } = await import("./setup-system-CJESBAQ5.js");
2714
2716
  const result = await runSystemSetupCommand({
2715
2717
  dryRun: parsed.dryRun,
2716
2718
  yes: parsed.yes,
@@ -2800,7 +2802,7 @@ async function runCli(argv = process.argv.slice(2), priorProjectRecovery = null,
2800
2802
  return;
2801
2803
  }
2802
2804
  const jsonOutput = parsed.json || !output.isTTY;
2803
- const interactive = !parsed.yes && !parsed.dryRun && !parsed.json && Boolean(input.isTTY && output.isTTY);
2805
+ const interactive = !parsed.yes && !parsed.json && Boolean(input.isTTY && output.isTTY);
2804
2806
  const recoveredProjectChanged = priorProjectMutationApplied || priorProjectRecovery !== null;
2805
2807
  if (parsed.command === void 0) {
2806
2808
  const bareClassification = await classifyCompatibilityState({ targetDir });
@@ -2833,7 +2835,47 @@ async function runCli(argv = process.argv.slice(2), priorProjectRecovery = null,
2833
2835
  );
2834
2836
  }
2835
2837
  const checkoutMove = previewInstallationCheckoutMove(targetDir, void 0, storeRoot);
2836
- if (checkoutMove.candidates.length) {
2838
+ if (parsed.command === "setup" && parsed.setupSubcommand === void 0 && !parsed.adopt && checkoutMove.status === "portable-unregistered" && !existsSync2(path4.join(targetDir, ".make-docs/manifest.json"))) {
2839
+ const nextAction = "Run `make-docs setup --adopt --yes` to register this checkout, or run interactive `make-docs setup` to choose a path.";
2840
+ if (!interactive) {
2841
+ if (jsonOutput) writeCanonicalSetupResult({
2842
+ status: "blocked",
2843
+ dryRun: parsed.dryRun,
2844
+ targetRoot: targetDir,
2845
+ storeBridge: storeBridgePreview,
2846
+ checkoutMove,
2847
+ storeMutationState: "none",
2848
+ projectChanged: false,
2849
+ projectMutationState: "none",
2850
+ projectActions: [],
2851
+ failedCondition: "This checkout has a project ID but no installed record in this Store. Choose adoption or normal setup before any write.",
2852
+ nextAction
2853
+ });
2854
+ else output.write(`Setup stopped before any write. ${nextAction}
2855
+ `);
2856
+ return;
2857
+ }
2858
+ const choice = await select({
2859
+ message: "This checkout has a project ID but no installed record in this Store. How should setup continue?",
2860
+ options: [
2861
+ { value: "adopt", label: "Adopt this checkout", hint: "Keep its project ID and review file ownership." },
2862
+ { value: "normal", label: "Continue with normal setup", hint: "Review the normal setup plan before any write." },
2863
+ { value: "cancel", label: "Cancel", hint: "Keep project files and Store unchanged." }
2864
+ ]
2865
+ });
2866
+ if (isCancel(choice) || choice === "cancel") {
2867
+ output.write("Setup cancelled. No project or Store file changed.\n");
2868
+ return;
2869
+ }
2870
+ if (choice === "adopt") parsed.adopt = true;
2871
+ }
2872
+ if (parsed.adopt && checkoutMove.candidates.length > 0) {
2873
+ throw new Error("This Store already has this project ID. Review checkout move or separate checkout registration before setup.");
2874
+ }
2875
+ if (parsed.adopt && checkoutMove.status !== "portable-unregistered") {
2876
+ throw new Error(`This checkout cannot be adopted yet. ${checkoutMove.nextAction}`);
2877
+ }
2878
+ if (checkoutMove.candidates.length && !parsed.adopt) {
2837
2879
  if (!jsonOutput) {
2838
2880
  output.write(`Project ID: ${checkoutMove.projectId}
2839
2881
  Current path: ${checkoutMove.targetRoot}
@@ -3058,7 +3100,7 @@ Current path: ${checkoutMove.targetRoot}
3058
3100
  });
3059
3101
  }
3060
3102
  if (!freshInstallTarget) {
3061
- const { detectPreV2Install, promptPreV2Choice } = await import("./self-WRWI5XNE.js");
3103
+ const { detectPreV2Install, promptPreV2Choice } = await import("./self-4HOKEXBV.js");
3062
3104
  const preV2 = detectPreV2Install({
3063
3105
  targetDir,
3064
3106
  classification: compatibilityClassification
@@ -3085,11 +3127,28 @@ Current path: ${checkoutMove.targetRoot}
3085
3127
  "The completed removal does not contain enough evidence to recover the prior local resource selection. Run `make-docs setup` interactively, or rerun with `--project-resources <csv|all|none>`."
3086
3128
  );
3087
3129
  }
3088
- const resolvedSelections = resolveSelections({ parsed, existingManifest: planningManifest });
3130
+ const resolvedSelections = resolveSelections({ parsed, existingManifest: planningManifest, config: makeDocsConfig });
3131
+ if (parsed.adopt && parsed.projectResources === void 0 && makeDocsConfig.resourceProjection === void 0) {
3132
+ const localProjection = inferLocalResourceProjection(targetDir);
3133
+ if (localProjection.status === "partial" && !interactive) {
3134
+ throw new Error("Local resource copies are incomplete. Supply `--project-resources <csv|all|none>` or review setup interactively.");
3135
+ }
3136
+ if (localProjection.status === "complete") {
3137
+ resolvedSelections.resourceProjection = [...localProjection.types];
3138
+ }
3139
+ }
3089
3140
  if (parsed.projectResources === void 0 && completedRemovalResourceProjection !== void 0 && completedRemovalResourceProjection !== null) {
3090
3141
  resolvedSelections.resourceProjection = [...completedRemovalResourceProjection];
3091
3142
  }
3092
3143
  let installationStatus = readInstallationStatus(targetDir, storeRoot);
3144
+ if (parsed.adopt) {
3145
+ if (!readDeclarativeProjectId(targetDir)) {
3146
+ throw new Error("`setup --adopt` requires a valid projectId in .make-docs/config.yaml.");
3147
+ }
3148
+ if (installationStatus.status === "ready") {
3149
+ throw new Error("This checkout already has a verified installation. Run `make-docs setup` without `--adopt`.");
3150
+ }
3151
+ }
3093
3152
  let projectState = freshInstallTarget ? "fresh" : installationStatus.status === "recovery-required" ? "recoverable" : compatibilityClassification.state === "modified-v1" ? "drifted" : completedRemovalResourceProjection === null || compatibilityClassification.state === "partial-install" || planningManifest?.effectiveCapabilities.length !== CAPABILITIES.length ? "partial" : "current";
3094
3153
  let selections = applySkillRegistrySelectionMetadata(
3095
3154
  resolveUnifiedSetupState({
@@ -3110,11 +3169,11 @@ Current path: ${checkoutMove.targetRoot}
3110
3169
  }
3111
3170
  let interactiveMethodSelections = {};
3112
3171
  if (interactive) {
3113
- const { inspectSystemHarnesses, promptForSystemSetupMethods } = await import("./setup-system-XX6NSVXZ.js");
3172
+ const { inspectSystemHarnesses, promptForSystemSetupMethods } = await import("./setup-system-CJESBAQ5.js");
3114
3173
  const harnessSupport = inspectSystemHarnesses();
3115
3174
  const afterHarnessSelection = async (wizardSelections) => {
3116
3175
  interactiveMethodSelections = await promptForSystemSetupMethods({
3117
- dryRun: false,
3176
+ dryRun: parsed.dryRun,
3118
3177
  yes: false,
3119
3178
  promptForMethods: true,
3120
3179
  methods: {
@@ -3137,7 +3196,7 @@ Current path: ${checkoutMove.targetRoot}
3137
3196
  const wizardSelections = await runSelectionWizard({
3138
3197
  initialSelections: selections,
3139
3198
  introTitle: "Let's configure your make-docs install",
3140
- projectState: "fresh",
3199
+ projectState: parsed.adopt ? "partial" : "fresh",
3141
3200
  harnessSupport,
3142
3201
  afterHarnessSelection,
3143
3202
  config: makeDocsConfig,
@@ -3188,12 +3247,16 @@ Current path: ${checkoutMove.targetRoot}
3188
3247
  applyPreparedSystemSetup,
3189
3248
  prepareSystemSetupCommand,
3190
3249
  resumePendingSystemSetupCommand
3191
- } = await import("./setup-system-XX6NSVXZ.js");
3250
+ } = await import("./setup-system-CJESBAQ5.js");
3251
+ const savedMethods = Object.fromEntries(
3252
+ makeDocsConfig.harnessIntegrations.filter((record) => record.mode === "narrow" && record.method && (record.harness === "codex" || record.harness === "claude-code" || record.harness === "github-copilot")).map((record) => [record.harness, record.method])
3253
+ );
3192
3254
  const systemOptions = {
3193
3255
  dryRun: parsed.dryRun,
3194
3256
  yes: parsed.yes,
3195
3257
  promptForMethods: interactive && Object.keys(interactiveMethodSelections).length === 0,
3196
3258
  methods: {
3259
+ ...savedMethods,
3197
3260
  ...interactiveMethodSelections,
3198
3261
  ...parsed.codexMethod !== void 0 ? { codex: parsed.codexMethod } : {},
3199
3262
  ...parsed.claudeCodeMethod !== void 0 ? { "claude-code": parsed.claudeCodeMethod } : {},
@@ -3233,9 +3296,47 @@ Current path: ${checkoutMove.targetRoot}
3233
3296
  packageMeta,
3234
3297
  skillRegistry: effectiveSkillRegistry.registry,
3235
3298
  preserveExistingSkills: skillReconciliation.routed,
3236
- operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup"
3299
+ operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup",
3300
+ adopt: parsed.adopt
3237
3301
  });
3302
+ if (parsed.adopt && parsed.conflicts === "overwrite" && findReviewableManagedFileConflicts(plan).length > 0) {
3303
+ const failedCondition = "Adoption cannot batch-overwrite files without prior local managed ownership proof.";
3304
+ const nextAction = "Run `make-docs setup --adopt --yes --conflicts keep` to preserve changed files, or review each file before replacing it.";
3305
+ if (jsonOutput) writeCanonicalSetupResult({
3306
+ status: "blocked",
3307
+ dryRun: parsed.dryRun,
3308
+ targetRoot: targetDir,
3309
+ storeBridge: storeBridgePreview,
3310
+ checkoutMove,
3311
+ storeMutationState: "none",
3312
+ projectChanged: false,
3313
+ projectMutationState: "none",
3314
+ projectActions: plan.actions,
3315
+ failedCondition,
3316
+ nextAction
3317
+ });
3318
+ else output.write(`${failedCondition}
3319
+ ${nextAction}
3320
+ `);
3321
+ return;
3322
+ }
3323
+ const conflictPolicy = parsed.conflicts ?? (parsed.adopt ? "keep" : void 0);
3238
3324
  let managedFileConflictResolutions;
3325
+ if (conflictPolicy) {
3326
+ managedFileConflictResolutions = resolveManagedFileConflictPolicy(plan, conflictPolicy);
3327
+ plan = await planInstall({
3328
+ targetDir,
3329
+ selections,
3330
+ existingManifest: planningManifest,
3331
+ completedRemovalHandoff: completedRemovalHandoff.status === "ready",
3332
+ packageMeta,
3333
+ managedFileConflictResolutions,
3334
+ skillRegistry: effectiveSkillRegistry.registry,
3335
+ preserveExistingSkills: skillReconciliation.routed,
3336
+ operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup",
3337
+ adopt: parsed.adopt
3338
+ });
3339
+ }
3239
3340
  if (interactive) {
3240
3341
  const managedFileConflicts = findReviewableManagedFileConflicts(plan);
3241
3342
  if (managedFileConflicts.length > 0) {
@@ -3253,7 +3354,8 @@ Current path: ${checkoutMove.targetRoot}
3253
3354
  managedFileConflictResolutions,
3254
3355
  skillRegistry: effectiveSkillRegistry.registry,
3255
3356
  preserveExistingSkills: skillReconciliation.routed,
3256
- operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup"
3357
+ operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup",
3358
+ adopt: parsed.adopt
3257
3359
  });
3258
3360
  }
3259
3361
  }
@@ -3300,11 +3402,12 @@ Current path: ${checkoutMove.targetRoot}
3300
3402
  let projectHarnessConfig = planProjectHarnessIntegrationWrite({
3301
3403
  targetDir,
3302
3404
  reviewed: reviewedHarnessIntegrations,
3405
+ reviewedResourceProjection: freshInstallTarget || makeDocsConfig.resourceProjection !== void 0 ? selections.resourceProjection : void 0,
3303
3406
  contentWhenMissing: plannedConfigContent
3304
3407
  });
3305
3408
  let hasPlannedChanges = plan.actions.some((action) => action.type !== "noop") || projectHarnessConfig.changed;
3306
3409
  let requiresProjectIdMigration = Boolean(existingManifest && !existingManifest.projectId);
3307
- let hasInstallMutation = hasPlannedChanges || requiresProjectIdMigration;
3410
+ let hasInstallMutation = hasPlannedChanges || requiresProjectIdMigration || Boolean(parsed.adopt);
3308
3411
  let reviewedProjectFingerprint = setupProjectReviewFingerprint(
3309
3412
  plan,
3310
3413
  projectHarnessConfig
@@ -3346,8 +3449,27 @@ Current path: ${checkoutMove.targetRoot}
3346
3449
  ...managedFileConflictResolutions ? { managedFileConflictResolutions } : {},
3347
3450
  skillRegistry: effectiveSkillRegistry.registry,
3348
3451
  preserveExistingSkills: skillReconciliation.routed,
3349
- operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup"
3452
+ operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup",
3453
+ adopt: parsed.adopt
3350
3454
  });
3455
+ if (conflictPolicy) {
3456
+ managedFileConflictResolutions = {
3457
+ ...managedFileConflictResolutions,
3458
+ ...resolveManagedFileConflictPolicy(plan, conflictPolicy)
3459
+ };
3460
+ plan = await planInstall({
3461
+ targetDir,
3462
+ selections,
3463
+ existingManifest: planningManifest,
3464
+ completedRemovalHandoff: completedRemovalHandoff.status === "ready",
3465
+ packageMeta,
3466
+ managedFileConflictResolutions,
3467
+ skillRegistry: effectiveSkillRegistry.registry,
3468
+ preserveExistingSkills: skillReconciliation.routed,
3469
+ operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup",
3470
+ adopt: parsed.adopt
3471
+ });
3472
+ }
3351
3473
  if (interactive) {
3352
3474
  const refreshedConflicts = findReviewableManagedFileConflicts(plan);
3353
3475
  if (refreshedConflicts.length > 0) {
@@ -3369,7 +3491,8 @@ Current path: ${checkoutMove.targetRoot}
3369
3491
  managedFileConflictResolutions,
3370
3492
  skillRegistry: effectiveSkillRegistry.registry,
3371
3493
  preserveExistingSkills: skillReconciliation.routed,
3372
- operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup"
3494
+ operation: installIntent === "reconfigure" ? "setup.reconfigure" : "setup",
3495
+ adopt: parsed.adopt
3373
3496
  });
3374
3497
  }
3375
3498
  }
@@ -3399,11 +3522,12 @@ Current path: ${checkoutMove.targetRoot}
3399
3522
  projectHarnessConfig = planProjectHarnessIntegrationWrite({
3400
3523
  targetDir,
3401
3524
  reviewed: reviewedHarnessIntegrations,
3525
+ reviewedResourceProjection: freshInstallTarget || makeDocsConfig.resourceProjection !== void 0 ? selections.resourceProjection : void 0,
3402
3526
  contentWhenMissing: plannedConfigContent
3403
3527
  });
3404
3528
  hasPlannedChanges = plan.actions.some((action) => action.type !== "noop") || projectHarnessConfig.changed;
3405
3529
  requiresProjectIdMigration = Boolean(existingManifest && !existingManifest.projectId);
3406
- hasInstallMutation = hasPlannedChanges || requiresProjectIdMigration;
3530
+ hasInstallMutation = hasPlannedChanges || requiresProjectIdMigration || Boolean(parsed.adopt);
3407
3531
  reviewedProjectFingerprint = setupProjectReviewFingerprint(
3408
3532
  plan,
3409
3533
  projectHarnessConfig
@@ -3439,13 +3563,13 @@ Current path: ${checkoutMove.targetRoot}
3439
3563
  if (!jsonOutput && projectHarnessConfig.changed) {
3440
3564
  output.write("Project harness intent: update .make-docs/config.yaml after machine verification.\n");
3441
3565
  }
3442
- if (parsed.dryRun) {
3566
+ const unresolvedManagedFileConflicts = findReviewableManagedFileConflicts(plan);
3567
+ if (parsed.dryRun && unresolvedManagedFileConflicts.length === 0) {
3443
3568
  if (jsonOutput) writeCanonicalSetupResult({ status: "planned", dryRun: true, targetRoot: targetDir, prepared: preparedSystemSetup, genericMcp: genericMcpPlan, storeBridge: storeBridgePreview, projectRecovery: priorProjectRecovery, projectChanged: hasInstallMutation, projectActions: plan.actions, failedCondition: null, nextAction: hasInstallMutation || hasMachineMutation ? "Run setup with the same choices and --yes to apply this plan." : null });
3444
3569
  else output.write("\nDry run complete.\n");
3445
3570
  return;
3446
3571
  }
3447
- const unresolvedManagedFileConflicts = findReviewableManagedFileConflicts(plan);
3448
- if (!interactive && unresolvedManagedFileConflicts.length > 0) {
3572
+ if (unresolvedManagedFileConflicts.length > 0) {
3449
3573
  const migrationReviewBlock = getInstallPlanMigrationReviewBlock(plan);
3450
3574
  const failedCondition = [
3451
3575
  "Non-interactive make-docs runs cannot apply unresolved managed-file diffs.",
@@ -3459,11 +3583,11 @@ Current path: ${checkoutMove.targetRoot}
3459
3583
  )
3460
3584
  ].join("\n")
3461
3585
  ].join("\n");
3462
- const nextAction = migrationReviewBlock?.nextAction ?? "Run `make-docs setup` without `--yes` to review the conflicts interactively.";
3586
+ const nextAction = migrationReviewBlock?.nextAction ?? "Run setup with `--conflicts keep` to preserve changed files, or review the conflicts interactively.";
3463
3587
  if (jsonOutput) {
3464
3588
  writeCanonicalSetupResult({
3465
3589
  status: "blocked",
3466
- dryRun: false,
3590
+ dryRun: parsed.dryRun,
3467
3591
  targetRoot: targetDir,
3468
3592
  prepared: preparedSystemSetup,
3469
3593
  genericMcp: genericMcpPlan,
@@ -3809,7 +3933,7 @@ Next: ${nextAction}
3809
3933
  }
3810
3934
  let applied;
3811
3935
  try {
3812
- applied = !freshInstallTarget && hasInstallMutation && completedRemovalHandoff.status !== "ready" ? executeInstallPlanMigration({
3936
+ applied = !parsed.adopt && !freshInstallTarget && hasInstallMutation && completedRemovalHandoff.status !== "ready" ? executeInstallPlanMigration({
3813
3937
  projectRoot: targetDir,
3814
3938
  storeRoot,
3815
3939
  compatibility: compatibilityClassification,
@@ -4055,9 +4179,19 @@ function describeSelectionSource(options) {
4055
4179
  return hasSelectionOverrides(parsed) ? "default selections plus command-line flags" : "default selections";
4056
4180
  }
4057
4181
  function resolveSelections(options) {
4058
- const { parsed, existingManifest } = options;
4182
+ const { parsed, existingManifest, config } = options;
4059
4183
  const baseSelections = existingManifest ? existingManifest.selections : defaultSelections();
4060
4184
  const selections = cloneSelections(baseSelections);
4185
+ if (!existingManifest && parsed.adopt) {
4186
+ for (const record of config.harnessIntegrations) {
4187
+ if (record.harness === "codex" || record.harness === "claude-code" || record.harness === "github-copilot") {
4188
+ selections.harnesses[record.harness] = record.mode !== "disable";
4189
+ }
4190
+ }
4191
+ }
4192
+ if (parsed.projectResources === void 0 && config.resourceProjection !== void 0) {
4193
+ selections.resourceProjection = [...config.resourceProjection];
4194
+ }
4061
4195
  if (selections.resourceProjection === void 0 && (!existingManifest || parsed.setupSubcommand === "reconfigure")) {
4062
4196
  selections.resourceProjection = [];
4063
4197
  }
@@ -4106,6 +4240,14 @@ function resolveSelections(options) {
4106
4240
  }
4107
4241
  return selections;
4108
4242
  }
4243
+ function resolveManagedFileConflictPolicy(plan, policy) {
4244
+ return Object.fromEntries(
4245
+ findReviewableManagedFileConflicts(plan).map((conflict) => [
4246
+ conflict.relativePath,
4247
+ policy === "keep" ? "skip" : "overwrite"
4248
+ ])
4249
+ );
4250
+ }
4109
4251
  function inferCompletedRemovalResourceProjection(manifest) {
4110
4252
  const resourceUris = /* @__PURE__ */ new Set([
4111
4253
  ...Object.keys(manifest.resourceProjection?.resources ?? {}),
@@ -4167,7 +4309,7 @@ async function loadUninstallCommand() {
4167
4309
  if (uninstallCommandLoaderOverride) {
4168
4310
  return uninstallCommandLoaderOverride();
4169
4311
  }
4170
- const uninstallModule = await import("./uninstall-3YJKZ6UF.js");
4312
+ const uninstallModule = await import("./uninstall-R2QK7XPK.js");
4171
4313
  if (typeof uninstallModule.runUninstallCommand !== "function") {
4172
4314
  throw new Error(
4173
4315
  "The `uninstall` command module must export `runUninstallCommand(options)`."
@@ -4180,7 +4322,7 @@ async function runSkillsCommand(options) {
4180
4322
  await skillsCommandRunnerOverride(options);
4181
4323
  return;
4182
4324
  }
4183
- const skillsModule = await import("./skills-command-YAQP24JM.js");
4325
+ const skillsModule = await import("./skills-command-YXPOHXI2.js");
4184
4326
  await skillsModule.runSkillsCommand(options);
4185
4327
  }
4186
4328
  function getSelectionOverrideFlags(parsed) {
@@ -4323,6 +4465,17 @@ function parseArgs(argv) {
4323
4465
  case "--yes":
4324
4466
  parsed.yes = true;
4325
4467
  break;
4468
+ case "--adopt":
4469
+ parsed.adopt = true;
4470
+ break;
4471
+ case "--conflicts": {
4472
+ const value = args.shift();
4473
+ if (value !== "keep" && value !== "overwrite") {
4474
+ throw new Error("`--conflicts` must be keep or overwrite.");
4475
+ }
4476
+ parsed.conflicts = value;
4477
+ break;
4478
+ }
4326
4479
  case "--json":
4327
4480
  parsed.json = true;
4328
4481
  break;
@@ -4660,6 +4813,12 @@ function writeCanonicalSetupResult(input2) {
4660
4813
  `);
4661
4814
  }
4662
4815
  function validateParsedArgs(parsed) {
4816
+ if (parsed.adopt && (parsed.command !== "setup" || parsed.setupSubcommand !== void 0)) {
4817
+ throw new Error("`--adopt` is valid only with plain `make-docs setup`.");
4818
+ }
4819
+ if (parsed.conflicts && (parsed.command !== "setup" || parsed.setupSubcommand === "system" || parsed.setupSubcommand === "skills" || parsed.setupSubcommand === "backup" || parsed.setupSubcommand === "remove")) {
4820
+ throw new Error("`--conflicts` is valid only with project setup or reconfigure.");
4821
+ }
4663
4822
  if (parsed.rotateMcp && (parsed.command !== "setup" || parsed.setupSubcommand !== "system")) {
4664
4823
  throw new Error("`--rotate-mcp` is valid only with `make-docs setup system`.");
4665
4824
  }
@@ -5077,6 +5236,8 @@ var SETUP_SHARED_OPTIONS = `General options:
5077
5236
  --target <dir> Operate on a different make-docs install directory.
5078
5237
  --dry-run Show planned changes without writing files.
5079
5238
  --yes Approve a fully specified non-interactive plan.
5239
+ --adopt Register a checkout with a saved projectId in this Store.
5240
+ --conflicts <keep|overwrite> Resolve changed managed files in this setup plan.
5080
5241
  --recover <resume|restore> Choose recovery for unfinished project work.
5081
5242
  --json Emit only the canonical setup result JSON.
5082
5243
  --help, -h Show help for this command.
@@ -5330,6 +5491,8 @@ ${SETUP_SHARED_OPTIONS}
5330
5491
  Examples:
5331
5492
  make-docs setup
5332
5493
  make-docs setup --yes
5494
+ make-docs setup --adopt --yes
5495
+ make-docs setup --adopt --yes --conflicts keep
5333
5496
  make-docs setup --target ~/Projects/example --dry-run
5334
5497
  make-docs setup reconfigure --yes --no-work
5335
5498
  make-docs setup remove --backup