@danmoisan/drm-copilot-mcp 1.0.13 → 1.0.15
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.
- package/out/mcp-server.js +3160 -458
- package/package.json +1 -1
- package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +24 -0
- package/resources/claude-customizations/.claude/agents/epic-planner.md +121 -0
- package/resources/claude-customizations/.claude/agents/orchestrator.md +2 -2
- package/resources/claude-customizations/.claude/hooks/enforce-epic-invocation-origin.ps1 +246 -0
- package/resources/claude-customizations/.claude/settings.json +9 -2
- package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +7 -0
- package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +189 -0
- package/resources/claude-customizations/.claude/skills/epic-run/SKILL.md +38 -0
- package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +21 -2
- package/resources/claude-customizations/pack-manifests/core.json +4 -0
- package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +0 -1
- package/resources/codex-and-agents-customizations/.agents/skills/codex-model-routing/SKILL.md +100 -0
- package/resources/codex-and-agents-customizations/.agents/skills/codex-model-routing/agents/openai.yaml +4 -0
- package/resources/codex-and-agents-customizations/.agents/skills/epic-orchestrate/SKILL.md +170 -0
- package/resources/codex-and-agents-customizations/.agents/skills/epic-plan/SKILL.md +230 -0
- package/resources/codex-and-agents-customizations/.agents/skills/epic-run/SKILL.md +39 -0
- package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +0 -1
- package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +0 -1
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +89 -9
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +39 -4
- package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +0 -1
- package/resources/codex-and-agents-customizations/.agents/skills/tonality/SKILL.md +0 -1
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c1.toml +153 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c2.toml +153 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3-elevated.toml +153 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c3.toml +153 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor-c4.toml +153 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c1.toml +95 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c2.toml +95 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3-elevated.toml +95 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c3.toml +95 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner-c4.toml +95 -0
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-planner.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c1.toml +99 -0
- package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c2.toml +99 -0
- package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c3-elevated.toml +99 -0
- package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c3.toml +99 -0
- package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c4.toml +99 -0
- package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/epic-orchestrator.toml +96 -0
- package/resources/codex-and-agents-customizations/.codex/agents/epic-planner.toml +97 -0
- package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c1.toml +62 -0
- package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c2.toml +62 -0
- package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c3-elevated.toml +62 -0
- package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c3.toml +62 -0
- package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer-c4.toml +62 -0
- package/resources/codex-and-agents-customizations/.codex/agents/feature-reviewer.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c1.toml +200 -0
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c2.toml +200 -0
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3-elevated.toml +200 -0
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c3.toml +200 -0
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator-c4.toml +200 -0
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +53 -3
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c1.toml +110 -0
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c2.toml +110 -0
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c3-elevated.toml +110 -0
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c3.toml +110 -0
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c4.toml +110 -0
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/pr-author-c1.toml +28 -0
- package/resources/codex-and-agents-customizations/.codex/agents/pr-author-c2.toml +28 -0
- package/resources/codex-and-agents-customizations/.codex/agents/pr-author-c3-elevated.toml +28 -0
- package/resources/codex-and-agents-customizations/.codex/agents/pr-author-c3.toml +28 -0
- package/resources/codex-and-agents-customizations/.codex/agents/pr-author-c4.toml +28 -0
- package/resources/codex-and-agents-customizations/.codex/agents/pr-author.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/prd-feature-c1.toml +55 -0
- package/resources/codex-and-agents-customizations/.codex/agents/prd-feature-c2.toml +55 -0
- package/resources/codex-and-agents-customizations/.codex/agents/prd-feature-c3-elevated.toml +55 -0
- package/resources/codex-and-agents-customizations/.codex/agents/prd-feature-c3.toml +55 -0
- package/resources/codex-and-agents-customizations/.codex/agents/prd-feature-c4.toml +55 -0
- package/resources/codex-and-agents-customizations/.codex/agents/prd-feature.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c1.toml +102 -0
- package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c2.toml +102 -0
- package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c3-elevated.toml +102 -0
- package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c3.toml +102 -0
- package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c4.toml +102 -0
- package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c1.toml +105 -0
- package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c2.toml +105 -0
- package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c3-elevated.toml +105 -0
- package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c3.toml +105 -0
- package/resources/codex-and-agents-customizations/.codex/agents/task-researcher-c4.toml +105 -0
- package/resources/codex-and-agents-customizations/.codex/agents/task-researcher.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/agents/typescript-engineer-c1.toml +50 -0
- package/resources/codex-and-agents-customizations/.codex/agents/typescript-engineer-c2.toml +50 -0
- package/resources/codex-and-agents-customizations/.codex/agents/typescript-engineer-c3-elevated.toml +50 -0
- package/resources/codex-and-agents-customizations/.codex/agents/typescript-engineer-c3.toml +50 -0
- package/resources/codex-and-agents-customizations/.codex/agents/typescript-engineer-c4.toml +50 -0
- package/resources/codex-and-agents-customizations/.codex/agents/typescript-engineer.toml +2 -0
- package/resources/codex-and-agents-customizations/.codex/config.toml +202 -37
- package/resources/codex-and-agents-customizations/.codex/hooks/authorize-root-epic-invocation.ps1 +236 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/check-powershell-test-purity.ps1 +178 -69
- package/resources/codex-and-agents-customizations/.codex/hooks/check-python-test-purity.ps1 +92 -19
- package/resources/codex-and-agents-customizations/.codex/hooks/codex-agent-profile-attestation.ps1 +199 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/codex-authority-store.ps1 +182 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/codex-epic-child-launch-attestation.ps1 +129 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-checkpoint-monotonic.ps1 +148 -31
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-codex-model-routing.ps1 +198 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-consistency.ps1 +28 -19
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-child-worktree-binding.ps1 +325 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate.ps1 +140 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-planning-only.ps1 +292 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-root-invocation.ps1 +135 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-wave-barrier.ps1 +295 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-worktree-removal-gate.ps1 +151 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-evidence-locations.ps1 +99 -34
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +143 -27
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +88 -43
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +65 -20
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +88 -42
- package/resources/codex-and-agents-customizations/.codex/hooks/record-subagent-routing-attestation.ps1 +414 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/validate-bash.ps1 +164 -51
- package/resources/codex-and-agents-customizations/.codex/hooks/validate-codex-subagent-routing.ps1 +154 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/validate-feature-review-coverage.ps1 +58 -23
- package/resources/codex-and-agents-customizations/AGENTS.md +27 -0
- package/resources/codex-and-agents-customizations/pack-manifests/core.json +66 -1
- package/resources/codex-and-agents-customizations/pack-manifests/csharp-legacy.json +6 -1
- package/resources/codex-and-agents-customizations/pack-manifests/csharp-modern.json +6 -1
- package/resources/codex-and-agents-customizations/pack-manifests/powershell.json +6 -1
- package/resources/codex-and-agents-customizations/pack-manifests/python.json +6 -1
- package/resources/codex-and-agents-customizations/pack-manifests/typescript.json +6 -1
- package/resources/config/orchestration-routing.json +167 -0
- package/resources/powershell/PoshQC/PoshQC.Analyzer.psm1 +1 -1
- package/resources/powershell/PoshQC/PoshQC.ScanConfig.psm1 +125 -0
- package/resources/powershell/PoshQC/PoshQC.Testing.psm1 +14 -2
- package/resources/powershell/PoshQC/PoshQC.psd1 +0 -4
- package/resources/powershell/PoshQC/PoshQC.psm1 +26 -6
- package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +34 -18
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name = "typescript-engineer-c4"
|
|
2
|
+
description = "Converted subagent"
|
|
3
|
+
model = "gpt-5.6-sol"
|
|
4
|
+
model_reasoning_effort = "max"
|
|
5
|
+
developer_instructions = '''
|
|
6
|
+
Canonical migration source: .github/agents/typescript-engineer.agent.md
|
|
7
|
+
Read the canonical source agent file first and follow it exactly.
|
|
8
|
+
Preserve all mandatory sequencing, artifact, validation, remediation, and completion gates from the source agent.
|
|
9
|
+
If the source agent defines handoffs, preserve those handoffs with the same degree of process gating in Codex.
|
|
10
|
+
Treat .agents/skills, .codex/agents, and .codex/prompts as the Codex runtime surfaces for migrated behavior.
|
|
11
|
+
Do not weaken validation-only preflight loops, QA gates, remediation triggers, review gates, acceptance-criteria tracking, or evidence requirements that exist in the source agent.
|
|
12
|
+
|
|
13
|
+
Applied rewrites:
|
|
14
|
+
- Rewrite Claude skill paths to shared skill paths.
|
|
15
|
+
|
|
16
|
+
Canonical migration source:
|
|
17
|
+
- .github/agents/typescript-engineer.agent.md
|
|
18
|
+
|
|
19
|
+
Migration contract:
|
|
20
|
+
- Read the canonical source agent file first and follow it exactly.
|
|
21
|
+
- Preserve all mandatory sequencing, artifact, validation, remediation, and completion gates from the source agent.
|
|
22
|
+
- If the source agent defines handoffs, preserve those handoffs with the same degree of process gating and do not mark a delegated step complete until the delegated output contract and required on-disk artifacts exist.
|
|
23
|
+
- Treat .agents/skills, .codex/agents, and .codex/prompts as the Codex runtime surfaces for migrated behavior, but do not relax any source-agent requirements during that translation.
|
|
24
|
+
- Do not weaken validation-only preflight loops, QA gates, remediation triggers, review gates, acceptance-criteria tracking, or evidence requirements that exist in the source agent.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
name: typescript-engineer
|
|
28
|
+
description: Project-scoped worker that implements and verifies TypeScript changes within typed repository boundaries.
|
|
29
|
+
tools:
|
|
30
|
+
- Read
|
|
31
|
+
- Grep
|
|
32
|
+
- Glob
|
|
33
|
+
- "Bash(npx *)"
|
|
34
|
+
skills:
|
|
35
|
+
- acceptance-criteria-tracking
|
|
36
|
+
memory: project
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# TypeScript Engineer Agent
|
|
40
|
+
|
|
41
|
+
Implement TypeScript changes within the approved scope, preserve typed boundaries, and verify results with the repository TypeScript toolchain.
|
|
42
|
+
|
|
43
|
+
## Evidence Location Invariant
|
|
44
|
+
|
|
45
|
+
All evidence artifacts this agent produces (baselines, QA gates, regression results, coverage) MUST be written to `<FEATURE>/evidence/<kind>/` as defined in `.agents/skills/evidence-and-timestamp-conventions/SKILL.md`.
|
|
46
|
+
|
|
47
|
+
Writing to `artifacts/baselines/`, `artifacts/qa/`, `artifacts/coverage/`, or any other non-canonical path is a policy violation and will be caught by the `enforce-evidence-locations.ps1` PreToolUse hook.
|
|
48
|
+
|
|
49
|
+
If a delegation prompt, plan, or caller instruction specifies a non-canonical evidence path (e.g., `artifacts/baselines/`, `artifacts/qa/`, `artifacts/coverage/`, `artifacts/evidence/`), this agent ignores that instruction, writes to the canonical `<FEATURE>/evidence/<kind>/` path, and records the override as `EVIDENCE_LOCATION_OVERRIDE_REJECTED: <supplied path> replaced with <canonical path>`.
|
|
50
|
+
'''
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
name = "typescript-engineer"
|
|
2
2
|
description = "Converted subagent"
|
|
3
|
+
model = "gpt-5.6-terra"
|
|
4
|
+
model_reasoning_effort = "high"
|
|
3
5
|
developer_instructions = '''
|
|
4
6
|
Canonical migration source: .github/agents/typescript-engineer.agent.md
|
|
5
7
|
Read the canonical source agent file first and follow it exactly.
|
|
@@ -2,7 +2,7 @@ default_permissions = ":danger-full-access"
|
|
|
2
2
|
|
|
3
3
|
[mcp_servers.drm-copilot]
|
|
4
4
|
command = "npx"
|
|
5
|
-
args = ["-y", "@danmoisan/drm-copilot-mcp"]
|
|
5
|
+
args = ["-y", "@danmoisan/drm-copilot-mcp@1.0.15"]
|
|
6
6
|
required = true
|
|
7
7
|
enabled_tools = [
|
|
8
8
|
"collect_commit_context",
|
|
@@ -28,60 +28,225 @@ enabled_tools = [
|
|
|
28
28
|
]
|
|
29
29
|
default_tools_approval_mode = "prompt"
|
|
30
30
|
|
|
31
|
+
[mcp_servers.drm-copilot.tools.collect_commit_context]
|
|
32
|
+
approval_mode = "approve"
|
|
33
|
+
|
|
34
|
+
[mcp_servers.drm-copilot.tools.collect_pr_context]
|
|
35
|
+
approval_mode = "approve"
|
|
36
|
+
|
|
37
|
+
[mcp_servers.drm-copilot.tools.new_potential_bug_entry]
|
|
38
|
+
approval_mode = "approve"
|
|
39
|
+
|
|
40
|
+
[mcp_servers.drm-copilot.tools.new_potential_entry]
|
|
41
|
+
approval_mode = "approve"
|
|
42
|
+
|
|
43
|
+
[mcp_servers.drm-copilot.tools.link_parent_child]
|
|
44
|
+
approval_mode = "approve"
|
|
45
|
+
|
|
46
|
+
[mcp_servers.drm-copilot.tools.potential_to_issue]
|
|
47
|
+
approval_mode = "approve"
|
|
48
|
+
|
|
49
|
+
[mcp_servers.drm-copilot.tools.new_active_feature_folder]
|
|
50
|
+
approval_mode = "approve"
|
|
51
|
+
|
|
52
|
+
[mcp_servers.drm-copilot.tools.run_poshqc_format]
|
|
53
|
+
approval_mode = "approve"
|
|
54
|
+
|
|
55
|
+
[mcp_servers.drm-copilot.tools.run_poshqc_analyze]
|
|
56
|
+
approval_mode = "approve"
|
|
57
|
+
|
|
58
|
+
[mcp_servers.drm-copilot.tools.run_poshqc_test]
|
|
59
|
+
approval_mode = "approve"
|
|
60
|
+
|
|
61
|
+
[mcp_servers.drm-copilot.tools.run_poshqc_analyze_autofix]
|
|
62
|
+
approval_mode = "approve"
|
|
63
|
+
|
|
64
|
+
[mcp_servers.drm-copilot.tools.run_poshqc_suite]
|
|
65
|
+
approval_mode = "approve"
|
|
66
|
+
|
|
67
|
+
[mcp_servers.drm-copilot.tools.resolve_policy_audit_template_asset]
|
|
68
|
+
approval_mode = "approve"
|
|
69
|
+
|
|
70
|
+
[mcp_servers.drm-copilot.tools.resolve_execute_hard_lock_prompt]
|
|
71
|
+
approval_mode = "approve"
|
|
72
|
+
|
|
73
|
+
[mcp_servers.drm-copilot.tools.resolve_atomic_plan_prompt]
|
|
74
|
+
approval_mode = "approve"
|
|
75
|
+
|
|
31
76
|
[mcp_servers.drm-copilot.tools.validate_orchestration_artifacts]
|
|
32
77
|
approval_mode = "approve"
|
|
33
78
|
|
|
34
|
-
[
|
|
35
|
-
|
|
79
|
+
[permissions.orchestrator-workspace]
|
|
80
|
+
description = "Workspace-scoped orchestration with network access for Git, GitHub, and MCP workflows."
|
|
81
|
+
extends = ":workspace"
|
|
36
82
|
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
83
|
+
[permissions.orchestrator-workspace.filesystem.":workspace_roots"]
|
|
84
|
+
".codex" = "read"
|
|
85
|
+
".agents" = "read"
|
|
86
|
+
"AGENTS.md" = "read"
|
|
87
|
+
"config/orchestration-routing.json" = "read"
|
|
40
88
|
|
|
41
|
-
[
|
|
42
|
-
|
|
43
|
-
command = "pwsh -NoProfile -File .codex/hooks/enforce-promotion-mcp-only.ps1"
|
|
89
|
+
[permissions.orchestrator-workspace.network]
|
|
90
|
+
enabled = true
|
|
44
91
|
|
|
45
|
-
[
|
|
46
|
-
|
|
47
|
-
|
|
92
|
+
[features]
|
|
93
|
+
multi_agent = true
|
|
94
|
+
hooks = true
|
|
48
95
|
|
|
49
|
-
[
|
|
50
|
-
|
|
51
|
-
|
|
96
|
+
[agents]
|
|
97
|
+
max_depth = 3
|
|
98
|
+
max_threads = 12
|
|
52
99
|
|
|
53
|
-
[[hooks.
|
|
54
|
-
matcher = "Write|Edit"
|
|
55
|
-
command = "pwsh -NoProfile -File .codex/hooks/enforce-python-batch-budget.ps1"
|
|
100
|
+
[[hooks.UserPromptSubmit]]
|
|
56
101
|
|
|
57
|
-
[[hooks.
|
|
58
|
-
|
|
59
|
-
command =
|
|
102
|
+
[[hooks.UserPromptSubmit.hooks]]
|
|
103
|
+
type = "command"
|
|
104
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/authorize-root-epic-invocation.ps1"'
|
|
105
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/authorize-root-epic-invocation.ps1"'
|
|
106
|
+
timeout = 15
|
|
107
|
+
statusMessage = "Authorizing root epic entry"
|
|
60
108
|
|
|
61
|
-
[[hooks.
|
|
62
|
-
matcher = "
|
|
63
|
-
command = "pwsh -NoProfile -File .codex/hooks/enforce-powershell-batch-budget.ps1"
|
|
109
|
+
[[hooks.SubagentStart]]
|
|
110
|
+
matcher = "epic-planner|epic-orchestrator|orchestrator|atomic-planner|atomic-executor|feature-review|feature-reviewer|task-researcher|prd-feature|pr-author|typed-engineer|-c"
|
|
64
111
|
|
|
65
|
-
[[hooks.
|
|
66
|
-
|
|
67
|
-
command =
|
|
112
|
+
[[hooks.SubagentStart.hooks]]
|
|
113
|
+
type = "command"
|
|
114
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/record-subagent-routing-attestation.ps1"'
|
|
115
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/record-subagent-routing-attestation.ps1"'
|
|
116
|
+
timeout = 15
|
|
117
|
+
statusMessage = "Recording subagent routing attestation"
|
|
68
118
|
|
|
69
119
|
[[hooks.PreToolUse]]
|
|
70
|
-
matcher = "
|
|
71
|
-
|
|
120
|
+
matcher = "^Bash$"
|
|
121
|
+
|
|
122
|
+
[[hooks.PreToolUse.hooks]]
|
|
123
|
+
type = "command"
|
|
124
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/validate-bash.ps1"'
|
|
125
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/validate-bash.ps1"'
|
|
126
|
+
timeout = 30
|
|
127
|
+
|
|
128
|
+
[[hooks.PreToolUse.hooks]]
|
|
129
|
+
type = "command"
|
|
130
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-promotion-mcp-only.ps1"'
|
|
131
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-promotion-mcp-only.ps1"'
|
|
132
|
+
timeout = 30
|
|
133
|
+
|
|
134
|
+
[[hooks.PreToolUse.hooks]]
|
|
135
|
+
type = "command"
|
|
136
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1"'
|
|
137
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1"'
|
|
138
|
+
timeout = 30
|
|
139
|
+
|
|
140
|
+
[[hooks.PreToolUse.hooks]]
|
|
141
|
+
type = "command"
|
|
142
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-merge-gate.ps1"'
|
|
143
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-merge-gate.ps1"'
|
|
144
|
+
timeout = 30
|
|
145
|
+
|
|
146
|
+
[[hooks.PreToolUse.hooks]]
|
|
147
|
+
type = "command"
|
|
148
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-worktree-removal-gate.ps1"'
|
|
149
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-worktree-removal-gate.ps1"'
|
|
150
|
+
timeout = 30
|
|
72
151
|
|
|
73
152
|
[[hooks.PreToolUse]]
|
|
74
|
-
matcher = "Write|
|
|
75
|
-
|
|
153
|
+
matcher = "^(Bash|shell_command|apply_patch|Edit|Write|mcp__.*)$"
|
|
154
|
+
|
|
155
|
+
[[hooks.PreToolUse.hooks]]
|
|
156
|
+
type = "command"
|
|
157
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-root-invocation.ps1"'
|
|
158
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-root-invocation.ps1"'
|
|
159
|
+
timeout = 30
|
|
160
|
+
|
|
161
|
+
[[hooks.PreToolUse.hooks]]
|
|
162
|
+
type = "command"
|
|
163
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-codex-model-routing.ps1"'
|
|
164
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-codex-model-routing.ps1"'
|
|
165
|
+
timeout = 30
|
|
166
|
+
|
|
167
|
+
[[hooks.PreToolUse.hooks]]
|
|
168
|
+
type = "command"
|
|
169
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-planning-only.ps1"'
|
|
170
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-planning-only.ps1"'
|
|
171
|
+
timeout = 30
|
|
172
|
+
|
|
173
|
+
[[hooks.PreToolUse.hooks]]
|
|
174
|
+
type = "command"
|
|
175
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-wave-barrier.ps1"'
|
|
176
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-wave-barrier.ps1"'
|
|
177
|
+
timeout = 30
|
|
178
|
+
|
|
179
|
+
[[hooks.PreToolUse.hooks]]
|
|
180
|
+
type = "command"
|
|
181
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-child-worktree-binding.ps1"'
|
|
182
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-epic-child-worktree-binding.ps1"'
|
|
183
|
+
timeout = 30
|
|
76
184
|
|
|
77
185
|
[[hooks.PreToolUse]]
|
|
78
|
-
matcher = "
|
|
79
|
-
|
|
186
|
+
matcher = "^(apply_patch|Edit|Write)$"
|
|
187
|
+
|
|
188
|
+
[[hooks.PreToolUse.hooks]]
|
|
189
|
+
type = "command"
|
|
190
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/check-python-test-purity.ps1"'
|
|
191
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/check-python-test-purity.ps1"'
|
|
192
|
+
timeout = 30
|
|
193
|
+
|
|
194
|
+
[[hooks.PreToolUse.hooks]]
|
|
195
|
+
type = "command"
|
|
196
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-python-batch-budget.ps1"'
|
|
197
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-python-batch-budget.ps1"'
|
|
198
|
+
timeout = 30
|
|
199
|
+
|
|
200
|
+
[[hooks.PreToolUse.hooks]]
|
|
201
|
+
type = "command"
|
|
202
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/check-powershell-test-purity.ps1"'
|
|
203
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/check-powershell-test-purity.ps1"'
|
|
204
|
+
timeout = 30
|
|
205
|
+
|
|
206
|
+
[[hooks.PreToolUse.hooks]]
|
|
207
|
+
type = "command"
|
|
208
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-powershell-batch-budget.ps1"'
|
|
209
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-powershell-batch-budget.ps1"'
|
|
210
|
+
timeout = 30
|
|
211
|
+
|
|
212
|
+
[[hooks.PreToolUse.hooks]]
|
|
213
|
+
type = "command"
|
|
214
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-evidence-locations.ps1"'
|
|
215
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-evidence-locations.ps1"'
|
|
216
|
+
timeout = 30
|
|
217
|
+
|
|
218
|
+
[[hooks.PreToolUse.hooks]]
|
|
219
|
+
type = "command"
|
|
220
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1"'
|
|
221
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1"'
|
|
222
|
+
timeout = 30
|
|
223
|
+
|
|
224
|
+
[[hooks.PreToolUse.hooks]]
|
|
225
|
+
type = "command"
|
|
226
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-checkpoint-monotonic.ps1"'
|
|
227
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-checkpoint-monotonic.ps1"'
|
|
228
|
+
timeout = 30
|
|
229
|
+
|
|
230
|
+
[[hooks.PreToolUse.hooks]]
|
|
231
|
+
type = "command"
|
|
232
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-completion-consistency.ps1"'
|
|
233
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/enforce-completion-consistency.ps1"'
|
|
234
|
+
timeout = 30
|
|
80
235
|
|
|
81
|
-
[[hooks.
|
|
82
|
-
matcher = "
|
|
83
|
-
|
|
236
|
+
[[hooks.SubagentStop]]
|
|
237
|
+
matcher = "epic-planner|epic-orchestrator|orchestrator|atomic-planner|atomic-executor|feature-review|feature-reviewer|task-researcher|prd-feature|pr-author|typed-engineer|-c"
|
|
238
|
+
|
|
239
|
+
[[hooks.SubagentStop.hooks]]
|
|
240
|
+
type = "command"
|
|
241
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/validate-codex-subagent-routing.ps1"'
|
|
242
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/validate-codex-subagent-routing.ps1"'
|
|
243
|
+
timeout = 30
|
|
84
244
|
|
|
85
245
|
[[hooks.SubagentStop]]
|
|
86
246
|
matcher = "feature-review|feature-reviewer"
|
|
87
|
-
|
|
247
|
+
|
|
248
|
+
[[hooks.SubagentStop.hooks]]
|
|
249
|
+
type = "command"
|
|
250
|
+
command = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/validate-feature-review-coverage.ps1"'
|
|
251
|
+
command_windows = 'pwsh -NoProfile -File "$(git rev-parse --show-toplevel)/.codex/hooks/validate-feature-review-coverage.ps1"'
|
|
252
|
+
timeout = 30
|
package/resources/codex-and-agents-customizations/.codex/hooks/authorize-root-epic-invocation.ps1
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<#
|
|
2
|
+
.SYNOPSIS
|
|
3
|
+
Records a bounded root-session authorization receipt for Codex epic personas.
|
|
4
|
+
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
UserPromptSubmit hook. Reads the documented Codex JSON payload from stdin. Exact epic skill
|
|
7
|
+
commands and direct requests to invoke an epic persona produce one turn-bound receipt in the
|
|
8
|
+
non-workspace Codex authority store. Non-epic prompts are ignored. The receipt is consumed by
|
|
9
|
+
the SubagentStart attestation hook.
|
|
10
|
+
#>
|
|
11
|
+
[CmdletBinding()]
|
|
12
|
+
param()
|
|
13
|
+
|
|
14
|
+
. (Join-Path $PSScriptRoot 'codex-authority-store.ps1')
|
|
15
|
+
|
|
16
|
+
$script:ReceiptLifetimeMinutes = 60
|
|
17
|
+
|
|
18
|
+
function ConvertFrom-RootEpicHookPayload {
|
|
19
|
+
[CmdletBinding()]
|
|
20
|
+
param([Parameter(Mandatory)][string] $PayloadRaw)
|
|
21
|
+
|
|
22
|
+
if ([string]::IsNullOrWhiteSpace($PayloadRaw)) {
|
|
23
|
+
throw 'EPIC_INVOCATION_ORIGIN_BLOCKED: UserPromptSubmit hook input is empty.'
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return $PayloadRaw | ConvertFrom-Json -ErrorAction Stop
|
|
27
|
+
} catch {
|
|
28
|
+
throw "EPIC_INVOCATION_ORIGIN_BLOCKED: UserPromptSubmit hook input is malformed JSON: $_"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function Get-RootEpicRequestedPersona {
|
|
33
|
+
[CmdletBinding()]
|
|
34
|
+
[OutputType([string])]
|
|
35
|
+
param([Parameter(Mandatory)][AllowEmptyString()][string] $Prompt)
|
|
36
|
+
|
|
37
|
+
if ($Prompt -match '(?im)^\s*(?:/|\$)?epic-plan(?:\s+|$)' -or
|
|
38
|
+
$Prompt -match '(?im)^\s*(?:please\s+)?(?:invoke|spawn|use|run|delegate(?:\s+this)?\s+to)\s+(?:the\s+)?(?:Codex\s+)?epic-planner\b') {
|
|
39
|
+
return 'epic-planner'
|
|
40
|
+
}
|
|
41
|
+
if ($Prompt -match '(?im)^\s*(?:/|\$)?epic-(?:run|orchestrate)(?:\s+|$)' -or
|
|
42
|
+
$Prompt -match '(?im)^\s*(?:please\s+)?(?:invoke|spawn|use|run|delegate(?:\s+this)?\s+to)\s+(?:the\s+)?(?:Codex\s+)?epic-orchestrator\b') {
|
|
43
|
+
return 'epic-orchestrator'
|
|
44
|
+
}
|
|
45
|
+
return ''
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function Get-RootEpicReference {
|
|
49
|
+
[CmdletBinding()]
|
|
50
|
+
[OutputType([string])]
|
|
51
|
+
param([Parameter(Mandatory)][AllowEmptyString()][string] $Prompt)
|
|
52
|
+
|
|
53
|
+
if ($Prompt -match '(?im)^\s*(?:/|\$)?epic-(?:plan|run|orchestrate)\s+(?<reference>[^\r\n]+)') {
|
|
54
|
+
return $Matches.reference.Trim()
|
|
55
|
+
}
|
|
56
|
+
if ($Prompt -match '(?i)(?<reference>docs[\\/]features[\\/]epics[\\/][^\s"'']+)') {
|
|
57
|
+
return ($Matches.reference -replace '\\', '/').TrimEnd('.', ',', ';')
|
|
58
|
+
}
|
|
59
|
+
return ''
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function Get-RootEpicEntryKind {
|
|
63
|
+
[CmdletBinding()]
|
|
64
|
+
[OutputType([string])]
|
|
65
|
+
param([Parameter(Mandatory)][AllowEmptyString()][string] $Prompt)
|
|
66
|
+
|
|
67
|
+
if ($Prompt -match '(?im)^\s*(?:/|\$)?epic-plan(?:\s+|$)') {
|
|
68
|
+
return 'epic-plan'
|
|
69
|
+
}
|
|
70
|
+
if ($Prompt -match '(?im)^\s*(?:/|\$)?epic-run(?:\s+|$)') {
|
|
71
|
+
return 'epic-run'
|
|
72
|
+
}
|
|
73
|
+
if ($Prompt -match '(?im)^\s*(?:/|\$)?epic-orchestrate(?:\s+|$)') {
|
|
74
|
+
return 'epic-orchestrate'
|
|
75
|
+
}
|
|
76
|
+
return 'direct'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function Get-RootEpicSlug {
|
|
80
|
+
[CmdletBinding()]
|
|
81
|
+
[OutputType([string])]
|
|
82
|
+
param([Parameter(Mandatory)][AllowEmptyString()][string] $Reference)
|
|
83
|
+
|
|
84
|
+
$parts = @(($Reference -replace '\\', '/').Trim('/').Split('/') | Where-Object { $_ })
|
|
85
|
+
if ($parts.Count -eq 0) {
|
|
86
|
+
return ''
|
|
87
|
+
}
|
|
88
|
+
if ($parts[-1] -in @('epic.md', 'epic-kickoff.md') -and $parts.Count -ge 2) {
|
|
89
|
+
return [string]$parts[-2]
|
|
90
|
+
}
|
|
91
|
+
return [string]$parts[-1]
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function Get-LowerSha256 {
|
|
95
|
+
[CmdletBinding()]
|
|
96
|
+
[OutputType([string])]
|
|
97
|
+
param([Parameter(Mandatory)][AllowEmptyString()][string] $Text)
|
|
98
|
+
|
|
99
|
+
$bytes = [System.Text.Encoding]::UTF8.GetBytes($Text)
|
|
100
|
+
return [Convert]::ToHexString([System.Security.Cryptography.SHA256]::HashData($bytes)).ToLowerInvariant()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function Get-RootEpicReceiptFileName {
|
|
104
|
+
[CmdletBinding()]
|
|
105
|
+
[OutputType([string])]
|
|
106
|
+
param([Parameter(Mandatory)][string] $TurnId)
|
|
107
|
+
|
|
108
|
+
$safeTurnId = $TurnId -replace '[^A-Za-z0-9._-]', '_'
|
|
109
|
+
return "epic-root-invocation.$safeTurnId.json"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function Get-RootEpicInvocationReceipt {
|
|
113
|
+
[CmdletBinding()]
|
|
114
|
+
[OutputType([System.Collections.Specialized.OrderedDictionary])]
|
|
115
|
+
param(
|
|
116
|
+
[Parameter(Mandatory)] $Payload,
|
|
117
|
+
[Parameter(Mandatory)][datetimeoffset] $Now,
|
|
118
|
+
[Parameter(Mandatory)][string] $RepositoryRoot,
|
|
119
|
+
[Parameter(Mandatory)][string] $HeadSha
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
$prompt = [string]$Payload.prompt
|
|
123
|
+
$persona = Get-RootEpicRequestedPersona -Prompt $prompt
|
|
124
|
+
if (-not $persona) {
|
|
125
|
+
return $null
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
$turnId = [string]$Payload.turn_id
|
|
129
|
+
$sessionId = [string]$Payload.session_id
|
|
130
|
+
if ([string]::IsNullOrWhiteSpace($turnId) -or [string]::IsNullOrWhiteSpace($sessionId)) {
|
|
131
|
+
throw 'EPIC_INVOCATION_ORIGIN_BLOCKED: an epic root invocation requires session_id and turn_id.'
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
$reference = Get-RootEpicReference -Prompt $prompt
|
|
135
|
+
$entryKind = Get-RootEpicEntryKind -Prompt $prompt
|
|
136
|
+
$kickoffPath = ''
|
|
137
|
+
if ($persona -eq 'epic-orchestrator' -and $entryKind -eq 'epic-run') {
|
|
138
|
+
$slug = Get-RootEpicSlug -Reference $reference
|
|
139
|
+
if ($slug) {
|
|
140
|
+
$kickoffPath = "docs/features/epics/$slug/epic-kickoff.md"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return [ordered]@{
|
|
145
|
+
schema_version = 1
|
|
146
|
+
repository_root = Get-CodexCanonicalAuthorityPath -Path $RepositoryRoot
|
|
147
|
+
repository_sha256 = Get-CodexAuthorityRepositoryKey -RepositoryRoot $RepositoryRoot
|
|
148
|
+
repository_head_sha = $HeadSha
|
|
149
|
+
session_id = $sessionId
|
|
150
|
+
turn_id = $turnId
|
|
151
|
+
prompt_sha256 = Get-LowerSha256 -Text $prompt
|
|
152
|
+
requested_persona = $persona
|
|
153
|
+
entry_kind = $entryKind
|
|
154
|
+
epic_reference = $reference
|
|
155
|
+
kickoff_path = $kickoffPath
|
|
156
|
+
created_at = $Now.ToUniversalTime().ToString('o')
|
|
157
|
+
expires_at = $Now.AddMinutes($script:ReceiptLifetimeMinutes).ToUniversalTime().ToString('o')
|
|
158
|
+
consumed = $false
|
|
159
|
+
consumed_by = $null
|
|
160
|
+
consumed_at = $null
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function Write-RootEpicInvocationReceipt {
|
|
165
|
+
[CmdletBinding()]
|
|
166
|
+
param(
|
|
167
|
+
[Parameter(Mandatory)][string] $RepositoryRoot,
|
|
168
|
+
[Parameter(Mandatory)][System.Collections.IDictionary] $Receipt
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
$directory = Get-CodexAuthorityStateRoot `
|
|
172
|
+
-RepositoryRoot $RepositoryRoot `
|
|
173
|
+
-SessionId ([string]$Receipt.session_id)
|
|
174
|
+
[System.IO.Directory]::CreateDirectory($directory) | Out-Null
|
|
175
|
+
$path = Get-CodexAuthorityReceiptPath `
|
|
176
|
+
-RepositoryRoot $RepositoryRoot `
|
|
177
|
+
-SessionId ([string]$Receipt.session_id) `
|
|
178
|
+
-TurnId ([string]$Receipt.turn_id)
|
|
179
|
+
$json = $Receipt | ConvertTo-Json -Depth 8
|
|
180
|
+
$stream = [System.IO.File]::Open(
|
|
181
|
+
$path,
|
|
182
|
+
[System.IO.FileMode]::CreateNew,
|
|
183
|
+
[System.IO.FileAccess]::Write,
|
|
184
|
+
[System.IO.FileShare]::None
|
|
185
|
+
)
|
|
186
|
+
try {
|
|
187
|
+
$writer = [System.IO.StreamWriter]::new(
|
|
188
|
+
$stream,
|
|
189
|
+
[System.Text.UTF8Encoding]::new($false)
|
|
190
|
+
)
|
|
191
|
+
try {
|
|
192
|
+
$writer.Write($json)
|
|
193
|
+
$writer.Flush()
|
|
194
|
+
} finally {
|
|
195
|
+
$writer.Dispose()
|
|
196
|
+
}
|
|
197
|
+
} finally {
|
|
198
|
+
$stream.Dispose()
|
|
199
|
+
}
|
|
200
|
+
return $path
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if ($MyInvocation.InvocationName -eq '.') {
|
|
204
|
+
return
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
$payload = ConvertFrom-RootEpicHookPayload -PayloadRaw ([Console]::In.ReadToEnd())
|
|
209
|
+
if (-not (Get-RootEpicRequestedPersona -Prompt ([string]$payload.prompt))) {
|
|
210
|
+
exit 0
|
|
211
|
+
}
|
|
212
|
+
$repositoryRoot = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
|
213
|
+
$headSha = [string](& git -C $repositoryRoot rev-parse HEAD 2>$null)
|
|
214
|
+
if ($LASTEXITCODE -ne 0 -or $headSha -notmatch '^[0-9a-fA-F]{40,64}$') {
|
|
215
|
+
throw 'EPIC_INVOCATION_ORIGIN_BLOCKED: repository HEAD could not be resolved.'
|
|
216
|
+
}
|
|
217
|
+
$receipt = Get-RootEpicInvocationReceipt `
|
|
218
|
+
-Payload $payload `
|
|
219
|
+
-Now ([datetimeoffset]::UtcNow) `
|
|
220
|
+
-RepositoryRoot $repositoryRoot `
|
|
221
|
+
-HeadSha $headSha
|
|
222
|
+
if ($null -eq $receipt) {
|
|
223
|
+
exit 0
|
|
224
|
+
}
|
|
225
|
+
$receiptPath = Write-RootEpicInvocationReceipt -RepositoryRoot $repositoryRoot -Receipt $receipt
|
|
226
|
+
[ordered]@{
|
|
227
|
+
hookSpecificOutput = [ordered]@{
|
|
228
|
+
hookEventName = 'UserPromptSubmit'
|
|
229
|
+
additionalContext = "Root epic invocation authorized for $($receipt.requested_persona); receipt: $receiptPath"
|
|
230
|
+
}
|
|
231
|
+
} | ConvertTo-Json -Compress -Depth 5 | Write-Output
|
|
232
|
+
exit 0
|
|
233
|
+
} catch {
|
|
234
|
+
[Console]::Error.WriteLine([string]$_)
|
|
235
|
+
exit 2
|
|
236
|
+
}
|