Skip to content

Commit 3c0a8e2

Browse files
MajorTalclaude
andcommitted
docs(cli): add worked manifest example with views + rpcs slices
The RPC entry shape (signature regex, grant_to roles) was only visible in the JSON Schema — every worked example in llms-cli.txt showed tables-only manifests. Adds a full example next to the policy table and spells out the signature regex constraint and role enumeration in prose, so agents don't have to fetch the schema to author RPC grants. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 99a1a20 commit 3c0a8e2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

cli/llms-cli.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,28 @@ Built-in policies (one per table):
672672

673673
`—` = denied. `service_key` bypasses all policies. **Views** are always created with `security_invoker=true` — they inherit the underlying table's RLS. **RPCs** require an entry in `rpcs[*]` with `grant_to` to be callable as `/rest/v1/rpc/<fn>` (since v1.30, `CREATE FUNCTION` revokes PUBLIC EXECUTE automatically).
674674

675+
Worked example covering all three slices (drop in as `manifest.json` or under `database.expose` in a deploy manifest):
676+
677+
```json
678+
{
679+
"$schema": "https://run402.com/schemas/manifest.v1.json",
680+
"version": "1",
681+
"tables": [
682+
{ "name": "posts", "expose": true, "policy": "public_read_authenticated_write" },
683+
{ "name": "notes", "expose": true, "policy": "user_owns_rows", "owner_column": "user_id", "force_owner_on_insert": true }
684+
],
685+
"views": [
686+
{ "name": "posts_public", "base": "posts", "select": ["id", "title", "published_at"], "expose": true }
687+
],
688+
"rpcs": [
689+
{ "name": "increment_counter", "signature": "(counter_name text)", "grant_to": ["authenticated"] },
690+
{ "name": "now_utc", "signature": "()", "grant_to": ["anon", "authenticated"] }
691+
]
692+
}
693+
```
694+
695+
`rpcs[*].signature` is the parenthesized argument list — `"()"` for no-arg functions, `"(arg_name type, ...)"` otherwise. The schema regex is `^\([^;]*\)$` (no semicolons, parentheses required). `grant_to` is a non-empty array of Postgres roles — typically `anon`, `authenticated`, `service_role`, or `project_admin`. The function must already exist in your migration SQL with a matching signature; the manifest only grants EXECUTE. Views require `base` plus a non-empty `select`; they are always created `security_invoker=true` and inherit the base table's RLS.
696+
675697
**Imperative escape hatch:** for ad-hoc changes outside a deploy, use `run402 projects apply-expose <project_id> --file manifest.json`. Inspect current state with `run402 projects get-expose <project_id>` — `source: "applied"` means it came from a prior apply; `"introspected"` means it was reconstructed from live DB state.
676698

677699
The manifest is **convergent**: applying the same manifest twice is a no-op; items removed between applies have their policies revoked, grants revoked, triggers dropped, views dropped. Include everything you want exposed in every apply.

0 commit comments

Comments
 (0)