@danmoisan/drm-copilot-mcp 1.1.11 → 1.1.12

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 +366 -159
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +1 -1
  4. package/resources/claude-customizations/.claude/agents/epic-planner.md +4 -1
  5. package/resources/claude-customizations/.claude/agents/pr-author.md +15 -0
  6. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-authorization.ps1 +443 -0
  7. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +33 -37
  8. package/resources/claude-customizations/.claude/hooks/enforce-model-routing-receipt.ps1 +120 -5
  9. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +127 -0
  10. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +163 -15
  11. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +14 -27
  12. package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +66 -5
  13. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill-helpers.ps1 +134 -10
  14. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.epic-base-branch.ps1 +37 -8
  15. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +3 -1
  16. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner-helpers.ps1 +332 -0
  17. package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +211 -182
  18. package/resources/claude-customizations/.claude/lib/codex-routing/CodexDeployment.psm1 +1 -0
  19. package/resources/claude-customizations/.claude/lib/worktree-resolution/EpicScopeReadiness.psm1 +176 -0
  20. package/resources/claude-customizations/.claude/lib/worktree-resolution/EpicScopeResolution.psm1 +369 -0
  21. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeItemResolution.psm1 +392 -0
  22. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeResolution.psm1 +500 -0
  23. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeTargetResolution.psm1 +347 -0
  24. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +27 -0
  25. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/SKILL.md +12 -0
  26. package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +14 -1
  27. package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +4 -0
  28. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +4 -1
  29. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +39 -6
  30. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +15 -0
  31. package/resources/claude-customizations/.claude/skills/quota-throttling/SKILL.md +221 -0
  32. package/resources/claude-customizations/pack-manifests/core.json +9 -0
  33. package/resources/codex-and-agents-customizations/.agents/skills/codex-model-routing/SKILL.md +13 -14
  34. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  35. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate.ps1 +193 -0
  36. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-planning-only.ps1 +15 -5
  37. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +163 -15
  38. package/resources/codex-and-agents-customizations/.codex/scripts/Resolve-CodexDeployment.ps1 +87 -0
  39. package/resources/codex-and-agents-customizations/.codex/scripts/Resolve-CodexTopology.ps1 +96 -0
  40. package/resources/codex-and-agents-customizations/.codex/scripts/codex-routing-cli-common.ps1 +370 -0
  41. package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-launch-contract.ps1 +475 -0
  42. package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-launch-runtime.ps1 +445 -0
  43. package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-persistence-runtime.ps1 +118 -0
  44. package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-sandbox-preflight.ps1 +69 -0
  45. package/resources/codex-and-agents-customizations/.codex/scripts/launch-epic-child-wave.ps1 +471 -0
  46. package/resources/codex-and-agents-customizations/.codex/scripts/post-codex-worktree-session.ps1 +280 -0
  47. package/resources/codex-and-agents-customizations/.codex/scripts/resume-epic-child.ps1 +263 -0
  48. package/resources/codex-and-agents-customizations/.codex-variants/csharp-legacy/agents/csharp-typed-engineer.toml +2 -1
  49. package/resources/codex-and-agents-customizations/pack-manifests/core.json +18 -1
  50. package/resources/lib/codex-routing/CodexDeployment.psm1 +315 -0
  51. package/resources/lib/codex-routing/CodexTopology.psm1 +394 -0
  52. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +26 -0
@@ -0,0 +1,315 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Codex deployment resolver, ported from the Python reference implementation.
4
+
5
+ .DESCRIPTION
6
+ Destination-runtime PowerShell port of
7
+ `scripts/dev_tools/resolve_codex_deployment.py`. It resolves the exact Codex
8
+ deployment agent, model, and reasoning effort for one delegation from the
9
+ logical agent, the assessed complexity band, the execution context, and the
10
+ orchestration complexity ceiling. C3 defaults to Terra/high and elevates to
11
+ Sol/high only for an epic child or a C4 orchestration ceiling; the epic
12
+ planner and epic orchestrator personas are always forced to Sol/ultra. No
13
+ model alias and no silent fallback is accepted.
14
+
15
+ SINGLE-IMPLEMENTATION RULE. The orchestrator-state U6.X checks
16
+ (`OrchestratorStateCodexModelReceipts.psm1`) MUST call `Resolve-CodexDeployment`
17
+ from this module. They must never re-implement the profile table, the C3
18
+ overlay rule, or the forced-persona rule. This module is the one PowerShell
19
+ implementation of the Codex deployment axis.
20
+
21
+ Every constant below is pinned to `config/orchestration-routing.json`
22
+ (`codex_model_policy`) by a static config-parity check in the Python
23
+ reference. Following the `ModelRouting.psm1` pattern, the values are hard-coded
24
+ here and never read from disk, because this module is pushed down to consumer
25
+ repositories that do not receive `config/orchestration-routing.json`.
26
+
27
+ Error surface, relied on by the U6.X receipt checks:
28
+ - [System.ArgumentException] is the ValueError-equivalent surface. Its
29
+ Message text reproduces the Python message verbatim, including Python
30
+ tuple and repr() rendering, because inventory row U6.X5 interpolates the
31
+ exception text into its error string.
32
+ - [System.InvalidOperationException] is the ModelUnavailableError-equivalent
33
+ surface. The Python receipt validator catches only ValueError, so this
34
+ exception deliberately does NOT satisfy the U6.X5 branch; it can only be
35
+ raised when a caller supplies an availability set, which the checks never do.
36
+
37
+ The function is pure: it reads no file, starts no process, and never mutates
38
+ its input.
39
+ CONVENTION: this module fails fast at module scope and imports its siblings with -ErrorAction Stop.
40
+ #>
41
+
42
+ Set-StrictMode -Version Latest
43
+ $ErrorActionPreference = 'Stop'
44
+
45
+ # The complexity-band vocabulary, ordered lowest to highest. Pinned to BAND_ORDER
46
+ # in scripts/dev_tools/compute_complexity_floor.py.
47
+ $script:BAND_ORDER = @('C1', 'C2', 'C3', 'C4')
48
+
49
+ # Rendered form of the Python BAND_ORDER tuple, used verbatim inside the
50
+ # ValueError-equivalent message so the ported text matches character for character.
51
+ $script:BAND_ORDER_PYTHON_TUPLE = "('C1', 'C2', 'C3', 'C4')"
52
+
53
+ # The three permitted execution contexts, and the sorted tuple rendering the
54
+ # Python message interpolates.
55
+ $script:VALID_EXECUTION_CONTEXTS = @('standalone', 'epic_preparation_child', 'epic_execution_child')
56
+ $script:VALID_EXECUTION_CONTEXTS_PYTHON_TUPLE = "('epic_execution_child', 'epic_preparation_child', 'standalone')"
57
+
58
+ # The execution contexts that elevate a C3 delegation, and the ceiling band that
59
+ # does so independently of context.
60
+ $script:C3_ELEVATED_EXECUTION_CONTEXTS = @('epic_preparation_child', 'epic_execution_child')
61
+ $script:C3_ELEVATED_CEILING = 'C4'
62
+ $script:C3_BAND = 'C3'
63
+
64
+ # The agent families for which a generated per-band deployment agent exists, and
65
+ # the logical-to-family alias map.
66
+ $script:GENERATED_AGENT_FAMILIES = @(
67
+ 'orchestrator',
68
+ 'atomic-planner',
69
+ 'atomic-executor',
70
+ 'feature-reviewer',
71
+ 'task-researcher',
72
+ 'prd-feature',
73
+ 'pr-author',
74
+ 'commit-steward',
75
+ 'python-typed-engineer',
76
+ 'powershell-typed-engineer',
77
+ 'csharp-typed-engineer',
78
+ 'typescript-engineer'
79
+ )
80
+ $script:LOGICAL_AGENT_ALIASES = @{ 'feature-review' = 'feature-reviewer' }
81
+
82
+ # The per-band deployment profiles (suffix, model, reasoning effort).
83
+ $script:BASE_PROFILES = @{
84
+ C1 = @{ suffix = 'c1'; model = 'gpt-5.6-luna'; model_reasoning_effort = 'low' }
85
+ C2 = @{ suffix = 'c2'; model = 'gpt-5.6-terra'; model_reasoning_effort = 'medium' }
86
+ C3 = @{ suffix = 'c3'; model = 'gpt-5.6-terra'; model_reasoning_effort = 'high' }
87
+ C4 = @{ suffix = 'c4'; model = 'gpt-5.6-sol'; model_reasoning_effort = 'max' }
88
+ }
89
+
90
+ # The profile a C3 delegation elevates to when the overlay applies.
91
+ $script:C3_ELEVATED_PROFILE = @{ suffix = 'c3-elevated'; model = 'gpt-5.6-sol'; model_reasoning_effort = 'high' }
92
+
93
+ # The personas whose profile is forced regardless of band, context, or ceiling.
94
+ # Their deployment agent is the logical agent itself (empty suffix).
95
+ $script:FORCED_PERSONA_PROFILES = @{
96
+ 'epic-planner' = @{ suffix = ''; model = 'gpt-5.6-sol'; model_reasoning_effort = 'ultra' }
97
+ 'epic-orchestrator' = @{ suffix = ''; model = 'gpt-5.6-sol'; model_reasoning_effort = 'ultra' }
98
+ }
99
+
100
+
101
+ function Assert-CodexBand {
102
+ <#
103
+ .SYNOPSIS
104
+ Return a valid complexity band or throw the field-specific ValueError text.
105
+ .DESCRIPTION
106
+ Private helper mirroring _validate_band. The thrown message reproduces the
107
+ Python text exactly, including the tuple rendering of BAND_ORDER and the
108
+ repr() rendering of the offending value, because U6.X5 interpolates it.
109
+ .PARAMETER Value
110
+ The candidate band value.
111
+ .PARAMETER FieldName
112
+ The field name to name in the message.
113
+ .OUTPUTS
114
+ System.String - the validated band.
115
+ #>
116
+ [CmdletBinding()]
117
+ [OutputType([string])]
118
+ param(
119
+ [Parameter(Mandatory = $true)]
120
+ [AllowNull()]
121
+ [AllowEmptyString()]
122
+ [string] $Value,
123
+
124
+ [Parameter(Mandatory = $true)]
125
+ [string] $FieldName
126
+ )
127
+
128
+ if ($script:BAND_ORDER -cnotcontains $Value) {
129
+ throw [System.ArgumentException]::new(
130
+ "$FieldName must be one of $($script:BAND_ORDER_PYTHON_TUPLE), found '$Value'."
131
+ )
132
+ }
133
+ return $Value
134
+ }
135
+
136
+ function Assert-CodexExecutionContext {
137
+ <#
138
+ .SYNOPSIS
139
+ Return a valid execution context or throw the ValueError-equivalent text.
140
+ .DESCRIPTION
141
+ Private helper mirroring _validate_context, reproducing the Python message
142
+ including the sorted-tuple rendering of the permitted contexts.
143
+ .PARAMETER Value
144
+ The candidate execution-context value.
145
+ .OUTPUTS
146
+ System.String - the validated execution context.
147
+ #>
148
+ [CmdletBinding()]
149
+ [OutputType([string])]
150
+ param(
151
+ [Parameter(Mandatory = $true)]
152
+ [AllowNull()]
153
+ [AllowEmptyString()]
154
+ [string] $Value
155
+ )
156
+
157
+ if ($script:VALID_EXECUTION_CONTEXTS -cnotcontains $Value) {
158
+ throw [System.ArgumentException]::new(
159
+ "execution_context must be one of $($script:VALID_EXECUTION_CONTEXTS_PYTHON_TUPLE), found '$Value'."
160
+ )
161
+ }
162
+ return $Value
163
+ }
164
+
165
+ function Get-CodexC3OverlayReason {
166
+ <#
167
+ .SYNOPSIS
168
+ Return the deterministic C3 elevation reason, or $null when none applies.
169
+ .DESCRIPTION
170
+ Private helper mirroring _select_c3_overlay_reason. Both conditions
171
+ together report the combined reason; the ordering matters because the
172
+ combined reason must win over either single reason.
173
+ .PARAMETER ExecutionContext
174
+ The validated execution context.
175
+ .PARAMETER OrchestrationComplexityCeiling
176
+ The validated orchestration ceiling band.
177
+ .OUTPUTS
178
+ System.String - the reason, or $null.
179
+ #>
180
+ [CmdletBinding()]
181
+ [OutputType([string])]
182
+ param(
183
+ [Parameter(Mandatory = $true)]
184
+ [string] $ExecutionContext,
185
+
186
+ [Parameter(Mandatory = $true)]
187
+ [string] $OrchestrationComplexityCeiling
188
+ )
189
+
190
+ $epicContext = $script:C3_ELEVATED_EXECUTION_CONTEXTS -ccontains $ExecutionContext
191
+ $c4Ceiling = ($OrchestrationComplexityCeiling -ceq $script:C3_ELEVATED_CEILING)
192
+
193
+ if ($epicContext -and $c4Ceiling) { return 'epic_context_and_c4_ceiling' }
194
+ if ($epicContext) { return 'epic_context' }
195
+ if ($c4Ceiling) { return 'c4_orchestration_ceiling' }
196
+ return $null
197
+ }
198
+
199
+ function Resolve-CodexDeployment {
200
+ <#
201
+ .SYNOPSIS
202
+ Resolve the exact Codex deployment agent, model, and reasoning effort.
203
+ .DESCRIPTION
204
+ Faithful PowerShell port of resolve_codex_deployment
205
+ (scripts/dev_tools/resolve_codex_deployment.py). Validates both bands and
206
+ the execution context, rejects a ceiling below the band, then selects the
207
+ profile: a forced persona wins outright; otherwise a C3 delegation may
208
+ elevate under the overlay rule and every other band reads the base table.
209
+ The deployment agent name is the resolved family plus the profile suffix.
210
+ .PARAMETER LogicalAgent
211
+ The logical agent name being delegated to.
212
+ .PARAMETER ComplexityBand
213
+ The assessed complexity band, one of C1..C4.
214
+ .PARAMETER ExecutionContext
215
+ One of standalone, epic_preparation_child, epic_execution_child.
216
+ .PARAMETER OrchestrationComplexityCeiling
217
+ The orchestration ceiling band, one of C1..C4, at or above ComplexityBand.
218
+ .PARAMETER AvailableModel
219
+ Optional availability set. When supplied and the routed model is absent
220
+ from it, the resolver throws rather than falling back to another model.
221
+ .OUTPUTS
222
+ System.Collections.Hashtable with the nine resolved keys: logical_agent,
223
+ deployment_agent, complexity_band, execution_context,
224
+ orchestration_complexity_ceiling, c3_overlay_applied, c3_overlay_reason,
225
+ model, model_reasoning_effort.
226
+ #>
227
+ [CmdletBinding()]
228
+ [OutputType([hashtable])]
229
+ param(
230
+ [Parameter(Mandatory = $true)]
231
+ [AllowNull()]
232
+ [AllowEmptyString()]
233
+ [string] $LogicalAgent,
234
+
235
+ [Parameter(Mandatory = $true)]
236
+ [AllowNull()]
237
+ [AllowEmptyString()]
238
+ [string] $ComplexityBand,
239
+
240
+ [Parameter(Mandatory = $true)]
241
+ [AllowNull()]
242
+ [AllowEmptyString()]
243
+ [string] $ExecutionContext,
244
+
245
+ [Parameter(Mandatory = $true)]
246
+ [AllowNull()]
247
+ [AllowEmptyString()]
248
+ [string] $OrchestrationComplexityCeiling,
249
+
250
+ [Parameter(Mandatory = $false)]
251
+ [AllowNull()]
252
+ [string[]] $AvailableModel = $null
253
+ )
254
+
255
+ $band = Assert-CodexBand -Value $ComplexityBand -FieldName 'complexity_band'
256
+ $ceiling = Assert-CodexBand -Value $OrchestrationComplexityCeiling -FieldName 'orchestration_complexity_ceiling'
257
+ $context = Assert-CodexExecutionContext -Value $ExecutionContext
258
+
259
+ # The ceiling is an upper bound on the delegation band; a ceiling below the
260
+ # band is an inconsistent pair rather than a clamp.
261
+ if ($script:BAND_ORDER.IndexOf($band) -gt $script:BAND_ORDER.IndexOf($ceiling)) {
262
+ throw [System.ArgumentException]::new(
263
+ "orchestration_complexity_ceiling must be greater than or equal to complexity_band, found $ceiling below $band."
264
+ )
265
+ }
266
+
267
+ # Routing table: a forced persona ignores band, context, and ceiling entirely
268
+ # and keeps its own name as the deployment agent; every other agent resolves
269
+ # through the family alias map, the C3 overlay rule, and the base profiles.
270
+ if ($script:FORCED_PERSONA_PROFILES.ContainsKey($LogicalAgent)) {
271
+ $deploymentProfile = $script:FORCED_PERSONA_PROFILES[$LogicalAgent]
272
+ $deploymentAgent = $LogicalAgent
273
+ $overlayReason = $null
274
+ } else {
275
+ $deploymentFamily = $LogicalAgent
276
+ if ($script:LOGICAL_AGENT_ALIASES.ContainsKey($LogicalAgent)) {
277
+ $deploymentFamily = $script:LOGICAL_AGENT_ALIASES[$LogicalAgent]
278
+ }
279
+ if ($script:GENERATED_AGENT_FAMILIES -cnotcontains $deploymentFamily) {
280
+ throw [System.ArgumentException]::new("Unsupported Codex logical agent: '$LogicalAgent'.")
281
+ }
282
+
283
+ # The overlay is a C3-only rule; every other band reads the base table.
284
+ $overlayReason = $null
285
+ if ($band -ceq $script:C3_BAND) {
286
+ $overlayReason = Get-CodexC3OverlayReason -ExecutionContext $context -OrchestrationComplexityCeiling $ceiling
287
+ }
288
+ $deploymentProfile = if ($overlayReason) { $script:C3_ELEVATED_PROFILE } else { $script:BASE_PROFILES[$band] }
289
+ $deploymentAgent = "$deploymentFamily-$($deploymentProfile['suffix'])"
290
+ }
291
+
292
+ # An availability set that omits the routed model is a hard failure: silent
293
+ # fallback to a different model is prohibited.
294
+ if ($null -ne $AvailableModel -and $AvailableModel -cnotcontains $deploymentProfile['model']) {
295
+ throw [System.InvalidOperationException]::new(
296
+ "model_unavailable: required Codex model '$($deploymentProfile['model'])' is unavailable; silent fallback is prohibited."
297
+ )
298
+ }
299
+
300
+ return @{
301
+ logical_agent = $LogicalAgent
302
+ deployment_agent = $deploymentAgent
303
+ complexity_band = $band
304
+ execution_context = $context
305
+ orchestration_complexity_ceiling = $ceiling
306
+ c3_overlay_applied = ($null -ne $overlayReason)
307
+ c3_overlay_reason = $overlayReason
308
+ model = $deploymentProfile['model']
309
+ model_reasoning_effort = $deploymentProfile['model_reasoning_effort']
310
+ }
311
+ }
312
+
313
+ # Only the resolver is exported; the validation and overlay helpers are private so
314
+ # no consumer can bypass the single entry point.
315
+ Export-ModuleMember -Function Resolve-CodexDeployment