@spfunctions/cli 1.7.6 → 1.7.7
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/dist/commands/query.js +22 -9
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/commands/query.js
CHANGED
|
@@ -49,16 +49,29 @@ async function queryCommand(q, opts) {
|
|
|
49
49
|
}
|
|
50
50
|
console.log();
|
|
51
51
|
}
|
|
52
|
-
// Markets
|
|
53
|
-
|
|
52
|
+
// Markets — show each venue separately
|
|
53
|
+
const formatMarket = (m) => {
|
|
54
|
+
const venue = m.venue === 'kalshi' ? '\x1b[36mK\x1b[39m' : '\x1b[35mP\x1b[39m';
|
|
55
|
+
const vol = m.volume > 1_000_000 ? `${(m.volume / 1_000_000).toFixed(1)}M` :
|
|
56
|
+
m.volume > 1_000 ? `${(m.volume / 1_000).toFixed(0)}K` :
|
|
57
|
+
String(Math.round(m.volume));
|
|
58
|
+
const ticker = m.ticker ? ` ${m.ticker}` : '';
|
|
59
|
+
console.log(` ${venue} ${String(m.price).padStart(3)}¢ vol ${vol.padStart(6)} ${m.title.slice(0, 55)}${ticker}`);
|
|
60
|
+
};
|
|
61
|
+
const kalshiList = data.kalshi || [];
|
|
62
|
+
const polyList = data.polymarket || [];
|
|
63
|
+
const hasMarkets = kalshiList.length > 0 || polyList.length > 0;
|
|
64
|
+
if (hasMarkets) {
|
|
54
65
|
console.log(' \x1b[1mMarkets\x1b[22m');
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
if (kalshiList.length > 0) {
|
|
67
|
+
for (const m of kalshiList.slice(0, 8))
|
|
68
|
+
formatMarket(m);
|
|
69
|
+
}
|
|
70
|
+
if (polyList.length > 0) {
|
|
71
|
+
if (kalshiList.length > 0)
|
|
72
|
+
console.log(); // separator between venues
|
|
73
|
+
for (const m of polyList.slice(0, 8))
|
|
74
|
+
formatMarket(m);
|
|
62
75
|
}
|
|
63
76
|
console.log();
|
|
64
77
|
}
|
package/dist/index.js
CHANGED
|
@@ -141,9 +141,13 @@ program
|
|
|
141
141
|
.option('--api-url <url>', 'API base URL (or set SF_API_URL env var)')
|
|
142
142
|
.configureHelp({
|
|
143
143
|
formatHelp: (cmd, helper) => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
// Root command (sf --help) → show grouped help
|
|
145
|
+
// Subcommands (sf query --help) → default behavior
|
|
146
|
+
if (!cmd.parent)
|
|
147
|
+
return GROUPED_HELP;
|
|
148
|
+
const { Help } = require('commander');
|
|
149
|
+
const defaultHelper = new Help();
|
|
150
|
+
return defaultHelper.formatHelp(cmd, helper);
|
|
147
151
|
},
|
|
148
152
|
})
|
|
149
153
|
.action(async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spfunctions/cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"description": "Prediction market intelligence CLI. Causal thesis model, 24/7 Kalshi/Polymarket scan, live orderbook, edge detection. Interactive agent mode with tool calling.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sf": "./dist/index.js"
|