@bachsproof/cli 1.1.0 → 2.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/README.md CHANGED
@@ -1,49 +1,28 @@
1
- # @bachsproof/cli
1
+ # `@bachsproof/cli`
2
2
 
3
- **Beyond webhook delivery. Verify financial correctness.**
3
+ The CLI is the supported BachsProof v2 entry point.
4
4
 
5
- Package-installable CLI onboarding for BachsProof, a financial correctness
6
- testing framework for applications integrating Bachs.
5
+ ```bash
6
+ pnpm add -D @bachsproof/cli
7
+ pnpm exec bachsproof init
8
+ pnpm exec bachsproof test
9
+ ```
7
10
 
8
- pnpm add -D @bachsproof/cli
9
- pnpm exec bachsproof init
10
- pnpm exec bachsproof test
11
+ `init` creates one `bachsproof.config.mjs` file. The file contains the complete
12
+ webhook URL, test signing secret, amount, currency, `createPayment()`, and
13
+ `verify()` callbacks. The CLI configures the Bachs adapter, webhook signing,
14
+ the eleven scenarios, ordinary concurrent delivery, and mandatory financial
15
+ verification automatically.
11
16
 
12
- `bachsproof init` creates a small configuration and test suite in the independent
13
- application repository:
17
+ The same config object works in Vitest, Jest, or a custom script:
14
18
 
15
- - `bachsproof.config.mjs` for the provider, webhook target, signing secret,
16
- payment preparation, verification, and polling settings;
17
- - `tests/bachsproof.test.mjs` with all 15 supported scenario definitions;
18
- - `tests/bachsproof.setup.mjs` for the optional `createPayment(context)` callback;
19
- - `tests/bachsproof.verify.mjs` for the `verify(reference, context)` callback.
19
+ ```js
20
+ import { loadConfig, runConfig, summarizeRuns } from "@bachsproof/cli";
20
21
 
21
- The generated setup and verifier templates fail until implemented. BachsProof does
22
- not invent application references or treat expected values as financial proof.
22
+ const config = await loadConfig("bachsproof.config.mjs");
23
+ const results = await runConfig(config);
24
+ console.log(summarizeRuns(results));
25
+ ```
23
26
 
24
- The target application does not need BachsProof routes, controllers, services, or
25
- production instrumentation. It only needs a reachable webhook URL. The
26
- application owns test payment preparation, isolation, cleanup, and committed
27
- state access.
28
-
29
- Real application references are the default. Use `createPayment` for fresh test
30
- records, explicit `reference` or `references` for manual fixtures, and
31
- `syntheticReferences: true` only for isolated adapter/HTTP fixture tests.
32
-
33
- The CLI runs configured scenarios sequentially. Delivery waves inside a
34
- concurrency scenario remain concurrent. `--name` runs one exact test name and
35
- `--json` emits machine-readable reports:
36
-
37
- pnpm exec bachsproof test --name "underpaid payment"
38
- pnpm exec bachsproof test --json
39
-
40
- Add `requireFinancialVerification: true` when the suite must fail unless the
41
- callback has observed committed financial state. Without a callback, BachsProof
42
- can still test HTTP delivery, but it reports the run as financially unverified.
43
-
44
- For optional controlled concurrency testing, configure a checkpoint and use
45
- `@bachsproof/sdk` in an explicitly enabled test build. Ordinary black-box HTTP
46
- concurrency is not deterministic race-condition coverage.
47
-
48
- See the repository [quickstart](../../docs/quickstart.md) and
49
- [CLI guide](../../docs/cli.md) for the complete workflow.
27
+ Financial verification is required. Configure a test-only application and
28
+ database; BachsProof never calls Bachs or moves real money.