liquilens 0.4.0 → 0.5.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/README.md +12 -2
- package/dist/api.js +1 -0
- package/dist/cli.js +31 -4
- package/dist/plain.js +33 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -32,15 +32,16 @@ Two boards, one command:
|
|
|
32
32
|
Run once without keeping an install:
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
npx
|
|
35
|
+
npx liquilens
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Or keep the command on your PATH:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
npm install --global
|
|
41
|
+
npm install --global liquilens
|
|
42
42
|
liquilens # India board
|
|
43
43
|
liquilens --region us # US board
|
|
44
|
+
liquilens --record # evidence status and eligibility, all markets
|
|
44
45
|
```
|
|
45
46
|
|
|
46
47
|
From a source checkout:
|
|
@@ -59,6 +60,11 @@ liquilens
|
|
|
59
60
|
- **`--plain`** (automatic when piped): one-shot ANSI-free table — safe for
|
|
60
61
|
scripts, cron mails, CI logs.
|
|
61
62
|
- **`--json`**: one-shot machine-readable dump (rows + `risk_band` + regime).
|
|
63
|
+
- **`--record`**: one-shot historical-evidence ledger for India, the US, and
|
|
64
|
+
Europe. It prints each market's construction/case-file status plus
|
|
65
|
+
`validated_backtest_eligible` and `real_money_eligible`; add `--json` to
|
|
66
|
+
preserve the served `/api/evidence/markets` payload exactly. It cannot be
|
|
67
|
+
combined with `--region` or `--fail-on`.
|
|
62
68
|
- **`--fail-on amber|red`**: alerting for cron/CI — exits 3 when any Indian
|
|
63
69
|
institution is at/above the band. (India only: US scores are within-quarter
|
|
64
70
|
percentile ranks — a relative leaderboard — so an absolute threshold would
|
|
@@ -67,6 +73,10 @@ liquilens
|
|
|
67
73
|
```bash
|
|
68
74
|
# cron: mail me the board only when something turns red
|
|
69
75
|
liquilens --fail-on red > /tmp/board.txt || mail -s "LiquiLens RED" me@x < /tmp/board.txt
|
|
76
|
+
|
|
77
|
+
# audit the historical-evidence boundary without opening the web app
|
|
78
|
+
liquilens --record
|
|
79
|
+
liquilens --record --json | jq '.markets[] | {name, historical_evidence}'
|
|
70
80
|
```
|
|
71
81
|
|
|
72
82
|
## Keys
|
package/dist/api.js
CHANGED
|
@@ -69,3 +69,4 @@ export const fetchBoard = () => getJson("/api/failure-radar/board");
|
|
|
69
69
|
export const fetchUSBoard = () => getJson("/api/us-radar/board");
|
|
70
70
|
export const fetchRegime = () => getJson("/api/public-signals/market-regime");
|
|
71
71
|
export const fetchNews = (slug) => getJson(`/api/public-signals/news/${encodeURIComponent(slug)}`);
|
|
72
|
+
export const fetchEvidenceMarkets = () => getJson("/api/evidence/markets");
|
package/dist/cli.js
CHANGED
|
@@ -4,9 +4,9 @@ import dns from "node:dns";
|
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { render } from "ink";
|
|
6
6
|
import App from "./App.js";
|
|
7
|
-
import { fetchBoard, fetchRegime, fetchUSBoard, setApiBase, setClientVersion, getApiBase, DEFAULT_API, } from "./api.js";
|
|
7
|
+
import { fetchBoard, fetchEvidenceMarkets, fetchRegime, fetchUSBoard, setApiBase, setClientVersion, getApiBase, DEFAULT_API, } from "./api.js";
|
|
8
8
|
import { loadCached, saveCached, ageMinutes, describeAge, } from "./cache.js";
|
|
9
|
-
import { renderJson, renderPlain, worstBand } from "./plain.js";
|
|
9
|
+
import { renderEvidenceJson, renderEvidenceRecord, renderJson, renderPlain, worstBand, } from "./plain.js";
|
|
10
10
|
import { bandAtLeast } from "./riskBands.js";
|
|
11
11
|
// Some networks blackhole IPv6 (Node's fetch hangs while curl works);
|
|
12
12
|
// prefer IPv4 first — undici's autoSelectFamily in api.ts covers the rest.
|
|
@@ -34,6 +34,9 @@ plain table when piped. Data comes from public, no-auth LiquiLens endpoints.
|
|
|
34
34
|
Options:
|
|
35
35
|
--region <in|us> board to show (default in). in = India institutions,
|
|
36
36
|
us = FDIC-scored US banks (undertow engine)
|
|
37
|
+
--record one-shot historical-evidence status for India, the US,
|
|
38
|
+
and Europe, including validated/real-money eligibility.
|
|
39
|
+
Cannot be combined with --region or --fail-on.
|
|
37
40
|
--plain one-shot ANSI-free table (default when stdout is not a TTY)
|
|
38
41
|
--json one-shot machine-readable JSON dump
|
|
39
42
|
--fail-on <band> exit 3 if any institution is at/above band (amber|red).
|
|
@@ -58,7 +61,9 @@ function fail(msg, code) {
|
|
|
58
61
|
export function parseArgs(argv, isTTY) {
|
|
59
62
|
let mode = null;
|
|
60
63
|
let region = "in";
|
|
64
|
+
let regionExplicit = false;
|
|
61
65
|
let failOn = null;
|
|
66
|
+
let record = false;
|
|
62
67
|
for (let i = 0; i < argv.length; i++) {
|
|
63
68
|
const arg = argv[i];
|
|
64
69
|
switch (arg) {
|
|
@@ -74,11 +79,15 @@ export function parseArgs(argv, isTTY) {
|
|
|
74
79
|
case "--json":
|
|
75
80
|
mode = "json";
|
|
76
81
|
break;
|
|
82
|
+
case "--record":
|
|
83
|
+
record = true;
|
|
84
|
+
break;
|
|
77
85
|
case "--region": {
|
|
78
86
|
const r = argv[++i];
|
|
79
87
|
if (r !== "in" && r !== "us")
|
|
80
88
|
fail(`--region must be "in" or "us", got "${r ?? ""}"`, 2);
|
|
81
89
|
region = r;
|
|
90
|
+
regionExplicit = true;
|
|
82
91
|
break;
|
|
83
92
|
}
|
|
84
93
|
case "--fail-on": {
|
|
@@ -103,9 +112,15 @@ export function parseArgs(argv, isTTY) {
|
|
|
103
112
|
fail("--fail-on works with --region in only: US scores are within-quarter " +
|
|
104
113
|
"percentile ranks (a relative leaderboard), so an absolute alert " +
|
|
105
114
|
"threshold would always fire", 2);
|
|
115
|
+
if (record && regionExplicit)
|
|
116
|
+
fail("--record cannot be combined with --region; it already covers every market", 2);
|
|
117
|
+
if (record && failOn)
|
|
118
|
+
fail("--record cannot be combined with --fail-on; evidence eligibility is not a risk band", 2);
|
|
119
|
+
if (record && mode === null)
|
|
120
|
+
mode = "plain";
|
|
106
121
|
if (failOn && mode === null)
|
|
107
122
|
mode = "plain";
|
|
108
|
-
return { mode: mode ?? (isTTY ? "tui" : "plain"), region, failOn };
|
|
123
|
+
return { mode: mode ?? (isTTY ? "tui" : "plain"), region, failOn, record };
|
|
109
124
|
}
|
|
110
125
|
async function snapshotOnce(region) {
|
|
111
126
|
if (region === "us") {
|
|
@@ -163,7 +178,19 @@ if ("exit" in parsed) {
|
|
|
163
178
|
console.log(parsed.exit);
|
|
164
179
|
process.exit(0);
|
|
165
180
|
}
|
|
166
|
-
if (parsed.
|
|
181
|
+
if (parsed.record) {
|
|
182
|
+
try {
|
|
183
|
+
const record = await fetchEvidenceMarkets();
|
|
184
|
+
console.log(parsed.mode === "json"
|
|
185
|
+
? renderEvidenceJson(record)
|
|
186
|
+
: renderEvidenceRecord(record));
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
fail(`could not read historical evidence from ${getApiBase()} ` +
|
|
190
|
+
`(${err instanceof Error ? err.message : String(err)})`, 1);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (parsed.mode === "tui") {
|
|
167
194
|
render(_jsx(App, { initialRegion: parsed.region }));
|
|
168
195
|
}
|
|
169
196
|
else {
|
package/dist/plain.js
CHANGED
|
@@ -116,3 +116,36 @@ export function renderJson(snap) {
|
|
|
116
116
|
})),
|
|
117
117
|
}, null, 2);
|
|
118
118
|
}
|
|
119
|
+
function evidenceFlag(value) {
|
|
120
|
+
if (value === true)
|
|
121
|
+
return "YES";
|
|
122
|
+
if (value === false)
|
|
123
|
+
return "NO";
|
|
124
|
+
return "NOT STATED";
|
|
125
|
+
}
|
|
126
|
+
/** One-shot evidence boundary for humans; no eligibility is inferred. */
|
|
127
|
+
export function renderEvidenceRecord(record) {
|
|
128
|
+
const lines = [
|
|
129
|
+
"LIQUILENS · HISTORICAL EVIDENCE STATUS",
|
|
130
|
+
"Eligibility is served per market; construction-PIT diagnostics are not promoted by the CLI.",
|
|
131
|
+
"",
|
|
132
|
+
];
|
|
133
|
+
for (const market of record.markets) {
|
|
134
|
+
const evidence = market.historical_evidence ?? {};
|
|
135
|
+
lines.push(market.name.toUpperCase());
|
|
136
|
+
lines.push(` kind: ${market.kind}`);
|
|
137
|
+
lines.push(` ${market.headline}`);
|
|
138
|
+
lines.push(` status: ${evidence.status ?? "NOT_STATED"}`);
|
|
139
|
+
lines.push(" validated-backtest eligible: " +
|
|
140
|
+
evidenceFlag(evidence.validated_backtest_eligible) +
|
|
141
|
+
" · real-money eligible: " +
|
|
142
|
+
evidenceFlag(evidence.real_money_eligible));
|
|
143
|
+
lines.push("");
|
|
144
|
+
}
|
|
145
|
+
lines.push("source: https://api.liquilens.in/api/evidence/markets");
|
|
146
|
+
return lines.join("\n");
|
|
147
|
+
}
|
|
148
|
+
/** Preserve the API payload exactly for agents and scripts. */
|
|
149
|
+
export function renderEvidenceJson(record) {
|
|
150
|
+
return JSON.stringify(record, null, 2);
|
|
151
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "liquilens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "LiquiLens Failure Radar in your terminal — live early-warning board for Indian institutions and FDIC-scored US banks, from public data",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://liquilens.in/developers/",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc",
|
|
38
38
|
"dev": "tsc && node dist/cli.js",
|
|
39
|
-
"test": "tsc && node --test dist/cache.test.js dist/format.test.js dist/riskBands.test.js dist/us.test.js",
|
|
39
|
+
"test": "tsc && node --test dist/cache.test.js dist/format.test.js dist/record.test.js dist/riskBands.test.js dist/us.test.js",
|
|
40
40
|
"prepare": "tsc"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"ink": "^5.2.0",
|
|
51
51
|
"react": "^18.3.1",
|
|
52
|
-
"undici": "^6.
|
|
52
|
+
"undici": "^6.29.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^22.10.0",
|