@faable/faable 2.2.0 → 3.0.0

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 CHANGED
@@ -9,67 +9,104 @@
9
9
  Your React, Node.js or Python apps, up to the cloud in seconds.
10
10
  </p>
11
11
 
12
- ## Faable
12
+ ## Faable CLI
13
13
 
14
- Faable is the best platform to build modern architectures that scale precisely
15
- to meet demand. We handle the hard stuff so you can focus on building cloud
16
- ready apps. Make your business cloud driven and join those awesome companies.
14
+ `@faable/faable` is the command-line interface for the Faable platform. It covers
15
+ **Faable Deploy** (ship and operate apps) and **Faable Auth** (manage an identity
16
+ tenant: users, login-flow actions, OAuth clients and the audit log) from one binary.
17
17
 
18
- To install the latest version of Faable CLI:
18
+ Full reference: **[faable.com/docs/cli](https://faable.com/docs/cli)**.
19
+
20
+ To install the latest version:
19
21
 
20
22
  ```bash
21
23
  npm i -g @faable/faable
22
24
  ```
23
25
 
24
- ## Runtimes
26
+ ## Commands
25
27
 
26
- `faable deploy` auto-detects the runtime from the files in your project (no
27
- config needed in the common case):
28
+ | Group | What it does | Docs |
29
+ | --- | --- | --- |
30
+ | `faable login` / `whoami` / `logout` | Session management (device flow; CI uses OIDC, no login needed) | [Authentication](https://faable.com/docs/cli#authentication) |
31
+ | `faable deploy` | Deploy the current directory, then `status`, `logs`, `deployments`, `inspect`, `trigger`, `redeploy`, `cancel`, `open`, `list` | [Deployment](https://faable.com/docs/cli#deployment) |
32
+ | `faable deploy secrets` | Environment variables: `list`, `set` (`KEY=VALUE` or `--env-file`), `rm` | [Secrets](https://faable.com/docs/cli#secrets) |
33
+ | `faable deploy domains` | Custom domains: `add` (prints the CNAME), `list`, `check`, `rm` | [Domains](https://faable.com/docs/cli#domains) |
34
+ | `faable deploy waf` | Edge rules: `block` (403), `sink` (404 without waking the app), `list`, `rm` | [Edge rules](https://faable.com/docs/cli#edge-rules-waf) |
35
+ | `faable auth users` | `list` (FaableQL filters), `get` (federated identities included), `suspend`, `reinstate` | [Users](https://faable.com/docs/cli#users) |
36
+ | `faable auth actions` | Login-flow hooks: `list`, `get --code`, `create`, `update`, `rm` | [Actions](https://faable.com/docs/cli#actions) |
37
+ | `faable auth clients` | OAuth clients: `list`, `get --secret`, `create`, `rm` | [OAuth clients](https://faable.com/docs/cli#oauth-clients) |
38
+ | `faable auth logs` | Audit log (read-only): `list` with filters, `get` | [Audit logs](https://faable.com/docs/cli#audit-logs) |
39
+
40
+ Every command has `--help`; read commands accept `--json` for output you can pipe
41
+ to `jq`. The complete table is in the
42
+ [command reference](https://faable.com/docs/cli#command-reference).
43
+
44
+ ### Deploy
28
45
 
29
- | Detected by | Runtime |
30
- | --- | --- |
31
- | `package.json` | Node.js (Next.js, Vite, Astro, Gatsby, CRA, Vue, Angular, …) |
32
- | `requirements.txt` / `pyproject.toml` / `Pipfile` | Python |
33
- | `Dockerfile` | Your own image (any language) |
46
+ ```bash
47
+ faable login
48
+ faable deploy # deploy the current directory
49
+ faable deploy status # phase, URL and detected stack
50
+ faable deploy logs --build # build output (--follow to tail)
51
+ faable deploy secrets set KEY=value
52
+ faable deploy domains add app.example.com
53
+ ```
34
54
 
35
- > A project with a `package.json` is always treated as Node. To deploy a Python
36
- > backend that also has a `package.json`, ship a `Dockerfile` instead.
55
+ ### Faable Auth
37
56
 
38
- ### Node.js / static frameworks
57
+ `faable auth` manages a [Faable Auth](https://faable.com/docs/auth) tenant and
58
+ reuses your `faable login` session. Point it at your tenant with
59
+ `--auth-url https://<account>.auth.faable.link` (or `FAABLE_AUTH_URL`).
39
60
 
40
- SPA frameworks are built and served automatically. If the project has **no
41
- `start` script**, the built output is served statically (e.g. Vite → `npx vite
42
- preview`, CRA/Vue/Angular → `serve`). If it defines a `start` script (custom SSR,
43
- Next.js, Nuxt, Remix, …), that command is used.
61
+ ```bash
62
+ faable auth users list --query email_verified:false --limit 50
63
+ faable auth users get user_abc123 # includes GitHub/… identities
64
+ faable auth users suspend user_abc123 -r "abuse: crypto miner"
44
65
 
45
- ### Python
66
+ # Bulk: pipe ids from a filtered listing
67
+ faable auth users list --suspended --json | jq -r '.[].id' | faable auth users reinstate -y
46
68
 
47
- The start command is detected from your framework:
69
+ faable auth actions create -n add-claims -t post-login -f ./claims.js
70
+ faable auth clients create -n my-app --callback https://app.example.com/callback
71
+ faable auth logs list --origin oauth --status failed --since 2026-08-01
72
+ ```
48
73
 
49
- | Framework | Detected from | Start command |
50
- | --- | --- | --- |
51
- | Django | `manage.py` + the package with `wsgi.py` | `gunicorn <pkg>.wsgi:application` |
52
- | FastAPI / ASGI | `fastapi`/`uvicorn`/`starlette` dep | `uvicorn <module>:app` |
53
- | Flask | `flask` dep | `gunicorn <module>:app` |
74
+ See [`faable auth` in the docs](https://faable.com/docs/cli#faable-auth) for
75
+ every flag. The concepts behind each group are documented in Faable Auth:
76
+ [users & suspension](https://faable.com/docs/auth/suspend-users),
77
+ [actions](https://faable.com/docs/auth/extensibility/actions),
78
+ [login flows](https://faable.com/docs/auth/login-flows),
79
+ [OAuth clients](https://faable.com/docs/auth/clients) and
80
+ [audit logs](https://faable.com/docs/auth/logs).
54
81
 
55
- Dependencies are installed inside the image from `requirements.txt`,
56
- `pyproject.toml` or `Pipfile`. `gunicorn`/`uvicorn` are installed automatically
57
- if missing.
82
+ ## Documentation
58
83
 
59
- Pin the Python version with a `runtime.txt` (`python-3.11.3`), a
60
- `.python-version`, or `requires-python` in `pyproject.toml`.
84
+ The CLI is a thin client: what it deploys and what it manages is documented in
85
+ the public docs, not here.
61
86
 
62
- ### Overriding detection
87
+ ### CLI
63
88
 
64
- When auto-detection doesn't fit, set the commands explicitly:
89
+ - [Command reference](https://faable.com/docs/cli#command-reference) — every command and flag
90
+ - [Authentication](https://faable.com/docs/cli#authentication) — `login`, `whoami`, `logout`
91
+ - [Deployment](https://faable.com/docs/cli#deployment) · [Inspecting](https://faable.com/docs/cli#inspecting) · [Secrets](https://faable.com/docs/cli#secrets) · [Domains](https://faable.com/docs/cli#domains) · [Edge rules](https://faable.com/docs/cli#edge-rules-waf) · [Faable Auth](https://faable.com/docs/cli#faable-auth)
65
92
 
66
- - `faable.json` — `{ "buildCommand": "...", "startCommand": "..." }`
67
- - `Procfile` — a `web:` line, e.g. `web: gunicorn app:app --bind 0.0.0.0:$PORT`
93
+ ### Faable Deploy
68
94
 
69
- Precedence: `faable.json` → `Procfile` → auto-detection. The container listens on
70
- `$PORT` (80).
95
+ - [Get started](https://faable.com/docs/deploy/get-started) — first deploy in minutes
96
+ - [How deployment works](https://faable.com/docs/deploy/how-it-works) — push-to-deploy, builds and releases
97
+ - [Runtime](https://faable.com/docs/deploy/runtime) — supported languages, framework detection, `faable.json` / `Procfile` overrides
98
+ - [What the builder expects](https://faable.com/docs/deploy/build-requirements) — build and start commands, `$PORT`, monorepos
99
+ - [Environment & releases](https://faable.com/docs/deploy/environment) — secrets, env vars and release versions
100
+ - [Custom domains](https://faable.com/docs/deploy/domains/custom-domain) and [SSL certificates](https://faable.com/docs/deploy/domains/ssl-certificates)
101
+ - [Web Application Firewall](https://faable.com/docs/deploy/security-waf) — the edge rules behind `faable deploy waf`
102
+ - [Deploy from your own CI](https://faable.com/docs/deploy/github-actions) — OIDC, no login needed
103
+ - Framework guides: [Next.js](https://faable.com/docs/deploy/guides/guide-next), [Vite](https://faable.com/docs/deploy/guides/guide-vite), [Astro](https://faable.com/docs/deploy/guides/guide-astro), [Express](https://faable.com/docs/deploy/guides/guide-express), [Django](https://faable.com/docs/deploy/guides/guide-django), [FastAPI](https://faable.com/docs/deploy/guides/guide-fastapi), [Flask](https://faable.com/docs/deploy/guides/guide-flask), [PHP](https://faable.com/docs/deploy/guides/guide-php)
71
104
 
72
- ## Documentation
105
+ ### Faable Auth
73
106
 
74
- For details on how to use Faable CLI, check out our
75
- [documentation](https://faable.com/docs).
107
+ - [Get started](https://faable.com/docs/auth/get-started) — create a tenant
108
+ - [Clients](https://faable.com/docs/auth/clients) · [Connections](https://faable.com/docs/auth/connections) · [Social login](https://faable.com/docs/auth/social) · [Passwordless](https://faable.com/docs/auth/passwordless)
109
+ - [Suspend users](https://faable.com/docs/auth/suspend-users) — what `users suspend` / `reinstate` do to sessions and tokens
110
+ - [Login flows](https://faable.com/docs/auth/login-flows) and [actions](https://faable.com/docs/auth/extensibility/actions) — the hooks managed by `auth actions`
111
+ - [Logs](https://faable.com/docs/auth/logs) — the audit trail read by `auth logs`
112
+ - [OAuth 2.0 flows](https://faable.com/docs/auth/oauth-flows) · [OpenID Connect](https://faable.com/docs/auth/oidc) · [Validate access tokens](https://faable.com/docs/auth/validate-access-tokens)
@@ -20,7 +20,7 @@ const context = async (targetAppId) => {
20
20
  try {
21
21
  const idToken = process.env.FAABLE_ID_TOKEN || (await getIDToken("https://faable.com"));
22
22
  // targetAppId disambiguates a monorepo (several apps, one repo) in the
23
- // OIDC exchange — from `faable deploy <app_id>`.
23
+ // OIDC exchange — from `faable deploy --app <app_id>`.
24
24
  api = FaableApi.create({
25
25
  authStrategy: oidc_strategy,
26
26
  auth: { idToken, appId: targetAppId },
@@ -27,7 +27,7 @@ const exchangeGithubOidcToken = async (gh_token, target_app_id) => {
27
27
  // Monorepo: several apps are linked to the same repository.
28
28
  if (status === 400) {
29
29
  throw new Error(serverMessage ||
30
- "This repository has multiple linked apps. Specify which one with `faable deploy <app_id>`.", { cause: err });
30
+ "This repository has multiple linked apps. Specify which one with `faable deploy --app <app_id>`.", { cause: err });
31
31
  }
32
32
  throw new Error(`Faable OIDC token exchange failed (${status ?? "network error"})${serverMessage ? `: ${serverMessage}` : ""}`, { cause: err });
33
33
  }
@@ -22,13 +22,18 @@ import { is_superseded } from './superseded.js';
22
22
  import { waf } from './waf/index.js';
23
23
 
24
24
  const deploy = {
25
- command: 'deploy [app_id]',
25
+ // No positional: `deploy` takes ONLY subcommands. An app_id typed where a
26
+ // subcommand belongs (`faable deploy app_xxx secrets list`) used to be
27
+ // swallowed by an `[app_id]` positional and silently DEPLOYED instead of
28
+ // running the subcommand; with no positional, .strictCommands() in
29
+ // src/index.ts rejects it as an unknown command. Target another app with
30
+ // --app, exactly like every subcommand does.
31
+ command: 'deploy',
26
32
  // Name the subcommand groups so `faable --help` makes them discoverable
27
33
  // without digging into `faable deploy --help`.
28
34
  describe: 'Deploy a faable app and manage it (secrets, domains, logs, deployments…)',
29
35
  builder: yargs => {
30
- // Product subcommands live under `deploy` (yargs matches them before the
31
- // app_id positional, so `faable deploy <app_id>` keeps working).
36
+ // Product subcommands live under `deploy`.
32
37
  return yargs
33
38
  .command(secrets)
34
39
  .command(domains)
@@ -43,9 +48,10 @@ const deploy = {
43
48
  .command(redeploy)
44
49
  .command(cancel)
45
50
  .command(link)
46
- .positional('app_id', {
51
+ .option('app', {
52
+ alias: 'a',
47
53
  type: 'string',
48
- description: 'App Identifier'
54
+ description: 'App Identifier (defaults to the app linked to this repository)'
49
55
  })
50
56
  .option('workdir', {
51
57
  alias: 'w',
@@ -62,22 +68,21 @@ const deploy = {
62
68
  default: false,
63
69
  description: 'Skip the confirmation prompt (only asked in interactive terminals — CI is unaffected)'
64
70
  })
71
+ .example('$0 deploy', 'Deploy the app linked to the current directory')
72
+ .example('$0 deploy --app app_a1b2c3', 'Deploy another app (monorepo: several apps, one repo)')
65
73
  .showHelpOnFail(false);
66
74
  },
67
75
  handler: async (args) => {
68
76
  const workdir = args.workdir || process.cwd();
69
77
  // Pass the explicit app target to the OIDC exchange so a monorepo (several
70
78
  // apps, one repo) can be disambiguated in CI.
71
- const ctx = await requireApi(args.app_id);
79
+ const ctx = await requireApi(args.app);
72
80
  const { api } = ctx;
73
81
  const config = Configuration.instance().deployConfig();
74
- const app_id = await resolve_app_id(args.app_id, ctx.appId, api, workdir);
82
+ const app_id = await resolve_app_id(args.app, ctx.appId, api, workdir);
75
83
  const app = await api.getApp(app_id);
76
- // Guard against the `faable deploy <app_id> <subcommand>` typo: yargs
77
- // doesn't recognize an unmatched trailing token as the subcommand, so it
78
- // silently falls through to THIS handler and deploys `workdir` instead.
79
- // Only prompts in a real terminal — CI (non-TTY) keeps deploying
80
- // unattended exactly as before, so existing pipelines need no changes.
84
+ // Confirm which app/dir is about to go out. Only in a real terminal — CI
85
+ // (non-TTY) deploys unattended, so pipelines need no changes.
81
86
  if (!args.yes && process.stdout.isTTY) {
82
87
  const { confirm } = await prompts({
83
88
  type: 'toggle',
@@ -3,7 +3,7 @@ import { getGitRemoteUrl } from '../../lib/git_remote.js';
3
3
  import { log } from '../../log.js';
4
4
 
5
5
  // app_id resolution (the user never has to look one up):
6
- // 1. explicit (positional on `deploy`, --app on subcommands)
6
+ // 1. explicit (--app, on `deploy` and on every subcommand)
7
7
  // 2. OIDC in CI — the backend resolves the app from the linked repository
8
8
  // 3. locally — a legacy app_id in faable.json (older CLIs wrote it on
9
9
  // `faable deploy link`; the current link only persists in the API)
@@ -25,10 +25,10 @@ const resolve_app_id = async (explicit, ctxAppId, api, workdir = process.cwd())
25
25
  }
26
26
  if (matches.length > 1) {
27
27
  const ids = matches.map(app => `${app.name} (${app.id})`).join(', ');
28
- throw new Error(`Repository ${repository} is linked to several apps: ${ids}. Pass the app explicitly.`);
28
+ throw new Error(`Repository ${repository} is linked to several apps: ${ids}. Pass one with --app <app_id>.`);
29
29
  }
30
30
  }
31
- throw new Error('No app linked to this repository. Link it from the dashboard (or run "faable deploy link"), or pass the app explicitly.');
31
+ throw new Error('No app linked to this repository. Link it from the dashboard (or run "faable deploy link"), or pass one with --app <app_id>.');
32
32
  };
33
33
 
34
34
  export { resolve_app_id };
package/dist/index.js CHANGED
@@ -72,6 +72,14 @@ yg.scriptName('faable')
72
72
  // help, then fail red — a bad invocation must not exit 0.
73
73
  yg.showHelp();
74
74
  log.error(`❌ ${msg}`);
75
+ // The one unknown command worth naming: an app id passed positionally.
76
+ // `faable deploy <app_id> secrets list` used to deploy the working
77
+ // directory instead of listing secrets, so the id now lives in a flag —
78
+ // say so, or the migration reads as the CLI having lost a feature.
79
+ const stray = /Unknown commands?: (app_[A-Za-z0-9_-]+)/.exec(msg);
80
+ if (stray) {
81
+ log.error(`The app id goes in a flag, not as an argument: faable deploy --app ${stray[1]} [subcommand]`);
82
+ }
75
83
  process.exit(1);
76
84
  }
77
85
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faable/faable",
3
- "version": "2.2.0",
3
+ "version": "3.0.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "author": "Marc Pomar <marc@faable.com>",