@wafflebase/cli 0.6.3 → 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.
- package/README.md +66 -7
- package/dist/bin.js +16929 -15495
- 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
|
|
@@ -53,7 +78,10 @@ wafflebase
|
|
|
53
78
|
│ └── import <file> --replace <id> --yes for in-place
|
|
54
79
|
│
|
|
55
80
|
├── sheets (aliases: sheet, spreadsheet, spreadsheets)
|
|
56
|
-
│ ├── tabs (alias: tab)
|
|
81
|
+
│ ├── tabs (alias: tab)
|
|
82
|
+
│ │ ├── list <doc-id>
|
|
83
|
+
│ │ ├── create <doc-id> [name] --type sheet
|
|
84
|
+
│ │ └── rename <doc-id> <tab-id> <name>
|
|
57
85
|
│ ├── cells (alias: cell)
|
|
58
86
|
│ │ ├── get <doc-id> [<range>]
|
|
59
87
|
│ │ ├── set <doc-id> <ref> <value> --formula
|
|
@@ -71,7 +99,9 @@ wafflebase
|
|
|
71
99
|
```
|
|
72
100
|
|
|
73
101
|
**Global flags**: `--server`, `--api-key`, `--workspace`, `--profile`,
|
|
74
|
-
`--format json|table|csv` (default `json`), `--quiet
|
|
102
|
+
`--format json|table|csv|yaml` (default `json`), `--quiet` (suppresses
|
|
103
|
+
progress notices only — the result body and the JSON error envelope are
|
|
104
|
+
always emitted), `--verbose`,
|
|
75
105
|
`--dry-run`. The `--format` flag also doubles as the per-content shape
|
|
76
106
|
on `docs content` (`json|md|text`) and the export type override on
|
|
77
107
|
`docs export` (`pdf|docx`).
|
|
@@ -84,6 +114,8 @@ wafflebase docs list
|
|
|
84
114
|
wafflebase docs create "Q1 Notes" --type doc
|
|
85
115
|
|
|
86
116
|
# Spreadsheets
|
|
117
|
+
wafflebase sheets tabs create abc-123 "History"
|
|
118
|
+
wafflebase sheets tabs rename abc-123 tab-1 "Summary"
|
|
87
119
|
wafflebase sheets cells get abc-123 A1:D100
|
|
88
120
|
echo '{"A1":"Name","B1":"Score"}' | wafflebase sheets cells batch abc-123
|
|
89
121
|
wafflebase sheets export abc-123 out.csv
|
|
@@ -109,10 +141,37 @@ wafflebase schema cell.get # → sheets.cells.get
|
|
|
109
141
|
- **Errors**: a single JSON line on stderr —
|
|
110
142
|
`{"error":{"code":"…","message":"…"}}`. Typed errors (e.g.,
|
|
111
143
|
`INVALID_DOCX`, `TYPE_MISMATCH`, `CONFIRMATION_REQ`) carry a
|
|
112
|
-
command-specific `code` agents can branch on;
|
|
113
|
-
|
|
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.
|
|
114
165
|
- **Exit codes**: `0` success, `1` user error (bad input, 404, type
|
|
115
|
-
mismatch), `2` system error
|
|
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).
|
|
116
175
|
|
|
117
176
|
## Skills (for AI agents)
|
|
118
177
|
|
|
@@ -124,6 +183,6 @@ for the index.
|
|
|
124
183
|
|
|
125
184
|
## Design
|
|
126
185
|
|
|
127
|
-
Full design in [`/docs/design/rest-api
|
|
128
|
-
and [`/docs/design/
|
|
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
|
|
129
188
|
docs-side `content / export / import` pipeline).
|