config
Check permdock.config.ts for keys PermDock does not read, or print the effective config with every default filled in.
permdock config reads the config file and lists each key PermDock does not read, such as a misspelt srcPaths. permdock config --print prints the effective config as JSON: the file, the config as written, and the value every command uses where the config is silent.
Usage
permdock config # warnings for unknown keys
permdock config --fail-on warning # exit 1 on a warning, for CI
permdock config --print # the effective config as JSON
permdock config --config apps/web/permdock.config.ts --printWith --json, data is the report --print prints.
{
"$schema": "https://permdock.com/schemas/config-report-v1.json",
"file": "permdock.config.ts",
"config": {
"permissions": "./src/permissions.ts",
"collect": { "barrel": true }
},
"resolved": {
"permissions": "./src/permissions.ts",
"policy": null,
"srcPath": ["./src"],
"catalog": "permissions.catalog.json",
"barrel": "src/permissions.generated.ts",
"migrations": [
"supabase/migrations",
"supabase/schemas",
"migrations",
"drizzle",
"prisma/migrations",
"db/migrations"
],
"sensitiveActions": [
"approve",
"pay",
"settle",
"submit",
"transfer",
"refund",
"disburse"
],
"rlsSchema": "permdock"
},
"effective": {
"permissions": "./src/permissions.ts",
"collect": { "barrel": true, "srcPath": ["./src"] }
},
"defaults": ["collect.srcPath"],
"restated": [],
"warnings": []
}effective is the config every command reads: each unset key of a section the config opens (rls, supabase.hook, gen, collect, doctor) holds its default, and defaults names those keys. A section the config does not open stays unset, because opening it turns a command on. restated lists keys set to their default, which doctor PD120 reports and permdock codemod config --prune removes.
resolved field | Unset default | Read by |
|---|---|---|
permissions | The first of src/permissions.ts, permissions.ts and <srcPath>/permissions.ts that exists | collect, catalog, usage |
srcPath | ["./src"] | collect, usage, doctor |
catalog | collect.out, then catalog.out, then permissions.catalog.json | collect, catalog, cloud |
barrel | false; true writes src/permissions.generated.ts | collect |
migrations | doctor.migrations, then the six folders above | doctor SQL checks |
sensitiveActions | doctor.sensitiveActions, then the seven verbs above | doctor PD017 |
rlsSchema | rls.schema, then rls.rbac.schema, then permdock | rls, supabase, doctor PD054 |
Typed config
Pass the imported policy value to defineConfig instead of its path, and the names in the config are checked against the policy when the config compiles:
import { defineConfig } from "permdock/cli";
import { permissions } from "./src/permissions.ts";
import { policy } from "./src/policy.ts";
export default defineConfig({
policy,
rls: {
tables: { quote: "quotes" },
scopeTypes: { organization: "uuid" },
realtime: {
// error: the scope is organization, not organisation
topics: { "org:{organisation}:quotes": { read: permissions.quote.read } },
},
},
});| Checked | Against |
|---|---|
Keys of rls.tables, powersync.memberLevel, entries of powersync.resources, resource in powersync.tables.*.follow | Resource names |
Keys of rls.scopeTypes, rls.memberships.scopes, rls.suspension.scopes; rls.storage.buckets.<b>.scope | Scope names, plus the tenant and team aliases |
{placeholder} segments in rls.realtime.topics keys | Scope names |
Keys of rls.actions, powersync.action | Action names |
String entries of the keep lists, rls.customRoleWrites.requires | Permission keys |
permissions and operations take the imported value too. The CLI reads a value from the relative import of the config file that exports it as policy, permissions or operations (or default), so every command, --watch included, reads that module; a value no relative import exports exits 2 with config_invalid. A path keeps working and checks nothing at compile time. PD077 reports the same names at run time for either form.
Validation
Every command checks the config before it runs. A module key that is neither a path nor an imported value, or a section (collect, rls, doctor, …) that is not an object, exits 2 with the key named, as an error document under --json. A key PermDock reads that holds a value of the wrong kind, such as rls.tables: ["staff"], exits 2 with the code config_invalid: permdock.config.ts: rls.tables must be an object, not an array. A key PermDock does not read is a warning on stderr, permdock: warning: permdock.config.ts: unknown key collect.srcPaths; PermDock reads srcPath, out, barrel, and the command still runs.
Keys
Every key PermDock reads, with the kinds of value it accepts. The command page owns what each key does.
| Key | Accepts | Read by |
|---|---|---|
collect.srcPath | an array | collect |
collect.out | a string | collect |
collect.barrel | a boolean or a string | collect |
catalog.out | a string | catalog |
gen.out | a string | gen |
gen.kinds | an array | gen |
gen.fields | a boolean | gen |
gen.zod | an object (specifier) | gen |
budgets.bundle | a number | bundle |
budgets.snapshot | an object, { bytes, memberships } | bundle |
budgets.claims | a number | bundle |
openapi.doc | an array | openapi |
openapi.operations | a string | doctor |
openapi.tenantPaths | an array | doctor |
openapi.base | a string | doctor |
openapi.enforcement | "kernel" | doctor |
rls.tables | an object | rls |
rls.dialect | a string | rls |
rls.memberships | an object | rls |
rls.membershipSources | an array | rls |
rls.suspension | an object | rls |
rls.functions | an object | rls |
rls.inlineFunctions | a boolean | rls |
rls.force | a boolean | rls |
rls.fixtures | a string | rls |
rls.verify | an object | rls |
rls.tenantClaim | a string | rls |
rls.scopeTypes | an object | rls |
rls.roleClaim | a string | rls |
rls.roleValues | an object | rls |
rls.gucPrefix | a string | rls |
rls.out | a string | rls |
rls.split | an array | rls |
rls.drizzle | an object | rls |
rls.prisma | an object | rls |
rls.schema | a string | rls |
rls.authorize | a string | rls |
rls.policyPerRole | a boolean | rls |
rls.customRoles | a boolean or an object | rls |
rls.triggers | an object | rls |
rls.audit | an object | rls |
rls.capabilities | a boolean | rls |
rls.anonymousSignIns | a string | rls |
rls.fields | a string | rls |
rls.revokeColumns | a boolean | rls |
rls.policyName | a string | rls |
rls.rbac | an object | rls |
rls.roles | an object | rls |
rls.actions | an object | rls |
rls.helpersOnly | a boolean | rls |
rls.rowHelpers | a boolean or an array | rls |
rls.memo | 'none', 'permdock' or 'better-supabase' | row helpers |
rls.idTypes | an object | row helpers |
rls.seeds | a string | rls |
rls.staticGrants | a string | rls |
rls.treeValues | an object | rls |
rls.trustedReaders | an array | rls |
rls.migrate | an object | rls |
rls.shims | a boolean or an object | rls |
rls.tenants | a string | rls |
rls.customRoleWrites | an object | rls |
rls.anonExecute | a boolean | rls |
rls.assignments | a boolean or an object | rls |
rls.approvals | a boolean or an object | rls |
rls.jsonSchema | a boolean or a string | rls |
rls.ownershipTriggers | a boolean or an object | rls |
rls.readOnlyActors | a boolean or an array | rls |
rls.apiKeys | a boolean or an object | rls |
rls.tokenScopes | a boolean or { delegations } | rls |
rls.realtime | an object | rls |
rls.storage | an object | rls |
betterSupabase.config | a string | supabase |
supabase.hook | an object | supabase |
supabase.schemas | a string | supabase |
powersync.out | a string | powersync |
powersync.resources | an array | powersync |
powersync.action | a string | powersync |
powersync.manifest | a string | powersync |
powersync.tables | an object | powersync |
powersync.memberLevel | an object | powersync |
doctor.sensitiveActions | an array | doctor |
doctor.memberships | a string | doctor |
doctor.credentials | a string | doctor |
doctor.clientEntries | an array | doctor |
doctor.migrations | an array | doctor |
doctor.claims | a string | doctor |
doctor.srcPath | an array | doctor |
doctor.cacheHelpers | an array | doctor |
doctor.baseline | a string | doctor |
doctor.failOn | a string, "error" or "warning" | doctor |
doctor.policies | an object, { max } | doctor |
Side effects
What each command may change; side effects explains each one.
| Command | Side effects |
|---|---|
permdock config | None |
Why
- Unknown keys warn instead of failing. A config written for a newer PermDock still loads in an older CLI, and a monorepo can pin two versions. The cost of a typo is a key that does nothing, so the warning names it and the key list, and
config --fail-on warningturns it into a CI failure for a project that wants one. - The known keys come from the config types.
src/cli/project/config-shape.tslists each key with the kinds it accepts and is checked againstkeyofits section type when PermDock builds, so a new option cannot ship without the validator knowing it.pnpm docs:driftfails when a key has no row in the table above. - The policy value types the config, the module path loads it. A path cannot carry types, and a value alone cannot tell
doctorwhich file to read, so the CLI traces the value back to the import that brought it in.resource(…, { name })anddefinePolicy({ scopes })keep their literal names in the types for this. - A wrong kind fails instead of warning. A value of the wrong kind is never what a newer PermDock reads either, and ignoring it would run with the default, such as no table mapping at all.
Related
Last updated on
completion
Tab completion for permdock in bash, zsh and fish - commands, subcommands, flags, enum values and catalogue values such as doctor codes and init archetypes.
skills
Install the PermDock Agent Skills (permdock, permdock-wire, permdock-audit and the topic skills) from the permdock package or from skills.sh.