Version 3 of the kit: - Radix UI replaced with Base UI (using the Shadcn UI patterns) - next-intl replaces react-i18next - enhanceAction deprecated; usage moved to next-safe-action - main layout now wrapped with [locale] path segment - Teams only mode - Layout updates - Zod v4 - Next.js 16.2 - Typescript 6 - All other dependencies updated - Removed deprecated Edge CSRF - Dynamic Github Action runner
1.0 KiB
1.0 KiB
@kit/policies — Registry-Based Policy System
Non-Negotiables
- ALWAYS use
definePolicywith a uniqueidand register in a registry viacreatePolicyRegistry() - NEVER write inline policies in feature code — define in a registry file
- ALWAYS use
allow()/deny()returns with error codes and remediation messages - ALWAYS assign stages (
preliminary,submission) for stage-aware evaluation - ALWAYS use
createPoliciesFromRegistry()to load policies by ID — supports config tuples like['max-invitations', { maxInvitations: 5 }] - ALWAYS use
createPolicyEvaluator()and callevaluatePolicies()orevaluateGroups() - NEVER evaluate policies without specifying an operator (
ALL= AND,ANY= OR)
Key Imports
definePolicy,allow,deny,createPolicyRegistry,createPoliciesFromRegistry,createPolicyEvaluator— all from@kit/policies
Exemplar
packages/features/team-accounts/src/server/policies/policies.ts— real-world registry with stage-aware, configurable policies