@pmate/cli 0.42.7 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -394,3 +394,25 @@ pmate account bot nickname --app pmate:merry --name blackbeard --nickname "黑
394
394
  `--name` is the bot's internal name, as returned by `pmate account bot list --app pmate:merry --json`. Both commands require an existing CLI login, use the active session, and rely on the auth API's profile update permissions. They require exactly one profile for the bot account in the specified app; missing or multiple profiles cause an error without a write. These commands never create a profile.
395
395
 
396
396
  The CLI updates only `nickName` through `PUT /profile`, then polls the profile index for up to approximately 10 seconds and returns the verified profile. A matching nickname is a no-op. If verification times out, the update may already have been applied; inspect the profile before retrying. `--base-url` selects the auth API for all requests.
397
+
398
+ ### Scoped roles and permissions
399
+
400
+ Roles group explicit actions and resource scopes. Platform roles use a bare name (`admin`); namespace roles use `namespace/role` (`pmate/reviewer`). This keeps a namespace named `platform` unambiguous. Permission creation alone grants no access.
401
+
402
+ ```bash
403
+ pmate role definition list --json
404
+ pmate role definition create pmate/reviewer --display-name Reviewer --description "Review PMate apps"
405
+ pmate role permission create app:review --scope-type namespace --display-name "Review app" --description "Approve an app review"
406
+ pmate role grant add --role pmate/reviewer --permission app:review --namespace pmate
407
+ pmate role binding add --role pmate/reviewer --account <account-id>
408
+ pmate role check --permission app:review --namespace pmate --json
409
+ pmate role grant list --role pmate/reviewer --json
410
+ pmate role permission update app:review --status disabled
411
+ pmate role grant remove --role pmate/reviewer --permission app:review --namespace pmate
412
+ pmate role binding remove --role pmate/reviewer --account <account-id>
413
+ pmate role definition update pmate/reviewer --status disabled
414
+ ```
415
+
416
+ For platform actions use `--scope platform`. Platform roles can grant namespace actions with `--namespace '*'`, including future namespaces; permission checks require a concrete namespace. Definitions and grants are independent, and disabled definitions grant no access. Platform authorization administrators can explicitly delegate new actions; namespace administrators remain bounded by their own namespace and permissions. All commands support `--base-url` and `--json`.
417
+
418
+ Root-only migration: `pmate role migration preview --json`, then `pmate role migration apply --json`. It preserves old records, migrates bindings to canonical role IDs, and records completion so revoked grants are not restored by rerunning migration.
package/dist/index.d.ts CHANGED
@@ -336,15 +336,15 @@ type OssCommandArgs = {
336
336
  };
337
337
  type RoleCommandArgs = {
338
338
  type: Command.Role;
339
- resource: "definition";
340
- action: "list";
341
- baseUrl?: string;
342
- json: boolean;
343
- } | {
344
- type: Command.Role;
345
- resource: "definition";
346
- action: "create";
347
- role: string;
339
+ resource: "definition" | "permission" | "grant" | "binding" | "migration" | "check";
340
+ action: "list" | "create" | "update" | "add" | "remove" | "preview" | "apply" | "check";
341
+ role?: string;
342
+ permission?: string;
343
+ account?: string;
344
+ namespace?: string;
345
+ scope?: "platform";
346
+ scopeType?: "platform" | "namespace";
347
+ status?: "active" | "disabled";
348
348
  displayName?: string;
349
349
  description?: string;
350
350
  baseUrl?: string;