Skip to content

feat: check the policy catalog before writing a new policy - #62

Merged
nicobatalla merged 1 commit into
mainfrom
nb-1672-catalog-first
Nov 13, 2026
Merged

nicobatalla merged 1 commit into
mainfrom
nb-1672-catalog-first

Conversation

@nicobatalla

Copy link
Copy Markdown
Collaborator

Closes https://github.com/dtwoai/d2/issues/1672

When a user asks for a new policy, dtwo-gateway-policy now searches the policy catalog before any Rego is written. It filters dtwo-list-catalog-policies by the app, tag or direction the request names, reads a likely match in full with dtwo-get-catalog-policy, and checks whether the tenant already imported it. Then it tells the user what the catalog policy does, how it differs from the request, and asks whether to import it or write a new one.

An unchanged import arrives published as version 1, so the skill attaches it pinned and skips the draft round. An import the user wants adjusted goes through the normal draft, test, publish and pin steps. With no match, the skill says so in one line and continues to authoring.

dtwo-policy-rego runs the same check when it is loaded on its own and the policy will be saved. The setup skill's custom policy step notes that the catalog is searched first.

Plugin version bumped to 1.3.6.

@nicobatalla
nicobatalla merged commit eb47bc2 into main Nov 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants