@danmoisan/drm-copilot-mcp 0.0.1 → 0.0.5
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 +5 -1
- package/package.json +21 -5
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/MEMORY.md +15 -3
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_branch_base_check_unmerged_pr_deps.md +16 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_every_change_through_lifecycle.md +15 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_policy_compliance_not_optional.md +18 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_potential_to_issue_creates_github_issue.md +13 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_remediation_plan_em_dash_required.md +13 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_small_bug_uses_minor_audit.md +13 -0
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_test_files_count_against_500_cap.md +13 -0
- package/resources/claude-customizations/.claude/agents/atomic-executor.md +7 -7
- package/resources/claude-customizations/.claude/agents/csharp-typed-engineer.md +4 -5
- package/resources/claude-customizations/.claude/agents/feature-review.md +7 -3
- package/resources/claude-customizations/.claude/agents/orchestrator.md +16 -1
- package/resources/claude-customizations/.claude/agents/powershell-typed-engineer.md +1 -1
- package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +245 -0
- package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +273 -0
- package/resources/claude-customizations/.claude/hooks/enforce-feature-folder-order.ps1 +148 -0
- package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +190 -0
- package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +216 -0
- package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +84 -15
- package/resources/claude-customizations/.claude/hooks/validate-executor-output.ps1 +1 -1
- package/resources/claude-customizations/.claude/hooks/validate-feature-review-coverage.ps1 +75 -5
- package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +93 -0
- package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +68 -0
- package/resources/claude-customizations/.claude/rules/architecture-boundaries.md +46 -0
- package/resources/claude-customizations/.claude/rules/benchmark-baselines.md +35 -0
- package/resources/claude-customizations/.claude/rules/ci-workflows.md +36 -0
- package/resources/claude-customizations/.claude/rules/csharp.md +62 -16
- package/resources/claude-customizations/.claude/rules/general-code-change.md +12 -3
- package/resources/claude-customizations/.claude/rules/general-unit-test.md +47 -2
- package/resources/claude-customizations/.claude/rules/orchestrator-state.md +39 -0
- package/resources/claude-customizations/.claude/rules/powershell.md +5 -5
- package/resources/claude-customizations/.claude/rules/python.md +4 -3
- package/resources/claude-customizations/.claude/rules/quality-tiers.md +51 -0
- package/resources/claude-customizations/.claude/rules/typescript.md +37 -8
- package/resources/claude-customizations/.claude/settings.json +37 -12
- package/resources/claude-customizations/.claude/skills/atomic-plan-contract/SKILL.md +2 -2
- package/resources/claude-customizations/.claude/skills/csharp-qa-gate/SKILL.md +25 -10
- package/resources/claude-customizations/.claude/skills/execute-hard-lock/SKILL.md +6 -6
- package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +8 -8
- package/resources/claude-customizations/.claude/skills/feature-review-workflow/SKILL.md +17 -6
- package/resources/claude-customizations/.claude/skills/human-exception-runbook/SKILL.md +52 -0
- package/resources/claude-customizations/.claude/skills/human-exception-runbook/example.runbook.md +36 -0
- package/resources/claude-customizations/.claude/skills/invoke-csharp-engineer/SKILL.md +4 -4
- package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +96 -3
- package/resources/claude-customizations/.claude/skills/policy-audit-template-usage/SKILL.md +3 -3
- package/resources/claude-customizations/.claude/skills/powershell-qa-gate/SKILL.md +4 -4
- package/resources/claude-customizations/.claude/skills/pr-base-branch-merge-base/SKILL.md +3 -3
- package/resources/claude-customizations/.claude/skills/python-qa-gate/SKILL.md +1 -1
- package/resources/claude-customizations/.claude/skills/remediation-handoff-atomic-planner/SKILL.md +90 -17
- package/resources/claude-dir-customizations/.mcp.json +3 -3
- package/resources/codex-and-agents-customizations/.agents/README.md +1 -1
- package/resources/codex-and-agents-customizations/.agents/skills/acceptance-criteria-tracking/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/architecture-boundaries/SKILL.md +52 -0
- package/resources/codex-and-agents-customizations/.agents/skills/atomic-plan-contract/SKILL.md +16 -8
- package/resources/codex-and-agents-customizations/.agents/skills/benchmark-baselines/SKILL.md +44 -0
- package/resources/codex-and-agents-customizations/.agents/skills/ci-workflows/SKILL.md +45 -0
- package/resources/codex-and-agents-customizations/.agents/skills/commit-message/SKILL.md +3 -11
- package/resources/codex-and-agents-customizations/.agents/skills/csharp/SKILL.md +1 -5
- package/resources/codex-and-agents-customizations/.agents/skills/csharp-change-budget-router/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/csharp-orchestration-state-machine/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/csharp-qa-gate/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/evidence-and-timestamp-conventions/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/execute-hard-lock/SKILL.md +8 -17
- package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +13 -14
- package/resources/codex-and-agents-customizations/.agents/skills/feature-review-workflow/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/fill-feature-docs/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +86 -0
- package/resources/codex-and-agents-customizations/.agents/skills/general-unit-test/SKILL.md +111 -0
- package/resources/codex-and-agents-customizations/.agents/skills/human-exception-runbook/SKILL.md +57 -0
- package/resources/codex-and-agents-customizations/.agents/skills/human-exception-runbook/example.runbook.md +36 -0
- package/resources/codex-and-agents-customizations/.agents/skills/invoke-csharp-engineer/SKILL.md +0 -9
- package/resources/codex-and-agents-customizations/.agents/skills/invoke-powershell-engineer/SKILL.md +0 -9
- package/resources/codex-and-agents-customizations/.agents/skills/invoke-python-engineer/SKILL.md +0 -9
- package/resources/codex-and-agents-customizations/.agents/skills/make-skill-template/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +93 -8
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-state/SKILL.md +48 -0
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +61 -2
- package/resources/codex-and-agents-customizations/.agents/skills/policy-audit-template-usage/SKILL.md +3 -8
- package/resources/codex-and-agents-customizations/.agents/skills/policy-compliance-order/SKILL.md +0 -10
- package/resources/codex-and-agents-customizations/.agents/skills/powershell/SKILL.md +4 -8
- package/resources/codex-and-agents-customizations/.agents/skills/powershell-change-budget-router/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/powershell-orchestration-state-machine/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/powershell-qa-gate/SKILL.md +3 -9
- package/resources/codex-and-agents-customizations/.agents/skills/pr-author/SKILL.md +1 -9
- package/resources/codex-and-agents-customizations/.agents/skills/pr-base-branch-merge-base/SKILL.md +4 -9
- package/resources/codex-and-agents-customizations/.agents/skills/pr-context-artifacts/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/python/SKILL.md +1 -5
- package/resources/codex-and-agents-customizations/.agents/skills/python-change-budget-router/SKILL.md +1 -6
- package/resources/codex-and-agents-customizations/.agents/skills/python-qa-gate/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/python-suppressions/SKILL.md +2 -6
- package/resources/codex-and-agents-customizations/.agents/skills/quality-tiers/SKILL.md +57 -0
- package/resources/codex-and-agents-customizations/.agents/skills/remediation-handoff-atomic-planner/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/SKILL.md +91 -72
- package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/agents/openai.yaml +1 -1
- package/resources/codex-and-agents-customizations/.agents/skills/research-issue/SKILL.md +0 -10
- package/resources/codex-and-agents-customizations/.agents/skills/review-epic/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/review-feature/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/review-staged/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/self-explanatory-code-commenting/SKILL.md +2 -6
- package/resources/codex-and-agents-customizations/.agents/skills/skill-canonical-location-audit/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.agents/skills/tonality/SKILL.md +86 -0
- package/resources/codex-and-agents-customizations/.agents/skills/translate-claude-to-codex/SKILL.md +297 -0
- package/resources/codex-and-agents-customizations/.agents/skills/translate-copilot-to-claude/SKILL.md +0 -22
- package/resources/codex-and-agents-customizations/.agents/skills/typescript/SKILL.md +1 -5
- package/resources/codex-and-agents-customizations/.agents/skills/typescript-suppressions/SKILL.md +2 -6
- package/resources/codex-and-agents-customizations/.agents/skills/update-status/SKILL.md +0 -5
- package/resources/codex-and-agents-customizations/.codex/agents/atomic-executor.toml +5 -5
- package/resources/codex-and-agents-customizations/.codex/agents/orchestrator.toml +91 -63
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-atomic-executor.toml +1 -1
- package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer.toml +1 -1
- package/resources/codex-and-agents-customizations/.codex/config.toml +51 -136
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +1 -1
- package/resources/codex-and-agents-customizations/.codex/prompts/orchestrate-work.md +4 -3
- package/resources/codex-and-agents-customizations/.codex/scripts/post-codex-worktree-session.ps1 +5 -0
- package/resources/codex-and-agents-customizations/.github/workflows/_validate-orchestrator-state.yml +68 -0
- package/resources/codex-and-agents-customizations/.github/workflows/validate-orchestrator-state.yml +15 -0
- package/resources/config/orchestration-routing.json +84 -0
- package/resources/customizations/.github/agents/Powershell DI Unit Test Engineer.agent.md +1 -1
- package/resources/customizations/.github/agents/atomic_executor.agent.md +1 -1
- package/resources/customizations/.github/agents/atomic_planning.agent.md +10 -10
- package/resources/customizations/.github/agents/csharp-orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/feature-review.agent.md +2 -2
- package/resources/customizations/.github/agents/orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/powershell-atomic-executor.agent.md +4 -4
- package/resources/customizations/.github/agents/powershell-atomic-planning.agent.md +10 -10
- package/resources/customizations/.github/agents/powershell-orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/powershell-typed-engineer.agent.md +2 -2
- package/resources/customizations/.github/agents/python-orchestrator.agent.md +6 -2
- package/resources/customizations/.github/agents/staged-review.agent.md +1 -1
- package/resources/customizations/.github/instructions/powershell-code-change.instructions.md +6 -6
- package/resources/customizations/.github/prompts/generate-commit-message-repo.prompt.md +1 -1
- package/resources/customizations/.github/prompts/orchestrate-csharp-work.prompt.md +5 -3
- package/resources/customizations/.github/prompts/orchestrate-work.prompt.md +5 -3
- package/resources/customizations/.github/skills/atomic-plan-contract/SKILL.md +14 -1
- package/resources/customizations/.github/skills/feature-promotion-lifecycle/SKILL.md +11 -7
- package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +10 -1
- package/resources/customizations/.github/skills/pr-base-branch-merge-base/SKILL.md +2 -2
- package/resources/customizations/.github/skills/remediation-handoff-atomic-planner/SKILL.md +5 -0
- package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +7 -0
- package/resources/scripts/dev_tools/_orchestrator_state_human_interaction.py +127 -0
- package/resources/scripts/dev_tools/_orchestrator_state_routing.py +216 -0
- package/resources/scripts/dev_tools/push_down_claude_customizations.py +191 -5
- package/resources/scripts/dev_tools/validate_orchestration_artifacts.py +103 -411
- package/resources/scripts/dev_tools/validate_orchestration_review_artifacts.py +107 -0
- package/resources/scripts/dev_tools/validate_orchestrator_state.py +428 -0
- package/resources/scripts/dev_tools/validate_policy_audit_artifact.py +448 -0
- package/resources/templates/push_down_claude_customizations.py +227 -6
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_repo_root_is_source_of_truth.md +0 -11
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_vsce_verify_package_location.md +0 -19
- package/resources/claude-customizations/.claude/agent-memory/orchestrator/project_extension_location.md +0 -11
- package/resources/claude-customizations/.claude/agent-memory/prd-feature/MEMORY.md +0 -1
- package/resources/claude-customizations/.claude/agent-memory/prd-feature/project_push_down_pattern.md +0 -13
- package/resources/claude-customizations/.claude/agent-memory/task-researcher/MEMORY.md +0 -3
- package/resources/claude-customizations/.claude/agent-memory/task-researcher/project_push_down_claude_dir.md +0 -11
package/out/mcp-server.js
CHANGED
|
@@ -7,7 +7,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
-
|
|
10
|
+
try {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
throw mod = 0, e;
|
|
14
|
+
}
|
|
11
15
|
};
|
|
12
16
|
var __export = (target, all) => {
|
|
13
17
|
for (var name in all)
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danmoisan/drm-copilot-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Stdio MCP server exposing drm-copilot repo-automation tools.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|
|
8
|
-
"drm-copilot-mcp": "
|
|
8
|
+
"drm-copilot-mcp": "out/mcp-server.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"out/mcp-server.js",
|
|
@@ -16,17 +16,33 @@
|
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/drmoisan/drm-copilot.git",
|
|
19
|
+
"url": "git+https://github.com/drmoisan/drm-copilot.git",
|
|
20
20
|
"directory": "packages/mcp-server"
|
|
21
21
|
},
|
|
22
|
-
"bugs": {
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/drmoisan/drm-copilot/issues"
|
|
24
|
+
},
|
|
23
25
|
"homepage": "https://github.com/drmoisan/drm-copilot#readme",
|
|
24
|
-
"keywords": [
|
|
26
|
+
"keywords": [
|
|
27
|
+
"mcp",
|
|
28
|
+
"copilot",
|
|
29
|
+
"claude",
|
|
30
|
+
"codex",
|
|
31
|
+
"automation",
|
|
32
|
+
"workflow",
|
|
33
|
+
"stdio"
|
|
34
|
+
],
|
|
25
35
|
"author": "Dan Moisan",
|
|
26
36
|
"scripts": {
|
|
27
37
|
"build": "node esbuild-mcp-server.cjs",
|
|
28
38
|
"prepack": "node -e \"const{cpSync}=require('fs');cpSync('../../extensions/drm-copilot/resources','./resources',{recursive:true,force:true})\""
|
|
29
39
|
},
|
|
40
|
+
"overrides": {
|
|
41
|
+
"fast-uri": "^3.1.2",
|
|
42
|
+
"hono": "^4.12.25",
|
|
43
|
+
"ip-address": "^10.2.0",
|
|
44
|
+
"qs": "^6.15.2"
|
|
45
|
+
},
|
|
30
46
|
"devDependencies": {
|
|
31
47
|
"esbuild": "^0.28.0"
|
|
32
48
|
},
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
---
|
|
2
|
+
name: orchestrator-memory-index
|
|
3
|
+
description: Index of orchestrator agent memories.
|
|
4
|
+
metadata:
|
|
5
|
+
type: index
|
|
6
|
+
scope: repo
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
- [Policy requirements are not optional gaps](feedback_policy_compliance_not_optional.md) — never frame skipped policy requirements as "known gaps" or defer them; comply before reporting completion.
|
|
10
|
+
- [test-files-count-against-500-cap](feedback_test_files_count_against_500_cap.md) — the 500-line file cap applies to test files too; QA must scan changed/created production AND test files.
|
|
11
|
+
- [every-change-through-lifecycle](feedback_every_change_through_lifecycle.md) — every change, including small tooling changes, goes through issue promotion, an active feature folder, and feature-review before commit.
|
|
12
|
+
- [remediation-plan-em-dash-required](feedback_remediation_plan_em_dash_required.md) — the plan validator rejects any token between "Phase N" and the em-dash; only `### Phase N — <Title>` passes.
|
|
13
|
+
- [branch-base-check-unmerged-pr-deps](feedback_branch_base_check_unmerged_pr_deps.md) — verify required symbols/files exist on the chosen branch base; if they only exist in an open PR, stack or merge first.
|
|
14
|
+
- [potential-to-issue-creates-github-issue](feedback_potential_to_issue_creates_github_issue.md) — potential-to-issue creates the GitHub issue as a side effect; do not also run gh issue create.
|
|
15
|
+
- [small-bug-uses-minor-audit](feedback_small_bug_uses_minor_audit.md) — a ~1-3 production-file bug fix uses the small path with Work Mode minor-audit, not full-bug.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: branch-base-check-unmerged-pr-deps
|
|
3
|
+
description: Before choosing a branch base, verify the plan's required symbols and files exist on that base; if they only exist in an open PR, stack on it or merge it first.
|
|
4
|
+
metadata:
|
|
5
|
+
type: feedback
|
|
6
|
+
scope: general
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Before choosing a branch base for a new feature, verify that the symbols and files the plan relies on exist on that base. If they only exist in an open PR, either (a) base on that PR's branch (stack), or (b) recommend merging it first.
|
|
10
|
+
|
|
11
|
+
Check existence with: `git cat-file -e origin/main:<file>`
|
|
12
|
+
Check file overlap with: `git diff --name-only origin/main...<branch>`
|
|
13
|
+
|
|
14
|
+
**Why:** Branching off the default branch when a required symbol only exists in an unmerged PR forces the implementation to use a fallback or stub, which the reviewer will catch.
|
|
15
|
+
|
|
16
|
+
**How to apply:** At orchestration start-up, when the plan references files or modules that appear to be part of a separate ongoing feature, run the cat-file check before setting the branch base in the orchestrator state.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: every-change-through-lifecycle
|
|
3
|
+
description: Every change, including small tooling changes, goes through issue promotion, an active feature folder, and feature-review before commit; evidence lives only under the active feature folder.
|
|
4
|
+
metadata:
|
|
5
|
+
type: feedback
|
|
6
|
+
scope: general
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Every change — including small tooling changes to hooks, skills, rules, or scripts — must go through the full orchestration lifecycle: open an issue (via MCP promotion), create the active feature folder, and pass feature-review before committing. "It's just a small change" is not an exemption.
|
|
10
|
+
|
|
11
|
+
Evidence may be written ONLY under the active feature folder at `docs/features/active/<date>-<short>-<issue>/evidence/<kind>/`. Any other location (including paths that are not in the forbidden list) is not approved.
|
|
12
|
+
|
|
13
|
+
**Why:** Bypassing the lifecycle produces changes with no feature folder, which causes engineers to place evidence in unapproved locations and creates review failures requiring full remediation.
|
|
14
|
+
|
|
15
|
+
**How to apply:** Before any implementation delegation, run promotion (new potential entry -> potential-to-issue -> new active feature folder). Pass the resulting feature folder's `evidence/<kind>/` path as the only permitted evidence sink.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Policy requirements are not optional gaps
|
|
3
|
+
description: Never frame skipped policy requirements as "known gaps" or defer them to user opt-in; comply before reporting completion.
|
|
4
|
+
type: feedback
|
|
5
|
+
metadata:
|
|
6
|
+
type: feedback
|
|
7
|
+
scope: general
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
When repository policy (`.claude/rules/*.md`, `.github/instructions/*.md`) requires something — tests, coverage, toolchain steps, file-size limits — completing the change without satisfying that requirement is a policy violation, not a "known gap" or "follow-up."
|
|
11
|
+
|
|
12
|
+
**Why:** The user explicitly rejected framing a missing Pester test as a "known gap" after a new PowerShell script was added. Per `.claude/rules/powershell.md` and `.claude/rules/general-unit-test.md`, new scripts require Pester tests and >=90% coverage. Treating that as optional or deferrable misrepresents the state of the work and pushes compliance burden onto the user.
|
|
13
|
+
|
|
14
|
+
**How to apply:**
|
|
15
|
+
- Before reporting any code change complete, verify every applicable policy requirement (toolchain steps, tests, coverage, file size, etc.) is satisfied in this same change set.
|
|
16
|
+
- Do not use phrases like "known gap," "follow-up," "if you want I can add tests," or "out of scope" to defer a policy requirement. Either complete the requirement, or stop and report the work as blocked with the specific policy citation.
|
|
17
|
+
- For PowerShell: new `.ps1` files require Pester tests covering positive, negative, and edge paths, with mocks at the wrapper-seam boundary; run format → analyze → Pester and confirm all pass before reporting completion.
|
|
18
|
+
- Asking the user whether to add required tests is not an acceptable substitute for adding them.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: potential-to-issue-creates-github-issue
|
|
3
|
+
description: The potential-to-issue MCP tool creates the GitHub issue as a side effect; do not also run gh issue create, which produces a duplicate.
|
|
4
|
+
metadata:
|
|
5
|
+
type: feedback
|
|
6
|
+
scope: general
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
The `potential_to_issue` MCP tool creates the GitHub issue as a side effect and returns a summary. The generated `issue.md` already carries the correct `Issue: #N` and `Issue URL` lines. Do NOT run `gh issue create` after `potential_to_issue` — it creates a duplicate issue.
|
|
10
|
+
|
|
11
|
+
**Why:** Running `gh issue create` after the MCP promotion step produces two issues for the same work item.
|
|
12
|
+
|
|
13
|
+
**How to apply:** After `potential_to_issue`, read the generated `issue.md` to get the assigned number. Pass that same number to the new-active-feature-folder step via the issue number. If the folder number and the tooling-created GitHub issue number disagree, align to the GitHub number.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remediation-plan-em-dash-required
|
|
3
|
+
description: The plan validator rejects any token between "Phase N" and the em-dash; only the canonical `### Phase N — <Title>` heading passes.
|
|
4
|
+
metadata:
|
|
5
|
+
type: feedback
|
|
6
|
+
scope: general
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
The plan validator (`validate_orchestration_artifacts` with `artifact_type: "plan"`) rejects any phase heading with tokens between "Phase N" and the em-dash. Only the canonical form `### Phase N — <Title>` passes. Parenthetical qualifiers like `(continued)` or `(part 2)` cause the validator to error with "phase heading must match ### Phase N — <Title>" followed by "task appears before a canonical phase heading".
|
|
10
|
+
|
|
11
|
+
**Why:** Encountered when a planner introduced `### Phase 1 (continued) — <Title>` to group tasks.
|
|
12
|
+
|
|
13
|
+
**How to apply:** Instruct the planner to use only canonical `### Phase N — <Title>` headings with no parenthetical qualifiers. Either fold task groups under a single phase title or use separate phase numbers. After the planner returns, always run the validator before delegating to executor preflight.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: small-bug-uses-minor-audit
|
|
3
|
+
description: A bug fix of roughly 1-3 production files uses the small path with Work Mode minor-audit, not full-bug; requirements and acceptance criteria live in issue.md.
|
|
4
|
+
metadata:
|
|
5
|
+
type: feedback
|
|
6
|
+
scope: general
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
A bug fix whose scope is roughly 1-3 production files must be delivered on the small path with Work Mode `minor-audit`, not `full-bug`. On the small path there is no `spec.md`; requirements (summary, repro, scope, test strategy, and acceptance criteria) live in `issue.md`. The feature-review agent in minor-audit mode reads the `## Acceptance Criteria` section of `issue.md` as the AC source.
|
|
10
|
+
|
|
11
|
+
**Why:** Using the full-bug path for a small change requires `spec.md`, adds unnecessary overhead, and risks marking a change done without on-disk audit artifacts.
|
|
12
|
+
|
|
13
|
+
**How to apply:** At change-budget routing, if a bug impacts only 1-3 production files, select small path + minor-audit. Confirm `issue.md` carries an explicit `## Acceptance Criteria` section before delegating to feature-review. Do not create `spec.md` for small-path bugs.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-files-count-against-500-cap
|
|
3
|
+
description: The 500-line file cap applies to test files as well as production files; QA phases must scan all changed/created production AND test files.
|
|
4
|
+
metadata:
|
|
5
|
+
type: feedback
|
|
6
|
+
scope: general
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
The `.claude/rules/general-code-change.md` 500-line file cap applies to test files as well as production files. Only throwaway scripts, raw text fixtures, and Markdown are exempt. When a plan adds substantial tests, Phase 0 baseline and final QA tasks must scan ALL changed/created test files (not only production files) and assert each is <= 500 lines.
|
|
10
|
+
|
|
11
|
+
**Why:** A plan that adds tests but only size-checks production files can create a remediation cycle when test files cross the cap — the only finding raised during feature-review.
|
|
12
|
+
|
|
13
|
+
**How to apply:** When briefing the planner for any change that adds tests, require the QA phase to include a line-count assertion across all changed/created production AND test files. If a test file would exceed the cap, split it into a sibling test module before reporting completion.
|
|
@@ -14,13 +14,13 @@ tools:
|
|
|
14
14
|
- "Bash(npx prettier *)"
|
|
15
15
|
- "Bash(npx eslint *)"
|
|
16
16
|
- "Bash(npx tsc *)"
|
|
17
|
-
- "Bash(npx
|
|
17
|
+
- "Bash(npx vitest *)"
|
|
18
18
|
- "Bash(pwsh *)"
|
|
19
19
|
- "Bash(git *)"
|
|
20
|
-
- "
|
|
21
|
-
- "
|
|
22
|
-
- "
|
|
23
|
-
- "
|
|
20
|
+
- "mcp__drm-copilot__run_poshqc_format"
|
|
21
|
+
- "mcp__drm-copilot__run_poshqc_analyze"
|
|
22
|
+
- "mcp__drm-copilot__run_poshqc_test"
|
|
23
|
+
- "mcp__drm-copilot__run_poshqc_analyze_autofix"
|
|
24
24
|
skills:
|
|
25
25
|
- policy-compliance-order
|
|
26
26
|
- atomic-plan-contract
|
|
@@ -75,8 +75,8 @@ For each task:
|
|
|
75
75
|
Use the scoped tool patterns for quality gates:
|
|
76
76
|
|
|
77
77
|
- **Python**: `poetry run black`, `poetry run ruff`, `poetry run pyright`, `poetry run pytest`
|
|
78
|
-
- **TypeScript**: `npx prettier`, `npx eslint`, `npx tsc`, `npx
|
|
79
|
-
- **PowerShell**: MCP server functions (`
|
|
78
|
+
- **TypeScript**: `npx prettier`, `npx eslint`, `npx tsc`, `npx vitest`
|
|
79
|
+
- **PowerShell**: MCP server functions (`mcp__drm-copilot__run_poshqc_format`, `mcp__drm-copilot__run_poshqc_analyze`, `mcp__drm-copilot__run_poshqc_test`, `mcp__drm-copilot__run_poshqc_analyze_autofix`)
|
|
80
80
|
- **Git**: `git diff`, `git status`, `git log`
|
|
81
81
|
|
|
82
82
|
Run toolchain in order: format, lint, type-check, test. Restart from step 1 if any step fails or changes files.
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: csharp-typed-engineer
|
|
3
|
-
description: Project-scoped worker that implements and verifies C# changes within typed repository boundaries. Applies the CSharpier -> .NET Analyzers -> Nullable Analysis ->
|
|
3
|
+
description: Project-scoped worker that implements and verifies C# changes within typed repository boundaries. Applies the CSharpier -> .NET Analyzers -> Nullable Analysis -> xUnit toolchain, the 1-3 production-file small-path budget, and zero-regression quality gates.
|
|
4
4
|
tools:
|
|
5
5
|
- Read
|
|
6
6
|
- Grep
|
|
7
7
|
- Glob
|
|
8
|
-
- "Bash(msbuild *)"
|
|
9
8
|
- "Bash(dotnet *)"
|
|
10
9
|
skills:
|
|
11
10
|
- policy-compliance-order
|
|
@@ -21,7 +20,7 @@ memory: project
|
|
|
21
20
|
|
|
22
21
|
# CSharp Typed Engineer Agent
|
|
23
22
|
|
|
24
|
-
Senior C# engineer specialized in small cohesive classes and modules, strong typing under nullable reference types, minimal DI seams, and deterministic
|
|
23
|
+
Senior C# engineer specialized in small cohesive classes and modules, strong typing under nullable reference types, minimal DI seams, and deterministic xUnit coverage. Implement C# changes within the approved scope, preserve typed boundaries, and verify results with the repository C# toolchain (`dotnet build`, `dotnet test`).
|
|
25
24
|
|
|
26
25
|
## Standing Rules
|
|
27
26
|
|
|
@@ -33,8 +32,8 @@ Follow the phased workflow defined by the preloaded skills:
|
|
|
33
32
|
|
|
34
33
|
1. **Policy compliance** — apply `policy-compliance-order` to load mandatory repo policies before any change.
|
|
35
34
|
2. **Routing and scope** — apply `csharp-change-budget-router` to estimate scope, select direct vs orchestrator handoff mode, and enforce the 3 production + 3 test per-batch cap.
|
|
36
|
-
3. **Plan and baseline** — apply `atomic-plan-contract` for Phase 0 baseline capture and atomic plan structure. Delegate plan authoring to `atomic_planner` when no plan is supplied. Plans must include the proposed class and module structure, minimal DI seams,
|
|
37
|
-
4. **Implement in batches** — apply the approved plan. After each batch, run targeted analyzer and nullable
|
|
35
|
+
3. **Plan and baseline** — apply `atomic-plan-contract` for Phase 0 baseline capture and atomic plan structure. Delegate plan authoring to `atomic_planner` when no plan is supplied. Plans must include the proposed class and module structure, minimal DI seams, xUnit scenario-level test strategy, and NSubstitute mock strategy.
|
|
36
|
+
4. **Implement in batches** — apply the approved plan. After each batch, run targeted `dotnet build` analyzer and nullable checks on touched projects plus targeted xUnit tests, and confirm per-file coverage.
|
|
38
37
|
5. **Final QA gate** — apply `csharp-qa-gate` to run the full toolchain, enforce zero-regression deltas against the baseline, and produce the required reporting block before declaring completion.
|
|
39
38
|
6. **Evidence and handoff** — store baseline and post-change evidence per `evidence-and-timestamp-conventions`. Trigger remediation via `remediation-handoff-atomic-planner` when deltas fail.
|
|
40
39
|
|
|
@@ -106,9 +106,13 @@ Coverage metrics are mandatory for every language that has changed files in the
|
|
|
106
106
|
|
|
107
107
|
### Coverage Thresholds
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
- **
|
|
109
|
+
Coverage thresholds follow the uniform tier rule (Authoritative Decision #2) defined in `.claude/rules/quality-tiers.md`:
|
|
110
|
+
|
|
111
|
+
- **New code files** (files added in this feature, not previously existing): line coverage >= 85%, branch coverage >= 75%.
|
|
112
|
+
- **Modified files** (files that existed before and were changed): line coverage >= 85%, branch coverage >= 75%, and no regression on changed lines relative to baseline.
|
|
113
|
+
- **Repo-wide per language**: line coverage >= 85%, branch coverage >= 75%.
|
|
114
|
+
|
|
115
|
+
Tier-specific lower thresholds are not used.
|
|
112
116
|
|
|
113
117
|
### Verification Procedure
|
|
114
118
|
|
|
@@ -6,11 +6,26 @@ tools:
|
|
|
6
6
|
- Read
|
|
7
7
|
- Grep
|
|
8
8
|
- Glob
|
|
9
|
+
- Write
|
|
10
|
+
- Edit
|
|
9
11
|
- "Bash(git *)"
|
|
10
12
|
- "Bash(poetry run *)"
|
|
11
13
|
- "Bash(npx *)"
|
|
12
14
|
- "Bash(pwsh *)"
|
|
13
|
-
- "
|
|
15
|
+
- "Bash(gh *)"
|
|
16
|
+
- "mcp__drm-copilot__run_poshqc_format"
|
|
17
|
+
- "mcp__drm-copilot__run_poshqc_analyze"
|
|
18
|
+
- "mcp__drm-copilot__run_poshqc_analyze_autofix"
|
|
19
|
+
- "mcp__drm-copilot__run_poshqc_test"
|
|
20
|
+
- "mcp__drm-copilot__resolve_execute_hard_lock_prompt"
|
|
21
|
+
- "mcp__drm-copilot__resolve_atomic_plan_prompt"
|
|
22
|
+
- "mcp__drm-copilot__collect_pr_context"
|
|
23
|
+
- "mcp__drm-copilot__new_potential_entry"
|
|
24
|
+
- "mcp__drm-copilot__new_potential_bug_entry"
|
|
25
|
+
- "mcp__drm-copilot__potential_to_issue"
|
|
26
|
+
- "mcp__drm-copilot__new_active_feature_folder"
|
|
27
|
+
- "mcp__drm-copilot__validate_orchestration_artifacts"
|
|
28
|
+
- "mcp__drm-copilot__.*"
|
|
14
29
|
skills:
|
|
15
30
|
- policy-compliance-order
|
|
16
31
|
- feature-promotion-lifecycle
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<#
|
|
2
|
+
.SYNOPSIS
|
|
3
|
+
Pre-tool-use hook that blocks Write operations on the orchestrator checkpoint
|
|
4
|
+
file when completed_steps appear out of declared canonical order.
|
|
5
|
+
|
|
6
|
+
.DESCRIPTION
|
|
7
|
+
Invoked by the Claude Code PreToolUse hook on Write or Edit operations. The
|
|
8
|
+
hook activates only when the target file_path is
|
|
9
|
+
artifacts/orchestration/orchestrator-state.json.
|
|
10
|
+
|
|
11
|
+
For Write tool calls, the content field is parsed as JSON and its
|
|
12
|
+
completed_steps array is validated against the canonical orchestrator
|
|
13
|
+
workflow step prefixes:
|
|
14
|
+
|
|
15
|
+
S0_startup_checks
|
|
16
|
+
S1_change_budget_estimation
|
|
17
|
+
S2_research
|
|
18
|
+
S3_promotion
|
|
19
|
+
S4_atomic_planning
|
|
20
|
+
S5_atomic_execution
|
|
21
|
+
S6_pre_review_commit
|
|
22
|
+
S7_feature_review
|
|
23
|
+
S8_create_pr
|
|
24
|
+
S9_remediation_loop
|
|
25
|
+
S10_post_pr
|
|
26
|
+
S12_complete
|
|
27
|
+
|
|
28
|
+
Entries that do not match any canonical prefix are treated as informational
|
|
29
|
+
and ignored. If any pair (i, j) with i < j has a higher canonical index at
|
|
30
|
+
position i than at position j, the script blocks with a reason listing the
|
|
31
|
+
offending pair. A non-empty rollback_history array suppresses this check
|
|
32
|
+
because rollbacks legitimately reorder steps.
|
|
33
|
+
|
|
34
|
+
Edit tool calls supply only old_string/new_string (a partial patch) and
|
|
35
|
+
cannot be reliably validated without the full target file content, so they
|
|
36
|
+
are allowed by this hook. The next Write call will catch a regression.
|
|
37
|
+
|
|
38
|
+
.NOTES
|
|
39
|
+
Compatible with PowerShell 7+. Read-only validation gate.
|
|
40
|
+
#>
|
|
41
|
+
[CmdletBinding()]
|
|
42
|
+
param()
|
|
43
|
+
|
|
44
|
+
$script:CanonicalStepPrefixes = @(
|
|
45
|
+
'S0_startup_checks',
|
|
46
|
+
'S1_change_budget_estimation',
|
|
47
|
+
'S2_research',
|
|
48
|
+
'S3_promotion',
|
|
49
|
+
'S4_atomic_planning',
|
|
50
|
+
'S5_atomic_execution',
|
|
51
|
+
'S6_pre_review_commit',
|
|
52
|
+
'S7_feature_review',
|
|
53
|
+
'S8_create_pr',
|
|
54
|
+
'S9_remediation_loop',
|
|
55
|
+
'S10_post_pr',
|
|
56
|
+
'S12_complete'
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
function ConvertFrom-CheckpointJson {
|
|
60
|
+
<#
|
|
61
|
+
.SYNOPSIS
|
|
62
|
+
Wrapper around ConvertFrom-Json for the checkpoint content. Mockable.
|
|
63
|
+
#>
|
|
64
|
+
[CmdletBinding()]
|
|
65
|
+
param(
|
|
66
|
+
[Parameter(Mandatory)]
|
|
67
|
+
[string] $Json
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
return $Json | ConvertFrom-Json -ErrorAction Stop
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function Get-CanonicalStepIndex {
|
|
74
|
+
<#
|
|
75
|
+
.SYNOPSIS
|
|
76
|
+
Returns the canonical index for a completed_steps entry, or -1 when the
|
|
77
|
+
entry does not match any canonical prefix.
|
|
78
|
+
#>
|
|
79
|
+
[CmdletBinding()]
|
|
80
|
+
[OutputType([int])]
|
|
81
|
+
param(
|
|
82
|
+
[Parameter(Mandatory)]
|
|
83
|
+
[AllowEmptyString()]
|
|
84
|
+
[string] $StepEntry
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
for ($i = 0; $i -lt $script:CanonicalStepPrefixes.Count; $i++) {
|
|
88
|
+
$prefix = $script:CanonicalStepPrefixes[$i]
|
|
89
|
+
if ($StepEntry -eq $prefix -or $StepEntry.StartsWith("$prefix" + '_') -or $StepEntry.StartsWith("$prefix.") -or $StepEntry.StartsWith("$prefix-")) {
|
|
90
|
+
return $i
|
|
91
|
+
}
|
|
92
|
+
# The S3_promotion family of variants (S3_promotion_potential, S3_promotion_issue,
|
|
93
|
+
# S3_promotion_folder, etc.) is matched by the StartsWith branches above.
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return -1
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function Get-OutOfOrderPair {
|
|
100
|
+
<#
|
|
101
|
+
.SYNOPSIS
|
|
102
|
+
Returns the first pair (entry-at-i, entry-at-j, indices) where i<j but the
|
|
103
|
+
canonical index at i is greater than the canonical index at j. Non-canonical
|
|
104
|
+
entries (index -1) are skipped. Returns $null when in order.
|
|
105
|
+
#>
|
|
106
|
+
[CmdletBinding()]
|
|
107
|
+
param(
|
|
108
|
+
[Parameter(Mandatory)]
|
|
109
|
+
[AllowEmptyCollection()]
|
|
110
|
+
[string[]] $CompletedSteps
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
$indexed = @()
|
|
114
|
+
for ($i = 0; $i -lt $CompletedSteps.Count; $i++) {
|
|
115
|
+
$idx = Get-CanonicalStepIndex -StepEntry $CompletedSteps[$i]
|
|
116
|
+
if ($idx -ge 0) {
|
|
117
|
+
$indexed += [pscustomobject]@{ Position = $i; CanonicalIndex = $idx; Entry = $CompletedSteps[$i] }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
for ($a = 0; $a -lt $indexed.Count; $a++) {
|
|
122
|
+
for ($b = $a + 1; $b -lt $indexed.Count; $b++) {
|
|
123
|
+
if ($indexed[$a].CanonicalIndex -gt $indexed[$b].CanonicalIndex) {
|
|
124
|
+
return [pscustomobject]@{
|
|
125
|
+
EarlierEntry = $indexed[$a].Entry
|
|
126
|
+
EarlierPos = $indexed[$a].Position
|
|
127
|
+
LaterEntry = $indexed[$b].Entry
|
|
128
|
+
LaterPos = $indexed[$b].Position
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return $null
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function Test-IsCheckpointPath {
|
|
138
|
+
[CmdletBinding()]
|
|
139
|
+
[OutputType([bool])]
|
|
140
|
+
param(
|
|
141
|
+
[Parameter(Mandatory)]
|
|
142
|
+
[string] $NormalizedPath
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
return $NormalizedPath -match '(^|/)artifacts/orchestration/orchestrator-state\.json$'
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function Invoke-CheckpointMonotonicDecision {
|
|
149
|
+
<#
|
|
150
|
+
.SYNOPSIS
|
|
151
|
+
Parses CLAUDE_TOOL_INPUT and returns an allow-or-block decision.
|
|
152
|
+
#>
|
|
153
|
+
[CmdletBinding()]
|
|
154
|
+
[OutputType([System.Collections.Specialized.OrderedDictionary])]
|
|
155
|
+
param(
|
|
156
|
+
[string] $ToolInputRaw
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
if (-not $ToolInputRaw) {
|
|
160
|
+
return [ordered]@{ decision = 'allow' }
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
$toolInput = $ToolInputRaw | ConvertFrom-Json -ErrorAction Stop
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
throw "enforce-checkpoint-monotonic hook received malformed JSON in CLAUDE_TOOL_INPUT: $_"
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
$filePath = $toolInput.file_path
|
|
171
|
+
if (-not $filePath) {
|
|
172
|
+
return [ordered]@{ decision = 'allow' }
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
$normalized = $filePath -replace '\\', '/'
|
|
176
|
+
if (-not (Test-IsCheckpointPath -NormalizedPath $normalized)) {
|
|
177
|
+
return [ordered]@{ decision = 'allow' }
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
# Write tool: validate the content payload. Edit tool: partial new_string is
|
|
181
|
+
# not reliable without the full target file content, so allow.
|
|
182
|
+
$content = $toolInput.content
|
|
183
|
+
if (-not $content) {
|
|
184
|
+
return [ordered]@{ decision = 'allow' }
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
$payload = ConvertFrom-CheckpointJson -Json $content
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
# The content itself is not valid JSON. Let downstream tools surface the
|
|
192
|
+
# error rather than blocking with a misleading reason here.
|
|
193
|
+
return [ordered]@{ decision = 'allow' }
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (-not $payload.PSObject.Properties.Name -contains 'completed_steps') {
|
|
197
|
+
return [ordered]@{ decision = 'allow' }
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
$steps = @()
|
|
201
|
+
if ($payload.completed_steps) {
|
|
202
|
+
foreach ($s in $payload.completed_steps) {
|
|
203
|
+
$steps += [string]$s
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if ($steps.Count -lt 2) {
|
|
208
|
+
return [ordered]@{ decision = 'allow' }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
$rollbackHistory = $null
|
|
212
|
+
if ($payload.PSObject.Properties.Name -contains 'rollback_history') {
|
|
213
|
+
$rollbackHistory = $payload.rollback_history
|
|
214
|
+
}
|
|
215
|
+
if ($rollbackHistory -and @($rollbackHistory).Count -gt 0) {
|
|
216
|
+
return [ordered]@{ decision = 'allow' }
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
$pair = Get-OutOfOrderPair -CompletedSteps $steps
|
|
220
|
+
if ($null -eq $pair) {
|
|
221
|
+
return [ordered]@{ decision = 'allow' }
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return [ordered]@{
|
|
225
|
+
decision = 'block'
|
|
226
|
+
reason = "CHECKPOINT_ORDER_BLOCKED: completed_steps lists '$($pair.EarlierEntry)' at position $($pair.EarlierPos) before '$($pair.LaterEntry)' at position $($pair.LaterPos), but the canonical orchestrator workflow requires the later step to follow the earlier one. Reorder completed_steps or, if a rollback occurred, record it in rollback_history."
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
# Guard allows dot-sourcing in tests without executing the entrypoint.
|
|
231
|
+
if ($MyInvocation.InvocationName -eq '.') {
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
try {
|
|
236
|
+
$decision = Invoke-CheckpointMonotonicDecision -ToolInputRaw $env:CLAUDE_TOOL_INPUT
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
Write-Error $_
|
|
240
|
+
exit 1
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
$decision | ConvertTo-Json -Compress | Write-Output
|
|
244
|
+
|
|
245
|
+
exit 0
|