@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.
- package/README.md +2 -0
- package/dist/index.js +65 -42
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @polterware/polterbase
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
[](https://www.npmjs.com/package/@polterware/polterbase)
|
|
4
6
|
[](https://opensource.org/licenses/MIT)
|
|
5
7
|
[](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
|
|
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:
|
|
42
|
-
primaryBold: (s) => pc.bold(
|
|
43
|
-
accent:
|
|
44
|
-
accentBold: (s) => pc.bold(
|
|
45
|
-
success:
|
|
46
|
-
successBold: (s) => pc.bold(
|
|
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:
|
|
50
|
-
warningBold: (s) => pc.bold(
|
|
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) =>
|
|
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:
|
|
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:
|
|
93
|
+
borderColor: inkColors.accent,
|
|
80
94
|
paddingX: 1,
|
|
81
95
|
children: [
|
|
82
|
-
/* @__PURE__ */ jsx(
|
|
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 ?
|
|
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 ?
|
|
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:
|
|
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:
|
|
363
|
+
borderColor: inkColors.accent,
|
|
364
|
+
borderDimColor: !hasSelectedRow && !isPinnedSection,
|
|
342
365
|
paddingX: 1,
|
|
343
366
|
children: [
|
|
344
|
-
section.title && /* @__PURE__ */ jsx2(Text2, { color:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 ?
|
|
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
|
|
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 ?
|
|
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 =
|
|
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:
|
|
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:
|
|
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:
|
|
1476
|
-
/* @__PURE__ */ jsx13(Text11, { color:
|
|
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:
|
|
1499
|
-
/* @__PURE__ */ jsx13(Text11, { color:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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" +
|
|
1644
|
+
"\n" + colors.dim("Thank you for using ") + colors.primaryBold("Polterbase") + colors.dim("!") + "\n\n"
|
|
1622
1645
|
);
|
|
1623
1646
|
exit();
|
|
1624
1647
|
};
|