scaffold_roles
Generate role table migration, requireRole gate code, and first operator bootstrap for Run402 role-gated functions.
Instructions
Generate a role-table migration + requireRole gate snippet + first-operator bootstrap for Run402 function role gates. Offline and deterministic (no project or network). Inputs: table, user_col, role_col, roles[], cache_ttl.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | No | Role table name (unquoted SQL identifier). Default: app_roles. | |
| user_col | No | User-id column — matches the tenant user id (internal.users.id / JWT 'sub'). Default: user_id. | |
| role_col | No | Role column. Default: role. | |
| roles | No | Allowed roles. Default: ["operator"]. | |
| cache_ttl | No | Role-lookup cache seconds (0-600). Default: 60. 0 = instant revocation (fresh DB read per request). |