@fluid-app/fluid-cli 0.1.64 → 0.1.66

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
@@ -25,6 +25,65 @@ fluid logout # Remove stored authentication
25
25
 
26
26
  Profiles are stored at `~/.fluid/config.json`.
27
27
 
28
+ `--shop <shop>` signs in to one company (`acme` or `acme.fluid.app`). For an
29
+ admin, finishing the sign-in with a code sent for that shop also confirms a
30
+ new company's signup.
31
+
32
+ ### Without a terminal
33
+
34
+ `fluid login` asks for the email and code at a prompt, so a script or agent
35
+ with no terminal signs in in two steps instead:
36
+
37
+ ```bash
38
+ # 1. Email a code for one company and save the sign-in (prints how to finish)
39
+ fluid login --send-code --email maya@acme.test --shop acme
40
+
41
+ # 2. Finish with the emailed code from FLUID_LOGIN_CODE
42
+ FLUID_LOGIN_CODE=123456 fluid login --code --email maya@acme.test --yes
43
+
44
+ # or read it from stdin with --code -
45
+ echo 123456 | fluid login --code - --email maya@acme.test --yes
46
+ ```
47
+
48
+ Step 1 needs `--shop`: the code is tied to that company, and only such a
49
+ code confirms a new signup (the signup response names the shop as
50
+ `fluid_shop`). Step 2 signs in to the same company; a `--shop` given there
51
+ must match it.
52
+
53
+ The code expires after 30 minutes, and five wrong codes lock it. Step 1
54
+ saves the server's id for the sign-in under
55
+ `~/.fluid/pending-logins/` until step 2 finishes it; the id alone cannot
56
+ sign in. A code given as `--code 123456` works but is visible in shell
57
+ history.
58
+
59
+ Without a terminal (and with `--code -`, which takes stdin), step 2 needs
60
+ `--yes`, which replaces a profile named after the company, or `--name
61
+ <profile>`, which is refused before the code is spent if that profile
62
+ exists. Either way the code is never used up on a profile it cannot write.
63
+ `--json` prints one JSON object (`status` is `code_sent`, `signed_in` or
64
+ `error`, with a `code` on errors).
65
+
66
+ With no terminal, `fluid login` fails at once rather than waiting at a
67
+ prompt, unless it has a token (`--token` or `FLUID_TOKEN`) or runs one of
68
+ the two steps (`--send-code`, `--code`).
69
+
70
+ ### Companies on Fluid's identity sign-in
71
+
72
+ Fluid decides per company whether it signs in through the identity service.
73
+ For such a company the email has a sign-in link instead of a code. Paste the
74
+ link at the code prompt, or, without a terminal, give it to `--code` the same
75
+ way as a code (in `FLUID_LOGIN_CODE` or on stdin). `fluid login` then opens
76
+ your browser to sign in and receives the result on a one-time server at
77
+ `http://127.0.0.1:<port>/callback`. The sign-in URL is printed too (on stderr
78
+ with `--json`), for a terminal with no browser to open.
79
+
80
+ In this mode no token is written to `config.json`. The refresh token is kept in
81
+ the operating system credential store (macOS Keychain, Windows Credential
82
+ Manager, or the Secret Service on Linux), and access tokens only in memory.
83
+ `fluid switch` moves company by token exchange, `fluid whoami` reads the
84
+ identity session, and `fluid logout` revokes the session. Every other company
85
+ signs in exactly as before.
86
+
28
87
  ## Plugins
29
88
 
30
89
  Install plugins alongside the core CLI to add commands:
@@ -99,12 +158,15 @@ to turn it off.
99
158
 
100
159
  ## Environment Variables
101
160
 
102
- | Variable | Description |
103
- | ----------------------- | ------------------------------------------------ |
104
- | `FLUID_TOKEN` | API token (alternative to `fluid login`) |
105
- | `FLUID_API_BASE` | API base URL (default: `https://api.fluid.app`) |
106
- | `FLUID_CONFIG_DIR` | Override config directory (default: `~/.fluid/`) |
107
- | `FLUID_NO_UPDATE_CHECK` | Turn off the daily update notice |
161
+ | Variable | Description |
162
+ | ----------------------- | ----------------------------------------------------------- |
163
+ | `FLUID_TOKEN` | API token (alternative to `fluid login`) |
164
+ | `FLUID_LOGIN_CODE` | Emailed code read by `fluid login --code` |
165
+ | `FLUID_API_BASE` | API base URL (default: `https://api.fluid.app`) |
166
+ | `FLUID_CONFIG_DIR` | Override config directory (default: `~/.fluid/`) |
167
+ | `FLUID_IDENTITY_URL` | Identity service origin (default: follows `FLUID_API_BASE`) |
168
+ | `FLUID_NO_BROWSER` | Print the sign-in URL without opening a browser |
169
+ | `FLUID_NO_UPDATE_CHECK` | Turn off the daily update notice |
108
170
 
109
171
  ## Development
110
172