@orygn/opa-mcp 0.1.8 → 0.1.10
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/CHANGELOG.md +96 -1
- package/README.md +83 -34
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/lib/conftest-cli.d.ts +144 -0
- package/dist/lib/conftest-cli.d.ts.map +1 -0
- package/dist/lib/conftest-cli.js +224 -0
- package/dist/lib/conftest-cli.js.map +1 -0
- package/dist/lib/opa-cli.d.ts +17 -17
- package/dist/lib/opa-cli.d.ts.map +1 -1
- package/dist/lib/opa-cli.js +37 -35
- package/dist/lib/opa-cli.js.map +1 -1
- package/dist/lib/opa-client.d.ts +5 -0
- package/dist/lib/opa-client.d.ts.map +1 -1
- package/dist/lib/opa-client.js +12 -1
- package/dist/lib/opa-client.js.map +1 -1
- package/dist/lib/regal-cli.d.ts +4 -4
- package/dist/lib/regal-cli.d.ts.map +1 -1
- package/dist/lib/regal-cli.js +10 -8
- package/dist/lib/regal-cli.js.map +1 -1
- package/dist/lib/subprocess.d.ts +4 -0
- package/dist/lib/subprocess.d.ts.map +1 -1
- package/dist/lib/subprocess.js +24 -3
- package/dist/lib/subprocess.js.map +1 -1
- package/dist/lib/tool-helpers.d.ts +14 -1
- package/dist/lib/tool-helpers.d.ts.map +1 -1
- package/dist/lib/tool-helpers.js +36 -2
- package/dist/lib/tool-helpers.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +15 -4
- package/dist/server.js.map +1 -1
- package/dist/tools/authoring/capabilities.d.ts.map +1 -1
- package/dist/tools/authoring/capabilities.js +8 -2
- package/dist/tools/authoring/capabilities.js.map +1 -1
- package/dist/tools/authoring/check.d.ts.map +1 -1
- package/dist/tools/authoring/check.js +16 -4
- package/dist/tools/authoring/check.js.map +1 -1
- package/dist/tools/authoring/deps.d.ts.map +1 -1
- package/dist/tools/authoring/deps.js +8 -2
- package/dist/tools/authoring/deps.js.map +1 -1
- package/dist/tools/authoring/format.d.ts.map +1 -1
- package/dist/tools/authoring/format.js +8 -2
- package/dist/tools/authoring/format.js.map +1 -1
- package/dist/tools/authoring/inspect.d.ts.map +1 -1
- package/dist/tools/authoring/inspect.js +8 -2
- package/dist/tools/authoring/inspect.js.map +1 -1
- package/dist/tools/authoring/lint.d.ts.map +1 -1
- package/dist/tools/authoring/lint.js +11 -12
- package/dist/tools/authoring/lint.js.map +1 -1
- package/dist/tools/authoring/migrate-v1.d.ts.map +1 -1
- package/dist/tools/authoring/migrate-v1.js +15 -5
- package/dist/tools/authoring/migrate-v1.js.map +1 -1
- package/dist/tools/authoring/parse.d.ts.map +1 -1
- package/dist/tools/authoring/parse.js +8 -2
- package/dist/tools/authoring/parse.js.map +1 -1
- package/dist/tools/bundles/build.d.ts.map +1 -1
- package/dist/tools/bundles/build.js +8 -2
- package/dist/tools/bundles/build.js.map +1 -1
- package/dist/tools/bundles/sign.d.ts.map +1 -1
- package/dist/tools/bundles/sign.js +8 -2
- package/dist/tools/bundles/sign.js.map +1 -1
- package/dist/tools/bundles/verify.d.ts.map +1 -1
- package/dist/tools/bundles/verify.js +8 -2
- package/dist/tools/bundles/verify.js.map +1 -1
- package/dist/tools/conftest/index.d.ts +4 -0
- package/dist/tools/conftest/index.d.ts.map +1 -0
- package/dist/tools/conftest/index.js +11 -0
- package/dist/tools/conftest/index.js.map +1 -0
- package/dist/tools/conftest/pull.d.ts +10 -0
- package/dist/tools/conftest/pull.d.ts.map +1 -0
- package/dist/tools/conftest/pull.js +83 -0
- package/dist/tools/conftest/pull.js.map +1 -0
- package/dist/tools/conftest/push.d.ts +10 -0
- package/dist/tools/conftest/push.d.ts.map +1 -0
- package/dist/tools/conftest/push.js +76 -0
- package/dist/tools/conftest/push.js.map +1 -0
- package/dist/tools/conftest/test.d.ts +21 -0
- package/dist/tools/conftest/test.d.ts.map +1 -0
- package/dist/tools/conftest/test.js +186 -0
- package/dist/tools/conftest/test.js.map +1 -0
- package/dist/tools/conftest/verify.d.ts +21 -0
- package/dist/tools/conftest/verify.d.ts.map +1 -0
- package/dist/tools/conftest/verify.js +112 -0
- package/dist/tools/conftest/verify.js.map +1 -0
- package/dist/tools/evaluation/_shared.d.ts +1 -1
- package/dist/tools/evaluation/_shared.d.ts.map +1 -1
- package/dist/tools/evaluation/_shared.js +2 -2
- package/dist/tools/evaluation/_shared.js.map +1 -1
- package/dist/tools/evaluation/bench.d.ts.map +1 -1
- package/dist/tools/evaluation/bench.js +8 -2
- package/dist/tools/evaluation/bench.js.map +1 -1
- package/dist/tools/evaluation/compile.d.ts.map +1 -1
- package/dist/tools/evaluation/compile.js +8 -2
- package/dist/tools/evaluation/compile.js.map +1 -1
- package/dist/tools/evaluation/eval.d.ts.map +1 -1
- package/dist/tools/evaluation/eval.js +32 -8
- package/dist/tools/evaluation/eval.js.map +1 -1
- package/dist/tools/evaluation/exec.d.ts.map +1 -1
- package/dist/tools/evaluation/exec.js +8 -2
- package/dist/tools/evaluation/exec.js.map +1 -1
- package/dist/tools/evaluation/test.d.ts.map +1 -1
- package/dist/tools/evaluation/test.js +8 -2
- package/dist/tools/evaluation/test.js.map +1 -1
- package/dist/tools/helpers/coverage-gaps.d.ts.map +1 -1
- package/dist/tools/helpers/coverage-gaps.js +8 -2
- package/dist/tools/helpers/coverage-gaps.js.map +1 -1
- package/dist/tools/helpers/describe-policy.d.ts.map +1 -1
- package/dist/tools/helpers/describe-policy.js +8 -2
- package/dist/tools/helpers/describe-policy.js.map +1 -1
- package/dist/tools/helpers/explain-decision.d.ts.map +1 -1
- package/dist/tools/helpers/explain-decision.js +8 -2
- package/dist/tools/helpers/explain-decision.js.map +1 -1
- package/dist/tools/helpers/fix.d.ts.map +1 -1
- package/dist/tools/helpers/fix.js +8 -2
- package/dist/tools/helpers/fix.js.map +1 -1
- package/dist/tools/helpers/format-write.d.ts.map +1 -1
- package/dist/tools/helpers/format-write.js +9 -3
- package/dist/tools/helpers/format-write.js.map +1 -1
- package/dist/tools/helpers/generate-test-skeleton.d.ts.map +1 -1
- package/dist/tools/helpers/generate-test-skeleton.js +8 -2
- package/dist/tools/helpers/generate-test-skeleton.js.map +1 -1
- package/dist/tools/helpers/infer-input-schema.d.ts.map +1 -1
- package/dist/tools/helpers/infer-input-schema.js +9 -3
- package/dist/tools/helpers/infer-input-schema.js.map +1 -1
- package/dist/tools/helpers/policy-diff.d.ts.map +1 -1
- package/dist/tools/helpers/policy-diff.js +11 -2
- package/dist/tools/helpers/policy-diff.js.map +1 -1
- package/dist/tools/helpers/security-audit.d.ts.map +1 -1
- package/dist/tools/helpers/security-audit.js +8 -2
- package/dist/tools/helpers/security-audit.js.map +1 -1
- package/dist/tools/helpers/suggest-fix.d.ts.map +1 -1
- package/dist/tools/helpers/suggest-fix.js +6 -0
- package/dist/tools/helpers/suggest-fix.js.map +1 -1
- package/dist/tools/index.d.ts +11 -9
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/meta/server-info.d.ts.map +1 -1
- package/dist/tools/meta/server-info.js +9 -3
- package/dist/tools/meta/server-info.js.map +1 -1
- package/dist/tools/server-management/_shared.d.ts.map +1 -1
- package/dist/tools/server-management/_shared.js +4 -1
- package/dist/tools/server-management/_shared.js.map +1 -1
- package/dist/tools/server-management/data.d.ts.map +1 -1
- package/dist/tools/server-management/data.js +32 -4
- package/dist/tools/server-management/data.js.map +1 -1
- package/dist/tools/server-management/decisions.d.ts.map +1 -1
- package/dist/tools/server-management/decisions.js +16 -2
- package/dist/tools/server-management/decisions.js.map +1 -1
- package/dist/tools/server-management/policies.d.ts.map +1 -1
- package/dist/tools/server-management/policies.js +32 -4
- package/dist/tools/server-management/policies.js.map +1 -1
- package/dist/tools/server-management/status.d.ts.map +1 -1
- package/dist/tools/server-management/status.js +24 -4
- package/dist/tools/server-management/status.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,100 @@ not part of the public surface and may change in minor releases.
|
|
|
17
17
|
|
|
18
18
|
## [Unreleased]
|
|
19
19
|
|
|
20
|
+
## [0.1.10] - 2026-05-22
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **Conftest integration (4 new tools, 47 total)** -- adds `conftest_test`,
|
|
25
|
+
`conftest_verify`, `conftest_pull`, and `conftest_push`, wrapping the
|
|
26
|
+
[conftest](https://www.conftest.dev/) CLI for policy testing of Kubernetes,
|
|
27
|
+
Terraform, Helm, Dockerfile, and other configuration formats. Conftest is
|
|
28
|
+
optional; all existing tools continue to work without it installed.
|
|
29
|
+
|
|
30
|
+
- **`conftest_test`** -- runs `conftest test` against one or more configuration
|
|
31
|
+
files and returns structured JSON pass/fail/warn results per namespace. Supports
|
|
32
|
+
inline configuration (written to a secure temp file, path redacted from output)
|
|
33
|
+
and inline Rego policy (written to a secure temp dir), multiple data directories,
|
|
34
|
+
namespace targeting, `--all-namespaces`, `--combine`, and `--fail-on-warn`.
|
|
35
|
+
|
|
36
|
+
- **`conftest_verify`** -- runs `conftest verify` to execute `_test.rego` unit
|
|
37
|
+
tests inside a policy directory, verifying that the policies themselves are
|
|
38
|
+
correct. Returns structured JSON output.
|
|
39
|
+
|
|
40
|
+
- **`conftest_pull`** -- pulls a policy bundle from a remote OCI or Git registry
|
|
41
|
+
into a local directory (`oci://registry/repo:tag` form).
|
|
42
|
+
|
|
43
|
+
- **`conftest_push`** -- pushes a local policy bundle to a remote OCI registry,
|
|
44
|
+
using host-environment credentials (docker login / ORAS).
|
|
45
|
+
|
|
46
|
+
- **`CONFTEST_NOT_FOUND` error code** -- returned by all four conftest tools when
|
|
47
|
+
the binary is absent, with a structured install hint. Consistent with the
|
|
48
|
+
existing `OPA_BINARY_NOT_FOUND` and `REGAL_NOT_FOUND` pattern.
|
|
49
|
+
|
|
50
|
+
- **`CONFTEST_BINARY` environment variable** -- configures the path to the conftest
|
|
51
|
+
binary. Defaults to `conftest` on PATH.
|
|
52
|
+
|
|
53
|
+
### Security
|
|
54
|
+
|
|
55
|
+
- Temp files for inline config and inline policy are now created via `mkdtemp`
|
|
56
|
+
(atomically, with `O_CREAT|O_EXCL` semantics at the OS level) rather than
|
|
57
|
+
constructing a path from `os.tmpdir()` and a UUID. This eliminates the TOCTOU
|
|
58
|
+
race window flagged by CodeQL CWE-377.
|
|
59
|
+
|
|
60
|
+
### Internal
|
|
61
|
+
|
|
62
|
+
- `src/lib/conftest-cli.ts`: `ConftestCli` class with `withTempAssets()` temp
|
|
63
|
+
file lifecycle management and `sanitizeOutput()` for redacting internal paths
|
|
64
|
+
from conftest JSON output. Path redaction uses `JSON.stringify` encoding to
|
|
65
|
+
correctly handle backslashes in Windows paths embedded in JSON output.
|
|
66
|
+
- Exit-code semantics: 0 and 1 both produce valid JSON (pass/fail respectively);
|
|
67
|
+
exit 2+ is a command error surfaced as `UNKNOWN_ERROR`.
|
|
68
|
+
- Tests: 57 tool-layer unit tests, 46 CLI unit tests, 12 real-binary integration
|
|
69
|
+
tests (auto-skipped when conftest is not on PATH).
|
|
70
|
+
|
|
71
|
+
## [0.1.9] - 2026-05-21
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
|
|
75
|
+
- **AbortSignal cancellation** -- all 43 tool handlers now wire the MCP SDK's
|
|
76
|
+
`extra.signal` into every subprocess spawn and OPA HTTP request. When a client
|
|
77
|
+
sends `notifications/cancelled`, in-flight work is actually terminated:
|
|
78
|
+
subprocess receives SIGTERM followed by SIGKILL escalation after 2 seconds;
|
|
79
|
+
HTTP fetches are aborted via `AbortSignal.any()` combining the existing
|
|
80
|
+
per-request timeout with the external client signal.
|
|
81
|
+
|
|
82
|
+
- **`CANCELLED` error code** -- added to `ToolErrorCode`. Returned to the caller
|
|
83
|
+
when a tool is interrupted mid-flight by client cancellation, rather than
|
|
84
|
+
surfacing a misleading `TIMEOUT` or `OPA_BINARY_NOT_FOUND` code.
|
|
85
|
+
|
|
86
|
+
- **`OpaCancelledError`** -- new error class in `OpaClient`. Thrown when a
|
|
87
|
+
fetch aborts because the client signal fired (not a network failure), so
|
|
88
|
+
`mapOpaClientError` can map it precisely to `CANCELLED`.
|
|
89
|
+
|
|
90
|
+
- **Tool annotations, instructions, and path sanitization (MCP spec 2025-11-25)**
|
|
91
|
+
-- all 43 tools now declare `readOnlyHint`, `destructiveHint`, `idempotentHint`,
|
|
92
|
+
and `openWorldHint` in their `annotations` block per the MCP spec. Server
|
|
93
|
+
registers `instructions` at startup describing the tool set. All file path
|
|
94
|
+
arguments validated through a hardened `validatePath` helper that normalises
|
|
95
|
+
Windows drive-letter casing and resolves symlinks before allow-list comparison,
|
|
96
|
+
closing a bypass that existed when a symlink target escaped the allowed root.
|
|
97
|
+
|
|
98
|
+
### Changed
|
|
99
|
+
|
|
100
|
+
- **`@modelcontextprotocol/sdk` pinned to `^1.29.0`** -- the minimum version that
|
|
101
|
+
exposes `annotations` on `RegisteredTool` and passes `extra.signal` to handlers.
|
|
102
|
+
|
|
103
|
+
### Internal
|
|
104
|
+
|
|
105
|
+
- `subprocess.ts`: `SpawnResult` gains `aborted: boolean`; `SpawnOptions` gains
|
|
106
|
+
`signal?: AbortSignal`. Early-return path if signal is pre-aborted; abort
|
|
107
|
+
listener shares the SIGTERM->SIGKILL escalation helper with the timeout path.
|
|
108
|
+
- `tool-helpers.ts`: `mapSubprocessFailure` checks `result.aborted` before
|
|
109
|
+
`exitCode === null` so cancellation takes priority over binary-not-found.
|
|
110
|
+
- Tests: all mock `SpawnResult` objects updated to include `aborted: false`;
|
|
111
|
+
`callTool` helper passes `{ signal }` as second argument; two new deterministic
|
|
112
|
+
abort path tests in `subprocess.test.ts`.
|
|
113
|
+
|
|
20
114
|
## [0.1.8] - 2026-05-21
|
|
21
115
|
|
|
22
116
|
### Added
|
|
@@ -514,7 +608,8 @@ wrappers end-to-end. CI matrix: Ubuntu, macOS, and Windows on Node
|
|
|
514
608
|
20 and 22, plus CodeQL security scanning and weekly Dependabot updates
|
|
515
609
|
for npm, GitHub Actions, and Docker base images.
|
|
516
610
|
|
|
517
|
-
[Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.
|
|
611
|
+
[Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.9...HEAD
|
|
612
|
+
[0.1.9]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.8...v0.1.9
|
|
518
613
|
[0.1.8]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.7...v0.1.8
|
|
519
614
|
[0.1.7]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.6...v0.1.7
|
|
520
615
|
[0.1.6]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.5...v0.1.6
|
package/README.md
CHANGED
|
@@ -15,13 +15,13 @@ VS Code, Windsurf, Zed, and others) into a first-class
|
|
|
15
15
|
environment.
|
|
16
16
|
|
|
17
17
|
```
|
|
18
|
-
+--------------------+ MCP / stdio +-----------------+ spawn / HTTP
|
|
19
|
-
| Claude · Cursor · | ------------> | @orygn/opa-mcp | -------------> | opa · regal ·
|
|
20
|
-
| VS Code · ... | <------------ | | <------------- | OPA REST API
|
|
21
|
-
+--------------------+
|
|
18
|
+
+--------------------+ MCP / stdio +-----------------+ spawn / HTTP +------------------------+
|
|
19
|
+
| Claude · Cursor · | ------------> | @orygn/opa-mcp | -------------> | opa · regal · conftest |
|
|
20
|
+
| VS Code · ... | <------------ | | <------------- | OPA REST API |
|
|
21
|
+
+--------------------+ 47 tools +-----------------+ +------------------------+
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
> **Status:** v0.1.
|
|
24
|
+
> **Status:** v0.1.10. Tool surface, error codes, and
|
|
25
25
|
> environment variables follow [SemVer](https://semver.org/) from
|
|
26
26
|
> v0.1.0 forward.
|
|
27
27
|
|
|
@@ -241,6 +241,7 @@ variable is optional; defaults are sensible for a local OPA on
|
|
|
241
241
|
| `OPA_TOKEN` | _(unset)_ | Bearer token for OPA, if your instance requires auth. Treated as a secret. Never echoed in logs or tool responses. |
|
|
242
242
|
| `OPA_BINARY` | `opa` (on `PATH`) | Path to the `opa` CLI, used by `rego_*` tools. |
|
|
243
243
|
| `REGAL_BINARY` | `regal` (on `PATH`) | Path to the `regal` linter. Only required by `rego_lint`. |
|
|
244
|
+
| `CONFTEST_BINARY` | `conftest` (on `PATH`) | Path to the `conftest` binary. Only required by `conftest_*` tools. Returns `CONFTEST_NOT_FOUND` if absent. |
|
|
244
245
|
| `OPA_MCP_ALLOWED_PATHS` | _(unset)_ | Comma- or semicolon-separated list of directories the server is allowed to read policies from. **When unset, file-based tools refuse to read from disk.** |
|
|
245
246
|
| `OPA_MCP_LOG_FILE` | `<tmpdir>/orygn-opa-mcp.log` | Path the server appends logs to. The server never writes to stdout; that channel is reserved for the MCP protocol. |
|
|
246
247
|
| `OPA_MCP_LOG_LEVEL` | `info` | One of `debug`, `info`, `warn`, `error`. |
|
|
@@ -264,7 +265,7 @@ Every tool returns a JSON envelope:
|
|
|
264
265
|
Stable error codes: `INVALID_INPUT`, `INVALID_REGO`, `INVALID_BUNDLE`,
|
|
265
266
|
`EVAL_ERROR`, `OPA_BINARY_NOT_FOUND`, `REGAL_NOT_FOUND`,
|
|
266
267
|
`REGAL_VERSION_TOO_OLD`, `OPA_UNREACHABLE`, `OPA_AUTH_FAILED`,
|
|
267
|
-
`POLICY_NOT_FOUND`, `PATH_NOT_ALLOWED`, `PATH_NOT_FOUND`,
|
|
268
|
+
`POLICY_NOT_FOUND`, `DATA_NOT_FOUND`, `PATH_NOT_ALLOWED`, `PATH_NOT_FOUND`,
|
|
268
269
|
`DEPENDENCY_CONFLICT`, `NO_TESTS_FOUND`, `HTTP_SEND_BLOCKED`, `TIMEOUT`,
|
|
269
270
|
`UNKNOWN_ERROR`.
|
|
270
271
|
|
|
@@ -274,15 +275,16 @@ Operate on Rego source code without needing a running OPA server. Wrap
|
|
|
274
275
|
`opa fmt`, `opa parse`, `opa check`, `opa inspect`, `opa capabilities`,
|
|
275
276
|
`opa deps`, and `regal`.
|
|
276
277
|
|
|
277
|
-
| Tool | What it does
|
|
278
|
-
| ------------------- |
|
|
279
|
-
| `rego_format` | Format Rego source. Wraps `opa fmt`. Idempotent.
|
|
280
|
-
| `rego_check` | Type-check and validate Rego. Wraps `opa check`.
|
|
281
|
-
| `rego_lint` | Run Regal across a file or directory. Returns findings grouped by category. **Requires `regal` on `PATH` or `REGAL_BINARY` set.**
|
|
282
|
-
| `rego_parse_ast` | Parse Rego to AST JSON. Wraps `opa parse`.
|
|
283
|
-
| `rego_inspect` | Inspect a bundle or directory: packages, rules, annotations. Wraps `opa inspect`.
|
|
284
|
-
| `rego_capabilities` | Return the capabilities (built-ins, future keywords) understood by the bundled OPA.
|
|
285
|
-
| `rego_deps` | Static dependency analysis: rule-level data references and cross-package calls.
|
|
278
|
+
| Tool | What it does |
|
|
279
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
280
|
+
| `rego_format` | Format Rego source. Wraps `opa fmt`. Idempotent. |
|
|
281
|
+
| `rego_check` | Type-check and validate Rego. Wraps `opa check`. |
|
|
282
|
+
| `rego_lint` | Run Regal across a file or directory. Returns findings grouped by category. **Requires `regal` on `PATH` or `REGAL_BINARY` set.** |
|
|
283
|
+
| `rego_parse_ast` | Parse Rego to AST JSON. Wraps `opa parse`. |
|
|
284
|
+
| `rego_inspect` | Inspect a bundle or directory: packages, rules, annotations. Wraps `opa inspect`. |
|
|
285
|
+
| `rego_capabilities` | Return the capabilities (built-ins, future keywords) understood by the bundled OPA. |
|
|
286
|
+
| `rego_deps` | Static dependency analysis: rule-level data references and cross-package calls. |
|
|
287
|
+
| `rego_migrate_v1` | Migrate Rego v0 source to v1 syntax. Runs `opa fmt --rego-v1` then validates with `opa check --v1-compatible`. Returns `{ original, migrated, changed, valid, errors }`. |
|
|
286
288
|
|
|
287
289
|
#### Featured: `rego_format`
|
|
288
290
|
|
|
@@ -332,15 +334,16 @@ Operate on Rego source code without needing a running OPA server. Wrap
|
|
|
332
334
|
Run a query against a policy and input. Wrap `opa eval`, `opa test`, and
|
|
333
335
|
`opa bench`.
|
|
334
336
|
|
|
335
|
-
| Tool | What it does
|
|
336
|
-
| ------------------------- |
|
|
337
|
-
| `rego_eval` | Evaluate a query against a policy and input. The bread-and-butter tool.
|
|
338
|
-
| `rego_eval_with_explain` | Evaluate with `--explain=full` and return a structured trace.
|
|
339
|
-
| `rego_eval_with_profile` | Evaluate with `--profile` and return per-rule timing and evaluation counts.
|
|
340
|
-
| `rego_eval_with_coverage` | Evaluate with `--coverage` and return per-line coverage.
|
|
341
|
-
| `rego_test` | Run `opa test` over a directory. Returns pass/fail per test, with optional coverage.
|
|
342
|
-
| `rego_bench` | Run `opa bench` and return statistical timing data.
|
|
343
|
-
| `rego_compile_query` | Partially evaluate a query against a policy.
|
|
337
|
+
| Tool | What it does |
|
|
338
|
+
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
339
|
+
| `rego_eval` | Evaluate a query against a policy and input. The bread-and-butter tool. |
|
|
340
|
+
| `rego_eval_with_explain` | Evaluate with `--explain=full` and return a structured trace. |
|
|
341
|
+
| `rego_eval_with_profile` | Evaluate with `--profile` and return per-rule timing and evaluation counts. |
|
|
342
|
+
| `rego_eval_with_coverage` | Evaluate with `--coverage` and return per-line coverage. |
|
|
343
|
+
| `rego_test` | Run `opa test` over a directory. Returns pass/fail per test, with optional coverage. |
|
|
344
|
+
| `rego_bench` | Run `opa bench` and return statistical timing data. |
|
|
345
|
+
| `rego_compile_query` | Partially evaluate a query against a policy. |
|
|
346
|
+
| `opa_exec` | Batch-evaluate a decision against multiple input files. Returns per-file results with `successCount` and `errorCount`. |
|
|
344
347
|
|
|
345
348
|
#### Featured: `rego_eval`
|
|
346
349
|
|
|
@@ -365,10 +368,11 @@ Run a query against a policy and input. Wrap `opa eval`, `opa test`, and
|
|
|
365
368
|
|
|
366
369
|
Package and sign deployable bundles. Wrap `opa build` and `opa sign`.
|
|
367
370
|
|
|
368
|
-
| Tool
|
|
369
|
-
|
|
|
370
|
-
| `opa_bundle_build`
|
|
371
|
-
| `opa_bundle_sign`
|
|
371
|
+
| Tool | What it does |
|
|
372
|
+
| ------------------- | ------------------------------------------------------------------------------------------------- |
|
|
373
|
+
| `opa_bundle_build` | Build a `.tar.gz` bundle from a policy directory. Supports `optimize` and `revision`. |
|
|
374
|
+
| `opa_bundle_sign` | Sign a bundle with a private key. Returns `.signatures.json` content. |
|
|
375
|
+
| `opa_bundle_verify` | Verify the signature of a signed bundle using a public key. Returns `{ bundle, verified: true }`. |
|
|
372
376
|
|
|
373
377
|
### Category D: OPA server management
|
|
374
378
|
|
|
@@ -384,6 +388,7 @@ point at a reachable server.
|
|
|
384
388
|
| `opa_get_data` | Read a path from the data hierarchy. |
|
|
385
389
|
| `opa_put_data` | Write to a path in the data hierarchy. |
|
|
386
390
|
| `opa_patch_data` | Apply a JSON Patch to the data hierarchy. |
|
|
391
|
+
| `opa_delete_data` | Delete a document from the data hierarchy. |
|
|
387
392
|
| `opa_query_decision` | POST to a `/v1/data/...` decision endpoint with input. |
|
|
388
393
|
| `opa_compile_query` | Partially evaluate a query against the running server. |
|
|
389
394
|
| `opa_health` | Liveness / readiness check. |
|
|
@@ -408,15 +413,59 @@ the tasks agents are actually asked to do.
|
|
|
408
413
|
| `rego_format_write` | Run `opa fmt --write` to canonically format one or more Rego files or directories in place. Use `dryRun: true` to list which files would change without modifying them. Validates all files parse successfully before writing any. Supports `regoV1`, `v0Compatible`, and `v1Compatible` flags. Only requires `opa`. |
|
|
409
414
|
| `rego_policy_diff` | Evaluate the same query against two policies in parallel and compare the results. Returns `equal: true/false`, the raw value from each side (`resultA`/`resultB`), and `changedPaths` -- dot/bracket JSON paths that differ. Each side takes inline source or a file/directory path. Useful for verifying refactor equivalence or mapping divergence between two policy versions. |
|
|
410
415
|
|
|
411
|
-
### Category F:
|
|
416
|
+
### Category F: Conftest (configuration policy testing)
|
|
412
417
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
418
|
+
Test Kubernetes manifests, Terraform plans, Dockerfiles, Helm charts, and any
|
|
419
|
+
YAML/JSON/HCL/TOML/INI against Rego policies using
|
|
420
|
+
[conftest](https://www.conftest.dev/). Requires `conftest` on `PATH` or
|
|
421
|
+
`CONFTEST_BINARY` set; all four tools return `CONFTEST_NOT_FOUND` otherwise.
|
|
422
|
+
|
|
423
|
+
| Tool | What it does |
|
|
424
|
+
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
425
|
+
| `conftest_test` | Evaluate configuration files against policies with `conftest test`. Accepts file paths or `inlineConfig` (inline YAML/JSON/HCL/etc) and `policy` path or `inlinePolicy` source. Returns per-file pass/fail/warn results and a summary. |
|
|
426
|
+
| `conftest_verify` | Run `test_*` rules inside `*_test.rego` files to verify the policies themselves are correct. Equivalent to `opa test` but using conftest's policy-loading machinery. |
|
|
427
|
+
| `conftest_pull` | Pull a policy bundle from an OCI registry or Git repo into a local directory with `conftest pull`. The target directory need not exist; conftest creates it. |
|
|
428
|
+
| `conftest_push` | Package a local policy directory as an OCI artifact and push to a registry with `conftest push`. Registry credentials come from the host environment (`docker login`, ORAS keychain, etc.) -- credentials are never passed through tools. |
|
|
429
|
+
|
|
430
|
+
#### Featured: `conftest_test` with inline config
|
|
431
|
+
|
|
432
|
+
```jsonc
|
|
433
|
+
// Input
|
|
434
|
+
{
|
|
435
|
+
"inlineConfig": "apiVersion: v1\nkind: Pod\nspec:\n containers:\n - name: app\n image: nginx:latest",
|
|
436
|
+
"inlinePolicy": "package main\ndeny[msg] { input.spec.containers[_].image == \"nginx:latest\"; msg := \"pin your image tag\" }"
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Output
|
|
440
|
+
{
|
|
441
|
+
"ok": true,
|
|
442
|
+
"data": {
|
|
443
|
+
"passed": false,
|
|
444
|
+
"results": [
|
|
445
|
+
{
|
|
446
|
+
"filename": "<inline>",
|
|
447
|
+
"namespace": "main",
|
|
448
|
+
"successes": 0,
|
|
449
|
+
"failures": [{ "msg": "pin your image tag" }],
|
|
450
|
+
"warnings": [],
|
|
451
|
+
"skipped": [],
|
|
452
|
+
"exceptions": []
|
|
453
|
+
}
|
|
454
|
+
],
|
|
455
|
+
"summary": { "passed": 0, "failed": 1, "warnings": 0, "skipped": 0 }
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Category G: Meta
|
|
461
|
+
|
|
462
|
+
| Tool | What it does |
|
|
463
|
+
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
464
|
+
| `mcp_server_info` | Return server name, version, resolved `opa`/`regal`/`conftest` versions, transport type, and Node.js version in one call. Useful for verifying which server instance the agent is connected to. |
|
|
416
465
|
|
|
417
466
|
## Prompts
|
|
418
467
|
|
|
419
|
-
Three [MCP prompts](https://modelcontextprotocol.io/specification/server/prompts)
|
|
468
|
+
Three [MCP prompts](https://modelcontextprotocol.io/specification/2025-11-25/server/prompts)
|
|
420
469
|
ship with the server. Clients surface them as slash commands or workflow
|
|
421
470
|
templates.
|
|
422
471
|
|
|
@@ -428,7 +477,7 @@ templates.
|
|
|
428
477
|
|
|
429
478
|
## Resources
|
|
430
479
|
|
|
431
|
-
Three [MCP resources](https://modelcontextprotocol.io/specification/server/resources)
|
|
480
|
+
Three [MCP resources](https://modelcontextprotocol.io/specification/2025-11-25/server/resources)
|
|
432
481
|
expose curated reference data the agent can read at any time.
|
|
433
482
|
|
|
434
483
|
| Resource URI | What's there |
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiC1C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiC1C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAiD/C;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAgBxE;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAMA"}
|
package/dist/cli.js
CHANGED
|
@@ -30,6 +30,7 @@ export function formatHelp(col) {
|
|
|
30
30
|
const rows = [
|
|
31
31
|
['OPA_BINARY', 'opa binary path', 'opa'],
|
|
32
32
|
['REGAL_BINARY', 'regal binary path', 'regal'],
|
|
33
|
+
['CONFTEST_BINARY', 'conftest binary path', 'conftest'],
|
|
33
34
|
['OPA_URL', 'OPA server base URL', 'http://localhost:8181'],
|
|
34
35
|
['OPA_TOKEN', 'OPA authentication token', ''],
|
|
35
36
|
['OPA_MCP_ALLOWED_PATHS', 'allowed filesystem roots, comma or semicolon separated', ''],
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","s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,OAAO,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
8
8
|
opaBinary: z.ZodDefault<z.ZodString>;
|
|
9
9
|
/** Path to the `regal` binary. Defaults to `regal` on PATH. */
|
|
10
10
|
regalBinary: z.ZodDefault<z.ZodString>;
|
|
11
|
+
/** Path to the `conftest` binary. Defaults to `conftest` on PATH. */
|
|
12
|
+
conftestBinary: z.ZodDefault<z.ZodString>;
|
|
11
13
|
/** Hard timeout in ms for any spawned subprocess (opa, regal). */
|
|
12
14
|
subprocessTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
13
15
|
/** HTTP request timeout for OPA REST API calls. */
|
|
@@ -33,6 +35,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
33
35
|
opaUrl: string;
|
|
34
36
|
opaBinary: string;
|
|
35
37
|
regalBinary: string;
|
|
38
|
+
conftestBinary: string;
|
|
36
39
|
subprocessTimeoutMs: number;
|
|
37
40
|
httpTimeoutMs: number;
|
|
38
41
|
allowedPaths: string[];
|
|
@@ -45,6 +48,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
45
48
|
opaToken?: string | undefined;
|
|
46
49
|
opaBinary?: string | undefined;
|
|
47
50
|
regalBinary?: string | undefined;
|
|
51
|
+
conftestBinary?: string | undefined;
|
|
48
52
|
subprocessTimeoutMs?: number | undefined;
|
|
49
53
|
httpTimeoutMs?: number | undefined;
|
|
50
54
|
allowedPaths?: string[] | undefined;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,YAAY;IAChB,wEAAwE;;IAGxE,2EAA2E;;IAG3E,2DAA2D;;IAG3D,+DAA+D;;IAG/D,kEAAkE;;IAGlE,mDAAmD;;IAGnD;;;;;OAKG;;IAGH,uEAAuE;;IAGvE,qCAAqC;;IAGrC;;;;OAIG
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,YAAY;IAChB,wEAAwE;;IAGxE,2EAA2E;;IAG3E,2DAA2D;;IAG3D,+DAA+D;;IAG/D,qEAAqE;;IAGrE,kEAAkE;;IAGlE,mDAAmD;;IAGnD;;;;;OAKG;;IAGH,uEAAuE;;IAGvE,qCAAqC;;IAGrC;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAyBlD,wBAAgB,UAAU,IAAI,MAAM,CAgCnC"}
|
package/dist/config.js
CHANGED
|
@@ -17,6 +17,8 @@ const ConfigSchema = z.object({
|
|
|
17
17
|
opaBinary: z.string().default('opa'),
|
|
18
18
|
/** Path to the `regal` binary. Defaults to `regal` on PATH. */
|
|
19
19
|
regalBinary: z.string().default('regal'),
|
|
20
|
+
/** Path to the `conftest` binary. Defaults to `conftest` on PATH. */
|
|
21
|
+
conftestBinary: z.string().default('conftest'),
|
|
20
22
|
/** Hard timeout in ms for any spawned subprocess (opa, regal). */
|
|
21
23
|
subprocessTimeoutMs: z.coerce.number().int().positive().default(30_000),
|
|
22
24
|
/** HTTP request timeout for OPA REST API calls. */
|
|
@@ -53,6 +55,7 @@ const ENV_VAR_NAMES = {
|
|
|
53
55
|
opaToken: 'OPA_TOKEN',
|
|
54
56
|
opaBinary: 'OPA_BINARY',
|
|
55
57
|
regalBinary: 'REGAL_BINARY',
|
|
58
|
+
conftestBinary: 'CONFTEST_BINARY',
|
|
56
59
|
subprocessTimeoutMs: 'OPA_MCP_TIMEOUT_MS',
|
|
57
60
|
httpTimeoutMs: 'OPA_MCP_HTTP_TIMEOUT_MS',
|
|
58
61
|
allowedPaths: 'OPA_MCP_ALLOWED_PATHS',
|
|
@@ -67,6 +70,7 @@ export function loadConfig() {
|
|
|
67
70
|
opaToken: process.env['OPA_TOKEN'],
|
|
68
71
|
opaBinary: process.env['OPA_BINARY'],
|
|
69
72
|
regalBinary: process.env['REGAL_BINARY'],
|
|
73
|
+
conftestBinary: process.env['CONFTEST_BINARY'],
|
|
70
74
|
subprocessTimeoutMs: process.env['OPA_MCP_TIMEOUT_MS'],
|
|
71
75
|
httpTimeoutMs: process.env['OPA_MCP_HTTP_TIMEOUT_MS'],
|
|
72
76
|
allowedPaths,
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,wEAAwE;IACxE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC;IAEzD,2EAA2E;IAC3E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAE/B,2DAA2D;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAEpC,+DAA+D;IAC/D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;IAExC,kEAAkE;IAClE,mBAAmB,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC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K,QAAQ,IAAI,KAAK,IAAI,aAAa;gBACjD,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;gBACtB,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;YACjC,OAAO,CAAC,KAAK,CAAC,KAAK,MAAM,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAC3C,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,WAAW,kBAAkB,CAAC;AAC3C,eAAO,MAAM,cAAc,WAAW,CAAC"}
|
package/dist/constants.js
CHANGED
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Config } from '../config.js';
|
|
2
|
+
import { type SpawnResult } from './subprocess.js';
|
|
3
|
+
/**
|
|
4
|
+
* A single denial or warning message returned by conftest. The `metadata`
|
|
5
|
+
* field carries any structured data attached via the `{"msg": ..., ...}`
|
|
6
|
+
* violation object form -- it is absent when the rule returned a plain string.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConftestMessage {
|
|
9
|
+
msg: string;
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Per-file test result. One entry is emitted for each (filename, namespace)
|
|
14
|
+
* pair that conftest evaluates.
|
|
15
|
+
*/
|
|
16
|
+
export interface ConftestFileResult {
|
|
17
|
+
filename: string;
|
|
18
|
+
namespace: string;
|
|
19
|
+
successes: number;
|
|
20
|
+
failures: ConftestMessage[];
|
|
21
|
+
warnings: ConftestMessage[];
|
|
22
|
+
skipped: ConftestMessage[];
|
|
23
|
+
exceptions: string[];
|
|
24
|
+
}
|
|
25
|
+
/** Input for `conftest test`. */
|
|
26
|
+
export interface ConftestTestInput {
|
|
27
|
+
/** Absolute paths to configuration files to evaluate. */
|
|
28
|
+
files?: string[];
|
|
29
|
+
/** Inline configuration content. Mutually exclusive with `files`. */
|
|
30
|
+
inlineConfig?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Parser used for inline config content. Determines the temp file
|
|
33
|
+
* extension (yaml → .yaml, json → .json, dockerfile → Dockerfile, etc.).
|
|
34
|
+
* Defaults to `yaml` when not specified.
|
|
35
|
+
*/
|
|
36
|
+
inlineConfigParser?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Absolute path to a directory or file containing Rego policies.
|
|
39
|
+
* Defaults to `./policy` (conftest's convention). Mutually exclusive
|
|
40
|
+
* with `inlinePolicy`.
|
|
41
|
+
*/
|
|
42
|
+
policy?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Inline Rego policy source. Written to a temp directory and passed as
|
|
45
|
+
* `--policy`. Mutually exclusive with `policy`.
|
|
46
|
+
*/
|
|
47
|
+
inlinePolicy?: string;
|
|
48
|
+
/** Namespace to test. Defaults to `main`. */
|
|
49
|
+
namespace?: string;
|
|
50
|
+
/** Test policies in all discovered namespaces. */
|
|
51
|
+
allNamespaces?: boolean;
|
|
52
|
+
/** Absolute paths to data directories for Rego policies. */
|
|
53
|
+
data?: string[];
|
|
54
|
+
/** Combine all config files into a single document before testing. */
|
|
55
|
+
combine?: boolean;
|
|
56
|
+
/** Return exit 1 when only warnings are present (no hard failures). */
|
|
57
|
+
failOnWarn?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Input for `conftest verify`. */
|
|
60
|
+
export interface ConftestVerifyInput {
|
|
61
|
+
/** Absolute path to the policy directory to verify. */
|
|
62
|
+
policy?: string;
|
|
63
|
+
/** Namespace to verify. Defaults to `main`. */
|
|
64
|
+
namespace?: string;
|
|
65
|
+
/** Absolute paths to data directories. */
|
|
66
|
+
data?: string[];
|
|
67
|
+
}
|
|
68
|
+
/** Input for `conftest pull`. */
|
|
69
|
+
export interface ConftestPullInput {
|
|
70
|
+
/** Policy URL to pull from (OCI: `oci://registry/repo:tag`). */
|
|
71
|
+
url: string;
|
|
72
|
+
/** Local directory to store pulled policies. Defaults to `./policy`. */
|
|
73
|
+
policy?: string;
|
|
74
|
+
}
|
|
75
|
+
/** Input for `conftest push`. */
|
|
76
|
+
export interface ConftestPushInput {
|
|
77
|
+
/** OCI repository URL to push policies to. */
|
|
78
|
+
repository: string;
|
|
79
|
+
/** Local directory containing policies to push. Defaults to `./policy`. */
|
|
80
|
+
policy?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Wrapper around the local `conftest` binary.
|
|
84
|
+
*
|
|
85
|
+
* Methods do not throw on conftest-side errors -- the exit code on the
|
|
86
|
+
* returned `SpawnResult` is the signal. Inline source is written to temp
|
|
87
|
+
* files/directories because conftest does not read from stdin.
|
|
88
|
+
*/
|
|
89
|
+
export declare class ConftestCli {
|
|
90
|
+
private readonly config;
|
|
91
|
+
constructor(config: Config);
|
|
92
|
+
/**
|
|
93
|
+
* Verify the binary is present and return its version string. Returns
|
|
94
|
+
* null if the binary is unreachable or the version output is malformed.
|
|
95
|
+
*/
|
|
96
|
+
version(signal?: AbortSignal): Promise<string | null>;
|
|
97
|
+
/**
|
|
98
|
+
* Run `conftest test` against one or more configuration files. Always
|
|
99
|
+
* uses `--output=json` so output is machine-readable.
|
|
100
|
+
*
|
|
101
|
+
* When `inlineConfig` or `inlinePolicy` are provided, temp files are
|
|
102
|
+
* created and cleaned up automatically. Temp file paths in the JSON
|
|
103
|
+
* output are replaced with `<inline>` before the result is returned so
|
|
104
|
+
* callers never see implementation-internal paths.
|
|
105
|
+
*/
|
|
106
|
+
test(input: ConftestTestInput, signal?: AbortSignal): Promise<SpawnResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Run `conftest verify` -- executes the `_test.rego` tests inside the
|
|
109
|
+
* policy directory to verify the policies themselves.
|
|
110
|
+
*/
|
|
111
|
+
verify(input: ConftestVerifyInput, signal?: AbortSignal): Promise<SpawnResult>;
|
|
112
|
+
/**
|
|
113
|
+
* Pull policies from a remote OCI or Git location into a local
|
|
114
|
+
* directory. Stdout is minimal; errors go to stderr.
|
|
115
|
+
*/
|
|
116
|
+
pull(input: ConftestPullInput, signal?: AbortSignal): Promise<SpawnResult>;
|
|
117
|
+
/**
|
|
118
|
+
* Push the local policy bundle to a remote OCI registry. Uses
|
|
119
|
+
* credentials from the host environment (docker login, ORAS, etc.).
|
|
120
|
+
*/
|
|
121
|
+
push(input: ConftestPushInput, signal?: AbortSignal): Promise<SpawnResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Run `conftest` with the given argv. Tools should prefer the typed
|
|
124
|
+
* methods above; this is the escape hatch for unusual invocations.
|
|
125
|
+
*/
|
|
126
|
+
run(args: string[], signal?: AbortSignal): Promise<SpawnResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Create temp assets for inline inputs, run `fn`, then clean up.
|
|
129
|
+
* Returns whatever `fn` returns.
|
|
130
|
+
*/
|
|
131
|
+
private withTempAssets;
|
|
132
|
+
/**
|
|
133
|
+
* Replace the temp inline-config path and temp inline-policy directory
|
|
134
|
+
* path in the stdout JSON with `<inline>` so callers never see
|
|
135
|
+
* implementation-internal temp paths.
|
|
136
|
+
*
|
|
137
|
+
* conftest emits paths inside a JSON array, so each backslash in the
|
|
138
|
+
* path is JSON-encoded as `\\`. We match the JSON-encoded form of the
|
|
139
|
+
* path to handle Windows paths correctly (forward slashes need no
|
|
140
|
+
* special treatment).
|
|
141
|
+
*/
|
|
142
|
+
private sanitizeOutput;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=conftest-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conftest-cli.d.ts","sourceRoot":"","sources":["../../src/lib/conftest-cli.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAID,iCAAiC;AACjC,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qEAAqE;IACrE,YAA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