@pmate/cli 0.42.7 → 0.44.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 +24 -0
- package/dist/index.d.ts +12 -9
- package/dist/index.js +313 -390
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -394,3 +394,27 @@ 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 --level maintainer --display-name Reviewer --description "Review PMate apps"
|
|
405
|
+
pmate role permission create app:review --scope-type namespace --risk M --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.
|
|
419
|
+
|
|
420
|
+
Permission risk: H requires an admin-level role, M requires maintainer or admin, L allows dev or higher. The same role must carry the explicit scoped grant. New roles default to dev and new permissions default to H. Use `role definition update <role> --level ...` and `role permission update <permission> --risk ...`; omitted values are preserved. Root may preview/apply the one-time risk migration using `role migration preview|apply --risk-model --json`.
|
package/dist/index.d.ts
CHANGED
|
@@ -335,16 +335,19 @@ type OssCommandArgs = {
|
|
|
335
335
|
objectKey: string;
|
|
336
336
|
};
|
|
337
337
|
type RoleCommandArgs = {
|
|
338
|
+
risk?: "H" | "M" | "L";
|
|
339
|
+
level?: "admin" | "maintainer" | "dev";
|
|
340
|
+
riskModel?: boolean;
|
|
338
341
|
type: Command.Role;
|
|
339
|
-
resource: "definition";
|
|
340
|
-
action: "list";
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
342
|
+
resource: "definition" | "permission" | "grant" | "binding" | "migration" | "check";
|
|
343
|
+
action: "list" | "create" | "update" | "add" | "remove" | "preview" | "apply" | "check";
|
|
344
|
+
role?: string;
|
|
345
|
+
permission?: string;
|
|
346
|
+
account?: string;
|
|
347
|
+
namespace?: string;
|
|
348
|
+
scope?: "platform";
|
|
349
|
+
scopeType?: "platform" | "namespace";
|
|
350
|
+
status?: "active" | "disabled";
|
|
348
351
|
displayName?: string;
|
|
349
352
|
description?: string;
|
|
350
353
|
baseUrl?: string;
|