saffron-ai 1.2.0 → 1.2.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/CHANGELOG.md +191 -1
- package/README.md +4 -4
- package/dist-pkg/cli.js +301 -302
- package/package.json +22 -7
- package/skills/saffron/references/api.md +6 -4
- package/skills/saffron/references/config.md +6 -5
- package/templates/playwright/saffron-helpers.ts +8 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saffron-ai",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "End-to-end tests written in plain language: an AI agent records each scenario once, replays run at zero tokens, and broken replays heal into proposals you review",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "vitest run",
|
|
7
7
|
"build": "tsc",
|
|
@@ -14,15 +14,30 @@
|
|
|
14
14
|
"plugin": "node scripts/build-claude-plugin.mjs"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
|
+
"e2e",
|
|
18
|
+
"e2e-testing",
|
|
19
|
+
"end-to-end-testing",
|
|
17
20
|
"testing",
|
|
18
|
-
"
|
|
19
|
-
"bdd",
|
|
21
|
+
"test-automation",
|
|
20
22
|
"playwright",
|
|
21
|
-
"ai",
|
|
23
|
+
"ai-testing",
|
|
22
24
|
"self-healing",
|
|
23
|
-
"
|
|
25
|
+
"self-healing-tests",
|
|
26
|
+
"natural-language",
|
|
27
|
+
"plain-language",
|
|
28
|
+
"bdd",
|
|
29
|
+
"gherkin",
|
|
30
|
+
"cucumber",
|
|
31
|
+
"feature-files",
|
|
32
|
+
"no-step-definitions",
|
|
33
|
+
"browser-testing",
|
|
34
|
+
"regression-testing",
|
|
35
|
+
"claude",
|
|
36
|
+
"codex",
|
|
37
|
+
"cursor",
|
|
38
|
+
"mcp"
|
|
24
39
|
],
|
|
25
|
-
"author": "",
|
|
40
|
+
"author": "Chathuranga Jayasinghe",
|
|
26
41
|
"license": "SEE LICENSE IN LICENSE",
|
|
27
42
|
"type": "module",
|
|
28
43
|
"bin": {
|
|
@@ -118,10 +118,12 @@ npx saffron trace "A missing customer answers 404" # the requests and response
|
|
|
118
118
|
- A write (`POST`, `PUT`, `PATCH`, `DELETE`) is never retried on replay:
|
|
119
119
|
a timeout fails the step instead of creating a second record. Reads are
|
|
120
120
|
retried as usual.
|
|
121
|
-
- A recording with a schema check
|
|
122
|
-
changes, or when `api.contract` names another file:
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
- A recording with a schema check is checked again when the pinned
|
|
122
|
+
contract changes, or when `api.contract` names another file: a zero-AI
|
|
123
|
+
replay of the same recording, filed for review (yellow) when it passes,
|
|
124
|
+
red when the API breaks the new contract, and no agent session either way.
|
|
125
|
+
It never passes green over a contract it was not checked against.
|
|
126
|
+
`saffron run --rerecord` records it again.
|
|
125
127
|
- `api.transcript` sets what the request transcript keeps: `"on-failure"`
|
|
126
128
|
(default), `"on"` (green scenarios too) or `"off"` (statuses and timings
|
|
127
129
|
only). The report lists each scenario's requests per step, and
|
|
@@ -69,6 +69,7 @@ your-project/
|
|
|
69
69
|
| `provider` | Whose agent records and heals, on its login on this machine: `claude` (default), `codex` (ChatGPT plan), `antigravity` (Google AI Pro/Ultra via the `agy` CLI, experimental), `cursor`. Also `--provider` |
|
|
70
70
|
| `model` | Model in the provider's own names (unset: the provider's default). A `--provider` run on another provider ignores it |
|
|
71
71
|
| `healModel` | Cheaper model for heal sessions only |
|
|
72
|
+
| `antigravityApiKey` | `true`: Antigravity signs in with `GEMINI_API_KEY` even beside an agy login (default: a login wins) |
|
|
72
73
|
| `ci` | Where `saffron runs` and `import --run` find CI runs: `{"provider": "github" \| "azure", "organization": ..., "project": ...}`. Unset, an Azure Repos remote means Azure Pipelines (through `az`), anything else GitHub Actions (through `gh`). `organization` and `project` are for a GitHub repository built by Azure Pipelines |
|
|
73
74
|
| `api` | The API under test: `{"baseURL": ..., "contract": "api/openapi.json", "transcript": "on-failure"}`. `baseURL` is where API steps' relative paths go (unset: the run's `baseURL`); `contract` is the pinned OpenAPI 3 document schema checks validate against (`saffron api pin` writes it), and a change to it, or to which file it names, makes the recordings checked against it stale; `transcript` keeps each scenario's requests and responses for the report and `saffron trace`: `"on-failure"` (default), `"on"` or `"off"` (statuses and timings only); `services` names more APIs, each `{"baseURL": ..., "contract": ...}`, which a request names instead of a host (`--api-url name=<url>` points one elsewhere for a run). See [API tests](api.md) |
|
|
74
75
|
|
|
@@ -100,11 +101,11 @@ one line (`SAFFRON_DEBUG=1` shows the stack).
|
|
|
100
101
|
|
|
101
102
|
## AI access
|
|
102
103
|
|
|
103
|
-
Recording and healing need the configured provider's login on the machine
|
|
104
|
-
Claude (default): `ANTHROPIC_API_KEY`, or a Claude Code login. Codex: a
|
|
105
|
-
ChatGPT-plan `npx @openai/codex login` plus `npm i -D "@openai/codex-sdk@>=0.158.0"`. Antigravity:
|
|
106
|
-
Google's `agy` CLI, signed in once
|
|
107
|
-
(allows Saffron's tools in agy's settings). Cursor: `npm i -D @cursor/sdk`
|
|
104
|
+
Recording and healing need the configured provider's login on the machine,
|
|
105
|
+
or its API key. Claude (default): `ANTHROPIC_API_KEY`, or a Claude Code login. Codex: a
|
|
106
|
+
ChatGPT-plan `npx @openai/codex login`, or `CODEX_API_KEY` (or `OPENAI_API_KEY`), plus `npm i -D "@openai/codex-sdk@>=0.158.0"`. Antigravity:
|
|
107
|
+
Google's `agy` CLI, signed in once or with `GEMINI_API_KEY`, then `npx saffron login antigravity`
|
|
108
|
+
(allows Saffron's tools in agy's settings). A Codex or Antigravity login wins over a key. Cursor: `npm i -D @cursor/sdk`
|
|
108
109
|
and `npx saffron login cursor`. `npx saffron login` lists what is missing.
|
|
109
110
|
Replay-only runs (`--no-agent`) need none: that is the normal CI mode once
|
|
110
111
|
caches are committed. With no `model` configured the provider's default
|
|
@@ -83,7 +83,14 @@ async function resolvesLinkLocal(hostname: string): Promise<boolean> {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/** A number or boolean a request body sends where the recording holds text with tokens (a row's "<seats>"). */
|
|
86
|
-
export function typed(text: string, type: "number" | "boolean"):
|
|
86
|
+
export function typed(text: string, type: "number" | "boolean" | "json"): unknown {
|
|
87
|
+
if (type === "json") {
|
|
88
|
+
try {
|
|
89
|
+
return JSON.parse(text);
|
|
90
|
+
} catch {
|
|
91
|
+
throw new Error("a body part must be JSON, but its value resolves to text that is not: give the column a whole JSON value");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
87
94
|
if (type === "boolean") {
|
|
88
95
|
if (text === "true" || text === "false") return text === "true";
|
|
89
96
|
throw new Error(`a body field must be true or false, but its value resolves to ${JSON.stringify(mask(text))}`);
|