@productlobster/plob 0.1.3 → 0.1.4

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 (4) hide show
  1. package/README.md +26 -7
  2. package/dist/cli.js +7985 -2477
  3. package/dist/index.js +7985 -2477
  4. package/package.json +3 -3
package/README.md CHANGED
@@ -35,13 +35,14 @@ plob --help
35
35
  | `plob run-replay <runId> [--from-stage <name>]` | Replay a run, optionally from a given stage. |
36
36
  | `plob prototype-list [--cursor <cursor>]` | List prototypes in the workspace. |
37
37
  | `plob prototype-pack --prototype-id <id> [--out <dir>]` | Fetch a prototype ZIP reference (extracts when `--out` is set). |
38
- | `plob document-list [--type <type>] [--run <runId>] [--latest] [--since <iso>] [--limit <n>] [--cursor <cursor>]` | List workspace documents. |
38
+ | `plob document-list [--type <type>] [--run <runId>] [--latest] [--since <iso>] [--limit <n>] [--cursor <cursor>]` | List workspace documents. `--latest` applies only with `--type`. |
39
39
  | `plob document-get --document-id <id>` | Read a document. |
40
40
  | `plob document-put --document-id <id> --version-token <token> --content <markdown> [--idempotency-key <key>]` | Update a document. |
41
41
  | `plob context-pack [--sections <list>] [--limit <n>] [--cursor <cursor>]` | Read accumulated workspace context. |
42
42
  | `plob observe --kind <kind> --content <text> [--idempotency-key <key>]` | Record a single observation. |
43
43
  | `plob ingest --bundle <path-or-dash> [--content-type <type>] [--source-name <name>] [--idempotency-key <key>]` | Ingest a bundle of notes. |
44
44
  | `plob --workspace <workspaceId> upload --file <path>` | Upload a document file to a workspace. |
45
+ | `plob --version` | Print the installed CLI version. |
45
46
 
46
47
  `plob workspaces` lists the workspace your stored credential can access. The initial credential is workspace-bound, so it returns that single workspace.
47
48
 
@@ -121,6 +122,8 @@ https://app.productlobster.ai/settings/connections
121
122
 
122
123
  Create an API key in the hosted app, then paste the one-time `ak_` key into the CLI prompt. The key is stored only in the OS keychain through `@napi-rs/keyring`; it is never written to a plaintext config file and is never printed by the CLI.
123
124
 
125
+ Where there is no OS keychain (headless Linux, CI runners, containers, cloud agent sandboxes), skip `login` and set `PRODUCTLOBSTER_API_KEY` instead; see [Credentials](#credentials).
126
+
124
127
  Automation-safe login reads the key from stdin and does not open a browser:
125
128
 
126
129
  ```bash
@@ -151,13 +154,15 @@ In `--json` mode, stdout contains exactly one JSON document for both success and
151
154
 
152
155
  ## Debugging
153
156
 
154
- Use `--debug` to print request IDs to stderr when the server returns one:
157
+ Use `--debug` to print request IDs to stderr when the server returns one, the credential source (`keychain` or `PRODUCTLOBSTER_API_KEY`, never the key), and the HTTP status and response body or local error behind a failure:
155
158
 
156
159
  ```bash
157
160
  plob --debug --json workspaces
158
161
  ```
159
162
 
160
- The CLI ships no client-side telemetry. Server-side request IDs are the support join key.
163
+ Anything shaped like an API key is redacted to `ak_[redacted]` in those diagnostics. The CLI ships no client-side telemetry. Server-side request IDs are the support join key.
164
+
165
+ `plob --version` prints the bare version; with `--json` (or piped stdout) it writes `{"data":{"version":"<version>"},"schemaVersion":1}`.
161
166
 
162
167
  ## Exit Codes
163
168
 
@@ -175,21 +180,33 @@ The CLI ships no client-side telemetry. Server-side request IDs are the support
175
180
  | 16 | Rate limited |
176
181
  | 17 | CLI version revoked; upgrade before retrying |
177
182
  | 18 | Backend temporarily unavailable; retry shortly |
183
+ | 19 | Included outcomes used; the account is read-only for agents |
178
184
  | 70 | Network or transport failure |
179
185
 
180
186
  When the server reports a version is no longer supported, the CLI exits 17 and prints the npm upgrade command from the structured error details. In `--json` mode, the same detail is emitted in the single JSON error document.
181
187
 
188
+ An HTTP-level refusal (rate limit, Terms re-acceptance, a rejected key) carries the server's own error document, so the CLI reports that code and message. A response that is not a ProductLobster error document reports its HTTP status in `details.httpStatus`, plus its `requestId` when the body is JSON that carries one: 401 maps to `unauthorized`, 429 to `rate_limited` (exit `16`), and any 5xx (including Cloudflare's own origin-error pages) to `service_unavailable` (exit `18`). A network-edge challenge or block page reports `details.reason: "edge_challenge"`. `plob upload` and the `prototype-pack --out` download apply the same mapping. If the response body cannot be read (the connection closed mid-body), the status alone decides the code. With `--debug`, the CLI also writes the HTTP status and the start of the response body, or the local error, to stderr, with anything shaped like an API key redacted. A `requestId` is kept only when it is id-shaped (letters, digits, `.`, `_`, `:`, `-`; at most 128 characters) and not shaped like an API key.
189
+
182
190
  ## Credentials
183
191
 
184
- The API key is loaded from the OS keychain through `@napi-rs/keyring`. `plob login` writes the pasted or stdin-provided `ak_` key to the keychain entry, and `plob logout` deletes it. A missing credential returns exit code `10` with a structured unauthorized error.
192
+ Every command except `login` and `logout` takes the API key from, in order:
193
+
194
+ 1. the OS keychain entry `plob login` saved, through `@napi-rs/keyring` (macOS Keychain, Windows Credential Manager, or the Linux Secret Service). A stored value that is not a valid `ak_` key is refused (exit `10`; run `plob login` again);
195
+ 2. the `PRODUCTLOBSTER_API_KEY` environment variable, only when the keychain holds no key or there is no keychain backend (CI, containers, headless Linux). A value that is not an `ak_` key is refused (exit `10`) rather than ignored.
196
+
197
+ The keychain wins so that a variable exported for another tool or workspace never silently replaces the key you logged in with. `--debug` names which source a command used.
198
+
199
+ `plob login` writes the pasted or stdin-provided `ak_` key to the keychain entry, and `plob logout` deletes it; neither reads or changes the environment variable, and `logout` notes on stderr when the variable is still set, since plob falls back to it once no keychain key is stored. A missing credential returns exit code `10` with a structured unauthorized error. When the keychain itself is unavailable (no Secret Service on a headless Linux host, for example), the error carries `details.reason: "keychain_unavailable"` and names the environment variable. The environment variable is visible to the process and anything it starts; prefer the keychain on a workstation.
185
200
 
186
201
  Default keychain entry:
187
202
 
188
203
  | Field | Value |
189
204
  | --- | --- |
190
- | Service | `productlobster.pl-cli` |
205
+ | Service | `productlobster.plob-cli` |
191
206
  | Account | `default` |
192
207
 
208
+ Versions 0.1.3 and earlier stored the key under the service `productlobster.pl-cli`. The CLI still reads that entry when the new one is empty, so an upgrade keeps working without a new login; reading never writes the keychain. `plob login` saves to the new entry and removes the old one, and `plob logout` removes both. Because a 0.1.4 `login` removes the legacy entry, going back to 0.1.3 afterwards needs a fresh `plob login`.
209
+
193
210
  ## Endpoint
194
211
 
195
212
  The default endpoint is:
@@ -201,10 +218,12 @@ https://app.productlobster.ai/api/mcp
201
218
  For local development, set:
202
219
 
203
220
  ```bash
204
- PL_MCP_URL=http://localhost:3000/api/mcp
221
+ PLOB_MCP_URL=http://localhost:3000/api/mcp
205
222
  ```
206
223
 
207
- `plob upload` uses the same origin as `PL_MCP_URL`.
224
+ The override must be an `https` URL on `productlobster.ai` (or a subdomain) or a `localhost` URL; any other host is refused (exit `2`) before the API key is sent. `plob upload` and `plob prototype-pack --out` use the same origin.
225
+
226
+ Versions 0.1.3 and earlier read `PL_MCP_URL`. It still works when `PLOB_MCP_URL` is unset, and plob writes one deprecation note to stderr when it uses it.
208
227
 
209
228
  ## Dependency Posture
210
229