pythx-cli 0.1.1 → 0.1.3

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 +33 -41
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -192,7 +192,7 @@ function DetailPanel({ analysis, windows, selectedWindow }) {
192
192
  ] })
193
193
  ] }),
194
194
  windows && windows.length > 0 && /* @__PURE__ */ jsx4(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx4(WindowBar, { windows, selected: selectedWindow }) }),
195
- /* @__PURE__ */ jsx4(Box4, { marginTop: 1, flexDirection: "column", children: sortedPosts.length === 0 ? /* @__PURE__ */ jsx4(Text4, { children: chalk4.dim(" No posts to display") }) : sortedPosts.slice(0, 8).map((post) => /* @__PURE__ */ jsx4(Text4, { children: formatPost(post) }, post.id)) })
195
+ /* @__PURE__ */ jsx4(Box4, { marginTop: 1, flexDirection: "column", children: sortedPosts.length === 0 ? /* @__PURE__ */ jsx4(Text4, { children: chalk4.dim(" No posts to display") }) : sortedPosts.slice(0, 4).map((post) => /* @__PURE__ */ jsx4(Text4, { children: formatPost(post) }, post.id)) })
196
196
  ]
197
197
  }
198
198
  );
@@ -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 "),
@@ -866,7 +863,7 @@ function useLiveData(apiUrl2) {
866
863
  }
867
864
 
868
865
  // src/app.tsx
869
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
866
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
870
867
  function App({ apiUrl: apiUrl2 }) {
871
868
  const { data, timeSeries, loading, error, lastUpdated, refresh } = useLiveData(apiUrl2);
872
869
  const [activeIndex, setActiveIndex] = useState3(0);
@@ -899,11 +896,11 @@ function App({ apiUrl: apiUrl2 }) {
899
896
  });
900
897
  const activeAnalysis = data[activeIndex];
901
898
  const activeWindows = timeSeries.find((ts) => ts.entity.id === activeAnalysis?.entity.id)?.windows;
902
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
899
+ return /* @__PURE__ */ jsxs6(Box7, { flexDirection: "column", children: [
903
900
  /* @__PURE__ */ jsx7(Header, { lastUpdated, loading }),
904
901
  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: [
902
+ 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: [
903
+ /* @__PURE__ */ jsxs6(Box7, { flexDirection: "column", paddingX: 1, flexGrow: 1, children: [
907
904
  /* @__PURE__ */ jsx7(Box7, { marginY: 1, children: /* @__PURE__ */ jsx7(Text7, { children: chalk7.dim(
908
905
  " " + "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
906
  ) }) }),
@@ -962,9 +959,4 @@ var cli = meow(
962
959
  }
963
960
  );
964
961
  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
- });
962
+ render(/* @__PURE__ */ jsx8(App, { apiUrl }), { patchConsole: false });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pythx-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Real-time sentiment intelligence terminal for prediction markets",
5
5
  "type": "module",
6
6
  "bin": {