@orygn/opa-mcp 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/README.md +65 -23
  3. package/dist/config.d.ts +1 -1
  4. package/dist/config.js +2 -2
  5. package/dist/constants.d.ts +8 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +8 -0
  8. package/dist/constants.js.map +1 -0
  9. package/dist/lib/errors.d.ts +1 -1
  10. package/dist/lib/logger.js +2 -2
  11. package/dist/lib/logger.js.map +1 -1
  12. package/dist/lib/opa-cli.d.ts +3 -3
  13. package/dist/lib/opa-cli.js +5 -5
  14. package/dist/lib/opa-cli.js.map +1 -1
  15. package/dist/lib/opa-client.d.ts +1 -1
  16. package/dist/lib/regal-cli.d.ts +4 -4
  17. package/dist/lib/regal-cli.js +5 -5
  18. package/dist/lib/subprocess.d.ts +1 -1
  19. package/dist/lib/subprocess.js +2 -2
  20. package/dist/lib/tool-helpers.d.ts +1 -1
  21. package/dist/prompts/index.js +6 -6
  22. package/dist/prompts/index.js.map +1 -1
  23. package/dist/resources/index.d.ts +4 -4
  24. package/dist/resources/patterns.d.ts +1 -1
  25. package/dist/resources/patterns.d.ts.map +1 -1
  26. package/dist/resources/patterns.js +7 -7
  27. package/dist/resources/style-guide.d.ts +1 -1
  28. package/dist/resources/style-guide.d.ts.map +1 -1
  29. package/dist/resources/style-guide.js +3 -3
  30. package/dist/server.d.ts +2 -2
  31. package/dist/server.d.ts.map +1 -1
  32. package/dist/server.js +4 -4
  33. package/dist/server.js.map +1 -1
  34. package/dist/tools/authoring/capabilities.js +1 -1
  35. package/dist/tools/authoring/check.js +3 -3
  36. package/dist/tools/authoring/check.js.map +1 -1
  37. package/dist/tools/authoring/deps.js +2 -2
  38. package/dist/tools/authoring/deps.js.map +1 -1
  39. package/dist/tools/authoring/format.js +1 -1
  40. package/dist/tools/authoring/index.d.ts +1 -1
  41. package/dist/tools/authoring/inspect.js +2 -2
  42. package/dist/tools/authoring/inspect.js.map +1 -1
  43. package/dist/tools/authoring/lint.js +1 -1
  44. package/dist/tools/authoring/parse.js +1 -1
  45. package/dist/tools/bundles/build.js +1 -1
  46. package/dist/tools/bundles/index.d.ts +1 -1
  47. package/dist/tools/bundles/sign.js +1 -1
  48. package/dist/tools/evaluation/_shared.d.ts +1 -1
  49. package/dist/tools/evaluation/_shared.js +1 -1
  50. package/dist/tools/evaluation/bench.js +1 -1
  51. package/dist/tools/evaluation/compile.d.ts +2 -2
  52. package/dist/tools/evaluation/compile.js +1 -1
  53. package/dist/tools/evaluation/compile.js.map +1 -1
  54. package/dist/tools/evaluation/eval.d.ts +2 -2
  55. package/dist/tools/evaluation/eval.js +1 -1
  56. package/dist/tools/evaluation/eval.js.map +1 -1
  57. package/dist/tools/evaluation/index.d.ts +1 -1
  58. package/dist/tools/evaluation/test.js +1 -1
  59. package/dist/tools/helpers/coverage-gaps.d.ts +29 -0
  60. package/dist/tools/helpers/coverage-gaps.d.ts.map +1 -0
  61. package/dist/tools/helpers/coverage-gaps.js +125 -0
  62. package/dist/tools/helpers/coverage-gaps.js.map +1 -0
  63. package/dist/tools/helpers/describe-policy.js +1 -1
  64. package/dist/tools/helpers/explain-decision.d.ts +1 -1
  65. package/dist/tools/helpers/explain-decision.js +1 -1
  66. package/dist/tools/helpers/explain-decision.js.map +1 -1
  67. package/dist/tools/helpers/generate-test-skeleton.js +3 -3
  68. package/dist/tools/helpers/generate-test-skeleton.js.map +1 -1
  69. package/dist/tools/helpers/index.d.ts +1 -1
  70. package/dist/tools/helpers/index.d.ts.map +1 -1
  71. package/dist/tools/helpers/index.js +4 -0
  72. package/dist/tools/helpers/index.js.map +1 -1
  73. package/dist/tools/helpers/security-audit.d.ts +21 -0
  74. package/dist/tools/helpers/security-audit.d.ts.map +1 -0
  75. package/dist/tools/helpers/security-audit.js +111 -0
  76. package/dist/tools/helpers/security-audit.js.map +1 -0
  77. package/dist/tools/helpers/suggest-fix.js +6 -6
  78. package/dist/tools/helpers/suggest-fix.js.map +1 -1
  79. package/dist/tools/index.d.ts +9 -6
  80. package/dist/tools/index.d.ts.map +1 -1
  81. package/dist/tools/index.js +2 -0
  82. package/dist/tools/index.js.map +1 -1
  83. package/dist/tools/meta/index.d.ts +10 -0
  84. package/dist/tools/meta/index.d.ts.map +1 -0
  85. package/dist/tools/meta/index.js +5 -0
  86. package/dist/tools/meta/index.js.map +1 -0
  87. package/dist/tools/meta/server-info.d.ts +17 -0
  88. package/dist/tools/meta/server-info.d.ts.map +1 -0
  89. package/dist/tools/meta/server-info.js +30 -0
  90. package/dist/tools/meta/server-info.js.map +1 -0
  91. package/dist/tools/server-management/data.js +1 -1
  92. package/dist/tools/server-management/data.js.map +1 -1
  93. package/dist/tools/server-management/decisions.js +1 -1
  94. package/dist/tools/server-management/decisions.js.map +1 -1
  95. package/dist/tools/server-management/index.d.ts +1 -1
  96. package/dist/tools/server-management/policies.js +1 -1
  97. package/dist/tools/server-management/policies.js.map +1 -1
  98. package/dist/tools/server-management/status.js +2 -2
  99. package/dist/tools/server-management/status.js.map +1 -1
  100. package/package.json +1 -1
@@ -5,5 +5,5 @@
5
5
  * - A test
6
6
  * - Common pitfalls
7
7
  */
8
- export declare const PATTERNS = "# Rego pattern library\n\nCommon Rego patterns with working examples, tests, and pitfalls. Each\npattern is self-contained \u2014 copy, adapt, and ship.\n\n---\n\n## 1. Role-based access control (RBAC)\n\n**When to use:** the simplest authorization model. Every user has one\nor more roles; each role grants a set of actions on a set of\nresources. Sufficient for ~80% of internal applications.\n\n```rego\npackage rbac\n\nimport rego.v1\n\ndefault allow := false\n\n# Permissions table \u2014 extend as roles evolve.\npermissions := {\n \"admin\": {\"read\", \"write\", \"delete\", \"manage_users\"},\n \"editor\": {\"read\", \"write\"},\n \"viewer\": {\"read\"},\n}\n\nallow if {\n some role in input.user.roles\n input.action in permissions[role]\n}\n\n# Why was it denied? \u2014 useful for audit logs.\ndeny_reasons contains reason if {\n not allow\n input.user\n reason := sprintf(\n \"user %q has roles %v, none grant %q\",\n [input.user.id, input.user.roles, input.action],\n )\n}\n\ndeny_reasons contains \"anonymous request\" if {\n not allow\n not input.user\n}\n```\n\n**Test:**\n\n```rego\npackage rbac_test\n\nimport rego.v1\nimport data.rbac\n\ntest_admin_can_delete if {\n rbac.allow with input as {\n \"user\": {\"id\": \"alice\", \"roles\": [\"admin\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_viewer_cannot_delete if {\n not rbac.allow with input as {\n \"user\": {\"id\": \"bob\", \"roles\": [\"viewer\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_anonymous_denied if {\n not rbac.allow with input as {\"action\": \"read\"}\n \"anonymous request\" in (rbac.deny_reasons with input as {\"action\": \"read\"})\n}\n```\n\n**Pitfalls:**\n- The `permissions` table grows unbounded. Move to data files\n (`data.permissions`) once you have more than ~20 roles.\n- Roles overlap with groups in real auth systems; map at the boundary\n rather than carrying both.\n\n---\n\n## 2. Attribute-based access control (ABAC)\n\n**When to use:** when \"who\" alone isn't enough \u2014 decisions also depend\non resource attributes (ownership, tenant, sensitivity) and context\n(time of day, source IP).\n\n```rego\npackage abac\n\nimport rego.v1\n\ndefault allow := false\n\n# A user can read any resource they own.\nallow if {\n input.action == \"read\"\n input.resource.owner_id == input.user.id\n}\n\n# A user can read shared resources at their organization.\nallow if {\n input.action == \"read\"\n input.resource.shared\n input.resource.org_id == input.user.org_id\n}\n\n# Admins can do anything within their organization.\nallow if {\n \"admin\" in input.user.roles\n input.resource.org_id == input.user.org_id\n}\n\n# Don't show \"secret\" resources to anyone outside the owner's\n# organization, even admins.\nallow := false if {\n input.resource.classification == \"secret\"\n input.resource.org_id != input.user.org_id\n}\n```\n\n**Test:**\n\n```rego\npackage abac_test\n\nimport rego.v1\nimport data.abac\n\ntest_owner_reads_own if {\n abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\"},\n \"resource\": {\"owner_id\": \"u1\", \"org_id\": \"o1\"},\n }\n}\n\ntest_admin_blocked_from_secret_in_other_org if {\n not abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\", \"roles\": [\"admin\"]},\n \"resource\": {\n \"owner_id\": \"u2\",\n \"org_id\": \"o2\",\n \"classification\": \"secret\",\n },\n }\n}\n```\n\n**Pitfalls:**\n- Multiple `allow` rules combine with logical OR. Use explicit\n `allow := false if ...` to *override* an allow.\n- Don't compute attributes inside the policy; compute them at the\n boundary and pass via `input`.\n\n---\n\n## 3. Kubernetes admission control\n\n**When to use:** validate or mutate Kubernetes resources at admission\ntime. Run as a Gatekeeper, OPA-as-a-webhook, or Kyverno-equivalent\npolicy layer.\n\n```rego\npackage k8s.admission\n\nimport rego.v1\n\n# Reject pods without resource limits.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n container := input.request.object.spec.containers[_]\n not container.resources.limits.memory\n msg := sprintf(\n \"Pod %q container %q is missing resources.limits.memory\",\n [input.request.object.metadata.name, container.name],\n )\n}\n\n# Reject privileged containers in production.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n input.request.namespace != \"kube-system\"\n container := input.request.object.spec.containers[_]\n container.securityContext.privileged == true\n msg := sprintf(\n \"privileged containers are not allowed: %q in %q\",\n [container.name, input.request.object.metadata.name],\n )\n}\n```\n\n**Pitfalls:**\n- Use `input.request.object` for the resource being admitted; the\n envelope shape comes from Kubernetes, not your control.\n- For mutations, return a JSON Patch via the `patch` field. Test\n patches with the actual admission webhook in dry-run mode before\n enforcing.\n- Iteration order is undefined; never rely on `containers[0]` to mean\n anything specific.\n\n---\n\n## 4. Infrastructure-as-Code gates (Terraform)\n\n**When to use:** validate Terraform plans before apply. Catch overly\npermissive IAM, public S3 buckets, missing encryption.\n\n```rego\npackage terraform\n\nimport rego.v1\n\n# Reject S3 buckets without server-side encryption.\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_s3_bucket\"\n after := resource.change.after\n not after.server_side_encryption_configuration\n msg := sprintf(\n \"S3 bucket %q has no server-side encryption configured\",\n [resource.address],\n )\n}\n\n# Reject IAM policies with action \"*\" on resource \"*\".\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_iam_policy\"\n policy := json.unmarshal(resource.change.after.policy)\n statement := policy.Statement[_]\n statement.Effect == \"Allow\"\n \"*\" in statement.Action\n statement.Resource == \"*\"\n msg := sprintf(\"IAM policy %q grants Allow * on *\", [resource.address])\n}\n```\n\n**Pitfalls:**\n- Terraform plan JSON is verbose and version-specific. Pin the\n `terraform plan -json` schema you target.\n- `resource_changes[_].change.after` may be `null` for destroys \u2014\n guard against it.\n- For wide-radius changes, use `opa exec --decision` against a plan\n file in CI, not the live API.\n\n---\n\n## 5. API authorization (HTTP request gating)\n\n**When to use:** at the API gateway / reverse proxy layer, validate\neach request against the caller's identity and the requested\nendpoint.\n\n```rego\npackage api.authz\n\nimport rego.v1\n\ndefault allow := false\n\n# Public endpoints \u2014 no auth required.\npublic_endpoints := {\n {\"method\": \"GET\", \"path\": [\"health\"]},\n {\"method\": \"GET\", \"path\": [\"version\"]},\n}\n\nallow if some _ in public_endpoints; matches_endpoint(_)\n\n# Authenticated reads on resources the user has access to.\nallow if {\n input.method == \"GET\"\n input.user\n user_can_read(input.user, input.path)\n}\n\n# Authenticated writes only with specific scopes.\nallow if {\n input.method in {\"POST\", \"PUT\", \"PATCH\", \"DELETE\"}\n input.user\n \"write\" in input.user.scopes\n user_can_write(input.user, input.path)\n}\n\nmatches_endpoint(spec) if {\n spec.method == input.method\n spec.path == input.path\n}\n\nuser_can_read(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n\nuser_can_write(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n```\n\n**Pitfalls:**\n- `input.path` is typically an array (`[\"users\", \"alice\"]`), not a\n string. Build it consistently at the gateway.\n- Path-prefix matching is easy; full pattern matching is not. For\n parameterized routes, decode at the gateway and pass structured\n fields.\n\n---\n\n## 6. Rate limiting (with sliding window data)\n\n**When to use:** allow N requests per principal per window. Lightweight\nlimit enforcement; for high throughput, push to a dedicated rate\nlimiter.\n\n```rego\npackage rate\n\nimport rego.v1\n\n# Configuration: 100 requests per principal per 60-second window.\nlimit := 100\nwindow_seconds := 60\n\n# input.now is a unix timestamp in nanoseconds.\n# data.requests[principal] is an array of nanosecond timestamps.\n\ncurrent_window := requests if {\n requests := [t | some t in data.requests[input.principal]; t > input.now - window_seconds * 1000000000]\n}\n\ncount := count(current_window)\n\nallow if count < limit\n\ndeny_reason := sprintf(\n \"rate limit exceeded: %d requests in last %d seconds (limit %d)\",\n [count, window_seconds, limit],\n) if not allow\n```\n\n**Pitfalls:**\n- `data.requests` grows unbounded unless the writer prunes outside the\n window. Schedule prune on every write.\n- This pattern is *advisory* \u2014 under load, two concurrent decisions\n can both see `count == limit - 1` and both allow. For strict\n limits, use a Lua/Redis token bucket at the gateway and have OPA\n validate the token, not count requests.\n\n---\n\n## Where these patterns came from\n\nEach is distilled from production policy code. The full Rego files,\ntests, and policy data fixtures live in this server's GitHub\nrepository under `tests/fixtures/policies/`.\n\nFor more patterns, see:\n\n- OPA Playground: https://play.openpolicyagent.org/\n- Awesome OPA: https://github.com/anderseknert/awesome-opa\n- Styra DAS pattern library: https://docs.styra.com/das/policies\n";
8
+ export declare const PATTERNS = "# Rego pattern library\n\nCommon Rego patterns with working examples, tests, and pitfalls. Each\npattern is self-contained -- copy, adapt, and ship.\n\n---\n\n## 1. Role-based access control (RBAC)\n\n**When to use:** the simplest authorization model. Every user has one\nor more roles; each role grants a set of actions on a set of\nresources. Sufficient for ~80% of internal applications.\n\n```rego\npackage rbac\n\nimport rego.v1\n\ndefault allow := false\n\n# Permissions table -- extend as roles evolve.\npermissions := {\n \"admin\": {\"read\", \"write\", \"delete\", \"manage_users\"},\n \"editor\": {\"read\", \"write\"},\n \"viewer\": {\"read\"},\n}\n\nallow if {\n some role in input.user.roles\n input.action in permissions[role]\n}\n\n# Why was it denied? -- useful for audit logs.\ndeny_reasons contains reason if {\n not allow\n input.user\n reason := sprintf(\n \"user %q has roles %v, none grant %q\",\n [input.user.id, input.user.roles, input.action],\n )\n}\n\ndeny_reasons contains \"anonymous request\" if {\n not allow\n not input.user\n}\n```\n\n**Test:**\n\n```rego\npackage rbac_test\n\nimport rego.v1\nimport data.rbac\n\ntest_admin_can_delete if {\n rbac.allow with input as {\n \"user\": {\"id\": \"alice\", \"roles\": [\"admin\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_viewer_cannot_delete if {\n not rbac.allow with input as {\n \"user\": {\"id\": \"bob\", \"roles\": [\"viewer\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_anonymous_denied if {\n not rbac.allow with input as {\"action\": \"read\"}\n \"anonymous request\" in (rbac.deny_reasons with input as {\"action\": \"read\"})\n}\n```\n\n**Pitfalls:**\n- The `permissions` table grows unbounded. Move to data files\n (`data.permissions`) once you have more than ~20 roles.\n- Roles overlap with groups in real auth systems; map at the boundary\n rather than carrying both.\n\n---\n\n## 2. Attribute-based access control (ABAC)\n\n**When to use:** when \"who\" alone isn't enough -- decisions also depend\non resource attributes (ownership, tenant, sensitivity) and context\n(time of day, source IP).\n\n```rego\npackage abac\n\nimport rego.v1\n\ndefault allow := false\n\n# A user can read any resource they own.\nallow if {\n input.action == \"read\"\n input.resource.owner_id == input.user.id\n}\n\n# A user can read shared resources at their organization.\nallow if {\n input.action == \"read\"\n input.resource.shared\n input.resource.org_id == input.user.org_id\n}\n\n# Admins can do anything within their organization.\nallow if {\n \"admin\" in input.user.roles\n input.resource.org_id == input.user.org_id\n}\n\n# Don't show \"secret\" resources to anyone outside the owner's\n# organization, even admins.\nallow := false if {\n input.resource.classification == \"secret\"\n input.resource.org_id != input.user.org_id\n}\n```\n\n**Test:**\n\n```rego\npackage abac_test\n\nimport rego.v1\nimport data.abac\n\ntest_owner_reads_own if {\n abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\"},\n \"resource\": {\"owner_id\": \"u1\", \"org_id\": \"o1\"},\n }\n}\n\ntest_admin_blocked_from_secret_in_other_org if {\n not abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\", \"roles\": [\"admin\"]},\n \"resource\": {\n \"owner_id\": \"u2\",\n \"org_id\": \"o2\",\n \"classification\": \"secret\",\n },\n }\n}\n```\n\n**Pitfalls:**\n- Multiple `allow` rules combine with logical OR. Use explicit\n `allow := false if ...` to *override* an allow.\n- Don't compute attributes inside the policy; compute them at the\n boundary and pass via `input`.\n\n---\n\n## 3. Kubernetes admission control\n\n**When to use:** validate or mutate Kubernetes resources at admission\ntime. Run as a Gatekeeper, OPA-as-a-webhook, or Kyverno-equivalent\npolicy layer.\n\n```rego\npackage k8s.admission\n\nimport rego.v1\n\n# Reject pods without resource limits.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n container := input.request.object.spec.containers[_]\n not container.resources.limits.memory\n msg := sprintf(\n \"Pod %q container %q is missing resources.limits.memory\",\n [input.request.object.metadata.name, container.name],\n )\n}\n\n# Reject privileged containers in production.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n input.request.namespace != \"kube-system\"\n container := input.request.object.spec.containers[_]\n container.securityContext.privileged == true\n msg := sprintf(\n \"privileged containers are not allowed: %q in %q\",\n [container.name, input.request.object.metadata.name],\n )\n}\n```\n\n**Pitfalls:**\n- Use `input.request.object` for the resource being admitted; the\n envelope shape comes from Kubernetes, not your control.\n- For mutations, return a JSON Patch via the `patch` field. Test\n patches with the actual admission webhook in dry-run mode before\n enforcing.\n- Iteration order is undefined; never rely on `containers[0]` to mean\n anything specific.\n\n---\n\n## 4. Infrastructure-as-Code gates (Terraform)\n\n**When to use:** validate Terraform plans before apply. Catch overly\npermissive IAM, public S3 buckets, missing encryption.\n\n```rego\npackage terraform\n\nimport rego.v1\n\n# Reject S3 buckets without server-side encryption.\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_s3_bucket\"\n after := resource.change.after\n not after.server_side_encryption_configuration\n msg := sprintf(\n \"S3 bucket %q has no server-side encryption configured\",\n [resource.address],\n )\n}\n\n# Reject IAM policies with action \"*\" on resource \"*\".\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_iam_policy\"\n policy := json.unmarshal(resource.change.after.policy)\n statement := policy.Statement[_]\n statement.Effect == \"Allow\"\n \"*\" in statement.Action\n statement.Resource == \"*\"\n msg := sprintf(\"IAM policy %q grants Allow * on *\", [resource.address])\n}\n```\n\n**Pitfalls:**\n- Terraform plan JSON is verbose and version-specific. Pin the\n `terraform plan -json` schema you target.\n- `resource_changes[_].change.after` may be `null` for destroys --\n guard against it.\n- For wide-radius changes, use `opa exec --decision` against a plan\n file in CI, not the live API.\n\n---\n\n## 5. API authorization (HTTP request gating)\n\n**When to use:** at the API gateway / reverse proxy layer, validate\neach request against the caller's identity and the requested\nendpoint.\n\n```rego\npackage api.authz\n\nimport rego.v1\n\ndefault allow := false\n\n# Public endpoints -- no auth required.\npublic_endpoints := {\n {\"method\": \"GET\", \"path\": [\"health\"]},\n {\"method\": \"GET\", \"path\": [\"version\"]},\n}\n\nallow if some _ in public_endpoints; matches_endpoint(_)\n\n# Authenticated reads on resources the user has access to.\nallow if {\n input.method == \"GET\"\n input.user\n user_can_read(input.user, input.path)\n}\n\n# Authenticated writes only with specific scopes.\nallow if {\n input.method in {\"POST\", \"PUT\", \"PATCH\", \"DELETE\"}\n input.user\n \"write\" in input.user.scopes\n user_can_write(input.user, input.path)\n}\n\nmatches_endpoint(spec) if {\n spec.method == input.method\n spec.path == input.path\n}\n\nuser_can_read(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n\nuser_can_write(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n```\n\n**Pitfalls:**\n- `input.path` is typically an array (`[\"users\", \"alice\"]`), not a\n string. Build it consistently at the gateway.\n- Path-prefix matching is easy; full pattern matching is not. For\n parameterized routes, decode at the gateway and pass structured\n fields.\n\n---\n\n## 6. Rate limiting (with sliding window data)\n\n**When to use:** allow N requests per principal per window. Lightweight\nlimit enforcement; for high throughput, push to a dedicated rate\nlimiter.\n\n```rego\npackage rate\n\nimport rego.v1\n\n# Configuration: 100 requests per principal per 60-second window.\nlimit := 100\nwindow_seconds := 60\n\n# input.now is a unix timestamp in nanoseconds.\n# data.requests[principal] is an array of nanosecond timestamps.\n\ncurrent_window := requests if {\n requests := [t | some t in data.requests[input.principal]; t > input.now - window_seconds * 1000000000]\n}\n\ncount := count(current_window)\n\nallow if count < limit\n\ndeny_reason := sprintf(\n \"rate limit exceeded: %d requests in last %d seconds (limit %d)\",\n [count, window_seconds, limit],\n) if not allow\n```\n\n**Pitfalls:**\n- `data.requests` grows unbounded unless the writer prunes outside the\n window. Schedule prune on every write.\n- This pattern is *advisory* -- under load, two concurrent decisions\n can both see `count == limit - 1` and both allow. For strict\n limits, use a Lua/Redis token bucket at the gateway and have OPA\n validate the token, not count requests.\n\n---\n\n## Where these patterns came from\n\nEach is distilled from production policy code. The full Rego files,\ntests, and policy data fixtures live in this server's GitHub\nrepository under `tests/fixtures/policies/`.\n\nFor more patterns, see:\n\n- OPA Playground: https://play.openpolicyagent.org/\n- Awesome OPA: https://github.com/anderseknert/awesome-opa\n- Styra DAS pattern library: https://docs.styra.com/das/policies\n";
9
9
  //# sourceMappingURL=patterns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/resources/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,glTA8WpB,CAAC"}
1
+ {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/resources/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,ojTA8WpB,CAAC"}
@@ -8,7 +8,7 @@
8
8
  export const PATTERNS = `# Rego pattern library
9
9
 
10
10
  Common Rego patterns with working examples, tests, and pitfalls. Each
11
- pattern is self-contained copy, adapt, and ship.
11
+ pattern is self-contained -- copy, adapt, and ship.
12
12
 
13
13
  ---
14
14
 
@@ -25,7 +25,7 @@ import rego.v1
25
25
 
26
26
  default allow := false
27
27
 
28
- # Permissions table extend as roles evolve.
28
+ # Permissions table -- extend as roles evolve.
29
29
  permissions := {
30
30
  "admin": {"read", "write", "delete", "manage_users"},
31
31
  "editor": {"read", "write"},
@@ -37,7 +37,7 @@ allow if {
37
37
  input.action in permissions[role]
38
38
  }
39
39
 
40
- # Why was it denied? useful for audit logs.
40
+ # Why was it denied? -- useful for audit logs.
41
41
  deny_reasons contains reason if {
42
42
  not allow
43
43
  input.user
@@ -91,7 +91,7 @@ test_anonymous_denied if {
91
91
 
92
92
  ## 2. Attribute-based access control (ABAC)
93
93
 
94
- **When to use:** when "who" alone isn't enough decisions also depend
94
+ **When to use:** when "who" alone isn't enough -- decisions also depend
95
95
  on resource attributes (ownership, tenant, sensitivity) and context
96
96
  (time of day, source IP).
97
97
 
@@ -250,7 +250,7 @@ deny contains msg if {
250
250
  **Pitfalls:**
251
251
  - Terraform plan JSON is verbose and version-specific. Pin the
252
252
  \`terraform plan -json\` schema you target.
253
- - \`resource_changes[_].change.after\` may be \`null\` for destroys
253
+ - \`resource_changes[_].change.after\` may be \`null\` for destroys --
254
254
  guard against it.
255
255
  - For wide-radius changes, use \`opa exec --decision\` against a plan
256
256
  file in CI, not the live API.
@@ -270,7 +270,7 @@ import rego.v1
270
270
 
271
271
  default allow := false
272
272
 
273
- # Public endpoints no auth required.
273
+ # Public endpoints -- no auth required.
274
274
  public_endpoints := {
275
275
  {"method": "GET", "path": ["health"]},
276
276
  {"method": "GET", "path": ["version"]},
@@ -353,7 +353,7 @@ deny_reason := sprintf(
353
353
  **Pitfalls:**
354
354
  - \`data.requests\` grows unbounded unless the writer prunes outside the
355
355
  window. Schedule prune on every write.
356
- - This pattern is *advisory* under load, two concurrent decisions
356
+ - This pattern is *advisory* -- under load, two concurrent decisions
357
357
  can both see \`count == limit - 1\` and both allow. For strict
358
358
  limits, use a Lua/Redis token bucket at the gateway and have OPA
359
359
  validate the token, not count requests.
@@ -2,5 +2,5 @@
2
2
  * Curated Rego style guide. Adapted from the Styra reference plus the
3
3
  * OPA team's own conventions, condensed for LLM consumption.
4
4
  */
5
- export declare const STYLE_GUIDE = "# Rego style guide\n\nA condensed reference for writing idiomatic, maintainable Rego. Adapted\nfrom the Styra style guide and the OPA project's conventions.\n\n## Always import `rego.v1`\n\nEvery `.rego` file should start with the v1 import. It enables the\nmodern syntax (`if`, `contains`, `every`) and disables the older\nimplicit-membership operator that's a frequent source of bugs.\n\n```rego\npackage authz\n\nimport rego.v1\n```\n\nOPA 1.0 (released January 2025) treats this as the default, but\nincluding it explicitly makes intent clear and keeps the file portable\nto older OPA installations.\n\n## Package layout mirrors directory layout\n\nMatch `package foo.bar` with the file path `foo/bar/main.rego` (or\n`foo/bar/<anything>.rego`). Regal flags mismatches as\n`directory-package-mismatch`.\n\nFor a multi-file package, group by responsibility:\n\n```\nauthz/\n main.rego # principal decision (allow / deny)\n rbac.rego # role-based access checks\n abac.rego # attribute-based access checks\n helpers.rego # shared helpers, no decisions\n main_test.rego # tests for principal decisions\n rbac_test.rego # tests for rbac\n```\n\nTests live in `*_test.rego` siblings of the source they test, in the\nsame package or a `<package>_test` package.\n\n## Naming\n\n- Rule names: `snake_case`.\n- Boolean rules: read like predicates \u2014 `allow`, `is_admin`,\n `should_log`. Avoid `is_not_blocked` (double negative).\n- Set/object rules: read like nouns \u2014 `grants`, `roles`, `reasons`.\n- Helper rules: `_` prefix is *not* a convention; just give them names\n that explain what they return.\n\nNames that conflict with reserved words (`type`, `time`, `input`) won't\nparse. Names matching builtins (`http`, `json`) shadow them.\n\n## Default deny\n\nEvery principal decision should have a default fallback so the policy\nreturns a value even when no rule matches.\n\n```rego\ndefault allow := false\n\nallow if {\n input.user.role == \"admin\"\n}\n```\n\nThe same applies to set-valued reasons:\n\n```rego\ndeny contains reason if {\n not allow\n reason := \"not authorized\"\n}\n```\n\n## Comprehensions vs `every`\n\nWhen you need a value derived from a collection, use a comprehension:\n\n```rego\nadmin_users := {u | some u in input.users; u.role == \"admin\"}\n```\n\nWhen you need to assert that a property holds for every element, use\n`every` (introduced in OPA 0.41):\n\n```rego\nallow if {\n every claim in input.token.claims {\n claim.verified == true\n }\n}\n```\n\n`every` is clearer than the older `not <comprehension>` idiom and\nshort-circuits on the first failure.\n\n## Annotations\n\nPublic rules deserve a metadata block so consumers know what they do.\n\n```rego\n# METADATA\n# title: Authorization decision for HTTP requests\n# description: |\n# Returns true when the requesting principal has a role with a\n# permission entry for the requested action on the requested\n# resource. Anonymous requests always deny.\n# entrypoint: true\nallow if {\n some role in input.principal.roles\n permission_grants[role][input.action]\n}\n```\n\nAnnotations show up in `opa inspect`, the registry, and editor\nhovers. They are also extracted by `rego_describe_policy`.\n\n## Schema annotations\n\nFor policies that are sensitive to input shape, attach a JSON Schema:\n\n```rego\n# METADATA\n# schemas:\n# - input: schema.input\nallow if {\n input.user.id != \"\"\n}\n```\n\nCombined with `opa check --schema`, this turns input-shape mismatches\ninto compile errors instead of runtime undefineds.\n\n## Anti-patterns\n\n- **`http.send` in the decision path.** Each call adds round-trip\n latency. If you must, scope it to a small, cacheable read.\n- **Deep `with` chains.** `x with input as ... with data as ...` more\n than two layers deep is a smell \u2014 the test is doing too much. Split.\n- **`print` and `trace`.** Useful in development; remove before\n shipping. Regal flags both as `print-or-trace-call`.\n- **Mixing `if` and the legacy implicit form in the same file.** Pick\n one. With `rego.v1` imported you cannot use the implicit form.\n\n## Tests\n\n`opa test` runs every rule whose name starts with `test_`. A test\neither evaluates to true (pass) or fails to evaluate (fail). The\ncommon shape:\n\n```rego\npackage authz_test\n\nimport rego.v1\nimport data.authz\n\ntest_admin_can_delete if {\n authz.allow with input as {\n \"user\": {\"role\": \"admin\"},\n \"action\": \"delete\",\n }\n}\n\ntest_viewer_cannot_delete if {\n not authz.allow with input as {\n \"user\": {\"role\": \"viewer\"},\n \"action\": \"delete\",\n }\n}\n```\n\nRun with `opa test -v ./...` for verbose output. Add `--coverage` to\nverify which lines were exercised.\n\n## References\n\n- Official Rego style guide: https://docs.styra.com/regal/rego-style-guide\n- OPA documentation: https://www.openpolicyagent.org/docs/latest/\n- Regal linter rules: https://docs.styra.com/regal/rules\n";
5
+ export declare const STYLE_GUIDE = "# Rego style guide\n\nA condensed reference for writing idiomatic, maintainable Rego. Adapted\nfrom the Styra style guide and the OPA project's conventions.\n\n## Always import `rego.v1`\n\nEvery `.rego` file should start with the v1 import. It enables the\nmodern syntax (`if`, `contains`, `every`) and disables the older\nimplicit-membership operator that's a frequent source of bugs.\n\n```rego\npackage authz\n\nimport rego.v1\n```\n\nOPA 1.0 (released January 2025) treats this as the default, but\nincluding it explicitly makes intent clear and keeps the file portable\nto older OPA installations.\n\n## Package layout mirrors directory layout\n\nMatch `package foo.bar` with the file path `foo/bar/main.rego` (or\n`foo/bar/<anything>.rego`). Regal flags mismatches as\n`directory-package-mismatch`.\n\nFor a multi-file package, group by responsibility:\n\n```\nauthz/\n main.rego # principal decision (allow / deny)\n rbac.rego # role-based access checks\n abac.rego # attribute-based access checks\n helpers.rego # shared helpers, no decisions\n main_test.rego # tests for principal decisions\n rbac_test.rego # tests for rbac\n```\n\nTests live in `*_test.rego` siblings of the source they test, in the\nsame package or a `<package>_test` package.\n\n## Naming\n\n- Rule names: `snake_case`.\n- Boolean rules: read like predicates -- `allow`, `is_admin`,\n `should_log`. Avoid `is_not_blocked` (double negative).\n- Set/object rules: read like nouns -- `grants`, `roles`, `reasons`.\n- Helper rules: `_` prefix is *not* a convention; just give them names\n that explain what they return.\n\nNames that conflict with reserved words (`type`, `time`, `input`) won't\nparse. Names matching builtins (`http`, `json`) shadow them.\n\n## Default deny\n\nEvery principal decision should have a default fallback so the policy\nreturns a value even when no rule matches.\n\n```rego\ndefault allow := false\n\nallow if {\n input.user.role == \"admin\"\n}\n```\n\nThe same applies to set-valued reasons:\n\n```rego\ndeny contains reason if {\n not allow\n reason := \"not authorized\"\n}\n```\n\n## Comprehensions vs `every`\n\nWhen you need a value derived from a collection, use a comprehension:\n\n```rego\nadmin_users := {u | some u in input.users; u.role == \"admin\"}\n```\n\nWhen you need to assert that a property holds for every element, use\n`every` (introduced in OPA 0.41):\n\n```rego\nallow if {\n every claim in input.token.claims {\n claim.verified == true\n }\n}\n```\n\n`every` is clearer than the older `not <comprehension>` idiom and\nshort-circuits on the first failure.\n\n## Annotations\n\nPublic rules deserve a metadata block so consumers know what they do.\n\n```rego\n# METADATA\n# title: Authorization decision for HTTP requests\n# description: |\n# Returns true when the requesting principal has a role with a\n# permission entry for the requested action on the requested\n# resource. Anonymous requests always deny.\n# entrypoint: true\nallow if {\n some role in input.principal.roles\n permission_grants[role][input.action]\n}\n```\n\nAnnotations show up in `opa inspect`, the registry, and editor\nhovers. They are also extracted by `rego_describe_policy`.\n\n## Schema annotations\n\nFor policies that are sensitive to input shape, attach a JSON Schema:\n\n```rego\n# METADATA\n# schemas:\n# - input: schema.input\nallow if {\n input.user.id != \"\"\n}\n```\n\nCombined with `opa check --schema`, this turns input-shape mismatches\ninto compile errors instead of runtime undefineds.\n\n## Anti-patterns\n\n- **`http.send` in the decision path.** Each call adds round-trip\n latency. If you must, scope it to a small, cacheable read.\n- **Deep `with` chains.** `x with input as ... with data as ...` more\n than two layers deep is a smell -- the test is doing too much. Split.\n- **`print` and `trace`.** Useful in development; remove before\n shipping. Regal flags both as `print-or-trace-call`.\n- **Mixing `if` and the legacy implicit form in the same file.** Pick\n one. With `rego.v1` imported you cannot use the implicit form.\n\n## Tests\n\n`opa test` runs every rule whose name starts with `test_`. A test\neither evaluates to true (pass) or fails to evaluate (fail). The\ncommon shape:\n\n```rego\npackage authz_test\n\nimport rego.v1\nimport data.authz\n\ntest_admin_can_delete if {\n authz.allow with input as {\n \"user\": {\"role\": \"admin\"},\n \"action\": \"delete\",\n }\n}\n\ntest_viewer_cannot_delete if {\n not authz.allow with input as {\n \"user\": {\"role\": \"viewer\"},\n \"action\": \"delete\",\n }\n}\n```\n\nRun with `opa test -v ./...` for verbose output. Add `--coverage` to\nverify which lines were exercised.\n\n## References\n\n- Official Rego style guide: https://docs.styra.com/regal/rego-style-guide\n- OPA documentation: https://www.openpolicyagent.org/docs/latest/\n- Regal linter rules: https://docs.styra.com/regal/rules\n";
6
6
  //# sourceMappingURL=style-guide.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style-guide.d.ts","sourceRoot":"","sources":["../../src/resources/style-guide.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,+6JAqLvB,CAAC"}
1
+ {"version":3,"file":"style-guide.d.ts","sourceRoot":"","sources":["../../src/resources/style-guide.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,m6JAqLvB,CAAC"}
@@ -47,9 +47,9 @@ same package or a \`<package>_test\` package.
47
47
  ## Naming
48
48
 
49
49
  - Rule names: \`snake_case\`.
50
- - Boolean rules: read like predicates \`allow\`, \`is_admin\`,
50
+ - Boolean rules: read like predicates -- \`allow\`, \`is_admin\`,
51
51
  \`should_log\`. Avoid \`is_not_blocked\` (double negative).
52
- - Set/object rules: read like nouns \`grants\`, \`roles\`, \`reasons\`.
52
+ - Set/object rules: read like nouns -- \`grants\`, \`roles\`, \`reasons\`.
53
53
  - Helper rules: \`_\` prefix is *not* a convention; just give them names
54
54
  that explain what they return.
55
55
 
@@ -142,7 +142,7 @@ into compile errors instead of runtime undefineds.
142
142
  - **\`http.send\` in the decision path.** Each call adds round-trip
143
143
  latency. If you must, scope it to a small, cacheable read.
144
144
  - **Deep \`with\` chains.** \`x with input as ... with data as ...\` more
145
- than two layers deep is a smell the test is doing too much. Split.
145
+ than two layers deep is a smell -- the test is doing too much. Split.
146
146
  - **\`print\` and \`trace\`.** Useful in development; remove before
147
147
  shipping. Regal flags both as \`print-or-trace-call\`.
148
148
  - **Mixing \`if\` and the legacy implicit form in the same file.** Pick
package/dist/server.d.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
4
4
  import { type Config } from './config.js';
5
- export declare const SERVER_NAME = "orygn-opa-mcp";
6
- export declare const SERVER_VERSION = "0.1.2";
5
+ import { SERVER_NAME, SERVER_VERSION } from './constants.js';
6
+ export { SERVER_NAME, SERVER_VERSION };
7
7
  /**
8
8
  * Construct an `McpServer`, register every tool / prompt / resource
9
9
  * onto it, and return it. Exported for tests so they can drive a
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAQtD,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAC3C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAoBrD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BvE;AAED;;;;;;;GAOG;AACH,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAepE"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQ7D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAoBrD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BvE;AAED;;;;;;;GAOG;AACH,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAepE"}
package/dist/server.js CHANGED
@@ -1,25 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * @orygn/opa-mcp entry point.
3
+ * @orygn/opa-mcp -- entry point.
4
4
  *
5
5
  * Initializes the MCP server, registers tools/prompts/resources,
6
6
  * and connects the stdio transport.
7
7
  *
8
- * IMPORTANT: never write to stdout from anywhere in this process
8
+ * IMPORTANT: never write to stdout from anywhere in this process --
9
9
  * stdout is the MCP protocol channel. Use `logger` (file) or stderr.
10
10
  */
11
11
  import { pathToFileURL } from 'node:url';
12
12
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
13
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
14
  import { loadConfig } from './config.js';
15
+ import { SERVER_NAME, SERVER_VERSION } from './constants.js';
15
16
  import { initLogger, logger } from './lib/logger.js';
16
17
  import { OpaCli } from './lib/opa-cli.js';
17
18
  import { RegalCli } from './lib/regal-cli.js';
18
19
  import { registerPrompts } from './prompts/index.js';
19
20
  import { registerResources } from './resources/index.js';
20
21
  import { registerTools } from './tools/index.js';
21
- export const SERVER_NAME = 'orygn-opa-mcp';
22
- export const SERVER_VERSION = '0.1.2';
22
+ export { SERVER_NAME, SERVER_VERSION };
23
23
  /**
24
24
  * Construct an `McpServer`, register every tool / prompt / resource
25
25
  * onto it, and return it. Exported for tests so they can drive a
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAe,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE;QACpC,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAA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M,CAAC,CAAC;IAEnC,MAAM,SAAS,GAAG,SAAS,IAAI,IAAI,oBAAoB,EAAE,CAAC;IAC1D,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAE1D,iEAAiE;IACjE,KAAK,mBAAmB,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACxD,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY;IACnB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,IAAI,YAAY,EAAE,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC9B,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_capabilities` list OPA's built-in functions and feature flags.
2
+ * `rego_capabilities` -- list OPA's built-in functions and feature flags.
3
3
  *
4
4
  * Useful as a reference when authoring policies, especially for
5
5
  * answering "is `crypto.x509.parse_certificates` available?" without
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_check` type-check Rego using `opa check`.
2
+ * `rego_check` -- type-check Rego using `opa check`.
3
3
  *
4
4
  * Returns `{ valid: true }` when the policy passes. On failure,
5
5
  * returns the structured error report `opa check --format=json` writes
@@ -18,7 +18,7 @@ const RegoCheckInput = {
18
18
  strict: z
19
19
  .boolean()
20
20
  .optional()
21
- .describe('Enable strict mode fail on unused vars, deprecated builtins, etc.'),
21
+ .describe('Enable strict mode -- fail on unused vars, deprecated builtins, etc.'),
22
22
  capabilities: z
23
23
  .string()
24
24
  .optional()
@@ -37,7 +37,7 @@ export function registerRegoCheck(server, config) {
37
37
  return err('INVALID_INPUT', 'rego_check requires either `source` or at least one entry in `paths`.');
38
38
  }
39
39
  if (source && paths?.length) {
40
- return err('INVALID_INPUT', 'rego_check does not accept both `source` and `paths` pass one or the other.');
40
+ return err('INVALID_INPUT', 'rego_check does not accept both `source` and `paths` -- pass one or the other.');
41
41
  }
42
42
  let resolvedPaths;
43
43
  if (paths?.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/tools/authoring/check.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAC9F,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QA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5E,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_deps` static dependency analysis for a Rego ref.
2
+ * `rego_deps` -- static dependency analysis for a Rego ref.
3
3
  *
4
4
  * Wraps `opa deps`. Given a target like `data.example.allow`, returns
5
5
  * the base (input/data) and virtual (rule) document references the
@@ -36,7 +36,7 @@ export function registerRegoDeps(server, config) {
36
36
  if (subprocessFailure)
37
37
  return subprocessFailure;
38
38
  if (result.exitCode !== 0) {
39
- return err('INVALID_REGO', 'opa deps exited non-zero the policy did not compile or the ref is invalid.', { details: { stderr: result.stderr.trim(), ref } });
39
+ return err('INVALID_REGO', 'opa deps exited non-zero -- the policy did not compile or the ref is invalid.', { details: { stderr: result.stderr.trim(), ref } });
40
40
  }
41
41
  const parsed = tryParseJson(result.stdout);
42
42
  if (parsed === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"deps.js","sourceRoot":"","sources":["../../../src/tools/authoring/deps.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,yHAAyH,CAC1H;IACH,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,mEAAmE,CAAC;CACjF,CAAC;AAOF,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EA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C,KAAK,CAAC;YAE5C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YACnE,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC9D,IAAI,iBAAiB;gBAAE,OAAO,iBAAiB,CAAC;YAEhD,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO,GAAG,CACR,cAAc,EACd,+EAA+E,EAC/E,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,CACnD,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,YAAY,CAAiB,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,OAAO,GAAG,CAAC,eAAe,EAAE,6CAA6C,EAAE;oBACzE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;iBAC1C,CAAC,CAAC;YACL,CAAC;YACD,OAAO,EAAE,CAAiB,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_format` format Rego source via `opa fmt`.
2
+ * `rego_format` -- format Rego source via `opa fmt`.
3
3
  *
4
4
  * Idempotent: running it on already-formatted source produces
5
5
  * identical output and `changed: false`.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Category A Authoring & static analysis.
2
+ * Category A -- Authoring & static analysis.
3
3
  *
4
4
  * Tools in this category operate on Rego source code without requiring
5
5
  * a running OPA server. They wrap `opa fmt`, `opa check`, `opa parse`,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_inspect` inspect a bundle, directory, or single Rego file
2
+ * `rego_inspect` -- inspect a bundle, directory, or single Rego file
3
3
  * via `opa inspect`. Returns the manifest (if present), namespaces,
4
4
  * and rule annotations as JSON.
5
5
  */
@@ -30,7 +30,7 @@ export function registerRegoInspect(server, config) {
30
30
  if (subprocessFailure)
31
31
  return subprocessFailure;
32
32
  if (result.exitCode !== 0) {
33
- return err('INVALID_BUNDLE', 'opa inspect rejected the target it is not a valid bundle, directory, or Rego file.', {
33
+ return err('INVALID_BUNDLE', 'opa inspect rejected the target -- it is not a valid bundle, directory, or Rego file.', {
34
34
  details: { stderr: result.stderr.trim(), stdout: result.stdout.trim() },
35
35
  });
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../../src/tools/authoring/inspect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,gBAAgB,GAAG;IACvB,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,wEAAwE,CAAC;CACtF,CAAC;AASF,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAc;IACnE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/B,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,0BAA0B;QACjC,WAAW,EACT,2KAA2K;QAC7K,WAAW,EAAE,gBAAgB;KAC9B,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACnB,OAAO,gBAAgB,CAAoB,MAAM,EAAE,K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AQ,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO,GAAG,CACR,gBAAgB,EAChB,uFAAuF,EACvF;oBACE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;iBACxE,CACF,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,YAAY,CAAoB,MAAM,CAAC,MAAM,CAAC,CAAC;YAC9D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,OAAO,GAAG,CAAC,eAAe,EAAE,gDAAgD,EAAE;oBAC5E,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;iBAC1C,CAAC,CAAC;YACL,CAAC;YACD,OAAO,EAAE,CAAoB,MAAM,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_lint` lint Rego with the optional `regal` binary.
2
+ * `rego_lint` -- lint Rego with the optional `regal` binary.
3
3
  *
4
4
  * The only authoring tool that requires Regal. Returns
5
5
  * `REGAL_NOT_FOUND` with an install hint if the binary is missing.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_parse_ast` parse Rego source to a JSON AST.
2
+ * `rego_parse_ast` -- parse Rego source to a JSON AST.
3
3
  *
4
4
  * Wraps `opa parse --format=json`. Useful for tools that want to walk
5
5
  * the structure of a policy programmatically (rule discovery, ref
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `opa_bundle_build` build a deployable bundle from policy + data
2
+ * `opa_bundle_build` -- build a deployable bundle from policy + data
3
3
  * paths via `opa build`.
4
4
  */
5
5
  import { z } from 'zod';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Category C Bundle operations.
2
+ * Category C -- Bundle operations.
3
3
  *
4
4
  * Wraps `opa build` and `opa sign` for packaging and signing
5
5
  * deployable bundles.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `opa_bundle_sign` sign an existing bundle directory or archive
2
+ * `opa_bundle_sign` -- sign an existing bundle directory or archive
3
3
  * via `opa sign`.
4
4
  */
5
5
  import { z } from 'zod';
@@ -2,7 +2,7 @@
2
2
  * Shared helpers for the evaluation tool category.
3
3
  *
4
4
  * `rego_eval` and its three trace/profile/coverage variants all share
5
- * the same input/output shape and error handling only the OPA flags
5
+ * the same input/output shape and error handling -- only the OPA flags
6
6
  * differ. The shared `runEval` helper takes the resolved EvalInput and
7
7
  * returns an envelope; each tool's handler is a thin adapter that
8
8
  * preps inputs and forwards.
@@ -2,7 +2,7 @@
2
2
  * Shared helpers for the evaluation tool category.
3
3
  *
4
4
  * `rego_eval` and its three trace/profile/coverage variants all share
5
- * the same input/output shape and error handling only the OPA flags
5
+ * the same input/output shape and error handling -- only the OPA flags
6
6
  * differ. The shared `runEval` helper takes the resolved EvalInput and
7
7
  * returns an envelope; each tool's handler is a thin adapter that
8
8
  * preps inputs and forwards.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_bench` benchmark a query via `opa bench`.
2
+ * `rego_bench` -- benchmark a query via `opa bench`.
3
3
  *
4
4
  * Returns iteration count plus statistical timing data (ns/op,
5
5
  * allocations, etc.).
@@ -1,8 +1,8 @@
1
1
  /**
2
- * `rego_compile_query` partially evaluate a query.
2
+ * `rego_compile_query` -- partially evaluate a query.
3
3
  *
4
4
  * Wraps `opa eval --partial` with a defaulted `unknowns` set. The
5
- * result is a residual query what remains after substituting in
5
+ * result is a residual query -- what remains after substituting in
6
6
  * everything that's known. Useful for offline policy slicing.
7
7
  */
8
8
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
@@ -6,7 +6,7 @@ export function registerRegoCompileQuery(server, config) {
6
6
  const opa = new OpaCli(config);
7
7
  server.registerTool('rego_compile_query', {
8
8
  title: 'Partially evaluate a Rego query',
9
- description: 'Run partial evaluation on a query substitute known values and return the residual policy. Defaults `unknowns` to `["input"]` (treat input as unknown), so the residual encodes "given input X, this is what would have to be true." Use this for offline policy slicing or pre-computing decision sets.',
9
+ description: 'Run partial evaluation on a query -- substitute known values and return the residual policy. Defaults `unknowns` to `["input"]` (treat input as unknown), so the residual encodes "given input X, this is what would have to be true." Use this for offline policy slicing or pre-computing decision sets.',
10
10
  inputSchema: RegoCompileQueryInput,
11
11
  }, async (args) => {
12
12
  return withToolEnvelope(config, () => runEval(opa, config, {
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/tools/evaluation/compile.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAuB,MAAM,cAAc,CAAC;AAE7E,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,MAAc;IACxE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/B,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,iCAAiC;QACxC,WAAW,EACT,2SAA2S;QAC7S,WAAW,EAAE,qBAAqB;KACnC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO,gBAAgB,CAAiB,MAAM,EAAE,GAAG,EAAE,CACnD,OAAO,CACL,GAAG,EACH,MAAM,EACN;YACE,GAAG,IAAI;YACP,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;SAC5D,EACD,EAAE,CACH,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/tools/evaluation/compile.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAuB,MAAM,cAAc,CAAC;AAE7E,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,MAAc;IACxE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/B,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,iCAAiC;QACxC,WAAW,EACT,4SAA4S;QAC9S,WAAW,EAAE,qBAAqB;KACnC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO,gBAAgB,CAAiB,MAAM,EAAE,GAAG,EAAE,CACnD,OAAO,CACL,GAAG,EACH,MAAM,EACN;YACE,GAAG,IAAI;YACP,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;SAC5D,EACD,EAAE,CACH,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * `rego_eval` and the three flag-extended variants.
3
3
  *
4
- * Each variant is a thin adapter same input shape, different OPA
5
- * flags built on the shared `runEval` helper.
4
+ * Each variant is a thin adapter -- same input shape, different OPA
5
+ * flags -- built on the shared `runEval` helper.
6
6
  */
7
7
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
8
  import type { Config } from '../../config.js';
@@ -12,7 +12,7 @@ export function registerRegoEval(server, config) {
12
12
  });
13
13
  server.registerTool('rego_eval_with_explain', {
14
14
  title: 'Evaluate Rego with execution trace',
15
- description: "Evaluate with `--explain=full` and return a structured trace alongside the result. Use this when an agent needs to see why a rule fired (or didn't) the trace is the basis for `rego_explain_decision`.",
15
+ description: "Evaluate with `--explain=full` and return a structured trace alongside the result. Use this when an agent needs to see why a rule fired (or didn't) -- the trace is the basis for `rego_explain_decision`.",
16
16
  inputSchema: SharedEvalInput,
17
17
  }, async (args) => {
18
18
  return withToolEnvelope(config, () => runEval(opa, config, args, { explain: 'full' }));
@@ -1 +1 @@
1
- {"version":3,"file":"eval.js","sourceRoot":"","sources":["../../../src/tools/evaluation/eval.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,eAAe,EAAuB,MAAM,cAAc,CAAC;AAE7E,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,MAAc;IAChE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/B,MAAM,CAAC,YAAY,CACjB,WAAW,EACX;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,mKAAmK;QACrK,WAAW,EAAE,eAAe;KAC7B,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO,gBAAgB,CAAiB,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,wBAAwB,EACxB;QACE,KAAK,EAAE,oCAAoC;QAC3C,WAAW,EACT,2MAA2M;QAC7M,WAAW,EAAE,eAAe;KAC7B,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO,gBAAgB,CAAiB,MAAM,EAAE,GAAG,EAAE,CACnD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,E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ACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Category B Evaluation & testing.
2
+ * Category B -- Evaluation & testing.
3
3
  *
4
4
  * Tools in this category run Rego queries against policies + input,
5
5
  * with optional trace/profile/coverage output. They wrap `opa eval`,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `rego_test` run Rego unit tests via `opa test`.
2
+ * `rego_test` -- run Rego unit tests via `opa test`.
3
3
  *
4
4
  * Returns per-test pass/fail records. With `coverage: true`, returns
5
5
  * per-line coverage data alongside the test results.
@@ -0,0 +1,29 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { Config } from '../../config.js';
3
+ interface CoverageRange {
4
+ start: {
5
+ row: number;
6
+ col?: number;
7
+ };
8
+ end: {
9
+ row: number;
10
+ col?: number;
11
+ };
12
+ }
13
+ export interface FileCoverageGap {
14
+ file: string;
15
+ coveragePercent: number;
16
+ uncoveredRanges: CoverageRange[];
17
+ uncoveredLineCount: number;
18
+ }
19
+ export interface RegoCoverageGapsOutput {
20
+ overallCoverage: number;
21
+ totalFiles: number;
22
+ filesWithGaps: FileCoverageGap[];
23
+ testsPassed: number;
24
+ testsFailed: number;
25
+ testsSkipped: number;
26
+ }
27
+ export declare function registerRegoCoverageGaps(server: McpServer, config: Config): void;
28
+ export {};
29
+ //# sourceMappingURL=coverage-gaps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-gaps.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/coverage-gaps.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA4B9C,UAAU,aAAa;IACrB,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,GAAG,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAmBD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AA0CD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAiFhF"}