@seliseblocks/cli-os 0.2.3 → 0.2.5
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/AI_USAGE_GUIDE.md +560 -560
- package/LICENSE +21 -21
- package/README.md +173 -173
- package/bin/run.js +2 -2
- package/dist/commands/auth/idp/create.d.ts +7 -0
- package/dist/commands/auth/idp/create.js +22 -3
- package/dist/commands/auth/idp/update.d.ts +7 -0
- package/dist/commands/auth/idp/update.js +22 -3
- package/dist/commands/new/web.js +4 -0
- package/dist/index.js +692 -672
- package/dist/lib/scaffold-web/app-core.js +6 -1
- package/dist/lib/scaffold-web/blocks-lib.js +36 -2
- package/dist/skills/blocks-data-gateway-configuration/SKILL.md +204 -204
- package/dist/skills/blocks-data-gateway-crud/SKILL.md +223 -223
- package/dist/skills/blocks-data-storage/SKILL.md +253 -253
- package/dist/skills/blocks-data-storage/flows/object-management.md +124 -124
- package/dist/skills/blocks-frontend-local-https/SKILL.md +100 -100
- package/dist/skills/blocks-iam-access-control/SKILL.md +49 -49
- package/dist/skills/blocks-iam-access-control/flows/feature-gating.md +38 -38
- package/dist/skills/blocks-iam-access-control/flows/manage-roles-permissions.md +110 -110
- package/dist/skills/blocks-iam-account/SKILL.md +169 -169
- package/dist/skills/blocks-iam-mfa/SKILL.md +124 -124
- package/dist/skills/blocks-iam-organizations/SKILL.md +43 -43
- package/dist/skills/blocks-iam-organizations/flows/admin-mutations.md +89 -89
- package/dist/skills/blocks-iam-organizations/flows/read-and-switch.md +57 -57
- package/dist/skills/blocks-iam-sso-oidc-configuration/SKILL.md +105 -89
- package/dist/skills/blocks-iam-sso-oidc-implementation/SKILL.md +80 -80
- package/dist/skills/blocks-iam-users/SKILL.md +131 -131
- package/dist/skills/blocks-localization-configuration/SKILL.md +149 -149
- package/dist/skills/blocks-localization-implementation/SKILL.md +63 -63
- package/dist/skills/blocks-mail/SKILL.md +95 -95
- package/dist/skills/blocks-notification/SKILL.md +69 -69
- package/dist/skills/blocks-notifier/SKILL.md +107 -107
- package/dist/skills/blocks-onboarding/SKILL.md +78 -78
- package/dist/skills/blocks-release-deployment/SKILL.md +81 -81
- package/dist/skills/blocks-secrets/SKILL.md +81 -81
- package/dist/skills/blocks-storage-configuration/SKILL.md +93 -93
- package/dist/skills/lint.mjs +168 -168
- package/package.json +47 -47
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: blocks-notifier
|
|
3
|
-
description: "Push real-time/offline notifications and manage a signed-in user's own notification inbox, via both the SDK (`blocksClient.notifier.*`) and the CLI (`blocks notifier notify|list|unread|mark-read|mark-all-read`). Distinct from the sibling blocks-notification skill, which configures tenant notification-*channel* settings on a different backing service, not sending. `notifier unread` flattens its subscription filter into GET query params since Fetch forbids a GET body. `--dry-run` before `--yes` on CLI `notify`/`mark-read`/`mark-all-read`."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Blocks Notifier — Send & Inbox
|
|
7
|
-
|
|
8
|
-
`notifier` pushes real-time/offline notifications to users, roles, or subscription-filter matches, and reads/manages the signed-in user's own notification inbox. This is a **separate, deliberate concern from the blocks-notification skill**, which manages a tenant's notification-*channel configuration* — which channel/method a notification type uses — on an unrelated backing service. Both this skill and the sibling skill confirm the same distinction from their own side. Don't merge them, and don't reconcile them as if one were a typo for the other — they hit different backing services. If the ask is "configure which channel a notification type uses," route to the blocks-notification skill instead.
|
|
9
|
-
|
|
10
|
-
Unlike `blocks-notification` (100% CLI, no SDK path), **`notifier` has both a CLI and an SDK surface**, and every one of the five operations exists on both:
|
|
11
|
-
|
|
12
|
-
| Operation | CLI | SDK (`blocksClient.notifier.*`) |
|
|
13
|
-
|---|---|---|
|
|
14
|
-
| Send a notification | `blocks notifier notify` | `notify(request)` |
|
|
15
|
-
| List the inbox | `blocks notifier list` | `getNotifications(options)` |
|
|
16
|
-
| Unread by subscription filter | `blocks notifier unread` | `getUnreadNotificationsBySubscriptionFilter(request)` |
|
|
17
|
-
| Mark one read | `blocks notifier mark-read <id>` | `markNotificationAsRead(request)` |
|
|
18
|
-
| Mark all read | `blocks notifier mark-all-read` | `markAllNotificationAsRead()` |
|
|
19
|
-
|
|
20
|
-
## CLI — `blocks notifier *`
|
|
21
|
-
|
|
22
|
-
Every CLI command is project-scoped: each requires an impersonated project session — there is no account-level mode for any of the five. Project resolution follows the same order as everywhere else in this CLI: `--project <tenantId>` flag, then the workspace's `blocks.json`, then the globally selected project from `blocks use <tenantId>`. See the blocks-onboarding skill if no project is selected yet.
|
|
23
|
-
|
|
24
|
-
- **`blocks notifier notify [--user-ids a,b] [--roles a,b] [--connection-id <id>] [--configuration-name <n>] [--subscription-filters '<json>'] [--denormalized-payload <text>] [--save-denormalized-payload-as-object] [--content-available] [--response-key <k>] [--response-value <v>] [--body '<json>'|--file <path>] [--dry-run] [--yes] [--json]`** — target with at least one of `--user-ids`/`--roles`/`--subscription-filters`. `--user-ids` and `--roles` are comma-separated lists; `--subscription-filters` is a raw JSON array string (e.g. `[{"context":"orders","actionName":"created","value":"*"}]`, matching `BlocksNotifierSubscriptionFilter[]`). The body is built by merging `--body`/`--file` first, then layering the convenience flags on top — so an explicit convenience flag always wins over the same field in `--body`/`--file`, and an unset one never overwrites what `--body`/`--file` supplied. `--content-available` and `--save-denormalized-payload-as-object` are true-only booleans (absent when not passed, never an explicit `false`).
|
|
25
|
-
- **`blocks notifier list [--unread-only] [--page <n>] [--page-size <n>] [--sort-by <property>] [--sort-desc] [--filter <text>] [--json]`** — read-only.
|
|
26
|
-
- **`blocks notifier unread [--user-id <id>] [--context <c>] [--action-name <a>] [--value <v>] [--order-by <1|2>] [--json]`** — read-only. See "The GET-with-a-body quirk" below.
|
|
27
|
-
- **`blocks notifier mark-read <id> [--dry-run] [--yes] [--json]`** — `id` may be positional or `--id`; one of the two is required (`Missing --id` if neither given).
|
|
28
|
-
- **`blocks notifier mark-all-read [--dry-run] [--yes] [--json]`** — no body/arguments needed.
|
|
29
|
-
|
|
30
|
-
### The GET-with-a-body quirk (`unread`)
|
|
31
|
-
|
|
32
|
-
This operation is documented upstream as a read with a JSON request body, which the Fetch spec forbids sending on a plain GET-style read. Both the CLI and SDK work around it the same way: flatten the filter fields into the query string instead. Confirmed field names, read directly from source:
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
UserId
|
|
36
|
-
SubscriptionFilterData.Context
|
|
37
|
-
SubscriptionFilterData.ActionName
|
|
38
|
-
SubscriptionFilterData.Value
|
|
39
|
-
OrderBy
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
CLI flags map to them as `--user-id` -> `UserId`, `--context` -> `SubscriptionFilterData.Context`, `--action-name` -> `SubscriptionFilterData.ActionName`, `--value` -> `SubscriptionFilterData.Value`, `--order-by` -> `OrderBy` (an integer, `1|2` per the SDK type — its enum meaning isn't published anywhere, so treat it as opaque and confirm with the user rather than guessing which value means what).
|
|
43
|
-
|
|
44
|
-
This flattening is a **client-side inference, not something verified against a live call** — both the CLI and SDK made the same choice independently, which is corroborating but not proof the real backend accepts it. If a live `notifier unread` call ever errors, re-check this against the actual API response rather than assuming the flattening above is still correct.
|
|
45
|
-
|
|
46
|
-
## SDK — `blocksClient.notifier.*`
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { blocksClient } from "../../lib/blocks/client";
|
|
50
|
-
|
|
51
|
-
await blocksClient.notifier.notify({
|
|
52
|
-
userIds: ["user-1"],
|
|
53
|
-
roles: ["admin"],
|
|
54
|
-
denormalizedPayload: '{"orderId":"123"}',
|
|
55
|
-
saveDenormalizedPayloadAsAnObject: true
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const inbox = await blocksClient.notifier.getNotifications({ isUnreadOnly: true, page: 1, pageSize: 20 });
|
|
59
|
-
|
|
60
|
-
const unread = await blocksClient.notifier.getUnreadNotificationsBySubscriptionFilter({
|
|
61
|
-
userId: "user-1",
|
|
62
|
-
subscriptionFilterData: { context: "orders", actionName: "created" }
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
await blocksClient.notifier.markNotificationAsRead({ id: notificationId });
|
|
66
|
-
await blocksClient.notifier.markAllNotificationAsRead();
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
- **`notify(request: BlocksNotifyRequest)`** — fields: `configurationName?`, `connectionId?`, `contentAvailable?: boolean`, `denormalizedPayload?: string`, `responseKey?`, `responseValue?`, `roles?: string[]`, `saveDenormalizedPayloadAsAnObject?: boolean`, `subscriptionFilters?: BlocksNotifierSubscriptionFilter[]`, `userIds?: string[]`.
|
|
70
|
-
- **`getUnreadNotificationsBySubscriptionFilter(request)`** — fields: `orderBy?: 1 | 2` (opaque enum), `subscriptionFilterData?: { actionName?, context?, value? }`, `userId?`. Internally builds the same flattened query as the CLI (see above) — this is the SDK-side half of the same documented workaround.
|
|
71
|
-
- **`getNotifications(options: BlocksGetNotificationsOptions = {})`** — options: `filter?`, `isUnreadOnly?`, `page?`, `pageSize?`, `sortBy?`, `sortDescending?`. Response shape: `{ notifications: Record<string, unknown>[], totalNotificationsCount: number, unReadNotificationsCount: number }`.
|
|
72
|
-
- **`markAllNotificationAsRead()`** — no arguments.
|
|
73
|
-
- **`markNotificationAsRead(request: BlocksMarkNotificationAsReadRequest)`** — request: `{ id: string }`.
|
|
74
|
-
|
|
75
|
-
`BlocksOfflineNotification` (the shape of items `getUnreadNotificationsBySubscriptionFilter` resolves to) is a loose `Record<string, unknown>` plus known fields `correlationId?`, `createdTime?`, `denormalizedPayload?`, `id?`, `isRead?`, `payload?`, `readByRoles?: string[]`, `readByUserIds?: string[]`. `BlocksNotifierPassThroughResponse` (the `notify`/mark-read/mark-all-read return type) is an untyped `Record<string, unknown>` — the SDK doesn't shape it further; don't assume fields beyond what a live response actually contains.
|
|
76
|
-
|
|
77
|
-
The SDK methods don't take a project/tenant argument per call — project context comes from however the app's shared `blocksClient` instance was constructed (its `xBlocksKey`/`appDomain`), same as every other `blocksClient.*` namespace. Don't create a second client just for notifier calls.
|
|
78
|
-
|
|
79
|
-
## Mutation discipline (CLI only)
|
|
80
|
-
|
|
81
|
-
`notify`, `mark-read`, and `mark-all-read` are the three CLI mutations, and all three follow the same two-gate pattern used throughout this CLI:
|
|
82
|
-
|
|
83
|
-
1. **`--dry-run`** short-circuits before any network call or confirmation prompt, printing a preview of what would be sent (`mark-all-read`'s preview has no request body since it sends none).
|
|
84
|
-
2. Without `--dry-run`, a confirmation step accepts `--yes` outright or, interactively, prompts to type "yes" to continue, and cancels on anything else.
|
|
85
|
-
|
|
86
|
-
Always show the `--dry-run` output and get explicit approval before re-running with `--yes`. `list` and `unread` are read-only and have neither flag — don't tell a user to `--dry-run` a `list` or `unread` call. The SDK methods have no equivalent gate at all; that discipline is a CLI-only convention for terminal/CI operators, not something app code needs to replicate.
|
|
87
|
-
|
|
88
|
-
## Gotchas
|
|
89
|
-
|
|
90
|
-
- **`notifier` and `notification` are not the same thing, and this is not an oversight to fix.** `notifier` (this skill) sends notifications and reads a user's inbox, on both CLI and SDK. `notification` (the sibling skill) configures a tenant's notification channel settings, CLI-only. Don't answer a "send a notification" ask with `notification save`, and don't answer a "configure the channel" ask with `notifier`.
|
|
91
|
-
- **`notifier unread`'s query-param flattening is an inferred client-side workaround for a Fetch-spec conflict, not verified against a live call.** See "The GET-with-a-body quirk" above. If it ever errors in practice, re-check whether the real endpoint tolerates a body server-side (some non-browser/non-Node HTTP stacks do) before assuming the flattening itself is broken.
|
|
92
|
-
- **`--content-available` and `--save-denormalized-payload-as-object` on `notify` are true-only flags.** Passing them sends `true`; omitting them omits the field entirely — there's no way to send an explicit `false` through the convenience flags (use `--body`/`--file` for that).
|
|
93
|
-
- **Convenience flags on `notify` win over `--body`/`--file`.** The merge order is `--body`/`--file` first, then the individual flags spread on top — so a flag like `--connection-id` always overrides the same key in `--body` if both are given.
|
|
94
|
-
- **`order-by` (both CLI `--order-by` and SDK `orderBy`) is an opaque `1|2` enum** — its meaning isn't published anywhere. Ask the user or confirm from the live API rather than guessing which value sorts which way.
|
|
95
|
-
- **Every CLI command is project-scoped**; there's no account-level mode. The SDK has no per-call project argument — it inherits whatever project the shared `blocksClient` was configured for.
|
|
96
|
-
- **`mark-read`'s `id` (positional or `--id`) is always required** — never guessed or defaulted.
|
|
97
|
-
- **`--dry-run` before `--yes`, always**, on the three CLI mutations — same discipline as every other mutating `blocks` command in this pack.
|
|
98
|
-
|
|
99
|
-
## Example trigger prompts
|
|
100
|
-
|
|
101
|
-
- "Send a notification to these user IDs from my app." -> SDK `blocksClient.notifier.notify({ userIds: [...] })`.
|
|
102
|
-
- "Push a notification to everyone matching this subscription filter." -> SDK `notify({ subscriptionFilters: [...] })`, or `blocks notifier notify --subscription-filters '<json>' --dry-run --json` from the terminal.
|
|
103
|
-
- "Show me a user's unread notifications for the 'orders' context." -> `blocks notifier unread --user-id <id> --context orders --json`, or SDK `getUnreadNotificationsBySubscriptionFilter({ userId, subscriptionFilterData: { context: "orders" } })`.
|
|
104
|
-
- "List my notification inbox, unread only." -> `blocks notifier list --unread-only --json`, or SDK `getNotifications({ isUnreadOnly: true })`.
|
|
105
|
-
- "Mark this notification as read." -> `blocks notifier mark-read <id> --dry-run --json`, then `--yes`.
|
|
106
|
-
- "Mark everything in the inbox as read." -> `blocks notifier mark-all-read --dry-run --json`, then `--yes`.
|
|
107
|
-
- "Configure which channel the order-shipped notification uses." -> not this skill; that's the blocks-notification skill.
|
|
1
|
+
---
|
|
2
|
+
name: blocks-notifier
|
|
3
|
+
description: "Push real-time/offline notifications and manage a signed-in user's own notification inbox, via both the SDK (`blocksClient.notifier.*`) and the CLI (`blocks notifier notify|list|unread|mark-read|mark-all-read`). Distinct from the sibling blocks-notification skill, which configures tenant notification-*channel* settings on a different backing service, not sending. `notifier unread` flattens its subscription filter into GET query params since Fetch forbids a GET body. `--dry-run` before `--yes` on CLI `notify`/`mark-read`/`mark-all-read`."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Blocks Notifier — Send & Inbox
|
|
7
|
+
|
|
8
|
+
`notifier` pushes real-time/offline notifications to users, roles, or subscription-filter matches, and reads/manages the signed-in user's own notification inbox. This is a **separate, deliberate concern from the blocks-notification skill**, which manages a tenant's notification-*channel configuration* — which channel/method a notification type uses — on an unrelated backing service. Both this skill and the sibling skill confirm the same distinction from their own side. Don't merge them, and don't reconcile them as if one were a typo for the other — they hit different backing services. If the ask is "configure which channel a notification type uses," route to the blocks-notification skill instead.
|
|
9
|
+
|
|
10
|
+
Unlike `blocks-notification` (100% CLI, no SDK path), **`notifier` has both a CLI and an SDK surface**, and every one of the five operations exists on both:
|
|
11
|
+
|
|
12
|
+
| Operation | CLI | SDK (`blocksClient.notifier.*`) |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| Send a notification | `blocks notifier notify` | `notify(request)` |
|
|
15
|
+
| List the inbox | `blocks notifier list` | `getNotifications(options)` |
|
|
16
|
+
| Unread by subscription filter | `blocks notifier unread` | `getUnreadNotificationsBySubscriptionFilter(request)` |
|
|
17
|
+
| Mark one read | `blocks notifier mark-read <id>` | `markNotificationAsRead(request)` |
|
|
18
|
+
| Mark all read | `blocks notifier mark-all-read` | `markAllNotificationAsRead()` |
|
|
19
|
+
|
|
20
|
+
## CLI — `blocks notifier *`
|
|
21
|
+
|
|
22
|
+
Every CLI command is project-scoped: each requires an impersonated project session — there is no account-level mode for any of the five. Project resolution follows the same order as everywhere else in this CLI: `--project <tenantId>` flag, then the workspace's `blocks.json`, then the globally selected project from `blocks use <tenantId>`. See the blocks-onboarding skill if no project is selected yet.
|
|
23
|
+
|
|
24
|
+
- **`blocks notifier notify [--user-ids a,b] [--roles a,b] [--connection-id <id>] [--configuration-name <n>] [--subscription-filters '<json>'] [--denormalized-payload <text>] [--save-denormalized-payload-as-object] [--content-available] [--response-key <k>] [--response-value <v>] [--body '<json>'|--file <path>] [--dry-run] [--yes] [--json]`** — target with at least one of `--user-ids`/`--roles`/`--subscription-filters`. `--user-ids` and `--roles` are comma-separated lists; `--subscription-filters` is a raw JSON array string (e.g. `[{"context":"orders","actionName":"created","value":"*"}]`, matching `BlocksNotifierSubscriptionFilter[]`). The body is built by merging `--body`/`--file` first, then layering the convenience flags on top — so an explicit convenience flag always wins over the same field in `--body`/`--file`, and an unset one never overwrites what `--body`/`--file` supplied. `--content-available` and `--save-denormalized-payload-as-object` are true-only booleans (absent when not passed, never an explicit `false`).
|
|
25
|
+
- **`blocks notifier list [--unread-only] [--page <n>] [--page-size <n>] [--sort-by <property>] [--sort-desc] [--filter <text>] [--json]`** — read-only.
|
|
26
|
+
- **`blocks notifier unread [--user-id <id>] [--context <c>] [--action-name <a>] [--value <v>] [--order-by <1|2>] [--json]`** — read-only. See "The GET-with-a-body quirk" below.
|
|
27
|
+
- **`blocks notifier mark-read <id> [--dry-run] [--yes] [--json]`** — `id` may be positional or `--id`; one of the two is required (`Missing --id` if neither given).
|
|
28
|
+
- **`blocks notifier mark-all-read [--dry-run] [--yes] [--json]`** — no body/arguments needed.
|
|
29
|
+
|
|
30
|
+
### The GET-with-a-body quirk (`unread`)
|
|
31
|
+
|
|
32
|
+
This operation is documented upstream as a read with a JSON request body, which the Fetch spec forbids sending on a plain GET-style read. Both the CLI and SDK work around it the same way: flatten the filter fields into the query string instead. Confirmed field names, read directly from source:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
UserId
|
|
36
|
+
SubscriptionFilterData.Context
|
|
37
|
+
SubscriptionFilterData.ActionName
|
|
38
|
+
SubscriptionFilterData.Value
|
|
39
|
+
OrderBy
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
CLI flags map to them as `--user-id` -> `UserId`, `--context` -> `SubscriptionFilterData.Context`, `--action-name` -> `SubscriptionFilterData.ActionName`, `--value` -> `SubscriptionFilterData.Value`, `--order-by` -> `OrderBy` (an integer, `1|2` per the SDK type — its enum meaning isn't published anywhere, so treat it as opaque and confirm with the user rather than guessing which value means what).
|
|
43
|
+
|
|
44
|
+
This flattening is a **client-side inference, not something verified against a live call** — both the CLI and SDK made the same choice independently, which is corroborating but not proof the real backend accepts it. If a live `notifier unread` call ever errors, re-check this against the actual API response rather than assuming the flattening above is still correct.
|
|
45
|
+
|
|
46
|
+
## SDK — `blocksClient.notifier.*`
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { blocksClient } from "../../lib/blocks/client";
|
|
50
|
+
|
|
51
|
+
await blocksClient.notifier.notify({
|
|
52
|
+
userIds: ["user-1"],
|
|
53
|
+
roles: ["admin"],
|
|
54
|
+
denormalizedPayload: '{"orderId":"123"}',
|
|
55
|
+
saveDenormalizedPayloadAsAnObject: true
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const inbox = await blocksClient.notifier.getNotifications({ isUnreadOnly: true, page: 1, pageSize: 20 });
|
|
59
|
+
|
|
60
|
+
const unread = await blocksClient.notifier.getUnreadNotificationsBySubscriptionFilter({
|
|
61
|
+
userId: "user-1",
|
|
62
|
+
subscriptionFilterData: { context: "orders", actionName: "created" }
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
await blocksClient.notifier.markNotificationAsRead({ id: notificationId });
|
|
66
|
+
await blocksClient.notifier.markAllNotificationAsRead();
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **`notify(request: BlocksNotifyRequest)`** — fields: `configurationName?`, `connectionId?`, `contentAvailable?: boolean`, `denormalizedPayload?: string`, `responseKey?`, `responseValue?`, `roles?: string[]`, `saveDenormalizedPayloadAsAnObject?: boolean`, `subscriptionFilters?: BlocksNotifierSubscriptionFilter[]`, `userIds?: string[]`.
|
|
70
|
+
- **`getUnreadNotificationsBySubscriptionFilter(request)`** — fields: `orderBy?: 1 | 2` (opaque enum), `subscriptionFilterData?: { actionName?, context?, value? }`, `userId?`. Internally builds the same flattened query as the CLI (see above) — this is the SDK-side half of the same documented workaround.
|
|
71
|
+
- **`getNotifications(options: BlocksGetNotificationsOptions = {})`** — options: `filter?`, `isUnreadOnly?`, `page?`, `pageSize?`, `sortBy?`, `sortDescending?`. Response shape: `{ notifications: Record<string, unknown>[], totalNotificationsCount: number, unReadNotificationsCount: number }`.
|
|
72
|
+
- **`markAllNotificationAsRead()`** — no arguments.
|
|
73
|
+
- **`markNotificationAsRead(request: BlocksMarkNotificationAsReadRequest)`** — request: `{ id: string }`.
|
|
74
|
+
|
|
75
|
+
`BlocksOfflineNotification` (the shape of items `getUnreadNotificationsBySubscriptionFilter` resolves to) is a loose `Record<string, unknown>` plus known fields `correlationId?`, `createdTime?`, `denormalizedPayload?`, `id?`, `isRead?`, `payload?`, `readByRoles?: string[]`, `readByUserIds?: string[]`. `BlocksNotifierPassThroughResponse` (the `notify`/mark-read/mark-all-read return type) is an untyped `Record<string, unknown>` — the SDK doesn't shape it further; don't assume fields beyond what a live response actually contains.
|
|
76
|
+
|
|
77
|
+
The SDK methods don't take a project/tenant argument per call — project context comes from however the app's shared `blocksClient` instance was constructed (its `xBlocksKey`/`appDomain`), same as every other `blocksClient.*` namespace. Don't create a second client just for notifier calls.
|
|
78
|
+
|
|
79
|
+
## Mutation discipline (CLI only)
|
|
80
|
+
|
|
81
|
+
`notify`, `mark-read`, and `mark-all-read` are the three CLI mutations, and all three follow the same two-gate pattern used throughout this CLI:
|
|
82
|
+
|
|
83
|
+
1. **`--dry-run`** short-circuits before any network call or confirmation prompt, printing a preview of what would be sent (`mark-all-read`'s preview has no request body since it sends none).
|
|
84
|
+
2. Without `--dry-run`, a confirmation step accepts `--yes` outright or, interactively, prompts to type "yes" to continue, and cancels on anything else.
|
|
85
|
+
|
|
86
|
+
Always show the `--dry-run` output and get explicit approval before re-running with `--yes`. `list` and `unread` are read-only and have neither flag — don't tell a user to `--dry-run` a `list` or `unread` call. The SDK methods have no equivalent gate at all; that discipline is a CLI-only convention for terminal/CI operators, not something app code needs to replicate.
|
|
87
|
+
|
|
88
|
+
## Gotchas
|
|
89
|
+
|
|
90
|
+
- **`notifier` and `notification` are not the same thing, and this is not an oversight to fix.** `notifier` (this skill) sends notifications and reads a user's inbox, on both CLI and SDK. `notification` (the sibling skill) configures a tenant's notification channel settings, CLI-only. Don't answer a "send a notification" ask with `notification save`, and don't answer a "configure the channel" ask with `notifier`.
|
|
91
|
+
- **`notifier unread`'s query-param flattening is an inferred client-side workaround for a Fetch-spec conflict, not verified against a live call.** See "The GET-with-a-body quirk" above. If it ever errors in practice, re-check whether the real endpoint tolerates a body server-side (some non-browser/non-Node HTTP stacks do) before assuming the flattening itself is broken.
|
|
92
|
+
- **`--content-available` and `--save-denormalized-payload-as-object` on `notify` are true-only flags.** Passing them sends `true`; omitting them omits the field entirely — there's no way to send an explicit `false` through the convenience flags (use `--body`/`--file` for that).
|
|
93
|
+
- **Convenience flags on `notify` win over `--body`/`--file`.** The merge order is `--body`/`--file` first, then the individual flags spread on top — so a flag like `--connection-id` always overrides the same key in `--body` if both are given.
|
|
94
|
+
- **`order-by` (both CLI `--order-by` and SDK `orderBy`) is an opaque `1|2` enum** — its meaning isn't published anywhere. Ask the user or confirm from the live API rather than guessing which value sorts which way.
|
|
95
|
+
- **Every CLI command is project-scoped**; there's no account-level mode. The SDK has no per-call project argument — it inherits whatever project the shared `blocksClient` was configured for.
|
|
96
|
+
- **`mark-read`'s `id` (positional or `--id`) is always required** — never guessed or defaulted.
|
|
97
|
+
- **`--dry-run` before `--yes`, always**, on the three CLI mutations — same discipline as every other mutating `blocks` command in this pack.
|
|
98
|
+
|
|
99
|
+
## Example trigger prompts
|
|
100
|
+
|
|
101
|
+
- "Send a notification to these user IDs from my app." -> SDK `blocksClient.notifier.notify({ userIds: [...] })`.
|
|
102
|
+
- "Push a notification to everyone matching this subscription filter." -> SDK `notify({ subscriptionFilters: [...] })`, or `blocks notifier notify --subscription-filters '<json>' --dry-run --json` from the terminal.
|
|
103
|
+
- "Show me a user's unread notifications for the 'orders' context." -> `blocks notifier unread --user-id <id> --context orders --json`, or SDK `getUnreadNotificationsBySubscriptionFilter({ userId, subscriptionFilterData: { context: "orders" } })`.
|
|
104
|
+
- "List my notification inbox, unread only." -> `blocks notifier list --unread-only --json`, or SDK `getNotifications({ isUnreadOnly: true })`.
|
|
105
|
+
- "Mark this notification as read." -> `blocks notifier mark-read <id> --dry-run --json`, then `--yes`.
|
|
106
|
+
- "Mark everything in the inbox as read." -> `blocks notifier mark-all-read --dry-run --json`, then `--yes`.
|
|
107
|
+
- "Configure which channel the order-shipped notification uses." -> not this skill; that's the blocks-notification skill.
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: blocks-onboarding
|
|
3
|
-
description: "Onboard a user into SELISE Blocks before any other Blocks skill can run, using the `blocks` CLI — never raw API calls. Detects current state (CLI installed?, logged in?, project selected?) via `blocks auth status --json`/`doctor --json` and closes each gap: install, `login` (device-code, no setup needed), list/select a project (`projects create` is currently disabled — new projects come from the portal), `blocks init`, then resolve/create the app's OIDC client via `auth oidc-clients` (no portal needed) before handing off to `blocks new web`. Use when a user is new to Blocks, asks how to get started, or hits `not_logged_in`/`project_not_selected` from another command."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Blocks — Onboarding
|
|
7
|
-
|
|
8
|
-
Every other Blocks skill assumes: the `blocks` CLI is installed, the user is logged in (`login`), and a project is selected (`use`). This skill detects which of those is missing and closes the gap. **Everything here goes through `blocks` — never a raw `fetch`/`curl` against `api.seliseblocks.com`.**
|
|
9
|
-
|
|
10
|
-
The CLI's own usage guide (bundled with the `blocks-cli` package) is the command-level ground truth (exact flags, defaults, failure codes); this skill is the conversational flow around it — what to ask, what's portal-only, and in what order.
|
|
11
|
-
|
|
12
|
-
## Probe first, ask second
|
|
13
|
-
|
|
14
|
-
Run `blocks auth status --json` and branch on the result — don't interrogate the user about state that's discoverable:
|
|
15
|
-
|
|
16
|
-
| Signal | State | Do this |
|
|
17
|
-
|---|---|---|
|
|
18
|
-
| command not found | CLI not installed | `npm install -g @seliseblocks/cli-os`, then re-probe |
|
|
19
|
-
| `accountAccessToken`/`accountRefreshToken` both `"missing"` | Never logged in | Step 1 — `login` |
|
|
20
|
-
| logged in, no project selected (check `blocks doctor --json`'s "Project selected" check) | No project selected | Step 2 — list/`use` |
|
|
21
|
-
| logged in, project selected | Ready | Confirm the project with the user — always show the full accessible-project list and which one is currently selected, never silently continue on a prior session's selection — then hand off to the skill/task that brought you here |
|
|
22
|
-
|
|
23
|
-
If anything looks broken rather than simply "not yet done" (unreadable/stale local token storage after a machine migration, Windows profile change, Keychain reset), run `blocks doctor --json` for the fuller diagnostic — it checks Node version, config/token/secret file locations, and token freshness in one pass. If storage itself is unreadable or corrupted, `blocks auth remove <account>` clears cached tokens and stored local credentials (restoring the packaged default account), then re-run `login`.
|
|
24
|
-
|
|
25
|
-
## Step 1 — Log in
|
|
26
|
-
|
|
27
|
-
The CLI authenticates itself with no setup. There is no OIDC client to register in the portal for this, no client id/secret to collect from the user, and nothing about how the CLI does it to look up, print, or report — just log in:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
blocks login
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Device-code flow: it prints a verification URL and user code, opens the browser to the verification page when possible so the user only needs to click approve, then polls until the device is authorized; stores account access and refresh tokens and auto-refreshes later. Run it yourself rather than only telling the user to run it, so you can read the printed code/URL and confirm the result right after.
|
|
34
|
-
|
|
35
|
-
Verify with `blocks auth status --json` — re-run after login rather than assuming it worked.
|
|
36
|
-
|
|
37
|
-
## Step 2 — Project
|
|
38
|
-
|
|
39
|
-
Ask **what the user wants to build** and whether they already have a project, rather than assuming:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
blocks projects list --json
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Always show the full list of accessible projects, and if one already appears selected, say which one — never silently continue on a prior session's selection. If projects exist, confirm which one (and which environment) the user wants; never guess.
|
|
46
|
-
|
|
47
|
-
**`projects create` is currently disabled in this CLI build** (commented out pending a product decision — there is no CLI path to create a new project). If none of the listed projects fit, tell the user a new project must be created from the Blocks portal first; once they confirm it exists, re-run `blocks projects list --json` and continue from here.
|
|
48
|
-
|
|
49
|
-
Then select it:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
blocks use <x-blocks-key>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Project (impersonation) tokens are created lazily from the account session the first time a project-scoped command needs one — never ask the user for a project token directly. If an impersonated project token later gets stuck, rejected, or expired and `blocks auth refresh --project --json` doesn't fix it, recover with:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
blocks deselect # drops the selection and its cached impersonation token
|
|
59
|
-
blocks use <x-blocks-key> # reselect the same x-blocks-key to force a fresh impersonation
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Step 3 — Local workspace + hand off
|
|
63
|
-
|
|
64
|
-
Run `blocks init` once per project directory to create `blocks.json`, `blocks/data/schemas/`, `blocks/data/rules.json`, and `.env.example` — the later data-gateway skills read/write these. Safe to re-run: it never overwrites files that already exist. (`init` does not create a localization folder or any release-related file — `blocks/localization/` only appears later, lazily, the first time `blocks localization pull` writes to it, and there is no `blocks/release/*` file at all.)
|
|
65
|
-
|
|
66
|
-
Then route to what the user actually wants:
|
|
67
|
-
- Building a frontend from scratch → resolve the app's public OIDC client first, then scaffold:
|
|
68
|
-
- `blocks auth oidc-clients list --json` — check whether a client already registered for this project fits. If none fits, create one directly (no portal visit needed): `blocks auth oidc-clients save --client-display-name <appName> --redirect-uris https://<domain>:5173/login/callback --scope "openid profile" --require-pkce --register-as-identity-provider --dry-run --json`, then re-run with `--yes` after showing the dry-run output and getting approval. See the blocks-iam-sso-oidc-configuration skill for the full decision tree and field-level gotchas.
|
|
69
|
-
- `blocks new web <name> --x-blocks-key <tenantId> --app-domain <domain> --client-id <the-resolved-client-id>`. **Always pass `--client-id` and `--app-domain` explicitly** — omitting either drops `new web` into an interactive pick-list prompt with no non-interactive escape (not even to "skip"), which hangs a scripted/agent run with no stdin to answer it. Omit `--blocks-api-url` unless the project uses a non-default gateway; the scaffold derives it from the app domain, e.g. `https://dqrsf.slsblx.com` -> `https://blocksapi.slsblx.com`.
|
|
70
|
-
- Defining data / CRUD / localization / release on an existing project → hand off to the matching skill; the project is already selected via `blocks use`, so its commands can proceed directly.
|
|
71
|
-
|
|
72
|
-
## Gotchas
|
|
73
|
-
|
|
74
|
-
- **Only one OIDC client matters here, and it's not the CLI's.** The CLI authenticates itself with no setup — nothing to register, nothing portal-only about `blocks login` itself, and nothing about how it does so to look up or mention. The only OIDC client involved is the scaffolded app's *public* browser client for its own end-user login (Step 3) — and that no longer requires the portal either: `blocks auth oidc-clients list`/`save` resolve or create it entirely through the CLI on the project's impersonated token. The portal remains available if the user prefers it, but it's an alternative, not a requirement. Don't tell a user they need to register anything before `blocks login` will work, and don't send them to the portal for the app's OIDC client by default.
|
|
75
|
-
- **`blocks new web` hangs a non-interactive run if `--client-id` or `--app-domain` is omitted** — it drops into an interactive pick-list (even to offer "skip") with no stdin to answer it in an agent-driven session. Always resolve both explicitly first (Step 3) rather than omitting either and hoping for a graceful default.
|
|
76
|
-
- **Never open, read, print, or expose the CLI's local storage files** (its config/token/secret files on disk) or anything inside them — client ids, root tenant id, account names, tokens. Only ever interact with them through `blocks` commands, never by inspecting the files directly. `auth status`/`doctor` only ever report token state (`missing`/`valid`/`expired`), never the value.
|
|
77
|
-
- **Known CLI error codes and fixes** (from the CLI's own error handling): `not_logged_in` → `blocks login`; `refresh_token_rejected` → `blocks login`; unreadable/stale local auth storage → `blocks auth remove <account>` then `blocks login`; `project_not_selected` → `blocks use <x-blocks-key>` (or pass `--project <tenantId>` for a single one-off command); `api_auth_failed` → `blocks auth status --json` then log in again; `impersonation_invalid_client` → not a stale-token problem, the account's OIDC client isn't registered for impersonation — check `blocks auth config get` and have an admin register it, `login`/`deselect`+`use` won't fix this one.
|
|
78
|
-
- **`--dry-run` before `--yes`** on every mutating command (`auth oidc-clients save`, `data schema push`/`data rules deploy`, `localization push`, `release deploy`) — this recurs in every skill that mutates project state.
|
|
1
|
+
---
|
|
2
|
+
name: blocks-onboarding
|
|
3
|
+
description: "Onboard a user into SELISE Blocks before any other Blocks skill can run, using the `blocks` CLI — never raw API calls. Detects current state (CLI installed?, logged in?, project selected?) via `blocks auth status --json`/`doctor --json` and closes each gap: install, `login` (device-code, no setup needed), list/select a project (`projects create` is currently disabled — new projects come from the portal), `blocks init`, then resolve/create the app's OIDC client via `auth oidc-clients` (no portal needed) before handing off to `blocks new web`. Use when a user is new to Blocks, asks how to get started, or hits `not_logged_in`/`project_not_selected` from another command."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Blocks — Onboarding
|
|
7
|
+
|
|
8
|
+
Every other Blocks skill assumes: the `blocks` CLI is installed, the user is logged in (`login`), and a project is selected (`use`). This skill detects which of those is missing and closes the gap. **Everything here goes through `blocks` — never a raw `fetch`/`curl` against `api.seliseblocks.com`.**
|
|
9
|
+
|
|
10
|
+
The CLI's own usage guide (bundled with the `blocks-cli` package) is the command-level ground truth (exact flags, defaults, failure codes); this skill is the conversational flow around it — what to ask, what's portal-only, and in what order.
|
|
11
|
+
|
|
12
|
+
## Probe first, ask second
|
|
13
|
+
|
|
14
|
+
Run `blocks auth status --json` and branch on the result — don't interrogate the user about state that's discoverable:
|
|
15
|
+
|
|
16
|
+
| Signal | State | Do this |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| command not found | CLI not installed | `npm install -g @seliseblocks/cli-os`, then re-probe |
|
|
19
|
+
| `accountAccessToken`/`accountRefreshToken` both `"missing"` | Never logged in | Step 1 — `login` |
|
|
20
|
+
| logged in, no project selected (check `blocks doctor --json`'s "Project selected" check) | No project selected | Step 2 — list/`use` |
|
|
21
|
+
| logged in, project selected | Ready | Confirm the project with the user — always show the full accessible-project list and which one is currently selected, never silently continue on a prior session's selection — then hand off to the skill/task that brought you here |
|
|
22
|
+
|
|
23
|
+
If anything looks broken rather than simply "not yet done" (unreadable/stale local token storage after a machine migration, Windows profile change, Keychain reset), run `blocks doctor --json` for the fuller diagnostic — it checks Node version, config/token/secret file locations, and token freshness in one pass. If storage itself is unreadable or corrupted, `blocks auth remove <account>` clears cached tokens and stored local credentials (restoring the packaged default account), then re-run `login`.
|
|
24
|
+
|
|
25
|
+
## Step 1 — Log in
|
|
26
|
+
|
|
27
|
+
The CLI authenticates itself with no setup. There is no OIDC client to register in the portal for this, no client id/secret to collect from the user, and nothing about how the CLI does it to look up, print, or report — just log in:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
blocks login
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Device-code flow: it prints a verification URL and user code, opens the browser to the verification page when possible so the user only needs to click approve, then polls until the device is authorized; stores account access and refresh tokens and auto-refreshes later. Run it yourself rather than only telling the user to run it, so you can read the printed code/URL and confirm the result right after.
|
|
34
|
+
|
|
35
|
+
Verify with `blocks auth status --json` — re-run after login rather than assuming it worked.
|
|
36
|
+
|
|
37
|
+
## Step 2 — Project
|
|
38
|
+
|
|
39
|
+
Ask **what the user wants to build** and whether they already have a project, rather than assuming:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
blocks projects list --json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Always show the full list of accessible projects, and if one already appears selected, say which one — never silently continue on a prior session's selection. If projects exist, confirm which one (and which environment) the user wants; never guess.
|
|
46
|
+
|
|
47
|
+
**`projects create` is currently disabled in this CLI build** (commented out pending a product decision — there is no CLI path to create a new project). If none of the listed projects fit, tell the user a new project must be created from the Blocks portal first; once they confirm it exists, re-run `blocks projects list --json` and continue from here.
|
|
48
|
+
|
|
49
|
+
Then select it:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
blocks use <x-blocks-key>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Project (impersonation) tokens are created lazily from the account session the first time a project-scoped command needs one — never ask the user for a project token directly. If an impersonated project token later gets stuck, rejected, or expired and `blocks auth refresh --project --json` doesn't fix it, recover with:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
blocks deselect # drops the selection and its cached impersonation token
|
|
59
|
+
blocks use <x-blocks-key> # reselect the same x-blocks-key to force a fresh impersonation
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Step 3 — Local workspace + hand off
|
|
63
|
+
|
|
64
|
+
Run `blocks init` once per project directory to create `blocks.json`, `blocks/data/schemas/`, `blocks/data/rules.json`, and `.env.example` — the later data-gateway skills read/write these. Safe to re-run: it never overwrites files that already exist. (`init` does not create a localization folder or any release-related file — `blocks/localization/` only appears later, lazily, the first time `blocks localization pull` writes to it, and there is no `blocks/release/*` file at all.)
|
|
65
|
+
|
|
66
|
+
Then route to what the user actually wants:
|
|
67
|
+
- Building a frontend from scratch → resolve the app's public OIDC client first, then scaffold:
|
|
68
|
+
- `blocks auth oidc-clients list --json` — check whether a client already registered for this project fits. If none fits, create one directly (no portal visit needed): `blocks auth oidc-clients save --client-display-name <appName> --client-type public --redirect-uris https://<domain>:5173/login/callback --scope "openid profile" --require-pkce --register-as-identity-provider --dry-run --json`, then re-run with `--yes` after showing the dry-run output and getting approval. `--client-type public` is required — IAM derives `tokenEndpointAuthMethod` from it, so omitting it stores a browser client as confidential. `--register-as-identity-provider` creates the linked identity provider in the same call; nothing further to run. See the blocks-iam-sso-oidc-configuration skill for the full decision tree and field-level gotchas.
|
|
69
|
+
- `blocks new web <name> --x-blocks-key <tenantId> --app-domain <domain> --client-id <the-resolved-client-id>`. **Always pass `--client-id` and `--app-domain` explicitly** — omitting either drops `new web` into an interactive pick-list prompt with no non-interactive escape (not even to "skip"), which hangs a scripted/agent run with no stdin to answer it. Omit `--blocks-api-url` unless the project uses a non-default gateway; the scaffold derives it from the app domain, e.g. `https://dqrsf.slsblx.com` -> `https://blocksapi.slsblx.com`.
|
|
70
|
+
- Defining data / CRUD / localization / release on an existing project → hand off to the matching skill; the project is already selected via `blocks use`, so its commands can proceed directly.
|
|
71
|
+
|
|
72
|
+
## Gotchas
|
|
73
|
+
|
|
74
|
+
- **Only one OIDC client matters here, and it's not the CLI's.** The CLI authenticates itself with no setup — nothing to register, nothing portal-only about `blocks login` itself, and nothing about how it does so to look up or mention. The only OIDC client involved is the scaffolded app's *public* browser client for its own end-user login (Step 3) — and that no longer requires the portal either: `blocks auth oidc-clients list`/`save` resolve or create it entirely through the CLI on the project's impersonated token. The portal remains available if the user prefers it, but it's an alternative, not a requirement. Don't tell a user they need to register anything before `blocks login` will work, and don't send them to the portal for the app's OIDC client by default.
|
|
75
|
+
- **`blocks new web` hangs a non-interactive run if `--client-id` or `--app-domain` is omitted** — it drops into an interactive pick-list (even to offer "skip") with no stdin to answer it in an agent-driven session. Always resolve both explicitly first (Step 3) rather than omitting either and hoping for a graceful default.
|
|
76
|
+
- **Never open, read, print, or expose the CLI's local storage files** (its config/token/secret files on disk) or anything inside them — client ids, root tenant id, account names, tokens. Only ever interact with them through `blocks` commands, never by inspecting the files directly. `auth status`/`doctor` only ever report token state (`missing`/`valid`/`expired`), never the value.
|
|
77
|
+
- **Known CLI error codes and fixes** (from the CLI's own error handling): `not_logged_in` → `blocks login`; `refresh_token_rejected` → `blocks login`; unreadable/stale local auth storage → `blocks auth remove <account>` then `blocks login`; `project_not_selected` → `blocks use <x-blocks-key>` (or pass `--project <tenantId>` for a single one-off command); `api_auth_failed` → `blocks auth status --json` then log in again; `impersonation_invalid_client` → not a stale-token problem, the account's OIDC client isn't registered for impersonation — check `blocks auth config get` and have an admin register it, `login`/`deselect`+`use` won't fix this one.
|
|
78
|
+
- **`--dry-run` before `--yes`** on every mutating command (`auth oidc-clients save`, `data schema push`/`data rules deploy`, `localization push`, `release deploy`) — this recurs in every skill that mutates project state.
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: blocks-release-deployment
|
|
3
|
-
description: "Trigger and inspect SELISE Blocks Release builds/deploys entirely through `blocks release *` — never raw fetch/curl; there is no SDK path (Release has no `@seliseblocks/client` namespace). Covers `release deploy` (auto-resolves the repo, verifies branch matches environment), `release status`/`builds get` (build lookup by id), and `builds list` (list builds for a repo). Use for 'deploy/trigger a release', 'check build status', 'list recent builds'. Always `--dry-run` before `--yes`. No artifact-upload capability — deploy triggers a configured pipeline only."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Blocks Release — Deployment
|
|
7
|
-
|
|
8
|
-
Trigger and read Release builds through `blocks release *`. This is **100% CLI, no SDK equivalent** — `@seliseblocks/client` (`createBlocksClient()`) exposes only `auth`, `data`, `iam`, and `localization`; there is no `release` namespace anywhere in the SDK. Never write a frontend/app-code path for this — it's always a terminal command.
|
|
9
|
-
|
|
10
|
-
**Prerequisite:** a project is selected (`blocks use <tenantId>`) and that project has a repo linked from the Blocks portal — see the blocks-onboarding skill. There is no local config file for release settings; `blocks init` only scaffolds `blocks/data/schemas/`, `blocks/data/rules.json`, and `.env.example` — it has no release-related output at all. `deploy` and `builds list` both resolve which repo to act on directly from the project's linked assets (see below), not from any file on disk.
|
|
11
|
-
|
|
12
|
-
## Safe read commands
|
|
13
|
-
|
|
14
|
-
- **`blocks release status <buildId> [--json]`** — one build's status by id (positional arg, or `--build-id <id>`).
|
|
15
|
-
- **`blocks release builds get <buildId> [--json]`** — literally the same call as `release status`; it's a pure alias in the CLI's own source (`releaseBuildsGet` just calls `releaseStatus(argv)`), not a different endpoint or response shape. Use whichever name the user said.
|
|
16
|
-
- **`blocks release builds list [<repoId>] [--repo-id <repoId>] [--json]`** — all builds for one repository. `repoId` is optional: if omitted, the CLI auto-resolves it from the selected project's linked repo assets the same way `deploy` does (see "Resolving the repo" below) — **except** when more than one repo is linked, in which case it falls back to an interactive `selectFromList()` prompt instead of erring or guessing. That prompt has no stdin in a non-interactive/agent run and will hang — if you can't guarantee a human is watching the terminal, resolve and pass `--repo-id` explicitly instead of letting this fall through to the prompt (the same hang risk applies to `blocks new web`'s OIDC-client picker when `--client-id` is omitted — always resolve and pass required values explicitly rather than relying on an interactive fallback).
|
|
17
|
-
|
|
18
|
-
None of these mutate anything — safe to run without confirmation.
|
|
19
|
-
|
|
20
|
-
## Mutating: trigger a deploy
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
blocks release deploy --dry-run --json # show the exact request first
|
|
24
|
-
blocks release deploy --yes --json # only after the user approves
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
There is **no `--repo-id` flag on `deploy`** — the repo is always resolved automatically (see below); passing `--repo-id` is not recognized by this command.
|
|
28
|
-
|
|
29
|
-
### Resolving the repo
|
|
30
|
-
|
|
31
|
-
`deploy` never takes a repo id as input. It resolves one from the currently selected project's linked assets:
|
|
32
|
-
|
|
33
|
-
1. It looks up the project's linked repo resources for the project's `tenantGroupId`.
|
|
34
|
-
2. If exactly one repo is linked, that's the one used.
|
|
35
|
-
3. If multiple are linked, it picks the one whose asset `name` matches the project's `environment` (case-insensitive); if none matches, it throws `repo_ambiguous`.
|
|
36
|
-
4. If none are linked at all, it throws `repo_not_linked`.
|
|
37
|
-
|
|
38
|
-
### Branch/environment safety check
|
|
39
|
-
|
|
40
|
-
Before building, `deploy` fetches the resolved repo's details to read its linked branch, then compares that branch to the project's `environment` (case-insensitive). If they don't match, it throws `branch_environment_mismatch` rather than building the wrong branch.
|
|
41
|
-
|
|
42
|
-
### Error codes you may see
|
|
43
|
-
|
|
44
|
-
| Code | Meaning | Fix |
|
|
45
|
-
|---|---|---|
|
|
46
|
-
| `repo_not_linked` | No repo is linked to this project at all. | Link a repo from the Blocks portal (requires GitHub OAuth), then re-run. |
|
|
47
|
-
| `repo_ambiguous` | Multiple repos are linked and none is named for the project's `environment`. | Check the repo links for this project from the Blocks portal. |
|
|
48
|
-
| `repo_not_found` | The linked asset's repo id wasn't found in blocks-release when fetching repo details. | Check the repo link for this project from the Blocks portal. |
|
|
49
|
-
| `branch_environment_mismatch` | The linked repo's branch doesn't match the project's `environment` (e.g. repo is on `main` but environment is `staging`). Message states the branch found and the environment required. | Point the linked repo at a branch named for the environment, or relink the correct branch from the Blocks portal. |
|
|
50
|
-
| `build_wait_timeout` | Only with `--wait`: no terminal build status was seen before `--timeout` elapsed. | Check manually with `blocks release status <buildId>`. |
|
|
51
|
-
|
|
52
|
-
### Optional flags
|
|
53
|
-
|
|
54
|
-
- **`--domain <domain>`** — before triggering the build, makes an extra call to set a custom deployment domain for this repo/environment.
|
|
55
|
-
- **`--wait`** — after triggering, polls the build status (by the returned `buildId`) every `--poll-interval` seconds until the status matches a terminal pattern (succeeded/success/completed/failed/error/cancelled/aborted/done, case-insensitive) or `--timeout` elapses (then throws `build_wait_timeout`).
|
|
56
|
-
- **`--poll-interval <seconds>`** — polling interval for `--wait`, default `10`.
|
|
57
|
-
- **`--timeout <seconds>`** — max time to wait for `--wait`, default `900`.
|
|
58
|
-
|
|
59
|
-
`--dry-run` prints the resolved `repoId`, `branch`, `environment`, `projectKey`, and (if given) `domain` — it does **not** build a request body from any local file, since none exists. The real request when not a dry run is simply `{ repoId }`. Always show the `--dry-run` output and get explicit approval before re-running with `--yes` — never skip straight to `--yes`.
|
|
60
|
-
|
|
61
|
-
## Gotchas
|
|
62
|
-
|
|
63
|
-
- **No SDK path, ever.** If asked "how do I trigger a deploy from my app," the answer is: you don't — this is a CLI-only, human/CI-operated action, not something to wire into frontend code.
|
|
64
|
-
- **No artifact upload.** `release deploy` triggers a *configured* pipeline/repository build — it does not accept or upload a build artifact you hand it. If a user asks to "upload my build and deploy it," that capability doesn't exist in this CLI; say so rather than inventing an upload flag.
|
|
65
|
-
- **`release builds get` and `release status` are the same command.** Don't treat them as returning different data or document them separately — the CLI's own source has `builds get` call `release status` directly.
|
|
66
|
-
- **Release commands are project-scoped, not account-level.** `deploy`, `status`, and `builds list` all run on an impersonated project token, and `deploy`/`builds list` both resolve which project's linked assets to use from whichever project is currently selected via `blocks use`. Behavior changes if the selected project changes; there is no account-level/project-independent mode here.
|
|
67
|
-
- **`deploy` never takes a repo id from the user** — it's always auto-resolved from the project's linked assets, with a real branch/environment safety check before it will build. Don't offer or accept a `--repo-id` flag on `deploy`.
|
|
68
|
-
- **`builds list --repo-id` is optional, not required** — it falls back to the same auto-resolve logic as `deploy`, but that fallback can hit an interactive prompt if multiple repos are linked. Pass `--repo-id` explicitly in any non-interactive/agent context to avoid the hang.
|
|
69
|
-
- **`buildId` for `status`/`builds get` is always required**, never guessed — ask the user rather than assuming a value.
|
|
70
|
-
- **`--dry-run` before `--yes`, always** — same discipline as every other mutating `blocks` command in this pack.
|
|
71
|
-
|
|
72
|
-
## Example trigger prompts
|
|
73
|
-
|
|
74
|
-
- "Deploy this project's configured release."
|
|
75
|
-
- "Trigger a build for the linked repo."
|
|
76
|
-
- "Check the status of build `<buildId>`."
|
|
77
|
-
- "Did my last deploy finish? Look up build `<buildId>`."
|
|
78
|
-
- "List the recent builds for this repo."
|
|
79
|
-
- "Deploy and wait until it finishes." → add `--wait` (optionally `--poll-interval`/`--timeout`).
|
|
80
|
-
- "Deploy this to a custom domain." → add `--domain <domain>`.
|
|
81
|
-
- "Can you upload my compiled artifact and deploy it?" → not supported; explain there's no artifact-upload path, only triggering the repo's configured pipeline.
|
|
1
|
+
---
|
|
2
|
+
name: blocks-release-deployment
|
|
3
|
+
description: "Trigger and inspect SELISE Blocks Release builds/deploys entirely through `blocks release *` — never raw fetch/curl; there is no SDK path (Release has no `@seliseblocks/client` namespace). Covers `release deploy` (auto-resolves the repo, verifies branch matches environment), `release status`/`builds get` (build lookup by id), and `builds list` (list builds for a repo). Use for 'deploy/trigger a release', 'check build status', 'list recent builds'. Always `--dry-run` before `--yes`. No artifact-upload capability — deploy triggers a configured pipeline only."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Blocks Release — Deployment
|
|
7
|
+
|
|
8
|
+
Trigger and read Release builds through `blocks release *`. This is **100% CLI, no SDK equivalent** — `@seliseblocks/client` (`createBlocksClient()`) exposes only `auth`, `data`, `iam`, and `localization`; there is no `release` namespace anywhere in the SDK. Never write a frontend/app-code path for this — it's always a terminal command.
|
|
9
|
+
|
|
10
|
+
**Prerequisite:** a project is selected (`blocks use <tenantId>`) and that project has a repo linked from the Blocks portal — see the blocks-onboarding skill. There is no local config file for release settings; `blocks init` only scaffolds `blocks/data/schemas/`, `blocks/data/rules.json`, and `.env.example` — it has no release-related output at all. `deploy` and `builds list` both resolve which repo to act on directly from the project's linked assets (see below), not from any file on disk.
|
|
11
|
+
|
|
12
|
+
## Safe read commands
|
|
13
|
+
|
|
14
|
+
- **`blocks release status <buildId> [--json]`** — one build's status by id (positional arg, or `--build-id <id>`).
|
|
15
|
+
- **`blocks release builds get <buildId> [--json]`** — literally the same call as `release status`; it's a pure alias in the CLI's own source (`releaseBuildsGet` just calls `releaseStatus(argv)`), not a different endpoint or response shape. Use whichever name the user said.
|
|
16
|
+
- **`blocks release builds list [<repoId>] [--repo-id <repoId>] [--json]`** — all builds for one repository. `repoId` is optional: if omitted, the CLI auto-resolves it from the selected project's linked repo assets the same way `deploy` does (see "Resolving the repo" below) — **except** when more than one repo is linked, in which case it falls back to an interactive `selectFromList()` prompt instead of erring or guessing. That prompt has no stdin in a non-interactive/agent run and will hang — if you can't guarantee a human is watching the terminal, resolve and pass `--repo-id` explicitly instead of letting this fall through to the prompt (the same hang risk applies to `blocks new web`'s OIDC-client picker when `--client-id` is omitted — always resolve and pass required values explicitly rather than relying on an interactive fallback).
|
|
17
|
+
|
|
18
|
+
None of these mutate anything — safe to run without confirmation.
|
|
19
|
+
|
|
20
|
+
## Mutating: trigger a deploy
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
blocks release deploy --dry-run --json # show the exact request first
|
|
24
|
+
blocks release deploy --yes --json # only after the user approves
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
There is **no `--repo-id` flag on `deploy`** — the repo is always resolved automatically (see below); passing `--repo-id` is not recognized by this command.
|
|
28
|
+
|
|
29
|
+
### Resolving the repo
|
|
30
|
+
|
|
31
|
+
`deploy` never takes a repo id as input. It resolves one from the currently selected project's linked assets:
|
|
32
|
+
|
|
33
|
+
1. It looks up the project's linked repo resources for the project's `tenantGroupId`.
|
|
34
|
+
2. If exactly one repo is linked, that's the one used.
|
|
35
|
+
3. If multiple are linked, it picks the one whose asset `name` matches the project's `environment` (case-insensitive); if none matches, it throws `repo_ambiguous`.
|
|
36
|
+
4. If none are linked at all, it throws `repo_not_linked`.
|
|
37
|
+
|
|
38
|
+
### Branch/environment safety check
|
|
39
|
+
|
|
40
|
+
Before building, `deploy` fetches the resolved repo's details to read its linked branch, then compares that branch to the project's `environment` (case-insensitive). If they don't match, it throws `branch_environment_mismatch` rather than building the wrong branch.
|
|
41
|
+
|
|
42
|
+
### Error codes you may see
|
|
43
|
+
|
|
44
|
+
| Code | Meaning | Fix |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `repo_not_linked` | No repo is linked to this project at all. | Link a repo from the Blocks portal (requires GitHub OAuth), then re-run. |
|
|
47
|
+
| `repo_ambiguous` | Multiple repos are linked and none is named for the project's `environment`. | Check the repo links for this project from the Blocks portal. |
|
|
48
|
+
| `repo_not_found` | The linked asset's repo id wasn't found in blocks-release when fetching repo details. | Check the repo link for this project from the Blocks portal. |
|
|
49
|
+
| `branch_environment_mismatch` | The linked repo's branch doesn't match the project's `environment` (e.g. repo is on `main` but environment is `staging`). Message states the branch found and the environment required. | Point the linked repo at a branch named for the environment, or relink the correct branch from the Blocks portal. |
|
|
50
|
+
| `build_wait_timeout` | Only with `--wait`: no terminal build status was seen before `--timeout` elapsed. | Check manually with `blocks release status <buildId>`. |
|
|
51
|
+
|
|
52
|
+
### Optional flags
|
|
53
|
+
|
|
54
|
+
- **`--domain <domain>`** — before triggering the build, makes an extra call to set a custom deployment domain for this repo/environment.
|
|
55
|
+
- **`--wait`** — after triggering, polls the build status (by the returned `buildId`) every `--poll-interval` seconds until the status matches a terminal pattern (succeeded/success/completed/failed/error/cancelled/aborted/done, case-insensitive) or `--timeout` elapses (then throws `build_wait_timeout`).
|
|
56
|
+
- **`--poll-interval <seconds>`** — polling interval for `--wait`, default `10`.
|
|
57
|
+
- **`--timeout <seconds>`** — max time to wait for `--wait`, default `900`.
|
|
58
|
+
|
|
59
|
+
`--dry-run` prints the resolved `repoId`, `branch`, `environment`, `projectKey`, and (if given) `domain` — it does **not** build a request body from any local file, since none exists. The real request when not a dry run is simply `{ repoId }`. Always show the `--dry-run` output and get explicit approval before re-running with `--yes` — never skip straight to `--yes`.
|
|
60
|
+
|
|
61
|
+
## Gotchas
|
|
62
|
+
|
|
63
|
+
- **No SDK path, ever.** If asked "how do I trigger a deploy from my app," the answer is: you don't — this is a CLI-only, human/CI-operated action, not something to wire into frontend code.
|
|
64
|
+
- **No artifact upload.** `release deploy` triggers a *configured* pipeline/repository build — it does not accept or upload a build artifact you hand it. If a user asks to "upload my build and deploy it," that capability doesn't exist in this CLI; say so rather than inventing an upload flag.
|
|
65
|
+
- **`release builds get` and `release status` are the same command.** Don't treat them as returning different data or document them separately — the CLI's own source has `builds get` call `release status` directly.
|
|
66
|
+
- **Release commands are project-scoped, not account-level.** `deploy`, `status`, and `builds list` all run on an impersonated project token, and `deploy`/`builds list` both resolve which project's linked assets to use from whichever project is currently selected via `blocks use`. Behavior changes if the selected project changes; there is no account-level/project-independent mode here.
|
|
67
|
+
- **`deploy` never takes a repo id from the user** — it's always auto-resolved from the project's linked assets, with a real branch/environment safety check before it will build. Don't offer or accept a `--repo-id` flag on `deploy`.
|
|
68
|
+
- **`builds list --repo-id` is optional, not required** — it falls back to the same auto-resolve logic as `deploy`, but that fallback can hit an interactive prompt if multiple repos are linked. Pass `--repo-id` explicitly in any non-interactive/agent context to avoid the hang.
|
|
69
|
+
- **`buildId` for `status`/`builds get` is always required**, never guessed — ask the user rather than assuming a value.
|
|
70
|
+
- **`--dry-run` before `--yes`, always** — same discipline as every other mutating `blocks` command in this pack.
|
|
71
|
+
|
|
72
|
+
## Example trigger prompts
|
|
73
|
+
|
|
74
|
+
- "Deploy this project's configured release."
|
|
75
|
+
- "Trigger a build for the linked repo."
|
|
76
|
+
- "Check the status of build `<buildId>`."
|
|
77
|
+
- "Did my last deploy finish? Look up build `<buildId>`."
|
|
78
|
+
- "List the recent builds for this repo."
|
|
79
|
+
- "Deploy and wait until it finishes." → add `--wait` (optionally `--poll-interval`/`--timeout`).
|
|
80
|
+
- "Deploy this to a custom domain." → add `--domain <domain>`.
|
|
81
|
+
- "Can you upload my compiled artifact and deploy it?" → not supported; explain there's no artifact-upload path, only triggering the repo's configured pipeline.
|