@polterware/polterbase 0.2.1 → 0.2.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 (3) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +65 -42
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @polterware/polterbase
2
2
 
3
+ ![Polterbase running](docs/assets/polterbase-hero.png)
4
+
3
5
  [![npm version](https://img.shields.io/npm/v/%40polterware%2Fpolterbase.svg)](https://www.npmjs.com/package/@polterware/polterbase)
4
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
7
  [![Node.js](https://img.shields.io/badge/Node.js-18%2B-green.svg)](https://nodejs.org/)
package/dist/index.js CHANGED
@@ -6,7 +6,6 @@ import { render } from "ink";
6
6
 
7
7
  // src/app.tsx
8
8
  import { Box as Box13, Text as Text12, useApp } from "ink";
9
- import pc2 from "picocolors";
10
9
 
11
10
  // src/hooks/useNavigation.ts
12
11
  import { useState, useCallback } from "react";
@@ -35,23 +34,38 @@ import { Box as Box4, Text as Text4 } from "ink";
35
34
  import { Box, Text } from "ink";
36
35
 
37
36
  // src/theme.ts
37
+ import { createRequire } from "module";
38
38
  import pc from "picocolors";
39
- var VERSION = "0.1.2";
39
+ var require2 = createRequire(import.meta.url);
40
+ var packageJson = require2("../package.json");
41
+ var SUPABASE_HEX = "#3ECF8E";
42
+ var SUPABASE_FG = "\x1B[38;2;62;207;142m";
43
+ var SUPABASE_BG = "\x1B[48;2;62;207;142m";
44
+ var RESET_FG = "\x1B[39m";
45
+ var RESET_BG = "\x1B[49m";
46
+ var wrapAnsi = (open, close) => (input) => pc.isColorSupported ? `${open}${input}${close}` : input;
47
+ var supabase = wrapAnsi(SUPABASE_FG, RESET_FG);
48
+ var supabaseBg = wrapAnsi(SUPABASE_BG, RESET_BG);
49
+ var VERSION = packageJson.version;
50
+ var inkColors = {
51
+ accent: SUPABASE_HEX,
52
+ accentContrast: "#081116"
53
+ };
40
54
  var colors = {
41
- primary: pc.cyan,
42
- primaryBold: (s) => pc.bold(pc.cyan(s)),
43
- accent: pc.magenta,
44
- accentBold: (s) => pc.bold(pc.magenta(s)),
45
- success: pc.green,
46
- successBold: (s) => pc.bold(pc.green(s)),
55
+ primary: supabase,
56
+ primaryBold: (s) => pc.bold(supabase(s)),
57
+ accent: supabase,
58
+ accentBold: (s) => pc.bold(supabase(s)),
59
+ success: supabase,
60
+ successBold: (s) => pc.bold(supabase(s)),
47
61
  error: pc.red,
48
62
  errorBold: (s) => pc.bold(pc.red(s)),
49
- warning: pc.yellow,
50
- warningBold: (s) => pc.bold(pc.yellow(s)),
63
+ warning: supabase,
64
+ warningBold: (s) => pc.bold(supabase(s)),
51
65
  dim: pc.dim,
52
66
  bold: pc.bold,
53
67
  white: pc.white,
54
- highlight: (s) => pc.bgCyan(pc.black(pc.bold(s)))
68
+ highlight: (s) => supabaseBg(pc.black(pc.bold(s)))
55
69
  };
56
70
  var ghost = {
57
71
  art: [
@@ -70,16 +84,24 @@ var ghost = {
70
84
  import { jsx, jsxs } from "react/jsx-runtime";
71
85
  function GhostBanner() {
72
86
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", alignItems: "flex-start", gap: 2, marginBottom: 1, children: [
73
- /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: ghost.art.map((line, i) => /* @__PURE__ */ jsx(Text, { color: "cyan", children: line }, i)) }),
87
+ /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: ghost.art.map((line, i) => /* @__PURE__ */ jsx(Text, { color: inkColors.accent, children: line }, i)) }),
74
88
  /* @__PURE__ */ jsxs(
75
89
  Box,
76
90
  {
77
91
  flexDirection: "column",
78
92
  borderStyle: "single",
79
- borderColor: "cyan",
93
+ borderColor: inkColors.accent,
80
94
  paddingX: 1,
81
95
  children: [
82
- /* @__PURE__ */ jsx(Text, { backgroundColor: "cyan", color: "black", bold: true, children: " POLTERBASE " }),
96
+ /* @__PURE__ */ jsx(
97
+ Text,
98
+ {
99
+ backgroundColor: inkColors.accent,
100
+ color: inkColors.accentContrast,
101
+ bold: true,
102
+ children: " POLTERBASE "
103
+ }
104
+ ),
83
105
  /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
84
106
  "Version: ",
85
107
  VERSION
@@ -305,11 +327,11 @@ function SelectList({
305
327
  const renderSelectableRow = (item, globalIdx) => {
306
328
  const isSelected = globalIdx === selectedItemIndex;
307
329
  return /* @__PURE__ */ jsxs2(Box2, { gap: 1, children: [
308
- /* @__PURE__ */ jsx2(Text2, { color: isSelected ? "cyan" : void 0, children: isSelected ? "\u276F" : " " }),
330
+ /* @__PURE__ */ jsx2(Text2, { color: isSelected ? inkColors.accent : void 0, children: isSelected ? "\u276F" : " " }),
309
331
  /* @__PURE__ */ jsx2(Box2, { width: labelWidth, children: /* @__PURE__ */ jsxs2(
310
332
  Text2,
311
333
  {
312
- color: isSelected ? "cyan" : isPinnedRow(item) ? "white" : void 0,
334
+ color: isSelected ? inkColors.accent : isPinnedRow(item) ? "white" : void 0,
313
335
  bold: isSelected || isPinnedRow(item),
314
336
  children: [
315
337
  item.icon ? `${item.icon} ` : "",
@@ -325,7 +347,7 @@ function SelectList({
325
347
  showScrollUp && /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: " \u2191 more" }),
326
348
  boxedSections ? boxedLayout.map((section) => {
327
349
  if (section.type === "heading") {
328
- return /* @__PURE__ */ jsx2(Box2, { children: /* @__PURE__ */ jsx2(Text2, { color: "yellow", bold: true, children: section.label }) }, section.key);
350
+ return /* @__PURE__ */ jsx2(Box2, { children: /* @__PURE__ */ jsx2(Text2, { color: inkColors.accent, bold: true, children: section.label }) }, section.key);
329
351
  }
330
352
  const hasSelectedRow = section.rows.some(
331
353
  (row) => row.globalIndex === selectedItemIndex
@@ -338,10 +360,11 @@ function SelectList({
338
360
  {
339
361
  flexDirection: "column",
340
362
  borderStyle: "round",
341
- borderColor: hasSelectedRow ? "cyan" : isPinnedSection ? "green" : "yellow",
363
+ borderColor: inkColors.accent,
364
+ borderDimColor: !hasSelectedRow && !isPinnedSection,
342
365
  paddingX: 1,
343
366
  children: [
344
- section.title && /* @__PURE__ */ jsx2(Text2, { color: hasSelectedRow ? "cyan" : "yellow", bold: true, children: section.title }),
367
+ section.title && /* @__PURE__ */ jsx2(Text2, { color: inkColors.accent, bold: true, children: section.title }),
345
368
  /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", children: section.rows.map(
346
369
  (row) => renderSelectableRow(row.item, row.globalIndex)
347
370
  ) })
@@ -357,7 +380,7 @@ function SelectList({
357
380
  Box2,
358
381
  {
359
382
  marginTop: i === 0 ? 0 : 1,
360
- children: /* @__PURE__ */ jsx2(Text2, { color: "yellow", bold: true, children: item.label })
383
+ children: /* @__PURE__ */ jsx2(Text2, { color: inkColors.accent, bold: true, children: item.label })
361
384
  },
362
385
  item.id ?? `${item.value}-${globalIdx}`
363
386
  );
@@ -777,7 +800,7 @@ function MainMenu({
777
800
  return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
778
801
  /* @__PURE__ */ jsx4(GhostBanner, {}),
779
802
  /* @__PURE__ */ jsx4(Box4, { marginBottom: 1, children: /* @__PURE__ */ jsx4(Text4, { bold: true, children: "Choose a command, then press Enter to continue." }) }),
780
- pinFeedback && /* @__PURE__ */ jsx4(Box4, { marginBottom: 1, children: /* @__PURE__ */ jsxs4(Text4, { color: "green", children: [
803
+ pinFeedback && /* @__PURE__ */ jsx4(Box4, { marginBottom: 1, children: /* @__PURE__ */ jsxs4(Text4, { color: inkColors.accent, children: [
781
804
  "\u2713 ",
782
805
  pinFeedback
783
806
  ] }) }),
@@ -830,11 +853,11 @@ function TextPrompt({
830
853
  };
831
854
  return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
832
855
  /* @__PURE__ */ jsxs5(Box5, { gap: 1, children: [
833
- /* @__PURE__ */ jsx5(Text5, { color: "cyan", bold: true, children: "?" }),
856
+ /* @__PURE__ */ jsx5(Text5, { color: inkColors.accent, bold: true, children: "?" }),
834
857
  /* @__PURE__ */ jsx5(Text5, { children: label })
835
858
  ] }),
836
859
  /* @__PURE__ */ jsxs5(Box5, { gap: 1, marginLeft: 2, children: [
837
- /* @__PURE__ */ jsx5(Text5, { color: "cyan", children: "\u276F" }),
860
+ /* @__PURE__ */ jsx5(Text5, { color: inkColors.accent, children: "\u276F" }),
838
861
  /* @__PURE__ */ jsx5(
839
862
  TextInputComponent,
840
863
  {
@@ -1028,7 +1051,7 @@ function CommandArgs({
1028
1051
  if (phase === "custom") {
1029
1052
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1030
1053
  /* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, gap: 1, children: [
1031
- /* @__PURE__ */ jsx6(Text6, { color: "cyan", bold: true, children: "Command" }),
1054
+ /* @__PURE__ */ jsx6(Text6, { color: inkColors.accent, bold: true, children: "Command" }),
1032
1055
  /* @__PURE__ */ jsx6(Text6, { children: command })
1033
1056
  ] }),
1034
1057
  /* @__PURE__ */ jsx6(
@@ -1062,10 +1085,10 @@ function CommandArgs({
1062
1085
  );
1063
1086
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1064
1087
  /* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, gap: 1, children: [
1065
- /* @__PURE__ */ jsx6(Text6, { color: "cyan", bold: true, children: "Command" }),
1088
+ /* @__PURE__ */ jsx6(Text6, { color: inkColors.accent, bold: true, children: "Command" }),
1066
1089
  /* @__PURE__ */ jsx6(Text6, { children: command })
1067
1090
  ] }),
1068
- pinFeedback && /* @__PURE__ */ jsx6(Box6, { marginBottom: 1, children: /* @__PURE__ */ jsxs6(Text6, { color: "green", children: [
1091
+ pinFeedback && /* @__PURE__ */ jsx6(Box6, { marginBottom: 1, children: /* @__PURE__ */ jsxs6(Text6, { color: inkColors.accent, children: [
1069
1092
  "\u2713 ",
1070
1093
  pinFeedback
1071
1094
  ] }) }),
@@ -1194,18 +1217,18 @@ function FlagToggle({
1194
1217
  });
1195
1218
  return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1196
1219
  /* @__PURE__ */ jsxs8(Box8, { marginBottom: 1, children: [
1197
- /* @__PURE__ */ jsx8(Text7, { bold: true, color: "cyan", children: "\u2691 Global Flags" }),
1220
+ /* @__PURE__ */ jsx8(Text7, { bold: true, color: inkColors.accent, children: "\u2691 Global Flags" }),
1198
1221
  /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " (Space to toggle, Enter to confirm)" })
1199
1222
  ] }),
1200
1223
  flags.map((flag, i) => {
1201
1224
  const isActive = cursor === i;
1202
1225
  const isChecked = selected.has(flag.value);
1203
1226
  return /* @__PURE__ */ jsxs8(Box8, { gap: 1, children: [
1204
- /* @__PURE__ */ jsx8(Text7, { color: isActive ? "cyan" : void 0, children: isActive ? "\u276F" : " " }),
1227
+ /* @__PURE__ */ jsx8(Text7, { color: isActive ? inkColors.accent : void 0, children: isActive ? "\u276F" : " " }),
1205
1228
  /* @__PURE__ */ jsx8(
1206
1229
  Text7,
1207
1230
  {
1208
- color: isChecked ? "green" : isActive ? "cyan" : void 0,
1231
+ color: isChecked || isActive ? inkColors.accent : void 0,
1209
1232
  bold: isChecked,
1210
1233
  children: isChecked ? "\u25C9" : "\u25CB"
1211
1234
  }
@@ -1213,7 +1236,7 @@ function FlagToggle({
1213
1236
  /* @__PURE__ */ jsx8(
1214
1237
  Text7,
1215
1238
  {
1216
- color: isActive ? "cyan" : void 0,
1239
+ color: isActive ? inkColors.accent : void 0,
1217
1240
  bold: isActive,
1218
1241
  children: flag.label
1219
1242
  }
@@ -1274,7 +1297,7 @@ import InkSpinner from "ink-spinner";
1274
1297
  import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1275
1298
  function Spinner({
1276
1299
  label = "Running...",
1277
- color = "cyan"
1300
+ color = inkColors.accent
1278
1301
  }) {
1279
1302
  return /* @__PURE__ */ jsxs10(Text8, { children: [
1280
1303
  /* @__PURE__ */ jsx10(Text8, { color, children: /* @__PURE__ */ jsx10(InkSpinner, { type: "dots" }) }),
@@ -1301,7 +1324,7 @@ function ConfirmPrompt({
1301
1324
  }
1302
1325
  });
1303
1326
  return /* @__PURE__ */ jsxs11(Box10, { gap: 1, children: [
1304
- /* @__PURE__ */ jsx11(Text9, { color: "cyan", bold: true, children: "?" }),
1327
+ /* @__PURE__ */ jsx11(Text9, { color: inkColors.accent, bold: true, children: "?" }),
1305
1328
  /* @__PURE__ */ jsx11(Text9, { children: message }),
1306
1329
  /* @__PURE__ */ jsx11(Text9, { dimColor: true, children: defaultValue ? "(Y/n)" : "(y/N)" })
1307
1330
  ] });
@@ -1460,7 +1483,7 @@ function CommandExecution({
1460
1483
  return /* @__PURE__ */ jsxs13(Box12, { flexDirection: "column", children: [
1461
1484
  /* @__PURE__ */ jsx13(Divider, {}),
1462
1485
  /* @__PURE__ */ jsxs13(Box12, { marginY: 1, gap: 1, children: [
1463
- /* @__PURE__ */ jsx13(Text11, { color: "cyan", bold: true, children: "\u25B6" }),
1486
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, bold: true, children: "\u25B6" }),
1464
1487
  /* @__PURE__ */ jsx13(Text11, { dimColor: true, children: "Running:" }),
1465
1488
  /* @__PURE__ */ jsx13(Text11, { children: cmdDisplay })
1466
1489
  ] }),
@@ -1472,8 +1495,8 @@ function CommandExecution({
1472
1495
  return /* @__PURE__ */ jsxs13(Box12, { flexDirection: "column", children: [
1473
1496
  /* @__PURE__ */ jsx13(Divider, {}),
1474
1497
  /* @__PURE__ */ jsxs13(Box12, { marginY: 1, gap: 1, children: [
1475
- /* @__PURE__ */ jsx13(Text11, { color: "green", bold: true, children: "\u2713" }),
1476
- /* @__PURE__ */ jsx13(Text11, { color: "green", bold: true, children: "Command completed successfully!" })
1498
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, bold: true, children: "\u2713" }),
1499
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, bold: true, children: "Command completed successfully!" })
1477
1500
  ] }),
1478
1501
  /* @__PURE__ */ jsx13(
1479
1502
  ConfirmPrompt,
@@ -1495,10 +1518,10 @@ function CommandExecution({
1495
1518
  return /* @__PURE__ */ jsxs13(Box12, { flexDirection: "column", children: [
1496
1519
  /* @__PURE__ */ jsx13(Divider, {}),
1497
1520
  /* @__PURE__ */ jsxs13(Box12, { marginY: 1, gap: 1, children: [
1498
- /* @__PURE__ */ jsx13(Text11, { color: "green", bold: true, children: "\u2713" }),
1499
- /* @__PURE__ */ jsx13(Text11, { color: "green", bold: true, children: "Command completed successfully!" })
1521
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, bold: true, children: "\u2713" }),
1522
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, bold: true, children: "Command completed successfully!" })
1500
1523
  ] }),
1501
- pinMessage && /* @__PURE__ */ jsx13(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx13(Text11, { color: "green", children: pinMessage }) }),
1524
+ pinMessage && /* @__PURE__ */ jsx13(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, children: pinMessage }) }),
1502
1525
  /* @__PURE__ */ jsx13(
1503
1526
  SelectList,
1504
1527
  {
@@ -1546,10 +1569,10 @@ function CommandExecution({
1546
1569
  /* @__PURE__ */ jsx13(Text11, { color: "red", children: result.spawnError })
1547
1570
  ] }),
1548
1571
  (result.spawnError.includes("ENOENT") || result.spawnError.includes("not found")) && /* @__PURE__ */ jsxs13(Box12, { flexDirection: "column", marginLeft: 2, marginTop: 1, children: [
1549
- /* @__PURE__ */ jsx13(Text11, { color: "yellow", bold: true, children: "\u{1F4A1} Supabase CLI not found in PATH" }),
1572
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, bold: true, children: "\u{1F4A1} Supabase CLI not found in PATH" }),
1550
1573
  /* @__PURE__ */ jsxs13(Box12, { gap: 1, children: [
1551
1574
  /* @__PURE__ */ jsx13(Text11, { dimColor: true, children: "Install it:" }),
1552
- /* @__PURE__ */ jsx13(Text11, { color: "cyan", children: "https://supabase.com/docs/guides/cli" })
1575
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, children: "https://supabase.com/docs/guides/cli" })
1553
1576
  ] })
1554
1577
  ] })
1555
1578
  ] }) : /* @__PURE__ */ jsxs13(Box12, { flexDirection: "column", marginY: 1, children: [
@@ -1566,7 +1589,7 @@ function CommandExecution({
1566
1589
  ] }),
1567
1590
  !hasDebug && /* @__PURE__ */ jsxs13(Box12, { marginLeft: 2, marginTop: 1, gap: 1, children: [
1568
1591
  /* @__PURE__ */ jsx13(Text11, { dimColor: true, children: "\u{1F4A1} Tip: retry with" }),
1569
- /* @__PURE__ */ jsx13(Text11, { color: "cyan", children: "--debug" }),
1592
+ /* @__PURE__ */ jsx13(Text11, { color: inkColors.accent, children: "--debug" }),
1570
1593
  /* @__PURE__ */ jsx13(Text11, { dimColor: true, children: "to see detailed logs" })
1571
1594
  ] })
1572
1595
  ] }),
@@ -1618,7 +1641,7 @@ function App() {
1618
1641
  const { exit } = useApp();
1619
1642
  const handleExit = () => {
1620
1643
  process.stdout.write(
1621
- "\n" + pc2.dim("Thank you for using ") + pc2.cyan(pc2.bold("Polterbase")) + pc2.dim("!") + "\n\n"
1644
+ "\n" + colors.dim("Thank you for using ") + colors.primaryBold("Polterbase") + colors.dim("!") + "\n\n"
1622
1645
  );
1623
1646
  exit();
1624
1647
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polterware/polterbase",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "A global CLI for managing Supabase CLI workflows.",
5
5
  "type": "module",
6
6
  "bin": {