pythx-cli 0.1.2 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/cli.js +44 -50
  2. package/package.json +4 -3
package/dist/cli.js CHANGED
@@ -201,10 +201,10 @@ function DetailPanel({ analysis, windows, selectedWindow }) {
201
201
  // src/components/sentiment-chart.tsx
202
202
  import { Box as Box5, Text as Text5 } from "ink";
203
203
  import chalk5 from "chalk";
204
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
205
- var CHART_HEIGHT = 9;
206
- var COL_WIDTH = 5;
207
- var NEUTRAL_ROW = 4;
204
+ import { jsx as jsx5 } from "react/jsx-runtime";
205
+ var CHART_HEIGHT = 7;
206
+ var COL_WIDTH = 4;
207
+ var NEUTRAL_ROW = 3;
208
208
  function scoreToRow(score) {
209
209
  const clamped = Math.max(-1, Math.min(1, score));
210
210
  return Math.round((1 - clamped) / 2 * (CHART_HEIGHT - 1));
@@ -217,11 +217,11 @@ function SentimentChart({ windows, selectedWindow }) {
217
217
  const lines = [];
218
218
  for (let row = 0; row < CHART_HEIGHT; row++) {
219
219
  let yLabel;
220
- if (row === 0) yLabel = chalk5.green(" Pos");
221
- else if (row === NEUTRAL_ROW) yLabel = chalk5.dim(" Neu");
222
- else if (row === CHART_HEIGHT - 1) yLabel = chalk5.red(" Neg");
223
- else yLabel = " ";
224
- let line = yLabel + chalk5.dim(" \u2502");
220
+ if (row === 0) yLabel = chalk5.green(" +");
221
+ else if (row === NEUTRAL_ROW) yLabel = chalk5.dim(" 0");
222
+ else if (row === CHART_HEIGHT - 1) yLabel = chalk5.red(" -");
223
+ else yLabel = " ";
224
+ let line = yLabel + chalk5.dim("\u2502");
225
225
  for (let col = 0; col < cols.length; col++) {
226
226
  const dr = dataRows[col];
227
227
  const score = scores[col];
@@ -229,53 +229,50 @@ function SentimentChart({ windows, selectedWindow }) {
229
229
  const isNegative = score < -0.05;
230
230
  const isSelected = cols[col].window === selectedWindow;
231
231
  const marker = isPositive ? "\u25B2" : isNegative ? "\u25BC" : "\u25C6";
232
+ const color = isPositive ? chalk5.green : isNegative ? chalk5.red : chalk5.white;
232
233
  if (row === dr) {
233
- const color = isPositive ? chalk5.green : isNegative ? chalk5.red : chalk5.white;
234
- const markerStr = isSelected ? chalk5.bold(color(` ${marker}`)) : color(` ${marker}`);
235
234
  if (row === NEUTRAL_ROW) {
236
- line += chalk5.dim("\u2500\u2500") + (isSelected ? chalk5.bold(color(marker)) : color(marker)) + chalk5.dim("\u2500\u2500");
237
- line = line;
235
+ line += chalk5.dim("\u2500") + (isSelected ? chalk5.bold(color(marker)) : color(marker)) + chalk5.dim("\u2500\u2500");
238
236
  } else {
239
- line += markerStr + " ".repeat(Math.max(0, COL_WIDTH - 2));
237
+ const m = isSelected ? chalk5.bold(color(marker)) : color(marker);
238
+ line += " " + m + " ";
240
239
  }
241
240
  } else if (row === NEUTRAL_ROW) {
242
- line += chalk5.dim("\u2500".repeat(COL_WIDTH));
241
+ line += chalk5.dim("\u2500\u2500\u2500\u2500");
243
242
  } else if (isPositive && row > dr && row < NEUTRAL_ROW) {
244
- const fillChar = isSelected ? "\u2588" : "\u2591";
245
- line += chalk5.green(` ${fillChar}` + " ".repeat(Math.max(0, COL_WIDTH - 2)));
243
+ const ch = isSelected ? "\u2588" : "\u2591";
244
+ line += " " + chalk5.green(ch) + " ";
246
245
  } else if (isNegative && row < dr && row > NEUTRAL_ROW) {
247
- const fillChar = isSelected ? "\u2588" : "\u2591";
248
- line += chalk5.red(` ${fillChar}` + " ".repeat(Math.max(0, COL_WIDTH - 2)));
246
+ const ch = isSelected ? "\u2588" : "\u2591";
247
+ line += " " + chalk5.red(ch) + " ";
249
248
  } else {
250
- line += " ".repeat(COL_WIDTH);
249
+ line += " ";
251
250
  }
252
251
  }
253
252
  lines.push(line);
254
253
  }
255
- let xAxis = " " + chalk5.dim("\u2514");
254
+ let xAxis = " " + chalk5.dim("\u2514");
256
255
  for (let i = 0; i < cols.length; i++) {
257
256
  xAxis += chalk5.dim("\u2500".repeat(COL_WIDTH));
258
257
  }
259
258
  lines.push(xAxis);
260
- let xLabels = " ";
259
+ let xLabels = " ";
261
260
  for (const w of cols) {
261
+ const short = w.label.length > 3 ? w.label.substring(0, 3) : w.label;
262
262
  if (w.window === selectedWindow) {
263
- xLabels += chalk5.white.bold(w.label.padEnd(COL_WIDTH));
263
+ xLabels += chalk5.white.bold(short.padEnd(COL_WIDTH));
264
264
  } else {
265
- xLabels += chalk5.dim(w.label.padEnd(COL_WIDTH));
265
+ xLabels += chalk5.dim(short.padEnd(COL_WIDTH));
266
266
  }
267
267
  }
268
268
  lines.push(xLabels);
269
- return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 1, children: [
270
- /* @__PURE__ */ jsx5(Text5, { children: chalk5.dim("SENTIMENT") }),
271
- lines.map((l, i) => /* @__PURE__ */ jsx5(Text5, { children: l }, i))
272
- ] });
269
+ return /* @__PURE__ */ jsx5(Box5, { flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 1, children: lines.map((l, i) => /* @__PURE__ */ jsx5(Text5, { children: l }, i)) });
273
270
  }
274
271
 
275
272
  // src/components/status-bar.tsx
276
273
  import { Box as Box6, Text as Text6 } from "ink";
277
274
  import chalk6 from "chalk";
278
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
275
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
279
276
  function StatusBar() {
280
277
  return /* @__PURE__ */ jsx6(
281
278
  Box6,
@@ -284,7 +281,7 @@ function StatusBar() {
284
281
  borderColor: "gray",
285
282
  paddingX: 1,
286
283
  justifyContent: "center",
287
- children: /* @__PURE__ */ jsxs6(Text6, { children: [
284
+ children: /* @__PURE__ */ jsxs5(Text6, { children: [
288
285
  chalk6.dim("\u2591 "),
289
286
  chalk6.white("q"),
290
287
  chalk6.dim(":quit "),
@@ -731,19 +728,21 @@ function rowToPost(row) {
731
728
 
732
729
  // ../core/src/windows.ts
733
730
  import { and, eq as eq2, gte } from "drizzle-orm";
731
+ var HOUR = 60 * 60 * 1e3;
732
+ var DAY = 24 * HOUR;
734
733
  var WINDOW_DEFS = {
735
734
  "1min": { label: "1MIN", ms: 60 * 1e3 },
736
735
  "5min": { label: "5MIN", ms: 5 * 60 * 1e3 },
737
736
  "15min": { label: "15MIN", ms: 15 * 60 * 1e3 },
738
- "1hr": { label: "1HR", ms: 60 * 60 * 1e3 },
739
- "6hr": { label: "6HR", ms: 6 * 60 * 60 * 1e3 },
740
- now: { label: "Now", ms: 6 * 60 * 60 * 1e3 },
741
- "1d": { label: "1D", ms: 24 * 60 * 60 * 1e3 },
742
- "1w": { label: "1W", ms: 7 * 24 * 60 * 60 * 1e3 },
743
- "1m": { label: "1M", ms: 30 * 24 * 60 * 60 * 1e3 },
744
- "90d": { label: "90D", ms: 90 * 24 * 60 * 60 * 1e3 },
745
- "6m": { label: "6M", ms: 180 * 24 * 60 * 60 * 1e3 },
746
- "12m": { label: "12M", ms: 365 * 24 * 60 * 60 * 1e3 }
737
+ "1hr": { label: "1HR", ms: HOUR },
738
+ "6hr": { label: "6HR", ms: 6 * HOUR },
739
+ now: { label: "Now", ms: 6 * HOUR },
740
+ "1d": { label: "D", ms: DAY },
741
+ "1w": { label: "W", ms: 7 * DAY },
742
+ "1m": { label: "M", ms: 30 * DAY },
743
+ "90d": { label: "90D", ms: 90 * DAY },
744
+ "6m": { label: "6M", ms: 180 * DAY },
745
+ "12m": { label: "12M", ms: 365 * DAY }
747
746
  };
748
747
  var ALL_WINDOWS = [
749
748
  "now",
@@ -866,7 +865,7 @@ function useLiveData(apiUrl2) {
866
865
  }
867
866
 
868
867
  // src/app.tsx
869
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
868
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
870
869
  function App({ apiUrl: apiUrl2 }) {
871
870
  const { data, timeSeries, loading, error, lastUpdated, refresh } = useLiveData(apiUrl2);
872
871
  const [activeIndex, setActiveIndex] = useState3(0);
@@ -899,11 +898,11 @@ function App({ apiUrl: apiUrl2 }) {
899
898
  });
900
899
  const activeAnalysis = data[activeIndex];
901
900
  const activeWindows = timeSeries.find((ts) => ts.entity.id === activeAnalysis?.entity.id)?.windows;
902
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
901
+ return /* @__PURE__ */ jsxs6(Box7, { flexDirection: "column", children: [
903
902
  /* @__PURE__ */ jsx7(Header, { lastUpdated, loading }),
904
903
  error && /* @__PURE__ */ jsx7(Box7, { paddingX: 1, children: /* @__PURE__ */ jsx7(Text7, { children: chalk7.red(`Error: ${error}`) }) }),
905
- loading && data.length === 0 ? /* @__PURE__ */ jsx7(Box7, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsx7(Text7, { children: chalk7.yellow("\u27F3 Fetching sentiment data...") }) }) : /* @__PURE__ */ jsxs7(Box7, { flexDirection: "row", alignItems: "flex-start", children: [
906
- /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, flexGrow: 1, children: [
904
+ loading && data.length === 0 ? /* @__PURE__ */ jsx7(Box7, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsx7(Text7, { children: chalk7.yellow("\u27F3 Fetching sentiment data...") }) }) : /* @__PURE__ */ jsxs6(Box7, { flexDirection: "row", alignItems: "flex-start", children: [
905
+ /* @__PURE__ */ jsxs6(Box7, { flexDirection: "column", paddingX: 1, flexGrow: 1, children: [
907
906
  /* @__PURE__ */ jsx7(Box7, { marginY: 1, children: /* @__PURE__ */ jsx7(Text7, { children: chalk7.dim(
908
907
  " " + "ENTITY".padEnd(COL.name) + "SCORE".padStart(COL.score) + " " + "TREND".padEnd(COL.trend) + "POS".padStart(COL.stat) + "NEU".padStart(COL.stat) + "NEG".padStart(COL.stat) + "TOT".padStart(COL.stat)
909
908
  ) }) }),
@@ -933,7 +932,7 @@ function App({ apiUrl: apiUrl2 }) {
933
932
 
934
933
  // src/cli.tsx
935
934
  import { jsx as jsx8 } from "react/jsx-runtime";
936
- var DEFAULT_API_URL = "https://pythx.vercel.app";
935
+ var DEFAULT_API_URL = "https://pythx.zachj.xyz";
937
936
  var cli = meow(
938
937
  `
939
938
  Usage
@@ -962,9 +961,4 @@ var cli = meow(
962
961
  }
963
962
  );
964
963
  var apiUrl = cli.flags.direct ? void 0 : cli.flags.apiUrl ?? DEFAULT_API_URL;
965
- process.stdout.write("\x1B[?1049h");
966
- process.stdout.write("\x1B[H");
967
- var instance = render(/* @__PURE__ */ jsx8(App, { apiUrl }), { patchConsole: false });
968
- instance.waitUntilExit().then(() => {
969
- process.stdout.write("\x1B[?1049l");
970
- });
964
+ render(/* @__PURE__ */ jsx8(App, { apiUrl }), { patchConsole: false });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pythx-cli",
3
- "version": "0.1.2",
4
- "description": "Real-time sentiment intelligence terminal for prediction markets",
3
+ "version": "0.1.4",
4
+ "description": "Real-time sentiment intelligence terminal",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "pythx": "./bin/pythx.js"
@@ -39,7 +39,8 @@
39
39
  "tui",
40
40
  "prediction-markets",
41
41
  "sentiment-analysis",
42
- "x-api"
42
+ "x-api",
43
+ "hugging-face"
43
44
  ],
44
45
  "author": "ZachJxyz",
45
46
  "repository": {