@seliseblocks/cli-os 0.2.6 → 0.2.7

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.
@@ -12,6 +12,7 @@ export async function authConfigSave(argv) {
12
12
  ...compact({
13
13
  absoluteRefreshTokenValidForNumberMinutes: optionalIntegerFlag(flags, "absolute-refresh-token-minutes"),
14
14
  accessTokenValidForNumberMinutes: optionalIntegerFlag(flags, "access-token-minutes"),
15
+ accountActionBaseUrl: stringFlag(flags, "account-action-base-url") || undefined,
15
16
  accountLockDurationInMinutes: optionalIntegerFlag(flags, "account-lock-duration-minutes"),
16
17
  getNumberOfWrongAttemptsToLockTheAccount: optionalIntegerFlag(flags, "wrong-attempts-to-lock"),
17
18
  isOidcEnabled: booleanFlag(flags, "oidc-enabled") || undefined,
@@ -32,10 +33,25 @@ export async function authConfigSave(argv) {
32
33
  projectTenantId: projectKey
33
34
  });
34
35
  const body = { ...current, ...overrides };
36
+ // Turning isOidcEnabled on isn't a single independent flag: the
37
+ // activation-link flow keys off accountActivationPath, which has to point
38
+ // at the OIDC variant once OIDC is on, or activation emails break.
39
+ // accountActionBaseUrl has no safe default this command can guess across
40
+ // environments, so the caller must supply it explicitly when the tenant
41
+ // doesn't already have one.
42
+ const missingActionBaseUrl = Boolean(body.isOidcEnabled) && !body.accountActionBaseUrl;
43
+ if (body.isOidcEnabled)
44
+ body.accountActivationPath = "oidc/activate/";
35
45
  if (booleanFlag(flags, "dry-run")) {
46
+ if (missingActionBaseUrl) {
47
+ console.warn("Warning: this tenant has no accountActionBaseUrl set. Enabling OIDC login requires one -- pass --account-action-base-url <https://your-iam-host> before re-running with --yes.");
48
+ }
36
49
  writeOutput({ dryRun: true, endpoint: "/iam/v4/auth/config", request: body }, flags);
37
50
  return;
38
51
  }
52
+ if (missingActionBaseUrl) {
53
+ throw new Error("Enabling OIDC login requires accountActionBaseUrl, and this tenant doesn't have one set. Pass --account-action-base-url <https://your-iam-host>.");
54
+ }
39
55
  await confirmMutation(flags, "Save AuthController configuration for the selected project.");
40
56
  const result = await blocksRequest("/iam/v4/auth/config", {
41
57
  body,
@@ -23,7 +23,7 @@ export async function newWeb(argv) {
23
23
  const oidcClientId = await resolveOidcClientId(tenantId, appDomain, name, flags);
24
24
  if (oidcClientId) {
25
25
  try {
26
- await ensureOidcLoginEnabled(tenantId, flags);
26
+ await ensureOidcLoginEnabled(tenantId, oidcUrl, flags);
27
27
  }
28
28
  catch (error) {
29
29
  console.warn(`Warning: could not confirm/enable OIDC login on this project's AuthController config: ${error.message}`);
@@ -135,7 +135,15 @@ async function listOidcClientSummaries(tenantId, flags) {
135
135
  // field) -- sending just `{ isOidcEnabled: true }` would reset every other
136
136
  // AuthController setting for this tenant, so the fetched config is spread
137
137
  // back in full with only that one field overridden.
138
- async function ensureOidcLoginEnabled(tenantId, flags) {
138
+ //
139
+ // Turning isOidcEnabled on isn't a single independent flag either: the
140
+ // activation-link flow keys off accountActivationPath, which has to point at
141
+ // the OIDC variant ("oidc/activate/") once OIDC is on, or activation emails
142
+ // break. accountActionBaseUrl (the host those links are built against) has
143
+ // no safe cross-environment default, but this project's own IAM host is
144
+ // already known here as `oidcUrl`, so it's used whenever the tenant doesn't
145
+ // already have one set.
146
+ async function ensureOidcLoginEnabled(tenantId, oidcUrl, flags) {
139
147
  const config = await blocksRequest("/iam/v4/auth/config", {
140
148
  impersonatedProjectAuth: true,
141
149
  projectTenantId: tenantId,
@@ -145,7 +153,12 @@ async function ensureOidcLoginEnabled(tenantId, flags) {
145
153
  return;
146
154
  await confirmMutation(flags, "Enable OIDC login on this project's AuthController configuration.");
147
155
  await blocksRequest("/iam/v4/auth/config", {
148
- body: { ...config, isOidcEnabled: true },
156
+ body: {
157
+ ...config,
158
+ accountActionBaseUrl: config.accountActionBaseUrl || oidcUrl,
159
+ accountActivationPath: "oidc/activate/",
160
+ isOidcEnabled: true
161
+ },
149
162
  impersonatedProjectAuth: true,
150
163
  projectTenantId: tenantId,
151
164
  ...requestContext(flags)
@@ -65,8 +65,8 @@ Run `blocks init` once per project directory to create `blocks.json`, `blocks/da
65
65
 
66
66
  Then route to what the user actually wants:
67
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`.
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 --auto-redirect --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. `--auto-redirect` matters too — the scaffolded login page already navigates straight to the provider itself, so without it IAM's hosted login page shows a redundant manual "continue" click. When updating an *existing* client instead of creating one, always pass `--item-id` — the save endpoint replaces the whole client document, and the CLI fetches the current one first to merge your change into it rather than resetting the rest. 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`. Once it resolves the client id, `new web` also checks the tenant's AuthController config and turns on `isOidcEnabled` if it's off — nothing further to do for login to actually work; if you're wiring an existing app instead (`blocks sdk client`, no `new web` call), check that yourself first: `blocks auth config get --json`, and if `isOidcEnabled` is `false`, `blocks auth config save --oidc-enabled --dry-run --json` then `--yes`.
70
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
71
 
72
72
  ## Gotchas
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seliseblocks/cli-os",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "CLI for SELISE Blocks project setup and configuration.",
5
5
  "license": "MIT",
6
6
  "type": "module",