chore(scripts): rename dw:make-admin to dw:admin
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
"dw:run": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dw/index.ts run",
|
||||
"dw:enable": "bun scripts/dw/index.ts enable",
|
||||
"dw:disable": "bun scripts/dw/index.ts disable",
|
||||
"dw:make-admin": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dw/index.ts make-admin",
|
||||
"dw:admin": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dw/index.ts admin",
|
||||
"d": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dev.ts",
|
||||
"d:prod": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/dev.ts --production",
|
||||
"dx": "bun scripts/dx.ts",
|
||||
|
||||
@@ -36,7 +36,7 @@ bun dw teardown # full cleanup of this worktree
|
||||
bun dw teardown --all # full cleanup of every agent worktree
|
||||
bun dw disable # rename .env.local -> .env.local.disabled (fall back to canonical env)
|
||||
bun dw enable # rename .env.local.disabled -> .env.local
|
||||
bun dw make-admin # set the better-auth global role to 'admin' for every user in this worktree's DB
|
||||
bun dw admin # set the better-auth global role to 'admin' for every user in this worktree's DB
|
||||
```
|
||||
|
||||
## Subcommands
|
||||
@@ -130,11 +130,11 @@ Inverse of `disable` — restores each `.env.local.disabled` to `.env.local`.
|
||||
bun dw enable
|
||||
```
|
||||
|
||||
### `bun dw make-admin`
|
||||
### `bun dw admin`
|
||||
Sets the better-auth **global** user role to `admin` for every row in the `user` table of this worktree's DB, granting the superuser scope locally (the `/admin` routes + impersonation). Org membership roles (`member` table) are left untouched.
|
||||
|
||||
```sh
|
||||
bun dw make-admin
|
||||
bun dw admin
|
||||
```
|
||||
|
||||
Targets `databaseUrl` from the registry entry for the current worktree, falling back to `DATABASE_URL`. **Refuses to run against production** via the shared `assertNotProductionDb` guard (connection strings containing `us-east-2`).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { log, fatal, sh } from "../helpers/shell.ts";
|
||||
import { assertNotProductionDb } from "../../../server/src/db/dbUtils.ts";
|
||||
import { getCurrentWorktree } from "../helpers/git.ts";
|
||||
import { loadRegistry } from "../helpers/registry.ts";
|
||||
import { assertNotProductionDb } from "../../../server/src/db/dbUtils.ts";
|
||||
import { fatal, log, sh } from "../helpers/shell.ts";
|
||||
|
||||
const UPDATE_SQL = `UPDATE "user" SET role = 'admin';`;
|
||||
|
||||
@@ -16,7 +16,7 @@ function describeTarget(url: string): string {
|
||||
// Sets the better-auth global role to 'admin' for every user in the current
|
||||
// worktree's DB, which grants the superuser scope locally. Org membership
|
||||
// roles (the `member` table) are intentionally left untouched.
|
||||
export function cmdMakeAdmin(): void {
|
||||
export function cmdAdmin(): void {
|
||||
const cwd = getCurrentWorktree();
|
||||
const entry = loadRegistry()[cwd];
|
||||
const url = entry?.databaseUrl || process.env.DATABASE_URL || "";
|
||||
@@ -1,16 +1,16 @@
|
||||
import { fatal } from "./helpers/shell.ts";
|
||||
import { cmdDefault } from "./commands/default.ts";
|
||||
import { cmdSetup } from "./commands/setup.ts";
|
||||
import { cmdRun } from "./commands/run.ts";
|
||||
import { cmdTeardown } from "./commands/teardown.ts";
|
||||
import { cmdList } from "./commands/list.ts";
|
||||
import { cmdReset } from "./commands/reset.ts";
|
||||
import { cmdLogs } from "./commands/logs.ts";
|
||||
import { cmdAdmin } from "./commands/admin.ts";
|
||||
import { cmdAttach } from "./commands/attach.ts";
|
||||
import { cmdIdentify } from "./commands/identify.ts";
|
||||
import { cmdEnable } from "./commands/enable.ts";
|
||||
import { cmdDefault } from "./commands/default.ts";
|
||||
import { cmdDisable } from "./commands/disable.ts";
|
||||
import { cmdMakeAdmin } from "./commands/make-admin.ts";
|
||||
import { cmdEnable } from "./commands/enable.ts";
|
||||
import { cmdIdentify } from "./commands/identify.ts";
|
||||
import { cmdList } from "./commands/list.ts";
|
||||
import { cmdLogs } from "./commands/logs.ts";
|
||||
import { cmdReset } from "./commands/reset.ts";
|
||||
import { cmdRun } from "./commands/run.ts";
|
||||
import { cmdSetup } from "./commands/setup.ts";
|
||||
import { cmdTeardown } from "./commands/teardown.ts";
|
||||
import { fatal } from "./helpers/shell.ts";
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const sub = process.argv[2];
|
||||
@@ -49,12 +49,12 @@ async function main(): Promise<void> {
|
||||
case "disable":
|
||||
cmdDisable();
|
||||
break;
|
||||
case "make-admin":
|
||||
cmdMakeAdmin();
|
||||
case "admin":
|
||||
cmdAdmin();
|
||||
break;
|
||||
default:
|
||||
fatal(
|
||||
`unknown subcommand: ${sub} (use: setup | run | teardown | list | reset | logs | attach | identify | enable | disable | make-admin)`,
|
||||
`unknown subcommand: ${sub} (use: setup | run | teardown | list | reset | logs | attach | identify | enable | disable | admin)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user