@vijaypjavvadi/bdd2pw 3.10.0 → 4.0.0
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 +253 -0
- package/README.md +19 -12
- package/dist/cli.js +39 -7
- package/dist/cli.js.map +1 -1
- package/dist/data/dataLoader.d.ts +78 -0
- package/dist/data/dataLoader.js +339 -0
- package/dist/data/dataLoader.js.map +1 -0
- package/dist/data/examplesInjector.d.ts +64 -0
- package/dist/data/examplesInjector.js +149 -0
- package/dist/data/examplesInjector.js.map +1 -0
- package/dist/data/synthGenerator.d.ts +71 -0
- package/dist/data/synthGenerator.js +265 -0
- package/dist/data/synthGenerator.js.map +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/llm/anthropicClient.d.ts +11 -0
- package/dist/llm/anthropicClient.js +89 -0
- package/dist/llm/anthropicClient.js.map +1 -1
- package/dist/llm/geminiClient.d.ts +92 -0
- package/dist/llm/geminiClient.js +559 -0
- package/dist/llm/geminiClient.js.map +1 -0
- package/dist/llm/index.d.ts +2 -0
- package/dist/llm/index.js +13 -2
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/openaiClient.d.ts +83 -0
- package/dist/llm/openaiClient.js +529 -0
- package/dist/llm/openaiClient.js.map +1 -0
- package/dist/llm/telemetry.js +14 -0
- package/dist/llm/telemetry.js.map +1 -1
- package/dist/llm/types.d.ts +45 -2
- package/dist/types.d.ts +41 -1
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,259 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
_Nothing yet._
|
|
11
11
|
|
|
12
|
+
## [4.0.0] — 2026-06-25
|
|
13
|
+
|
|
14
|
+
### Theme: Data-driven scaffolds — bring your own data or generate it
|
|
15
|
+
|
|
16
|
+
v4.0 is a **major version with no breaking changes**. The number bump
|
|
17
|
+
reflects the size of the feature bundle, not the risk to existing users.
|
|
18
|
+
Scaffolds that don't use the new `--data` / `--gen-data` flags behave
|
|
19
|
+
identically to v3.12.
|
|
20
|
+
|
|
21
|
+
### Added — `--data <path>` external data file injection
|
|
22
|
+
|
|
23
|
+
Pass a CSV, JSON, or XLSX file. Every Scenario Outline in the .feature
|
|
24
|
+
file gets its Examples table swapped with rows from the data file.
|
|
25
|
+
Inline Examples in the .feature become the no-data fallback.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
bdd2pw scaffold login.feature --data data/users.csv --url ... --page LoginPage --repo .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- CSV parser is dependency-free (RFC 4180 quoted fields, embedded
|
|
32
|
+
newlines, escaped quotes, mixed CRLF/LF).
|
|
33
|
+
- JSON accepts either array of objects or `{rows: [...]}` envelope.
|
|
34
|
+
- XLSX lazy-loads via the optional `xlsx` dep; clear `npm install xlsx`
|
|
35
|
+
hint if missing.
|
|
36
|
+
- Per-scenario column filtering — extra data columns are dropped per
|
|
37
|
+
scenario, so a single 50-column data file can feed many narrow
|
|
38
|
+
scenarios without each one pulling in noise.
|
|
39
|
+
- Scenarios whose placeholders reference columns NOT present in the
|
|
40
|
+
data are skipped with a warning in BDD_REVIEW.md (inline Examples
|
|
41
|
+
preserved).
|
|
42
|
+
|
|
43
|
+
### Added — `--gen-data` synthetic data generator
|
|
44
|
+
|
|
45
|
+
For when you need plausible test data but don't have a real dataset.
|
|
46
|
+
Pass a schema JSON listing each column's source:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"email": "faker.internet.email",
|
|
51
|
+
"password": "faker.internet.password",
|
|
52
|
+
"url_fragment": "inventory.html",
|
|
53
|
+
"description": "llm:auto insurance claim, one sentence"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
bdd2pw scaffold login.feature --gen-data --schema users.schema.json --rows 50 --url ... --page LoginPage --repo .
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- `faker.X.Y` paths resolve via `@faker-js/faker` (optional dep).
|
|
62
|
+
- `llm:<prompt>` routes through the configured LLM provider (Anthropic,
|
|
63
|
+
OpenAI, or Gemini) for context-aware domain-specific data.
|
|
64
|
+
- Literal strings repeat the same value in every row.
|
|
65
|
+
- Seeded by default (seed=42) so output is reproducible across runs.
|
|
66
|
+
Override with `--seed N`.
|
|
67
|
+
- Per-column LLM batching — one provider call per LLM-driven column
|
|
68
|
+
regardless of row count. 3 LLM fields × 50 rows = 3 calls.
|
|
69
|
+
|
|
70
|
+
### Added — `LLMClient.generateText()` API
|
|
71
|
+
|
|
72
|
+
Generic single-prompt text generation method on all three providers
|
|
73
|
+
(Anthropic, OpenAI, Gemini). Routes through the same governance
|
|
74
|
+
sanitisation, budget enforcement, timeout, and telemetry pipeline as
|
|
75
|
+
binding generation. Used by the synth data generator; available for
|
|
76
|
+
any custom downstream tooling that needs a clean LLM call.
|
|
77
|
+
|
|
78
|
+
### CLI
|
|
79
|
+
|
|
80
|
+
- `--data <path>` — load external data file
|
|
81
|
+
- `--gen-data` — enable synthetic generation
|
|
82
|
+
- `--schema <path>` — schema JSON for `--gen-data`
|
|
83
|
+
- `--rows <n>` — row count for `--gen-data` (default 20)
|
|
84
|
+
- `--seed <n>` — Faker seed (default 42)
|
|
85
|
+
|
|
86
|
+
Precedence: `--data` wins if both are passed; warning printed to stderr.
|
|
87
|
+
|
|
88
|
+
### Programmatic API
|
|
89
|
+
|
|
90
|
+
`ScaffoldOptions.dataSource: {type: "file"|"synthetic", path?, schemaPath?, rows?, seed?}`
|
|
91
|
+
- Failures fall back to inline Examples and surface as ReviewItems.
|
|
92
|
+
- Same graceful-degradation pattern as the v2.0 LLM fallback failure mode.
|
|
93
|
+
|
|
94
|
+
### New `optionalDependencies`
|
|
95
|
+
|
|
96
|
+
- `@faker-js/faker ^9.3.0` — synthetic data generation
|
|
97
|
+
- `xlsx ^0.18.5` — XLSX data file loading
|
|
98
|
+
|
|
99
|
+
Same defensive `require()` loading pattern as existing optional deps.
|
|
100
|
+
Users who only use Anthropic + CSV need neither.
|
|
101
|
+
|
|
102
|
+
### Tests
|
|
103
|
+
|
|
104
|
+
`tests/unit/v400Data.test.ts` — 28 cases across DataLoader (CSV/JSON
|
|
105
|
+
parsing, file routing, validation), SynthGenerator (literal/Faker/LLM
|
|
106
|
+
fields, error cases), and ExamplesInjector (extract placeholders,
|
|
107
|
+
swap, skip vanilla, missing-column warning, per-scenario filtering,
|
|
108
|
+
zero-row graceful handling).
|
|
109
|
+
|
|
110
|
+
## [3.12.0] — 2026-06-19
|
|
111
|
+
|
|
112
|
+
> Note: v3.11.0 was tagged in git but never published to npm. v3.12.0
|
|
113
|
+
> on npm is the first release that includes BOTH the v3.11.0 OpenAI
|
|
114
|
+
> provider AND the v3.12.0 Gemini provider. Anyone who installs
|
|
115
|
+
> `@vijaypjavvadi/bdd2pw@latest` after this release gets all three
|
|
116
|
+
> providers (Anthropic, OpenAI, Gemini) with full parity in one go.
|
|
117
|
+
|
|
118
|
+
### Added — Gemini provider, three-provider parity is complete
|
|
119
|
+
|
|
120
|
+
`LLMClientOptions.provider` now accepts `"gemini"` alongside
|
|
121
|
+
`"anthropic"` and `"openai"`. `createLLMClient` factory routes
|
|
122
|
+
`"gemini"` to a new `GeminiLLMClient` that matches the surface
|
|
123
|
+
area of the other two:
|
|
124
|
+
|
|
125
|
+
- Single-step `generateBinding(input)`
|
|
126
|
+
- Batched `generateBatchBindings(inputs[])` — same per-step cache
|
|
127
|
+
lookup + one batched prompt as the v3.5.0 Anthropic batching
|
|
128
|
+
- Cache hit accounting (`callsMade`, `callsAttempted`,
|
|
129
|
+
`cacheBackendPersistent`, `cacheBackendFallbackReason`)
|
|
130
|
+
- Budget enforcement via `maxCalls`
|
|
131
|
+
- Governance sanitisation through the same sidecar (fail-closed
|
|
132
|
+
if the sidecar is unreachable — identical to Anthropic/OpenAI)
|
|
133
|
+
- Provider timeout enforcement — Gemini's SDK has no native
|
|
134
|
+
timeout option, so we wrap the call in a `Promise.race` against
|
|
135
|
+
`setTimeout`; surfaces a clear `Gemini call exceeded Xms timeout`
|
|
136
|
+
error in logs and the result `error` field
|
|
137
|
+
- LLMLogEvent stream that feeds the v3.9.0 telemetry sidecar
|
|
138
|
+
|
|
139
|
+
### Default model: `gemini-2.5-flash`
|
|
140
|
+
|
|
141
|
+
For bdd2pw's structured-JSON task, Flash is the price/perf sweet
|
|
142
|
+
spot. Pricing snapshot: $0.10 per million input tokens, $0.40 per
|
|
143
|
+
million output. That is the cheapest model across all three
|
|
144
|
+
providers — cheaper than `gpt-4o-mini` ($0.15) and dramatically
|
|
145
|
+
cheaper than `claude-sonnet-4-6` ($3.00). Override via
|
|
146
|
+
`LLMClientOptions.model` or `--llm-model`.
|
|
147
|
+
|
|
148
|
+
### Pricing rows added to `DEFAULT_PRICING`
|
|
149
|
+
|
|
150
|
+
`telemetry.ts` now includes pricing snapshots for: `gemini-2.5-flash`,
|
|
151
|
+
`gemini-2.5-pro`, `gemini-2.0-flash`, `gemini-1.5-flash`,
|
|
152
|
+
`gemini-1.5-pro`. v3.9.0 `llm-stats.json` cost estimates work
|
|
153
|
+
end-to-end for Gemini runs.
|
|
154
|
+
|
|
155
|
+
### CLI
|
|
156
|
+
|
|
157
|
+
`bdd2pw scaffold ... --llm gemini` now works. `--llm-model` help
|
|
158
|
+
text updated to list all three provider defaults.
|
|
159
|
+
|
|
160
|
+
### Auth env vars
|
|
161
|
+
|
|
162
|
+
Reads `GEMINI_API_KEY` first, then falls back to `GOOGLE_API_KEY`
|
|
163
|
+
(both are widely used in the Google AI Studio + Vertex ecosystem).
|
|
164
|
+
|
|
165
|
+
### `optionalDependencies`
|
|
166
|
+
|
|
167
|
+
`@google/generative-ai ^0.21.0` added alongside `@anthropic-ai/sdk`
|
|
168
|
+
and `openai`. Same defensive `require()` loading pattern — teams
|
|
169
|
+
that only use Anthropic do not need to install the Gemini SDK,
|
|
170
|
+
and vice versa. Missing-package error message points to
|
|
171
|
+
`npm install @google/generative-ai`.
|
|
172
|
+
|
|
173
|
+
### Cache compat
|
|
174
|
+
|
|
175
|
+
Cache keys include the model name (since v2.0), so a scaffold
|
|
176
|
+
cached under `claude-sonnet-4-6` does NOT hit the cache when re-run
|
|
177
|
+
under `gemini-2.5-flash` — you get a fresh provider call. Within
|
|
178
|
+
the same model, cache hits work identically regardless of how many
|
|
179
|
+
times you switch providers across scaffold runs.
|
|
180
|
+
|
|
181
|
+
### Tests
|
|
182
|
+
|
|
183
|
+
`tests/unit/v3120Gemini.test.ts`:
|
|
184
|
+
- Default model + DEFAULT_PRICING lookup.
|
|
185
|
+
- generateBinding succeeds with a well-formed JSON response.
|
|
186
|
+
- generateBatchBindings produces N bindings from ONE provider call
|
|
187
|
+
(cache misses → single batched prompt → JSON array → N bindings).
|
|
188
|
+
- Budget exhaustion returns an error without making a provider call.
|
|
189
|
+
- Missing API key short-circuits before the SDK loads.
|
|
190
|
+
- Malformed JSON response surfaces a parse error.
|
|
191
|
+
- Provider timeout aborts a hung call (Promise.race against
|
|
192
|
+
setTimeout works as designed).
|
|
193
|
+
|
|
194
|
+
## [3.11.0] — 2026-06-08
|
|
195
|
+
|
|
196
|
+
### Added — OpenAI provider parity
|
|
197
|
+
|
|
198
|
+
`LLMClientOptions.provider` now accepts `"openai"` alongside
|
|
199
|
+
`"anthropic"`. The factory wires up `OpenAILLMClient` which matches
|
|
200
|
+
the Anthropic client's surface area completely:
|
|
201
|
+
|
|
202
|
+
- Single-step `generateBinding(input)`
|
|
203
|
+
- Batched `generateBatchBindings(inputs[])` — same per-step cache
|
|
204
|
+
lookup + one batched prompt as v3.5.0 batching
|
|
205
|
+
- Cache hit accounting (`callsMade`, `callsAttempted`,
|
|
206
|
+
`cacheBackendPersistent`, `cacheBackendFallbackReason`)
|
|
207
|
+
- Budget enforcement via `maxCalls`
|
|
208
|
+
- Governance sanitisation through the same sidecar
|
|
209
|
+
- Step deadlines + provider timeouts
|
|
210
|
+
- LLMLogEvent stream that feeds the v3.9.0 telemetry sidecar
|
|
211
|
+
|
|
212
|
+
What differs is purely the SDK call shape — OpenAI's
|
|
213
|
+
`chat.completions.create()` instead of Anthropic's `messages.create()`,
|
|
214
|
+
and the response unpacking (`choices[0].message.content` vs
|
|
215
|
+
`content[0].text`, `usage.prompt_tokens` vs `usage.input_tokens`).
|
|
216
|
+
|
|
217
|
+
### Default model: `gpt-4o-mini`
|
|
218
|
+
|
|
219
|
+
bdd2pw's task is structured JSON output over regex-shaped
|
|
220
|
+
deterministic patterns. Mini handles it reliably and runs ~17x
|
|
221
|
+
cheaper than gpt-4o ($0.15 vs $2.50 per million input tokens).
|
|
222
|
+
Override via `LLMClientOptions.model` or `--llm-model`.
|
|
223
|
+
|
|
224
|
+
### Pricing rows added to `DEFAULT_PRICING`
|
|
225
|
+
|
|
226
|
+
`telemetry.ts` now includes pricing snapshots for: `gpt-4o`,
|
|
227
|
+
`gpt-4o-mini`, `gpt-4-turbo`, `o1`, `o1-mini`, `o1-preview`. v3.9.0
|
|
228
|
+
`llm-stats.json` cost estimates work end-to-end for OpenAI runs.
|
|
229
|
+
Prices are Q4 2025 published rates; override via
|
|
230
|
+
`new LLMTelemetry(scaffoldId, version, pricingOverride)` if you
|
|
231
|
+
have negotiated rates.
|
|
232
|
+
|
|
233
|
+
### CLI
|
|
234
|
+
|
|
235
|
+
`bdd2pw scaffold ... --llm openai` now works. The `--llm-model`
|
|
236
|
+
help text updated to reflect both providers' defaults.
|
|
237
|
+
|
|
238
|
+
### `optionalDependencies`
|
|
239
|
+
|
|
240
|
+
`openai ^4.77.0` added alongside `@anthropic-ai/sdk`. Like the
|
|
241
|
+
Anthropic SDK, it's loaded defensively via `require()` so users who
|
|
242
|
+
only want Anthropic don't need to install the OpenAI SDK and vice
|
|
243
|
+
versa. Missing-package error message points to `npm install openai`.
|
|
244
|
+
|
|
245
|
+
### Cache compat
|
|
246
|
+
|
|
247
|
+
Cache keys include the model name (since v2.0), so a scaffold
|
|
248
|
+
cached under `claude-sonnet-4-6` will NOT hit the cache when run
|
|
249
|
+
under `gpt-4o-mini` — you get a fresh provider call. Within the
|
|
250
|
+
same model, cache hits work identically regardless of how many
|
|
251
|
+
times you switch providers across scaffold runs.
|
|
252
|
+
|
|
253
|
+
### Tests
|
|
254
|
+
|
|
255
|
+
`tests/unit/v3110OpenAI.test.ts`:
|
|
256
|
+
- Default model + DEFAULT_PRICING lookup.
|
|
257
|
+
- generateBinding succeeds with a well-formed JSON response.
|
|
258
|
+
- generateBatchBindings produces N bindings from ONE provider
|
|
259
|
+
call (cache misses → single batched prompt → JSON array → N
|
|
260
|
+
bindings).
|
|
261
|
+
- Budget exhaustion returns an error without making a provider call.
|
|
262
|
+
- Missing API key short-circuits before the SDK loads.
|
|
263
|
+
- Malformed JSON response surfaces a parse error.
|
|
264
|
+
|
|
12
265
|
## [3.10.0] — 2026-06-06
|
|
13
266
|
|
|
14
267
|
### Added — self-healing stats sidecar + `bdd2pw heal-stats` CLI
|
package/README.md
CHANGED
|
@@ -42,9 +42,15 @@ Point it at a `.feature` file and a URL. It parses the Gherkin, scans the live p
|
|
|
42
42
|
|
|
43
43
|
> **The pitch.** Run `bdd2pw scaffold` and you get a Playwright TS repo where `npx playwright test` runs against the real site. For specific fixtures, all green. For vague ones, the 60-90% you'd otherwise hand-write is done; you finish the rest — or you let the governed LLM finish them.
|
|
44
44
|
|
|
45
|
-
## What's new in
|
|
46
|
-
|
|
47
|
-
- **NEW**
|
|
45
|
+
## What's new in v4.0.0
|
|
46
|
+
|
|
47
|
+
- **NEW** `--data <path>` — load CSV / JSON / XLSX file and inject rows into every Scenario Outline's Examples table. Drop in a 500-row dataset without touching the .feature file.
|
|
48
|
+
- **NEW** `--gen-data --schema <path> --rows N` — generate synthetic Examples rows. Schema picks per-column source: `faker.internet.email` for common fields, `llm:auto insurance claim description` for context-aware domain data. Seeded for reproducibility (`--seed 42`).
|
|
49
|
+
- **NEW** `LLMClient.generateText()` — generic single-prompt API on all three providers (Anthropic, OpenAI, Gemini). Same governance + budget + timeout + telemetry pipeline as binding generation.
|
|
50
|
+
- Gemini provider — three-provider parity complete. `--llm gemini` defaults to `gemini-2.5-flash` ($0.10/M input — cheapest across all three providers). (v3.12.0)
|
|
51
|
+
- OpenAI provider with full parity. `--llm openai` defaults to `gpt-4o-mini`. (v3.11.0)
|
|
52
|
+
- `bdd2pw heal-stats <repo>` CLI reads `<repo>/artefacts/heal-events.jsonl` and writes a heal-stats.json sidecar with heal rate, top failing fields, retry latency, candidate-selector promotions (v3.10.0).
|
|
53
|
+
- `llmStats: true` writes `<repo>/artefacts/llm-stats.json` with per-call latency, token counts, cache hit rate, and an estimated cost in USD (v3.9.0).
|
|
48
54
|
- Seven domain rule packs (banking, healthcare, insurance, retail, gov, education, telecom) — ~140 industry-specific patterns total.
|
|
49
55
|
- Per-scenario LLM batching cuts Anthropic spend by ~75% on unmatched-heavy scaffolds.
|
|
50
56
|
- `bdd2pw propose-rules` CLI clusters past LLM bindings into draft regex proposals — turning the offline-review pipeline into one command.
|
|
@@ -348,23 +354,24 @@ output/
|
|
|
348
354
|
| v3.6 | Diagnostics + auto-rules | Rule-trace block in `BDD_REVIEW.md`; new `bdd2pw propose-rules` CLI clustering candidate-rules.jsonl into draft regex |
|
|
349
355
|
| v3.7.1 | Regression fixes | PascalCase className shadow fix; `test.step` wrapping regression-asserted |
|
|
350
356
|
| v3.8.1 | More domain packs | Retail / gov / education / telecom packs added — seven total (~140 industry-specific rules) |
|
|
351
|
-
|
|
|
357
|
+
| v3.9.0 | Telemetry | `artefacts/llm-stats.json` sidecar — per-call latency + tokens + cache hit rate + estimated cost. Makes v3.5 batching ROI measurable per scaffold. |
|
|
358
|
+
| v3.10.0 | Heal stats | `bdd2pw heal-stats <repo>` CLI consumes `artefacts/heal-events.jsonl` and writes `heal-stats.json` with heal rate, top failing fields, top error patterns, retry latency, candidate-selector promotions. Self-healing ROI per test run. |
|
|
359
|
+
| v3.11.0 | OpenAI provider | `LLMClientOptions.provider: "openai"` lands with cache + governance + batching + telemetry parity. Default model `gpt-4o-mini` (~17x cheaper than `gpt-4o` for structured-JSON tasks). |
|
|
360
|
+
| v3.12.0 | Gemini provider | `LLMClientOptions.provider: "gemini"` lands with full parity. Default model `gemini-2.5-flash` ($0.10/M input — cheapest across all three providers). Three-provider parity complete. |
|
|
361
|
+
| **v4.0.0 (current)** | Data-driven scaffolds | `--data <path>` (CSV/JSON/XLSX) and `--gen-data --schema <path>` (Faker + LLM) inject Examples rows into Scenario Outlines. `LLMClient.generateText()` added to all three providers. **Additive only — no breaking changes.** |
|
|
352
362
|
|
|
353
363
|
### Next 6 months (Jun 2026 → Nov 2026, ~2 releases/month)
|
|
354
364
|
|
|
355
365
|
| Target | Version | Theme | Headline |
|
|
356
366
|
|---|---|---|---|
|
|
357
|
-
|
|
|
358
|
-
|
|
|
359
|
-
|
|
|
360
|
-
| Aug 2026 | **v4.0.0** | Modern defaults | Semver-major reset: bump Anthropic default model, retire v2.x deprecated APIs, switch test-signature defaults to current best practice. Migration guide ships alongside. |
|
|
361
|
-
| Aug 2026 | **v4.1.0** | sel2pw merge | sel2pw migrated onto `@vijaypjavvadi/pw-emit` — three packages share one emitter. All future v3.x emitter improvements automatically flow to Selenium users. |
|
|
367
|
+
| Aug 2026 | **v3.13.0** | Auto-rules | `bdd2pw apply-proposals --interactive` — walks the human through each v3.6 proposal, validates the regex compiles + matches the sample texts, optionally appends to `stepMatcher.ts`. Closes the propose-rules loop. |
|
|
368
|
+
| Aug 2026 | **v4.1.0** | Modern defaults | Bump default models, retire v2.x deprecated APIs, flip opt-in defaults (domains, llm-stats, healing) to opt-out. Migration guide ships alongside. |
|
|
369
|
+
| Sep 2026 | **v4.1.0** | sel2pw merge | sel2pw migrated onto `@vijaypjavvadi/pw-emit` — three packages share one emitter. All future v3.x emitter improvements automatically flow to Selenium users. |
|
|
362
370
|
| Sep 2026 | **v4.2.0** | Domain packs | Three more opt-in packs: **fintech** (KYC, AML, trading desks), **real-estate** (MLS, listings, escrow), **hospitality** (PMS, reservations, OTA). ~60 more rules. |
|
|
363
|
-
|
|
|
371
|
+
| Oct 2026 | **v4.3.0** | API v2 | WebSocket assertion rules, multipart file-upload patterns, GraphQL query / mutation / subscription rules. Extends v3.0's API testing surface. |
|
|
364
372
|
| Oct 2026 | **v4.4.0** | Coverage analyzer | `bdd2pw coverage` CLI: which deterministic rules fired on which features across a fleet, per-pack hit rate, dead-rule report, suggestion to retire unused rules. |
|
|
365
|
-
|
|
|
373
|
+
| Nov 2026 | **v4.5.0** | CI/CD templates | Optional scaffolder output: GitHub Actions / GitLab CI / Azure Pipelines / CircleCI starter workflows wired to run the generated specs. Opt-in via `--ci <provider>`. |
|
|
366
374
|
| Nov 2026 | **v4.6.0** | Mobile dialect | Touch / swipe / scroll-into-view rules + responsive viewport assertions. Reuses the same emitter pipeline; opt-in via `domains: ["mobile"]`. |
|
|
367
|
-
| Nov 2026 | **v4.7.0** | i18n Gherkin | Accept Cucumber-compatible non-English keywords (Spanish, German, French, Portuguese, Japanese, …). Lets bdd2pw scaffold from `.feature` files written in any of the ~70 languages Cucumber supports. |
|
|
368
375
|
|
|
369
376
|
Each release is shaped to be self-contained, ship in ~2 weeks, and keep `domains: []` byte-stable for existing users so the upgrade path stays painless.
|
|
370
377
|
|
package/dist/cli.js
CHANGED
|
@@ -61,9 +61,9 @@ program
|
|
|
61
61
|
.option("--headed", "Show browser during MCP scan", false)
|
|
62
62
|
.option("--snapshot-file <path>", "Read elements from a JSON file instead of launching a browser")
|
|
63
63
|
.option("--no-discovery", "Skip page discovery entirely (rule-only probing). Field-referencing rules will fall to TODO.")
|
|
64
|
-
.option("--llm <provider>", "Enable LLM fallback for unmatched steps.
|
|
64
|
+
.option("--llm <provider>", "Enable LLM fallback for unmatched steps. v3.12.0: 'anthropic', 'openai', or 'gemini'.")
|
|
65
65
|
.option("--governance-url <url>", "ai-governance sidecar URL — every prompt is sanitised here before leaving the perimeter (fail-closed).", "http://localhost:4900")
|
|
66
|
-
.option("--llm-model <model>", "Override the LLM model
|
|
66
|
+
.option("--llm-model <model>", "Override the LLM model. Defaults: anthropic→claude-sonnet-4-6, openai→gpt-4o-mini, gemini→gemini-2.5-flash.")
|
|
67
67
|
.option("--llm-max-calls <n>", "Max LLM provider calls per scaffold. Default 50. Cache hits don't count.", "50")
|
|
68
68
|
.option("--llm-cache <path>", "SQLite cache path. Default <repo>/.bdd2pw/llm-cache.sqlite. Use ':memory:' for one-shot.")
|
|
69
69
|
.option("--llm-skip-governance", "DO NOT USE in production — bypass the sidecar sanitisation step. Test-only escape hatch.", false)
|
|
@@ -77,14 +77,23 @@ program
|
|
|
77
77
|
.option("--force", "Overwrite existing spec files", false)
|
|
78
78
|
.option("--self-healing", "Wrap emitted locators in healOrThrow() and generate lib/heal.ts + tsconfig path alias. Locator events are logged to artefacts/heal-events.jsonl for the offline self-heal pipeline. Action-time healing is v1.2.", false)
|
|
79
79
|
.option("--llm-stats", "v3.9.0 — write <repo>/artefacts/llm-stats.json with per-call latency, token counts, cache hit rate, and estimated cost.", false)
|
|
80
|
+
// v4.0.0 — data-driven Examples injection.
|
|
81
|
+
.option("--data <path>", "v4.0.0 — load CSV / JSON / XLSX file and inject rows into every Scenario Outline's Examples table. Inline Examples are overridden when this is set. Failures fall back to inline Examples + warn in BDD_REVIEW.md.")
|
|
82
|
+
.option("--gen-data", "v4.0.0 — generate synthetic Examples rows via Faker + LLM. Requires --schema. Combine with --rows to set row count.", false)
|
|
83
|
+
.option("--schema <path>", "v4.0.0 — JSON schema for --gen-data. Object of {column: source} where source is 'faker.X.Y', 'llm:<prompt>', or a literal string.")
|
|
84
|
+
.option("--rows <n>", "v4.0.0 — row count for --gen-data. Default 20.", "20")
|
|
85
|
+
.option("--seed <n>", "v4.0.0 — Faker RNG seed for --gen-data reproducibility. Default 42.", "42")
|
|
80
86
|
.action(async (feature, opts) => {
|
|
81
87
|
try {
|
|
82
88
|
// v2.0 — wire the actual LLM config when --llm is passed. The legacy
|
|
83
89
|
// top-level `llm` field stays for backwards compat; `llmConfig` is the
|
|
84
|
-
// real one used by scaffold().
|
|
85
|
-
const
|
|
86
|
-
?
|
|
87
|
-
|
|
90
|
+
// real one used by scaffold(). v3.11.0 — accept openai too.
|
|
91
|
+
const llmProvider = opts.llm === "anthropic" || opts.llm === "openai" || opts.llm === "gemini"
|
|
92
|
+
? opts.llm
|
|
93
|
+
: null;
|
|
94
|
+
const llmConfig = llmProvider
|
|
95
|
+
? ({
|
|
96
|
+
provider: llmProvider,
|
|
88
97
|
model: opts.llmModel,
|
|
89
98
|
governanceUrl: opts.governanceUrl,
|
|
90
99
|
maxCalls: opts.llmMaxCalls
|
|
@@ -102,8 +111,16 @@ program
|
|
|
102
111
|
governanceTimeoutMs: opts.llmGovernanceTimeoutMs
|
|
103
112
|
? Number(opts.llmGovernanceTimeoutMs)
|
|
104
113
|
: undefined,
|
|
105
|
-
}
|
|
114
|
+
})
|
|
106
115
|
: undefined;
|
|
116
|
+
// v4.0.0 — warn if user passed both data sources. --data wins.
|
|
117
|
+
if (opts.data && opts.genData) {
|
|
118
|
+
console.warn("[bdd2pw] both --data and --gen-data passed; --data wins. --gen-data ignored.");
|
|
119
|
+
}
|
|
120
|
+
// v4.0.0 — warn if --gen-data without --schema.
|
|
121
|
+
if (opts.genData && !opts.schema) {
|
|
122
|
+
console.warn("[bdd2pw] --gen-data requires --schema <path>. Ignoring --gen-data.");
|
|
123
|
+
}
|
|
107
124
|
const result = await (0, index_1.scaffold)({
|
|
108
125
|
feature: path.resolve(feature),
|
|
109
126
|
url: opts.url,
|
|
@@ -126,6 +143,21 @@ program
|
|
|
126
143
|
selfHealing: opts.selfHealing,
|
|
127
144
|
// v3.9.0 — telemetry sidecar
|
|
128
145
|
llmStats: opts.llmStats === true,
|
|
146
|
+
// v4.0.0 — data-driven Examples injection. --data wins over
|
|
147
|
+
// --gen-data when both are passed (and we warn in stderr so the
|
|
148
|
+
// user sees what happened).
|
|
149
|
+
dataSource: opts.data
|
|
150
|
+
? { type: "file", path: path.resolve(opts.data) }
|
|
151
|
+
: opts.genData
|
|
152
|
+
? {
|
|
153
|
+
type: "synthetic",
|
|
154
|
+
schemaPath: opts.schema
|
|
155
|
+
? path.resolve(opts.schema)
|
|
156
|
+
: undefined,
|
|
157
|
+
rows: opts.rows ? Number(opts.rows) : undefined,
|
|
158
|
+
seed: opts.seed ? Number(opts.seed) : undefined,
|
|
159
|
+
}
|
|
160
|
+
: undefined,
|
|
129
161
|
});
|
|
130
162
|
logger_1.logger.info({ result }, "scaffold complete");
|
|
131
163
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,2CAA6B;AAC7B,mCAAuD;AACvD,+BAAqC;AACrC,mDAAuD;AACvD,2CAAwC;AAExC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CACV,4EAA4E,CAC7E;KACA,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC;AAE/C,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CACV,iFAAiF,CAClF;KACA,QAAQ,CAAC,WAAW,EAAE,iCAAiC,CAAC;KACxD,cAAc,CAAC,aAAa,EAAE,4BAA4B,CAAC;KAC3D,cAAc,CAAC,eAAe,EAAE,qCAAqC,CAAC;KACtE,cAAc,CAAC,cAAc,EAAE,gDAAgD,CAAC;KAChF,MAAM,CAAC,gBAAgB,EAAE,sDAAsD,CAAC;KAChF,MAAM,CAAC,wBAAwB,EAAE,sCAAsC,CAAC;KACxE,MAAM,CAAC,UAAU,EAAE,8BAA8B,EAAE,KAAK,CAAC;KACzD,MAAM,CAAC,w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CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC7C,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v4.0.0 — DataLoader.
|
|
3
|
+
*
|
|
4
|
+
* Reads CSV / JSON / XLSX into a normalized `DataRow[]` for injection
|
|
5
|
+
* into Scenario Outline Examples tables.
|
|
6
|
+
*
|
|
7
|
+
* Normalization contract:
|
|
8
|
+
* - All values are coerced to strings (Gherkin Examples tables are
|
|
9
|
+
* always string-typed; the test code does the parsing).
|
|
10
|
+
* - Headers are trimmed; empty headers are rejected up-front so the
|
|
11
|
+
* placeholder-to-column matching downstream is deterministic.
|
|
12
|
+
* - Empty rows (all-blank cells) are dropped silently — they're
|
|
13
|
+
* a frequent artifact of hand-edited CSVs.
|
|
14
|
+
*
|
|
15
|
+
* Format detection is by file extension. .xlsx loading is lazy via
|
|
16
|
+
* the `xlsx` optional dep — if missing, the user gets a clear
|
|
17
|
+
* `npm install xlsx` error instead of a module-resolution crash.
|
|
18
|
+
*
|
|
19
|
+
* Error model: every loader function throws `DataLoaderError` with
|
|
20
|
+
* a human-readable message. The orchestrator in `scaffold()` catches
|
|
21
|
+
* this and surfaces it as a `ReviewItem` so the failure shows up in
|
|
22
|
+
* BDD_REVIEW.md alongside other diagnostics — not just on stderr.
|
|
23
|
+
*/
|
|
24
|
+
/** One row of data. All values are strings (Gherkin convention). */
|
|
25
|
+
export type DataRow = Record<string, string>;
|
|
26
|
+
export declare class DataLoaderError extends Error {
|
|
27
|
+
readonly file?: string | undefined;
|
|
28
|
+
constructor(message: string, file?: string | undefined);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Entry point. Routes by extension to the right parser.
|
|
32
|
+
*
|
|
33
|
+
* @param filePath Absolute or relative path to a .csv / .json / .xlsx file.
|
|
34
|
+
* @returns Array of rows, each a string-keyed dict.
|
|
35
|
+
* @throws DataLoaderError on any read / parse / shape error.
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadDataFile(filePath: string): DataRow[];
|
|
38
|
+
/**
|
|
39
|
+
* CSV parser — RFC 4180 compliant for the practical subset:
|
|
40
|
+
* - Quoted fields with embedded commas
|
|
41
|
+
* - Quoted fields with embedded newlines
|
|
42
|
+
* - Escaped quotes (`""` inside a quoted field)
|
|
43
|
+
* - Mixed CRLF / LF line endings
|
|
44
|
+
*
|
|
45
|
+
* Does NOT delegate to papaparse — keeping this dependency-free since
|
|
46
|
+
* the format is small enough to handle inline and we want bdd2pw to
|
|
47
|
+
* scaffold without an `npm install` step on the user's machine.
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseCsv(text: string, fileLabel?: string): DataRow[];
|
|
50
|
+
/**
|
|
51
|
+
* JSON parser — accepts either:
|
|
52
|
+
* 1. Array of objects: `[{a:1,b:2}, {a:3,b:4}]` — most natural shape.
|
|
53
|
+
* 2. Object with `rows`: `{rows: [{...}, {...}]}` — useful for files
|
|
54
|
+
* that also carry metadata (generator seed, source URL, etc).
|
|
55
|
+
*
|
|
56
|
+
* Numbers and booleans are stringified for Gherkin Examples compatibility.
|
|
57
|
+
* Null values become empty strings.
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseJson(text: string, fileLabel?: string): DataRow[];
|
|
60
|
+
/**
|
|
61
|
+
* XLSX parser — uses the optional `xlsx` dep. Reads the FIRST sheet
|
|
62
|
+
* only; users with multi-sheet workbooks should export the sheet they
|
|
63
|
+
* want to CSV.
|
|
64
|
+
*
|
|
65
|
+
* Lazy-loaded so users who never use XLSX don't need the dep installed.
|
|
66
|
+
*/
|
|
67
|
+
export declare function parseXlsx(absPath: string, fileLabel?: string): DataRow[];
|
|
68
|
+
/**
|
|
69
|
+
* Validates that the loaded data rows have every column the Scenario
|
|
70
|
+
* Outline placeholders reference. Returns the list of missing column
|
|
71
|
+
* names; empty array means OK.
|
|
72
|
+
*
|
|
73
|
+
* Called by the scaffold orchestrator after parsing the .feature file.
|
|
74
|
+
* If anything is missing, the orchestrator surfaces it as a
|
|
75
|
+
* `ReviewItem` and skips Examples injection for that scenario rather
|
|
76
|
+
* than producing a broken spec.
|
|
77
|
+
*/
|
|
78
|
+
export declare function validateColumnsForPlaceholders(rows: DataRow[], placeholders: string[]): string[];
|