PermDock
CLI

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 --print

With --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 fieldUnset defaultRead by
permissionsThe first of src/permissions.ts, permissions.ts and <srcPath>/permissions.ts that existscollect, catalog, usage
srcPath["./src"]collect, usage, doctor
catalogcollect.out, then catalog.out, then permissions.catalog.jsoncollect, catalog, cloud
barrelfalse; true writes src/permissions.generated.tscollect
migrationsdoctor.migrations, then the six folders abovedoctor SQL checks
sensitiveActionsdoctor.sensitiveActions, then the seven verbs abovedoctor PD017
rlsSchemarls.schema, then rls.rbac.schema, then permdockrls, 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:

permdock.config.ts
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 } },
    },
  },
});
CheckedAgainst
Keys of rls.tables, powersync.memberLevel, entries of powersync.resources, resource in powersync.tables.*.followResource names
Keys of rls.scopeTypes, rls.memberships.scopes, rls.suspension.scopes; rls.storage.buckets.<b>.scopeScope names, plus the tenant and team aliases
{placeholder} segments in rls.realtime.topics keysScope names
Keys of rls.actions, powersync.actionAction names
String entries of the keep lists, rls.customRoleWrites.requiresPermission 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.

KeyAcceptsRead by
collect.srcPathan arraycollect
collect.outa stringcollect
collect.barrela boolean or a stringcollect
catalog.outa stringcatalog
gen.outa stringgen
gen.kindsan arraygen
gen.fieldsa booleangen
gen.zodan object (specifier)gen
budgets.bundlea numberbundle
budgets.snapshotan object, { bytes, memberships }bundle
budgets.claimsa numberbundle
openapi.docan arrayopenapi
openapi.operationsa stringdoctor
openapi.tenantPathsan arraydoctor
openapi.basea stringdoctor
openapi.enforcement"kernel"doctor
rls.tablesan objectrls
rls.dialecta stringrls
rls.membershipsan objectrls
rls.membershipSourcesan arrayrls
rls.suspensionan objectrls
rls.functionsan objectrls
rls.inlineFunctionsa booleanrls
rls.forcea booleanrls
rls.fixturesa stringrls
rls.verifyan objectrls
rls.tenantClaima stringrls
rls.scopeTypesan objectrls
rls.roleClaima stringrls
rls.roleValuesan objectrls
rls.gucPrefixa stringrls
rls.outa stringrls
rls.splitan arrayrls
rls.drizzlean objectrls
rls.prismaan objectrls
rls.schemaa stringrls
rls.authorizea stringrls
rls.policyPerRolea booleanrls
rls.customRolesa boolean or an objectrls
rls.triggersan objectrls
rls.auditan objectrls
rls.capabilitiesa booleanrls
rls.anonymousSignInsa stringrls
rls.fieldsa stringrls
rls.revokeColumnsa booleanrls
rls.policyNamea stringrls
rls.rbacan objectrls
rls.rolesan objectrls
rls.actionsan objectrls
rls.helpersOnlya booleanrls
rls.rowHelpersa boolean or an arrayrls
rls.memo'none', 'permdock' or 'better-supabase'row helpers
rls.idTypesan objectrow helpers
rls.seedsa stringrls
rls.staticGrantsa stringrls
rls.treeValuesan objectrls
rls.trustedReadersan arrayrls
rls.migratean objectrls
rls.shimsa boolean or an objectrls
rls.tenantsa stringrls
rls.customRoleWritesan objectrls
rls.anonExecutea booleanrls
rls.assignmentsa boolean or an objectrls
rls.approvalsa boolean or an objectrls
rls.jsonSchemaa boolean or a stringrls
rls.ownershipTriggersa boolean or an objectrls
rls.readOnlyActorsa boolean or an arrayrls
rls.apiKeysa boolean or an objectrls
rls.tokenScopesa boolean or { delegations }rls
rls.realtimean objectrls
rls.storagean objectrls
betterSupabase.configa stringsupabase
supabase.hookan objectsupabase
supabase.schemasa stringsupabase
powersync.outa stringpowersync
powersync.resourcesan arraypowersync
powersync.actiona stringpowersync
powersync.manifesta stringpowersync
powersync.tablesan objectpowersync
powersync.memberLevelan objectpowersync
doctor.sensitiveActionsan arraydoctor
doctor.membershipsa stringdoctor
doctor.credentialsa stringdoctor
doctor.clientEntriesan arraydoctor
doctor.migrationsan arraydoctor
doctor.claimsa stringdoctor
doctor.srcPathan arraydoctor
doctor.cacheHelpersan arraydoctor
doctor.baselinea stringdoctor
doctor.failOna string, "error" or "warning"doctor
doctor.policiesan object, { max }doctor

Side effects

What each command may change; side effects explains each one.

CommandSide effects
permdock configNone

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 warning turns it into a CI failure for a project that wants one.
  • The known keys come from the config types. src/cli/project/config-shape.ts lists each key with the kinds it accepts and is checked against keyof its section type when PermDock builds, so a new option cannot ship without the validator knowing it. pnpm docs:drift fails 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 doctor which file to read, so the CLI traces the value back to the import that brought it in. resource(…, { name }) and definePolicy({ 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.

Last updated on

On this page