Protega

Sample protega-policy.json (Input)

This is the user-defined policy file that codifies architectural rules.

{
  "schemaVersion": "2.0",
  "policies": {
    "csharp": [
      {
        "id": "cs-no-feature-to-feature-deps",
        "name": "No Feature-to-Feature Dependencies",
        "description": "Ensures that a class inside a 'Features' namespace does not reference another class in a different 'Features' namespace.",
        "who": "Class",
        "whereClauses": [
          {
            "property": "Path",
            "operator": "contains",
            "value": "/Features/"
          }
        ],
        "whatClauses": [
          {
            "property": "References.Path",
            "operator": "not contains",
            "value": "/Features/"
          }
        ]
      }
    ]
  }
}```
Sample protega-data.json (Output)
This is the report generated by Protega, detailing any violations found.
```json
{
  "reportId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
  "timestamp": "2026-05-01T15:00:00Z",
  "summary": {
    "policiesEvaluated": 15,
    "filesScanned": 250,
    "newViolationsFound": 1,
    "exceptionsApplied": 0,
    "finalResult": "FAIL"
  },
  "newViolations": [
    {
      "policyId": "cs-no-feature-to-feature-deps",
      "policyName": "No Feature-to-Feature Dependencies",
      "errorMessage": "Class 'Features.Billing.BillingService' illegally references 'Features.Ordering.OrderRepository'.",
      "violatingFilePath": "src/Features/Billing/BillingService.cs",
      "violatingNodeId": "CSharp:Class:Features.Billing.BillingService"
    }
  ]
}