@plune-ai/cli 0.39.16 → 0.40.1

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
@@ -10,7 +10,7 @@
10
10
  Plune runs an assertion suite against an LLM provider and gives you a pass/fail report —
11
11
  locally, in CI, or as a regression diff between two runs. You describe the checks in one
12
12
  `plune.yaml`; Plune calls the model, evaluates each assertion, caches results, and reports
13
- token cost. Ten built-in assertion types cover plain text, JSON-schema, LLM-as-judge, and
13
+ token cost. Eleven built-in assertion types cover plain text, JSON (a schema or an expected value), LLM-as-judge, and
14
14
  RAG metrics (faithfulness, answer-relevance, context-precision).
15
15
 
16
16
  **Links:** [plune.ai](https://plune.ai) | [npm](https://www.npmjs.com/package/@plune-ai/cli) | [GitHub Action on Marketplace](https://github.com/marketplace/actions/plune-eval-diff)
@@ -108,12 +108,52 @@ the last resort, used only when `PLUNE_TOKEN` is set nowhere else. Nothing write
108
108
  | `contains-any` | output contains at least one of `values` |
109
109
  | `contains-all` | output contains every one of `values` |
110
110
  | `json-schema` | output validates against the JSON `schema` |
111
+ | `json-verify` | the JSON in the output matches `expected` (`mode`: `exact`, `unordered`, `contains`) |
111
112
  | `llm-judge` | an LLM grades the output against `criteria` (≥ `pass_threshold`) |
112
113
  | `semantic-similarity` | embedding similarity to `reference` ≥ `threshold` |
113
114
  | `faithfulness` | output is grounded in `context` (RAG) |
114
115
  | `answer-relevance` | output actually answers the `question` (RAG) |
115
116
  | `context-precision` | `context` is relevant to the `question` (RAG) |
116
117
 
118
+ ### A provider that fails on purpose: `stubs`
119
+
120
+ An eval with `stubs: <file>` gets its model calls answered by a local server from that file, in place of
121
+ the provider: a canned answer, or a failure (`timeout`, `reset`, `http_429`, `http_500`, `slow_stream`,
122
+ `truncated_json`), on every call or on the first N.
123
+
124
+ ```yaml
125
+ # plune.yaml: one eval
126
+ - id: refund-survives-500
127
+ stubs: stubs/refund.stubs.yaml
128
+ prompt: "Can order {{order}} be refunded?"
129
+ dataset: { examples: [{ vars: { order: 1042 } }] }
130
+ assertions:
131
+ - type: contains
132
+ value: "Refund approved"
133
+ ```
134
+
135
+ ```yaml
136
+ # stubs/refund.stubs.yaml
137
+ version: 1
138
+ stubs:
139
+ - path: /v1/messages
140
+ failure: { type: http_500, first: 2 }
141
+ response:
142
+ json:
143
+ type: message
144
+ role: assistant
145
+ content: [{ type: text, text: "Refund approved for order 1042." }]
146
+ stop_reason: end_turn
147
+ usage: { input_tokens: 12, output_tokens: 8 }
148
+ ```
149
+
150
+ The call fails twice, is retried, and the row passes on the third answer. The server lives for the run
151
+ only, every row gets the stubs fresh, the completion cache is not used, a stubbed call costs `0`, and
152
+ judge calls still go to the real provider at their price. A bad stub file is exit `2` before any model
153
+ call, and so is a `timeout` stub without `provider.timeout`. A run that holds a stubbed eval is marked,
154
+ `plune report` and `plune diff` say so, and `plune sync` refuses to upload it (exit `2`). See the
155
+ [configuration guide](docs/guide/configuration.md#stubs-a-provider-that-fails-on-purpose-stubs).
156
+
117
157
  ## Commands
118
158
 
119
159
  | Command | Summary |
@@ -122,8 +162,9 @@ the last resort, used only when `PLUNE_TOKEN` is set nowhere else. Nothing write
122
162
  | `plune report` | Re-render the most recent run. Flags: `--format` (the formats of `plune run`, `junit` included), `-o`. |
123
163
  | `plune judge-check <labels.jsonl>` | How well a model judge agrees with a person's pass/fail labels of the saved run's rows: agreement, TPR, TNR, Cohen's kappa with a 95% interval. Offline; changes nothing. Flags: `--init`, `--force`, `--run`, `--eval`, `--check`, `--min-kappa`, `--max-interval-width`. See [the CLI reference](./docs/guide/cli.md#plune-judge-check). |
124
164
  | `plune diff <baseline> <current>` | Compare two `plune run --format json` outputs and report pass→fail regressions. Flags: `--fail-on-regression` (exit `1` on a regression, `3` when none but an eval was not measured), `--format`, `-o`. |
165
+ | `plune mock <file>` | Serve a stub file on `127.0.0.1` so a product's model calls are answered locally, with no network. With `--record --target <origin>` it forwards each request to that origin and writes the answers into the file as stubs to replay later. Prompts and answers are stored as they are; credentials are masked by a few fixed rules that do not catch everything, and `plune mock --help` and the [CLI guide](docs/guide/cli.md#plune-mock) say what they miss. Flags: `--record`, `--target`, `--force`, `--scope`, `--port`. |
125
166
  | `plune init` | Scaffold `plune.yaml`, a sample dataset, and `.env.example`. Flags: `--yes` (non-interactive), `--force`, `--from-openai-eval <eval.json>` (build it from an exported OpenAI eval). |
126
- | `plune login` | Save a [Plune platform](https://plune.ai/platform) API token so `sync` and `ingest` can reach it. The token is **checked against the API before it is saved**, so a wrong one fails here rather than two commands later. Get one at `https://beta.plune.ai` → Account → API tokens. Flags: `--token <token>` (omit to paste it or pipe it via stdin), `--skip-verify` (save without checking, for offline setup). In CI, skip this step: every platform command reads `PLUNE_TOKEN` from the environment first, and the saved login only when it is not set. |
167
+ | `plune login` | Save a [Plune platform](https://plune.ai/platform) API token so `sync` and `ingest` can reach it. The token is **checked against the API before it is saved**, so a wrong one fails here rather than two commands later. Get one at `https://app.plune.ai` → Account → API tokens. Flags: `--token <token>` (omit to paste it or pipe it via stdin), `--skip-verify` (save without checking, for offline setup). In CI, skip this step: every platform command reads `PLUNE_TOKEN` from the environment first, and the saved login only when it is not set. |
127
168
  | `plune logout` | Remove the saved token. |
128
169
  | `plune mcp serve` | Serve the Plune tools to an AI agent (Claude Code, Codex, any MCP client) over **MCP stdio**. See [Plune tools for AI agents](#plune-tools-for-ai-agents-plune-mcp). Flags: `--project <id>` (default `PLUNE_PROJECT`), `--read-only` (offer only the read tools), `--disable-tool <name>` (switch one tool off; repeatable). |
129
170
  | `plune mcp check` | Check that **any** MCP server starts and answers: handshake, protocol version, capabilities, the lists, `ping`. See [Is the server alive](#is-the-server-alive-plune-mcp-check). Flags: `--check-timeout <duration>`, `--wait <duration>`, `--smoke` (with `--smoke-limit`, `--smoke-timeout`, `--budget`, `--allow-write-calls`), `--out [<format>=]<path>` (repeatable), `--reporter junit-xml`, `--format human\|json\|github\|markdown`, and the connection flags. Exit `0` healthy, `1` a check failed, `2` the server did not start, could not be reached or wants credentials, or a flag is wrong, `3` something could not be measured. |
@@ -173,7 +214,7 @@ Global flags: `-c, --config <path>` · `-v, --verbose` · `--no-color`.
173
214
  - **Policy version.** `CACHE_POLICY_VERSION` is part of the key. When it is raised, older entries stop answering, are dropped, and the run says `cache policy changed, N entries are stale` once on stderr.
174
215
  - **`--cache-strict`.** Every row must be in the cache; the model is not called for completions (judge assertions such as `llm-judge` still call it). A miss ends the run with exit code `5` and lists the rows with no entry. Not combinable with `--no-cache` (exit `2`), and neither is `--cache-max-age`. An entry with the wrong format is left in place in this mode (there is no retry).
175
216
  - **`--cache-max-age <duration>`.** `90s`, `15m`, `12h`, `7d` or milliseconds. An older entry is a miss; a fresh one is a hit.
176
- - **Summary.** The console report and the JSON (`summary.cache`) show rows `from_cache`, `from_model`, `missed` and `errored` (the provider failed; the four add up to the rows run), and the tokens and cost the cache saved (`saved`, the sum of each row's `cache_saved`).
217
+ - **Summary.** The console report and the JSON (`summary.cache`) show rows `from_cache`, `from_model`, `missed` and `errored` (the provider failed; the four add up to the rows run, rows of an eval with `stubs` aside: those are counted in `stubbed`), and the tokens and cost the cache saved (`saved`, the sum of each row's `cache_saved`).
177
218
 
178
219
  Design: `docs/features/C7-completion-cache/adr/0001-completion-cache-hardening.md`.
179
220
 
@@ -696,8 +737,9 @@ plune push --dry-run # what a push would change, before it changes anything
696
737
  ```
697
738
 
698
739
  The token is stored at `~/.config/plune/credentials.json` (mode `0600`, honours `XDG_CONFIG_HOME`)
699
- and is never printed or logged. `PLUNE_API_URL` points `sync`, `pull` and `push` at a different server —
700
- useful for a self-hosted backend. The Markdown format `pull` writes and `push` reads is documented at
740
+ and is never printed or logged. Every platform command talks to `https://api.plune.ai` unless `PLUNE_API_URL` names a different server:
741
+ a self-hosted backend, or `https://beta-api.plune.ai` for a beta account (a token works only at the
742
+ address that issued it). The Markdown format `pull` writes and `push` reads is documented at
701
743
  [docs.plune.ai/platform/cases/markdown](https://docs.plune.ai/platform/cases/markdown/).
702
744
 
703
745
  ### Plune tools for AI agents: `plune mcp`