@nebulr-group/bridge-cli 0.6.6 → 1.0.0-alpha.1
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 +98 -458
- package/dist/api/accounts.d.ts +105 -0
- package/dist/api/accounts.d.ts.map +1 -0
- package/dist/api/accounts.js +58 -0
- package/dist/api/accounts.js.map +1 -0
- package/dist/api/apps.d.ts +50 -0
- package/dist/api/apps.d.ts.map +1 -0
- package/dist/api/apps.js +62 -0
- package/dist/api/apps.js.map +1 -0
- package/dist/api/billing.d.ts +131 -0
- package/dist/api/billing.d.ts.map +1 -0
- package/dist/api/billing.js +42 -0
- package/dist/api/billing.js.map +1 -0
- package/dist/api/flags.d.ts +73 -0
- package/dist/api/flags.d.ts.map +1 -0
- package/dist/api/flags.js +108 -0
- package/dist/api/flags.js.map +1 -0
- package/dist/api/keys.d.ts +48 -0
- package/dist/api/keys.d.ts.map +1 -0
- package/dist/api/keys.js +87 -0
- package/dist/api/keys.js.map +1 -0
- package/dist/auth/browser-open.d.ts +21 -4
- package/dist/auth/browser-open.d.ts.map +1 -1
- package/dist/auth/browser-open.js +45 -65
- package/dist/auth/browser-open.js.map +1 -1
- package/dist/auth/lock.d.ts +8 -0
- package/dist/auth/lock.d.ts.map +1 -0
- package/dist/auth/lock.js +43 -0
- package/dist/auth/lock.js.map +1 -0
- package/dist/auth/loopback.d.ts +8 -12
- package/dist/auth/loopback.d.ts.map +1 -1
- package/dist/auth/loopback.js +40 -45
- package/dist/auth/loopback.js.map +1 -1
- package/dist/auth/session.d.ts +61 -0
- package/dist/auth/session.d.ts.map +1 -0
- package/dist/auth/session.js +142 -0
- package/dist/auth/session.js.map +1 -0
- package/dist/auth/sign-in.d.ts +67 -0
- package/dist/auth/sign-in.d.ts.map +1 -0
- package/dist/auth/sign-in.js +113 -0
- package/dist/auth/sign-in.js.map +1 -0
- package/dist/auth/store.d.ts +89 -0
- package/dist/auth/store.d.ts.map +1 -0
- package/dist/auth/store.js +214 -0
- package/dist/auth/store.js.map +1 -0
- package/dist/bin.js +0 -2
- package/dist/bin.js.map +1 -1
- package/dist/cli.d.ts +1 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +13 -17
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +31 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +67 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/accounts.command.d.ts +4 -0
- package/dist/commands/accounts.command.d.ts.map +1 -0
- package/dist/commands/accounts.command.js +166 -0
- package/dist/commands/accounts.command.js.map +1 -0
- package/dist/commands/app.command.d.ts +3 -2
- package/dist/commands/app.command.d.ts.map +1 -1
- package/dist/commands/app.command.js +132 -233
- package/dist/commands/app.command.js.map +1 -1
- package/dist/commands/auth.command.d.ts +2 -12
- package/dist/commands/auth.command.d.ts.map +1 -1
- package/dist/commands/auth.command.js +147 -20
- package/dist/commands/auth.command.js.map +1 -1
- package/dist/commands/billing.command.d.ts +4 -0
- package/dist/commands/billing.command.d.ts.map +1 -0
- package/dist/commands/billing.command.js +185 -0
- package/dist/commands/billing.command.js.map +1 -0
- package/dist/commands/check.command.d.ts +2 -1
- package/dist/commands/check.command.d.ts.map +1 -1
- package/dist/commands/check.command.js +11 -14
- package/dist/commands/check.command.js.map +1 -1
- package/dist/commands/context.d.ts +58 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +78 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/flag.command.d.ts +3 -62
- package/dist/commands/flag.command.d.ts.map +1 -1
- package/dist/commands/flag.command.js +181 -864
- package/dist/commands/flag.command.js.map +1 -1
- package/dist/commands/key.command.d.ts +4 -0
- package/dist/commands/key.command.d.ts.map +1 -0
- package/dist/commands/key.command.js +44 -0
- package/dist/commands/key.command.js.map +1 -0
- package/dist/commands/plan.command.d.ts +3 -203
- package/dist/commands/plan.command.d.ts.map +1 -1
- package/dist/commands/plan.command.js +200 -759
- package/dist/commands/plan.command.js.map +1 -1
- package/dist/config.d.ts +19 -101
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +51 -364
- package/dist/config.js.map +1 -1
- package/dist/core/discovery.d.ts +27 -0
- package/dist/core/discovery.d.ts.map +1 -0
- package/dist/core/discovery.js +97 -0
- package/dist/core/discovery.js.map +1 -0
- package/dist/core/errors.d.ts +26 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +33 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/http.d.ts +23 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +153 -0
- package/dist/core/http.js.map +1 -0
- package/dist/core/private-files.d.ts +6 -0
- package/dist/core/private-files.d.ts.map +1 -0
- package/dist/core/private-files.js +96 -0
- package/dist/core/private-files.js.map +1 -0
- package/dist/core/routes.d.ts +100 -0
- package/dist/core/routes.d.ts.map +1 -0
- package/dist/core/routes.js +99 -0
- package/dist/core/routes.js.map +1 -0
- package/dist/core/urls.d.ts +15 -0
- package/dist/core/urls.d.ts.map +1 -0
- package/dist/core/urls.js +55 -0
- package/dist/core/urls.js.map +1 -0
- package/dist/gate-rules.d.ts +1 -2
- package/dist/gate-rules.d.ts.map +1 -1
- package/dist/gate-rules.js +4 -5
- package/dist/gate-rules.js.map +1 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/io.d.ts +21 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +59 -0
- package/dist/io.js.map +1 -0
- package/dist/money.d.ts +42 -0
- package/dist/money.d.ts.map +1 -0
- package/dist/money.js +112 -0
- package/dist/money.js.map +1 -0
- package/dist/program.d.ts +5 -24
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +25 -113
- package/dist/program.js.map +1 -1
- package/package.json +7 -8
- package/dist/auth/api-client.d.ts +0 -50
- package/dist/auth/api-client.d.ts.map +0 -1
- package/dist/auth/api-client.js +0 -109
- package/dist/auth/api-client.js.map +0 -1
- package/dist/auth/relative-time.d.ts +0 -2
- package/dist/auth/relative-time.d.ts.map +0 -1
- package/dist/auth/relative-time.js +0 -27
- package/dist/auth/relative-time.js.map +0 -1
- package/dist/auth/scopes.d.ts +0 -30
- package/dist/auth/scopes.d.ts.map +0 -1
- package/dist/auth/scopes.js +0 -39
- package/dist/auth/scopes.js.map +0 -1
- package/dist/auth/workspace-client.d.ts +0 -70
- package/dist/auth/workspace-client.d.ts.map +0 -1
- package/dist/auth/workspace-client.js +0 -105
- package/dist/auth/workspace-client.js.map +0 -1
- package/dist/commands/auth/config.command.d.ts +0 -8
- package/dist/commands/auth/config.command.d.ts.map +0 -1
- package/dist/commands/auth/config.command.js +0 -60
- package/dist/commands/auth/config.command.js.map +0 -1
- package/dist/commands/auth/login.command.d.ts +0 -46
- package/dist/commands/auth/login.command.d.ts.map +0 -1
- package/dist/commands/auth/login.command.js +0 -166
- package/dist/commands/auth/login.command.js.map +0 -1
- package/dist/commands/auth/logout.command.d.ts +0 -21
- package/dist/commands/auth/logout.command.d.ts.map +0 -1
- package/dist/commands/auth/logout.command.js +0 -97
- package/dist/commands/auth/logout.command.js.map +0 -1
- package/dist/commands/auth/methods.command.d.ts +0 -68
- package/dist/commands/auth/methods.command.d.ts.map +0 -1
- package/dist/commands/auth/methods.command.js +0 -91
- package/dist/commands/auth/methods.command.js.map +0 -1
- package/dist/commands/auth/status.command.d.ts +0 -18
- package/dist/commands/auth/status.command.d.ts.map +0 -1
- package/dist/commands/auth/status.command.js +0 -104
- package/dist/commands/auth/status.command.js.map +0 -1
- package/dist/commands/auth/use.command.d.ts +0 -17
- package/dist/commands/auth/use.command.d.ts.map +0 -1
- package/dist/commands/auth/use.command.js +0 -47
- package/dist/commands/auth/use.command.js.map +0 -1
- package/dist/commands/branding.command.d.ts +0 -3
- package/dist/commands/branding.command.d.ts.map +0 -1
- package/dist/commands/branding.command.js +0 -42
- package/dist/commands/branding.command.js.map +0 -1
- package/dist/commands/event.command.d.ts +0 -3
- package/dist/commands/event.command.d.ts.map +0 -1
- package/dist/commands/event.command.js +0 -27
- package/dist/commands/event.command.js.map +0 -1
- package/dist/commands/flag-init.command.d.ts +0 -13
- package/dist/commands/flag-init.command.d.ts.map +0 -1
- package/dist/commands/flag-init.command.js +0 -463
- package/dist/commands/flag-init.command.js.map +0 -1
- package/dist/commands/guide.command.d.ts +0 -61
- package/dist/commands/guide.command.d.ts.map +0 -1
- package/dist/commands/guide.command.js +0 -655
- package/dist/commands/guide.command.js.map +0 -1
- package/dist/commands/info.command.d.ts +0 -3
- package/dist/commands/info.command.d.ts.map +0 -1
- package/dist/commands/info.command.js +0 -70
- package/dist/commands/info.command.js.map +0 -1
- package/dist/commands/integration.command.d.ts +0 -35
- package/dist/commands/integration.command.d.ts.map +0 -1
- package/dist/commands/integration.command.js +0 -290
- package/dist/commands/integration.command.js.map +0 -1
- package/dist/commands/journeys.d.ts +0 -43
- package/dist/commands/journeys.d.ts.map +0 -1
- package/dist/commands/journeys.js +0 -221
- package/dist/commands/journeys.js.map +0 -1
- package/dist/commands/ops.command.d.ts +0 -17
- package/dist/commands/ops.command.d.ts.map +0 -1
- package/dist/commands/ops.command.js +0 -129
- package/dist/commands/ops.command.js.map +0 -1
- package/dist/commands/privilege.command.d.ts +0 -16
- package/dist/commands/privilege.command.d.ts.map +0 -1
- package/dist/commands/privilege.command.js +0 -86
- package/dist/commands/privilege.command.js.map +0 -1
- package/dist/commands/role.command.d.ts +0 -3
- package/dist/commands/role.command.d.ts.map +0 -1
- package/dist/commands/role.command.js +0 -101
- package/dist/commands/role.command.js.map +0 -1
- package/dist/commands/runtime-dir.d.ts +0 -16
- package/dist/commands/runtime-dir.d.ts.map +0 -1
- package/dist/commands/runtime-dir.js +0 -18
- package/dist/commands/runtime-dir.js.map +0 -1
- package/dist/commands/setup.command.d.ts +0 -63
- package/dist/commands/setup.command.d.ts.map +0 -1
- package/dist/commands/setup.command.js +0 -148
- package/dist/commands/setup.command.js.map +0 -1
- package/dist/commands/stripe.command.d.ts +0 -29
- package/dist/commands/stripe.command.d.ts.map +0 -1
- package/dist/commands/stripe.command.js +0 -99
- package/dist/commands/stripe.command.js.map +0 -1
- package/dist/commands/tenant.command.d.ts +0 -3
- package/dist/commands/tenant.command.d.ts.map +0 -1
- package/dist/commands/tenant.command.js +0 -135
- package/dist/commands/tenant.command.js.map +0 -1
- package/dist/commands/token.command.d.ts +0 -3
- package/dist/commands/token.command.d.ts.map +0 -1
- package/dist/commands/token.command.js +0 -54
- package/dist/commands/token.command.js.map +0 -1
- package/dist/commands/user.command.d.ts +0 -3
- package/dist/commands/user.command.d.ts.map +0 -1
- package/dist/commands/user.command.js +0 -117
- package/dist/commands/user.command.js.map +0 -1
- package/dist/credentials.d.ts +0 -141
- package/dist/credentials.d.ts.map +0 -1
- package/dist/credentials.js +0 -348
- package/dist/credentials.js.map +0 -1
- package/dist/flag-coherence.d.ts +0 -42
- package/dist/flag-coherence.d.ts.map +0 -1
- package/dist/flag-coherence.js +0 -103
- package/dist/flag-coherence.js.map +0 -1
- package/dist/output.d.ts +0 -17
- package/dist/output.d.ts.map +0 -1
- package/dist/output.js +0 -107
- package/dist/output.js.map +0 -1
- package/dist/preview.d.ts +0 -9
- package/dist/preview.d.ts.map +0 -1
- package/dist/preview.js +0 -63
- package/dist/preview.js.map +0 -1
- package/dist/product-decisions.d.ts +0 -40
- package/dist/product-decisions.d.ts.map +0 -1
- package/dist/product-decisions.js +0 -52
- package/dist/product-decisions.js.map +0 -1
- package/dist/prompt-urls.d.ts +0 -31
- package/dist/prompt-urls.d.ts.map +0 -1
- package/dist/prompt-urls.js +0 -35
- package/dist/prompt-urls.js.map +0 -1
- package/dist/prompts/auth-master-integration-prompt.md +0 -255
- package/dist/prompts/billing/master.md +0 -332
- package/dist/prompts/decisions/feature-control.md +0 -131
- package/dist/prompts/decisions/going-live.md +0 -60
- package/dist/prompts/decisions/login.md +0 -71
- package/dist/prompts/decisions/look-and-feel.md +0 -68
- package/dist/prompts/decisions/payments.md +0 -97
- package/dist/prompts/decisions/roles.md +0 -78
- package/dist/prompts/decisions/teams.md +0 -61
- package/dist/prompts/fit-together.md +0 -97
- package/dist/prompts/flags/master.md +0 -220
- package/dist/prompts/guide-coverage.json +0 -17
- package/dist/prompts/integration-success.md +0 -106
- package/dist/prompts/mcp-tools.json +0 -90
- package/dist/prompts/mechanisms.md +0 -304
- package/dist/prompts/orientation.md +0 -42
- package/dist/prompts/product-decisions.json +0 -338
- package/dist/resolve.d.ts +0 -110
- package/dist/resolve.d.ts.map +0 -1
- package/dist/resolve.js +0 -260
- package/dist/resolve.js.map +0 -1
- package/dist/shape.d.ts +0 -25
- package/dist/shape.d.ts.map +0 -1
- package/dist/shape.js +0 -74
- package/dist/shape.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,518 +2,158 @@
|
|
|
2
2
|
<a href="https://thebridge.dev/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/thebridgedev/bridge-cli/main/.github/assets/banner.png"><img src="https://raw.githubusercontent.com/thebridgedev/bridge-cli/main/.github/assets/banner-light.png" alt="The Bridge CLI" width="100%"></picture></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
<a href="https://www.npmjs.com/package/@nebulr-group/bridge-cli"><img src="https://img.shields.io/npm/v/@nebulr-group/bridge-cli?color=20006b&label=npm" alt="npm version"></a>
|
|
7
|
-
<a href="https://github.com/thebridgedev/bridge-cli/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@nebulr-group/bridge-cli?color=20006b" alt="MIT license"></a>
|
|
8
|
-
</p>
|
|
9
|
-
|
|
10
|
-
<p align="center">
|
|
11
|
-
<a href="https://thebridge.dev/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli"><b>Website</b></a> ·
|
|
12
|
-
<a href="https://thebridge.dev/docs/getting-started/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli"><b>Getting started</b></a> ·
|
|
13
|
-
<a href="https://thebridge.dev/docs/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli"><b>Docs</b></a> ·
|
|
14
|
-
<a href="https://thebridge.dev/docs/ai-assistants/mcp/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli"><b>Set up with your AI assistant</b></a>
|
|
15
|
-
</p>
|
|
5
|
+
# The Bridge CLI 1.0 (alpha)
|
|
16
6
|
|
|
17
|
-
|
|
7
|
+
`@nebulr-group/bridge-cli` sets up your app on Bridge from the terminal. You sign in, then create your app and its addresses, its keys, plans with prices and trials, Stripe in test mode, and the feature flags your code gates on. It works the same for you and for a coding agent: every result is JSON.
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
**[The Bridge](https://thebridge.dev/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli)** is a hosted backend for SaaS apps. It gives you sign-in (passwords, magic links, passkeys, social login and SSO), multi-tenant workspaces with roles, Stripe subscriptions with plan limits, and feature flags, all managed from one dashboard. Your AI coding assistant can set it up for you through the [Bridge MCP server](https://thebridge.dev/docs/ai-assistants/mcp/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli).
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install -g @nebulr-group/bridge-cli
|
|
27
|
-
```
|
|
9
|
+
> **This is the 1.0 alpha.** It talks to version 2 of Bridge's API only. For the Bridge you use today, stay on 0.x: `npm install -g @nebulr-group/bridge-cli` installs it (`latest`).
|
|
28
10
|
|
|
29
|
-
|
|
11
|
+
## Install
|
|
30
12
|
|
|
31
13
|
```bash
|
|
32
|
-
|
|
14
|
+
npm install -g @nebulr-group/bridge-cli@alpha
|
|
15
|
+
# or, without installing
|
|
16
|
+
npx @nebulr-group/bridge-cli@alpha --help
|
|
33
17
|
```
|
|
34
18
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
bridge-cli supports two authentication paths.
|
|
38
|
-
|
|
39
|
-
### 1. Interactive (recommended for humans + AI agents) — `bridge auth login`
|
|
19
|
+
It needs Node.js 20 or later.
|
|
40
20
|
|
|
41
|
-
|
|
42
|
-
bridge auth login
|
|
43
|
-
```
|
|
21
|
+
## Sign in
|
|
44
22
|
|
|
45
|
-
|
|
23
|
+
The CLI needs one address: your **issuer**, the address Bridge signs you in at. Every other endpoint is read from the issuer's published metadata. Give it once; it is saved for the commands that follow.
|
|
46
24
|
|
|
47
25
|
```bash
|
|
48
|
-
bridge auth
|
|
49
|
-
bridge auth logout # revoke the active token and remove it locally
|
|
26
|
+
bridge auth login --issuer https://<your Bridge>/identity-access/apps/<app id>
|
|
50
27
|
```
|
|
51
28
|
|
|
52
|
-
|
|
29
|
+
This opens Bridge's sign-in page in your browser: the page your issuer publishes, and the CLI says its address before it opens it. You sign in there, and the browser comes back to the CLI on `127.0.0.1`. The sign-in is bound to this process with PKCE, so a code that leaks is no use to anyone else. If the browser cannot be opened, the CLI prints the address to open.
|
|
53
30
|
|
|
54
|
-
|
|
55
|
-
login covers all your apps — the same way the MCP server does. The app you pin
|
|
56
|
-
at login (`--app`) is the *home* app; switch between the others locally:
|
|
31
|
+
If no browser is at hand (a server, a container, CI), sign in in the terminal:
|
|
57
32
|
|
|
58
33
|
```bash
|
|
59
|
-
bridge auth login
|
|
60
|
-
|
|
61
|
-
bridge app use "Acme Stage" # the default for every command, no re-login
|
|
62
|
-
bridge app create --name "Acme Prod" --use
|
|
63
|
-
bridge --app 66f0c0ffee0000000000abcd role list # one command on another app
|
|
34
|
+
bridge auth login --password --email you@example.com # asks for the password, without echo
|
|
35
|
+
echo "$PASSWORD" | bridge auth login --password --email you@example.com --password-stdin
|
|
64
36
|
```
|
|
65
37
|
|
|
66
|
-
|
|
67
|
-
*which stored login*; `--app` picks the app *within* it. Acting on a non-home
|
|
68
|
-
app prints `bridge: Acting on app <name> (<id>)` to stderr. Per-app tokens live
|
|
69
|
-
only in memory for that one command and are never written to disk.
|
|
70
|
-
|
|
71
|
-
`bridge auth login --single-app` asks for a login that covers only the home app
|
|
72
|
-
(the user can still change the choice on the consent screen). On such a login,
|
|
73
|
-
`--app` / `bridge app use` for another app fail and tell you to log in again.
|
|
74
|
-
`BRIDGE_API_KEY` is always bound to its one app.
|
|
75
|
-
|
|
76
|
-
#### Several apps at once
|
|
77
|
-
|
|
78
|
-
The credentials file holds one credential per app, so you can log in to your
|
|
79
|
-
local, stage and prod apps and move between them without a browser round-trip —
|
|
80
|
-
the tokens are already on disk with days left on them.
|
|
38
|
+
If you belong to several workspaces, the CLI asks which one, or takes `--workspace <id>`.
|
|
81
39
|
|
|
82
40
|
```bash
|
|
83
|
-
bridge auth
|
|
84
|
-
bridge auth
|
|
85
|
-
|
|
86
|
-
bridge auth
|
|
87
|
-
bridge auth use northwhistle-local # switch the default, offline
|
|
88
|
-
bridge --profile northwhistle-prod app get # target ONE command, default untouched
|
|
41
|
+
bridge auth whoami # who you are, which workspace, which app commands act on
|
|
42
|
+
bridge auth workspace # your workspaces
|
|
43
|
+
bridge auth workspace <id> # switch to one
|
|
44
|
+
bridge auth logout # ends the session at Bridge and removes it from this machine
|
|
89
45
|
```
|
|
90
46
|
|
|
91
|
-
|
|
92
|
-
order. An ambiguous name is an error rather than a guess. `BRIDGE_PROFILE` does
|
|
93
|
-
the same thing as `--profile` for a whole shell session.
|
|
47
|
+
**Where the session is kept.** In your operating system's keychain (the macOS keychain, or the Secret Service keyring on Linux) when there is one, else in `~/.config/bridge/v1/sessions.json`, readable only by you (mode 0600). Set `BRIDGE_TOKEN_STORE=file` to use the file. The CLI renews the session as it goes; each renewal replaces the refresh token, and the old one stops working.
|
|
94
48
|
|
|
95
|
-
|
|
96
|
-
sessions: `use` mutates state another process may be reading, `--profile` does
|
|
97
|
-
not.
|
|
98
|
-
|
|
99
|
-
Every command prints one line to **stderr** naming the app that answered:
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
bridge: northwhistle-prod (606b4416fabdc800087d09ec) · https://api.thebridge.dev · via saved default
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
stdout stays pure JSON, so this does not disturb anything parsing it. Silence it
|
|
106
|
-
with `BRIDGE_NO_BANNER=true` if you are already certain which app you are on.
|
|
107
|
-
|
|
108
|
-
`bridge auth logout` removes the active app only. Use `--profile <name>` for a
|
|
109
|
-
specific one, or `--all` to clear the file.
|
|
110
|
-
|
|
111
|
-
Existing single-app credentials files keep working and are upgraded in place the
|
|
112
|
-
next time something writes.
|
|
113
|
-
|
|
114
|
-
#### `bridge auth login` flags
|
|
115
|
-
|
|
116
|
-
| Flag | Description |
|
|
117
|
-
|------|-------------|
|
|
118
|
-
| `--app <id\|name>` | Pin the home app, skipping the picker on the consent screen. |
|
|
119
|
-
| `--single-app` | Preselect "only this app" instead of "every app in the workspace" on the consent screen. |
|
|
120
|
-
| `--label <text>` | Friendly label stored on the token (default: `bridge-cli`). Useful when listing CLI tokens at `app.thebridge.dev/keys`. |
|
|
121
|
-
| `--no-browser` | Print the authorization URL instead of opening a browser. Use this on headless boxes or over SSH. |
|
|
122
|
-
|
|
123
|
-
When the token expires (10 days), the next command fails with a friendly `Token expired. Run `bridge auth login` to re-authenticate.` message.
|
|
124
|
-
|
|
125
|
-
The credentials file location honors `XDG_CONFIG_HOME`:
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
$XDG_CONFIG_HOME/bridge/credentials.json # if XDG_CONFIG_HOME is set
|
|
129
|
-
~/.config/bridge/credentials.json # otherwise
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### 2. Service-account / CI — `BRIDGE_API_KEY`
|
|
133
|
-
|
|
134
|
-
For non-interactive contexts (CI/CD pipelines, Docker images, headless agents) set the API key directly in the environment:
|
|
49
|
+
## Set up an app
|
|
135
50
|
|
|
136
51
|
```bash
|
|
137
|
-
|
|
138
|
-
|
|
52
|
+
# 1. Create the app. Commands act on it from now on (`bridge app use <id>` switches).
|
|
53
|
+
bridge app create --name "My App" \
|
|
54
|
+
--sign-in-return http://localhost:5173/auth/callback \
|
|
55
|
+
--email-links http://localhost:5173/auth/link \
|
|
56
|
+
--browser-origin http://localhost:5173
|
|
139
57
|
|
|
140
|
-
|
|
58
|
+
# 2. Add your production addresses next to the development ones.
|
|
59
|
+
bridge app address add https://myapp.com/auth/callback --use sign-in-return
|
|
60
|
+
bridge app address add https://myapp.com --use browser-origin
|
|
61
|
+
bridge app address list
|
|
141
62
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
being ignored, and what to do instead. To point the CLI at a different app, use
|
|
145
|
-
`--profile`, not the env vars.
|
|
63
|
+
# 3. A key for your server. The secret is shown once: put it in your server's secrets.
|
|
64
|
+
bridge key create --name "production server"
|
|
146
65
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
66
|
+
# 4. Plans: prices, a trial, a per-unit usage price, features and limits.
|
|
67
|
+
bridge metric set exports --kind counter --name "Exports"
|
|
68
|
+
bridge plan create pro --name Pro \
|
|
69
|
+
--price "19 EUR/month" --price "190 EUR/year" \
|
|
70
|
+
--usage-price "exports 0.05 EUR/month included 100" \
|
|
71
|
+
--trial-days 14 \
|
|
72
|
+
--feature analytics --limit seats=10
|
|
151
73
|
|
|
152
|
-
|
|
74
|
+
# 5. Take payments: connect Stripe in test mode with your test secret key (asked for without echo).
|
|
75
|
+
bridge stripe connect
|
|
153
76
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export BRIDGE_DEBUG=true # enable debug logging
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### 3. Targeting a local stack
|
|
161
|
-
|
|
162
|
-
Two exports, then log in as usual — the browser flow works against a local
|
|
163
|
-
stack the same way it does against production:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
export BRIDGE_BASE_URL=http://localhost:3200 # bridge-api
|
|
167
|
-
export BRIDGE_AUTH_BASE_URL=http://localhost:3091 # consent screen (cloud-views)
|
|
168
|
-
|
|
169
|
-
bridge auth login
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
`BRIDGE_BASE_URL` is where commands send their API calls; `BRIDGE_AUTH_BASE_URL`
|
|
173
|
-
is where `bridge auth login` opens the consent screen. Set the second one too,
|
|
174
|
-
or you will authenticate against production and then issue commands against
|
|
175
|
-
your local API with a token it does not accept.
|
|
176
|
-
|
|
177
|
-
There is deliberately **no config file to source** (TBP-121). A sourceable file
|
|
178
|
-
mixed CLI settings with two demo apps' settings, pinned an undocumented app id,
|
|
179
|
-
and kept a long-lived API key on disk in plaintext; two exports cover the same
|
|
180
|
-
ground without any of that. For CI, use `BRIDGE_API_KEY` as described above.
|
|
181
|
-
|
|
182
|
-
One more, for working on the integration guides themselves:
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
export BRIDGE_GUIDE_LOCAL_DIR=/path/to/thebridge-platform/bridge-plugins
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
`bridge guide` then reads prompts from that directory
|
|
189
|
-
instead of fetching them from GitHub (or the copies bundled with the CLI), so edits show up without a release.
|
|
190
|
-
|
|
191
|
-
## Usage
|
|
192
|
-
|
|
193
|
-
All output is JSON by default for management commands. AI agents parse it directly; humans can pipe through `jq`. The `bridge auth status` and `bridge auth login` commands print human-readable text, since their primary audience is a human in a terminal.
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
bridge <command> <subcommand> [options]
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### Addressing a resource
|
|
200
|
-
|
|
201
|
-
Every command that acts on a single resource takes **either** its opaque id
|
|
202
|
-
**or** its human-readable identifier — you never have to run a `list` first just
|
|
203
|
-
to look up an id.
|
|
204
|
-
|
|
205
|
-
| Noun | Human-readable option | Id option |
|
|
206
|
-
|---|---|---|
|
|
207
|
-
| flag | `--key <key>` (or a positional `<key>` on `get` / `eval` / `schedule`) | `--id` |
|
|
208
|
-
| role | `--key <key>` (or a positional `<idOrKey>` on `get`) | `--id` |
|
|
209
|
-
| plan | positional `<key>` — plans are key-native, no id anywhere | — |
|
|
210
|
-
| tenant | `--name <name>` | `--id` |
|
|
211
|
-
| user | `--email <email>` | `--user-id` |
|
|
212
|
-
| token | `--name <name>` | `--id` |
|
|
213
|
-
|
|
214
|
-
Rules, the same for every noun:
|
|
215
|
-
|
|
216
|
-
- Pass exactly one. Both together, or neither, is an error.
|
|
217
|
-
- An identifier that matches nothing fails and names the `list` command to run.
|
|
218
|
-
- An identifier that matches **more than one** resource fails, lists the
|
|
219
|
-
candidates, and changes nothing. The CLI never picks one for you — pass `--id`
|
|
220
|
-
to disambiguate.
|
|
221
|
-
|
|
222
|
-
`--name` and `--email` exist because tenants, users and tokens have no key
|
|
223
|
-
field. Of those, only a user's email is unique; tenant and token names are free
|
|
224
|
-
text, which is exactly why the ambiguity check is a hard failure.
|
|
225
|
-
|
|
226
|
-
### Auth (interactive credentials)
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
bridge auth login # default: open browser, complete PKCE flow
|
|
230
|
-
bridge auth login --app acme # pin to a specific app
|
|
231
|
-
bridge auth login --label "work laptop"
|
|
232
|
-
bridge auth login --no-browser # print the URL (headless / SSH)
|
|
233
|
-
bridge auth status # show every stored app, active one marked
|
|
234
|
-
bridge auth use <label|app-id> # switch the default app, no browser
|
|
235
|
-
bridge auth logout # revoke + remove the active app
|
|
236
|
-
bridge auth logout --all # ...or every stored app
|
|
237
|
-
bridge --profile <label> <cmd> # target one stored login for one command
|
|
238
|
-
bridge app list # apps this login covers (home + current marked)
|
|
239
|
-
bridge app use <id|name> # switch app within a workspace login, no browser
|
|
240
|
-
bridge app create --name <n> [--callback-url <url>] [--use]
|
|
241
|
-
bridge --app <id|name> <cmd> # one command on another app of the workspace
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Auth Configuration (app-level — separate from `auth login`)
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
bridge auth config
|
|
248
|
-
bridge auth mfa --enabled true
|
|
249
|
-
bridge auth password-policy --access-token-ttl 3600
|
|
77
|
+
# 6. Flags: every gate in your code is a flag, and its rule says who gets it.
|
|
78
|
+
bridge flag create analytics --when "bridge:billing.entitlement.analytics eq true"
|
|
79
|
+
bridge flag create team-admin --when "privileges contains USER_WRITE"
|
|
250
80
|
```
|
|
251
81
|
|
|
252
|
-
|
|
82
|
+
## Commands
|
|
253
83
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
Tenants have no key field, so they are addressed by `--name`. Names are **not**
|
|
271
|
-
enforced unique — if two tenants share one, the command fails and lists both
|
|
272
|
-
rather than guessing. Use `--id` to disambiguate.
|
|
273
|
-
|
|
274
|
-
`tenant update --name` addresses the tenant when `--id` is absent; passed
|
|
275
|
-
alongside `--id` it keeps its original meaning and renames the tenant.
|
|
276
|
-
`--new-name` always renames, whichever way you addressed it.
|
|
277
|
-
|
|
278
|
-
### Users
|
|
279
|
-
|
|
280
|
-
Requires tenant context via `--tenant-id` or `BRIDGE_TENANT_ID`.
|
|
281
|
-
|
|
282
|
-
```bash
|
|
283
|
-
bridge user list --tenant-id <tenant-id>
|
|
284
|
-
bridge user get --email alice@acme.com --tenant-id <tenant-id> # or --user-id <user-id>
|
|
285
|
-
bridge user invite --email alice@acme.com --role ADMIN --tenant-id <tenant-id>
|
|
286
|
-
bridge user update --email alice@acme.com --role OWNER --tenant-id <tenant-id>
|
|
287
|
-
bridge user remove --email alice@acme.com --tenant-id <tenant-id>
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
Users have no key field either; `--email` is the human-readable address and is
|
|
291
|
-
unique within a tenant (matched case-insensitively).
|
|
292
|
-
|
|
293
|
-
### Access Roles
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
bridge role list
|
|
297
|
-
bridge role get ADMIN
|
|
298
|
-
bridge role create --name Editor --key editor --privileges READ,WRITE
|
|
299
|
-
bridge role update --key editor --privileges READ,WRITE,DELETE # or --id <role-id>
|
|
300
|
-
bridge role delete --key editor # or --id <role-id>
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Feature Flags
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
bridge flag list
|
|
307
|
-
bridge flag create --key dark-mode --description "Dark mode UI" --enabled
|
|
308
|
-
bridge flag update --key dark-mode --state on # or --id <flag-id>
|
|
309
|
-
bridge flag update --key dark-mode --new-key dark-theme # rename
|
|
310
|
-
bridge flag toggle --key dark-mode --enabled true # or --id <flag-id>
|
|
311
|
-
bridge flag delete --key dark-mode # or --id <flag-id>
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
`flag update --key` addresses the flag when `--id` is absent; passed alongside
|
|
315
|
-
`--id` it keeps its original meaning and renames the flag. `--new-key` always
|
|
316
|
-
renames, whichever way you addressed it.
|
|
317
|
-
|
|
318
|
-
### Branding
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
bridge branding get
|
|
322
|
-
bridge branding update --bg-color "#ffffff" --text-color "#000000"
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
### Subscription Plans
|
|
326
|
-
|
|
327
|
-
```bash
|
|
328
|
-
bridge plan list
|
|
329
|
-
# A plan needs at least one price — `create` takes the first one.
|
|
330
|
-
# A free tier is a zero-amount price: --amount 0
|
|
331
|
-
bridge plan create --key pro --name "Pro Plan" --amount 29 --interval month
|
|
332
|
-
bridge plan update --key pro --name "Pro Plan v2"
|
|
333
|
-
# Remove a plan. Only a plan no workspace is on is deleted (needs
|
|
334
|
-
# `bridge auth login --admin`); with workspaces on it the delete is refused.
|
|
335
|
-
bridge plan delete --key pro --dry-run # would it go through, and who is on it
|
|
336
|
-
bridge plan delete --key pro
|
|
337
|
-
# Stop selling it instead: workspaces on it keep it, nobody new can choose it.
|
|
338
|
-
bridge plan archive --key pro # --undo brings it back
|
|
339
|
-
# Or move the workspaces off it first (a paid subscription moves too).
|
|
340
|
-
bridge tenant set-plan --name "Acme Corp" --plan free
|
|
341
|
-
|
|
342
|
-
# Prices — a plan can have several (one per currency + interval). Idempotent.
|
|
343
|
-
bridge plan price set pro --amount 290 --currency usd --interval year
|
|
344
|
-
# Removing the last price is refused: a priceless plan can't be assigned.
|
|
345
|
-
bridge plan price rm pro --interval year
|
|
346
|
-
|
|
347
|
-
# Usage quotas (hard | metered caps)
|
|
348
|
-
# hard = block at the cap; metered = bill overage per unit (needs --price-amount)
|
|
349
|
-
bridge plan quota set pro --metric ai_completions --limit 1000 --policy hard
|
|
350
|
-
# Metered: first 1000 free, then $0.002/unit (currency from the plan's price)
|
|
351
|
-
bridge plan quota set pro --metric ai_completions --limit 1000 --policy metered --price-amount 0.002
|
|
352
|
-
# Pure per-unit (billed from unit 1)
|
|
353
|
-
bridge plan quota set pro --metric api_calls --limit 0 --policy metered --price-amount 0.01 --price-currency usd
|
|
354
|
-
bridge plan quota rm pro --metric ai_completions
|
|
355
|
-
|
|
356
|
-
# Included on/off features — each is `bridge:billing.entitlement.<key>` in flag rules
|
|
357
|
-
bridge plan feature add pro analytics --name "Analytics"
|
|
358
|
-
bridge plan feature list pro
|
|
359
|
-
bridge plan feature remove pro analytics
|
|
360
|
-
bridge plan create --key team --name Team --amount 0 --interval month --features "analytics,sso:Single sign-on"
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
### API Tokens
|
|
364
|
-
|
|
365
|
-
```bash
|
|
366
|
-
bridge token list
|
|
367
|
-
bridge token create --name "CI Token" --privileges USER_READ,TENANT_READ
|
|
368
|
-
bridge token revoke --name "CI Token" # or --id <token-id>
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
Token names are free text and not enforced unique — a duplicate name fails and
|
|
372
|
-
lists the candidates instead of revoking one at random.
|
|
373
|
-
|
|
374
|
-
### Events
|
|
375
|
-
|
|
376
|
-
```bash
|
|
377
|
-
bridge event list
|
|
378
|
-
bridge event list --type USER_CREATED --since 24h --limit 50
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
### Setup Workflows (multi-step)
|
|
382
|
-
|
|
383
|
-
```bash
|
|
384
|
-
bridge setup sso --provider google --client-id <id> --client-secret <secret>
|
|
385
|
-
bridge setup sso --provider azure --client-id <id> --client-secret <secret> --tenant-id <entra-directory-id>
|
|
386
|
-
bridge setup payments --stripe-key sk_test_xxx
|
|
387
|
-
bridge setup communication --from-address noreply@acme.com --from-name "Acme"
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
`setup sso` supports google, github, linkedin, facebook and azure (azure also
|
|
391
|
-
needs the Entra ID Directory (tenant) ID). SAML and OIDC are not supported by
|
|
392
|
-
the Bridge API; set them up in the Bridge admin UI. The command prints the
|
|
393
|
-
callback URL to register in the provider's console.
|
|
394
|
-
|
|
395
|
-
`setup communication` sets only the sender name and address. Bridge sends all
|
|
396
|
-
email through its own provider, so there is no provider or API key to
|
|
397
|
-
configure. A new sender address is verified by email before Bridge uses it.
|
|
398
|
-
|
|
399
|
-
### Info (context for AI agents)
|
|
400
|
-
|
|
401
|
-
```bash
|
|
402
|
-
bridge info app
|
|
403
|
-
bridge info auth-config
|
|
404
|
-
bridge info flags
|
|
405
|
-
bridge info plans
|
|
406
|
-
bridge info roles
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### Integration Guides
|
|
84
|
+
| Command | What it does |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `auth login` · `logout` · `whoami` · `workspace` | Sign in and out, see who you are, switch workspace |
|
|
87
|
+
| `app list` · `create` · `use` · `get` · `update` · `delete` | Your apps; `update` sets the name, logo, website, privacy policy and terms |
|
|
88
|
+
| `app address list` · `add` · `remove` | Sign-in returns, email links, browser origins, sign-out and checkout returns |
|
|
89
|
+
| `app default-return <url>` | The sign-in return used when a sign-in names none |
|
|
90
|
+
| `key list` · `create` · `revoke` | App keys, for your server |
|
|
91
|
+
| `plan list` · `get` · `create` · `update` · `apply` · `archive` · `delete` | Plans as one document; `apply <file>` creates or replaces one from JSON |
|
|
92
|
+
| `plan price` · `usage-price` · `feature` · `limit` (`set`/`add`, `remove`) | Change one entry of a plan |
|
|
93
|
+
| `product` · `metric` · `tax` · `billing settings` | Add-ons, what you count, tax rates, billing settings |
|
|
94
|
+
| `stripe status` · `connect` · `disconnect` | Stripe, in test mode by your pasted test key |
|
|
95
|
+
| `flag list` · `get` · `create` · `update` · `on` · `off` · `restore` · `delete` | Feature flags |
|
|
96
|
+
| `flag rule show` · `add` · `set` · `clear` | A flag's rule: ordered branches of conditions, the first match wins |
|
|
97
|
+
| `role` · `privilege` · `workspace list` · `member` | Roles, privileges, your customers' workspaces and their members |
|
|
98
|
+
| `invite send` · `list` · `revoke` | Invites by email: into your own workspace, or with `--workspace` into one of your app's |
|
|
99
|
+
| `check gates` | Lists every direct role, privilege or plan check in your project, with the flag to use instead |
|
|
410
100
|
|
|
411
|
-
|
|
101
|
+
`bridge <command> --help` has every option.
|
|
412
102
|
|
|
413
|
-
|
|
414
|
-
bridge guide # Bridge Auth master prompt (auth, RBAC, tenants)
|
|
415
|
-
bridge guide flags # Feature Flags 2.0 master prompt
|
|
416
|
-
bridge guide billing # Billing 2.0 master prompt (subscriptions, quotas, webhooks)
|
|
417
|
-
```
|
|
103
|
+
### Prices
|
|
418
104
|
|
|
419
|
-
|
|
105
|
+
Write prices the way you say them: `"19.99 EUR/month"`, `"190 EUR/year"`, or `"49 EUR"` for a one-time product. A usage price is a price per unit on top of a plan's price: `"api.calls 0.002 EUR/month included 10000"` charges 0.002 EUR per call above 10,000 a month. Limits are `metric=n` or `metric=unlimited`.
|
|
420
106
|
|
|
421
|
-
|
|
422
|
-
bridge guide mechanisms
|
|
423
|
-
```
|
|
107
|
+
### Flag rules
|
|
424
108
|
|
|
425
|
-
|
|
109
|
+
`--when "<attribute> <operator> <value>"` writes a one-branch rule; repeat `--when` to require every condition. The operators are `eq`, `neq`, `contains`, `not_contains`, `in`, `not_in`, `gt`, `lt`, `between`, `regex`, `exists` and `not_exists`. `flag rule add` adds a branch, `--rollout 25` gives it to a share of the people it matches, and `--rule`/`--rule-file` take a whole rule as JSON.
|
|
426
110
|
|
|
427
|
-
|
|
428
|
-
bridge guide list
|
|
429
|
-
bridge guide <framework> # auth guide (svelte | react | nextjs | angular | nestjs | express)
|
|
430
|
-
bridge guide <framework> sdk-auth # in-app auth UI (frontend frameworks only)
|
|
431
|
-
bridge guide flags --framework <name> # flags-specific guide
|
|
432
|
-
bridge guide billing --framework <name> # billing-specific guide
|
|
433
|
-
bridge guide custom # REST API fallback for any language
|
|
434
|
-
```
|
|
111
|
+
### Invites
|
|
435
112
|
|
|
436
|
-
`bridge
|
|
113
|
+
`bridge invite send ann@example.com --role ADMIN` emails Ann an invite to your own workspace on Bridge, the one you signed in to. Sending again to the same address sends a new link, and the old one stops working; an invite lasts 30 days. `bridge invite list` shows the open ones and `bridge invite revoke <id>` stops a link working.
|
|
437
114
|
|
|
438
|
-
|
|
115
|
+
Add `--workspace <id>` to invite into one of your app's workspaces instead (`bridge workspace list` shows them). That runs with an app key, as below. Bridge emails the link to your app's email-links address, so add one first: `bridge app address add https://app.example.com/auth --use email-links`.
|
|
439
116
|
|
|
440
|
-
|
|
117
|
+
### Roles, members and the pasted Stripe key
|
|
441
118
|
|
|
442
|
-
|
|
443
|
-
{
|
|
444
|
-
"success": true,
|
|
445
|
-
"data": { ... }
|
|
446
|
-
}
|
|
447
|
-
```
|
|
119
|
+
Bridge offers roles, privileges, workspaces, members and a pasted Stripe key to your app's own server, so these commands call Bridge with an app key. Set `BRIDGE_APP_KEY` to one of your app's keys, or leave it unset: the CLI then makes a key that lasts one day and holds only what the command needs, and revokes it as soon as the command is done. Making a key needs a recent sign-in; if yours is older, the CLI says so.
|
|
448
120
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
```json
|
|
452
|
-
{
|
|
453
|
-
"success": false,
|
|
454
|
-
"error": {
|
|
455
|
-
"code": "TENANT_HAS_ACTIVE_SUBSCRIPTION",
|
|
456
|
-
"message": "Cannot delete tenant with active subscription.",
|
|
457
|
-
"details": { ... }
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
```
|
|
121
|
+
## Output
|
|
461
122
|
|
|
462
|
-
|
|
123
|
+
Results are JSON on stdout: `{ "success": true, "data": … }`. Errors are JSON on stderr: `{ "success": false, "error": { "code", "message", "hint" } }`. Messages meant for you go to stderr as plain text.
|
|
463
124
|
|
|
464
|
-
|
|
125
|
+
Exit codes: `0` done, `1` refused or failed, `2` Bridge could not be reached or could not answer, `3` the CLI is not set up (no issuer, not signed in, a wrong setting).
|
|
465
126
|
|
|
466
|
-
|
|
467
|
-
|------|---------|
|
|
468
|
-
| 0 | Success |
|
|
469
|
-
| 1 | Client error (4xx), or `bridge auth login` failed/cancelled |
|
|
470
|
-
| 2 | Server error (5xx) |
|
|
471
|
-
| 3 | Configuration error (missing API key, expired credentials, etc.) |
|
|
127
|
+
## Settings
|
|
472
128
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
129
|
+
| Variable | Flag | What it is |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| `BRIDGE_ISSUER` | `--issuer` | Your issuer. Saved at sign-in |
|
|
132
|
+
| `BRIDGE_APP` | `--app` | The app commands act on. Default: the one chosen with `bridge app use` |
|
|
133
|
+
| `BRIDGE_SIGN_IN_PAGE` | `auth login --sign-in-page` | Bridge's sign-in page, only when the issuer publishes none, and only on the issuer's own address or on localhost. Never saved |
|
|
134
|
+
| `BRIDGE_APP_KEY` | | An app key for the commands that need one |
|
|
135
|
+
| `BRIDGE_TOKEN_STORE` | | `file` to keep the session in the 0600 file, `keychain` to require the keychain |
|
|
136
|
+
| `BRIDGE_CONFIG_DIR` | | Where settings are kept. Default `~/.config/bridge/v1` |
|
|
480
137
|
|
|
481
|
-
##
|
|
138
|
+
## Security
|
|
482
139
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
140
|
+
- The issuer and every endpoint must be `https`; plain `http` only on `localhost`, `127.0.0.1` and `[::1]`, for local development.
|
|
141
|
+
- The CLI never follows a redirect, so your token goes only to the addresses your issuer lists.
|
|
142
|
+
- Browser sign-in opens the sign-in page the issuer publishes. Another page is taken only on the issuer's own address, or on localhost for development, and is never saved.
|
|
143
|
+
- The browser is opened with no shell: the address is one argument to `open`, `xdg-open`, or `rundll32 url.dll,FileProtocolHandler` on Windows.
|
|
144
|
+
- Browser sign-in listens on `127.0.0.1` only, checks the `state` it sent, requires the issuer to name itself on the callback (`iss`, RFC 9207), and uses PKCE (S256).
|
|
145
|
+
- The session and settings files are written with no symlink followed: to a new 0600 file in a 0700 directory you own, then renamed into place.
|
|
146
|
+
- A temporary app key is revoked when the command ends, fails or is stopped with Ctrl-C; if it cannot be, the CLI prints the key's id to revoke.
|
|
147
|
+
- Passwords and Stripe keys are read without echo or from stdin, never from arguments, and never kept.
|
|
486
148
|
|
|
487
|
-
|
|
488
|
-
npm run build
|
|
149
|
+
## Use it from code
|
|
489
150
|
|
|
490
|
-
|
|
491
|
-
node bridge-cli/dist/bin.js --help
|
|
151
|
+
Every command is a plain function over one client, exported from the package:
|
|
492
152
|
|
|
493
|
-
|
|
494
|
-
|
|
153
|
+
```ts
|
|
154
|
+
import { BridgeClient, Sessions, FileStore, discover, plans } from '@nebulr-group/bridge-cli';
|
|
495
155
|
```
|
|
496
156
|
|
|
497
|
-
## Learn more
|
|
498
|
-
|
|
499
|
-
- [Getting started](https://thebridge.dev/docs/getting-started/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli)
|
|
500
|
-
- [Set up Bridge with your AI assistant](https://thebridge.dev/docs/ai-assistants/mcp/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli)
|
|
501
|
-
- [Feature flags](https://thebridge.dev/docs/feature-flags/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli)
|
|
502
|
-
- [Subscriptions and plan limits](https://thebridge.dev/docs/billing/how-it-works/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli)
|
|
503
|
-
- [API reference](https://thebridge.dev/docs/api-reference/?utm_source=npm&utm_medium=readme&utm_campaign=bridge-cli)
|
|
504
|
-
|
|
505
|
-
## Other Bridge packages
|
|
506
|
-
|
|
507
|
-
| Package | For |
|
|
508
|
-
|---|---|
|
|
509
|
-
| [`@nebulr-group/bridge-svelte`](https://www.npmjs.com/package/@nebulr-group/bridge-svelte) | SvelteKit |
|
|
510
|
-
| [`@nebulr-group/bridge-react`](https://www.npmjs.com/package/@nebulr-group/bridge-react) | React |
|
|
511
|
-
| [`@nebulr-group/bridge-nextjs`](https://www.npmjs.com/package/@nebulr-group/bridge-nextjs) | Next.js |
|
|
512
|
-
| [`@nebulr-group/bridge-angular`](https://www.npmjs.com/package/@nebulr-group/bridge-angular) | Angular |
|
|
513
|
-
| [`@nebulr-group/bridge-nestjs`](https://www.npmjs.com/package/@nebulr-group/bridge-nestjs) | NestJS |
|
|
514
|
-
| [`@nebulr-group/bridge-express`](https://www.npmjs.com/package/@nebulr-group/bridge-express) | Express |
|
|
515
|
-
| [`@nebulr-group/bridge-auth-core`](https://www.npmjs.com/package/@nebulr-group/bridge-auth-core) | Any JavaScript app (core) |
|
|
516
|
-
|
|
517
157
|
## License
|
|
518
158
|
|
|
519
|
-
|
|
159
|
+
MIT
|