@wafflebase/cli 0.6.4 → 0.6.5

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.
Files changed (3) hide show
  1. package/README.md +57 -5
  2. package/dist/bin.js +16727 -15398
  3. package/package.json +6 -4
package/README.md CHANGED
@@ -24,6 +24,13 @@ Two paths, in priority order:
24
24
  `WAFFLEBASE_API_KEY`, or set `api-key:` in `~/.wafflebase/config.yaml`.
25
25
  2. **OAuth session** — `wafflebase login` opens a browser, completes
26
26
  GitHub OAuth, and writes a JWT session to `~/.wafflebase/session.json`.
27
+ The login callback is bound to a per-attempt nonce, which the backend
28
+ echoes back as the callback's `state`, so a server that predates that
29
+ echo never completes one; against such a server (a self-hosted backend
30
+ that has not upgraded yet) pass
31
+ `wafflebase login --allow-unbound-callback` to accept its `state`-less
32
+ callback anyway. It warns on stderr, and a *mismatched* `state` stays
33
+ refused under the flag.
27
34
 
28
35
  Always pair API keys with a workspace ID:
29
36
 
@@ -32,6 +39,24 @@ export WAFFLEBASE_API_KEY=wfb_…
32
39
  export WAFFLEBASE_WORKSPACE=ws-…
33
40
  ```
34
41
 
42
+ ## Image fetching
43
+
44
+ `docs export` / `slides export` fetch the images a document references. An
45
+ image `src` is content someone else may have written, so the fetcher speaks
46
+ only `http`/`https`/`data` and refuses a non-public address (loopback,
47
+ private, `169.254.169.254`, CGNAT, multicast/reserved, and the IPv6
48
+ spellings of all of those) unless it is the configured `--server`'s own host
49
+ **and port**. The hostname is resolved before it is fetched and judged per
50
+ address, so `169.254.169.254.nip.io` and friends get no further than the
51
+ literal would, and the request is then pinned to the addresses that check
52
+ approved — DNS cannot answer differently between the check and the
53
+ connection. Every redirect hop is gated the same way, up to five.
54
+
55
+ An image that is refused or unreachable is reported on stderr and skipped,
56
+ rather than failing the whole export: one `src` you cannot fix must not cost
57
+ you the export you asked for. The rest of the document still exports, minus
58
+ those images.
59
+
35
60
  ## Command Tree (v0.3.7)
36
61
 
37
62
  Plural namespaces are canonical; singular forms are accepted as
@@ -116,10 +141,37 @@ wafflebase schema cell.get # → sheets.cells.get
116
141
  - **Errors**: a single JSON line on stderr —
117
142
  `{"error":{"code":"…","message":"…"}}`. Typed errors (e.g.,
118
143
  `INVALID_DOCX`, `TYPE_MISMATCH`, `CONFIRMATION_REQ`) carry a
119
- command-specific `code` agents can branch on; everything else
120
- reports `"ERROR"`.
144
+ command-specific `code` agents can branch on; argument-parsing
145
+ failures (missing argument, unknown option, unknown command) report
146
+ `USAGE`. A failed request whose
147
+ body the backend did *not* send in that shape (an Express/Nest
148
+ `{message, error, statusCode}` 404/500, an HTML proxy page) reports
149
+ `"HTTP_ERROR"` — or `"AUTH_ERROR"` / `"SERVER_ERROR"` when the status
150
+ says so — with `"HTTP <status>"` plus the upstream's own wording when
151
+ it had any, as `"HTTP 404: Document has no file"`. Every command
152
+ reports the same code for that condition, so the branch does not
153
+ depend on which subcommand ran. Local failures (bad input, a
154
+ filesystem error) still report `"ERROR"`.
155
+ - **Forwarded backend errors are bounded**: when the backend *did* send
156
+ the envelope, its own `code` is what you get — that is the value to
157
+ branch on, and it is never rewritten. The surrounding text is capped,
158
+ because it is upstream-controlled content going straight into an
159
+ agent's stderr: `code` is truncated at 80 characters, `message` at 500
160
+ (with a trailing `…`), a `message` that is an HTML document is replaced
161
+ by `"HTTP <status>"`, and any extra fields the backend attached
162
+ (`command`, a request id) are dropped once the whole body exceeds
163
+ 4,000 bytes, leaving `{code, message}`. Treat `message` as a display string,
164
+ not a parseable payload.
121
165
  - **Exit codes**: `0` success, `1` user error (bad input, 404, type
122
- mismatch), `2` system error (network, auth).
166
+ mismatch), `2` system error — an unreachable server
167
+ (`NETWORK_ERROR`), rejected credentials (`AUTH_ERROR`, HTTP 401/403),
168
+ or a server fault (`SERVER_ERROR`, HTTP 5xx). A 2xx the CLI cannot use
169
+ — a create that returned no id, a download that returned no bytes — is
170
+ a server fault too. The class is decided where the failure is raised,
171
+ so `--quiet` reports it too.
172
+ - **Proxies**: image downloads during `docs export` / `slides export`
173
+ honor `http_proxy` / `https_proxy` / `all_proxy` and `no_proxy` (either
174
+ letter case).
123
175
 
124
176
  ## Skills (for AI agents)
125
177
 
@@ -131,6 +183,6 @@ for the index.
131
183
 
132
184
  ## Design
133
185
 
134
- Full design in [`/docs/design/rest-api-and-cli.md`](../../docs/design/rest-api-and-cli.md)
135
- and [`/docs/design/docs-cli.md`](../../docs/design/docs-cli.md) (the
186
+ Full design in [`/docs/design/rest-api.md`](../../docs/design/rest-api.md)
187
+ and [`/docs/design/cli.md`](../../docs/design/cli.md) (the
136
188
  docs-side `content / export / import` pipeline).