@perpscope/percolator-adapter 0.6.0 → 0.7.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 +13 -0
- package/bin/perpscope.mjs +61 -0
- package/package.json +4 -1
- package/src/lib/percolator-adapter.js +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,19 @@ The full field-level contract is documented in `../../docs/field-compatibility-m
|
|
|
63
63
|
|
|
64
64
|
`compareCompatibilityReports(previous, current)` returns `perpscope.compatibility-diff` with score delta, status change, new/resolved fields, section drift, and merged alias suggestions.
|
|
65
65
|
|
|
66
|
+
## CLI
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
perpscope compat report capture.json
|
|
70
|
+
perpscope compat diff previous.json current.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Try it locally with:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
perpscope compat diff ../../examples/fixture-pack-minimal-terminal.json ../../examples/fixture-pack-drifted-aliases.json
|
|
77
|
+
```
|
|
78
|
+
|
|
66
79
|
## DTO Example
|
|
67
80
|
|
|
68
81
|
```js
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import {
|
|
4
|
+
buildPercolatorCompatibilityReport,
|
|
5
|
+
compareCompatibilityReports,
|
|
6
|
+
exportCompatibilityReport,
|
|
7
|
+
normalizePercolatorSnapshot,
|
|
8
|
+
parsePercolatorJson
|
|
9
|
+
} from "../index.js";
|
|
10
|
+
|
|
11
|
+
const [, , ...args] = process.argv;
|
|
12
|
+
|
|
13
|
+
function usage() {
|
|
14
|
+
return [
|
|
15
|
+
"Usage:",
|
|
16
|
+
" perpscope compat report <capture.json>",
|
|
17
|
+
" perpscope compat diff <previous.json> <current.json>",
|
|
18
|
+
"",
|
|
19
|
+
"Read-only only: the adapter rejects wallet, signer, transaction, instruction, order, private key, seed, mnemonic, and API key fields."
|
|
20
|
+
].join("\n");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function readCapture(path) {
|
|
24
|
+
if (!path) throw new Error("Missing capture path.");
|
|
25
|
+
return parsePercolatorJson(readFileSync(path, "utf8"));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function buildReport(input) {
|
|
29
|
+
const snapshot = normalizePercolatorSnapshot(input);
|
|
30
|
+
return buildPercolatorCompatibilityReport(input, snapshot);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function main() {
|
|
34
|
+
const [scope, command, ...rest] = args;
|
|
35
|
+
if (!scope || scope === "--help" || scope === "-h") {
|
|
36
|
+
console.log(usage());
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (scope !== "compat") throw new Error(`Unknown scope: ${scope}`);
|
|
40
|
+
if (command === "report") {
|
|
41
|
+
const input = readCapture(rest[0]);
|
|
42
|
+
console.log(JSON.stringify(exportCompatibilityReport(input), null, 2));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (command === "diff") {
|
|
46
|
+
const previous = buildReport(readCapture(rest[0]));
|
|
47
|
+
const current = buildReport(readCapture(rest[1]));
|
|
48
|
+
console.log(JSON.stringify(compareCompatibilityReports(previous, current), null, 2));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`Unknown compat command: ${command || ""}`.trim());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
main();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.error(error.message);
|
|
58
|
+
console.error("");
|
|
59
|
+
console.error(usage());
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perpscope/percolator-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Read-only Percolator adapter helpers for Solana perps terminals.",
|
|
6
6
|
"main": "./index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"perpscope": "bin/perpscope.mjs"
|
|
9
|
+
},
|
|
7
10
|
"exports": {
|
|
8
11
|
".": "./index.js"
|
|
9
12
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeFundingSkewHistory } from "./funding-history.js";
|
|
2
2
|
|
|
3
|
-
export const PERPSCOPE_ADAPTER_VERSION = "0.
|
|
3
|
+
export const PERPSCOPE_ADAPTER_VERSION = "0.7.0";
|
|
4
4
|
|
|
5
5
|
const KEYPAIR_FIELD_PATTERN = /(^|_)(secret|private|keypair|mnemonic|seed|walletPath|wallet)(_|$)/i;
|
|
6
6
|
const HISTORY_COMMAND_KEYS = new Set([
|