@danmoisan/drm-copilot-mcp 0.0.5 → 0.0.6
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 +93 -20
- package/package.json +1 -1
- package/resources/claude-customizations/.claude/agents/orchestrator.md +6 -2
- package/resources/claude-customizations/.claude/agents/pr-author.md +78 -0
- package/resources/claude-customizations/.claude/agents/task-researcher.md +10 -6
- package/resources/claude-customizations/.claude/hooks/enforce-checkpoint-monotonic.ps1 +68 -10
- package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +28 -1
- package/resources/claude-customizations/.claude/hooks/enforce-evidence-locations.ps1 +40 -14
- package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +210 -0
- package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +153 -10
- package/resources/claude-customizations/.claude/hooks/validate-pr-author-output.ps1 +136 -0
- package/resources/claude-customizations/.claude/hooks/validate-task-researcher-output.ps1 +22 -6
- package/resources/claude-customizations/.claude/settings.json +22 -0
- package/resources/claude-customizations/.claude/skills/evidence-and-timestamp-conventions/SKILL.md +0 -1
- package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +76 -2
- package/resources/claude-customizations/.claude/skills/research-issue/SKILL.md +5 -3
- package/resources/claude-customizations/.claude-variants/csharp-legacy/agents/csharp-typed-engineer.md +69 -0
- package/resources/claude-customizations/.claude-variants/csharp-legacy/rules/csharp.md +96 -0
- package/resources/claude-customizations/.claude-variants/csharp-legacy/skills/csharp-qa-gate/SKILL.md +77 -0
- package/resources/claude-customizations/.claude-variants/csharp-legacy/skills/invoke-csharp-engineer/SKILL.md +64 -0
- package/resources/claude-customizations/pack-manifests/core.json +65 -0
- package/resources/claude-customizations/pack-manifests/csharp-legacy.json +11 -0
- package/resources/claude-customizations/pack-manifests/csharp-modern.json +12 -0
- package/resources/claude-customizations/pack-manifests/powershell.json +14 -0
- package/resources/claude-customizations/pack-manifests/python.json +14 -0
- package/resources/claude-customizations/pack-manifests/typescript.json +9 -0
- package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +30 -13
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +113 -10
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-workflow/SKILL.md +33 -8
- package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/SKILL.md +12 -7
- package/resources/codex-and-agents-customizations/.codex/config.toml +65 -6
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-checkpoint-monotonic.ps1 +303 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-completion-consistency.ps1 +300 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +148 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-pr-author-skill.ps1 +336 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +83 -17
- package/resources/config/orchestration-routing.json +2 -10
- package/resources/customizations/.github/agents/pr-author.agent.md +25 -0
- package/resources/customizations/.github/agents/task-researcher.agent.md +4 -4
- package/resources/customizations/.github/prompts/fillout-prd-feature.prompt.md +1 -1
- package/resources/customizations/.github/prompts/research-issue.prompt.md +4 -3
- package/resources/scripts/dev_tools/push_down_claude_customizations.py +253 -224
- package/resources/scripts/dev_tools/push_down_claude_filesystem.py +472 -0
- package/resources/scripts/dev_tools/push_down_claude_pack_selection.py +401 -0
- package/resources/scripts/dev_tools/validate_orchestrator_state.py +106 -29
- package/resources/scripts/dev_tools/validate_policy_audit_artifact.py +24 -0
- package/resources/templates/push_down_claude_customizations.py +128 -304
|
@@ -61,17 +61,29 @@ After reading `artifacts/orchestration/orchestrator-state.json`, the main sessio
|
|
|
61
61
|
- `atomic-planner` — generates phased implementation plans
|
|
62
62
|
- `atomic-executor` — executes approved plans task-by-task
|
|
63
63
|
- `feature-review` — produces policy, code, and feature audit artifacts
|
|
64
|
-
- `task-researcher` — performs deep research and writes findings to `
|
|
64
|
+
- `task-researcher` — performs deep research and writes findings to the research path the orchestrator resolves before delegating: `docs/features/<feature>/research/` when an active `feature-folder` is in scope in `orchestrator-state.json`, otherwise `docs/research/` for one-off research. The orchestrator passes the resolved path in the delegation prompt.
|
|
65
65
|
|
|
66
66
|
The orchestrator does not perform deep implementation itself. It coordinates, tracks state, and enforces completion.
|
|
67
67
|
|
|
68
|
+
## PR Creation Delegation
|
|
69
|
+
|
|
70
|
+
PR creation and PR body edits are delegated work, not orchestrator work. The orchestrator MUST NOT call `gh pr create` or `gh pr edit --body*` directly from the main thread; the `enforce-pr-author-skill.ps1` PreToolUse hook blocks those commands unless a valid authorization sentinel issued by the `pr-author` agent is present.
|
|
71
|
+
|
|
72
|
+
The mandatory sequence is:
|
|
73
|
+
|
|
74
|
+
1. The orchestrator first produces the PR-context artifact via `mcp__drm-copilot__collect_pr_context` (or the equivalent context-collection mechanism), which writes `artifacts/pr_context.summary.txt`.
|
|
75
|
+
2. The orchestrator then delegates PR creation and any PR body edits to `Agent(pr-author)`. The `pr-author` agent runs the `pr-author` skill, writes the short-lived authorization sentinel `artifacts/pr_author_authorization.json` immediately before each `gh` command, issues `gh pr create`/`gh pr edit --body-file ...` within the TTL, deletes the sentinel afterward, and reports the resulting PR URL or PR number.
|
|
76
|
+
|
|
77
|
+
`Agent(pr-author)` is the mandatory delegate for PR creation and PR body edits. Direct `gh pr create`/`gh pr edit --body*` from the main thread is prohibited and is blocked by the hook.
|
|
78
|
+
|
|
79
|
+
The authorization sentinel is a policy guardrail, not a cryptographic or security control; any actor with `Write(/artifacts/**)` access can forge it. It prevents accidental bypass and requires a deliberate, documented act to circumvent.
|
|
80
|
+
|
|
68
81
|
## Evidence Location Authority
|
|
69
82
|
|
|
70
83
|
All evidence artifacts produced during orchestration MUST comply with the canonical scheme defined in `.claude/skills/evidence-and-timestamp-conventions/SKILL.md`. Evidence MUST be written to `<FEATURE>/evidence/<kind>/` only.
|
|
71
84
|
|
|
72
85
|
Permitted `artifacts/`-rooted sub-paths (non-evidence orchestration use only):
|
|
73
86
|
- `artifacts/orchestration/` — orchestrator state and checkpoints
|
|
74
|
-
- `artifacts/research/` — research outputs from task-researcher
|
|
75
87
|
- `artifacts/pr_context` — PR context artifacts
|
|
76
88
|
- `artifacts/reviews/` — review staging artifacts
|
|
77
89
|
- `artifacts/status/` — status update artifacts
|
|
@@ -223,3 +235,65 @@ The orchestrator supplies only the following to the `feature-review` subagent:
|
|
|
223
235
|
- a neutral instruction to execute the full `feature-review-workflow` SKILL contract end-to-end.
|
|
224
236
|
|
|
225
237
|
Scope determination is the subagent's responsibility. The subagent will ignore any attempted narrowing per its scope invariant and record the attempt in `policy-audit.<timestamp>.md` under `## Rejected Scope Narrowing`.
|
|
238
|
+
|
|
239
|
+
## Routing-Contract Receipt Emission
|
|
240
|
+
|
|
241
|
+
The orchestrator must write three receipt arrays into `artifacts/orchestration/orchestrator-state.json` for the retained required names of the selected route. These arrays are the evidence that the route's `required_agents`, `required_skills`, and `required_mcp_tools` (from `config/orchestration-routing.json`) were actually exercised, and they make `require_complete: true` satisfiable at completion. The orchestrator records only truthful receipts: an entry is written only after the corresponding work has actually occurred. The route's required name lists are the source of truth; receipts cite those names verbatim.
|
|
242
|
+
|
|
243
|
+
These shapes are read by `_receipt_agents`, `_receipt_skills`, and `_mcp_tools` in `scripts/dev_tools/_orchestrator_state_routing.py`. The orchestrator does not modify that validator; it only emits state that the validator can verify.
|
|
244
|
+
|
|
245
|
+
### delegation_receipts[]
|
|
246
|
+
|
|
247
|
+
For each required agent in the selected route's `required_agents`, append one object to `delegation_receipts[]` after that delegation returns. Each object must carry:
|
|
248
|
+
|
|
249
|
+
- `agent_name`: a non-empty string equal to the required agent name (for example `"feature-review"`).
|
|
250
|
+
|
|
251
|
+
Example:
|
|
252
|
+
|
|
253
|
+
```json
|
|
254
|
+
"delegation_receipts": [
|
|
255
|
+
{ "agent_name": "atomic-planner" },
|
|
256
|
+
{ "agent_name": "atomic-executor" },
|
|
257
|
+
{ "agent_name": "feature-review" }
|
|
258
|
+
]
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The validator collects each receipt whose `agent_name` is a non-empty string and requires every `required_agents` entry to be present.
|
|
262
|
+
|
|
263
|
+
### skill_receipts[]
|
|
264
|
+
|
|
265
|
+
For each required skill in the selected route's `required_skills`, append one object to `skill_receipts[]` after that required skill is read. Each entry must be an object with:
|
|
266
|
+
|
|
267
|
+
- `skill`: a non-empty string equal to a `required_skills` entry (for example `"orchestrate"`).
|
|
268
|
+
- `required`: the literal boolean `true`.
|
|
269
|
+
- `evidence`: a non-empty string, for example `"read:.claude/skills/orchestrate/SKILL.md"`.
|
|
270
|
+
|
|
271
|
+
Example:
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
"skill_receipts": [
|
|
275
|
+
{ "skill": "orchestrate", "required": true, "evidence": "read:.claude/skills/orchestrate/SKILL.md" }
|
|
276
|
+
]
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
The validator counts a skill as acknowledged only when `skill` is a non-empty string, `required` is exactly `true`, and `evidence` is a non-empty string. Every `required_skills` entry must have such a receipt.
|
|
280
|
+
|
|
281
|
+
### mcp_call_receipts[]
|
|
282
|
+
|
|
283
|
+
For each required MCP tool in the selected route's `required_mcp_tools`, append one object to `mcp_call_receipts[]` after each successful required MCP call. Each entry must be an object with:
|
|
284
|
+
|
|
285
|
+
- `tool`: a non-empty string equal to a `required_mcp_tools` entry (for example `"validate_orchestration_artifacts"`).
|
|
286
|
+
- `ok`: the literal boolean `true`.
|
|
287
|
+
- `evidence`: a non-empty string, such as the MCP response summary or an artifact path.
|
|
288
|
+
|
|
289
|
+
Example:
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
"mcp_call_receipts": [
|
|
293
|
+
{ "tool": "validate_orchestration_artifacts", "ok": true, "evidence": "plan validator exit 0" }
|
|
294
|
+
]
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The validator counts an MCP receipt as successful only when `tool` is a non-empty string, `ok` is exactly `true`, and `evidence` is a non-empty string. Every `required_mcp_tools` entry must have such a receipt.
|
|
298
|
+
|
|
299
|
+
These three receipt arrays, populated with the retained required names of the selected route, are what allow the routing-contract validation under `require_complete: true` to pass.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: research-issue
|
|
3
|
-
description: Investigate the best implementation approach for a feature or bug by analyzing the codebase and external references, then writing structured findings to
|
|
3
|
+
description: Investigate the best implementation approach for a feature or bug by analyzing the codebase and external references, then writing structured findings to the resolved research path under docs/features/<feature>/research/ (feature-associated) or docs/research/ (one-off).
|
|
4
4
|
allowed-tools:
|
|
5
5
|
- Read
|
|
6
6
|
- Grep
|
|
@@ -22,9 +22,11 @@ Accept one or more feature documents as context:
|
|
|
22
22
|
|
|
23
23
|
## Output
|
|
24
24
|
|
|
25
|
-
Create or update a single research file:
|
|
25
|
+
Create or update a single research file at one of the two tracked research roots:
|
|
26
26
|
|
|
27
|
-
-
|
|
27
|
+
- Feature-associated research: `docs/features/<feature>/research/<timestamp>-<short-name>-research.md` (for example `docs/features/active/<feature>/research/<timestamp>-<short-name>-research.md`).
|
|
28
|
+
- One-off research not tied to a feature: `docs/research/<timestamp>-<short-name>-research.md`.
|
|
29
|
+
- Routing rule: write to the feature research root when an active feature folder is in scope (the orchestrator supplies the resolved path from `feature-folder` in `orchestrator-state.json`); otherwise write to `docs/research/`. The filename convention `<timestamp>-<short-name>-research.md` is unchanged.
|
|
28
30
|
- Use the Task Researcher template from the repository exactly.
|
|
29
31
|
- Place rejected-alternatives summaries inside `## Recommended Approach`, not as a separate top-level header.
|
|
30
32
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
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 -> MSTest toolchain, the 1-3 production-file small-path budget, and zero-regression quality gates.
|
|
4
|
+
tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Grep
|
|
7
|
+
- Glob
|
|
8
|
+
- "Bash(msbuild *)"
|
|
9
|
+
- "Bash(dotnet *)"
|
|
10
|
+
skills:
|
|
11
|
+
- policy-compliance-order
|
|
12
|
+
- csharp-change-budget-router
|
|
13
|
+
- atomic-plan-contract
|
|
14
|
+
- csharp-qa-gate
|
|
15
|
+
- acceptance-criteria-tracking
|
|
16
|
+
- feature-promotion-lifecycle
|
|
17
|
+
- remediation-handoff-atomic-planner
|
|
18
|
+
- evidence-and-timestamp-conventions
|
|
19
|
+
memory: project
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# CSharp Typed Engineer Agent
|
|
23
|
+
|
|
24
|
+
Senior C# engineer specialized in small cohesive classes and modules, strong typing under nullable reference types, minimal DI seams, and deterministic MSTest coverage. Implement C# changes within the approved scope, preserve typed boundaries, and verify results with the repository C# toolchain.
|
|
25
|
+
|
|
26
|
+
## Standing Rules
|
|
27
|
+
|
|
28
|
+
Language standards and toolchain are defined in `.claude/rules/csharp.md` and `.claude/rules/general-code-change.md`, auto-loaded for `**/*.cs` and `**/*.csproj` edits. Tonality is defined in `.claude/rules/tonality.md` and `CLAUDE.md`.
|
|
29
|
+
|
|
30
|
+
## Workflow
|
|
31
|
+
|
|
32
|
+
Follow the phased workflow defined by the preloaded skills:
|
|
33
|
+
|
|
34
|
+
1. **Policy compliance** — apply `policy-compliance-order` to load mandatory repo policies before any change.
|
|
35
|
+
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, MSTest scenario-level test strategy, and Moq mock strategy.
|
|
37
|
+
4. **Implement in batches** — apply the approved plan. After each batch, run targeted analyzer and nullable builds on touched projects plus targeted MSTest, and confirm per-file coverage.
|
|
38
|
+
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
|
+
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
|
+
|
|
41
|
+
## Mode Marker Resolution
|
|
42
|
+
|
|
43
|
+
For feature-scoped work, resolve Work Mode from `issue.md` per `feature-promotion-lifecycle`:
|
|
44
|
+
|
|
45
|
+
- `- Work Mode: minor-audit`
|
|
46
|
+
- `- Work Mode: full-feature`
|
|
47
|
+
- `- Work Mode: full-bug`
|
|
48
|
+
- legacy `- Work Mode: full` -> interpret as `full-feature`.
|
|
49
|
+
|
|
50
|
+
If the marker is missing or malformed, fail closed to `full-feature`.
|
|
51
|
+
|
|
52
|
+
## Stop Conditions
|
|
53
|
+
|
|
54
|
+
Stop implementation and return to the user when:
|
|
55
|
+
|
|
56
|
+
- the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
|
|
57
|
+
- a file is near or would exceed the 500-line limit,
|
|
58
|
+
- any QA gate delta is non-zero after self-correction,
|
|
59
|
+
- the toolchain cannot be executed in the current environment (mark the change **unverified**),
|
|
60
|
+
- orchestrator handoff mode is requested but the required context package is incomplete,
|
|
61
|
+
- policy instructions conflict.
|
|
62
|
+
|
|
63
|
+
## Evidence Location Invariant
|
|
64
|
+
|
|
65
|
+
All evidence artifacts this agent produces (baselines, QA gates, regression results, coverage) MUST be written to `<FEATURE>/evidence/<kind>/` as defined in `.claude/skills/evidence-and-timestamp-conventions/SKILL.md`.
|
|
66
|
+
|
|
67
|
+
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.
|
|
68
|
+
|
|
69
|
+
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>`.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "**/*.cs"
|
|
4
|
+
- "**/*.csproj"
|
|
5
|
+
description: C#-specific toolchain and coding standards.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# C# Code Standards
|
|
9
|
+
|
|
10
|
+
This rule file summarizes the C#-specific policies for this repository.
|
|
11
|
+
|
|
12
|
+
## Toolchain
|
|
13
|
+
|
|
14
|
+
1. **Formatting — CSharpier**: All C# source files must be formatted with CSharpier. Do not use `dotnet format`. Command: `dotnet tool run csharpier .` or `csharpier .`
|
|
15
|
+
2. **Linting — .NET Analyzers**: C# code must pass Roslyn/.NET analyzer diagnostics. Command: `msbuild <solution>.sln /t:Build /p:Configuration=Debug /p:Platform="Any CPU" /p:EnableNETAnalyzers=true /p:EnforceCodeStyleInBuild=true`
|
|
16
|
+
3. **Type Checking — Nullable Analysis**: Enable nullable reference types and fail on warnings. Command: `msbuild <solution>.sln /t:Build /p:Configuration=Debug /p:Platform="Any CPU" /p:Nullable=enable /p:TreatWarningsAsErrors=true`
|
|
17
|
+
4. **Testing — MSTest + Moq + FluentAssertions**: Run tests with: `vstest.console.exe <test-assembly-paths> /EnableCodeCoverage`
|
|
18
|
+
|
|
19
|
+
Run the toolchain in order: format → lint → type-check → test. Restart from step 1 if any step fails or changes files.
|
|
20
|
+
|
|
21
|
+
## Coding Standards
|
|
22
|
+
|
|
23
|
+
- **Naming**: `PascalCase` for types and public members. `camelCase` for locals and private fields/parameters.
|
|
24
|
+
- **Null safety**: Keep nullable reference types enabled. Model optional values with nullable annotations and guard clauses.
|
|
25
|
+
- **Composition over inheritance**: Keep classes cohesive and scoped to one responsibility. Favor composition unless polymorphism is a clear requirement.
|
|
26
|
+
- **Async/await**: Use `async`/`await` for I/O-bound operations. Prefer `using`/`await using` for disposable resources.
|
|
27
|
+
- **Exceptions**: Fail fast with explicit exceptions. Avoid broad `catch (Exception)` unless at a defined boundary with added context.
|
|
28
|
+
- **Public surface**: Keep public API surface intentional and minimal. Prefer `internal` for non-public APIs.
|
|
29
|
+
- **XML docs**: Public APIs should include XML documentation comments when behavior or contract is non-obvious.
|
|
30
|
+
|
|
31
|
+
## Testing Standards
|
|
32
|
+
|
|
33
|
+
- Use **MSTest** (`Microsoft.VisualStudio.TestTools.UnitTesting`) as the test framework.
|
|
34
|
+
- Use **Moq** for mocking.
|
|
35
|
+
- Prefer **FluentAssertions** for assertions; use MSTest `Assert` only when FluentAssertions is not practical.
|
|
36
|
+
- Use `[TestClass]` and `[TestMethod]` attributes.
|
|
37
|
+
- Follow Arrange–Act–Assert structure.
|
|
38
|
+
- No external dependencies in unit tests.
|
|
39
|
+
- Repository-wide line coverage must remain >= 80%.
|
|
40
|
+
- Any new module, class, or method must reach >= 90% coverage.
|
|
41
|
+
- Coverage regression on changed lines is a blocking finding.
|
|
42
|
+
|
|
43
|
+
## Deterministic Test Rules
|
|
44
|
+
|
|
45
|
+
Unit tests must not depend on network, mutable machine PATH or profile state, implicit working-directory assumptions, or external services. Use seam-based mocking for all external boundaries (processes, HTTP, filesystem, clocks). Tests must produce identical results in the IDE test runner and in CLI runs so local and CI behavior agree.
|
|
46
|
+
|
|
47
|
+
## DI Seams
|
|
48
|
+
|
|
49
|
+
Introduce the smallest seam that enables reliable unit testing. Apply in this order of preference:
|
|
50
|
+
|
|
51
|
+
1. **Interface seam (preferred)** — extract boundary calls into narrow purpose-specific interfaces (for example, `IProcessRunner`, `IFileSystem`, `IClock`). Keep interfaces minimal.
|
|
52
|
+
2. **Injectable delegate seam** — use a narrow `Func<>`/`Action<>` delegate for a single call path when a full interface is excessive. Default behavior must remain safe and deterministic.
|
|
53
|
+
3. **Adapter seam for static or third-party APIs** — wrap the static or third-party call behind a small adapter so tests can mock the adapter with Moq.
|
|
54
|
+
|
|
55
|
+
### Time seam (TimeProvider) — guidance only
|
|
56
|
+
|
|
57
|
+
For new or touched time-dependent code, inject `System.TimeProvider` through the constructor instead of calling the clock directly:
|
|
58
|
+
|
|
59
|
+
- Production supplies `TimeProvider.System`.
|
|
60
|
+
- Tests supply `FakeTimeProvider` from `Microsoft.Extensions.TimeProvider.Testing` to make time deterministic.
|
|
61
|
+
- Do not call `DateTime.Now`, `DateTime.UtcNow`, or `DateTimeOffset.Now` directly in new/touched code; obtain time via the injected `TimeProvider` (for example `GetUtcNow()` / `GetLocalNow()`).
|
|
62
|
+
|
|
63
|
+
This is guidance only: it introduces no runtime behavior change and does not require rewriting existing call sites. Where `Microsoft.Bcl.TimeProvider` (the .NET Framework backport of `System.TimeProvider`) is already present in the repository, the seam is available without adding a new production dependency. Legacy call-site migration is follow-up work, not a requirement of adopting this guidance.
|
|
64
|
+
|
|
65
|
+
## Analyzer Stack
|
|
66
|
+
|
|
67
|
+
This repository adopts a fixed set of FIVE static-analysis packages, wired into first-party projects only (vendored or third-party projects are excluded):
|
|
68
|
+
|
|
69
|
+
1. **Meziantou.Analyzer**
|
|
70
|
+
2. **SonarAnalyzer.CSharp**
|
|
71
|
+
3. **Roslynator.Analyzers**
|
|
72
|
+
4. **AsyncFixer**
|
|
73
|
+
5. **Microsoft.CodeAnalysis.BannedApiAnalyzers**
|
|
74
|
+
|
|
75
|
+
### Mechanism
|
|
76
|
+
|
|
77
|
+
- Each first-party project references its analyzers via a `packages.config` `<package ... developmentDependency="true" />` entry plus an explicit `<Analyzer Include="..\packages\<id>.<version>\analyzers\dotnet\cs\<dll>" />` item in the project's analyzer `<ItemGroup>`. This file-based wiring is used because the projects are legacy (non-SDK, `packages.config`) VSTO/.NET Framework projects; no PackageReference, no Central Package Management, and no `dotnet restore` are introduced.
|
|
78
|
+
- For this repo's Roslyn 5.6 (VS18) toolchain, use the analyzer DLLs from the Meziantou `roslyn5.0` and Roslynator `roslyn4.7` subfolders.
|
|
79
|
+
- **Banned symbols** are enforced by BannedApiAnalyzers using a repo-root `BannedSymbols.txt` referenced by each first-party project as `<AdditionalFiles Include="$(MSBuildThisFileDirectory)..\BannedSymbols.txt" />`. The banned targets are `DateTime.Now`, `DateTime.UtcNow`, `Random.Shared`, `Thread.Sleep`, and `Task.Delay`. RS0030 is held at `severity = suggestion` for initial rollout (existing call sites are not build-broken); promotion to `warning` after legacy cleanup is documented follow-up work.
|
|
80
|
+
|
|
81
|
+
### Severity-first ordering invariant
|
|
82
|
+
|
|
83
|
+
All new analyzer rule severities are configured in `.editorconfig` at `severity = suggestion` (never `warning`/`error`) BEFORE any `<Analyzer Include>` item is wired into a project. This is required because the type-check toolchain step runs `msbuild ... /p:Nullable=enable /p:TreatWarningsAsErrors=true`, which promotes any `warning`-severity analyzer diagnostic to a build error. Keeping new analyzer diagnostics at `suggestion` (message level) prevents the analyzer adoption from breaking the protected nullable gate.
|
|
84
|
+
|
|
85
|
+
### Deferred analyzer — SecurityCodeScan.VS2019
|
|
86
|
+
|
|
87
|
+
SecurityCodeScan.VS2019 was evaluated and **deferred** (not silently omitted) from this rollout. Version 5.6.7 is incompatible with this repository's Roslyn 5.6 (VS18) analyzer loader: its types fail to initialize (`TypeInitializationException` → `FileNotFoundException` for `YamlDotNet, Version=11.0.0.0`), which the compiler reports as warning **CS8032**. CS8032 is a compiler warning, not an analyzer rule ID, so it cannot be set to `suggestion` via `.editorconfig`; under `/p:TreatWarningsAsErrors=true` it is promoted to an error and breaks the protected nullable build. SecurityCodeScan.VS2019 is therefore dropped from the analyzer set entirely. **No CS8032 suppression** (no `dotnet_diagnostic.CS8032` entry and no `<WarningsNotAsErrors>` containing CS8032) is introduced, and no substitute security analyzer is added. Re-evaluation is follow-up work pending a Roslyn-5.x-compatible security analyzer.
|
|
88
|
+
|
|
89
|
+
## Prohibited Behaviors
|
|
90
|
+
|
|
91
|
+
- Broad refactors across unrelated projects or files.
|
|
92
|
+
- Introducing heavy generic abstraction frameworks without need.
|
|
93
|
+
- Creating analyzer debt and deferring cleanup.
|
|
94
|
+
- Weakening assertions or relaxing test expectations to make tests pass.
|
|
95
|
+
- Adding sleeps, retries, or timing hacks to mask flaky behavior.
|
|
96
|
+
- Reporting success without running the required toolchain.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: csharp-qa-gate
|
|
3
|
+
description: Final QA gate for C# changes. Executes the full CSharpier -> .NET Analyzers -> Nullable Analysis -> MSTest toolchain, compares against a captured baseline, enforces zero-regression deltas, and produces the required reporting block before the agent declares the change complete.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# C# QA Gate
|
|
7
|
+
|
|
8
|
+
Canonical procedure for the Phase D final quality gate that every C# change must pass before completion is reported.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
Use this skill when:
|
|
13
|
+
|
|
14
|
+
- `csharp-typed-engineer` is about to declare a change complete.
|
|
15
|
+
- An executor has finished applying a planned batch and must verify zero regressions against the baseline captured in Phase A.
|
|
16
|
+
- A reviewer needs to confirm the toolchain was actually run and produced a clean pass.
|
|
17
|
+
|
|
18
|
+
## Required Inputs
|
|
19
|
+
|
|
20
|
+
Before invoking this gate, the agent must have:
|
|
21
|
+
|
|
22
|
+
- a baseline record produced in Phase A, containing analyzer findings, compiler/nullable diagnostics, MSTest pass/fail status, and per-file coverage status for the in-scope files,
|
|
23
|
+
- the exact list of touched production and test files,
|
|
24
|
+
- a clean working tree (all planned edits committed to the working copy).
|
|
25
|
+
|
|
26
|
+
## Toolchain Execution Sequence
|
|
27
|
+
|
|
28
|
+
Run the full toolchain in this exact order. If any step fails or modifies files, fix the issue and restart from step 1. Do not stop the loop until all four steps complete without errors in a single pass.
|
|
29
|
+
|
|
30
|
+
1. `dotnet tool run csharpier .`
|
|
31
|
+
2. `msbuild <solution>.sln /t:Build /p:Configuration=Debug /p:Platform="Any CPU" /p:EnableNETAnalyzers=true /p:EnforceCodeStyleInBuild=true`
|
|
32
|
+
3. `msbuild <solution>.sln /t:Build /p:Configuration=Debug /p:Platform="Any CPU" /p:Nullable=enable /p:TreatWarningsAsErrors=true`
|
|
33
|
+
4. `vstest.console.exe <test-assembly-paths> /EnableCodeCoverage`
|
|
34
|
+
|
|
35
|
+
If the environment prevents running any tool, stop and report the change as **unverified**. Do not declare completion.
|
|
36
|
+
|
|
37
|
+
## Delta Requirements (Zero-Regression Hard Gate)
|
|
38
|
+
|
|
39
|
+
Compare the final results to the Phase A baseline. All of the following must hold:
|
|
40
|
+
|
|
41
|
+
- **Analyzer delta**: 0 new findings across the repository.
|
|
42
|
+
- **Compiler / nullable delta**: 0 new diagnostics across the repository.
|
|
43
|
+
- **MSTest delta**: 0 new failing tests.
|
|
44
|
+
- **Per-file coverage delta**: coverage for every touched file is greater than or equal to the baseline for that file.
|
|
45
|
+
- **Overall coverage delta** (when the repo enforces it): overall coverage is greater than or equal to the baseline.
|
|
46
|
+
- **New modules, classes, or methods**: coverage >= 90% for each new unit introduced in the batch.
|
|
47
|
+
|
|
48
|
+
If any delta check fails, the agent must revert or fix immediately and rerun the full toolchain. Do not proceed to reporting until all deltas are clean.
|
|
49
|
+
|
|
50
|
+
## Required Reporting Block
|
|
51
|
+
|
|
52
|
+
Every completion response must include the following sections:
|
|
53
|
+
|
|
54
|
+
1. **Scope** — exact file list touched in this change.
|
|
55
|
+
2. **Baseline** — analyzer, compiler/nullable, MSTest, and coverage status recorded in Phase A.
|
|
56
|
+
3. **Plan** — design and test-strategy summary, referencing the approved plan.
|
|
57
|
+
4. **Diffs** — patch-style or full-file replacements for scoped files only.
|
|
58
|
+
5. **QA Gate Results** — analyzer, compiler/nullable, MSTest, and coverage deltas. If any step could not be run, mark the corresponding line **unverified** and state why.
|
|
59
|
+
|
|
60
|
+
## Evidence Storage
|
|
61
|
+
|
|
62
|
+
Persist toolchain output according to `evidence-and-timestamp-conventions`:
|
|
63
|
+
|
|
64
|
+
- store baseline outputs under `<FEATURE>/evidence/baseline/<timestamp>/`,
|
|
65
|
+
- store post-change outputs under `<FEATURE>/evidence/qa-gates/<timestamp>/`,
|
|
66
|
+
- use ISO-8601 UTC timestamps in folder names.
|
|
67
|
+
|
|
68
|
+
This location is canonical per evidence-and-timestamp-conventions and is not overridable.
|
|
69
|
+
See `.claude/skills/evidence-and-timestamp-conventions/SKILL.md` for the canonical evidence path authority.
|
|
70
|
+
|
|
71
|
+
The evidence paths must be referenced in the agent's completion message to satisfy the `SubagentStop` completion-artifact gate.
|
|
72
|
+
|
|
73
|
+
## Prohibited Shortcuts
|
|
74
|
+
|
|
75
|
+
- Do not disable, skip, or narrow any step of the toolchain to reach a clean result.
|
|
76
|
+
- Do not add analyzer suppressions, `#pragma warning disable`, `#nullable disable`, or test `[Ignore]` attributes to suppress new findings introduced by the change.
|
|
77
|
+
- Do not report success based on partial or targeted runs alone. Targeted runs are allowed mid-batch, but the final gate requires a full-solution pass.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invoke-csharp-engineer
|
|
3
|
+
description: Invoke the csharp-typed-engineer worker to design, implement, and verify C# changes within typed repository boundaries. Applies CSharpier -> .NET Analyzers -> Nullable Analysis -> MSTest toolchain, the 1-3 production-file small-path budget, and zero-regression quality gates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Implement C# Skill
|
|
7
|
+
|
|
8
|
+
This direct-use wrapper delegates C# implementation work to the `csharp-typed-engineer` worker. Use this entry point when a prompt needs a scoped C# change that must stay inside the typed engineer's guardrails.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
Use this skill when:
|
|
13
|
+
|
|
14
|
+
- The user requests a C# code change, bug fix, refactor, or test addition.
|
|
15
|
+
- Estimated scope fits the small path (1-3 production files plus corresponding tests).
|
|
16
|
+
- The toolchain (CSharpier, .NET Analyzers, Nullable Analysis, MSTest) can be run in the current environment, or the user has explicitly authorized an unverified plan-only response.
|
|
17
|
+
|
|
18
|
+
If the estimated scope exceeds the small-path budget, this skill defers to the orchestrated flow via `csharp-change-budget-router` instead of proceeding directly.
|
|
19
|
+
|
|
20
|
+
## Inputs
|
|
21
|
+
|
|
22
|
+
- Objective statement (what the change must accomplish).
|
|
23
|
+
- Files or entrypoints in scope.
|
|
24
|
+
- Constraints, including public APIs that must be preserved.
|
|
25
|
+
- Optional approved plan. If none is supplied, the worker delegates plan authoring to `atomic_planner` before any edits.
|
|
26
|
+
- Optional budget override in the form `budget: prod=<N>, test=<M>` subject to repo policy compliance.
|
|
27
|
+
|
|
28
|
+
## Output Paths
|
|
29
|
+
|
|
30
|
+
- C# source and test files within the approved scope.
|
|
31
|
+
- Baseline evidence under `<FEATURE>/evidence/baseline/<timestamp>/` and post-change evidence under `<FEATURE>/evidence/qa-gates/<timestamp>/` per `evidence-and-timestamp-conventions`.
|
|
32
|
+
- This location is canonical per evidence-and-timestamp-conventions and is not overridable. See `.claude/skills/evidence-and-timestamp-conventions/SKILL.md` for the canonical evidence path authority.
|
|
33
|
+
- Plan artifacts under the active feature folder when the task is feature-scoped.
|
|
34
|
+
|
|
35
|
+
## Required Reporting Block
|
|
36
|
+
|
|
37
|
+
The worker must return the following reporting block:
|
|
38
|
+
|
|
39
|
+
1. Scope (exact file list).
|
|
40
|
+
2. Baseline (CSharpier, .NET Analyzers, Nullable Analysis, MSTest, coverage status).
|
|
41
|
+
3. Plan (design and test strategy).
|
|
42
|
+
4. Diffs (patch-style or full-file replacements).
|
|
43
|
+
5. QA Gate Results (CSharpier, .NET Analyzers, Nullable Analysis, MSTest, and coverage deltas, or clearly marked **unverified**).
|
|
44
|
+
|
|
45
|
+
## Worker Routing
|
|
46
|
+
|
|
47
|
+
- Worker: `csharp-typed-engineer`
|
|
48
|
+
|
|
49
|
+
## Preloaded Contracts
|
|
50
|
+
|
|
51
|
+
The worker operates under the following preloaded skills and rules:
|
|
52
|
+
|
|
53
|
+
- `policy-compliance-order`
|
|
54
|
+
- `csharp-change-budget-router`
|
|
55
|
+
- `atomic-plan-contract`
|
|
56
|
+
- `csharp-qa-gate`
|
|
57
|
+
- `acceptance-criteria-tracking`
|
|
58
|
+
- `feature-promotion-lifecycle`
|
|
59
|
+
- `remediation-handoff-atomic-planner`
|
|
60
|
+
- `evidence-and-timestamp-conventions`
|
|
61
|
+
- `.claude/rules/csharp.md` (path-scoped for `**/*.cs` and `**/*.csproj`)
|
|
62
|
+
- `.claude/rules/general-code-change.md`
|
|
63
|
+
- `.claude/rules/general-unit-test.md`
|
|
64
|
+
- `.claude/rules/tonality.md`
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "core",
|
|
3
|
+
"label": "Core (always included)",
|
|
4
|
+
"paths": [
|
|
5
|
+
".claude/settings.json",
|
|
6
|
+
".claude/agents/atomic-executor.md",
|
|
7
|
+
".claude/agents/atomic-planner.md",
|
|
8
|
+
".claude/agents/epic-review.md",
|
|
9
|
+
".claude/agents/feature-review.md",
|
|
10
|
+
".claude/agents/orchestrator.md",
|
|
11
|
+
".claude/agents/prd-feature.md",
|
|
12
|
+
".claude/agents/staged-review.md",
|
|
13
|
+
".claude/agents/status-updater.md",
|
|
14
|
+
".claude/agents/task-researcher.md",
|
|
15
|
+
".claude/hooks/enforce-checkpoint-monotonic.ps1",
|
|
16
|
+
".claude/hooks/enforce-completion-consistency.ps1",
|
|
17
|
+
".claude/hooks/enforce-evidence-locations.ps1",
|
|
18
|
+
".claude/hooks/enforce-feature-folder-order.ps1",
|
|
19
|
+
".claude/hooks/enforce-orchestration-preimplementation-gate.ps1",
|
|
20
|
+
".claude/hooks/enforce-pr-author-skill.ps1",
|
|
21
|
+
".claude/hooks/enforce-prd-feature-before-planner.ps1",
|
|
22
|
+
".claude/hooks/enforce-promotion-mcp-only.ps1",
|
|
23
|
+
".claude/hooks/validate-bash.ps1",
|
|
24
|
+
".claude/hooks/validate-executor-output.ps1",
|
|
25
|
+
".claude/hooks/validate-feature-review-coverage.ps1",
|
|
26
|
+
".claude/hooks/validate-orchestrator-output.ps1",
|
|
27
|
+
".claude/hooks/validate-planner-output.ps1",
|
|
28
|
+
".claude/hooks/validate-required-artifact-output.ps1",
|
|
29
|
+
".claude/hooks/validate-task-researcher-output.ps1",
|
|
30
|
+
".claude/rules/architecture-boundaries.md",
|
|
31
|
+
".claude/rules/benchmark-baselines.md",
|
|
32
|
+
".claude/rules/ci-workflows.md",
|
|
33
|
+
".claude/rules/general-code-change.md",
|
|
34
|
+
".claude/rules/general-unit-test.md",
|
|
35
|
+
".claude/rules/orchestrator-state.md",
|
|
36
|
+
".claude/rules/quality-tiers.md",
|
|
37
|
+
".claude/rules/self-explanatory-code-commenting.md",
|
|
38
|
+
".claude/rules/tonality.md",
|
|
39
|
+
".claude/skills/acceptance-criteria-tracking/SKILL.md",
|
|
40
|
+
".claude/skills/atomic-plan-contract/SKILL.md",
|
|
41
|
+
".claude/skills/commit-message/SKILL.md",
|
|
42
|
+
".claude/skills/evidence-and-timestamp-conventions/SKILL.md",
|
|
43
|
+
".claude/skills/execute-hard-lock/SKILL.md",
|
|
44
|
+
".claude/skills/feature-promotion-lifecycle/SKILL.md",
|
|
45
|
+
".claude/skills/feature-review-workflow/SKILL.md",
|
|
46
|
+
".claude/skills/fill-feature-docs/SKILL.md",
|
|
47
|
+
".claude/skills/human-exception-runbook/example.runbook.md",
|
|
48
|
+
".claude/skills/human-exception-runbook/SKILL.md",
|
|
49
|
+
".claude/skills/make-skill-template/SKILL.md",
|
|
50
|
+
".claude/skills/orchestrate/SKILL.md",
|
|
51
|
+
".claude/skills/policy-audit-template-usage/SKILL.md",
|
|
52
|
+
".claude/skills/policy-compliance-order/SKILL.md",
|
|
53
|
+
".claude/skills/pr-author/SKILL.md",
|
|
54
|
+
".claude/skills/pr-base-branch-merge-base/SKILL.md",
|
|
55
|
+
".claude/skills/pr-context-artifacts/SKILL.md",
|
|
56
|
+
".claude/skills/remediation-handoff-atomic-planner/SKILL.md",
|
|
57
|
+
".claude/skills/research-issue/SKILL.md",
|
|
58
|
+
".claude/skills/review-epic/SKILL.md",
|
|
59
|
+
".claude/skills/review-feature/SKILL.md",
|
|
60
|
+
".claude/skills/review-staged/SKILL.md",
|
|
61
|
+
".claude/skills/skill-canonical-location-audit/SKILL.md",
|
|
62
|
+
".claude/skills/translate-copilot-to-claude/SKILL.md",
|
|
63
|
+
".claude/skills/update-status/SKILL.md"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "csharp-legacy",
|
|
3
|
+
"label": "C# (legacy)",
|
|
4
|
+
"source_prefix": ".claude-variants/csharp-legacy",
|
|
5
|
+
"paths": [
|
|
6
|
+
".claude/rules/csharp.md",
|
|
7
|
+
".claude/agents/csharp-typed-engineer.md",
|
|
8
|
+
".claude/skills/csharp-qa-gate/SKILL.md",
|
|
9
|
+
".claude/skills/invoke-csharp-engineer/SKILL.md"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "csharp-modern",
|
|
3
|
+
"label": "C# (modern)",
|
|
4
|
+
"paths": [
|
|
5
|
+
".claude/rules/csharp.md",
|
|
6
|
+
".claude/agents/csharp-typed-engineer.md",
|
|
7
|
+
".claude/skills/csharp-qa-gate/SKILL.md",
|
|
8
|
+
".claude/skills/invoke-csharp-engineer/SKILL.md",
|
|
9
|
+
".claude/skills/csharp-change-budget-router/SKILL.md",
|
|
10
|
+
".claude/skills/csharp-orchestration-state-machine/SKILL.md"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "powershell",
|
|
3
|
+
"label": "PowerShell",
|
|
4
|
+
"paths": [
|
|
5
|
+
".claude/rules/powershell.md",
|
|
6
|
+
".claude/agents/powershell-typed-engineer.md",
|
|
7
|
+
".claude/hooks/check-powershell-test-purity.ps1",
|
|
8
|
+
".claude/hooks/enforce-powershell-batch-budget.ps1",
|
|
9
|
+
".claude/skills/invoke-powershell-engineer/SKILL.md",
|
|
10
|
+
".claude/skills/powershell-change-budget-router/SKILL.md",
|
|
11
|
+
".claude/skills/powershell-orchestration-state-machine/SKILL.md",
|
|
12
|
+
".claude/skills/powershell-qa-gate/SKILL.md"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "python",
|
|
3
|
+
"label": "Python",
|
|
4
|
+
"paths": [
|
|
5
|
+
".claude/rules/python.md",
|
|
6
|
+
".claude/rules/python-suppressions.md",
|
|
7
|
+
".claude/agents/python-typed-engineer.md",
|
|
8
|
+
".claude/hooks/check-python-test-purity.ps1",
|
|
9
|
+
".claude/hooks/enforce-python-batch-budget.ps1",
|
|
10
|
+
".claude/skills/invoke-python-engineer/SKILL.md",
|
|
11
|
+
".claude/skills/python-change-budget-router/SKILL.md",
|
|
12
|
+
".claude/skills/python-qa-gate/SKILL.md"
|
|
13
|
+
]
|
|
14
|
+
}
|