Write grants: page share --role, role in page shares, pkg publish --owner (adom/wiki#252)
The wiki server now supports write grants (adom/wiki#252, on main, going to prod with the next tag). The CLI needs three small changes to use them.
1. page share --role
POST /api/pages/<owner>/<slug>/grants takes an optional role: read (the default, every grant made so far) or write.
adom-wiki page share <owner>/<slug> --user <handle> --role write
- Granting again with a different role changes it. The response has
changed: trueandgrant.role. - An unknown role answers
400 BAD_GRANT_ROLEwithdata.allowed: ["read", "write"].
2. page shares shows the role
GET /api/pages/<owner>/<slug>/grants returns role on every row, next to user_name, granted_by and created_at. Please add it as a column.
3. pkg publish --owner <handle>
A write grantee publishes into the owner's page by sending an owner multipart form field with the publish (the page's namespace). This is a form field, not a manifest key, so an owner already in someone's package.json changes nothing.
- The page must already exist. The publish keeps its owner, org and author.
- If the caller can't write the page, or it doesn't exist:
404 PAGE_NOT_FOUNDwithdata: { owner, slug }. - If the manifest would change
visibility,release_visibility,source_visibilityorpkg_visibilityfor a write grantee:403 MANAGER_ONLYwithdata.fields. The current value restated is fine.
repo push needs no change: POST /files already accepts write grantees.
Errors worth a hint
A write grantee who calls an owner-only route (visibility, grants, shares, transfer, rename, delete, purge, unpublish, withdraw, secrets) now gets 403 MANAGER_ONLY instead of the 404. The response hint says what they can and can't do; the CLI can print it as is.