@danmoisan/drm-copilot-mcp 1.0.0 → 1.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 (52) hide show
  1. package/out/mcp-server.js +814 -194
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agents/commit-message.md +42 -0
  4. package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +127 -0
  5. package/resources/claude-customizations/.claude/agents/human-exception-runbook.md +48 -0
  6. package/resources/claude-customizations/.claude/agents/orchestrator.md +67 -2
  7. package/resources/claude-customizations/.claude/agents/pr-author.md +37 -21
  8. package/resources/claude-customizations/.claude/hooks/check-powershell-test-purity.ps1 +103 -65
  9. package/resources/claude-customizations/.claude/hooks/check-python-test-purity.ps1 +12 -9
  10. package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +24 -16
  11. package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +19 -13
  12. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +304 -0
  13. package/resources/claude-customizations/.claude/hooks/enforce-epic-wave-barrier.ps1 +304 -0
  14. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate.ps1 +237 -0
  15. package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +16 -12
  16. package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +14 -10
  17. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +35 -8
  18. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +17 -14
  19. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.epic-base-branch.ps1 +104 -0
  20. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +268 -93
  21. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +19 -11
  22. package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +28 -6
  23. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +17 -14
  24. package/resources/claude-customizations/.claude/hooks/validate-bash.ps1 +146 -36
  25. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +19 -7
  26. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +36 -0
  27. package/resources/claude-customizations/.claude/settings.json +34 -1
  28. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +252 -0
  29. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +42 -13
  30. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +28 -0
  31. package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +22 -18
  32. package/resources/claude-customizations/pack-manifests/core.json +8 -0
  33. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +6 -3
  34. package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +1 -1
  35. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp/SKILL.md +65 -0
  36. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/csharp-qa-gate/SKILL.md +79 -0
  37. package/resources/codex-and-agents-customizations/.agents-variants/csharp-legacy/skills/invoke-csharp-engineer/SKILL.md +66 -0
  38. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -25
  39. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-pr-author-skill.ps1 +257 -93
  40. package/resources/codex-and-agents-customizations/.codex-variants/csharp-legacy/agents/csharp-typed-engineer.toml +98 -0
  41. package/resources/codex-and-agents-customizations/pack-manifests/core.json +24 -0
  42. package/resources/codex-and-agents-customizations/pack-manifests/csharp-legacy.json +11 -0
  43. package/resources/codex-and-agents-customizations/pack-manifests/csharp-modern.json +10 -0
  44. package/resources/codex-and-agents-customizations/pack-manifests/powershell.json +15 -0
  45. package/resources/codex-and-agents-customizations/pack-manifests/python.json +15 -0
  46. package/resources/codex-and-agents-customizations/pack-manifests/typescript.json +9 -0
  47. package/resources/config/orchestration-routing.json +92 -0
  48. package/resources/customizations/.github/agents/pr-author.agent.md +24 -18
  49. package/resources/icon.png +0 -0
  50. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +11 -0
  51. package/resources/codex-and-agents-customizations/.github/workflows/_validate-orchestrator-state.yml +0 -68
  52. package/resources/codex-and-agents-customizations/.github/workflows/validate-orchestrator-state.yml +0 -15
package/out/mcp-server.js CHANGED
@@ -8964,13 +8964,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
8964
8964
  }
8965
8965
  return propValues;
8966
8966
  });
8967
- const isObject7 = isObject;
8967
+ const isObject8 = isObject;
8968
8968
  const catchall = def.catchall;
8969
8969
  let value;
8970
8970
  inst._zod.parse = (payload, ctx) => {
8971
8971
  value ?? (value = _normalized.value);
8972
8972
  const input = payload.value;
8973
- if (!isObject7(input)) {
8973
+ if (!isObject8(input)) {
8974
8974
  payload.issues.push({
8975
8975
  expected: "object",
8976
8976
  code: "invalid_type",
@@ -9097,7 +9097,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
9097
9097
  return (payload, ctx) => fn(shape, payload, ctx);
9098
9098
  };
9099
9099
  let fastpass;
9100
- const isObject7 = isObject;
9100
+ const isObject8 = isObject;
9101
9101
  const jit = !globalConfig.jitless;
9102
9102
  const allowsEval2 = allowsEval;
9103
9103
  const fastEnabled = jit && allowsEval2.value;
@@ -9106,7 +9106,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
9106
9106
  inst._zod.parse = (payload, ctx) => {
9107
9107
  value ?? (value = _normalized.value);
9108
9108
  const input = payload.value;
9109
- if (!isObject7(input)) {
9109
+ if (!isObject8(input)) {
9110
9110
  payload.issues.push({
9111
9111
  expected: "object",
9112
9112
  code: "invalid_type",
@@ -15504,9 +15504,15 @@ function createBufferedOutput() {
15504
15504
  };
15505
15505
  }
15506
15506
  function executableExists(executable) {
15507
+ return findExecutableOnPath(executable) !== void 0;
15508
+ }
15509
+ function getPathExtensions() {
15510
+ return process.platform === "win32" ? (process.env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((part) => part.length > 0) : [""];
15511
+ }
15512
+ function findExecutableOnPath(executable) {
15507
15513
  const pathValue = process.env["PATH"] ?? "";
15508
15514
  const pathParts = pathValue.split(path.delimiter).filter((part) => part.length > 0);
15509
- const pathExtensions = process.platform === "win32" ? (process.env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((part) => part.length > 0) : [""];
15515
+ const pathExtensions = getPathExtensions();
15510
15516
  for (const directory of pathParts) {
15511
15517
  for (const extension of pathExtensions) {
15512
15518
  const candidate = path.join(
@@ -15514,11 +15520,11 @@ function executableExists(executable) {
15514
15520
  process.platform === "win32" ? `${executable}${extension}` : executable
15515
15521
  );
15516
15522
  if (fs.existsSync(candidate)) {
15517
- return true;
15523
+ return candidate.replace(/\\/g, "/");
15518
15524
  }
15519
15525
  }
15520
15526
  }
15521
- return false;
15527
+ return void 0;
15522
15528
  }
15523
15529
  function detectRuntime(runtimeKind) {
15524
15530
  void runtimeKind;
@@ -15660,6 +15666,54 @@ function getStderrExcerpt(error2) {
15660
15666
  return trimmed.length > 0 ? trimmed : void 0;
15661
15667
  }
15662
15668
 
15669
+ // ../../extensions/drm-copilot/src/mcp-push-down-schema-properties.ts
15670
+ var workspaceRootProperty = {
15671
+ type: "string",
15672
+ description: "Target workspace root. Defaults to process.cwd() when omitted."
15673
+ };
15674
+ var codexPacksProperty = {
15675
+ type: "array",
15676
+ items: {
15677
+ type: "string"
15678
+ },
15679
+ description: "Optional Codex language pack names to publish. When omitted, the full tree is published. 'core' is always included."
15680
+ };
15681
+ var codexCsharpVariantProperty = {
15682
+ type: "string",
15683
+ enum: ["modern", "legacy"],
15684
+ description: "Optional Codex C# toolchain variant to source ('modern' default or 'legacy')."
15685
+ };
15686
+ var codexMemoryModeProperty = {
15687
+ type: "string",
15688
+ enum: ["overwrite", "merge", "skip"],
15689
+ description: "Optional inert Codex memory parity field: 'overwrite' (default), 'merge', or 'skip'."
15690
+ };
15691
+ var codexPushDownSelectionProperties = {
15692
+ packs: codexPacksProperty,
15693
+ csharp_variant: codexCsharpVariantProperty,
15694
+ memory_mode: codexMemoryModeProperty
15695
+ };
15696
+ var copilotPushDownSelectionProperties = {};
15697
+ var claudePushDownSelectionProperties = {
15698
+ packs: {
15699
+ type: "array",
15700
+ items: {
15701
+ type: "string"
15702
+ },
15703
+ description: "Optional language pack names to publish (for example 'core', 'typescript'). When omitted, the full tree is published. 'core' is always included."
15704
+ },
15705
+ csharp_variant: {
15706
+ type: "string",
15707
+ enum: ["modern", "legacy"],
15708
+ description: "Optional C# toolchain variant to source ('modern' default or 'legacy')."
15709
+ },
15710
+ memory_mode: {
15711
+ type: "string",
15712
+ enum: ["overwrite", "merge", "skip"],
15713
+ description: "Optional agent-memory handling mode: 'overwrite' (default), 'merge', or 'skip'."
15714
+ }
15715
+ };
15716
+
15663
15717
  // ../../extensions/drm-copilot/src/workflow-command-arguments.ts
15664
15718
  var path2 = __toESM(require("node:path"));
15665
15719
  var SHORT_NAME_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
@@ -15771,10 +15825,6 @@ function normalizeWorkspaceDestinationPath(value, workspaceRoot, fieldName) {
15771
15825
  }
15772
15826
 
15773
15827
  // ../../extensions/drm-copilot/src/mcp-repo-automation-tool-definitions.ts
15774
- var workspaceRootProperty = {
15775
- type: "string",
15776
- description: "Target workspace root. Defaults to process.cwd() when omitted."
15777
- };
15778
15828
  var REPO_AUTOMATION_TOOL_DEFINITIONS = [
15779
15829
  {
15780
15830
  name: "collect_commit_context",
@@ -15852,7 +15902,8 @@ var REPO_AUTOMATION_TOOL_DEFINITIONS = [
15852
15902
  inputSchema: {
15853
15903
  type: "object",
15854
15904
  properties: {
15855
- workspace_root: workspaceRootProperty
15905
+ workspace_root: workspaceRootProperty,
15906
+ ...copilotPushDownSelectionProperties
15856
15907
  },
15857
15908
  additionalProperties: false
15858
15909
  }
@@ -15863,7 +15914,8 @@ var REPO_AUTOMATION_TOOL_DEFINITIONS = [
15863
15914
  inputSchema: {
15864
15915
  type: "object",
15865
15916
  properties: {
15866
- workspace_root: workspaceRootProperty
15917
+ workspace_root: workspaceRootProperty,
15918
+ ...codexPushDownSelectionProperties
15867
15919
  },
15868
15920
  additionalProperties: false
15869
15921
  }
@@ -15875,23 +15927,7 @@ var REPO_AUTOMATION_TOOL_DEFINITIONS = [
15875
15927
  type: "object",
15876
15928
  properties: {
15877
15929
  workspace_root: workspaceRootProperty,
15878
- packs: {
15879
- type: "array",
15880
- items: {
15881
- type: "string"
15882
- },
15883
- description: "Optional language pack names to publish (for example 'core', 'typescript'). When omitted, the full tree is published. 'core' is always included."
15884
- },
15885
- csharp_variant: {
15886
- type: "string",
15887
- enum: ["modern", "legacy"],
15888
- description: "Optional C# toolchain variant to source ('modern' default or 'legacy')."
15889
- },
15890
- memory_mode: {
15891
- type: "string",
15892
- enum: ["overwrite", "merge", "skip"],
15893
- description: "Optional agent-memory handling mode: 'overwrite' (default), 'merge', or 'skip'."
15894
- }
15930
+ ...claudePushDownSelectionProperties
15895
15931
  },
15896
15932
  additionalProperties: false
15897
15933
  }
@@ -16205,7 +16241,7 @@ var REPO_AUTOMATION_TOOLS = [
16205
16241
  ];
16206
16242
 
16207
16243
  // ../../extensions/drm-copilot/src/mcp-tool-inputs-push-down.ts
16208
- function resolveClaudePacksField(rawValue) {
16244
+ function resolvePacksField(rawValue) {
16209
16245
  if (rawValue === void 0) {
16210
16246
  return void 0;
16211
16247
  }
@@ -16240,7 +16276,22 @@ function resolveMemoryModeField(rawValue) {
16240
16276
  }
16241
16277
  function resolvePushDownClaudeCustomizationsToolInput(rawInput, fallbackWorkspaceRoot) {
16242
16278
  const args = asToolArgumentObject(rawInput);
16243
- const packs = resolveClaudePacksField(args["packs"]);
16279
+ const packs = resolvePacksField(args["packs"]);
16280
+ const csharpVariant = resolveCsharpVariantField(args["csharp_variant"]);
16281
+ const memoryMode = resolveMemoryModeField(args["memory_mode"]);
16282
+ return {
16283
+ workspaceRoot: normalizeWorkspaceRoot(
16284
+ args["workspace_root"],
16285
+ fallbackWorkspaceRoot
16286
+ ),
16287
+ ...packs === void 0 ? {} : { packs },
16288
+ ...csharpVariant === void 0 ? {} : { csharpVariant },
16289
+ ...memoryMode === void 0 ? {} : { memoryMode }
16290
+ };
16291
+ }
16292
+ function resolvePushDownCodexAndAgentsCustomizationsToolInput(rawInput, fallbackWorkspaceRoot) {
16293
+ const args = asToolArgumentObject(rawInput);
16294
+ const packs = resolvePacksField(args["packs"]);
16244
16295
  const csharpVariant = resolveCsharpVariantField(args["csharp_variant"]);
16245
16296
  const memoryMode = resolveMemoryModeField(args["memory_mode"]);
16246
16297
  return {
@@ -16381,15 +16432,6 @@ function resolvePushDownCopilotCustomizationsToolInput(rawInput, fallbackWorkspa
16381
16432
  )
16382
16433
  };
16383
16434
  }
16384
- function resolvePushDownCodexAndAgentsCustomizationsToolInput(rawInput, fallbackWorkspaceRoot) {
16385
- const args = asToolArgumentObject(rawInput);
16386
- return {
16387
- workspaceRoot: normalizeWorkspaceRoot(
16388
- args["workspace_root"],
16389
- fallbackWorkspaceRoot
16390
- )
16391
- };
16392
- }
16393
16435
  function resolveNewPotentialBugEntryToolInput(rawInput, fallbackWorkspaceRoot) {
16394
16436
  const args = asToolArgumentObject(rawInput);
16395
16437
  return {
@@ -17458,18 +17500,304 @@ function pushDownCustomizations2(options) {
17458
17500
  });
17459
17501
  }
17460
17502
 
17503
+ // ../../extensions/drm-copilot/src/lib/push-down/codex-pack-selection.ts
17504
+ var CORE_PACK_NAME = "core";
17505
+ var PUBLIC_CSHARP_PACK_NAME = "csharp";
17506
+ var SUPPORTED_PACK_NAMES = /* @__PURE__ */ new Set([
17507
+ "core",
17508
+ "python",
17509
+ "powershell",
17510
+ "typescript",
17511
+ PUBLIC_CSHARP_PACK_NAME
17512
+ ]);
17513
+ var MANIFEST_PACK_NAMES = /* @__PURE__ */ new Set([
17514
+ "core",
17515
+ "python",
17516
+ "powershell",
17517
+ "typescript",
17518
+ "csharp-modern",
17519
+ "csharp-legacy"
17520
+ ]);
17521
+ var CSHARP_CANONICAL_PATHS = [
17522
+ ".agents/skills/csharp/SKILL.md",
17523
+ ".agents/skills/csharp-qa-gate/SKILL.md",
17524
+ ".agents/skills/invoke-csharp-engineer/SKILL.md",
17525
+ ".codex/agents/csharp-typed-engineer.toml"
17526
+ ];
17527
+ var CSHARP_PACK_NAMES = /* @__PURE__ */ new Set([
17528
+ "csharp-modern",
17529
+ "csharp-legacy"
17530
+ ]);
17531
+ var AGENTS_LEGACY_VARIANT_SOURCE_PREFIX = ".agents-variants/csharp-legacy";
17532
+ var CODEX_LEGACY_VARIANT_SOURCE_PREFIX = ".codex-variants/csharp-legacy";
17533
+ var ManifestError = class extends Error {
17534
+ constructor(message) {
17535
+ super(message);
17536
+ this.name = "ManifestError";
17537
+ }
17538
+ };
17539
+ function joinPosix3(dir, name) {
17540
+ const normalizedDir = dir.replace(/\\/g, "/").replace(/\/+$/, "");
17541
+ return normalizedDir === "" ? name : `${normalizedDir}/${name}`;
17542
+ }
17543
+ function loadPackManifests(manifestDir, selectedPackNames, fs9) {
17544
+ const unknown2 = [...selectedPackNames].filter(
17545
+ (name) => !MANIFEST_PACK_NAMES.has(name)
17546
+ );
17547
+ if (unknown2.length > 0) {
17548
+ throw new ManifestError(`Unknown Codex pack name(s): ${unknown2.sort()}`);
17549
+ }
17550
+ const namesToLoad = new Set(selectedPackNames);
17551
+ namesToLoad.add(CORE_PACK_NAME);
17552
+ const manifests = /* @__PURE__ */ new Map();
17553
+ for (const name of [...namesToLoad].sort()) {
17554
+ const manifestPath = joinPosix3(manifestDir, `${name}.json`);
17555
+ if (!fs9.isFile(manifestPath)) {
17556
+ throw new ManifestError(
17557
+ `Codex pack manifest is missing for pack '${name}': ${manifestPath}`
17558
+ );
17559
+ }
17560
+ manifests.set(
17561
+ name,
17562
+ parseManifest(name, manifestPath, fs9.readTextFile(manifestPath))
17563
+ );
17564
+ }
17565
+ return manifests;
17566
+ }
17567
+ function resolveManifestPackNames(selectedPackNames, csharpVariant) {
17568
+ if (selectedPackNames === null || selectedPackNames.size === 0) {
17569
+ return null;
17570
+ }
17571
+ const variantSpecific = [...selectedPackNames].filter(
17572
+ (name) => CSHARP_PACK_NAMES.has(name)
17573
+ );
17574
+ if (variantSpecific.length > 0) {
17575
+ throw new ManifestError(
17576
+ `Use public Codex pack 'csharp' with csharpVariant instead of variant-specific pack name(s): ${variantSpecific.sort().join(", ")}.`
17577
+ );
17578
+ }
17579
+ const unknown2 = [...selectedPackNames].filter(
17580
+ (name) => !SUPPORTED_PACK_NAMES.has(name)
17581
+ );
17582
+ if (unknown2.length > 0) {
17583
+ throw new ManifestError(`Unknown Codex pack name(s): ${unknown2.sort()}`);
17584
+ }
17585
+ const manifestNames = new Set(selectedPackNames);
17586
+ if (manifestNames.has(PUBLIC_CSHARP_PACK_NAME)) {
17587
+ manifestNames.delete(PUBLIC_CSHARP_PACK_NAME);
17588
+ manifestNames.add(`csharp-${csharpVariant}`);
17589
+ }
17590
+ return manifestNames;
17591
+ }
17592
+ function parseManifest(name, manifestPath, rawText) {
17593
+ let loaded;
17594
+ try {
17595
+ loaded = JSON.parse(rawText);
17596
+ } catch {
17597
+ throw new ManifestError(
17598
+ `Codex pack manifest is not valid JSON for pack '${name}': ${manifestPath}`
17599
+ );
17600
+ }
17601
+ if (loaded === null || typeof loaded !== "object" || Array.isArray(loaded)) {
17602
+ throw new ManifestError(
17603
+ `Codex pack manifest must be a JSON object for pack '${name}': ${manifestPath}`
17604
+ );
17605
+ }
17606
+ const parsed = loaded;
17607
+ const manifestName = parsed["name"];
17608
+ const manifestLabel = parsed["label"] ?? manifestName;
17609
+ const manifestPaths = parsed["paths"];
17610
+ const sourcePrefix = parsed["source_prefix"];
17611
+ if (typeof manifestName !== "string" || manifestName === "") {
17612
+ throw new ManifestError(
17613
+ `Codex pack manifest 'name' must be a non-empty string: ${manifestPath}`
17614
+ );
17615
+ }
17616
+ if (typeof manifestLabel !== "string" || manifestLabel === "") {
17617
+ throw new ManifestError(
17618
+ `Codex pack manifest 'label' must be a non-empty string: ${manifestPath}`
17619
+ );
17620
+ }
17621
+ if (!Array.isArray(manifestPaths) || manifestPaths.length === 0) {
17622
+ throw new ManifestError(
17623
+ `Codex pack manifest 'paths' must be a non-empty list of strings: ${manifestPath}`
17624
+ );
17625
+ }
17626
+ const paths = [];
17627
+ for (const entry of manifestPaths) {
17628
+ if (typeof entry !== "string" || entry === "") {
17629
+ throw new ManifestError(
17630
+ `Codex pack manifest 'paths' must be a non-empty list of strings: ${manifestPath}`
17631
+ );
17632
+ }
17633
+ paths.push(entry);
17634
+ }
17635
+ if (sourcePrefix !== void 0 && sourcePrefix !== null && typeof sourcePrefix !== "string") {
17636
+ throw new ManifestError(
17637
+ `Codex pack manifest 'source_prefix' must be a string when present: ${manifestPath}`
17638
+ );
17639
+ }
17640
+ return {
17641
+ name: manifestName,
17642
+ label: manifestLabel,
17643
+ paths,
17644
+ sourcePrefix: sourcePrefix === void 0 || sourcePrefix === null ? null : sourcePrefix
17645
+ };
17646
+ }
17647
+ function computePublishedPaths(selectedPackNames, manifests) {
17648
+ if (selectedPackNames === null || selectedPackNames.size === 0) {
17649
+ return null;
17650
+ }
17651
+ const effectiveNames = new Set(selectedPackNames);
17652
+ effectiveNames.add(CORE_PACK_NAME);
17653
+ const published = /* @__PURE__ */ new Set();
17654
+ for (const name of effectiveNames) {
17655
+ const manifest = manifests.get(name);
17656
+ if (manifest === void 0) {
17657
+ throw new ManifestError(
17658
+ `No loaded Codex manifest for selected pack '${name}'.`
17659
+ );
17660
+ }
17661
+ for (const path10 of manifest.paths) {
17662
+ published.add(path10);
17663
+ }
17664
+ }
17665
+ return published;
17666
+ }
17667
+ function resolveVariantSourcePath(destinationRelativePath, csharpVariant) {
17668
+ if (csharpVariant === "legacy" && CSHARP_CANONICAL_PATHS.includes(destinationRelativePath)) {
17669
+ if (destinationRelativePath.startsWith(".agents/")) {
17670
+ return `${AGENTS_LEGACY_VARIANT_SOURCE_PREFIX}/${destinationRelativePath.slice(".agents/".length)}`;
17671
+ }
17672
+ if (destinationRelativePath.startsWith(".codex/")) {
17673
+ return `${CODEX_LEGACY_VARIANT_SOURCE_PREFIX}/${destinationRelativePath.slice(".codex/".length)}`;
17674
+ }
17675
+ }
17676
+ return destinationRelativePath;
17677
+ }
17678
+ function assertSingleCsharpToolchain(publishedPaths, selectedPackNames) {
17679
+ const selectedCsharp = [...selectedPackNames].filter((name) => CSHARP_PACK_NAMES.has(name)).sort();
17680
+ if (selectedCsharp.length > 1) {
17681
+ throw new ManifestError(
17682
+ `C# mutual exclusion violated: both modern and legacy Codex C# packs were selected (${selectedCsharp.join(", ")}); select exactly one C# variant.`
17683
+ );
17684
+ }
17685
+ void publishedPaths;
17686
+ }
17687
+
17461
17688
  // ../../extensions/drm-copilot/src/lib/push-down/codex-agents-customizations.ts
17462
17689
  var ARTIFACT_DIRECTORY3 = "artifacts/codex-and-agents-customizations";
17463
17690
  var ROOT_FOLDERS = [".codex", ".agents"];
17691
+ var PACK_MANIFEST_SUBDIR = "pack-manifests";
17464
17692
  function passthroughRewrite(text) {
17465
17693
  return [text, 0, 0, []];
17466
17694
  }
17695
+ function normalizePosix(value) {
17696
+ return value.replace(/\\/g, "/").replace(/\/+$/, "");
17697
+ }
17698
+ function joinPosix4(root, relative2) {
17699
+ const normalizedRoot = normalizePosix(root);
17700
+ const normalizedRelative = relative2.replace(/\\/g, "/").replace(/^\/+/, "");
17701
+ return normalizedRoot === "" ? normalizedRelative : `${normalizedRoot}/${normalizedRelative}`;
17702
+ }
17703
+ function relativeToPosix2(path10, root) {
17704
+ const normalizedPath = normalizePosix(path10);
17705
+ const normalizedRoot = normalizePosix(root);
17706
+ if (normalizedPath === normalizedRoot) {
17707
+ return "";
17708
+ }
17709
+ const prefix = `${normalizedRoot}/`;
17710
+ return normalizedPath.startsWith(prefix) ? normalizedPath.slice(prefix.length) : null;
17711
+ }
17712
+ var CodexFilteringFileSystem = class {
17713
+ constructor(inner, options) {
17714
+ this.inner = inner;
17715
+ this.sourceRoot = normalizePosix(options.sourceRoot);
17716
+ this.bundleRoot = normalizePosix(options.bundleRoot);
17717
+ this.publishedPaths = options.publishedPaths;
17718
+ this.csharpVariant = options.csharpVariant;
17719
+ }
17720
+ inner;
17721
+ sourceRoot;
17722
+ bundleRoot;
17723
+ publishedPaths;
17724
+ csharpVariant;
17725
+ sourceRelative(path10) {
17726
+ return relativeToPosix2(path10, this.sourceRoot);
17727
+ }
17728
+ isPackIncluded(path10) {
17729
+ if (this.publishedPaths === null) {
17730
+ return true;
17731
+ }
17732
+ const relative2 = this.sourceRelative(path10);
17733
+ return relative2 === null || this.publishedPaths.has(relative2);
17734
+ }
17735
+ resolveReadSource(path10) {
17736
+ if (this.csharpVariant !== "legacy") {
17737
+ return path10;
17738
+ }
17739
+ const relative2 = this.sourceRelative(path10);
17740
+ if (relative2 === null) {
17741
+ return path10;
17742
+ }
17743
+ const routed = resolveVariantSourcePath(relative2, "legacy");
17744
+ return routed === relative2 ? path10 : joinPosix4(this.bundleRoot, routed);
17745
+ }
17746
+ listFiles(root) {
17747
+ return this.inner.listFiles(root).filter((path10) => this.isPackIncluded(path10));
17748
+ }
17749
+ isDir(path10) {
17750
+ return this.inner.isDir(path10);
17751
+ }
17752
+ isFile(path10) {
17753
+ return this.inner.isFile(path10);
17754
+ }
17755
+ readTextFile(path10) {
17756
+ return this.inner.readTextFile(this.resolveReadSource(path10));
17757
+ }
17758
+ writeTextFile(path10, content) {
17759
+ this.inner.writeTextFile(path10, content);
17760
+ }
17761
+ ensureDir(path10) {
17762
+ this.inner.ensureDir(path10);
17763
+ }
17764
+ };
17765
+ function resolvePublishedPaths(packs, csharpVariant, bundleRoot, fs9) {
17766
+ const manifestPacks = resolveManifestPackNames(packs ?? null, csharpVariant);
17767
+ if (manifestPacks === null || manifestPacks.size === 0) {
17768
+ return null;
17769
+ }
17770
+ const manifests = loadPackManifests(
17771
+ joinPosix4(bundleRoot, PACK_MANIFEST_SUBDIR),
17772
+ manifestPacks,
17773
+ fs9
17774
+ );
17775
+ const published = computePublishedPaths(manifestPacks, manifests) ?? /* @__PURE__ */ new Set();
17776
+ assertSingleCsharpToolchain(published, manifestPacks);
17777
+ return published;
17778
+ }
17467
17779
  function pushDownCustomizations3(options) {
17780
+ const sourceRoot = options.sourceRoot ?? options.repoRoot;
17781
+ const bundleRoot = options.bundleRoot ?? sourceRoot;
17782
+ const csharpVariant = options.csharpVariant ?? "modern";
17783
+ const publishedPaths = resolvePublishedPaths(
17784
+ options.packs,
17785
+ csharpVariant,
17786
+ bundleRoot,
17787
+ options.fs
17788
+ );
17789
+ const filteringFs = new CodexFilteringFileSystem(options.fs, {
17790
+ sourceRoot,
17791
+ bundleRoot,
17792
+ publishedPaths,
17793
+ csharpVariant
17794
+ });
17795
+ void options.memoryMode;
17468
17796
  return pushDownCustomizations({
17469
17797
  repoRoot: options.repoRoot,
17470
17798
  destinationRoot: options.destinationRoot,
17471
- fs: options.fs,
17472
- ...options.sourceRoot === void 0 ? {} : { sourceRoot: options.sourceRoot },
17799
+ fs: filteringFs,
17800
+ sourceRoot,
17473
17801
  ...options.artifactRoot === void 0 ? {} : { artifactRoot: options.artifactRoot },
17474
17802
  rootFolders: ROOT_FOLDERS,
17475
17803
  artifactDirectory: ARTIFACT_DIRECTORY3,
@@ -17506,11 +17834,11 @@ function readMemoryScope(content) {
17506
17834
  }
17507
17835
  return scopeValue === GENERAL_MEMORY_SCOPE ? GENERAL_MEMORY_SCOPE : REPO_MEMORY_SCOPE;
17508
17836
  }
17509
- function normalizePosix(value) {
17837
+ function normalizePosix2(value) {
17510
17838
  return value.replace(/\\/g, "/").replace(/\/+$/, "");
17511
17839
  }
17512
17840
  function isUnderAgentMemory(relativePosixPath) {
17513
- const normalized = normalizePosix(relativePosixPath);
17841
+ const normalized = normalizePosix2(relativePosixPath);
17514
17842
  return normalized === AGENT_MEMORY_RELATIVE_ROOT || normalized.startsWith(`${AGENT_MEMORY_RELATIVE_ROOT}/`);
17515
17843
  }
17516
17844
  function isGeneralMemoryFile(relativePosixPath, content) {
@@ -17521,55 +17849,55 @@ function isGeneralMemoryFile(relativePosixPath, content) {
17521
17849
  }
17522
17850
 
17523
17851
  // ../../extensions/drm-copilot/src/lib/push-down/claude-pack-selection.ts
17524
- var CORE_PACK_NAME = "core";
17525
- var CSHARP_CANONICAL_PATHS = [
17852
+ var CORE_PACK_NAME2 = "core";
17853
+ var CSHARP_CANONICAL_PATHS2 = [
17526
17854
  ".claude/rules/csharp.md",
17527
17855
  ".claude/agents/csharp-typed-engineer.md",
17528
17856
  ".claude/skills/csharp-qa-gate/SKILL.md",
17529
17857
  ".claude/skills/invoke-csharp-engineer/SKILL.md"
17530
17858
  ];
17531
- var CSHARP_PACK_NAMES = /* @__PURE__ */ new Set([
17859
+ var CSHARP_PACK_NAMES2 = /* @__PURE__ */ new Set([
17532
17860
  "csharp-modern",
17533
17861
  "csharp-legacy"
17534
17862
  ]);
17535
17863
  var LEGACY_VARIANT_SOURCE_PREFIX = ".claude-variants/csharp-legacy";
17536
- var ManifestError = class extends Error {
17864
+ var ManifestError2 = class extends Error {
17537
17865
  constructor(message) {
17538
17866
  super(message);
17539
17867
  this.name = "ManifestError";
17540
17868
  }
17541
17869
  };
17542
- function joinPosix3(dir, name) {
17870
+ function joinPosix5(dir, name) {
17543
17871
  const normalizedDir = dir.replace(/\\/g, "/").replace(/\/+$/, "");
17544
17872
  return normalizedDir === "" ? name : `${normalizedDir}/${name}`;
17545
17873
  }
17546
- function loadPackManifests(manifestDir, selectedPackNames, fs9) {
17874
+ function loadPackManifests2(manifestDir, selectedPackNames, fs9) {
17547
17875
  const namesToLoad = new Set(selectedPackNames);
17548
- namesToLoad.add(CORE_PACK_NAME);
17876
+ namesToLoad.add(CORE_PACK_NAME2);
17549
17877
  const manifests = /* @__PURE__ */ new Map();
17550
17878
  for (const name of [...namesToLoad].sort()) {
17551
- const manifestPath = joinPosix3(manifestDir, `${name}.json`);
17879
+ const manifestPath = joinPosix5(manifestDir, `${name}.json`);
17552
17880
  if (!fs9.isFile(manifestPath)) {
17553
- throw new ManifestError(
17881
+ throw new ManifestError2(
17554
17882
  `Pack manifest is missing for pack '${name}': ${manifestPath}`
17555
17883
  );
17556
17884
  }
17557
17885
  const rawText = fs9.readTextFile(manifestPath);
17558
- manifests.set(name, parseManifest(name, manifestPath, rawText));
17886
+ manifests.set(name, parseManifest2(name, manifestPath, rawText));
17559
17887
  }
17560
17888
  return manifests;
17561
17889
  }
17562
- function parseManifest(name, manifestPath, rawText) {
17890
+ function parseManifest2(name, manifestPath, rawText) {
17563
17891
  let loaded;
17564
17892
  try {
17565
17893
  loaded = JSON.parse(rawText);
17566
17894
  } catch {
17567
- throw new ManifestError(
17895
+ throw new ManifestError2(
17568
17896
  `Pack manifest is not valid JSON for pack '${name}': ${manifestPath}`
17569
17897
  );
17570
17898
  }
17571
17899
  if (loaded === null || typeof loaded !== "object" || Array.isArray(loaded)) {
17572
- throw new ManifestError(
17900
+ throw new ManifestError2(
17573
17901
  `Pack manifest must be a JSON object for pack '${name}': ${manifestPath}`
17574
17902
  );
17575
17903
  }
@@ -17579,31 +17907,31 @@ function parseManifest(name, manifestPath, rawText) {
17579
17907
  const manifestPaths = parsed["paths"];
17580
17908
  const sourcePrefix = parsed["source_prefix"];
17581
17909
  if (typeof manifestName !== "string" || manifestName === "") {
17582
- throw new ManifestError(
17910
+ throw new ManifestError2(
17583
17911
  `Pack manifest 'name' must be a non-empty string: ${manifestPath}`
17584
17912
  );
17585
17913
  }
17586
17914
  if (typeof manifestLabel !== "string" || manifestLabel === "") {
17587
- throw new ManifestError(
17915
+ throw new ManifestError2(
17588
17916
  `Pack manifest 'label' must be a non-empty string: ${manifestPath}`
17589
17917
  );
17590
17918
  }
17591
17919
  if (!Array.isArray(manifestPaths)) {
17592
- throw new ManifestError(
17920
+ throw new ManifestError2(
17593
17921
  `Pack manifest 'paths' must be a list of strings: ${manifestPath}`
17594
17922
  );
17595
17923
  }
17596
17924
  const typedPaths = [];
17597
17925
  for (const entry of manifestPaths) {
17598
17926
  if (typeof entry !== "string") {
17599
- throw new ManifestError(
17927
+ throw new ManifestError2(
17600
17928
  `Pack manifest 'paths' must be a list of strings: ${manifestPath}`
17601
17929
  );
17602
17930
  }
17603
17931
  typedPaths.push(entry);
17604
17932
  }
17605
17933
  if (sourcePrefix !== void 0 && sourcePrefix !== null && typeof sourcePrefix !== "string") {
17606
- throw new ManifestError(
17934
+ throw new ManifestError2(
17607
17935
  `Pack manifest 'source_prefix' must be a string when present: ${manifestPath}`
17608
17936
  );
17609
17937
  }
@@ -17614,17 +17942,17 @@ function parseManifest(name, manifestPath, rawText) {
17614
17942
  sourcePrefix: sourcePrefix === void 0 || sourcePrefix === null ? null : sourcePrefix
17615
17943
  };
17616
17944
  }
17617
- function computePublishedPaths(selectedPackNames, manifests) {
17945
+ function computePublishedPaths2(selectedPackNames, manifests) {
17618
17946
  if (selectedPackNames === null || selectedPackNames.size === 0) {
17619
17947
  return null;
17620
17948
  }
17621
17949
  const effectiveNames = new Set(selectedPackNames);
17622
- effectiveNames.add(CORE_PACK_NAME);
17950
+ effectiveNames.add(CORE_PACK_NAME2);
17623
17951
  const published = /* @__PURE__ */ new Set();
17624
17952
  for (const name of effectiveNames) {
17625
17953
  const manifest = manifests.get(name);
17626
17954
  if (manifest === void 0) {
17627
- throw new ManifestError(
17955
+ throw new ManifestError2(
17628
17956
  `No loaded manifest for selected pack '${name}'.`
17629
17957
  );
17630
17958
  }
@@ -17634,17 +17962,17 @@ function computePublishedPaths(selectedPackNames, manifests) {
17634
17962
  }
17635
17963
  return published;
17636
17964
  }
17637
- function resolveVariantSourcePath(destinationRelativePath, csharpVariant) {
17638
- if (csharpVariant === "legacy" && CSHARP_CANONICAL_PATHS.includes(destinationRelativePath)) {
17965
+ function resolveVariantSourcePath2(destinationRelativePath, csharpVariant) {
17966
+ if (csharpVariant === "legacy" && CSHARP_CANONICAL_PATHS2.includes(destinationRelativePath)) {
17639
17967
  const tail = destinationRelativePath.slice(".claude/".length);
17640
17968
  return `${LEGACY_VARIANT_SOURCE_PREFIX}/${tail}`;
17641
17969
  }
17642
17970
  return destinationRelativePath;
17643
17971
  }
17644
- function assertSingleCsharpToolchain(publishedPaths, selectedPackNames) {
17645
- const selectedCsharp = [...selectedPackNames].filter((name) => CSHARP_PACK_NAMES.has(name)).sort();
17972
+ function assertSingleCsharpToolchain2(publishedPaths, selectedPackNames) {
17973
+ const selectedCsharp = [...selectedPackNames].filter((name) => CSHARP_PACK_NAMES2.has(name)).sort();
17646
17974
  if (selectedCsharp.length > 1) {
17647
- throw new ManifestError(
17975
+ throw new ManifestError2(
17648
17976
  `C# mutual exclusion violated: both modern and legacy C# packs were selected ([${selectedCsharp.map((n) => `'${n}'`).join(", ")}]); select exactly one C# variant.`
17649
17977
  );
17650
17978
  }
@@ -17652,11 +17980,11 @@ function assertSingleCsharpToolchain(publishedPaths, selectedPackNames) {
17652
17980
  }
17653
17981
 
17654
17982
  // ../../extensions/drm-copilot/src/lib/push-down/claude-filesystem-adapter.ts
17655
- function normalizePosix2(value) {
17983
+ function normalizePosix3(value) {
17656
17984
  return value.replace(/\\/g, "/").replace(/\/+$/, "");
17657
17985
  }
17658
- function joinPosix4(root, relative2) {
17659
- const normalizedRoot = normalizePosix2(root);
17986
+ function joinPosix6(root, relative2) {
17987
+ const normalizedRoot = normalizePosix3(root);
17660
17988
  const normalizedRelative = relative2.replace(/\\/g, "/").replace(/^\/+/, "");
17661
17989
  if (normalizedRoot === "") {
17662
17990
  return normalizedRelative;
@@ -17666,9 +17994,9 @@ function joinPosix4(root, relative2) {
17666
17994
  }
17667
17995
  return `${normalizedRoot}/${normalizedRelative}`;
17668
17996
  }
17669
- function relativeToPosix2(path10, root) {
17670
- const normalizedPath = normalizePosix2(path10);
17671
- const normalizedRoot = normalizePosix2(root);
17997
+ function relativeToPosix3(path10, root) {
17998
+ const normalizedPath = normalizePosix3(path10);
17999
+ const normalizedRoot = normalizePosix3(root);
17672
18000
  if (normalizedPath === normalizedRoot) {
17673
18001
  return "";
17674
18002
  }
@@ -17697,16 +18025,16 @@ var ExcludingFileSystem = class {
17697
18025
  */
17698
18026
  constructor(inner, repoRoot, excluded, options = {}) {
17699
18027
  this.inner = inner;
17700
- this.repoRoot = normalizePosix2(repoRoot);
17701
- this.sourceRoot = normalizePosix2(options.sourceRoot ?? repoRoot);
17702
- this.variantRoot = normalizePosix2(
18028
+ this.repoRoot = normalizePosix3(repoRoot);
18029
+ this.sourceRoot = normalizePosix3(options.sourceRoot ?? repoRoot);
18030
+ this.variantRoot = normalizePosix3(
17703
18031
  options.variantRoot ?? options.sourceRoot ?? repoRoot
17704
18032
  );
17705
- this.destinationRoot = options.destinationRoot === void 0 ? void 0 : normalizePosix2(options.destinationRoot);
18033
+ this.destinationRoot = options.destinationRoot === void 0 ? void 0 : normalizePosix3(options.destinationRoot);
17706
18034
  this.publishedPaths = options.publishedPaths ?? null;
17707
18035
  this.csharpVariant = options.csharpVariant ?? "modern";
17708
18036
  this.memoryMode = options.memoryMode ?? "overwrite";
17709
- this.excluded = new Set(excluded.map((p) => joinPosix4(this.repoRoot, p)));
18037
+ this.excluded = new Set(excluded.map((p) => joinPosix6(this.repoRoot, p)));
17710
18038
  }
17711
18039
  /**
17712
18040
  * Return the source-relative POSIX path, or null when outside the root.
@@ -17715,7 +18043,7 @@ var ExcludingFileSystem = class {
17715
18043
  * @returns The source-relative POSIX path, or `null`.
17716
18044
  */
17717
18045
  sourceRelativePosix(path10) {
17718
- return relativeToPosix2(path10, this.sourceRoot);
18046
+ return relativeToPosix3(path10, this.sourceRoot);
17719
18047
  }
17720
18048
  /**
17721
18049
  * Return whether a candidate path is in the active published set.
@@ -17742,7 +18070,7 @@ var ExcludingFileSystem = class {
17742
18070
  * @returns True when the file is outside the memory subtree or general-scoped.
17743
18071
  */
17744
18072
  isScopeIncluded(path10) {
17745
- const relativePath = relativeToPosix2(path10, this.repoRoot);
18073
+ const relativePath = relativeToPosix3(path10, this.repoRoot);
17746
18074
  if (relativePath === null) {
17747
18075
  return true;
17748
18076
  }
@@ -17773,7 +18101,7 @@ var ExcludingFileSystem = class {
17773
18101
  if (this.destinationRoot === void 0) {
17774
18102
  return true;
17775
18103
  }
17776
- const destinationPath = joinPosix4(this.destinationRoot, relative2);
18104
+ const destinationPath = joinPosix6(this.destinationRoot, relative2);
17777
18105
  return !this.inner.isFile(destinationPath);
17778
18106
  }
17779
18107
  return true;
@@ -17792,15 +18120,15 @@ var ExcludingFileSystem = class {
17792
18120
  return path10;
17793
18121
  }
17794
18122
  const relative2 = this.sourceRelativePosix(path10);
17795
- if (relative2 === null || !CSHARP_CANONICAL_PATHS.includes(relative2)) {
18123
+ if (relative2 === null || !CSHARP_CANONICAL_PATHS2.includes(relative2)) {
17796
18124
  return path10;
17797
18125
  }
17798
- const redirectedRelative = resolveVariantSourcePath(relative2, "legacy");
17799
- return joinPosix4(this.variantRoot, redirectedRelative);
18126
+ const redirectedRelative = resolveVariantSourcePath2(relative2, "legacy");
18127
+ return joinPosix6(this.variantRoot, redirectedRelative);
17800
18128
  }
17801
18129
  listFiles(root) {
17802
18130
  return this.inner.listFiles(root).filter(
17803
- (p) => !this.excluded.has(normalizePosix2(p)) && this.isPackIncluded(p) && this.isScopeIncluded(p) && this.isMemoryModeIncluded(p)
18131
+ (p) => !this.excluded.has(normalizePosix3(p)) && this.isPackIncluded(p) && this.isScopeIncluded(p) && this.isMemoryModeIncluded(p)
17804
18132
  );
17805
18133
  }
17806
18134
  isDir(path10) {
@@ -17830,28 +18158,28 @@ var EXCLUDED_RELATIVE_PATHS = [
17830
18158
  ".claude/settings.local.json"
17831
18159
  ];
17832
18160
  var BUNDLE_ROOT_RELATIVE_DIR = "extensions/drm-copilot/resources/claude-customizations";
17833
- var PACK_MANIFEST_SUBDIR = "pack-manifests";
18161
+ var PACK_MANIFEST_SUBDIR2 = "pack-manifests";
17834
18162
  function passthroughRewrite2(text) {
17835
18163
  return [text, 0, 0, []];
17836
18164
  }
17837
- function joinPosix5(root, relative2) {
18165
+ function joinPosix7(root, relative2) {
17838
18166
  const normalizedRoot = root.replace(/\\/g, "/").replace(/\/+$/, "");
17839
18167
  const normalizedRelative = relative2.replace(/\\/g, "/").replace(/^\/+/, "");
17840
18168
  return normalizedRoot === "" ? normalizedRelative : `${normalizedRoot}/${normalizedRelative}`;
17841
18169
  }
17842
- function resolvePublishedPaths(packs, bundleRoot, fs9) {
18170
+ function resolvePublishedPaths2(packs, bundleRoot, fs9) {
17843
18171
  if (packs === null || packs.size === 0) {
17844
18172
  return null;
17845
18173
  }
17846
- const manifestDir = joinPosix5(bundleRoot, PACK_MANIFEST_SUBDIR);
17847
- const manifests = loadPackManifests(
18174
+ const manifestDir = joinPosix7(bundleRoot, PACK_MANIFEST_SUBDIR2);
18175
+ const manifests = loadPackManifests2(
17848
18176
  manifestDir,
17849
18177
  packs,
17850
18178
  fs9
17851
18179
  );
17852
- const published = computePublishedPaths(packs, manifests);
18180
+ const published = computePublishedPaths2(packs, manifests);
17853
18181
  const effectivePublished = published ?? /* @__PURE__ */ new Set();
17854
- assertSingleCsharpToolchain(effectivePublished, packs);
18182
+ assertSingleCsharpToolchain2(effectivePublished, packs);
17855
18183
  return effectivePublished;
17856
18184
  }
17857
18185
  function pushDownCustomizations4(options) {
@@ -17868,8 +18196,8 @@ function pushDownCustomizations4(options) {
17868
18196
  clock
17869
18197
  } = options;
17870
18198
  const effectiveSource = sourceRoot ?? repoRoot;
17871
- const effectiveBundle = bundleRoot ?? joinPosix5(effectiveSource, BUNDLE_ROOT_RELATIVE_DIR);
17872
- const publishedPaths = resolvePublishedPaths(
18199
+ const effectiveBundle = bundleRoot ?? joinPosix7(effectiveSource, BUNDLE_ROOT_RELATIVE_DIR);
18200
+ const publishedPaths = resolvePublishedPaths2(
17873
18201
  packs ?? null,
17874
18202
  effectiveBundle,
17875
18203
  fs9
@@ -17932,12 +18260,17 @@ function pushDownCodexAndAgentsCustomizationsServiceCall(input) {
17932
18260
  "resources/codex-and-agents-customizations"
17933
18261
  );
17934
18262
  const destinationRoot = toPosixPath(input.workspaceRoot);
18263
+ const packs = input.packs === void 0 || input.packs.length === 0 ? null : new Set(input.packs);
17935
18264
  const summary = pushDownCustomizations3({
17936
18265
  repoRoot: sourceRoot,
17937
18266
  destinationRoot,
17938
18267
  fs: input.fs,
17939
18268
  sourceRoot,
17940
18269
  artifactRoot: destinationRoot,
18270
+ bundleRoot: sourceRoot,
18271
+ packs,
18272
+ ...input.csharpVariant === void 0 ? {} : { csharpVariant: input.csharpVariant },
18273
+ ...input.memoryMode === void 0 ? {} : { memoryMode: input.memoryMode },
17941
18274
  ...input.clock === void 0 ? {} : { clock: input.clock }
17942
18275
  });
17943
18276
  return {
@@ -17983,6 +18316,14 @@ function buildPushDownClaudeCustomizationsOptions(input) {
17983
18316
  ...input.memoryMode === void 0 ? {} : { memoryMode: input.memoryMode }
17984
18317
  };
17985
18318
  }
18319
+ function buildPushDownCodexAndAgentsCustomizationsOptions(input) {
18320
+ return {
18321
+ workspaceRoot: input.workspaceRoot,
18322
+ ...input.packs === void 0 ? {} : { packs: input.packs },
18323
+ ...input.csharpVariant === void 0 ? {} : { csharpVariant: input.csharpVariant },
18324
+ ...input.memoryMode === void 0 ? {} : { memoryMode: input.memoryMode }
18325
+ };
18326
+ }
17986
18327
  function runPushDownCopilotCustomizations(workspaceRoot, deps) {
17987
18328
  return pushDownCopilotCustomizationsServiceCall({
17988
18329
  fs: deps.fs,
@@ -17991,12 +18332,16 @@ function runPushDownCopilotCustomizations(workspaceRoot, deps) {
17991
18332
  log: deps.log
17992
18333
  });
17993
18334
  }
17994
- function runPushDownCodexAndAgentsCustomizations(workspaceRoot, deps) {
18335
+ function runPushDownCodexAndAgentsCustomizations(input, deps) {
18336
+ const forwarded = buildPushDownCodexAndAgentsCustomizationsOptions(input);
17995
18337
  return pushDownCodexAndAgentsCustomizationsServiceCall({
17996
18338
  fs: deps.fs,
17997
18339
  extensionRoot: deps.extensionRoot,
17998
- workspaceRoot,
17999
- log: deps.log
18340
+ workspaceRoot: forwarded.workspaceRoot,
18341
+ log: deps.log,
18342
+ ...forwarded.packs === void 0 ? {} : { packs: forwarded.packs },
18343
+ ...forwarded.csharpVariant === void 0 ? {} : { csharpVariant: forwarded.csharpVariant },
18344
+ ...forwarded.memoryMode === void 0 ? {} : { memoryMode: forwarded.memoryMode }
18000
18345
  });
18001
18346
  }
18002
18347
  function runPushDownClaudeCustomizations(input, deps) {
@@ -18074,7 +18419,7 @@ var nodePath3 = __toESM(require("node:path"));
18074
18419
  function toPosixPath2(value) {
18075
18420
  return value.replace(/\\/g, "/");
18076
18421
  }
18077
- function joinPosix6(root, relative2) {
18422
+ function joinPosix8(root, relative2) {
18078
18423
  const normalizedRoot = toPosixPath2(root).replace(/\/+$/, "");
18079
18424
  const normalizedRelative = toPosixPath2(relative2).replace(/^\/+/, "");
18080
18425
  if (normalizedRoot === "") {
@@ -18147,7 +18492,7 @@ var RealFileSystem = class {
18147
18492
  for (const entry of entries) {
18148
18493
  const relativePath = relativePrefix === "" ? entry.name : `${relativePrefix}/${entry.name}`;
18149
18494
  if (matcher.test(relativePath)) {
18150
- matches.push(joinPosix6(normalizedRoot, relativePath));
18495
+ matches.push(joinPosix8(normalizedRoot, relativePath));
18151
18496
  }
18152
18497
  if (entry.isDirectory()) {
18153
18498
  walk(nodePath3.join(currentDir, entry.name), relativePath);
@@ -18305,11 +18650,11 @@ function resolveTemplateName(templateKind) {
18305
18650
  function resolveTemplatePath(templateName, workspaceRoot, templateRoot, fs9) {
18306
18651
  const candidates = [];
18307
18652
  if (templateRoot !== null) {
18308
- candidates.push(joinPosix7(templateRoot, templateName));
18653
+ candidates.push(joinPosix9(templateRoot, templateName));
18309
18654
  }
18310
18655
  candidates.push(
18311
- joinPosix7(
18312
- joinPosix7(toPosixPath2(workspaceRoot), ".github/codex"),
18656
+ joinPosix9(
18657
+ joinPosix9(toPosixPath2(workspaceRoot), ".github/codex"),
18313
18658
  templateName
18314
18659
  )
18315
18660
  );
@@ -18324,15 +18669,15 @@ function resolveIssueFileForTarget(targetPath, workspaceRoot, fs9) {
18324
18669
  const normalizedRoot = toPosixPath2(workspaceRoot).replace(/\/+$/, "");
18325
18670
  const relativeTarget = tryRelativeToWorkspace(targetPath, workspaceRoot);
18326
18671
  const planDir = parentOf(relativeTarget);
18327
- const directIssue = joinPosix7(joinPosix7(normalizedRoot, planDir), "issue.md");
18672
+ const directIssue = joinPosix9(joinPosix9(normalizedRoot, planDir), "issue.md");
18328
18673
  if (fs9.isFile(directIssue)) {
18329
18674
  return directIssue;
18330
18675
  }
18331
18676
  const planDirParts = splitParts(planDir);
18332
18677
  const planDirName = planDirParts[planDirParts.length - 1] ?? "";
18333
18678
  if (planDirName.startsWith("v") && planDirParts.length >= 2) {
18334
- const parentIssue = joinPosix7(
18335
- joinPosix7(normalizedRoot, parentOf(planDir)),
18679
+ const parentIssue = joinPosix9(
18680
+ joinPosix9(normalizedRoot, parentOf(planDir)),
18336
18681
  "issue.md"
18337
18682
  );
18338
18683
  if (fs9.isFile(parentIssue)) {
@@ -18453,7 +18798,7 @@ function resolveOutputPath(output, workspaceRoot) {
18453
18798
  if (isAbsolute(output)) {
18454
18799
  return toPosixPath2(output);
18455
18800
  }
18456
- return joinPosix7(toPosixPath2(workspaceRoot), output);
18801
+ return joinPosix9(toPosixPath2(workspaceRoot), output);
18457
18802
  }
18458
18803
  function tryRelativeToWorkspace(path10, workspaceRoot) {
18459
18804
  const normalizedPath = toPosixPath2(path10).replace(/\/+$/, "");
@@ -18481,7 +18826,7 @@ function parentOf(pathValue) {
18481
18826
  function splitParts(pathValue) {
18482
18827
  return toPosixPath2(pathValue).split("/").filter((part) => part.length > 0 && part !== ".");
18483
18828
  }
18484
- function joinPosix7(root, relative2) {
18829
+ function joinPosix9(root, relative2) {
18485
18830
  const normalizedRoot = toPosixPath2(root).replace(/\/+$/, "");
18486
18831
  const normalizedRelative = toPosixPath2(relative2).replace(/^\/+/, "");
18487
18832
  if (normalizedRelative === "" || normalizedRelative === ".") {
@@ -19443,7 +19788,7 @@ var SUPPORTED_ROOTS = {
19443
19788
  ".claude/rules"
19444
19789
  ]
19445
19790
  };
19446
- function joinPosix8(root, relative2) {
19791
+ function joinPosix10(root, relative2) {
19447
19792
  const normalizedRoot = root.replace(/\/+$/, "");
19448
19793
  const normalizedRelative = relative2.replace(/^\/+/, "");
19449
19794
  if (normalizedRoot === "") {
@@ -19485,7 +19830,7 @@ function isAbsolutePath(value) {
19485
19830
  function normalizeRelativePath(sourceRoot, candidatePath) {
19486
19831
  const resolvedRoot = collapseSegments(toPosixPath2(sourceRoot));
19487
19832
  const candidate = toPosixPath2(candidatePath);
19488
- const resolvedCandidate = isAbsolutePath(candidate) ? collapseSegments(candidate) : collapseSegments(joinPosix8(resolvedRoot, candidate));
19833
+ const resolvedCandidate = isAbsolutePath(candidate) ? collapseSegments(candidate) : collapseSegments(joinPosix10(resolvedRoot, candidate));
19489
19834
  const rootPrefix = `${resolvedRoot.replace(/\/+$/, "")}/`;
19490
19835
  if (resolvedCandidate === resolvedRoot) {
19491
19836
  return "";
@@ -19508,7 +19853,7 @@ function normalizeSelectedPaths(sourceRoot, selectedPaths) {
19508
19853
  }
19509
19854
  function collectFilesRecursive(fileSystem, absoluteDir, out) {
19510
19855
  for (const childName of fileSystem.listDirectory(absoluteDir)) {
19511
- const childPath = joinPosix8(absoluteDir, childName);
19856
+ const childPath = joinPosix10(absoluteDir, childName);
19512
19857
  if (fileSystem.isDirectory(childPath)) {
19513
19858
  collectFilesRecursive(fileSystem, childPath, out);
19514
19859
  } else if (fileSystem.isFile(childPath)) {
@@ -19522,7 +19867,7 @@ function iterSupportedArtifacts(fileSystem, sourceRoot, sourceEcosystem) {
19522
19867
  const discovered = /* @__PURE__ */ new Set();
19523
19868
  for (const supportedRoot of SUPPORTED_ROOTS[sourceEcosystem]) {
19524
19869
  const absoluteSupportedRoot = collapseSegments(
19525
- joinPosix8(resolvedRoot, supportedRoot)
19870
+ joinPosix10(resolvedRoot, supportedRoot)
19526
19871
  );
19527
19872
  if (!fileSystem.exists(absoluteSupportedRoot)) {
19528
19873
  continue;
@@ -20589,14 +20934,14 @@ function sortKeysDeep(value) {
20589
20934
  function dumpsSorted(payload) {
20590
20935
  return JSON.stringify(sortKeysDeep(payload), null, 2);
20591
20936
  }
20592
- function joinPosix9(root, child) {
20937
+ function joinPosix11(root, child) {
20593
20938
  const normalizedRoot = root.replace(/\/+$/, "");
20594
20939
  return normalizedRoot === "" ? child : `${normalizedRoot}/${child}`;
20595
20940
  }
20596
20941
  function writeIntermediateStateArtifacts(fileSystem, state, artifactRoot) {
20597
- const intermediateDir = joinPosix9(artifactRoot, "intermediate");
20942
+ const intermediateDir = joinPosix11(artifactRoot, "intermediate");
20598
20943
  fileSystem.ensureDir(intermediateDir);
20599
- const sourceArtifactsPath = joinPosix9(
20944
+ const sourceArtifactsPath = joinPosix11(
20600
20945
  intermediateDir,
20601
20946
  "source-artifacts.json"
20602
20947
  );
@@ -20606,14 +20951,14 @@ function writeIntermediateStateArtifacts(fileSystem, state, artifactRoot) {
20606
20951
  state.sourceArtifacts.map((artifact) => sourceArtifactToJson(artifact))
20607
20952
  )
20608
20953
  );
20609
- const sectionIntentsPath = joinPosix9(intermediateDir, "section-intents.json");
20954
+ const sectionIntentsPath = joinPosix11(intermediateDir, "section-intents.json");
20610
20955
  fileSystem.writeTextFile(
20611
20956
  sectionIntentsPath,
20612
20957
  dumpsSorted(
20613
20958
  state.sectionIntents.map((intent) => sectionIntentToJson(intent))
20614
20959
  )
20615
20960
  );
20616
- const plannedEmissionsPath = joinPosix9(
20961
+ const plannedEmissionsPath = joinPosix11(
20617
20962
  intermediateDir,
20618
20963
  "planned-emissions.json"
20619
20964
  );
@@ -20623,7 +20968,7 @@ function writeIntermediateStateArtifacts(fileSystem, state, artifactRoot) {
20623
20968
  state.plannedEmissions.map((emission) => plannedEmissionToJson(emission))
20624
20969
  )
20625
20970
  );
20626
- const translationTracesPath = joinPosix9(
20971
+ const translationTracesPath = joinPosix11(
20627
20972
  intermediateDir,
20628
20973
  "translation-traces.json"
20629
20974
  );
@@ -20955,7 +21300,7 @@ function collapseSegments2(value) {
20955
21300
  }
20956
21301
  return isAbsolute2 ? `/${joined}` : joined;
20957
21302
  }
20958
- function joinPosix10(root, child) {
21303
+ function joinPosix12(root, child) {
20959
21304
  const normalizedRoot = root.replace(/\/+$/, "");
20960
21305
  const normalizedChild = child.replace(/^\/+/, "");
20961
21306
  return normalizedRoot === "" ? normalizedChild : `${normalizedRoot}/${normalizedChild}`;
@@ -20981,11 +21326,11 @@ function sortFindings(validationFindings) {
20981
21326
  }
20982
21327
  function writeConversionReportSet(fileSystem, runOptions, mappingRecords, topologyEdges, translationTraces, validationFindings, generatedOutput) {
20983
21328
  const artifactRoot = collapseSegments2(runOptions.artifactRoot);
20984
- const proposedTreeRoot = joinPosix10(artifactRoot, "proposed-tree");
21329
+ const proposedTreeRoot = joinPosix12(artifactRoot, "proposed-tree");
20985
21330
  const reportPaths = {
20986
- conversionReport: joinPosix10(artifactRoot, "conversion-report.md"),
20987
- mappingCatalog: joinPosix10(artifactRoot, "mapping-catalog.json"),
20988
- validationResults: joinPosix10(artifactRoot, "validation-results.json"),
21331
+ conversionReport: joinPosix12(artifactRoot, "conversion-report.md"),
21332
+ mappingCatalog: joinPosix12(artifactRoot, "mapping-catalog.json"),
21333
+ validationResults: joinPosix12(artifactRoot, "validation-results.json"),
20989
21334
  proposedTreeRoot
20990
21335
  };
20991
21336
  fileSystem.ensureDir(artifactRoot);
@@ -21018,7 +21363,7 @@ function writeConversionReportSet(fileSystem, runOptions, mappingRecords, topolo
21018
21363
  (left, right) => left < right ? -1 : left > right ? 1 : 0
21019
21364
  )) {
21020
21365
  fileSystem.writeTextFile(
21021
- joinPosix10(proposedTreeRoot, targetPath),
21366
+ joinPosix12(proposedTreeRoot, targetPath),
21022
21367
  generatedOutput[targetPath] ?? ""
21023
21368
  );
21024
21369
  }
@@ -21435,6 +21780,278 @@ var SubprocessRunner = class {
21435
21780
  // ../../extensions/drm-copilot/src/lib/validate/validate-orchestration-service-call.ts
21436
21781
  var path8 = __toESM(require("node:path"));
21437
21782
 
21783
+ // ../../extensions/drm-copilot/src/lib/validate/epic-orchestrator-state-core.ts
21784
+ var REQUIRED_BASELINE_KEYS = [
21785
+ "objective",
21786
+ "completed_steps",
21787
+ "next_step",
21788
+ "last_updated"
21789
+ ];
21790
+ var REQUIRED_EPIC_KEYS = [
21791
+ "route_id",
21792
+ "epic_feature_folder",
21793
+ "integration_branch",
21794
+ "waves",
21795
+ "features"
21796
+ ];
21797
+ var EXPECTED_ROUTE_ID = "epic";
21798
+ var VALID_MERGE_STATUS = /* @__PURE__ */ new Set([
21799
+ "not_started",
21800
+ "worktree_created",
21801
+ "pr_open",
21802
+ "ci_green",
21803
+ "merge_conflict",
21804
+ "blocked_conflict_loop_limit",
21805
+ "merged",
21806
+ "worktree_removed"
21807
+ ]);
21808
+ var MERGED_STATUSES = /* @__PURE__ */ new Set([
21809
+ "merged",
21810
+ "worktree_removed"
21811
+ ]);
21812
+ function isObject2(value) {
21813
+ return typeof value === "object" && value !== null && !Array.isArray(value);
21814
+ }
21815
+ function extractFeatures(state) {
21816
+ const features = state["features"];
21817
+ if (!Array.isArray(features)) {
21818
+ return [];
21819
+ }
21820
+ return features.filter(isObject2);
21821
+ }
21822
+ function missingBaselineAndEpicKeys(state) {
21823
+ const errors = [];
21824
+ for (const key of [...REQUIRED_BASELINE_KEYS, ...REQUIRED_EPIC_KEYS]) {
21825
+ if (!(key in state)) {
21826
+ errors.push(`Epic checkpoint missing required key: ${key}`);
21827
+ }
21828
+ }
21829
+ return errors;
21830
+ }
21831
+ function validateRouteId(state) {
21832
+ if ("route_id" in state && state["route_id"] !== EXPECTED_ROUTE_ID) {
21833
+ return [
21834
+ `Epic checkpoint route_id must be 'epic', found: ${JSON.stringify(state["route_id"])}`
21835
+ ];
21836
+ }
21837
+ return [];
21838
+ }
21839
+ function validateFeatureFolderUniquenessAndDependencies(features) {
21840
+ const errors = [];
21841
+ const seen = /* @__PURE__ */ new Set();
21842
+ const duplicates = /* @__PURE__ */ new Set();
21843
+ const allFolders = /* @__PURE__ */ new Set();
21844
+ for (const feature of features) {
21845
+ const folder = feature["feature_folder"];
21846
+ if (typeof folder === "string" && folder) {
21847
+ allFolders.add(folder);
21848
+ }
21849
+ }
21850
+ for (const feature of features) {
21851
+ const folder = feature["feature_folder"];
21852
+ if (typeof folder !== "string" || !folder) {
21853
+ continue;
21854
+ }
21855
+ if (seen.has(folder)) {
21856
+ duplicates.add(folder);
21857
+ }
21858
+ seen.add(folder);
21859
+ const dependsOn = feature["depends_on"];
21860
+ if (!Array.isArray(dependsOn)) {
21861
+ continue;
21862
+ }
21863
+ for (const dependency of dependsOn) {
21864
+ if (!allFolders.has(dependency)) {
21865
+ errors.push(
21866
+ `Epic checkpoint feature '${folder}' depends_on unresolved feature_folder: ${JSON.stringify(dependency)}`
21867
+ );
21868
+ }
21869
+ }
21870
+ }
21871
+ for (const folder of [...duplicates].sort()) {
21872
+ errors.push(
21873
+ `Epic checkpoint has duplicate features[].feature_folder: ${folder}`
21874
+ );
21875
+ }
21876
+ return errors;
21877
+ }
21878
+ function detectDependencyCycle(features) {
21879
+ const graph = /* @__PURE__ */ new Map();
21880
+ for (const feature of features) {
21881
+ const folder = feature["feature_folder"];
21882
+ if (typeof folder !== "string" || !folder) {
21883
+ continue;
21884
+ }
21885
+ const dependsOn = feature["depends_on"];
21886
+ graph.set(
21887
+ folder,
21888
+ Array.isArray(dependsOn) ? dependsOn.filter(
21889
+ (d) => typeof d === "string"
21890
+ ) : []
21891
+ );
21892
+ }
21893
+ const visiting = /* @__PURE__ */ new Set();
21894
+ const visited = /* @__PURE__ */ new Set();
21895
+ function visit(node) {
21896
+ if (visiting.has(node)) {
21897
+ return node;
21898
+ }
21899
+ if (visited.has(node) || !graph.has(node)) {
21900
+ return null;
21901
+ }
21902
+ visiting.add(node);
21903
+ for (const dependency of graph.get(node) ?? []) {
21904
+ const cycleNode = visit(dependency);
21905
+ if (cycleNode !== null) {
21906
+ return cycleNode;
21907
+ }
21908
+ }
21909
+ visiting.delete(node);
21910
+ visited.add(node);
21911
+ return null;
21912
+ }
21913
+ for (const start of graph.keys()) {
21914
+ const cycleNode = visit(start);
21915
+ if (cycleNode !== null) {
21916
+ return `Epic checkpoint depends_on graph contains a cycle involving feature_folder: ${cycleNode}`;
21917
+ }
21918
+ }
21919
+ return null;
21920
+ }
21921
+ function validateMergeStatusEnum(features) {
21922
+ const errors = [];
21923
+ for (const feature of features) {
21924
+ const folder = feature["feature_folder"] ?? "<unknown>";
21925
+ const mergeStatus = feature["merge_status"];
21926
+ if (mergeStatus !== void 0 && mergeStatus !== null && !(typeof mergeStatus === "string" && VALID_MERGE_STATUS.has(mergeStatus))) {
21927
+ errors.push(
21928
+ `Epic checkpoint feature '${String(folder)}' has invalid merge_status: ${JSON.stringify(mergeStatus)}`
21929
+ );
21930
+ }
21931
+ }
21932
+ return errors;
21933
+ }
21934
+ function validateWaveBarrierOrdering(features) {
21935
+ const errors = [];
21936
+ const byFolder = /* @__PURE__ */ new Map();
21937
+ for (const feature of features) {
21938
+ const folder = feature["feature_folder"];
21939
+ if (typeof folder === "string") {
21940
+ byFolder.set(folder, feature);
21941
+ }
21942
+ }
21943
+ for (const feature of features) {
21944
+ const folder = feature["feature_folder"];
21945
+ const dependsOn = feature["depends_on"];
21946
+ if (typeof folder !== "string" || !Array.isArray(dependsOn)) {
21947
+ continue;
21948
+ }
21949
+ const worktreeCreatedAt = feature["worktree_created_at"];
21950
+ for (const dependency of dependsOn) {
21951
+ const dependencyFeature = byFolder.get(dependency);
21952
+ if (dependencyFeature === void 0) {
21953
+ continue;
21954
+ }
21955
+ const depMergeStatus = dependencyFeature["merge_status"];
21956
+ const depConfirmedAt = dependencyFeature["merge_confirmed_at"];
21957
+ const statusViolation = typeof depMergeStatus !== "string" || !MERGED_STATUSES.has(depMergeStatus);
21958
+ const timingViolation = typeof depConfirmedAt === "string" && typeof worktreeCreatedAt === "string" && depConfirmedAt > worktreeCreatedAt;
21959
+ if (statusViolation || timingViolation) {
21960
+ errors.push(
21961
+ `EPIC_WAVE_BARRIER_VIOLATION: ${folder} started before dependency ${String(dependency)} merged`
21962
+ );
21963
+ }
21964
+ }
21965
+ }
21966
+ return errors;
21967
+ }
21968
+ function validateWavesConsistency(state) {
21969
+ const errors = [];
21970
+ const waves = state["waves"];
21971
+ if (!Array.isArray(waves)) {
21972
+ return errors;
21973
+ }
21974
+ const featuresByFolder = /* @__PURE__ */ new Map();
21975
+ for (const feature of extractFeatures(state)) {
21976
+ const folder = feature["feature_folder"];
21977
+ if (typeof folder === "string") {
21978
+ featuresByFolder.set(folder, feature);
21979
+ }
21980
+ }
21981
+ for (const waveItem of waves) {
21982
+ if (!isObject2(waveItem)) {
21983
+ continue;
21984
+ }
21985
+ const waveNumber = waveItem["wave_number"];
21986
+ const folders = waveItem["feature_folders"];
21987
+ if (!Array.isArray(folders)) {
21988
+ continue;
21989
+ }
21990
+ for (const folder of folders) {
21991
+ const feature = featuresByFolder.get(folder);
21992
+ if (feature === void 0) {
21993
+ continue;
21994
+ }
21995
+ if (feature["wave_number"] !== waveNumber) {
21996
+ errors.push(
21997
+ `Epic checkpoint waves[] lists '${String(folder)}' under wave ${String(waveNumber)} but its own wave_number is ${JSON.stringify(feature["wave_number"])}`
21998
+ );
21999
+ }
22000
+ }
22001
+ }
22002
+ return errors;
22003
+ }
22004
+ function validateCompletion(features, state) {
22005
+ const errors = [];
22006
+ for (const feature of features) {
22007
+ const folder = feature["feature_folder"] ?? "<unknown>";
22008
+ const mergeStatus = feature["merge_status"];
22009
+ if (typeof mergeStatus !== "string" || !MERGED_STATUSES.has(mergeStatus)) {
22010
+ errors.push(
22011
+ `Epic checkpoint completion validation failed: feature '${String(folder)}' merge_status is not merged/worktree_removed.`
22012
+ );
22013
+ }
22014
+ }
22015
+ const epicMergePr = state["epic_merge_pr"];
22016
+ const mergeCommitSha = isObject2(epicMergePr) ? epicMergePr["merge_commit_sha"] : void 0;
22017
+ if (typeof mergeCommitSha !== "string" || !mergeCommitSha.trim()) {
22018
+ errors.push(
22019
+ "Epic checkpoint completion validation failed: epic_merge_pr.merge_commit_sha is missing or empty."
22020
+ );
22021
+ }
22022
+ return errors;
22023
+ }
22024
+ function validateEpicOrchestratorStateText(text, options = {}) {
22025
+ let state;
22026
+ try {
22027
+ state = JSON.parse(text);
22028
+ } catch (exc) {
22029
+ return [
22030
+ `Epic checkpoint is not valid JSON: ${exc instanceof Error ? exc.message : String(exc)}`
22031
+ ];
22032
+ }
22033
+ if (!isObject2(state)) {
22034
+ return ["Epic checkpoint root must be a JSON object."];
22035
+ }
22036
+ const stateMap = state;
22037
+ const errors = [];
22038
+ errors.push(...missingBaselineAndEpicKeys(stateMap));
22039
+ errors.push(...validateRouteId(stateMap));
22040
+ const features = extractFeatures(stateMap);
22041
+ errors.push(...validateFeatureFolderUniquenessAndDependencies(features));
22042
+ const cycleError = detectDependencyCycle(features);
22043
+ if (cycleError !== null) {
22044
+ errors.push(cycleError);
22045
+ }
22046
+ errors.push(...validateMergeStatusEnum(features));
22047
+ errors.push(...validateWaveBarrierOrdering(features));
22048
+ errors.push(...validateWavesConsistency(stateMap));
22049
+ if (options.requireComplete === true) {
22050
+ errors.push(...validateCompletion(features, stateMap));
22051
+ }
22052
+ return errors;
22053
+ }
22054
+
21438
22055
  // ../../extensions/drm-copilot/src/lib/validate/orchestrator-state-completion.ts
21439
22056
  var ISSUE_232 = "232";
21440
22057
  var ISSUE_232_BRANCH = "feature/harden-orchestrate-skill-232";
@@ -21451,11 +22068,11 @@ var PROMOTION_RECEIPT_KEYS = [
21451
22068
  "issue",
21452
22069
  "feature_folder"
21453
22070
  ];
21454
- function isObject2(value) {
22071
+ function isObject3(value) {
21455
22072
  return typeof value === "object" && value !== null && !Array.isArray(value);
21456
22073
  }
21457
22074
  function missingObjectKeys(value, keys) {
21458
- if (!isObject2(value)) {
22075
+ if (!isObject3(value)) {
21459
22076
  return [...keys];
21460
22077
  }
21461
22078
  const missing = [];
@@ -21470,7 +22087,7 @@ function missingObjectKeys(value, keys) {
21470
22087
  function validateCompletionPrGate(state) {
21471
22088
  const prGate = state["pr_gate"];
21472
22089
  const missing = missingObjectKeys(prGate, PR_GATE_KEYS);
21473
- if (!isObject2(prGate)) {
22090
+ if (!isObject3(prGate)) {
21474
22091
  return [
21475
22092
  `Checkpoint completion validation failed: pr_gate must be an object with keys: ${PR_GATE_KEYS.join(", ")}.`
21476
22093
  ];
@@ -21493,7 +22110,7 @@ function validateCompletionPrGate(state) {
21493
22110
  function validateCompletionCiGate(state) {
21494
22111
  const ciGate = state["ci_gate"];
21495
22112
  const missing = missingObjectKeys(ciGate, CI_GATE_KEYS);
21496
- if (!isObject2(ciGate)) {
22113
+ if (!isObject3(ciGate)) {
21497
22114
  return [
21498
22115
  `Checkpoint completion validation failed: ci_gate must be an object with keys: ${CI_GATE_KEYS.join(", ")}.`
21499
22116
  ];
@@ -21510,7 +22127,7 @@ function validateCompletionCiGate(state) {
21510
22127
  );
21511
22128
  }
21512
22129
  const prGate = state["pr_gate"];
21513
- const prHeadSha = isObject2(prGate) ? prGate["head_sha"] : null;
22130
+ const prHeadSha = isObject3(prGate) ? prGate["head_sha"] : null;
21514
22131
  if (prHeadSha !== null && prHeadSha !== void 0 && ciGate["head_sha"] !== prHeadSha) {
21515
22132
  errors.push(
21516
22133
  "Checkpoint completion validation failed: ci_gate.head_sha must match pr_gate.head_sha."
@@ -21525,7 +22142,7 @@ function validateIssue232PromotionReceipts(state) {
21525
22142
  const receipts = state["delegation_receipts"];
21526
22143
  let promotionSource = "promotion_receipts";
21527
22144
  let promotion = state["promotion_receipts"];
21528
- if (isObject2(receipts)) {
22145
+ if (isObject3(receipts)) {
21529
22146
  const namespacedPromotion = receipts[PROMOTION_RECEIPT_NAMESPACE_KEY];
21530
22147
  if (namespacedPromotion !== void 0 && namespacedPromotion !== null) {
21531
22148
  promotionSource = "delegation_receipts.promotion";
@@ -21550,7 +22167,7 @@ var HUMAN_INTERACTION_RESPONSE_ENUM = /* @__PURE__ */ new Set([
21550
22167
  "halt"
21551
22168
  ]);
21552
22169
  var HUMAN_INTERACTION_EXCEPTION_RESPONSE = "exception";
21553
- function isObject3(value) {
22170
+ function isObject4(value) {
21554
22171
  return typeof value === "object" && value !== null && !Array.isArray(value);
21555
22172
  }
21556
22173
  function pythonRepr(value) {
@@ -21567,7 +22184,7 @@ function pythonRepr(value) {
21567
22184
  }
21568
22185
  function validateHumanInteraction(humanInteraction) {
21569
22186
  const errors = [];
21570
- if (!isObject3(humanInteraction)) {
22187
+ if (!isObject4(humanInteraction)) {
21571
22188
  errors.push("Checkpoint human_interaction must be an object when present.");
21572
22189
  return errors;
21573
22190
  }
@@ -21577,7 +22194,7 @@ function validateHumanInteraction(humanInteraction) {
21577
22194
  return errors;
21578
22195
  }
21579
22196
  requirements.forEach((requirement, index) => {
21580
- if (!isObject3(requirement)) {
22197
+ if (!isObject4(requirement)) {
21581
22198
  errors.push(
21582
22199
  `Checkpoint human_interaction.requirements #${index} must be an object.`
21583
22200
  );
@@ -21607,7 +22224,7 @@ var REMEDIATION_LOOP_KEY = "remediation_loop";
21607
22224
  var REMEDIATION_CYCLES_KEY = "cycles";
21608
22225
  var EXECUTION_STATUSES_REQUIRING_CLEAR_PREFLIGHT = /* @__PURE__ */ new Set(["in_progress", "complete", "failed"]);
21609
22226
  var PREFLIGHT_CLEARED_STATUS = "clear";
21610
- function isObject4(value) {
22227
+ function isObject5(value) {
21611
22228
  return typeof value === "object" && value !== null && !Array.isArray(value);
21612
22229
  }
21613
22230
  function validateRemediationCycle(index, cycle) {
@@ -21621,7 +22238,7 @@ function validateRemediationCycle(index, cycle) {
21621
22238
  const executionStatus = cycle["execution_status"];
21622
22239
  if (typeof executionStatus === "string" && EXECUTION_STATUSES_REQUIRING_CLEAR_PREFLIGHT.has(executionStatus)) {
21623
22240
  const preflight = cycle["preflight"];
21624
- const preflightStatus = isObject4(preflight) ? preflight["final_status"] : void 0;
22241
+ const preflightStatus = isObject5(preflight) ? preflight["final_status"] : void 0;
21625
22242
  if (preflightStatus !== PREFLIGHT_CLEARED_STATUS) {
21626
22243
  errors.push(
21627
22244
  `Checkpoint remediation cycle #${index} execution_status is ${executionStatus} but preflight.final_status is not 'clear'.`
@@ -21637,7 +22254,7 @@ function validateRemediationCycle(index, cycle) {
21637
22254
  }
21638
22255
  function validateRemediationLoop(remediationLoop) {
21639
22256
  const errors = [];
21640
- if (!isObject4(remediationLoop)) {
22257
+ if (!isObject5(remediationLoop)) {
21641
22258
  return errors;
21642
22259
  }
21643
22260
  const cycles = remediationLoop[REMEDIATION_CYCLES_KEY];
@@ -21645,7 +22262,7 @@ function validateRemediationLoop(remediationLoop) {
21645
22262
  return errors;
21646
22263
  }
21647
22264
  cycles.forEach((cycle, index) => {
21648
- if (!isObject4(cycle)) {
22265
+ if (!isObject5(cycle)) {
21649
22266
  errors.push(`Checkpoint remediation cycle #${index} must be an object.`);
21650
22267
  return;
21651
22268
  }
@@ -21656,7 +22273,7 @@ function validateRemediationLoop(remediationLoop) {
21656
22273
 
21657
22274
  // ../../extensions/drm-copilot/src/lib/validate/orchestrator-state-routing.ts
21658
22275
  var ROUTING_MATRIX_RELATIVE_PATH = "config/orchestration-routing.json";
21659
- function isObject5(value) {
22276
+ function isObject6(value) {
21660
22277
  return typeof value === "object" && value !== null && !Array.isArray(value);
21661
22278
  }
21662
22279
  function loadRoutingMatrix(fs9, root) {
@@ -21693,7 +22310,7 @@ function listReceipts(receipts) {
21693
22310
  if (!Array.isArray(receipts)) {
21694
22311
  return [];
21695
22312
  }
21696
- return receipts.filter(isObject5);
22313
+ return receipts.filter(isObject6);
21697
22314
  }
21698
22315
  function receiptAgents(state) {
21699
22316
  const agents = /* @__PURE__ */ new Set();
@@ -21712,7 +22329,7 @@ function receiptSkills(state) {
21712
22329
  return skills;
21713
22330
  }
21714
22331
  for (const receipt of receipts) {
21715
- if (!isObject5(receipt)) {
22332
+ if (!isObject6(receipt)) {
21716
22333
  continue;
21717
22334
  }
21718
22335
  const skill = receipt["skill"];
@@ -21731,7 +22348,7 @@ function mcpTools(state) {
21731
22348
  return tools;
21732
22349
  }
21733
22350
  for (const receipt of receipts) {
21734
- if (!isObject5(receipt)) {
22351
+ if (!isObject6(receipt)) {
21735
22352
  continue;
21736
22353
  }
21737
22354
  const tool = receipt["tool"];
@@ -21763,7 +22380,7 @@ function validateLifecycleOperations(state) {
21763
22380
  }
21764
22381
  const errors = [];
21765
22382
  operations.forEach((operation, index) => {
21766
- if (!isObject5(operation)) {
22383
+ if (!isObject6(operation)) {
21767
22384
  errors.push(
21768
22385
  `Checkpoint lifecycle_operations #${index} must be an object.`
21769
22386
  );
@@ -21779,11 +22396,11 @@ function validateLifecycleOperations(state) {
21779
22396
  }
21780
22397
  function validateRoutingContract(state, options = {}) {
21781
22398
  const matrix = options.routingMatrix;
21782
- if (!isObject5(matrix)) {
22399
+ if (!isObject6(matrix)) {
21783
22400
  return ["Routing matrix missing routes object."];
21784
22401
  }
21785
22402
  const rawRoutes = matrix["routes"];
21786
- if (!isObject5(rawRoutes)) {
22403
+ if (!isObject6(rawRoutes)) {
21787
22404
  return ["Routing matrix missing routes object."];
21788
22405
  }
21789
22406
  const routeIdValue = state["route_id"] !== void 0 ? state["route_id"] : state["path_selected"];
@@ -21792,7 +22409,7 @@ function validateRoutingContract(state, options = {}) {
21792
22409
  }
21793
22410
  const routeId = routeIdValue;
21794
22411
  const rawRoute = rawRoutes[routeId];
21795
- if (!isObject5(rawRoute)) {
22412
+ if (!isObject6(rawRoute)) {
21796
22413
  return [
21797
22414
  `Checkpoint selected route has no routing-matrix entry: ${routeId}.`
21798
22415
  ];
@@ -21902,13 +22519,13 @@ var STEP_STATUS_KEYS = [
21902
22519
  "step9_status",
21903
22520
  "step10_status"
21904
22521
  ];
21905
- function isObject6(value) {
22522
+ function isObject7(value) {
21906
22523
  return typeof value === "object" && value !== null && !Array.isArray(value);
21907
22524
  }
21908
22525
  function validateListDelegationReceipts(receipts) {
21909
22526
  const errors = [];
21910
22527
  receipts.forEach((receipt, index) => {
21911
- if (!isObject6(receipt)) {
22528
+ if (!isObject7(receipt)) {
21912
22529
  errors.push(`Checkpoint delegation receipt #${index} must be an object.`);
21913
22530
  return;
21914
22531
  }
@@ -21940,7 +22557,7 @@ function validateNamespacedDelegationReceipts(receipts) {
21940
22557
  if (promotionReceipts === void 0 || promotionReceipts === null) {
21941
22558
  return errors;
21942
22559
  }
21943
- if (!isObject6(promotionReceipts)) {
22560
+ if (!isObject7(promotionReceipts)) {
21944
22561
  errors.push(
21945
22562
  "Checkpoint delegation_receipts.promotion must be an object namespace."
21946
22563
  );
@@ -21975,7 +22592,7 @@ function validateOrchestratorStateText(text, options = {}) {
21975
22592
  `Checkpoint is not valid JSON: ${exc instanceof Error ? exc.message : String(exc)}`
21976
22593
  ];
21977
22594
  }
21978
- if (!isObject6(state)) {
22595
+ if (!isObject7(state)) {
21979
22596
  return ["Checkpoint root must be a JSON object."];
21980
22597
  }
21981
22598
  const stateMap = state;
@@ -22000,7 +22617,7 @@ function validateOrchestratorStateText(text, options = {}) {
22000
22617
  if (receipts !== void 0 && receipts !== null) {
22001
22618
  if (Array.isArray(receipts)) {
22002
22619
  errors.push(...validateListDelegationReceipts(receipts));
22003
- } else if (isObject6(receipts)) {
22620
+ } else if (isObject7(receipts)) {
22004
22621
  errors.push(...validateNamespacedDelegationReceipts(receipts));
22005
22622
  } else {
22006
22623
  errors.push(
@@ -22418,6 +23035,12 @@ function validateArtifact(input) {
22418
23035
  };
22419
23036
  return validateOrchestratorStateText(input.text, options);
22420
23037
  }
23038
+ case "epic-orchestrator-state": {
23039
+ const options = {
23040
+ ...input.requireComplete === void 0 ? {} : { requireComplete: input.requireComplete }
23041
+ };
23042
+ return validateEpicOrchestratorStateText(input.text, options);
23043
+ }
22421
23044
  default:
22422
23045
  return [`Unsupported artifact type: ${input.artifactType}`];
22423
23046
  }
@@ -23969,7 +24592,7 @@ function resolveReadinessSignal(fs9, featureDir) {
23969
24592
  }
23970
24593
  return [null, null];
23971
24594
  }
23972
- function relativeToPosix3(root, path10) {
24595
+ function relativeToPosix4(root, path10) {
23973
24596
  const normalizedRoot = toPosixPath2(root).replace(/\/+$/u, "");
23974
24597
  const normalized = toPosixPath2(path10);
23975
24598
  if (normalized.startsWith(`${normalizedRoot}/`)) {
@@ -24007,7 +24630,7 @@ function discoverCanonicalEvidenceFiles(fs9, root, feature) {
24007
24630
  for (const pattern of CANONICAL_GLOBS) {
24008
24631
  for (const candidate of fs9.glob(featureRoot, pattern)) {
24009
24632
  if (fs9.isFile(candidate)) {
24010
- discovered.add(relativeToPosix4(normalizedRoot, candidate));
24633
+ discovered.add(relativeToPosix5(normalizedRoot, candidate));
24011
24634
  }
24012
24635
  }
24013
24636
  }
@@ -24078,7 +24701,7 @@ function parseIntegerStrict(value) {
24078
24701
  }
24079
24702
  return Number.parseInt(value, 10);
24080
24703
  }
24081
- function relativeToPosix4(root, absolute) {
24704
+ function relativeToPosix5(root, absolute) {
24082
24705
  const normalized = toPosixPath2(absolute);
24083
24706
  if (normalized.startsWith(`${root}/`)) {
24084
24707
  return normalized.slice(root.length + 1);
@@ -24117,7 +24740,7 @@ var SPEC_HEADINGS = [
24117
24740
  "Behavior",
24118
24741
  "Overview"
24119
24742
  ];
24120
- function extractFeatures(changedFiles) {
24743
+ function extractFeatures2(changedFiles) {
24121
24744
  const features = /* @__PURE__ */ new Set();
24122
24745
  for (const raw of changedFiles) {
24123
24746
  const parts = toPosixPath2(raw).split("/");
@@ -24129,7 +24752,7 @@ function extractFeatures(changedFiles) {
24129
24752
  }
24130
24753
  function gatherFeatureExcerpts2(fs9, root, changedFiles) {
24131
24754
  const normalizedRoot = toPosixPath2(root).replace(/\/+$/u, "");
24132
- const features = extractFeatures(changedFiles);
24755
+ const features = extractFeatures2(changedFiles);
24133
24756
  const excerpts = [];
24134
24757
  const baseDir = `${normalizedRoot}/docs/features/active`;
24135
24758
  const promotedDir = `${normalizedRoot}/docs/features/potential/promoted`;
@@ -24275,11 +24898,11 @@ function buildContextFiles(params) {
24275
24898
  const contextFiles = [];
24276
24899
  for (const path10 of candidatePaths) {
24277
24900
  if (fs9.exists(path10)) {
24278
- contextFiles.push(relativeToPosix3(root, path10));
24901
+ contextFiles.push(relativeToPosix4(root, path10));
24279
24902
  }
24280
24903
  }
24281
24904
  if (readinessSource !== null) {
24282
- contextFiles.push(relativeToPosix3(root, readinessSource));
24905
+ contextFiles.push(relativeToPosix4(root, readinessSource));
24283
24906
  }
24284
24907
  const evidenceContextFiles = discoverCanonicalEvidenceFiles(
24285
24908
  fs9,
@@ -25816,7 +26439,7 @@ var PLACEHOLDERS = [
25816
26439
  "<bug-name>"
25817
26440
  ];
25818
26441
  var PLAN_TIMESTAMP_TEMPLATE_NAME = "plan.yyyy-MM-ddTHH-mm.md";
25819
- function joinPosix11(root, relative2) {
26442
+ function joinPosix13(root, relative2) {
25820
26443
  const normalizedRoot = toPosixPath2(root).replace(/\/+$/, "");
25821
26444
  const normalizedRelative = toPosixPath2(relative2).replace(/^\/+/, "");
25822
26445
  if (normalizedRoot === "") {
@@ -25876,14 +26499,14 @@ var RealFolderFileSystem = class {
25876
26499
  return;
25877
26500
  }
25878
26501
  for (const entry of entries) {
25879
- const childAbs = joinPosix11(toPosixPath2(currentDir), entry.name);
26502
+ const childAbs = joinPosix13(toPosixPath2(currentDir), entry.name);
25880
26503
  if (entry.isDirectory()) {
25881
26504
  walk(childAbs);
25882
26505
  continue;
25883
26506
  }
25884
26507
  if (entry.isFile()) {
25885
26508
  const relative2 = childAbs.slice(normalizedSrc.length + 1);
25886
- this.copyFile(childAbs, joinPosix11(toPosixPath2(dest), relative2));
26509
+ this.copyFile(childAbs, joinPosix13(toPosixPath2(dest), relative2));
25887
26510
  }
25888
26511
  }
25889
26512
  };
@@ -25904,7 +26527,7 @@ var RealFolderFileSystem = class {
25904
26527
  const files = [];
25905
26528
  for (const entry of entries) {
25906
26529
  if (entry.isFile()) {
25907
- files.push(joinPosix11(toPosixPath2(path10), entry.name));
26530
+ files.push(joinPosix13(toPosixPath2(path10), entry.name));
25908
26531
  }
25909
26532
  }
25910
26533
  return files;
@@ -26289,8 +26912,8 @@ function stem(path10) {
26289
26912
  function findPotentialFile(featureName, workspace2, fs9) {
26290
26913
  const normalized = featureName.replace(/_/g, "-");
26291
26914
  const potentialDirs = [
26292
- joinPosix11(workspace2, "docs/features/potential"),
26293
- joinPosix11(workspace2, "docs/features/potential/promoted")
26915
+ joinPosix13(workspace2, "docs/features/potential"),
26916
+ joinPosix13(workspace2, "docs/features/potential/promoted")
26294
26917
  ];
26295
26918
  for (const directory of potentialDirs) {
26296
26919
  const candidates = fs9.listFiles(directory).filter(
@@ -26327,9 +26950,9 @@ function buildFolderSlug(featureName, potentialFile, issueNumber) {
26327
26950
  function copyTemplate(featureType, templateDir, targetDir, fs9) {
26328
26951
  if (featureType === "bug") {
26329
26952
  for (const name of ["spec.md", PLAN_TIMESTAMP_TEMPLATE_NAME, "plan.md"]) {
26330
- const src = joinPosix11(templateDir, name);
26953
+ const src = joinPosix13(templateDir, name);
26331
26954
  if (fs9.exists(src)) {
26332
- fs9.copyFile(src, joinPosix11(targetDir, name));
26955
+ fs9.copyFile(src, joinPosix13(targetDir, name));
26333
26956
  if (name === PLAN_TIMESTAMP_TEMPLATE_NAME) {
26334
26957
  break;
26335
26958
  }
@@ -26340,24 +26963,24 @@ function copyTemplate(featureType, templateDir, targetDir, fs9) {
26340
26963
  }
26341
26964
  }
26342
26965
  function copyFeatureTemplateForMinorAudit(templateDir, targetDir, fs9) {
26343
- const timestampedPlan = joinPosix11(templateDir, PLAN_TIMESTAMP_TEMPLATE_NAME);
26966
+ const timestampedPlan = joinPosix13(templateDir, PLAN_TIMESTAMP_TEMPLATE_NAME);
26344
26967
  if (fs9.exists(timestampedPlan)) {
26345
26968
  fs9.copyFile(
26346
26969
  timestampedPlan,
26347
- joinPosix11(targetDir, PLAN_TIMESTAMP_TEMPLATE_NAME)
26970
+ joinPosix13(targetDir, PLAN_TIMESTAMP_TEMPLATE_NAME)
26348
26971
  );
26349
26972
  return;
26350
26973
  }
26351
- const legacyPlan = joinPosix11(templateDir, "plan.md");
26974
+ const legacyPlan = joinPosix13(templateDir, "plan.md");
26352
26975
  if (fs9.exists(legacyPlan)) {
26353
- fs9.copyFile(legacyPlan, joinPosix11(targetDir, "plan.md"));
26976
+ fs9.copyFile(legacyPlan, joinPosix13(targetDir, "plan.md"));
26354
26977
  }
26355
26978
  }
26356
26979
  function materializePlanFile(featureType, targetDir, featureName, issueField, ownerField, parentField, statusField, versionField, planTimestamp, fs9) {
26357
26980
  void featureType;
26358
- const templatePlan = joinPosix11(targetDir, PLAN_TIMESTAMP_TEMPLATE_NAME);
26981
+ const templatePlan = joinPosix13(targetDir, PLAN_TIMESTAMP_TEMPLATE_NAME);
26359
26982
  if (fs9.exists(templatePlan)) {
26360
- const targetPlan = joinPosix11(targetDir, `plan.${planTimestamp}.md`);
26983
+ const targetPlan = joinPosix13(targetDir, `plan.${planTimestamp}.md`);
26361
26984
  fs9.move(templatePlan, targetPlan);
26362
26985
  let content = fs9.readText(targetPlan);
26363
26986
  const updatedField = planTimestamp;
@@ -26374,7 +26997,7 @@ function materializePlanFile(featureType, targetDir, featureName, issueField, ow
26374
26997
  fs9.writeText(targetPlan, content);
26375
26998
  return targetPlan;
26376
26999
  }
26377
- const legacy = joinPosix11(targetDir, "plan.md");
27000
+ const legacy = joinPosix13(targetDir, "plan.md");
26378
27001
  if (fs9.exists(legacy)) {
26379
27002
  return legacy;
26380
27003
  }
@@ -26444,9 +27067,9 @@ function updateFeatureDocs(featureType, featureName, targetDir, issueField, owne
26444
27067
  const filesToOpen = [];
26445
27068
  const get = (key) => sections[key] ?? "";
26446
27069
  if (featureType === "feature") {
26447
- const userStory = joinPosix11(targetDir, "user-story.md");
26448
- const spec = joinPosix11(targetDir, "spec.md");
26449
- const plan = planPath ?? joinPosix11(targetDir, "plan.md");
27070
+ const userStory = joinPosix13(targetDir, "user-story.md");
27071
+ const spec = joinPosix13(targetDir, "spec.md");
27072
+ const plan = planPath ?? joinPosix13(targetDir, "plan.md");
26450
27073
  applyHeaderAndSections(
26451
27074
  userStory,
26452
27075
  featureName,
@@ -26496,8 +27119,8 @@ function updateFeatureDocs(featureType, featureName, targetDir, issueField, owne
26496
27119
  );
26497
27120
  filesToOpen.push(userStory, spec, plan);
26498
27121
  } else if (featureType === "refactor") {
26499
- const spec = joinPosix11(targetDir, "spec.md");
26500
- const plan = planPath ?? joinPosix11(targetDir, "plan.md");
27122
+ const spec = joinPosix13(targetDir, "spec.md");
27123
+ const plan = planPath ?? joinPosix13(targetDir, "plan.md");
26501
27124
  applyHeaderAndSections(
26502
27125
  spec,
26503
27126
  featureName,
@@ -26532,7 +27155,7 @@ function updateFeatureDocs(featureType, featureName, targetDir, issueField, owne
26532
27155
  );
26533
27156
  filesToOpen.push(spec, plan);
26534
27157
  } else if (featureType === "epic") {
26535
- const initiative = joinPosix11(targetDir, "initiative.md");
27158
+ const initiative = joinPosix13(targetDir, "initiative.md");
26536
27159
  applyHeaderAndSections(
26537
27160
  initiative,
26538
27161
  featureName,
@@ -26547,8 +27170,8 @@ function updateFeatureDocs(featureType, featureName, targetDir, issueField, owne
26547
27170
  );
26548
27171
  filesToOpen.push(initiative);
26549
27172
  } else if (featureType === "bug") {
26550
- const spec = joinPosix11(targetDir, "spec.md");
26551
- const plan = planPath ?? joinPosix11(targetDir, "plan.md");
27173
+ const spec = joinPosix13(targetDir, "spec.md");
27174
+ const plan = planPath ?? joinPosix13(targetDir, "plan.md");
26552
27175
  const contextParts = [];
26553
27176
  if (get("bug_summary")) {
26554
27177
  contextParts.push(get("bug_summary"));
@@ -26669,9 +27292,9 @@ function createActiveFolder(options) {
26669
27292
  const autoResolveError = "Select a promoted issue markdown file under docs/features/potential/promoted or supply --feature-name directly.";
26670
27293
  let activeFilePath = toPosixPath2(options.activeFileForFeatureName);
26671
27294
  if (!isAbsolutePosix(activeFilePath)) {
26672
- activeFilePath = joinPosix11(workspacePath, activeFilePath);
27295
+ activeFilePath = joinPosix13(workspacePath, activeFilePath);
26673
27296
  }
26674
- const promotedRoot = joinPosix11(
27297
+ const promotedRoot = joinPosix13(
26675
27298
  workspacePath,
26676
27299
  "docs/features/potential/promoted"
26677
27300
  );
@@ -26689,7 +27312,7 @@ function createActiveFolder(options) {
26689
27312
  }
26690
27313
  validateFeatureName2(resolvedFeatureName);
26691
27314
  emit(`Feature name source: ${featureNameSource}`);
26692
- const templateDir = options.templateRoot !== void 0 && options.templateRoot !== null ? joinPosix11(options.templateRoot, featureType) : joinPosix11(workspacePath, `docs/features/templates/${featureType}`);
27315
+ const templateDir = options.templateRoot !== void 0 && options.templateRoot !== null ? joinPosix13(options.templateRoot, featureType) : joinPosix13(workspacePath, `docs/features/templates/${featureType}`);
26693
27316
  if (!filesystem.exists(templateDir)) {
26694
27317
  throw new Error(`Template folder not found: ${templateDir}`);
26695
27318
  }
@@ -26717,7 +27340,7 @@ function createActiveFolder(options) {
26717
27340
  potentialFile,
26718
27341
  normalizedIssueNumber
26719
27342
  );
26720
- const targetDir = joinPosix11(
27343
+ const targetDir = joinPosix13(
26721
27344
  workspacePath,
26722
27345
  `docs/features/active/${folderSlug}`
26723
27346
  );
@@ -26782,7 +27405,7 @@ function createActiveFolder(options) {
26782
27405
  let potentialIssuePath = null;
26783
27406
  if (useMinorAudit) {
26784
27407
  if (potentialFile) {
26785
- potentialIssuePath = joinPosix11(targetDir, "issue.md");
27408
+ potentialIssuePath = joinPosix13(targetDir, "issue.md");
26786
27409
  filesystem.move(potentialFile, potentialIssuePath);
26787
27410
  const movedContent = filesystem.readText(potentialIssuePath);
26788
27411
  filesystem.writeText(
@@ -26791,7 +27414,7 @@ function createActiveFolder(options) {
26791
27414
  );
26792
27415
  filesToOpen = [potentialIssuePath];
26793
27416
  } else {
26794
- const issueDoc = joinPosix11(targetDir, "issue.md");
27417
+ const issueDoc = joinPosix13(targetDir, "issue.md");
26795
27418
  const issueBody = [
26796
27419
  `# ${resolvedFeatureName}`,
26797
27420
  "",
@@ -26842,7 +27465,7 @@ function createActiveFolder(options) {
26842
27465
  emit(`Moved potential file to ${potentialIssuePath}`);
26843
27466
  }
26844
27467
  } else {
26845
- potentialIssuePath = joinPosix11(targetDir, "issue.md");
27468
+ potentialIssuePath = joinPosix13(targetDir, "issue.md");
26846
27469
  filesystem.move(potentialFile, potentialIssuePath);
26847
27470
  const movedContent = filesystem.readText(potentialIssuePath);
26848
27471
  filesystem.writeText(
@@ -26989,10 +27612,7 @@ var DefaultRepoAutomationService = class {
26989
27612
  );
26990
27613
  }
26991
27614
  async pushDownCodexAndAgentsCustomizations(input) {
26992
- return runPushDownCodexAndAgentsCustomizations(
26993
- input.workspaceRoot,
26994
- this.pushDownDeps
26995
- );
27615
+ return runPushDownCodexAndAgentsCustomizations(input, this.pushDownDeps);
26996
27616
  }
26997
27617
  async pushDownClaudeCustomizations(input) {
26998
27618
  return runPushDownClaudeCustomizations(input, this.pushDownDeps);