@danmoisan/drm-copilot-mcp 1.1.0 → 1.1.2

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 (45) hide show
  1. package/out/mcp-server.js +10 -2
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +349 -0
  4. package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +118 -6
  5. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusExtraction.psm1 +34 -60
  6. package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusTokenShape.psm1 +187 -0
  7. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +16 -0
  8. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +62 -4
  9. package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +27 -0
  10. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +28 -0
  11. package/resources/claude-customizations/config/orchestration-routing.json +1 -1
  12. package/resources/claude-customizations/pack-manifests/core.json +2 -0
  13. package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +0 -3
  14. package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +0 -3
  15. package/resources/codex-and-agents-customizations/.agents/skills/csharp-change-budget-router/SKILL.md +1 -1
  16. package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +1 -1
  17. package/resources/codex-and-agents-customizations/.agents/skills/epic-plan/SKILL.md +1 -1
  18. package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +2 -1
  19. package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +0 -2
  20. package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +0 -2
  21. package/resources/codex-and-agents-customizations/.agents/skills/invoke-csharp-engineer/SKILL.md +1 -1
  22. package/resources/codex-and-agents-customizations/.agents/skills/invoke-powershell-engineer/SKILL.md +1 -1
  23. package/resources/codex-and-agents-customizations/.agents/skills/invoke-python-engineer/SKILL.md +1 -1
  24. package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +3 -2
  25. package/resources/codex-and-agents-customizations/.agents/skills/policy-audit-template-usage/SKILL.md +1 -1
  26. package/resources/codex-and-agents-customizations/.agents/skills/powershell/SKILL.md +0 -4
  27. package/resources/codex-and-agents-customizations/.agents/skills/powershell-change-budget-router/SKILL.md +1 -1
  28. package/resources/codex-and-agents-customizations/.agents/skills/powershell-qa-gate/SKILL.md +1 -1
  29. package/resources/codex-and-agents-customizations/.agents/skills/python/SKILL.md +0 -2
  30. package/resources/codex-and-agents-customizations/.agents/skills/python-qa-gate/SKILL.md +1 -1
  31. package/resources/codex-and-agents-customizations/.agents/skills/python-suppressions/SKILL.md +0 -2
  32. package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +0 -2
  33. package/resources/codex-and-agents-customizations/.agents/skills/research-issue/SKILL.md +4 -3
  34. package/resources/codex-and-agents-customizations/.agents/skills/self-explanatory-code-commenting/SKILL.md +0 -2
  35. package/resources/codex-and-agents-customizations/.agents/skills/tonality/SKILL.md +0 -2
  36. package/resources/codex-and-agents-customizations/.agents/skills/translate-claude-to-codex/SKILL.md +3 -3
  37. package/resources/codex-and-agents-customizations/.agents/skills/translate-copilot-to-claude/SKILL.md +1 -1
  38. package/resources/codex-and-agents-customizations/.agents/skills/typescript/SKILL.md +0 -2
  39. package/resources/codex-and-agents-customizations/.agents/skills/typescript-suppressions/SKILL.md +0 -2
  40. package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
  41. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +349 -0
  42. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +123 -6
  43. package/resources/codex-and-agents-customizations/pack-manifests/core.json +1 -0
  44. package/resources/config/orchestration-routing.json +1 -1
  45. package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +17 -1
@@ -10,8 +10,37 @@ param()
10
10
  # mapping for every tool name the ^(apply_patch|Edit|Write)$ matcher admits.
11
11
  . (Join-Path $PSScriptRoot 'codex-pretooluse-file-mapping.ps1')
12
12
 
13
+ # Pure pathspec classifier for the issue #539 orchestration-bookkeeping staging exemption.
14
+ # Extracted to a dot-sourced sibling so this file stays inside the 500-line cap, following
15
+ # the headroom-split precedent already used on this side by enforce-completion-helpers.ps1.
16
+ . (Join-Path $PSScriptRoot 'enforce-orchestration-preimplementation-gate-helpers.ps1')
17
+
18
+ # The readiness checkpoint this gate reads and names in its block message.
13
19
  $script:CheckpointPath = 'artifacts/orchestration/orchestrator-state.json'
14
20
 
21
+ # Every orchestration checkpoint a planner or orchestrator surface writes. Writing one
22
+ # of these is orchestration bookkeeping, not implementation, so the gate must not
23
+ # require a ready checkpoint before the checkpoint itself can be created. The set is a
24
+ # list of repo-relative literals behind a single membership check: no directory prefix,
25
+ # no glob, and no absolute-path entry.
26
+ $script:CheckpointPaths = @(
27
+ 'artifacts/orchestration/orchestrator-state.json'
28
+ 'artifacts/orchestration/parallel-planner-state.json'
29
+ 'artifacts/orchestration/parallel-orchestrator-state.json'
30
+ 'artifacts/orchestration/epic-planner-state.json'
31
+ 'artifacts/orchestration/epic-orchestrator-state.json'
32
+ 'artifacts/orchestration/powershell-orchestrator-state.json'
33
+ 'artifacts/orchestration/csharp-orchestrator-state.json'
34
+ )
35
+
36
+ # Both markers must appear in the field-scoped prompt for a delegation to qualify as a
37
+ # preparation-mode kickoff. The literals are reused verbatim from
38
+ # .claude/skills/parallel-plan/SKILL.md and .claude/skills/epic-plan/SKILL.md.
39
+ $script:PreparationModeMarkers = @(
40
+ 'Preparation mode: true.'
41
+ 'route_id: preparation.'
42
+ )
43
+
15
44
  function ConvertFrom-CheckpointJson {
16
45
  [CmdletBinding()]
17
46
  param([Parameter(Mandatory)][string] $Json)
@@ -38,7 +67,13 @@ function Test-FeatureDocumentationOrEvidencePath {
38
67
  [OutputType([bool])]
39
68
  param([Parameter(Mandatory)][string] $NormalizedPath)
40
69
 
41
- return $NormalizedPath.StartsWith('docs/features/active/')
70
+ # The segment anchor (^|/) admits both the repo-relative spelling and an
71
+ # absolute spelling of the same feature document, which the Write tool
72
+ # supplies by contract. -cmatch is deliberate and must not be normalized into
73
+ # -match: String.StartsWith is case-sensitive, so the case-sensitive operator
74
+ # is what preserves the previous semantics exactly. PowerShell -match is
75
+ # case-insensitive and would widen this predicate.
76
+ return $NormalizedPath -cmatch '(^|/)docs/features/active/'
42
77
  }
43
78
 
44
79
  function Test-ImplementationPath {
@@ -49,8 +84,33 @@ function Test-ImplementationPath {
49
84
  if (Test-FeatureDocumentationOrEvidencePath -NormalizedPath $NormalizedPath) {
50
85
  return $false
51
86
  }
52
- if ($NormalizedPath -eq $script:CheckpointPath) {
53
- return $false
87
+ # Segment-anchored and end-anchored, so an absolute spelling of a checkpoint is
88
+ # exempt exactly as its repo-relative spelling already was. -match is
89
+ # deliberate here and must not be narrowed into -cmatch: -contains was
90
+ # case-insensitive, so the case-insensitive operator is what preserves the
91
+ # previous semantics exactly.
92
+ #
93
+ # Accepted widening: this also exempts a path OUTSIDE the workspace whose tail
94
+ # is an artifacts/orchestration/ segment followed by one of the seven names.
95
+ # Measured exposure in this repository is one matching file, the real
96
+ # checkpoint; there is no nested or vendored second copy. The same widening is
97
+ # already accepted for the identical literal in four other hooks. Resolving a
98
+ # workspace root instead would reintroduce every root-resolution failure mode
99
+ # (8.3 short names, drive-letter case, symlinks, linked worktrees), and a strip
100
+ # that failed to match would leave the path absolute and deny, reinstating the
101
+ # reported defect in a subtler form.
102
+ #
103
+ # Known deliberate miss: a path reaching a checkpoint name only through a '..'
104
+ # hop stays denied. The Write tool does not emit '..' segments, and a
105
+ # canonicalizer would reintroduce filesystem dependence for no measured gain.
106
+ #
107
+ # Idempotence for the apply_patch call site: (^|/) matches at ^, so a
108
+ # repo-relative path harvested from a file marker by Test-ImplementationCommand
109
+ # classifies exactly as it does today.
110
+ foreach ($checkpoint in $script:CheckpointPaths) {
111
+ if ($NormalizedPath -match ('(^|/)' + [regex]::Escape($checkpoint) + '$')) {
112
+ return $false
113
+ }
54
114
  }
55
115
  return $NormalizedPath -match '\.(py|ps1|psm1|ts|tsx|js|jsx|cs|json|yml|yaml)$'
56
116
  }
@@ -86,14 +146,60 @@ function Test-ImplementationCommand {
86
146
  '(^|\s)pwsh\s+.*(Invoke-Pester|tests/scripts/)'
87
147
  )
88
148
 
89
- foreach ($pattern in $implementationCommandPatterns) {
90
- if ($normalizedCommand -match $pattern) {
91
- return $true
149
+ for ($index = 0; $index -lt $implementationCommandPatterns.Count; $index++) {
150
+ if ($normalizedCommand -notmatch $implementationCommandPatterns[$index]) {
151
+ continue
152
+ }
153
+ # Allow-side only (issue #539). Index 0 is the git staging trigger, whose pattern
154
+ # text is unchanged. It is the sole leg the orchestration-bookkeeping exemption may
155
+ # clear, and only when no other implementation pattern matches the same line: the
156
+ # loop continues rather than returning, so a chained line carrying any non-git
157
+ # implementation segment still classifies as implementation. The apply_patch marker
158
+ # legs above are upstream of this loop and are unmodified.
159
+ if ($index -eq 0 -and (Test-ExemptOrchestrationStagingCommand -CommandText $normalizedCommand)) {
160
+ continue
92
161
  }
162
+ return $true
93
163
  }
94
164
  return $false
95
165
  }
96
166
 
167
+ function Test-PreparationModeDelegation {
168
+ <#
169
+ .SYNOPSIS
170
+ Identifies an orchestrator delegation that is a preparation-mode kickoff.
171
+ .DESCRIPTION
172
+ Returns true only when all three conjuncts hold: the payload is present, the
173
+ delegated agent is exactly 'orchestrator', and the field-scoped prompt carries
174
+ both preparation markers. The prompt is read as a named field via this file's
175
+ own Get-StringProperty helper rather than from the serialized payload, so that
176
+ marker text planted in an unrelated field cannot exempt an implementation
177
+ delegation.
178
+ .OUTPUTS
179
+ System.Boolean
180
+ #>
181
+ [CmdletBinding()]
182
+ [OutputType([bool])]
183
+ param([Parameter(Mandatory)][AllowNull()] $ToolInput)
184
+
185
+ if ($null -eq $ToolInput) {
186
+ return $false
187
+ }
188
+
189
+ $subagentType = Get-StringProperty -Value $ToolInput -Name 'subagent_type'
190
+ if ($subagentType -ne 'orchestrator') {
191
+ return $false
192
+ }
193
+
194
+ $prompt = Get-StringProperty -Value $ToolInput -Name 'prompt'
195
+ foreach ($marker in $script:PreparationModeMarkers) {
196
+ if (-not $prompt.Contains($marker)) {
197
+ return $false
198
+ }
199
+ }
200
+ return $true
201
+ }
202
+
97
203
  function Test-ImplementationDelegation {
98
204
  [CmdletBinding()]
99
205
  [OutputType([bool])]
@@ -103,6 +209,17 @@ function Test-ImplementationDelegation {
103
209
  return $false
104
210
  }
105
211
 
212
+ try {
213
+ if (Test-PreparationModeDelegation -ToolInput $ToolInput) {
214
+ return $false
215
+ }
216
+ } catch {
217
+ # An envelope the field reader cannot probe falls through to the unchanged
218
+ # whole-payload regex below. An extraction failure must never become an
219
+ # exemption, so the gate stays closed on the stricter classifier.
220
+ Write-Debug "Preparation-mode probe failed: $($_.Exception.Message)"
221
+ }
222
+
106
223
  $payloadText = ($ToolInput | ConvertTo-Json -Depth 20 -Compress)
107
224
  return $payloadText -match '(python-typed-engineer|powershell-typed-engineer|typescript-engineer|csharp-typed-engineer|atomic-executor|implementation|execute)'
108
225
  }
@@ -37,6 +37,7 @@
37
37
  ".codex/hooks/enforce-epic-root-invocation.ps1",
38
38
  ".codex/hooks/enforce-epic-wave-barrier.ps1",
39
39
  ".codex/hooks/enforce-epic-worktree-removal-gate.ps1",
40
+ ".codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1",
40
41
  ".codex/hooks/record-subagent-routing-attestation.ps1",
41
42
  ".codex/hooks/validate-codex-subagent-routing.ps1",
42
43
  ".codex/scripts/epic-child-launch-contract.ps1",
@@ -210,7 +210,7 @@
210
210
  },
211
211
  "model_budget": {
212
212
  "description": "Session-level model budget. fable_policy is a three-way switch controlling whether the fable tier is disabled (removed and clamped to opus), available (used as-is), or preferred (applies the preferred_overlay).",
213
- "fable_policy": "preferred"
213
+ "fable_policy": "available"
214
214
  },
215
215
  "codex_topology_policy": {
216
216
  "description": "Codex-native production-file-count routing. This axis selects the initial implementation topology independently from C1-C4 model selection.",
@@ -129,6 +129,10 @@
129
129
  '.codex/hooks/enforce-evidence-locations.ps1'
130
130
  '.codex/hooks/enforce-checkpoint-monotonic.ps1'
131
131
  '.codex/hooks/enforce-orchestration-preimplementation-gate.ps1'
132
+ # Issue #539 extracted the command-branch pathspec classifier into this
133
+ # dot-sourced sibling for headroom; registered so the new production file stays
134
+ # in the coverage denominator per the Coverage Exclusion Policy.
135
+ '.codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1'
132
136
  # Issue #415 remediation cycle 2 (R-COV): the detached-HEAD null-guard fix changed
133
137
  # these two Codex PreToolUse hooks. Both were absent from this list, so the changed
134
138
  # production surface was outside the coverage denominator. Measured here so the
@@ -137,7 +141,7 @@
137
141
  '.codex/hooks/enforce-epic-planning-only.ps1'
138
142
  # Issue #447 added the .claude-resident PowerShell blast-radius library, the
139
143
  # two-language mirror of scripts/dev_tools/compute_blast_radius.py and its
140
- # helper modules. The set is split across six files only to satisfy the
144
+ # helper modules. The set is split across seven files only to satisfy the
141
145
  # 500-line limit; measured here so no new production module is excluded from
142
146
  # coverage.
143
147
  # Issue #489 added BlastRadiusNormalization.psm1, which holds the
@@ -145,12 +149,20 @@
145
149
  # Resolve-BlastRadiusModule relocated out of the two modules that had run
146
150
  # out of headroom. The relocation moves already-measured lines, so the new
147
151
  # file is registered here to keep them in the coverage denominator.
152
+ # Issue #502 added BlastRadiusTokenShape.psm1, the seventh file. It holds the
153
+ # new placeholder-marker predicate plus Test-MultipleFeatureFolderSpan
154
+ # relocated out of BlastRadiusExtraction.psm1, which had two lines of
155
+ # headroom left. CodeCoverage.Path is an explicit per-file allow-list, so
156
+ # without this entry the new production module and the relocated
157
+ # already-measured lines would both sit outside the coverage denominator,
158
+ # which the Coverage Exclusion Policy forbids.
148
159
  '.claude/lib/blast-radius/BlastRadiusExtraction.psm1'
149
160
  '.claude/lib/blast-radius/BlastRadiusGlob.psm1'
150
161
  '.claude/lib/blast-radius/BlastRadiusConfig.psm1'
151
162
  '.claude/lib/blast-radius/BlastRadiusValidation.psm1'
152
163
  '.claude/lib/blast-radius/BlastRadius.psm1'
153
164
  '.claude/lib/blast-radius/BlastRadiusNormalization.psm1'
165
+ '.claude/lib/blast-radius/BlastRadiusTokenShape.psm1'
154
166
  # Issue #440 added the two parallel enforcement hooks (the Layer 1 cohort
155
167
  # barrier and the worktree removal gate) and extended the invocation-origin
156
168
  # hook with the parallel-agent family; measured here so no new or changed
@@ -188,6 +200,10 @@
188
200
  '.claude/lib/hook-payload/HookPayload.psm1'
189
201
  '.claude/hooks/enforce-promotion-mcp-only.ps1'
190
202
  '.claude/hooks/enforce-orchestration-preimplementation-gate.ps1'
203
+ # Issue #539 extracted the command-branch pathspec classifier into this
204
+ # dot-sourced sibling for headroom; registered so the new production file stays
205
+ # in the coverage denominator per the Coverage Exclusion Policy.
206
+ '.claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1'
191
207
  '.claude/hooks/enforce-evidence-locations.ps1'
192
208
  '.claude/hooks/enforce-feature-folder-order.ps1'
193
209
  '.claude/hooks/enforce-checkpoint-monotonic.ps1'