@orygn/opa-mcp 0.1.11 → 0.1.12
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 +68 -1
- package/README.md +18 -17
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/lib/rego-ast-types.d.ts +81 -0
- package/dist/lib/rego-ast-types.d.ts.map +1 -0
- package/dist/lib/rego-ast-types.js +9 -0
- package/dist/lib/rego-ast-types.js.map +1 -0
- package/dist/lib/rego-ast-walker.d.ts +21 -0
- package/dist/lib/rego-ast-walker.d.ts.map +1 -0
- package/dist/lib/rego-ast-walker.js +491 -0
- package/dist/lib/rego-ast-walker.js.map +1 -0
- package/dist/lib/rego-counterexample.d.ts +32 -0
- package/dist/lib/rego-counterexample.d.ts.map +1 -0
- package/dist/lib/rego-counterexample.js +75 -0
- package/dist/lib/rego-counterexample.js.map +1 -0
- package/dist/lib/rego-ir.d.ts +117 -0
- package/dist/lib/rego-ir.d.ts.map +1 -0
- package/dist/lib/rego-ir.js +7 -0
- package/dist/lib/rego-ir.js.map +1 -0
- package/dist/lib/rego-property-parser.d.ts +34 -0
- package/dist/lib/rego-property-parser.d.ts.map +1 -0
- package/dist/lib/rego-property-parser.js +60 -0
- package/dist/lib/rego-property-parser.js.map +1 -0
- package/dist/lib/rego-smt-encoder.d.ts +57 -0
- package/dist/lib/rego-smt-encoder.d.ts.map +1 -0
- package/dist/lib/rego-smt-encoder.js +499 -0
- package/dist/lib/rego-smt-encoder.js.map +1 -0
- package/dist/lib/rego-type-inferencer.d.ts +26 -0
- package/dist/lib/rego-type-inferencer.d.ts.map +1 -0
- package/dist/lib/rego-type-inferencer.js +138 -0
- package/dist/lib/rego-type-inferencer.js.map +1 -0
- package/dist/lib/rego-verify-engine.d.ts +37 -0
- package/dist/lib/rego-verify-engine.d.ts.map +1 -0
- package/dist/lib/rego-verify-engine.js +236 -0
- package/dist/lib/rego-verify-engine.js.map +1 -0
- package/dist/lib/rego-z3.d.ts +13 -0
- package/dist/lib/rego-z3.d.ts.map +1 -0
- package/dist/lib/rego-z3.js +29 -0
- package/dist/lib/rego-z3.js.map +1 -0
- package/dist/tools/helpers/index.d.ts.map +1 -1
- package/dist/tools/helpers/index.js +2 -0
- package/dist/tools/helpers/index.js.map +1 -1
- package/dist/tools/helpers/verify.d.ts +4 -0
- package/dist/tools/helpers/verify.d.ts.map +1 -0
- package/dist/tools/helpers/verify.js +75 -0
- package/dist/tools/helpers/verify.js.map +1 -0
- package/dist/tools/index.d.ts +3 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,72 @@ not part of the public surface and may change in minor releases.
|
|
|
17
17
|
|
|
18
18
|
## [Unreleased]
|
|
19
19
|
|
|
20
|
+
## [0.1.12] - 2026-05-25
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **`rego_verify` (49 tools total)** -- formal SMT-based verification for Rego
|
|
25
|
+
policies using Microsoft Z3 (WASM). Unlike testing, which checks specific
|
|
26
|
+
inputs, `rego_verify` examines ALL possible inputs mathematically and either
|
|
27
|
+
proves a property holds or returns a concrete counterexample. Three property
|
|
28
|
+
kinds are supported: `always_true` (prove a rule is true for every input),
|
|
29
|
+
`never_true` (prove a rule never fires), and `satisfiable` (find at least one
|
|
30
|
+
satisfying input as a witness). Supports equality and inequality operators,
|
|
31
|
+
string built-ins (`startswith`, `endswith`, `contains`, `regex.match`),
|
|
32
|
+
comparison operators (`<`, `<=`, `>`, `>=`), multi-clause rules (OR
|
|
33
|
+
semantics), cross-rule inlining (depth <= 5, cycle-safe), and mixed-type
|
|
34
|
+
input paths. Reports `INCONCLUSIVE` for negation-as-failure (`not`),
|
|
35
|
+
comprehensions, and other constructs that cannot be encoded in Z3.
|
|
36
|
+
Counterexamples are returned as nested JSON ready for use with `opa eval
|
|
37
|
+
--input`. Powered by a layered pipeline: OPA AST walker (IR), Z3 type
|
|
38
|
+
inferencer, and SMT encoder.
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- **Transitive local variable chains in type inferencer.** Sort inference
|
|
43
|
+
previously stopped after one level of indirection (`x := input.user.role`
|
|
44
|
+
was resolved, but `y := x; y == "admin"` was not). The inferencer now
|
|
45
|
+
follows chains of arbitrary depth with a cycle guard, so intermediate
|
|
46
|
+
local variables are correctly typed regardless of how many assignments
|
|
47
|
+
separate them from an `input.*` path.
|
|
48
|
+
|
|
49
|
+
- **Multi-expression helper rule inlining.** Helper rules with multiple body
|
|
50
|
+
expressions (e.g. `is_adult { x := input.age; x >= 18 }`) previously only
|
|
51
|
+
inlined the first expression. The walker now flattens all body expressions
|
|
52
|
+
into the caller clause as AND conjuncts, matching OPA's actual evaluation
|
|
53
|
+
semantics. Inlining also correctly handles per-expression negation-as-failure
|
|
54
|
+
and `with` modifiers inside the helper body.
|
|
55
|
+
|
|
56
|
+
- **`.*` regex patterns always encode as true.** `regex.match(".*", x)` and
|
|
57
|
+
equivalent anchored forms (`^.*$`, `^.*`, `.*$`) previously created an
|
|
58
|
+
unsatisfiable or redundant Z3 string constraint. They now short-circuit to
|
|
59
|
+
`Bool.val(true)` since any string matches the pattern.
|
|
60
|
+
|
|
61
|
+
- **`unsatisfiable` verdict for dead-code rules.** When verifying a
|
|
62
|
+
`satisfiable` property and Z3 returns UNSAT, the tool now returns
|
|
63
|
+
`verdict: "unsatisfiable"` with a clear message indicating the rule is dead
|
|
64
|
+
code or has contradictory conditions. Previously this case fell through as a
|
|
65
|
+
generic inconclusive result.
|
|
66
|
+
|
|
67
|
+
- **Default-only rule verdicts.** Rules with only a `default` clause (e.g.
|
|
68
|
+
`default allow = false`) previously returned `INCONCLUSIVE` because the
|
|
69
|
+
solver found no non-default clauses to encode. The engine now detects this
|
|
70
|
+
case and returns the correct verdict directly -- `PROVEN`, `COUNTEREXAMPLE`,
|
|
71
|
+
`SATISFIABLE`, or `UNSATISFIABLE` -- without invoking Z3, using an empty
|
|
72
|
+
`{}` witness where applicable.
|
|
73
|
+
|
|
74
|
+
- **Unsupported construct attribution scoped to target rule.** The
|
|
75
|
+
`unsupportedConstructs` field in the result previously listed constructs from
|
|
76
|
+
any rule in the module, including unrelated rules that were never evaluated.
|
|
77
|
+
It is now filtered to only constructs that appear in the target rule's own
|
|
78
|
+
clause expressions.
|
|
79
|
+
|
|
80
|
+
- **Per-call Z3 variable namespacing.** All Z3 constant names are now prefixed
|
|
81
|
+
with a monotonically increasing call ID (`v0_`, `v1_`, ...). This prevents
|
|
82
|
+
sort-redeclaration errors when the same input path is inferred as different
|
|
83
|
+
sorts across successive calls (e.g. one policy uses `input.x` as a string,
|
|
84
|
+
the next uses it as an int) within the shared Z3 WASM singleton context.
|
|
85
|
+
|
|
20
86
|
## [0.1.11] - 2026-05-24
|
|
21
87
|
|
|
22
88
|
### Added
|
|
@@ -623,7 +689,8 @@ wrappers end-to-end. CI matrix: Ubuntu, macOS, and Windows on Node
|
|
|
623
689
|
20 and 22, plus CodeQL security scanning and weekly Dependabot updates
|
|
624
690
|
for npm, GitHub Actions, and Docker base images.
|
|
625
691
|
|
|
626
|
-
[Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.
|
|
692
|
+
[Unreleased]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.12...HEAD
|
|
693
|
+
[0.1.12]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.11...v0.1.12
|
|
627
694
|
[0.1.11]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.10...v0.1.11
|
|
628
695
|
[0.1.10]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.9...v0.1.10
|
|
629
696
|
[0.1.9]: https://github.com/OrygnsCode/opa-mcp-server/compare/v0.1.8...v0.1.9
|
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
|
-
+--------------------+
|
|
19
|
-
| Claude · Cursor · |
|
|
20
|
-
| VS Code · ...
|
|
21
|
-
+--------------------+
|
|
18
|
+
+--------------------+ MCP/stdio +-----------------+ spawn/HTTP +---------------------+
|
|
19
|
+
| Claude · Cursor · |----------> | @orygn/opa-mcp |----------> | opa · regal |
|
|
20
|
+
| VS Code · ... |<---------- | |<---------- | conftest · REST API |
|
|
21
|
+
+--------------------+ 49 tools +-----------------+ +---------------------+
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
> **Status:** v0.1.
|
|
24
|
+
> **Status:** v0.1.12. Tool surface, error codes, and
|
|
25
25
|
> environment variables follow [SemVer](https://semver.org/) from
|
|
26
26
|
> v0.1.0 forward.
|
|
27
27
|
|
|
@@ -400,18 +400,19 @@ point at a reachable server.
|
|
|
400
400
|
The differentiation surface. These compose lower-level primitives into
|
|
401
401
|
the tasks agents are actually asked to do.
|
|
402
402
|
|
|
403
|
-
| Tool | What it does
|
|
404
|
-
| ----------------------------- |
|
|
405
|
-
| `rego_explain_decision` | Walk through every rule that fired (and didn't) for a given query. Wraps `rego_eval_with_explain` and produces a step-by-step natural-language trace.
|
|
406
|
-
| `rego_generate_test_skeleton` | Given a policy, generate a `_test.rego` skeleton covering each rule.
|
|
407
|
-
| `rego_describe_policy` | Summarize what a policy does, its inputs, decisions, and assumptions.
|
|
408
|
-
| `rego_suggest_fix` | For a failed `rego_check` or `rego_lint`, propose minimal patches.
|
|
409
|
-
| `rego_coverage_gaps` | Run `opa test --coverage` and return per-file uncovered line ranges, sorted worst first. Use `threshold` to focus on files below a target percentage.
|
|
410
|
-
| `rego_security_audit` | Run regal lint restricted to `security` and `bugs` categories across a directory. Returns severity-grouped findings with remediation guidance.
|
|
411
|
-
| `rego_infer_input_schema` | Statically analyse a policy (or directory of policies) with `opa parse` and return a JSON Schema describing every `input.*` field the policy reads. No running OPA required. Correct starting point for writing integration tests or configuring `opa check --schema`.
|
|
412
|
-
| `rego_fix` | Run `regal fix` to auto-apply mechanical fixes: `opa-fmt`, `use-rego-v1`, `use-assignment-operator`, `no-whitespace-comment`, and `directory-package-mismatch`. Use `dryRun: true` to preview changes first. Returns a per-file breakdown of which rules were applied and, for `directory-package-mismatch`, the new path the file was moved to.
|
|
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`.
|
|
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.
|
|
403
|
+
| Tool | What it does |
|
|
404
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
405
|
+
| `rego_explain_decision` | Walk through every rule that fired (and didn't) for a given query. Wraps `rego_eval_with_explain` and produces a step-by-step natural-language trace. |
|
|
406
|
+
| `rego_generate_test_skeleton` | Given a policy, generate a `_test.rego` skeleton covering each rule. |
|
|
407
|
+
| `rego_describe_policy` | Summarize what a policy does, its inputs, decisions, and assumptions. |
|
|
408
|
+
| `rego_suggest_fix` | For a failed `rego_check` or `rego_lint`, propose minimal patches. |
|
|
409
|
+
| `rego_coverage_gaps` | Run `opa test --coverage` and return per-file uncovered line ranges, sorted worst first. Use `threshold` to focus on files below a target percentage. |
|
|
410
|
+
| `rego_security_audit` | Run regal lint restricted to `security` and `bugs` categories across a directory. Returns severity-grouped findings with remediation guidance. |
|
|
411
|
+
| `rego_infer_input_schema` | Statically analyse a policy (or directory of policies) with `opa parse` and return a JSON Schema describing every `input.*` field the policy reads. No running OPA required. Correct starting point for writing integration tests or configuring `opa check --schema`. |
|
|
412
|
+
| `rego_fix` | Run `regal fix` to auto-apply mechanical fixes: `opa-fmt`, `use-rego-v1`, `use-assignment-operator`, `no-whitespace-comment`, and `directory-package-mismatch`. Use `dryRun: true` to preview changes first. Returns a per-file breakdown of which rules were applied and, for `directory-package-mismatch`, the new path the file was moved to. |
|
|
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`. |
|
|
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. |
|
|
415
|
+
| `rego_verify` | Formally verify a property about a Rego rule using SMT solving (Microsoft Z3 via WASM). Unlike testing, this checks ALL possible inputs mathematically and either proves the property holds or returns a concrete counterexample. Supports `always_true`, `never_true`, and `satisfiable` property kinds. Handles equality, comparison, string built-ins (`startswith`, `endswith`, `contains`, `regex.match`), multi-clause rules, and cross-rule inlining. Reports `INCONCLUSIVE` for negation-as-failure and comprehensions. |
|
|
415
416
|
|
|
416
417
|
### Category F: Conftest (configuration policy testing)
|
|
417
418
|
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript types mirroring the JSON output of `opa parse --format=json`.
|
|
3
|
+
*
|
|
4
|
+
* Field names and value shapes are verified against real OPA 0.69 output.
|
|
5
|
+
* Exact operator names confirmed: equal(==), eq(=), assign(:=), neq, gt,
|
|
6
|
+
* gte, lt, lte, startswith, endswith, contains, regex.match (compound ref).
|
|
7
|
+
*/
|
|
8
|
+
export type OpaTermType = 'null' | 'boolean' | 'number' | 'string' | 'var' | 'ref' | 'array' | 'set' | 'object' | 'call' | 'every' | 'arraycomprehension' | 'setcomprehension' | 'objectcomprehension';
|
|
9
|
+
export interface OpaLocation {
|
|
10
|
+
file: string;
|
|
11
|
+
row: number;
|
|
12
|
+
col: number;
|
|
13
|
+
}
|
|
14
|
+
export interface OpaTerm {
|
|
15
|
+
type: OpaTermType;
|
|
16
|
+
value: OpaTermValue;
|
|
17
|
+
location?: OpaLocation;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Union of possible value shapes for each term type:
|
|
21
|
+
* null → null
|
|
22
|
+
* boolean → boolean
|
|
23
|
+
* number → number
|
|
24
|
+
* string/var → string
|
|
25
|
+
* ref/array → OpaTerm[]
|
|
26
|
+
* object → Array<[OpaTerm, OpaTerm]> (key-value pairs)
|
|
27
|
+
* call → OpaTerm[] (first element is the function ref)
|
|
28
|
+
* every → OpaEvery
|
|
29
|
+
* *comprehension → OpaComprehension
|
|
30
|
+
*/
|
|
31
|
+
export type OpaTermValue = null | boolean | number | string | OpaTerm[] | Array<[OpaTerm, OpaTerm]> | OpaEvery | OpaComprehension;
|
|
32
|
+
export interface OpaEvery {
|
|
33
|
+
key?: OpaTerm;
|
|
34
|
+
value: OpaTerm;
|
|
35
|
+
domain: OpaTerm;
|
|
36
|
+
body: OpaExpression[];
|
|
37
|
+
}
|
|
38
|
+
export interface OpaComprehension {
|
|
39
|
+
term?: OpaTerm;
|
|
40
|
+
key?: OpaTerm;
|
|
41
|
+
value?: OpaTerm;
|
|
42
|
+
body: OpaExpression[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A single expression in a rule body.
|
|
46
|
+
*
|
|
47
|
+
* `terms` is EITHER a single OpaTerm (bare expression: boolean literal,
|
|
48
|
+
* var reference, or input ref truthiness check) OR an OpaTerm[] where the
|
|
49
|
+
* first element is a ref to the operator/builtin and the rest are arguments.
|
|
50
|
+
*
|
|
51
|
+
* `negated: true` signals negation-as-failure (`not expr`).
|
|
52
|
+
*/
|
|
53
|
+
export interface OpaExpression {
|
|
54
|
+
index: number;
|
|
55
|
+
terms: OpaTerm | OpaTerm[];
|
|
56
|
+
negated?: boolean;
|
|
57
|
+
with?: unknown;
|
|
58
|
+
}
|
|
59
|
+
export interface OpaRuleHead {
|
|
60
|
+
name: string;
|
|
61
|
+
value?: OpaTerm;
|
|
62
|
+
key?: OpaTerm;
|
|
63
|
+
args?: OpaTerm[];
|
|
64
|
+
assign?: boolean;
|
|
65
|
+
ref?: OpaTerm[];
|
|
66
|
+
}
|
|
67
|
+
export interface OpaRule {
|
|
68
|
+
head: OpaRuleHead;
|
|
69
|
+
body: OpaExpression[];
|
|
70
|
+
default?: boolean;
|
|
71
|
+
else?: OpaRule;
|
|
72
|
+
}
|
|
73
|
+
export interface OpaModule {
|
|
74
|
+
package: {
|
|
75
|
+
path: OpaTerm[];
|
|
76
|
+
};
|
|
77
|
+
imports?: unknown[];
|
|
78
|
+
rules: OpaRule[];
|
|
79
|
+
comments?: unknown[];
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=rego-ast-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rego-ast-types.d.ts","sourceRoot":"","sources":["../../src/lib/rego-ast-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,KAAK,GACL,OAAO,GACP,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,CAAC;AAE1B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,EAAE,GACT,KAAK,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,GACzB,QAAQ,GACR,gBAAgB,CAAC;AAErB,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript types mirroring the JSON output of `opa parse --format=json`.
|
|
3
|
+
*
|
|
4
|
+
* Field names and value shapes are verified against real OPA 0.69 output.
|
|
5
|
+
* Exact operator names confirmed: equal(==), eq(=), assign(:=), neq, gt,
|
|
6
|
+
* gte, lt, lte, startswith, endswith, contains, regex.match (compound ref).
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=rego-ast-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rego-ast-types.js","sourceRoot":"","sources":["../../src/lib/rego-ast-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST walker: OpaModule → VerifyWalkResult.
|
|
3
|
+
*
|
|
4
|
+
* Responsibilities:
|
|
5
|
+
* 1. Traverse all rules in the module, grouping clauses by rule name.
|
|
6
|
+
* 2. Inline cross-module rule references (non-recursive, depth <= MAX_INLINE_DEPTH).
|
|
7
|
+
* 3. Collect all input.* paths referenced anywhere in scope.
|
|
8
|
+
* 4. Detect and record every construct Phase 1 cannot handle.
|
|
9
|
+
*
|
|
10
|
+
* The encoder never touches OPA AST types -- all AST knowledge lives here.
|
|
11
|
+
*/
|
|
12
|
+
import type { OpaModule } from './rego-ast-types.js';
|
|
13
|
+
import type { VerifyWalkResult } from './rego-ir.js';
|
|
14
|
+
export declare function walkModule(ast: OpaModule): VerifyWalkResult;
|
|
15
|
+
/**
|
|
16
|
+
* Collect all input.* paths recursively from a raw OPA AST value.
|
|
17
|
+
* Used for deep scans of comprehension bodies (Phase 2), but exported
|
|
18
|
+
* here for reuse in the engine's path-discovery pass.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectAllInputPaths(node: unknown, out: Map<string, string[]>): void;
|
|
21
|
+
//# sourceMappingURL=rego-ast-walker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rego-ast-walker.d.ts","sourceRoot":"","sources":["../../src/lib/rego-ast-walker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAiB,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AACtF,OAAO,KAAK,EAA2B,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAoB9E,wBAAgB,UAAU,CAAC,GAAG,EAAE,SAAS,GAAG,gBAAgB,CAiB3D;AA4lBD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CA6BpF"}
|