@brucewaynedecoy/make-docs 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/{backup-CM7RL2Q7.js → backup-P5NUPAJL.js} +4 -4
  2. package/dist/{chunk-M7DMFIKU.js → chunk-2WC74W66.js} +224 -20
  3. package/dist/chunk-2WC74W66.js.map +1 -0
  4. package/dist/{chunk-OR5ZVGLG.js → chunk-B7QF7XZT.js} +151 -5
  5. package/dist/chunk-B7QF7XZT.js.map +1 -0
  6. package/dist/{chunk-LV3CBXZB.js → chunk-DNPFQB24.js} +3 -3
  7. package/dist/{chunk-52FTNVXS.js → chunk-EF47XIIR.js} +8977 -2891
  8. package/dist/chunk-EF47XIIR.js.map +1 -0
  9. package/dist/{chunk-GERMRLJ2.js → chunk-KFYUB4AX.js} +6 -4
  10. package/dist/chunk-KFYUB4AX.js.map +1 -0
  11. package/dist/{chunk-ADVNSMA7.js → chunk-LK6BLVZA.js} +3 -3
  12. package/dist/{chunk-65QWMODG.js → chunk-PI7W5QDB.js} +3 -3
  13. package/dist/{chunk-65QWMODG.js.map → chunk-PI7W5QDB.js.map} +1 -1
  14. package/dist/{chunk-YVSASZMT.js → chunk-SFKYGFUV.js} +277 -79
  15. package/dist/chunk-SFKYGFUV.js.map +1 -0
  16. package/dist/{chunk-J5QDGRZ7.js → chunk-TDB6UW4M.js} +116 -37
  17. package/dist/chunk-TDB6UW4M.js.map +1 -0
  18. package/dist/{chunk-7R2PPKTB.js → chunk-XFFESINU.js} +2 -2
  19. package/dist/index.js +408 -86
  20. package/dist/index.js.map +1 -1
  21. package/dist/registry-44WLX4F5.js +50 -0
  22. package/dist/registry-44WLX4F5.js.map +1 -0
  23. package/dist/{self-36ULRIJ6.js → self-WRWI5XNE.js} +10 -10
  24. package/dist/server-FYRDPOBR.js +1117 -0
  25. package/dist/server-FYRDPOBR.js.map +1 -0
  26. package/dist/{setup-system-JI36YJ6D.js → setup-system-XX6NSVXZ.js} +263 -40
  27. package/dist/setup-system-XX6NSVXZ.js.map +1 -0
  28. package/dist/{skills-command-IGDVLNKY.js → skills-command-YAQP24JM.js} +17 -7
  29. package/dist/skills-command-YAQP24JM.js.map +1 -0
  30. package/dist/{uninstall-VBGMQQLA.js → uninstall-3YJKZ6UF.js} +9 -9
  31. package/dist/virtual_make-docs-first-party-skills-5TYTCD5U.js +11 -0
  32. package/dist/virtual_make-docs-first-party-skills-5TYTCD5U.js.map +1 -0
  33. package/package.json +5 -5
  34. package/skill-registry.json +24 -8
  35. package/skill-registry.schema.json +2 -1
  36. package/template/.make-docs/system/contracts/system-resource-contract.md +16 -0
  37. package/template/.make-docs/system-resources.catalog.json +415 -0
  38. package/template/.make-docs/system-resources.schema.json +25 -0
  39. package/dist/chunk-52FTNVXS.js.map +0 -1
  40. package/dist/chunk-GERMRLJ2.js.map +0 -1
  41. package/dist/chunk-J5QDGRZ7.js.map +0 -1
  42. package/dist/chunk-M7DMFIKU.js.map +0 -1
  43. package/dist/chunk-OR5ZVGLG.js.map +0 -1
  44. package/dist/chunk-YVSASZMT.js.map +0 -1
  45. package/dist/server-H754TA4Q.js +0 -512
  46. package/dist/server-H754TA4Q.js.map +0 -1
  47. package/dist/setup-system-JI36YJ6D.js.map +0 -1
  48. package/dist/skills-command-IGDVLNKY.js.map +0 -1
  49. package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js +0 -11
  50. package/dist/virtual_make-docs-first-party-skills-H3FC47C2.js.map +0 -1
  51. /package/dist/{backup-CM7RL2Q7.js.map → backup-P5NUPAJL.js.map} +0 -0
  52. /package/dist/{chunk-LV3CBXZB.js.map → chunk-DNPFQB24.js.map} +0 -0
  53. /package/dist/{chunk-ADVNSMA7.js.map → chunk-LK6BLVZA.js.map} +0 -0
  54. /package/dist/{chunk-7R2PPKTB.js.map → chunk-XFFESINU.js.map} +0 -0
  55. /package/dist/{self-36ULRIJ6.js.map → self-WRWI5XNE.js.map} +0 -0
  56. /package/dist/{uninstall-VBGMQQLA.js.map → uninstall-3YJKZ6UF.js.map} +0 -0
@@ -7236,7 +7236,8 @@ function cleanupAccessDirectory(directory) {
7236
7236
  try {
7237
7237
  rmdirSync(directory);
7238
7238
  } catch (error) {
7239
- if (!(/* @__PURE__ */ new Set(["ENOENT", "ENOTEMPTY", "EEXIST"])).has(systemCode(error) ?? "")) {
7239
+ const code = systemCode(error);
7240
+ if (!(/* @__PURE__ */ new Set(["ENOENT", "ENOTEMPTY", "EEXIST"])).has(code ?? "") && !(platform.kind === "win32" && code === "EBUSY")) {
7240
7241
  throw new StoreUnavailableError(makeStoreIssue("io-error", directory, "clean session directory", error));
7241
7242
  }
7242
7243
  }
@@ -8344,7 +8345,7 @@ function normalizePath(relativePath) {
8344
8345
  // src/types.ts
8345
8346
  var CAPABILITIES = ["designs", "plans", "prd", "work"];
8346
8347
  var INSTRUCTION_KINDS = ["AGENTS.md", "CLAUDE.md"];
8347
- var HARNESSES = ["claude-code", "codex"];
8348
+ var HARNESSES = ["claude-code", "codex", "github-copilot"];
8348
8349
  var PROJECT_RESOURCE_TYPES = [
8349
8350
  "contract",
8350
8351
  "prompt",
@@ -8353,7 +8354,8 @@ var PROJECT_RESOURCE_TYPES = [
8353
8354
  ];
8354
8355
  var HARNESS_TO_INSTRUCTION = {
8355
8356
  "claude-code": "CLAUDE.md",
8356
- codex: "AGENTS.md"
8357
+ codex: "AGENTS.md",
8358
+ "github-copilot": "AGENTS.md"
8357
8359
  };
8358
8360
  var SYSTEM_ASSET_MATERIALIZATION_MODES = [
8359
8361
  "full-snapshot",
@@ -8776,7 +8778,7 @@ function isConfiguredRouterPath(profile, relativePath, instructionKind) {
8776
8778
  return getConfiguredRouterPaths(profile, instructionKind).includes(relativePath);
8777
8779
  }
8778
8780
  function getRouterTemplateSourcePath(profile, relativePath) {
8779
- if (relativePath === "docs/AGENTS.md" && profile.selections.harnesses.codex && !profile.selections.harnesses["claude-code"]) return "docs/AGENTS.codex-only.md";
8781
+ if (relativePath === "docs/AGENTS.md" && (profile.selections.harnesses.codex || profile.selections.harnesses["github-copilot"]) && !profile.selections.harnesses["claude-code"]) return "docs/AGENTS.codex-only.md";
8780
8782
  if (relativePath === "docs/CLAUDE.md" && profile.selections.harnesses["claude-code"] && !profile.selections.harnesses.codex) return "docs/CLAUDE.claude-only.md";
8781
8783
  return relativePath;
8782
8784
  }
@@ -9263,6 +9265,7 @@ function validateHarnesses(value) {
9263
9265
  assertPlainObject(value, "selections.harnesses");
9264
9266
  const harnesses = {};
9265
9267
  for (const harness of HARNESSES) {
9268
+ if (harness === "github-copilot" && value[harness] === void 0) continue;
9266
9269
  harnesses[harness] = validateBoolean(
9267
9270
  value[harness],
9268
9271
  `selections.harnesses.${harness}`
@@ -9678,7 +9681,7 @@ function validateRouterOwnershipManifestState(value, files, selections, packageM
9678
9681
  `manifest.routerOwnership.routers.${relativePath}.instructionKind must be valid`
9679
9682
  );
9680
9683
  }
9681
- const expectedInstruction = harness === "codex" ? "AGENTS.md" : "CLAUDE.md";
9684
+ const expectedInstruction = HARNESS_TO_INSTRUCTION[harness];
9682
9685
  if (instructionKind !== expectedInstruction) {
9683
9686
  throw new Error(
9684
9687
  `manifest.routerOwnership.routers.${relativePath}.instructionKind must match its harness`
@@ -9741,13 +9744,13 @@ function validateRouterOwnershipManifestState(value, files, selections, packageM
9741
9744
  }
9742
9745
  const bootstrapPaths = Object.values(routers).filter((router) => router.routerClass === "bootstrap").map((router) => router.relativePath).sort();
9743
9746
  const legacyBootstrapPaths = expectedHarnesses.flatMap((harness) => {
9744
- const instructionKind = harness === "codex" ? "AGENTS.md" : "CLAUDE.md";
9747
+ const instructionKind = HARNESS_TO_INSTRUCTION[harness];
9745
9748
  return getLegacyIncompleteRouterPaths(instructionKind);
9746
9749
  }).sort();
9747
9750
  const isExactLegacyIncompleteInput = JSON.stringify(bootstrapPaths) === JSON.stringify(legacyBootstrapPaths);
9748
9751
  if (!isExactLegacyIncompleteInput) {
9749
9752
  for (const harness of expectedHarnesses) {
9750
- const instructionKind = harness === "codex" ? "AGENTS.md" : "CLAUDE.md";
9753
+ const instructionKind = HARNESS_TO_INSTRUCTION[harness];
9751
9754
  for (const relativePath of getConfiguredRouterPaths(profile, instructionKind)) {
9752
9755
  if (!routers[relativePath]) {
9753
9756
  throw new Error(
@@ -10353,7 +10356,7 @@ function validateSkillSelectionProvenance(value) {
10353
10356
  entry.supportedHarnesses,
10354
10357
  `selections.skillSelectionProvenance.${index}.supportedHarnesses`
10355
10358
  ).map((harness) => {
10356
- if (harness !== "claude-code" && harness !== "codex") {
10359
+ if (harness !== "claude-code" && harness !== "codex" && harness !== "github-copilot") {
10357
10360
  throw new Error(
10358
10361
  `selections.skillSelectionProvenance.${index}.supportedHarnesses contains unsupported harness ${harness}`
10359
10362
  );
@@ -10465,7 +10468,7 @@ function validatePluginSelectionProvenance(value) {
10465
10468
  entry.supportedHarnesses,
10466
10469
  `selections.pluginSelectionProvenance.${index}.supportedHarnesses`
10467
10470
  ).map((harness) => {
10468
- if (harness !== "claude-code" && harness !== "codex") {
10471
+ if (harness !== "claude-code" && harness !== "codex" && harness !== "github-copilot") {
10469
10472
  throw new Error(
10470
10473
  `selections.pluginSelectionProvenance.${index}.supportedHarnesses contains unsupported harness ${harness}`
10471
10474
  );
@@ -10768,13 +10771,14 @@ function getContainedRelativePath2(root, candidate) {
10768
10771
  // src/skill-paths.ts
10769
10772
  import * as os3 from "os";
10770
10773
  import path8 from "path";
10771
- var HARNESS_SKILL_DIRS2 = { "claude-code": ".claude/skills", codex: ".agents/skills" };
10774
+ var HARNESS_SKILL_DIRS2 = { "claude-code": ".claude/skills", codex: ".agents/skills", "github-copilot": ".agents/skills" };
10772
10775
  function getCanonicalSkillDirectory(selections) {
10773
10776
  const tools = selections.skillHarnesses ?? selections.harnesses;
10774
- return selections.skillScope === "project" && !tools.codex && tools["claude-code"] ? ".claude/skills" : ".agents/skills";
10777
+ return selections.skillScope === "project" && !tools.codex && !tools["github-copilot"] && tools["claude-code"] ? ".claude/skills" : ".agents/skills";
10775
10778
  }
10776
10779
  function getHarnessSkillDirectory(harness, scope, homeDir = os3.homedir()) {
10777
10780
  if (scope === "project") return HARNESS_SKILL_DIRS2[harness];
10781
+ if (harness === "github-copilot") return path8.join(homeDir, ".agents", "skills");
10778
10782
  const configuredHome = harness === "codex" ? process.env.CODEX_HOME : process.env.CLAUDE_CONFIG_DIR;
10779
10783
  return path8.join(configuredHome ? path8.resolve(configuredHome) : path8.join(homeDir, harness === "codex" ? ".codex" : ".claude"), "skills");
10780
10784
  }
@@ -11190,7 +11194,7 @@ function withReviewedStoreCompatibilityBridge(fn) {
11190
11194
  function withInstallationDatabase(projectRoot, fn, options = {}) {
11191
11195
  const root = canonicalInstallationPath(projectRoot);
11192
11196
  const store = validateInstallationStoreRoot(root, options.storeRoot ?? active.get(root)?.storeRoot ?? held2.get(root)?.storeRoot ?? resolveStoreRoot());
11193
- if (!options.readOnly && !held2.has(root))
11197
+ if (!options.readOnly && !options.skipPreparation && !held2.has(root))
11194
11198
  prepareStore(root, store);
11195
11199
  const databasePath = getStoreDatabasePath(store);
11196
11200
  try {
@@ -11246,61 +11250,122 @@ function checkout(db, root) {
11246
11250
  fail("ownership-unverified", "More than one checkout claims this platform path. No Store identity changed.");
11247
11251
  return matches2[0] ?? null;
11248
11252
  }
11249
- function managedContentDigest(root, ledgerJson, operationPaths) {
11250
- const isCheckoutPath = (relative) => {
11251
- if (relative === ".") return false;
11252
- const absolute = path9.resolve(root, relative);
11253
- const relation = path9.relative(root, absolute);
11254
- return relation !== ".." && !relation.startsWith(`..${path9.sep}`) && !path9.isAbsolute(relation);
11255
- };
11256
- const paths = new Set(operationPaths.filter(isCheckoutPath));
11257
- if (ledgerJson && ledgerJson !== "null") {
11258
- const manifest = validateAndMigrateManifest(JSON.parse(ledgerJson), "Make Docs Store checkout verification ledger");
11259
- for (const relative of Object.keys(manifest.files)) if (isCheckoutPath(relative)) paths.add(relative);
11260
- }
11261
- if (paths.size === 0) return null;
11262
- const facts = [...paths].sort().map((relative) => {
11263
- const absolute = path9.resolve(root, relative);
11264
- const relation = path9.relative(root, absolute);
11253
+ function checkoutOwnershipFacts(root, ledgerJson, projectId, requireFullProof) {
11254
+ if (!ledgerJson || ledgerJson === "null") return [];
11255
+ let manifest;
11256
+ try {
11257
+ manifest = validateAndMigrateManifest(JSON.parse(ledgerJson), "Make Docs Store checkout verification ledger");
11258
+ } catch {
11259
+ return fail("ownership-unverified", "The saved installation ledger is invalid. No checkout ownership changed.");
11260
+ }
11261
+ if (manifest.projectId !== projectId)
11262
+ return fail("ownership-unverified", "The saved installation ledger has a different project identity.");
11263
+ const facts = [];
11264
+ for (const [relative, entry] of Object.entries(manifest.files).sort(([a], [b]) => a.localeCompare(b))) {
11265
+ if (relative === ".make-docs/config.yaml" || entry.ownershipClass === "project-owned" || entry.ownershipClass === "runtime-state" || entry.ownershipClass === "project-override") continue;
11266
+ const ownershipClass = entry.ownershipClass ?? (manifest.schemaVersion === 1 ? "managed-snapshot" : null);
11267
+ if (!ownershipClass || !entry.sourceId || !/^[a-f0-9]{64}$/i.test(entry.hash)) {
11268
+ if (!requireFullProof) continue;
11269
+ return fail("ownership-unverified", `The saved ownership proof is incomplete for ${relative}. No checkout ownership changed.`);
11270
+ }
11271
+ const absolute = assertSafeFilePath(root, relative);
11265
11272
  const stat = lstatSync6(absolute, { throwIfNoEntry: false });
11266
- if (!stat) return [relative, "missing"];
11267
- if (stat.isSymbolicLink()) return [relative, `link:${readlinkSync(absolute)}`];
11268
- if (stat.isFile()) return [relative, `file:${sha(readFileSync5(absolute))}`];
11269
- if (stat.isDirectory()) return [relative, "directory"];
11270
- return [relative, "unsupported"];
11271
- });
11272
- return sha(canonicalJson(facts));
11273
- }
11274
- function checkoutVerificationEvidence(db, root, projectId, checkoutId, ledgerJson) {
11275
- const config = path9.join(root, ".make-docs", "config.yaml");
11276
- const configStat = lstatSync6(config, { throwIfNoEntry: false });
11277
- if (configStat && (!configStat.isFile() || configStat.isSymbolicLink()))
11278
- fail("ownership-unverified", "The checkout identity file is not a safe regular file.");
11279
- const operationPaths = db.prepare(`
11280
- SELECT DISTINCT step.relative_path
11281
- FROM installation_steps step
11282
- JOIN installation_operations operation ON operation.operation_id=step.operation_id
11283
- WHERE operation.checkout_id=? AND step.applied=1
11284
- `).all(checkoutId).map((row) => row.relative_path);
11273
+ if (entry.skillExposure) {
11274
+ try {
11275
+ verifySkillExposure(root, relative, entry);
11276
+ } catch (error) {
11277
+ if (!requireFullProof && error instanceof InstallationStateError && error.code === "ownership-unverified") continue;
11278
+ throw error;
11279
+ }
11280
+ facts.push({ path: relative, ownershipClass, hash: entry.hash });
11281
+ continue;
11282
+ }
11283
+ if (!stat?.isFile() || stat.isSymbolicLink()) {
11284
+ if (requireFullProof) return fail("ownership-unverified", `The saved ${ownershipClass} path is not a regular file: ${relative}. No checkout ownership changed.`);
11285
+ continue;
11286
+ }
11287
+ const bytes = readFileSync5(absolute);
11288
+ let actualHash;
11289
+ if (ownershipClass === "managed-block") {
11290
+ const parsed = parseManagedBlock(bytes.toString("utf8"));
11291
+ if (parsed.state !== "valid" || parsed.body === null) {
11292
+ if (requireFullProof) return fail("ownership-unverified", `The managed block markers are invalid for ${relative}. No checkout ownership changed.`);
11293
+ continue;
11294
+ }
11295
+ actualHash = sha(parsed.body);
11296
+ } else {
11297
+ actualHash = sha(bytes);
11298
+ }
11299
+ if (actualHash !== entry.hash) {
11300
+ if (requireFullProof) return fail("ownership-unverified", `The saved ${ownershipClass} hash does not match ${relative}. No checkout ownership changed.`);
11301
+ continue;
11302
+ }
11303
+ facts.push({ path: relative, ownershipClass, hash: entry.hash });
11304
+ }
11305
+ return facts;
11306
+ }
11307
+ function verifySkillExposure(root, relative, entry) {
11308
+ const exposure = entry.skillExposure;
11309
+ if (entry.ownershipClass !== "selected-skill" || exposure.exposurePath !== relative || !exposure.mode)
11310
+ fail("ownership-unverified", `The saved skill exposure proof is incomplete for ${relative}.`);
11311
+ const absolute = assertSafeFilePath(root, relative);
11312
+ const stat = lstatSync6(absolute, { throwIfNoEntry: false });
11313
+ if (exposure.mode === "symlink") {
11314
+ if (!stat?.isSymbolicLink() || readlinkSync(absolute) !== exposure.symlinkTarget)
11315
+ fail("ownership-unverified", `The saved skill link does not match ${relative}.`);
11316
+ const linked = path9.resolve(path9.dirname(absolute), exposure.symlinkTarget);
11317
+ const canonical2 = assertSafeFilePath(root, exposure.canonicalPayloadPath);
11318
+ if (!platform.samePath(linked, canonical2))
11319
+ fail("ownership-unverified", `The saved skill link target is inconsistent for ${relative}.`);
11320
+ return;
11321
+ }
11322
+ if (!stat?.isDirectory() || stat.isSymbolicLink())
11323
+ fail("ownership-unverified", `The saved skill copy is not a directory: ${relative}.`);
11324
+ const canonical = assertSafeFilePath(root, exposure.canonicalPayloadPath);
11325
+ if (!lstatSync6(canonical, { throwIfNoEntry: false })?.isDirectory())
11326
+ fail("ownership-unverified", `The saved skill source is not a directory: ${relative}.`);
11327
+ const tree = (directory) => {
11328
+ const result = [];
11329
+ const visit3 = (current) => {
11330
+ for (const child of readdirSync4(current, { withFileTypes: true })) {
11331
+ const file = path9.join(current, child.name);
11332
+ if (child.isDirectory()) visit3(file);
11333
+ else if (child.isFile()) result.push([path9.relative(directory, file), sha(readFileSync5(file))]);
11334
+ else fail("ownership-unverified", `The saved skill copy contains an unsafe path: ${relative}.`);
11335
+ }
11336
+ };
11337
+ visit3(directory);
11338
+ return result.sort(([a], [b]) => a.localeCompare(b));
11339
+ };
11340
+ if (canonicalJson(tree(absolute)) !== canonicalJson(tree(canonical)))
11341
+ fail("ownership-unverified", `The saved skill copy differs from its source: ${relative}.`);
11342
+ }
11343
+ function checkoutVerificationEvidence(_db, root, projectId, _checkoutId, ledgerJson, requireFullProof = true) {
11344
+ const declaredId = readDeclarativeProjectId(root);
11345
+ if (declaredId && declaredId !== projectId)
11346
+ return fail("ownership-unverified", "The config project identity conflicts with the saved installation ledger.");
11285
11347
  return {
11286
- schemaVersion: 1,
11348
+ schemaVersion: 2,
11287
11349
  projectId,
11288
- configDigest: configStat ? sha(readFileSync5(config)) : null,
11289
11350
  ledgerDigest: ledgerJson && ledgerJson !== "null" ? sha(ledgerJson) : null,
11290
- managedContentDigest: managedContentDigest(root, ledgerJson, operationPaths)
11351
+ ownershipFacts: checkoutOwnershipFacts(root, ledgerJson, projectId, requireFullProof)
11291
11352
  };
11292
11353
  }
11293
11354
  function parseCheckoutVerification(row) {
11294
11355
  if (!row.verification_json) return null;
11295
11356
  try {
11296
11357
  const value = JSON.parse(row.verification_json);
11358
+ if (value.schemaVersion === 2 && typeof value.projectId === "string" && (typeof value.ledgerDigest === "string" || value.ledgerDigest === null) && Array.isArray(value.ownershipFacts) && value.ownershipFacts.every((fact) => typeof fact?.path === "string" && typeof fact?.ownershipClass === "string" && typeof fact?.hash === "string"))
11359
+ return value;
11297
11360
  return value.schemaVersion === 1 && typeof value.projectId === "string" && (typeof value.configDigest === "string" || value.configDigest === null) && (typeof value.ledgerDigest === "string" || value.ledgerDigest === null) && (typeof value.managedContentDigest === "string" || value.managedContentDigest === null) ? value : null;
11298
11361
  } catch {
11299
11362
  return null;
11300
11363
  }
11301
11364
  }
11302
11365
  function sameCheckoutEvidence(left, right) {
11303
- return left.projectId === right.projectId && left.configDigest === right.configDigest && left.ledgerDigest === right.ledgerDigest && left.managedContentDigest === right.managedContentDigest;
11366
+ if (left.projectId !== right.projectId || left.ledgerDigest !== right.ledgerDigest) return false;
11367
+ if (left.schemaVersion === 1) return left.ledgerDigest !== null;
11368
+ return canonicalJson(left.ownershipFacts) === canonicalJson(right.ownershipFacts);
11304
11369
  }
11305
11370
  function assertCheckoutIdentity(row, root) {
11306
11371
  const id = readDeclarativeProjectId(root);
@@ -11322,32 +11387,161 @@ function bindCheckout(db, root, projectId) {
11322
11387
  fail("ownership-unverified", "The requested project identity conflicts with the checkout config.");
11323
11388
  const id = declarativeId ?? projectId ?? randomUUID5();
11324
11389
  const sameProject = db.prepare("SELECT * FROM installation_checkouts WHERE project_id=?").all(id);
11325
- const absent = sameProject.filter((row2) => !existsSync3(row2.root_path));
11326
- if (absent.length && declarativeId) {
11327
- if (absent.length !== 1)
11328
- fail("ownership-unverified", "More than one absent checkout can claim this project path. No Store identity changed.");
11329
- const row2 = absent[0];
11330
- const busy = db.prepare("SELECT 1 FROM installation_operations WHERE checkout_id=? AND status='pending'").get(row2.checkout_id);
11331
- if (busy || db.prepare("SELECT 1 FROM installation_locks WHERE root_path=?").get(row2.root_path))
11332
- fail("recovery-required", "Resolve the old checkout operation before rebinding its path.");
11333
- const ledger = db.prepare("SELECT manifest_json FROM installation_ledgers WHERE checkout_id=?").get(row2.checkout_id)?.manifest_json ?? null;
11334
- const priorEvidence = parseCheckoutVerification(row2);
11335
- const currentEvidence = checkoutVerificationEvidence(db, root, id, row2.checkout_id, ledger);
11336
- if (!priorEvidence || !sameCheckoutEvidence(priorEvidence, currentEvidence))
11337
- fail("ownership-unverified", "The moved checkout content does not match its last verified Store facts. No Store identity changed.");
11338
- const key = platform.comparisonKey(root);
11339
- const competing = db.prepare("SELECT * FROM installation_checkouts WHERE checkout_id<>?").all(row2.checkout_id).some((candidate) => candidate.root_path_key === key || platform.samePath(candidate.root_path, root));
11340
- if (competing)
11341
- fail("ownership-unverified", "Another checkout already claims this platform path. No Store identity changed.");
11342
- const verifiedAt = now();
11343
- const verificationJson = JSON.stringify(currentEvidence);
11344
- db.prepare("UPDATE installation_checkouts SET root_path=?,root_path_key=?,verified_at=?,verification_json=? WHERE checkout_id=?").run(root, key, verifiedAt, verificationJson, row2.checkout_id);
11345
- return { ...row2, root_path: root, root_path_key: key, verified_at: verifiedAt, verification_json: verificationJson };
11346
- }
11390
+ if (sameProject.length && declarativeId)
11391
+ fail("ownership-unverified", "This project ID has a Store checkout at another path. Review checkout move or register a separate checkout before setup. No Store identity changed.");
11347
11392
  const row = { checkout_id: randomUUID5(), project_id: id, root_path: root, root_path_key: platform.comparisonKey(root), verified_at: null, verification_json: null };
11348
11393
  db.prepare("INSERT INTO installation_checkouts (checkout_id,project_id,root_path,created_at,root_path_key,verified_at,verification_json) VALUES (?,?,?,?,?,?,?)").run(row.checkout_id, id, root, now(), row.root_path_key, row.verified_at, row.verification_json);
11349
11394
  return row;
11350
11395
  }
11396
+ function previewInstallationCheckoutMove(projectRoot, sourceCheckoutId, storeRoot) {
11397
+ const root = canonicalInstallationPath(projectRoot);
11398
+ const id = readDeclarativeProjectId(root);
11399
+ const base = { schemaVersion: 1, projectId: id, targetRoot: root };
11400
+ if (!id) return { ...base, status: "none", candidates: [], nextAction: "A valid projectId in .make-docs/config.yaml is required before checkout move." };
11401
+ const store = validateInstallationStoreRoot(root, storeRoot ?? resolveStoreRoot());
11402
+ if (classifyStoreCheckpoint9State(store).state !== "supported-current")
11403
+ return { ...base, status: "blocked", candidates: [], nextAction: "The Store must use the current schema before checkout move." };
11404
+ return withInstallationDatabase(root, (db) => previewInstallationCheckoutMoveInDatabase(db, root, id, sourceCheckoutId), { storeRoot: store, readOnly: true });
11405
+ }
11406
+ function previewInstallationCheckoutMoveInDatabase(db, root, id, sourceCheckoutId) {
11407
+ const base = { schemaVersion: 1, projectId: id, targetRoot: root };
11408
+ const bound = checkout(db, root);
11409
+ if (bound && bound.project_id === id) {
11410
+ assertCheckoutIdentity(bound, root);
11411
+ return { ...base, status: "bound", candidates: [], nextAction: "This checkout is already bound. Continue setup." };
11412
+ }
11413
+ const rows = db.prepare("SELECT * FROM installation_checkouts WHERE project_id=? ORDER BY checkout_id").all(id);
11414
+ const targetKey = platform.comparisonKey(root);
11415
+ const claimed = db.prepare("SELECT * FROM installation_checkouts").all().some((row) => row.root_path_key === targetKey || platform.samePath(row.root_path, root));
11416
+ const configDigest = sha(readFileSync5(path9.join(root, ".make-docs/config.yaml")));
11417
+ const separateReviewDigest = claimed || !rows.length ? null : sha(canonicalJson({
11418
+ schemaVersion: 1,
11419
+ action: "register-separate",
11420
+ projectId: id,
11421
+ targetRoot: root,
11422
+ targetKey,
11423
+ configDigest,
11424
+ otherCheckouts: rows.map((row) => [row.checkout_id, row.root_path, row.root_path_key])
11425
+ }));
11426
+ const candidates = rows.map((row) => {
11427
+ const blockers = [];
11428
+ if (sourceCheckoutId && row.checkout_id !== sourceCheckoutId) blockers.push("Another source checkout was selected.");
11429
+ if (lstatSync6(row.root_path, { throwIfNoEntry: false })) blockers.push("The source path still exists.");
11430
+ if (claimed) blockers.push("Another checkout claims the target path.");
11431
+ if (db.prepare("SELECT 1 FROM installation_operations WHERE checkout_id=? AND status='pending'").get(row.checkout_id)) blockers.push("The source has pending work.");
11432
+ for (const lockedRoot of [row.root_path, root]) {
11433
+ const lock = db.prepare("SELECT pid,hostname FROM installation_locks WHERE root_path=?").get(lockedRoot);
11434
+ if (lock) blockers.push(isDead(lock.pid, lock.hostname) ? "A dead writer lock needs recovery." : "A writer is active.");
11435
+ }
11436
+ if (db.prepare("SELECT 1 FROM tool_operations WHERE status='pending' LIMIT 1").get()) blockers.push("A tool operation is pending.");
11437
+ const ledger = db.prepare("SELECT manifest_json FROM installation_ledgers WHERE checkout_id=?").get(row.checkout_id)?.manifest_json ?? null;
11438
+ const saved = parseCheckoutVerification(row);
11439
+ let current = null;
11440
+ if (!ledger || !saved) blockers.push("The source lacks a saved ledger or ownership proof.");
11441
+ else {
11442
+ try {
11443
+ current = checkoutVerificationEvidence(db, root, id, row.checkout_id, ledger);
11444
+ } catch (error) {
11445
+ blockers.push(error instanceof Error ? error.message : String(error));
11446
+ }
11447
+ if (current && !sameCheckoutEvidence(saved, current)) blockers.push("Target ownership does not match the saved Store facts.");
11448
+ if (current && current.ownershipFacts.length === 0) blockers.push("The target has no independent managed ownership fact.");
11449
+ }
11450
+ const reviewDigest = blockers.length || !current || !saved || !ledger ? null : sha(canonicalJson({
11451
+ schemaVersion: 1,
11452
+ projectId: id,
11453
+ checkoutId: row.checkout_id,
11454
+ sourceRoot: canonicalInstallationPath(row.root_path),
11455
+ sourceKey: row.root_path_key,
11456
+ targetRoot: root,
11457
+ targetKey,
11458
+ configDigest,
11459
+ ledgerDigest: sha(ledger),
11460
+ targetFiles: current.ownershipFacts.map((fact) => {
11461
+ const absolute = path9.join(root, fact.path);
11462
+ const stat = lstatSync6(absolute, { throwIfNoEntry: false });
11463
+ return [fact.path, stat?.isSymbolicLink() ? `link:${readlinkSync(absolute)}` : stat?.isFile() ? `file:${sha(readFileSync5(absolute))}` : "missing"];
11464
+ }),
11465
+ savedEvidenceDigest: sha(row.verification_json),
11466
+ targetEvidence: current
11467
+ }));
11468
+ return { checkoutId: row.checkout_id, sourceRoot: row.root_path, targetRoot: root, available: blockers.length === 0, blockers, reviewDigest };
11469
+ });
11470
+ const selected = sourceCheckoutId ? candidates.find((candidate) => candidate.checkoutId === sourceCheckoutId) : candidates.length === 1 ? candidates[0] : null;
11471
+ return {
11472
+ ...base,
11473
+ status: selected?.available ? "ready" : "blocked",
11474
+ candidates,
11475
+ separateReviewDigest,
11476
+ nextAction: !candidates.length ? "No saved checkout has this project ID. Review setup as a new registration." : candidates.length > 1 && !sourceCheckoutId ? "Select one source checkout ID before move. Register separately or cancel if the source is not the same checkout." : selected?.available ? "Review the exact source, target, and digest. Apply checkout move only with explicit approval." : "Resolve the listed blockers. Register a separate checkout or cancel."
11477
+ };
11478
+ }
11479
+ function registerSeparateInstallationCheckout(projectRoot, reviewDigest, storeRoot) {
11480
+ const root = canonicalInstallationPath(projectRoot);
11481
+ const store = validateInstallationStoreRoot(root, storeRoot ?? resolveStoreRoot());
11482
+ if (classifyStoreCheckpoint9State(store).state !== "supported-current")
11483
+ fail("store-unavailable", "Separate checkout registration requires a current Store.");
11484
+ return withInstallationDatabase(root, (db) => transaction(db, () => {
11485
+ const id = readDeclarativeProjectId(root);
11486
+ if (!id) fail("ownership-unverified", "A valid config projectId is required.");
11487
+ const preview = previewInstallationCheckoutMoveInDatabase(db, root, id);
11488
+ if (!preview.separateReviewDigest || preview.separateReviewDigest !== reviewDigest)
11489
+ fail("ownership-unverified", "Separate checkout review is stale or blocked. Preview again.");
11490
+ const checkoutId = randomUUID5();
11491
+ db.prepare("INSERT INTO installation_checkouts (checkout_id,project_id,root_path,created_at,root_path_key,verified_at,verification_json) VALUES (?,?,?,?,?,?,?)").run(checkoutId, id, root, now(), platform.comparisonKey(root), null, null);
11492
+ return {
11493
+ status: "registered",
11494
+ projectId: id,
11495
+ checkoutId,
11496
+ targetRoot: root,
11497
+ effect: "new-checkout-binding",
11498
+ projectFilesChanged: false,
11499
+ nextAction: "Run setup for this target to review its own installation state."
11500
+ };
11501
+ }), { storeRoot: store, skipPreparation: true });
11502
+ }
11503
+ function applyInstallationCheckoutMove(projectRoot, sourceCheckoutId, sourceRoot, reviewDigest, storeRoot) {
11504
+ const root = canonicalInstallationPath(projectRoot);
11505
+ const store = validateInstallationStoreRoot(root, storeRoot ?? resolveStoreRoot());
11506
+ if (classifyStoreCheckpoint9State(store).state !== "supported-current")
11507
+ fail("store-unavailable", "Checkout move requires a current Store. No Store state changed.");
11508
+ return withInstallationDatabase(root, (db) => transaction(db, () => {
11509
+ const alreadyBound = checkout(db, root);
11510
+ if (alreadyBound?.checkout_id === sourceCheckoutId && canonicalInstallationPath(sourceRoot) !== root) {
11511
+ const ledger2 = db.prepare("SELECT manifest_json FROM installation_ledgers WHERE checkout_id=?").get(sourceCheckoutId)?.manifest_json;
11512
+ const receipts = db.prepare("SELECT record_json FROM installation_migration_records WHERE checkout_id=? AND kind='receipt' AND record_id LIKE 'checkout-move:%'").all(sourceCheckoutId);
11513
+ const receipt2 = receipts.map((item) => JSON.parse(item.record_json)).find((item) => item.reviewDigest === reviewDigest && item.checkoutId === sourceCheckoutId && item.sourceRoot === canonicalInstallationPath(sourceRoot) && item.targetRoot === root && item.projectId === alreadyBound.project_id && item.ledgerDigest === (ledger2 ? sha(ledger2) : null) && item.evidenceDigest === (alreadyBound.verification_json ? sha(alreadyBound.verification_json) : null));
11514
+ if (receipt2) return {
11515
+ status: "already-completed",
11516
+ ...receipt2,
11517
+ effect: "checkout-already-bound",
11518
+ projectFilesChanged: false,
11519
+ nextAction: "Continue setup for this target."
11520
+ };
11521
+ }
11522
+ const id = readDeclarativeProjectId(root);
11523
+ if (!id) fail("ownership-unverified", "A valid config projectId is required for checkout move.");
11524
+ const preview = previewInstallationCheckoutMoveInDatabase(db, root, id, sourceCheckoutId);
11525
+ const selected = preview.candidates.find((candidate) => candidate.checkoutId === sourceCheckoutId);
11526
+ if (preview.status !== "ready" || !selected?.reviewDigest || selected.reviewDigest !== reviewDigest || canonicalInstallationPath(selected.sourceRoot) !== canonicalInstallationPath(sourceRoot))
11527
+ fail("ownership-unverified", "Checkout move review is stale or blocked. Preview again. No Store identity changed.");
11528
+ const row = db.prepare("SELECT * FROM installation_checkouts WHERE checkout_id=?").get(sourceCheckoutId);
11529
+ const ledger = db.prepare("SELECT manifest_json FROM installation_ledgers WHERE checkout_id=?").get(sourceCheckoutId).manifest_json;
11530
+ const evidence = checkoutVerificationEvidence(db, root, row.project_id, sourceCheckoutId, ledger);
11531
+ const verifiedAt = now();
11532
+ const verificationJson = JSON.stringify(evidence);
11533
+ db.prepare("UPDATE installation_checkouts SET root_path=?,root_path_key=?,verified_at=?,verification_json=? WHERE checkout_id=?").run(root, platform.comparisonKey(root), verifiedAt, verificationJson, sourceCheckoutId);
11534
+ const receipt = { schemaVersion: 1, operation: "project.checkout-move.apply", projectId: row.project_id, checkoutId: sourceCheckoutId, sourceRoot: row.root_path, targetRoot: root, reviewDigest, ledgerDigest: sha(ledger), evidenceDigest: sha(verificationJson), appliedAt: verifiedAt };
11535
+ db.prepare("INSERT INTO installation_migration_records (checkout_id,kind,record_id,record_json) VALUES (?,'receipt',?,?)").run(sourceCheckoutId, `checkout-move:${randomUUID5()}`, JSON.stringify(receipt));
11536
+ return {
11537
+ status: "completed",
11538
+ ...receipt,
11539
+ effect: "checkout-binding-moved",
11540
+ projectFilesChanged: false,
11541
+ nextAction: "Continue setup for this target."
11542
+ };
11543
+ }), { storeRoot: store, skipPreparation: true });
11544
+ }
11351
11545
  function getInstallationCheckoutId(projectRoot, storeRoot) {
11352
11546
  const root = canonicalInstallationPath(projectRoot);
11353
11547
  return withInstallationDatabase(root, (db) => transaction(db, () => bindCheckout(db, root).checkout_id), { storeRoot });
@@ -11529,7 +11723,7 @@ function commitOperation(db, id, root, rollback = false) {
11529
11723
  else
11530
11724
  db.prepare("DELETE FROM installation_ledgers WHERE checkout_id=?").run(op.checkout_id);
11531
11725
  const owner = db.prepare("SELECT project_id FROM installation_checkouts WHERE checkout_id=?").get(op.checkout_id);
11532
- const evidence = checkoutVerificationEvidence(db, root, owner.project_id, op.checkout_id, ledger);
11726
+ const evidence = checkoutVerificationEvidence(db, root, owner.project_id, op.checkout_id, ledger, false);
11533
11727
  db.prepare("UPDATE installation_checkouts SET root_path=?,root_path_key=?,verified_at=?,verification_json=? WHERE checkout_id=?").run(root, platform.comparisonKey(root), now(), JSON.stringify(evidence), op.checkout_id);
11534
11728
  db.prepare("UPDATE installation_operations SET status=?,finished_at=? WHERE operation_id=?").run(rollback ? "rolled-back" : "completed", now(), id);
11535
11729
  });
@@ -12454,7 +12648,8 @@ var PROVENANCE_KINDS = /* @__PURE__ */ new Set([
12454
12648
  ]);
12455
12649
  var SUPPORTED_HARNESSES = /* @__PURE__ */ new Set([
12456
12650
  "claude-code",
12457
- "codex"
12651
+ "codex",
12652
+ "github-copilot"
12458
12653
  ]);
12459
12654
  function loadSkillRegistry(packageRoot) {
12460
12655
  const registryPath = path10.join(packageRoot, REGISTRY_FILENAME);
@@ -12975,7 +13170,7 @@ function validateEmbeddedSkillBundle(candidate) {
12975
13170
  }
12976
13171
  async function loadEmbeddedSkillBundle() {
12977
13172
  try {
12978
- const { bundle, sourceTestAdapter } = await import("./virtual_make-docs-first-party-skills-H3FC47C2.js");
13173
+ const { bundle, sourceTestAdapter } = await import("./virtual_make-docs-first-party-skills-5TYTCD5U.js");
12979
13174
  validateEmbeddedSkillBundle(bundle);
12980
13175
  const [registryBytes, packageBytes] = await Promise.all([
12981
13176
  readFile(path11.join(PACKAGE_ROOT, "skill-registry.json")),
@@ -13892,6 +14087,8 @@ export {
13892
14087
  openStoreSqliteConnection,
13893
14088
  STORE_LEASE_RECOVERY_FILE,
13894
14089
  GLOBAL_ASSET_LOCK_FILE,
14090
+ parseManagedBlock,
14091
+ upsertManagedBlock,
13895
14092
  getHarnessSkillDirectory,
13896
14093
  InstallationStateError,
13897
14094
  readInstallationPathClaims,
@@ -13903,6 +14100,9 @@ export {
13903
14100
  withReviewedStoreCompatibilityBridge,
13904
14101
  withInstallationDatabase,
13905
14102
  readDeclarativeProjectId,
14103
+ previewInstallationCheckoutMove,
14104
+ registerSeparateInstallationCheckout,
14105
+ applyInstallationCheckoutMove,
13906
14106
  getInstallationCheckoutId,
13907
14107
  getExistingInstallationCheckoutId,
13908
14108
  acquireInstallationLock,
@@ -13932,8 +14132,6 @@ export {
13932
14132
  PROJECT_RESOURCE_TYPES,
13933
14133
  HARNESS_TO_INSTRUCTION,
13934
14134
  DEFAULT_SYSTEM_ASSET_MATERIALIZATION_MODE,
13935
- parseManagedBlock,
13936
- upsertManagedBlock,
13937
14135
  PACKAGE_ROOT,
13938
14136
  TEMPLATE_ROOT,
13939
14137
  readPackageFile,
@@ -13992,4 +14190,4 @@ export {
13992
14190
  getRecommendedSkillChoices,
13993
14191
  applySkillRegistrySelectionMetadata
13994
14192
  };
13995
- //# sourceMappingURL=chunk-YVSASZMT.js.map
14193
+ //# sourceMappingURL=chunk-SFKYGFUV.js.map