@spfunctions/cli 1.7.17 → 1.7.20
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/101.index.js +1 -0
- package/dist/12.index.js +1 -0
- package/dist/160.index.js +1 -0
- package/dist/174.index.js +1 -0
- package/dist/278.index.js +6 -0
- package/dist/582.index.js +1 -0
- package/dist/641.index.js +324 -0
- package/dist/669.index.js +1 -0
- package/dist/722.index.js +1 -0
- package/dist/788.index.js +1 -0
- package/dist/816.index.js +12 -0
- package/dist/830.index.js +1 -0
- package/dist/921.index.js +1 -0
- package/dist/index.js +1 -813
- package/package.json +6 -2
- package/dist/cache.d.ts +0 -6
- package/dist/cache.js +0 -31
- package/dist/cache.test.d.ts +0 -1
- package/dist/cache.test.js +0 -73
- package/dist/client.d.ts +0 -56
- package/dist/client.js +0 -205
- package/dist/client.test.d.ts +0 -1
- package/dist/client.test.js +0 -89
- package/dist/commands/agent.d.ts +0 -20
- package/dist/commands/agent.js +0 -4119
- package/dist/commands/announcements.d.ts +0 -3
- package/dist/commands/announcements.js +0 -28
- package/dist/commands/augment.d.ts +0 -12
- package/dist/commands/augment.js +0 -56
- package/dist/commands/balance.d.ts +0 -3
- package/dist/commands/balance.js +0 -17
- package/dist/commands/book.d.ts +0 -17
- package/dist/commands/book.js +0 -220
- package/dist/commands/cancel.d.ts +0 -5
- package/dist/commands/cancel.js +0 -41
- package/dist/commands/context.d.ts +0 -6
- package/dist/commands/context.js +0 -208
- package/dist/commands/create.d.ts +0 -7
- package/dist/commands/create.js +0 -42
- package/dist/commands/dashboard.d.ts +0 -14
- package/dist/commands/dashboard.js +0 -215
- package/dist/commands/delta.d.ts +0 -16
- package/dist/commands/delta.js +0 -115
- package/dist/commands/edges.d.ts +0 -26
- package/dist/commands/edges.js +0 -237
- package/dist/commands/evaluate.d.ts +0 -4
- package/dist/commands/evaluate.js +0 -30
- package/dist/commands/explore.d.ts +0 -14
- package/dist/commands/explore.js +0 -115
- package/dist/commands/feed.d.ts +0 -13
- package/dist/commands/feed.js +0 -73
- package/dist/commands/fills.d.ts +0 -4
- package/dist/commands/fills.js +0 -29
- package/dist/commands/forecast.d.ts +0 -4
- package/dist/commands/forecast.js +0 -53
- package/dist/commands/get.d.ts +0 -5
- package/dist/commands/get.js +0 -98
- package/dist/commands/heartbeat.d.ts +0 -20
- package/dist/commands/heartbeat.js +0 -73
- package/dist/commands/history.d.ts +0 -3
- package/dist/commands/history.js +0 -38
- package/dist/commands/liquidity.d.ts +0 -14
- package/dist/commands/liquidity.js +0 -378
- package/dist/commands/list.d.ts +0 -5
- package/dist/commands/list.js +0 -38
- package/dist/commands/login.d.ts +0 -9
- package/dist/commands/login.js +0 -98
- package/dist/commands/markets.d.ts +0 -10
- package/dist/commands/markets.js +0 -39
- package/dist/commands/milestones.d.ts +0 -8
- package/dist/commands/milestones.js +0 -56
- package/dist/commands/orders.d.ts +0 -4
- package/dist/commands/orders.js +0 -28
- package/dist/commands/performance.d.ts +0 -11
- package/dist/commands/performance.js +0 -250
- package/dist/commands/positions.d.ts +0 -19
- package/dist/commands/positions.js +0 -294
- package/dist/commands/prompt.d.ts +0 -13
- package/dist/commands/prompt.js +0 -35
- package/dist/commands/publish.d.ts +0 -15
- package/dist/commands/publish.js +0 -39
- package/dist/commands/query.d.ts +0 -15
- package/dist/commands/query.js +0 -132
- package/dist/commands/rfq.d.ts +0 -5
- package/dist/commands/rfq.js +0 -35
- package/dist/commands/scan.d.ts +0 -11
- package/dist/commands/scan.js +0 -230
- package/dist/commands/schedule.d.ts +0 -3
- package/dist/commands/schedule.js +0 -38
- package/dist/commands/settlements.d.ts +0 -6
- package/dist/commands/settlements.js +0 -50
- package/dist/commands/setup.d.ts +0 -24
- package/dist/commands/setup.js +0 -700
- package/dist/commands/signal.d.ts +0 -6
- package/dist/commands/signal.js +0 -32
- package/dist/commands/strategies.d.ts +0 -11
- package/dist/commands/strategies.js +0 -130
- package/dist/commands/telegram.d.ts +0 -15
- package/dist/commands/telegram.js +0 -125
- package/dist/commands/trade.d.ts +0 -12
- package/dist/commands/trade.js +0 -112
- package/dist/commands/watch.d.ts +0 -19
- package/dist/commands/watch.js +0 -157
- package/dist/commands/whatif.d.ts +0 -17
- package/dist/commands/whatif.js +0 -209
- package/dist/commands/x.d.ts +0 -28
- package/dist/commands/x.js +0 -167
- package/dist/config.d.ts +0 -55
- package/dist/config.js +0 -139
- package/dist/config.test.d.ts +0 -1
- package/dist/config.test.js +0 -138
- package/dist/index.d.ts +0 -20
- package/dist/kalshi.d.ts +0 -144
- package/dist/kalshi.js +0 -498
- package/dist/polymarket.d.ts +0 -237
- package/dist/polymarket.js +0 -353
- package/dist/polymarket.test.d.ts +0 -1
- package/dist/polymarket.test.js +0 -424
- package/dist/share.d.ts +0 -4
- package/dist/share.js +0 -27
- package/dist/skills/loader.d.ts +0 -19
- package/dist/skills/loader.js +0 -86
- package/dist/telegram/agent-bridge.d.ts +0 -15
- package/dist/telegram/agent-bridge.js +0 -573
- package/dist/telegram/bot.d.ts +0 -10
- package/dist/telegram/bot.js +0 -297
- package/dist/telegram/commands.d.ts +0 -11
- package/dist/telegram/commands.js +0 -120
- package/dist/telegram/format.d.ts +0 -11
- package/dist/telegram/format.js +0 -51
- package/dist/telegram/format.test.d.ts +0 -1
- package/dist/telegram/format.test.js +0 -73
- package/dist/telegram/poller.d.ts +0 -6
- package/dist/telegram/poller.js +0 -32
- package/dist/topics.d.ts +0 -17
- package/dist/topics.js +0 -102
- package/dist/topics.test.d.ts +0 -1
- package/dist/topics.test.js +0 -131
- package/dist/tui/border.d.ts +0 -33
- package/dist/tui/border.js +0 -87
- package/dist/tui/chart.d.ts +0 -19
- package/dist/tui/chart.js +0 -117
- package/dist/tui/dashboard.d.ts +0 -9
- package/dist/tui/dashboard.js +0 -814
- package/dist/tui/layout.d.ts +0 -16
- package/dist/tui/layout.js +0 -41
- package/dist/tui/screen.d.ts +0 -33
- package/dist/tui/screen.js +0 -102
- package/dist/tui/state.d.ts +0 -40
- package/dist/tui/state.js +0 -36
- package/dist/tui/widgets/commandbar.d.ts +0 -8
- package/dist/tui/widgets/commandbar.js +0 -82
- package/dist/tui/widgets/detail.d.ts +0 -9
- package/dist/tui/widgets/detail.js +0 -151
- package/dist/tui/widgets/edges.d.ts +0 -4
- package/dist/tui/widgets/edges.js +0 -34
- package/dist/tui/widgets/liquidity.d.ts +0 -9
- package/dist/tui/widgets/liquidity.js +0 -142
- package/dist/tui/widgets/orders.d.ts +0 -4
- package/dist/tui/widgets/orders.js +0 -37
- package/dist/tui/widgets/portfolio.d.ts +0 -4
- package/dist/tui/widgets/portfolio.js +0 -59
- package/dist/tui/widgets/signals.d.ts +0 -4
- package/dist/tui/widgets/signals.js +0 -31
- package/dist/tui/widgets/statusbar.d.ts +0 -8
- package/dist/tui/widgets/statusbar.js +0 -72
- package/dist/tui/widgets/thesis.d.ts +0 -4
- package/dist/tui/widgets/thesis.js +0 -66
- package/dist/tui/widgets/trade.d.ts +0 -9
- package/dist/tui/widgets/trade.js +0 -117
- package/dist/tui/widgets/upcoming.d.ts +0 -4
- package/dist/tui/widgets/upcoming.js +0 -41
- package/dist/tui/widgets/whatif.d.ts +0 -7
- package/dist/tui/widgets/whatif.js +0 -113
- package/dist/types/output.d.ts +0 -412
- package/dist/types/output.js +0 -9
- package/dist/utils.d.ts +0 -42
- package/dist/utils.js +0 -124
- package/dist/utils.test.d.ts +0 -1
- package/dist/utils.test.js +0 -111
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* What-if view — scenario analysis with BEFORE/AFTER comparison
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderWhatif = renderWhatif;
|
|
7
|
-
const border_js_1 = require("../border.js");
|
|
8
|
-
const HIGHLIGHT_BG = (0, border_js_1.bgRgb)(25, 25, 30);
|
|
9
|
-
function renderWhatif(screen, region, state) {
|
|
10
|
-
(0, border_js_1.drawBorder)(screen, region, 'WHAT-IF SCENARIO');
|
|
11
|
-
const x = region.col + 2;
|
|
12
|
-
const w = region.width - 4;
|
|
13
|
-
let line = 1;
|
|
14
|
-
if (!state.whatifResult) {
|
|
15
|
-
screen.write(region.row + line, x, 'No what-if data. Press "w" from overview to start.', border_js_1.CLR.dim);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const result = state.whatifResult;
|
|
19
|
-
const scenarios = result.scenarios || result.overrides || [];
|
|
20
|
-
const halfW = Math.floor(w / 2) - 2;
|
|
21
|
-
// ── Top: Scenario list with cursor ──
|
|
22
|
-
screen.write(region.row + line, x, 'Scenarios:', border_js_1.CLR.title);
|
|
23
|
-
line++;
|
|
24
|
-
if (scenarios.length === 0) {
|
|
25
|
-
screen.write(region.row + line, x, ' (no scenarios available)', border_js_1.CLR.dim);
|
|
26
|
-
line += 2;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
for (let i = 0; i < scenarios.length; i++) {
|
|
30
|
-
if (line >= region.height - 8)
|
|
31
|
-
break;
|
|
32
|
-
const sc = scenarios[i];
|
|
33
|
-
const selected = state.whatifScenarioIndex === i;
|
|
34
|
-
const marker = selected ? '\u25B8 ' : ' ';
|
|
35
|
-
const name = sc.name || sc.description || sc.nodeId || `Scenario ${i + 1}`;
|
|
36
|
-
const bg = selected ? HIGHLIGHT_BG : '';
|
|
37
|
-
screen.write(region.row + line, x, (0, border_js_1.fit)(`${marker}${name}`, w), selected ? border_js_1.CLR.white : border_js_1.CLR.text, bg);
|
|
38
|
-
line++;
|
|
39
|
-
}
|
|
40
|
-
line++;
|
|
41
|
-
}
|
|
42
|
-
// ── Divider ──
|
|
43
|
-
for (let c = x; c < x + w; c++) {
|
|
44
|
-
screen.write(region.row + line, c, '─', border_js_1.CLR.borderDim);
|
|
45
|
-
}
|
|
46
|
-
line++;
|
|
47
|
-
// ── Bottom: BEFORE vs AFTER comparison ──
|
|
48
|
-
const beforeCol = x;
|
|
49
|
-
const afterCol = x + halfW + 3;
|
|
50
|
-
// Headers
|
|
51
|
-
screen.write(region.row + line, beforeCol, (0, border_js_1.fit)('BEFORE', halfW), border_js_1.CLR.title);
|
|
52
|
-
screen.write(region.row + line, afterCol, (0, border_js_1.fit)('AFTER', halfW), border_js_1.CLR.title);
|
|
53
|
-
line++;
|
|
54
|
-
const before = result.before || result.current || {};
|
|
55
|
-
const after = result.after || result.proposed || {};
|
|
56
|
-
// Confidence
|
|
57
|
-
const confBefore = before.confidence != null ? `${Math.round(before.confidence * 100)}%` : '?%';
|
|
58
|
-
const confAfter = after.confidence != null ? `${Math.round(after.confidence * 100)}%` : '?%';
|
|
59
|
-
const confDelta = (after.confidence ?? 0) - (before.confidence ?? 0);
|
|
60
|
-
const confDeltaStr = confDelta >= 0 ? `+${Math.round(confDelta * 100)}%` : `${Math.round(confDelta * 100)}%`;
|
|
61
|
-
screen.writeStyled(region.row + line, beforeCol, [
|
|
62
|
-
{ text: 'Confidence: ', fg: border_js_1.CLR.dim },
|
|
63
|
-
{ text: confBefore, fg: border_js_1.CLR.text },
|
|
64
|
-
]);
|
|
65
|
-
screen.writeStyled(region.row + line, afterCol, [
|
|
66
|
-
{ text: 'Confidence: ', fg: border_js_1.CLR.dim },
|
|
67
|
-
{ text: confAfter, fg: border_js_1.CLR.text },
|
|
68
|
-
{ text: ` (${confDeltaStr})`, fg: confDelta >= 0 ? border_js_1.CLR.green : border_js_1.CLR.red },
|
|
69
|
-
]);
|
|
70
|
-
line++;
|
|
71
|
-
// Edge changes
|
|
72
|
-
const beforeEdges = before.edges || [];
|
|
73
|
-
const afterEdges = after.edges || [];
|
|
74
|
-
screen.write(region.row + line, beforeCol, 'Edges:', border_js_1.CLR.dim);
|
|
75
|
-
screen.write(region.row + line, afterCol, 'Edges:', border_js_1.CLR.dim);
|
|
76
|
-
line++;
|
|
77
|
-
const maxEdgeRows = Math.min(Math.max(beforeEdges.length, afterEdges.length), region.height - line - 3);
|
|
78
|
-
for (let i = 0; i < maxEdgeRows; i++) {
|
|
79
|
-
const be = beforeEdges[i];
|
|
80
|
-
const ae = afterEdges[i];
|
|
81
|
-
if (be) {
|
|
82
|
-
const name = (be.market || be.ticker || '').slice(0, halfW - 10);
|
|
83
|
-
const edgeStr = `${be.edge >= 0 ? '+' : ''}${be.edge}`;
|
|
84
|
-
screen.writeStyled(region.row + line, beforeCol, [
|
|
85
|
-
{ text: (0, border_js_1.fit)(name, halfW - 8), fg: border_js_1.CLR.text },
|
|
86
|
-
{ text: (0, border_js_1.fit)(edgeStr, 6, 'right'), fg: be.edge >= 0 ? border_js_1.CLR.green : border_js_1.CLR.red },
|
|
87
|
-
]);
|
|
88
|
-
}
|
|
89
|
-
if (ae) {
|
|
90
|
-
const name = (ae.market || ae.ticker || '').slice(0, halfW - 10);
|
|
91
|
-
const edgeStr = `${ae.edge >= 0 ? '+' : ''}${ae.edge}`;
|
|
92
|
-
const delta = ae.edgeDelta ?? (ae.edge - (be?.edge ?? 0));
|
|
93
|
-
const deltaStr = delta >= 0 ? `+${delta}` : `${delta}`;
|
|
94
|
-
screen.writeStyled(region.row + line, afterCol, [
|
|
95
|
-
{ text: (0, border_js_1.fit)(name, halfW - 14), fg: border_js_1.CLR.text },
|
|
96
|
-
{ text: (0, border_js_1.fit)(edgeStr, 6, 'right'), fg: ae.edge >= 0 ? border_js_1.CLR.green : border_js_1.CLR.red },
|
|
97
|
-
{ text: (0, border_js_1.fit)(deltaStr, 6, 'right'), fg: delta >= 0 ? border_js_1.CLR.green : border_js_1.CLR.red },
|
|
98
|
-
]);
|
|
99
|
-
}
|
|
100
|
-
line++;
|
|
101
|
-
}
|
|
102
|
-
// P&L impact summary
|
|
103
|
-
if (line < region.height - 2) {
|
|
104
|
-
line++;
|
|
105
|
-
const pnlImpact = result.pnlImpact ?? result.pnl_impact;
|
|
106
|
-
if (pnlImpact != null) {
|
|
107
|
-
screen.writeStyled(region.row + line, x, [
|
|
108
|
-
{ text: 'P&L Impact: ', fg: border_js_1.CLR.dim },
|
|
109
|
-
{ text: `${pnlImpact >= 0 ? '+' : ''}$${Math.abs(pnlImpact).toFixed(2)}`, fg: pnlImpact >= 0 ? border_js_1.CLR.green : border_js_1.CLR.red },
|
|
110
|
-
]);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
package/dist/types/output.d.ts
DELETED
|
@@ -1,412 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stable JSON output schemas for all SF CLI commands.
|
|
3
|
-
*
|
|
4
|
-
* IMPORTANT: These types define the contract that --share and sf watch depend on.
|
|
5
|
-
* Breaking changes here cascade to the share renderer and watch differ.
|
|
6
|
-
* Add fields freely; removing or renaming fields is a breaking change.
|
|
7
|
-
*/
|
|
8
|
-
export type Venue = 'kalshi' | 'polymarket';
|
|
9
|
-
export interface MarketItem {
|
|
10
|
-
venue: Venue;
|
|
11
|
-
ticker: string;
|
|
12
|
-
title: string;
|
|
13
|
-
yesAsk: number;
|
|
14
|
-
lastPrice: number;
|
|
15
|
-
volume24h: number;
|
|
16
|
-
liquidity: number;
|
|
17
|
-
seriesTicker?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface TraditionalMarket {
|
|
20
|
-
symbol: string;
|
|
21
|
-
name: string;
|
|
22
|
-
price: number;
|
|
23
|
-
changePct: number;
|
|
24
|
-
change1d?: number;
|
|
25
|
-
}
|
|
26
|
-
export interface EdgeItem {
|
|
27
|
-
marketId: string;
|
|
28
|
-
market: string;
|
|
29
|
-
venue: Venue;
|
|
30
|
-
direction: string;
|
|
31
|
-
marketPrice: number;
|
|
32
|
-
thesisPrice: number;
|
|
33
|
-
edge: number;
|
|
34
|
-
executableEdge: number | null;
|
|
35
|
-
spread: number | null;
|
|
36
|
-
liquidityScore: string | null;
|
|
37
|
-
thesisId: string;
|
|
38
|
-
position: {
|
|
39
|
-
side: string;
|
|
40
|
-
quantity: number;
|
|
41
|
-
avgPrice: number;
|
|
42
|
-
currentValue: number;
|
|
43
|
-
pnl: number;
|
|
44
|
-
totalCost: number;
|
|
45
|
-
} | null;
|
|
46
|
-
}
|
|
47
|
-
export interface ThesisSummary {
|
|
48
|
-
id: string;
|
|
49
|
-
status: string;
|
|
50
|
-
confidence: number | null;
|
|
51
|
-
updatedAt: string;
|
|
52
|
-
title: string;
|
|
53
|
-
rawThesis?: string;
|
|
54
|
-
slug?: string;
|
|
55
|
-
edgeCount?: number;
|
|
56
|
-
}
|
|
57
|
-
export interface CausalNode {
|
|
58
|
-
id: string;
|
|
59
|
-
label: string;
|
|
60
|
-
probability: number;
|
|
61
|
-
depth?: number;
|
|
62
|
-
children?: CausalNode[];
|
|
63
|
-
}
|
|
64
|
-
export interface EvaluationSummary {
|
|
65
|
-
evaluatedAt: string;
|
|
66
|
-
summary: string;
|
|
67
|
-
confidence: number;
|
|
68
|
-
confidenceDelta: number;
|
|
69
|
-
model?: string;
|
|
70
|
-
thesisTitle?: string;
|
|
71
|
-
thesisSlug?: string;
|
|
72
|
-
}
|
|
73
|
-
/** sf scan "keywords" --json */
|
|
74
|
-
export type ScanOutput = MarketItem[];
|
|
75
|
-
/** sf query "question" --json */
|
|
76
|
-
export interface QueryOutput {
|
|
77
|
-
query: string;
|
|
78
|
-
answer: string;
|
|
79
|
-
keyFactors?: string[];
|
|
80
|
-
kalshi?: Array<{
|
|
81
|
-
title: string;
|
|
82
|
-
ticker: string;
|
|
83
|
-
price: number;
|
|
84
|
-
volume: number;
|
|
85
|
-
}>;
|
|
86
|
-
polymarket?: Array<{
|
|
87
|
-
title: string;
|
|
88
|
-
slug: string;
|
|
89
|
-
price: number;
|
|
90
|
-
volume: number;
|
|
91
|
-
}>;
|
|
92
|
-
x?: Array<{
|
|
93
|
-
author: string;
|
|
94
|
-
text: string;
|
|
95
|
-
url: string;
|
|
96
|
-
likes: number;
|
|
97
|
-
retweets?: number;
|
|
98
|
-
}>;
|
|
99
|
-
traditional?: TraditionalMarket[];
|
|
100
|
-
theses?: Array<{
|
|
101
|
-
title: string;
|
|
102
|
-
slug: string;
|
|
103
|
-
confidence: number;
|
|
104
|
-
edges: number;
|
|
105
|
-
}>;
|
|
106
|
-
content?: Array<{
|
|
107
|
-
type: string;
|
|
108
|
-
title: string;
|
|
109
|
-
url: string;
|
|
110
|
-
snippet?: string;
|
|
111
|
-
}>;
|
|
112
|
-
meta?: {
|
|
113
|
-
sources?: string[];
|
|
114
|
-
latencyMs?: number;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
/** sf context --json (no thesis ID — global context) */
|
|
118
|
-
export interface GlobalContextOutput {
|
|
119
|
-
scannedAt?: string;
|
|
120
|
-
meta?: {
|
|
121
|
-
totalMarkets: number;
|
|
122
|
-
kalshiMarkets: number;
|
|
123
|
-
polymarketMarkets: number;
|
|
124
|
-
};
|
|
125
|
-
traditional?: TraditionalMarket[];
|
|
126
|
-
highlights?: Array<{
|
|
127
|
-
title: string;
|
|
128
|
-
detail: string;
|
|
129
|
-
relatedTickers?: string[];
|
|
130
|
-
suggestedAction?: string;
|
|
131
|
-
}>;
|
|
132
|
-
categories?: Array<{
|
|
133
|
-
name: string;
|
|
134
|
-
description: string;
|
|
135
|
-
marketCount: number;
|
|
136
|
-
totalVolume24h: number;
|
|
137
|
-
topMovers?: Array<{
|
|
138
|
-
venue: string;
|
|
139
|
-
price: number;
|
|
140
|
-
change24h: number;
|
|
141
|
-
title: string;
|
|
142
|
-
ticker: string;
|
|
143
|
-
whyInteresting?: string;
|
|
144
|
-
}>;
|
|
145
|
-
mostLiquid?: Array<{
|
|
146
|
-
venue: string;
|
|
147
|
-
price: number;
|
|
148
|
-
spread: number;
|
|
149
|
-
volume24h: number;
|
|
150
|
-
title: string;
|
|
151
|
-
}>;
|
|
152
|
-
}>;
|
|
153
|
-
edges?: Array<{
|
|
154
|
-
price: number;
|
|
155
|
-
edge: number;
|
|
156
|
-
title: string;
|
|
157
|
-
thesisSlug: string;
|
|
158
|
-
venue: string;
|
|
159
|
-
}>;
|
|
160
|
-
signals?: EvaluationSummary[];
|
|
161
|
-
}
|
|
162
|
-
/** sf context <id> --json (thesis-specific context) */
|
|
163
|
-
export interface ThesisContextOutput {
|
|
164
|
-
thesis: string;
|
|
165
|
-
rawThesis?: string;
|
|
166
|
-
confidence: number | null;
|
|
167
|
-
status: string;
|
|
168
|
-
updatedAt?: string;
|
|
169
|
-
causalTree?: {
|
|
170
|
-
nodes: CausalNode[];
|
|
171
|
-
};
|
|
172
|
-
edges?: Array<{
|
|
173
|
-
marketId: string;
|
|
174
|
-
market: string;
|
|
175
|
-
marketTitle?: string;
|
|
176
|
-
marketPrice: number;
|
|
177
|
-
thesisPrice: number;
|
|
178
|
-
edge: number;
|
|
179
|
-
edgeSize?: number;
|
|
180
|
-
direction: string;
|
|
181
|
-
venue: string;
|
|
182
|
-
orderbook?: {
|
|
183
|
-
spread: number;
|
|
184
|
-
liquidityScore: string;
|
|
185
|
-
};
|
|
186
|
-
}>;
|
|
187
|
-
lastEvaluation?: {
|
|
188
|
-
evaluatedAt: string;
|
|
189
|
-
summary: string;
|
|
190
|
-
model: string;
|
|
191
|
-
positionRecommendations?: Array<{
|
|
192
|
-
positionId: string;
|
|
193
|
-
recommendation: string;
|
|
194
|
-
reason: string;
|
|
195
|
-
}>;
|
|
196
|
-
};
|
|
197
|
-
edgeMeta?: {
|
|
198
|
-
lastRescanAt: string;
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
/** sf edges --json */
|
|
202
|
-
export interface EdgesOutput {
|
|
203
|
-
totalEdges: number;
|
|
204
|
-
displayed: number;
|
|
205
|
-
thesesScanned: number;
|
|
206
|
-
edges: EdgeItem[];
|
|
207
|
-
}
|
|
208
|
-
/** sf list --json */
|
|
209
|
-
export type ListOutput = ThesisSummary[];
|
|
210
|
-
/** sf markets --json */
|
|
211
|
-
export interface MarketsOutput {
|
|
212
|
-
snapshotAt: string;
|
|
213
|
-
markets: TraditionalMarket[];
|
|
214
|
-
}
|
|
215
|
-
/** sf positions --json */
|
|
216
|
-
export interface PositionsOutput {
|
|
217
|
-
kalshiConfigured: boolean;
|
|
218
|
-
polymarketConfigured: boolean;
|
|
219
|
-
positions: Array<{
|
|
220
|
-
ticker: string;
|
|
221
|
-
side: string;
|
|
222
|
-
quantity: number;
|
|
223
|
-
average_price_paid: number;
|
|
224
|
-
current_value?: number;
|
|
225
|
-
unrealized_pnl?: number;
|
|
226
|
-
total_cost?: number;
|
|
227
|
-
}>;
|
|
228
|
-
polymarketPositions: Array<{
|
|
229
|
-
title?: string;
|
|
230
|
-
slug?: string;
|
|
231
|
-
outcome?: string;
|
|
232
|
-
size?: number;
|
|
233
|
-
avgPrice?: number;
|
|
234
|
-
curPrice?: number;
|
|
235
|
-
cashPnl?: number;
|
|
236
|
-
}>;
|
|
237
|
-
edges: Array<EdgeItem & {
|
|
238
|
-
thesisId: string;
|
|
239
|
-
}>;
|
|
240
|
-
}
|
|
241
|
-
/** sf explore --json (list mode, no slug) */
|
|
242
|
-
export interface ExploreListOutput {
|
|
243
|
-
theses: Array<{
|
|
244
|
-
slug: string;
|
|
245
|
-
confidence: number | null;
|
|
246
|
-
impliedReturn?: number;
|
|
247
|
-
status: string;
|
|
248
|
-
title: string;
|
|
249
|
-
}>;
|
|
250
|
-
}
|
|
251
|
-
/** sf explore <slug> --json (detail mode) */
|
|
252
|
-
export interface ExploreDetailOutput {
|
|
253
|
-
thesis: {
|
|
254
|
-
title: string;
|
|
255
|
-
slug: string;
|
|
256
|
-
confidence: number | null;
|
|
257
|
-
status: string;
|
|
258
|
-
publishedAt?: string;
|
|
259
|
-
description?: string;
|
|
260
|
-
};
|
|
261
|
-
causalTree?: {
|
|
262
|
-
nodes: CausalNode[];
|
|
263
|
-
};
|
|
264
|
-
impliedReturns?: {
|
|
265
|
-
avgReturnPct: number;
|
|
266
|
-
winRate: number;
|
|
267
|
-
winners: number;
|
|
268
|
-
losers: number;
|
|
269
|
-
trackedSince?: string;
|
|
270
|
-
edges: Array<{
|
|
271
|
-
market: string;
|
|
272
|
-
entryPrice: number;
|
|
273
|
-
currentPrice: number;
|
|
274
|
-
returnPct: number;
|
|
275
|
-
}>;
|
|
276
|
-
};
|
|
277
|
-
confidenceHistory?: EvaluationSummary[];
|
|
278
|
-
edges?: Array<{
|
|
279
|
-
market: string;
|
|
280
|
-
marketPrice: number;
|
|
281
|
-
thesisPrice: number;
|
|
282
|
-
edge: number;
|
|
283
|
-
orderbook?: {
|
|
284
|
-
liquidityScore: string;
|
|
285
|
-
};
|
|
286
|
-
}>;
|
|
287
|
-
}
|
|
288
|
-
/** sf balance --json */
|
|
289
|
-
export interface BalanceOutput {
|
|
290
|
-
available: number;
|
|
291
|
-
total: number;
|
|
292
|
-
currency: string;
|
|
293
|
-
}
|
|
294
|
-
/** sf orders --json */
|
|
295
|
-
export type OrdersOutput = Array<{
|
|
296
|
-
orderId: string;
|
|
297
|
-
ticker: string;
|
|
298
|
-
side: string;
|
|
299
|
-
type: string;
|
|
300
|
-
price: number;
|
|
301
|
-
quantity: number;
|
|
302
|
-
remainingQuantity: number;
|
|
303
|
-
status: string;
|
|
304
|
-
createdAt: string;
|
|
305
|
-
}>;
|
|
306
|
-
/** sf fills --json */
|
|
307
|
-
export type FillsOutput = Array<{
|
|
308
|
-
tradeId: string;
|
|
309
|
-
ticker: string;
|
|
310
|
-
side: string;
|
|
311
|
-
price: number;
|
|
312
|
-
count: number;
|
|
313
|
-
createdAt: string;
|
|
314
|
-
}>;
|
|
315
|
-
/** sf performance --json */
|
|
316
|
-
export interface PerformanceOutput {
|
|
317
|
-
totalPnl: number;
|
|
318
|
-
realizedPnl: number;
|
|
319
|
-
unrealizedPnl: number;
|
|
320
|
-
winRate: number;
|
|
321
|
-
trades: number;
|
|
322
|
-
positions: Array<{
|
|
323
|
-
ticker: string;
|
|
324
|
-
side: string;
|
|
325
|
-
entryPrice: number;
|
|
326
|
-
currentPrice: number;
|
|
327
|
-
pnl: number;
|
|
328
|
-
returnPct: number;
|
|
329
|
-
}>;
|
|
330
|
-
}
|
|
331
|
-
/** sf feed --json */
|
|
332
|
-
export type FeedOutput = EvaluationSummary[];
|
|
333
|
-
/** sf milestones --json */
|
|
334
|
-
export type MilestonesOutput = Array<{
|
|
335
|
-
date: string;
|
|
336
|
-
ticker: string;
|
|
337
|
-
title: string;
|
|
338
|
-
category?: string;
|
|
339
|
-
}>;
|
|
340
|
-
/** sf history <ticker> --json */
|
|
341
|
-
export type HistoryOutput = Array<{
|
|
342
|
-
ts: string;
|
|
343
|
-
price: number;
|
|
344
|
-
volume?: number;
|
|
345
|
-
}>;
|
|
346
|
-
/** sf forecast <event> --json */
|
|
347
|
-
export interface ForecastOutput {
|
|
348
|
-
event: string;
|
|
349
|
-
markets: Array<{
|
|
350
|
-
ticker: string;
|
|
351
|
-
title: string;
|
|
352
|
-
price: number;
|
|
353
|
-
impliedProb: number;
|
|
354
|
-
}>;
|
|
355
|
-
distribution?: {
|
|
356
|
-
p10: number;
|
|
357
|
-
p25: number;
|
|
358
|
-
p50: number;
|
|
359
|
-
p75: number;
|
|
360
|
-
p90: number;
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
/** sf liquidity --json */
|
|
364
|
-
export interface LiquidityOutput {
|
|
365
|
-
markets: Array<{
|
|
366
|
-
ticker: string;
|
|
367
|
-
title: string;
|
|
368
|
-
venue: Venue;
|
|
369
|
-
spread: number;
|
|
370
|
-
bidDepth: number;
|
|
371
|
-
askDepth: number;
|
|
372
|
-
score: string;
|
|
373
|
-
}>;
|
|
374
|
-
}
|
|
375
|
-
/** sf book <ticker> --json */
|
|
376
|
-
export interface BookOutput {
|
|
377
|
-
ticker: string;
|
|
378
|
-
bids: Array<{
|
|
379
|
-
price: number;
|
|
380
|
-
quantity: number;
|
|
381
|
-
}>;
|
|
382
|
-
asks: Array<{
|
|
383
|
-
price: number;
|
|
384
|
-
quantity: number;
|
|
385
|
-
}>;
|
|
386
|
-
spread: number;
|
|
387
|
-
midPrice: number;
|
|
388
|
-
}
|
|
389
|
-
/** Wrapper used by --share to store snapshots */
|
|
390
|
-
export interface ShareSnapshot {
|
|
391
|
-
command: string;
|
|
392
|
-
args: string[];
|
|
393
|
-
timestamp: string;
|
|
394
|
-
data: unknown;
|
|
395
|
-
version: string;
|
|
396
|
-
}
|
|
397
|
-
/** Change event emitted by sf watch */
|
|
398
|
-
export interface WatchChangeEvent {
|
|
399
|
-
type: 'edge_change' | 'new_contract' | 'removed_contract' | 'price_move';
|
|
400
|
-
timestamp: string;
|
|
401
|
-
market: string;
|
|
402
|
-
venue: Venue;
|
|
403
|
-
before?: {
|
|
404
|
-
price: number;
|
|
405
|
-
edge?: number;
|
|
406
|
-
};
|
|
407
|
-
after: {
|
|
408
|
-
price: number;
|
|
409
|
-
edge?: number;
|
|
410
|
-
};
|
|
411
|
-
delta: number;
|
|
412
|
-
}
|
package/dist/types/output.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Stable JSON output schemas for all SF CLI commands.
|
|
4
|
-
*
|
|
5
|
-
* IMPORTANT: These types define the contract that --share and sf watch depend on.
|
|
6
|
-
* Breaking changes here cascade to the share renderer and watch differ.
|
|
7
|
-
* Add fields freely; removing or renaming fields is a breaking change.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/utils.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI formatting utilities
|
|
3
|
-
*
|
|
4
|
-
* ANSI escape codes only — no chalk dependency.
|
|
5
|
-
*/
|
|
6
|
-
export declare const c: {
|
|
7
|
-
readonly reset: "\u001B[0m";
|
|
8
|
-
readonly bold: "\u001B[1m";
|
|
9
|
-
readonly dim: "\u001B[2m";
|
|
10
|
-
readonly red: "\u001B[31m";
|
|
11
|
-
readonly green: "\u001B[32m";
|
|
12
|
-
readonly yellow: "\u001B[33m";
|
|
13
|
-
readonly blue: "\u001B[34m";
|
|
14
|
-
readonly magenta: "\u001B[35m";
|
|
15
|
-
readonly cyan: "\u001B[36m";
|
|
16
|
-
readonly white: "\u001B[37m";
|
|
17
|
-
readonly gray: "\u001B[90m";
|
|
18
|
-
};
|
|
19
|
-
/** Format a number as volume string: 1234567 → "1.2M", 12345 → "12K" */
|
|
20
|
-
export declare function vol(n: number | string | null | undefined): string;
|
|
21
|
-
/** Format a dollar amount as cents: 0.55 → "55¢" */
|
|
22
|
-
export declare function cents(n: number | string | null | undefined): string;
|
|
23
|
-
/** Format a probability as percentage: 0.82 → "82%" */
|
|
24
|
-
export declare function pct(n: number | string | null | undefined): string;
|
|
25
|
-
/** Format a confidence delta with arrow: +0.10 → "↑ +10%", -0.05 → "↓ -5%" */
|
|
26
|
-
export declare function delta(n: number): string;
|
|
27
|
-
/** Format ISO date string to short form: "2026-03-12T11:13:00Z" → "Mar 12 11:13" */
|
|
28
|
-
export declare function shortDate(iso: string | null | undefined): string;
|
|
29
|
-
/** Pad/truncate a string to exact width */
|
|
30
|
-
export declare function pad(s: string, width: number): string;
|
|
31
|
-
/** Right-align a string to exact width */
|
|
32
|
-
export declare function rpad(s: string, width: number): string;
|
|
33
|
-
/** Print a horizontal rule */
|
|
34
|
-
export declare function hr(width?: number): void;
|
|
35
|
-
/** Print an error and exit */
|
|
36
|
-
export declare function die(msg: string): never;
|
|
37
|
-
/** Print a section header */
|
|
38
|
-
export declare function header(title: string): void;
|
|
39
|
-
/** Truncate a string with ellipsis */
|
|
40
|
-
export declare function trunc(s: string, maxLen: number): string;
|
|
41
|
-
/** Short ID: first 8 chars of a UUID */
|
|
42
|
-
export declare function shortId(id: string): string;
|
package/dist/utils.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CLI formatting utilities
|
|
4
|
-
*
|
|
5
|
-
* ANSI escape codes only — no chalk dependency.
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.c = void 0;
|
|
9
|
-
exports.vol = vol;
|
|
10
|
-
exports.cents = cents;
|
|
11
|
-
exports.pct = pct;
|
|
12
|
-
exports.delta = delta;
|
|
13
|
-
exports.shortDate = shortDate;
|
|
14
|
-
exports.pad = pad;
|
|
15
|
-
exports.rpad = rpad;
|
|
16
|
-
exports.hr = hr;
|
|
17
|
-
exports.die = die;
|
|
18
|
-
exports.header = header;
|
|
19
|
-
exports.trunc = trunc;
|
|
20
|
-
exports.shortId = shortId;
|
|
21
|
-
// ===== ANSI Colors =====
|
|
22
|
-
exports.c = {
|
|
23
|
-
reset: '\x1b[0m',
|
|
24
|
-
bold: '\x1b[1m',
|
|
25
|
-
dim: '\x1b[2m',
|
|
26
|
-
red: '\x1b[31m',
|
|
27
|
-
green: '\x1b[32m',
|
|
28
|
-
yellow: '\x1b[33m',
|
|
29
|
-
blue: '\x1b[34m',
|
|
30
|
-
magenta: '\x1b[35m',
|
|
31
|
-
cyan: '\x1b[36m',
|
|
32
|
-
white: '\x1b[37m',
|
|
33
|
-
gray: '\x1b[90m',
|
|
34
|
-
};
|
|
35
|
-
// ===== Formatting helpers =====
|
|
36
|
-
/** Format a number as volume string: 1234567 → "1.2M", 12345 → "12K" */
|
|
37
|
-
function vol(n) {
|
|
38
|
-
if (n === null || n === undefined)
|
|
39
|
-
return '-';
|
|
40
|
-
const v = typeof n === 'string' ? parseFloat(n) : n;
|
|
41
|
-
if (isNaN(v))
|
|
42
|
-
return '-';
|
|
43
|
-
if (v >= 1_000_000)
|
|
44
|
-
return `${(v / 1_000_000).toFixed(1)}M`;
|
|
45
|
-
if (v >= 1_000)
|
|
46
|
-
return `${(v / 1_000).toFixed(0)}K`;
|
|
47
|
-
return v.toString();
|
|
48
|
-
}
|
|
49
|
-
/** Format a dollar amount as cents: 0.55 → "55¢" */
|
|
50
|
-
function cents(n) {
|
|
51
|
-
if (n === null || n === undefined)
|
|
52
|
-
return '-';
|
|
53
|
-
const v = typeof n === 'string' ? parseFloat(n) : n;
|
|
54
|
-
if (isNaN(v))
|
|
55
|
-
return '-';
|
|
56
|
-
return `${Math.round(v * 100)}¢`;
|
|
57
|
-
}
|
|
58
|
-
/** Format a probability as percentage: 0.82 → "82%" */
|
|
59
|
-
function pct(n) {
|
|
60
|
-
if (n === null || n === undefined)
|
|
61
|
-
return '-';
|
|
62
|
-
const v = typeof n === 'string' ? parseFloat(n) : n;
|
|
63
|
-
if (isNaN(v))
|
|
64
|
-
return '-';
|
|
65
|
-
return `${Math.round(v * 100)}%`;
|
|
66
|
-
}
|
|
67
|
-
/** Format a confidence delta with arrow: +0.10 → "↑ +10%", -0.05 → "↓ -5%" */
|
|
68
|
-
function delta(n) {
|
|
69
|
-
const arrow = n > 0 ? '↑' : n < 0 ? '↓' : '→';
|
|
70
|
-
const sign = n > 0 ? '+' : '';
|
|
71
|
-
return `${arrow} ${sign}${Math.round(n * 100)}%`;
|
|
72
|
-
}
|
|
73
|
-
/** Format ISO date string to short form: "2026-03-12T11:13:00Z" → "Mar 12 11:13" */
|
|
74
|
-
function shortDate(iso) {
|
|
75
|
-
if (!iso)
|
|
76
|
-
return '-';
|
|
77
|
-
try {
|
|
78
|
-
const d = new Date(iso);
|
|
79
|
-
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
80
|
-
const month = months[d.getMonth()];
|
|
81
|
-
const day = d.getDate();
|
|
82
|
-
const hours = d.getHours().toString().padStart(2, '0');
|
|
83
|
-
const mins = d.getMinutes().toString().padStart(2, '0');
|
|
84
|
-
return `${month} ${day} ${hours}:${mins}`;
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return iso.slice(0, 16);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/** Pad/truncate a string to exact width */
|
|
91
|
-
function pad(s, width) {
|
|
92
|
-
if (s.length >= width)
|
|
93
|
-
return s.slice(0, width);
|
|
94
|
-
return s + ' '.repeat(width - s.length);
|
|
95
|
-
}
|
|
96
|
-
/** Right-align a string to exact width */
|
|
97
|
-
function rpad(s, width) {
|
|
98
|
-
if (s.length >= width)
|
|
99
|
-
return s.slice(0, width);
|
|
100
|
-
return ' '.repeat(width - s.length) + s;
|
|
101
|
-
}
|
|
102
|
-
/** Print a horizontal rule */
|
|
103
|
-
function hr(width = 80) {
|
|
104
|
-
console.log(exports.c.dim + '─'.repeat(width) + exports.c.reset);
|
|
105
|
-
}
|
|
106
|
-
/** Print an error and exit */
|
|
107
|
-
function die(msg) {
|
|
108
|
-
console.error(`${exports.c.red}Error:${exports.c.reset} ${msg}`);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
/** Print a section header */
|
|
112
|
-
function header(title) {
|
|
113
|
-
console.log(`\n${exports.c.bold}${exports.c.cyan}${title}${exports.c.reset}`);
|
|
114
|
-
}
|
|
115
|
-
/** Truncate a string with ellipsis */
|
|
116
|
-
function trunc(s, maxLen) {
|
|
117
|
-
if (s.length <= maxLen)
|
|
118
|
-
return s;
|
|
119
|
-
return s.slice(0, maxLen - 1) + '…';
|
|
120
|
-
}
|
|
121
|
-
/** Short ID: first 8 chars of a UUID */
|
|
122
|
-
function shortId(id) {
|
|
123
|
-
return id.slice(0, 8);
|
|
124
|
-
}
|
package/dist/utils.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|