@bluestep-systems/b6p-cli 1.6.0 → 1.8.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/CHANGELOG.md +84 -0
- package/README.md +183 -21
- package/dist/cli.js +331 -304
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,90 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.8.0] — 2026-12-05
|
|
11
|
+
|
|
12
|
+
Requires b6p-core 1.9.1 (bundled).
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **`b6p auth login`** signs b6p in through the browser, modelled on `gh auth login`: it prints a one-time code,
|
|
17
|
+
offers to open the gateway's `/device` page ("Press Enter to open … in your browser..."), waits while you allow it
|
|
18
|
+
there, then stores a token with the scopes BlueStep's tools need (`mcp`, `kb:read`, `kb:push`, `registry:read`,
|
|
19
|
+
`tokens:self`) for 90 days. Over SSH, with no display, without a terminal or with `--no-browser` it prints the
|
|
20
|
+
page's address instead; `--yes` skips the Enter prompt. The browser opener runs by full path only (never one in
|
|
21
|
+
the current folder or on `PATH`). The code is never put in the address. `--hostname <host>` signs in to another
|
|
22
|
+
gateway; nothing changes while it waits, and it becomes the configured one together with its token only when the
|
|
23
|
+
sign-in succeeds. `--with-token` stores a piped token, as `auth set`
|
|
24
|
+
does; `--web` is accepted. Already signed in, it asks first on a terminal. A new sign-in revokes the token the
|
|
25
|
+
last sign-in made; a pasted token is left live. Every way a sign-in can end is worded: denied in the browser, the
|
|
26
|
+
code expired, too many sign-ins from this network (with how long to wait), a gateway that doesn't offer it yet
|
|
27
|
+
("use `b6p auth set`"), and Ctrl-C (exit 130; when the approval had already arrived, its token is stored and b6p
|
|
28
|
+
says it is signed in anyway, exit 0); Ctrl-C also cancels the Enter prompt. `--json` prints the result on stdout and keeps the code on stderr. Then it offers git's credential
|
|
29
|
+
helper, as `auth set` does.
|
|
30
|
+
- **`b6p auth logout [--revoke]`** revokes the token `auth login` made and forgets it. A pasted token is only
|
|
31
|
+
forgotten unless `--revoke`. Offline, it forgets the token and says it stays live until it expires or is revoked
|
|
32
|
+
on My Account (exit 0).
|
|
33
|
+
- **`b6p auth refresh`** renews the sign-in's token now, to a fresh 90 days.
|
|
34
|
+
- **Renewal**: before a gateway command (`kb`, `marketplace`, `auth token`) and before script work (`script push`,
|
|
35
|
+
`pull`, `audit`, `deploy`, `setup`), b6p renews a sign-in's token when 30
|
|
36
|
+
days or fewer are left, at most once a day. Silent when it works; one warning line when it doesn't, and the
|
|
37
|
+
command goes on. A token that was renewed but could not be stored is never printed: the command fails and names
|
|
38
|
+
the `0600` recovery file b6p kept it in (`~/.b6p/recovered-token-<time>`). Ctrl-C waits until a renewal's new
|
|
39
|
+
token is stored. `auth mcp-headers` and `auth git-credential` never renew.
|
|
40
|
+
- **`b6p auth status`** says how b6p is signed in: browser sign-in (account, token name, scopes, expiry, "renews
|
|
41
|
+
itself while you use b6p") or a pasted token, with the token shown only as its masked prefix (`b6p_g_************`).
|
|
42
|
+
`--json` gains `method`, `account`, `alias`, `expiresAt` and `signIn`.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- **New token prefixes.** `auth set`, its hint and every error and helper line accept and name `b6p_g_` (global
|
|
47
|
+
accounts), `b6p_t_` (tenant users) and the older `b6pt_`. `b6p_o_` is not a platform token and is refused.
|
|
48
|
+
- A new secret that could not be stored, or came in a malformed answer (`auth token create`/`rotate`, login,
|
|
49
|
+
renewal, refresh), is no longer printed: the failure names core's recovery file (`recoveryFile` under `--json`,
|
|
50
|
+
which replaces `secret` on those failure bodies).
|
|
51
|
+
- A refused token from a browser sign-in says the sign-in has ended and to run `b6p auth login`; a missing or
|
|
52
|
+
malformed token points at `b6p auth login` as well as `b6p auth set`.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- Ctrl-C at a line prompt on a terminal exits 130, as it does at the masked token prompt, instead of reading as the
|
|
57
|
+
end of input (exit 1).
|
|
58
|
+
|
|
59
|
+
## [1.7.0] — 2026-12-05
|
|
60
|
+
|
|
61
|
+
Requires b6p-core 1.8.1 (bundled).
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
- **`b6p kb read <ref> [page]`** prints one knowledge-base page on stdout, untouched, and says on
|
|
66
|
+
stderr where it came from. Docs is read from the gateway with no token; the internal knowledge bases
|
|
67
|
+
(`fleet-supers`, `supers`) with the stored token. When the gateway cannot answer with the page (no token, the
|
|
68
|
+
token refused, unreachable, an unexpected answer, or a knowledge base whose pages it serves at no address), the
|
|
69
|
+
page is read from a clone of that knowledge base at its head commit: `--clone <dir>`, or `~/.bluestep/<name>` when
|
|
70
|
+
it exists. `--no-fallback` never reads a clone. A not-found is final: no clone is read after one. `--json` prints
|
|
71
|
+
the page with its source, commit and why a clone was read; a failure's body carries `reason`, `gatewayReason` and
|
|
72
|
+
`source`.
|
|
73
|
+
- **`b6p auth mcp-headers`**, for MCP clients: Claude Code's `headersHelper` and Codex's `http_headers_helper` run it
|
|
74
|
+
to get the gateway's `Authorization` header from b6p's stored token, so no `B6PT_TOKEN` environment variable is
|
|
75
|
+
needed. It prints only the header JSON, refuses a terminal, gives the token only for the gateway's own address,
|
|
76
|
+
and exits 1 with one fixed line on stderr on any failure (a closed stdout included). Root flags before or around
|
|
77
|
+
it (`--json`, `--help`, `--version`) still reach it. Core runs silent for it, so no warning of core's (a malformed
|
|
78
|
+
cache entry, say) reaches stderr. Hidden from help.
|
|
79
|
+
- **`b6p auth status --check`** asks the gateway whether it takes the stored token for BlueStep's tools: live, with
|
|
80
|
+
the `mcp` and `kb:read` scopes, and (with `tokens:self`) when it expires and whether it is refreshable. It exits 1
|
|
81
|
+
when not, saying why; `--json` adds a `check` field. The verdict, the token's row and both scopes come from one
|
|
82
|
+
read of the stored token (core's check). The suggested rotate command quotes the alias for your shell.
|
|
83
|
+
`b6p auth status` without it stays offline.
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
|
|
87
|
+
- The README no longer says the BlueStep AI tools read the token from `B6PT_TOKEN`: b6p is the one place it is kept.
|
|
88
|
+
|
|
89
|
+
### Fixed
|
|
90
|
+
|
|
91
|
+
- On a terminal, the spinner no longer erases the line after it has already been cleared, which wiped the last
|
|
92
|
+
line of output that had no newline (a page printed by `kb read`).
|
|
93
|
+
|
|
10
94
|
## [1.6.0] — 2026-12-04
|
|
11
95
|
|
|
12
96
|
### Added
|
package/README.md
CHANGED
|
@@ -63,19 +63,121 @@ The npm install above is unchanged and remains the recommended path wherever Nod
|
|
|
63
63
|
|
|
64
64
|
## Signing in
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
token the BlueStep AI tools use for the gateway MCP (`B6PT_TOKEN`), so if you already have one, use it
|
|
68
|
-
here too. To make one: **Tools → Organization Admin → Super → Global Users → Access Tokens → Create
|
|
69
|
-
New Token**.
|
|
66
|
+
Sign b6p in through your browser, the way `gh auth login` does:
|
|
70
67
|
|
|
71
|
-
|
|
68
|
+
```console
|
|
69
|
+
$ b6p auth login
|
|
70
|
+
! First copy your one-time code: WDJB-MJHT
|
|
71
|
+
Press Enter to open gateway.bluestep.net in your browser...
|
|
72
|
+
⠋ Waiting for you to approve in the browser (expires in 10 minutes)…
|
|
73
|
+
✓ Signed in to gateway.bluestep.net as you@example.com
|
|
74
|
+
✓ Token "b6p on your-laptop 2026-12-05 14:03" stored.
|
|
75
|
+
It expires 2027-03-05 and renews itself while you use b6p.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
On the gateway's `/device` page you sign in with Microsoft, type the code, check what is asking ("b6p on
|
|
79
|
+
your-laptop") and choose **Allow**. Type the code yourself: it is never put in a link, and nobody at BlueStep will
|
|
80
|
+
ever ask you for one. The token b6p gets has the scopes BlueStep's tools need (`mcp`, `kb:read`, `kb:push`,
|
|
81
|
+
`registry:read`, `tokens:self`), lasts 90 days and is renewed by b6p before it runs out (see
|
|
82
|
+
[Renewal](#renewal)), so you sign in again only after 60 days without using b6p.
|
|
83
|
+
|
|
84
|
+
Over SSH, with no display, without a terminal, with no browser opener in a system folder, or with `--no-browser`,
|
|
85
|
+
b6p prints the page's address instead of offering to open it: open it in a browser on any device. `--yes` skips the
|
|
86
|
+
Enter prompt and opens the browser at once. b6p runs the opener by its full path only (`/usr/bin/open`, `xdg-open`
|
|
87
|
+
from the system folders, `%SystemRoot%\System32\rundll32.exe`, or `$BROWSER` when it is a full path), never one found
|
|
88
|
+
in the current folder or on `PATH`. Ctrl-C stops waiting (exit `130`); the code expires on its
|
|
89
|
+
own after 10 minutes. If the approval had already arrived when you pressed Ctrl-C, its token is stored: b6p says it
|
|
90
|
+
is signed in anyway (the token it replaced was not revoked) and exits `0`.
|
|
91
|
+
|
|
92
|
+
| Flag | |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `--hostname <host>` | Sign in to another gateway (`gateway.myassn.com`, or an `https://` address). Nothing changes while it waits; it becomes the configured `gatewayUrl`, together with its token, only when the sign-in succeeds. Not with `--with-token` |
|
|
95
|
+
| `--no-browser` | Print the address; never offer to open a browser |
|
|
96
|
+
| `--with-token` | Read a token from stdin and store it, as `b6p auth set` does |
|
|
97
|
+
| `--web` | Accepted for gh's muscle memory; the browser is the only way |
|
|
98
|
+
|
|
99
|
+
Already signed in, `b6p auth login` asks first on a terminal ("Sign in again?", default no; for a pasted token
|
|
100
|
+
"Replace it with a browser sign-in?", default yes); `--yes`, `--json` or no terminal go on. A new sign-in revokes
|
|
101
|
+
the token the last sign-in made (it says so, and says whose it was when another account approves); a token you
|
|
102
|
+
pasted is left live, since it may be in use elsewhere. `--json` prints the result (gateway, account, token name and
|
|
103
|
+
id, scopes, expiry, what became of the token it replaced, `gatewayChanged`, `git`) on stdout; the code and address
|
|
104
|
+
still go to stderr. A failed sign-in's body has `reason` (`unavailable`, `denied`, `expired`, `rate-limited`,
|
|
105
|
+
`aborted`), `retryAfterSeconds` and `signedIn`.
|
|
106
|
+
|
|
107
|
+
Who can't sign in this way yet: an account without a linked Microsoft identity, a tenant's own user, or a gateway
|
|
108
|
+
that doesn't offer it ("This gateway doesn't offer device sign-in yet; use `b6p auth set`"). For them, and for CI,
|
|
109
|
+
store a token from My Account → Access Tokens with:
|
|
72
110
|
|
|
73
111
|
```bash
|
|
74
112
|
b6p auth set
|
|
75
113
|
```
|
|
76
114
|
|
|
77
|
-
|
|
78
|
-
|
|
115
|
+
A platform token begins `b6p_g_` (a global account's), `b6p_t_` (a tenant user's) or `b6pt_` (older tokens); all
|
|
116
|
+
three are accepted. `b6p_o_` tokens are not platform tokens and are refused. b6p is the one place the token is kept:
|
|
117
|
+
BlueStep's AI tools get it from b6p for the gateway MCP ([below](#the-gateway-mcp-gets-its-token-from-b6p)), so a
|
|
118
|
+
pasted token needs the `mcp` and `kb:read` scopes as well as what b6p's commands need. A `401` usually means the
|
|
119
|
+
token expired or its account lost access, not that it is the wrong kind of token.
|
|
120
|
+
|
|
121
|
+
### Signing out
|
|
122
|
+
|
|
123
|
+
```console
|
|
124
|
+
$ b6p auth logout
|
|
125
|
+
✓ Signed out of gateway.bluestep.net (you@example.com).
|
|
126
|
+
Token "b6p on your-laptop 2026-12-05 14:03" revoked.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`b6p auth logout` revokes the token `b6p auth login` made (with that token's own `tokens:self`) and forgets it.
|
|
130
|
+
A pasted token is only forgotten, since it may be in use elsewhere; `--revoke` revokes it too. When the gateway
|
|
131
|
+
can't be reached the token is forgotten anyway and b6p says it stays live until it expires or you revoke it on My
|
|
132
|
+
Account (exit `0`, as gh). `b6p auth clear` forgets the token and never revokes anything.
|
|
133
|
+
|
|
134
|
+
### Renewal
|
|
135
|
+
|
|
136
|
+
Before a gateway command (`kb`, `marketplace`, `auth token`) and before script work that uses the token (`script
|
|
137
|
+
push`, `pull`, `audit`, `deploy`, `setup`), b6p renews a browser sign-in's token when 30 days or
|
|
138
|
+
fewer are left: a fresh 90 days, at most one attempt a day on a computer. It says nothing when that works; when it
|
|
139
|
+
fails, one warning line, and the command goes on with the token it has. If the token was renewed but the new one
|
|
140
|
+
could not be stored, the command fails and says where b6p kept it: a new file `~/.b6p/recovered-token-<time>`
|
|
141
|
+
readable only by you. Store it with `b6p auth set < <that file>` and delete the file. b6p never prints such a token
|
|
142
|
+
(only when no file could be written and stdout is your terminal, as the last resort). Ctrl-C during a renewal waits
|
|
143
|
+
until the new token is stored. `b6p auth refresh` renews now, whatever is left. A pasted token is never renewed
|
|
144
|
+
(`b6p auth token rotate --days` renews a refreshable one by hand). The MCP header helper and git's credential helper
|
|
145
|
+
never renew: a renewal revokes the old secret at once, which would cut the connection that asked.
|
|
146
|
+
|
|
147
|
+
### The gateway MCP gets its token from b6p
|
|
148
|
+
|
|
149
|
+
An MCP client asks b6p for the gateway's `Authorization` header instead of reading an environment variable:
|
|
150
|
+
Claude Code's `headersHelper` and Codex's `http_headers_helper` run
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
b6p auth mcp-headers
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
which prints `{"Authorization":"Bearer <token>"}` from the stored token and nothing else. BlueStep's AI Dev Kit
|
|
157
|
+
plugin sets this up; a hand-written Claude Code entry looks like:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"mcpServers": {
|
|
162
|
+
"bluestep-gateway": {
|
|
163
|
+
"type": "http",
|
|
164
|
+
"url": "https://gateway.bluestep.net/mcp",
|
|
165
|
+
"headersHelper": "b6p auth mcp-headers"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
and for Codex, in `config.toml`: `http_headers_helper = "b6p auth mcp-headers"` under the server's table, with no
|
|
172
|
+
`bearer_token_env_var` (Codex prefers that variable to the helper). The client runs it again on reconnect and after
|
|
173
|
+
a `401`, so `b6p auth token rotate` or `b6p auth set` takes effect without a restart.
|
|
174
|
+
|
|
175
|
+
It is not for typing. It refuses a terminal (prints nothing and exits `1`), gives the token only for b6p's gateway
|
|
176
|
+
(when the client names the server, in `CLAUDE_CODE_MCP_SERVER_URL` or `--url <url>`, it must be on `gatewayUrl`'s
|
|
177
|
+
origin), never asks for anything, sends nothing anywhere, and on any failure prints one line on stderr and exits
|
|
178
|
+
`1`. Claude Code shows none of that line, so when the MCP does not connect, run `b6p auth status --check`: it asks
|
|
179
|
+
the gateway whether it takes the stored token (live, with `mcp` and `kb:read`), and says when it expires and whether
|
|
180
|
+
it is refreshable.
|
|
79
181
|
|
|
80
182
|
### Plain `git pull` and `git push`
|
|
81
183
|
|
|
@@ -129,8 +231,12 @@ platform; the verbs beneath it act on that part.
|
|
|
129
231
|
|
|
130
232
|
| Command | Purpose |
|
|
131
233
|
|---|---|
|
|
132
|
-
| `b6p auth
|
|
133
|
-
| `b6p auth
|
|
234
|
+
| `b6p auth login [--hostname <host>] [--no-browser] [--with-token]` | Sign in through the browser with a one-time code ([details](#signing-in)) |
|
|
235
|
+
| `b6p auth logout [--revoke]` | Revoke the token `auth login` made and forget it; a pasted token only with `--revoke` ([details](#signing-out)) |
|
|
236
|
+
| `b6p auth refresh` | Renew the token `auth login` made now, to a fresh 90 days ([details](#renewal)) |
|
|
237
|
+
| `b6p auth set` | Set or update the access token (paste one from My Account; for CI and accounts that can't use `auth login`) |
|
|
238
|
+
| `b6p auth status` | Report how b6p is signed in (browser sign-in or pasted, account, token name, scopes, expiry) and whether git is set up to use it (never prompts, offline) |
|
|
239
|
+
| `b6p auth status --check` | Also ask the gateway whether it takes the token for BlueStep's tools: live, with the `mcp` and `kb:read` scopes; its expiry and whether it is refreshable. Exits `1` when not ([details](#checking-the-token-with-the-gateway)) |
|
|
134
240
|
| `b6p auth setup-git` | Set git to use the token for plain `git pull` and `git push` ([details](#plain-git-pull-and-git-push)) |
|
|
135
241
|
| `b6p auth setup-git --remove` | Take b6p's entries out of your git config |
|
|
136
242
|
| `b6p auth clear` | Clear the stored token |
|
|
@@ -143,9 +249,9 @@ platform; the verbs beneath it act on that part.
|
|
|
143
249
|
`auth token` manages only your **own** tokens and needs the `tokens:self` scope. `create` and `rotate`
|
|
144
250
|
print the new secret **once**, alone on stdout (so `TOKEN=$(b6p auth token create …)` captures it), with
|
|
145
251
|
the details and a "store it now" note on stderr. Under `--json` the secret is the top-level `secret`
|
|
146
|
-
field of the body, on success (`create`, `rotate`)
|
|
147
|
-
|
|
148
|
-
and `stored
|
|
252
|
+
field of the body, on success (`create`, `rotate`). A new secret that could not be stored, or came in a malformed
|
|
253
|
+
answer, is never printed: the command fails and names the `0600` recovery file b6p kept it in (`recoveryFile` in
|
|
254
|
+
the `--json` body, with `error`, `errors`, `operation` and `stored`). A new token's
|
|
149
255
|
scopes can never exceed the token b6p is using. The default lifetime is 90 days, or until the token b6p is using expires if that comes first (the command says so and gives the date); `--expires 30d`, a date
|
|
150
256
|
(`2027-03-01`, the start of that day UTC) or a full date-time with `Z` or an offset
|
|
151
257
|
(`2027-03-01T12:00Z`, `2027-03-01T12:00:00+02:00`) picks another. `--expires never` warns and asks first (the safe answer, Cancel, is the
|
|
@@ -162,6 +268,7 @@ A new token can never outlive the token that creates it: an explicit `--expires`
|
|
|
162
268
|
|---|---|
|
|
163
269
|
| `b6p kb list [--scope global\|tenant] [--tenant U…]` | List the knowledge bases you may read, whether you may push, and each one's STATUS (`ok`, `branch-mismatch`, `repo-only`, `row-only`, `unconfirmed`, `undescribed`; a note under the table explains each one present) |
|
|
164
270
|
| `b6p kb pull <ref> [dir]` | Clone a knowledge base into a folder (default `./<name>`, or `./<tenant>-<name>` for a tenant's), or fast-forward an existing clone |
|
|
271
|
+
| `b6p kb read <ref> [page] [--clone <dir>] [--no-fallback]` | Print one page (default the README) on stdout, untouched: from the gateway for Docs and the internal knowledge bases, else from a clone ([details](#reading-a-page)) |
|
|
165
272
|
| `b6p kb push [dir]` | Push a clone (default: the current folder, or the clone that contains it) to the knowledge base's live branch |
|
|
166
273
|
| `b6p kb create <name> [--title <t>] [--live-branch <b>] [--access public\|private\|fleet-supers\|supers] [--confirm-public]` | Register a global knowledge base (and its repository). Defaults: title = name, branch `main`, private. `fleet-supers` is for BlueStep staff (fleet supers) only; `supers` is for BlueStep staff and reseller supers |
|
|
167
274
|
| `b6p kb set <name> [--title <t>] [--live-branch <b>] [--access public\|private\|fleet-supers\|supers] [--confirm-public]` | Change a global knowledge base's title, live branch or access, in one request; at least one option is required |
|
|
@@ -177,6 +284,32 @@ alone never makes a knowledge base public (it refuses). A knowledge base that
|
|
|
177
284
|
is already public is left alone. `--json` prints `{ knowledgeBase, changed }` (`kb set`) or `{ knowledgeBase }`
|
|
178
285
|
(`kb create`). `--access` is matched exactly, in lower case. `fleet-supers` and `supers` narrow access, so they need no confirmation, but the gateway accepts them only when the knowledge base is created and refuses a change to one on an existing knowledge base; b6p shows the gateway's refusal as it is. Do not set them until the gateway in that environment enforces them: an older gateway refuses them (b6p shows its message, then a hint to update the gateway) or may not enforce them. Only global knowledge bases can be created or changed; a tenant's cannot.
|
|
179
286
|
|
|
287
|
+
#### Reading a page
|
|
288
|
+
|
|
289
|
+
`b6p kb read <ref> [page]` prints the page's markdown on stdout and one line on stderr saying where it came from,
|
|
290
|
+
e.g. `global/fleet: Deployment/README.md from the gateway (commit 1a2b3c4)`. `page` is a path in the knowledge base:
|
|
291
|
+
`README.md`, `Deployment` (that is `Deployment.md`, or `Deployment/README.md` when it is a folder),
|
|
292
|
+
`Deployment/` (the folder's README) or `Deployment/Ring rollout.md`; no leading `/`, `..` or backslash.
|
|
293
|
+
|
|
294
|
+
- **Docs** (`docs`) is read from `/support/docs/<page>.md` with no token at all, as the site is.
|
|
295
|
+
- **Internal knowledge bases** (`fleet-supers` and `supers` access) are read from `/console/docs/<name>/<page>.md`
|
|
296
|
+
with the stored token (`kb:read`).
|
|
297
|
+
- **Any other** knowledge base (another public one, a private or a tenant one): the gateway serves its pages at no
|
|
298
|
+
address yet, so only a clone can be read.
|
|
299
|
+
|
|
300
|
+
When the gateway cannot answer with the page (no token, the token refused, unreachable, an answer that is not the
|
|
301
|
+
page, or no address), the page is read from a clone instead: `--clone <dir>`, or `~/.bluestep/<name>` when that
|
|
302
|
+
folder exists. The clone must be a clone of that knowledge base; the page is read at its head commit (local edits
|
|
303
|
+
are not seen, a symbolic link is never followed) and nothing is fetched, so keep it fresh with `b6p kb pull`.
|
|
304
|
+
`--no-fallback` never reads a clone. **A not-found is final**: the gateway answers 404 for a page you may not see
|
|
305
|
+
too, so a clone is never read after one, and a knowledge base the listing does not show is not found either.
|
|
306
|
+
|
|
307
|
+
`--json` prints `{ ref, page, source, commit, text, clone, fallbackReason }`: `source` is `gateway` or `clone`,
|
|
308
|
+
`fallbackReason` is why the clone was read (`no-token`, `refused`, `unavailable`, `unexpected`, `no-route`) or
|
|
309
|
+
`null`. A failure exits `1`; under `--json` its body has `error`, `errors`, `reason` (`not-found`, `no-clone`,
|
|
310
|
+
`no-fallback`, `not-a-clone`, `clone-mismatch`, `clone-refused`, `bad-page`), `gatewayReason` (why the gateway did
|
|
311
|
+
not answer, or `null`) and `source` (for `not-found`: `gateway` or `clone`).
|
|
312
|
+
|
|
180
313
|
### `b6p marketplace` — marketplace repositories
|
|
181
314
|
|
|
182
315
|
| Command | Purpose |
|
|
@@ -197,12 +330,13 @@ A plain working clone, unrelated to any script. There is no push.
|
|
|
197
330
|
### Gateway token scopes
|
|
198
331
|
|
|
199
332
|
`kb` and `marketplace` talk to the BlueStep gateway (`gatewayUrl`, default `https://gateway.bluestep.net`;
|
|
200
|
-
change it with `b6p config set gatewayUrl <url>`) using the same stored `
|
|
201
|
-
the scopes you need:
|
|
333
|
+
change it with `b6p config set gatewayUrl <url>`) using the same stored token. `b6p auth login` gives it `mcp`, `kb:read`, `kb:push`, `registry:read` and
|
|
334
|
+
`tokens:self`; for a pasted token, mint one with the scopes you need:
|
|
202
335
|
|
|
203
336
|
| Scope | For |
|
|
204
337
|
|---|---|
|
|
205
|
-
| `kb:read` | `kb list`, `kb pull` |
|
|
338
|
+
| `kb:read` | `kb list`, `kb pull`, `kb read` (all but Docs, which needs no token) |
|
|
339
|
+
| `mcp` | the gateway MCP, through `auth mcp-headers` (not used by b6p's own commands; `auth status --check` checks it) |
|
|
206
340
|
| `kb:push` | `kb push` |
|
|
207
341
|
| `kb:manage` | `kb create`, and the change in `kb set` (super users) |
|
|
208
342
|
| `registry:read` | `marketplace list`, `marketplace get`, `marketplace pull` |
|
|
@@ -389,7 +523,7 @@ any target fails by the push rules above.
|
|
|
389
523
|
|---|---|
|
|
390
524
|
| `0` | The command completed without reporting an error |
|
|
391
525
|
| `1` | The command failed, or its arguments were rejected |
|
|
392
|
-
| `130` | A prompt was interrupted with Ctrl-C |
|
|
526
|
+
| `130` | A prompt, or `b6p auth login`'s wait, was interrupted with Ctrl-C |
|
|
393
527
|
|
|
394
528
|
`--quiet` and `--json` change what is printed, never the exit code, so it is safe to gate a
|
|
395
529
|
pipeline on:
|
|
@@ -410,7 +544,7 @@ $ b6p --json script deploy missing.json
|
|
|
410
544
|
```
|
|
411
545
|
|
|
412
546
|
Note that a command reporting a *value* has still succeeded — `b6p auth status` exits `0` whether
|
|
413
|
-
or not a token is stored. Branch on its output, not its exit code:
|
|
547
|
+
or not a token is stored (`b6p auth status --check`, a check, exits `1` when it fails). Branch on its output, not its exit code:
|
|
414
548
|
|
|
415
549
|
```bash
|
|
416
550
|
b6p --json auth status | jq -e .authenticated >/dev/null
|
|
@@ -432,9 +566,10 @@ instead of stalling until the job times out.
|
|
|
432
566
|
|
|
433
567
|
## Authentication
|
|
434
568
|
|
|
435
|
-
The token from [Signing in](#signing-in) is stored in encrypted secret storage under `~/.b6p
|
|
436
|
-
|
|
437
|
-
|
|
569
|
+
The token from [Signing in](#signing-in) is stored in encrypted secret storage under `~/.b6p/`, with what the
|
|
570
|
+
sign-in said about it (gateway, token id and name, account, scopes, expiry). Any command that needs credentials
|
|
571
|
+
prompts for a token if none is stored. In CI, store one with `b6p auth set`: `b6p auth login` needs a person at a
|
|
572
|
+
browser.
|
|
438
573
|
|
|
439
574
|
For unattended use, check for credentials before running anything that might prompt:
|
|
440
575
|
|
|
@@ -455,7 +590,34 @@ Piped (or under `--yes` or `--json`), `auth set` does not ask about git; it prin
|
|
|
455
590
|
`{ "authenticated": true, "git": { "configured": false, "hint": "…" } }` (`configured` is `null` when git could
|
|
456
591
|
not be checked, and `hint` is `null` when there is nothing to say). `b6p --json auth status` carries git's state as `git`: core's
|
|
457
592
|
status (`configured`, `hosts`, `otherHelpers`, `scope`) with `error: null`, or `{ "error": "<why>" }` when
|
|
458
|
-
git cannot be checked.
|
|
593
|
+
git cannot be checked. It also carries the sign-in: `method` (`login`, `pasted` or `null`), `account`, `alias`,
|
|
594
|
+
`expiresAt`, and `signIn`, core's whole offline description (`tokenPrefix`, `gateway`, `signedInGateway`,
|
|
595
|
+
`scopes`, `refreshable`, `daysLeft`, `expired`, `renewDue`; never the token).
|
|
596
|
+
|
|
597
|
+
### Checking the token with the gateway
|
|
598
|
+
|
|
599
|
+
`b6p auth status` is offline and only says whether a well-formed token is stored. `b6p auth status --check` also
|
|
600
|
+
asks the gateway (core's MCP check, on one read of the stored token): whether
|
|
601
|
+
the token is live, whether `/mcp` takes it (`mcp`), whether it holds `kb:read`, and, with `tokens:self`, its alias,
|
|
602
|
+
expiry and whether it is refreshable. It exits `0` when the token works for BlueStep's tools and `1` when it does
|
|
603
|
+
not, saying why and what to do. `--json` adds a `check` field:
|
|
604
|
+
|
|
605
|
+
```json
|
|
606
|
+
{
|
|
607
|
+
"ok": true,
|
|
608
|
+
"reason": null,
|
|
609
|
+
"missingScope": null,
|
|
610
|
+
"scopes": { "mcp": true, "kb:read": true },
|
|
611
|
+
"token": { "alias": "laptop", "expiresAt": "2027-03-01T00:00:00Z", "refreshable": true },
|
|
612
|
+
"status": 200,
|
|
613
|
+
"error": null
|
|
614
|
+
}
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
`reason` is `token-missing`, `token-malformed` (nothing is sent for either), `token-invalid` (expired or revoked;
|
|
618
|
+
the gateway does not say which), `scope-missing` (`missingScope` names it), `not-permitted` or `unreachable` (the
|
|
619
|
+
gateway could not give a verdict; `error` says what to do). A scope is `null` when it could not be told, and
|
|
620
|
+
`token` is `null` without `tokens:self`.
|
|
459
621
|
|
|
460
622
|
## WebDAV URL format
|
|
461
623
|
|