feat: add interactive policy builder to docs#271
Conversation
Add a browser-based environment-policy builder as a self-contained
Mintlify React component (snippets/policy-builder.jsx) on a new
policy-reference/policy_builder page. It mirrors the kosli create
policy-file CLI wizard: provenance and trail-compliance toggles,
repeatable attestation rules, exceptions, and an expression builder
(comparison/matches/exists, and/or/not, flow-name and flow-tag
conditions), with a live syntax-highlighted YAML preview and copy button.
The YAML serializer and expression builders are reimplemented in plain
JS (no third-party packages, per Mintlify sandbox constraints). All
helpers, constants, styles, and sub-renderers live inside the exported
component because the Mintlify MDX sandbox only exposes the exported
component body plus the pre-injected hooks. The attestation 'name' field
is omitted when it is the schema default ('*'). The page uses wide mode
to drop the right-hand table of contents. Fully client-side, no API calls.
Closes #269
|
Claude finished @dangrondahl's task in 1m 39s —— View job PR Review: Interactive Policy Builder
Review findingsScope: Checklist
Suggestions1. "Toggle the requirements you need" could be clearer. Consider: "Enable the requirements you need" — "toggle" implies switching back and forth rather than building up. 2. The prior reviews flagged this repeatedly. The author confirmed 3. All other colors use CSS variables ( SummaryThe PR is well-structured: new page has proper frontmatter and navigation entry, all links are root-relative and resolve to existing pages, and the reference page cross-links are bidirectional. The component is self-contained and thoroughly documented in its header comment. The main open item from prior reviews is the |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
- Drop reference to unreleased `kosli create policy-file` CLI command - Prepend `# yaml-language-server` schema directive to builder output for editor validation/autocomplete - Use stable ids instead of array indices as React keys on dynamic lists
Summary
Adds an interactive policy builder to the docs as a self-contained Mintlify React component, so users can assemble a valid environment policy YAML in the browser and copy it into their repo without installing the CLI.
policy-reference/policy_builder.mdx(wide mode, no right-hand TOC), added to navigation and cross-linked fromenvironment_policy.mdx.snippets/policy-builder.jsx.It mirrors the
kosli create policy-fileCLI wizard (kosli-dev/cliinternal/policywizard):custom:<name>, optional name, optional condition. Enforces the "type and name can't both be*" rule with inline feedback.and/or, per-term negate; term kinds for flow name, flow tag, artifact name regex (matches), custom comparison (incl.matches/exists), and raw.Implementation notes
useState/useMemo), and resolves capitalized<Tags>through its own registry rather than local scope.namefield is omitted when it is the schema default (*), sincenamedefaults to*in the v1 schema and onlytypeis required.Verification
policy.ToYAML()expected outputs.mint broken-linkspasses; component renders inmint dev.Note
The CLI
kosli create policy-filefeature is still on the unmergedcreate_policy_filebranch in kosli-dev/cli. Consider holding this until that ships, since the page references it.Closes #269