rpc-bastion 0.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bastion contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # rpc-bastion
2
+
3
+ The `bastion` diagnostics CLI — inspect endpoints, watch transactions, and run
4
+ chaos scenarios, all on the same resilient pool/sender the SDK uses.
5
+
6
+ > Not yet published to npm (the package name is pending). Build it from the repo
7
+ > and run the bin directly:
8
+
9
+ ```bash
10
+ npm install && npm run build # from the repo root
11
+ node packages/cli/dist/bin.cjs <command> # e.g. doctor --json
12
+ # (after publication this becomes `npx bastion <command>`)
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ | Command | What it does |
18
+ |---|---|
19
+ | `bastion doctor --endpoints <urls\|--config file> [--probes N] [--json]` | One-shot diagnostics per endpoint: p50 latency, `getHealth`, slot vs cluster max, version. Pretty table or `--json`. |
20
+ | `bastion monitor --endpoints <urls\|--config file> [--interval ms]` | Live endpoint health table (status dot, latency sparkline, error rate, slot lag, breaker) refreshing on an interval. |
21
+ | `bastion watch-tx <signature> --endpoints <urls>` | Watch a transaction to a terminal state (confirmed / failed / expired), reusing the confirmation engine. |
22
+ | `bastion simulate --scenario <name> \| --list` | Run a built-in testkit chaos scenario against a local mock pool and render it live. |
23
+
24
+ Config file (`bastion.config.json`): `{ "endpoints": ["..."], "jito": { "region": "..." } }`.
25
+
26
+ ## Examples
27
+
28
+ ```bash
29
+ bastion doctor --endpoints https://api.devnet.solana.com --json
30
+ bastion simulate --list
31
+ bastion simulate --scenario flaky-endpoint
32
+ bastion monitor --config bastion.config.json --interval 1000
33
+ ```
34
+
35
+ ## Architecture (why it's testable)
36
+
37
+ All **data-fetching and aggregation** lives in pure functions under
38
+ [`src/data/`](./src/data) — endpoint probing (`runDoctor`), health projection
39
+ (`summarizeSnapshot`), scenario simulation (`runSimulation`), and the config/arg
40
+ parsers. These are exported from the package and fully unit-tested (against the
41
+ testkit mock RPC, with injected clocks — no real network in tests).
42
+
43
+ The **rendering + live-I/O** layer lives under [`src/ui/`](./src/ui) (ANSI
44
+ tables/sparklines, the command orchestrators, the `bastion` executable) and is
45
+ excluded from coverage — the data it renders is what's verified.
46
+
47
+ ```ts
48
+ // programmatic use of the data layer
49
+ import { runDoctor, doctorReportToJson } from 'rpc-bastion';
50
+ const report = await runDoctor(urls, { rpcFactory });
51
+ console.log(doctorReportToJson(report));
52
+ ```
@@ -0,0 +1,3 @@
1
+ export { flagBool, flagInt, flagString, parseArgs } from './chunk-Q2OA5HXD.js';
2
+ //# sourceMappingURL=args-O3XNV7QR.js.map
3
+ //# sourceMappingURL=args-O3XNV7QR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"args-O3XNV7QR.js"}