calabasas 0.2.4 → 0.3.1

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.
@@ -0,0 +1,153 @@
1
+ import {
2
+ build_default,
3
+ relativeTime
4
+ } from "./index-8gymgyxd.js";
5
+ import"./index-tre7d3f1.js";
6
+ import {
7
+ __toESM
8
+ } from "./index-sdksp5px.js";
9
+ import {
10
+ Box_default,
11
+ Text
12
+ } from "./index-4rn9k8et.js";
13
+ import {
14
+ cliApi,
15
+ require_jsx_dev_runtime,
16
+ useQuery
17
+ } from "./convex-1z1jsz1n.js";
18
+ import"./index-vmy4gfe1.js";
19
+
20
+ // src/components/StatusBadge.tsx
21
+ var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
22
+ var STATUS_CONFIG = {
23
+ connected: { color: "green", dot: "●" },
24
+ connecting: { color: "yellow", dot: "●" },
25
+ error: { color: "red", dot: "●" },
26
+ disconnected: { color: "gray", dot: "●" }
27
+ };
28
+ function StatusBadge({ status, width = 0 }) {
29
+ const config = STATUS_CONFIG[status];
30
+ const label = `${config.dot} ${status}`;
31
+ const padded = width > 0 ? label.padEnd(width) : label;
32
+ return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
33
+ children: [
34
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
35
+ color: config.color,
36
+ children: config.dot
37
+ }, undefined, false, undefined, this),
38
+ /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
39
+ children: padded.slice(1)
40
+ }, undefined, false, undefined, this)
41
+ ]
42
+ }, undefined, true, undefined, this);
43
+ }
44
+
45
+ // src/components/BotList.tsx
46
+ var jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
47
+ function BotList({
48
+ apiKey,
49
+ selectedIndex,
50
+ onSelect
51
+ }) {
52
+ const bots = useQuery(cliApi.listBots, { apiKey });
53
+ if (bots === undefined) {
54
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
55
+ children: [
56
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
57
+ color: "cyan",
58
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(build_default, {
59
+ type: "dots"
60
+ }, undefined, false, undefined, this)
61
+ }, undefined, false, undefined, this),
62
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
63
+ children: " Loading bots..."
64
+ }, undefined, false, undefined, this)
65
+ ]
66
+ }, undefined, true, undefined, this);
67
+ }
68
+ if (bots.length === 0) {
69
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
70
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
71
+ dimColor: true,
72
+ children: "No bots found. Run `calabasas bot add` to create one."
73
+ }, undefined, false, undefined, this)
74
+ }, undefined, false, undefined, this);
75
+ }
76
+ const COL = { name: 30, status: 16, appId: 22, url: 34 };
77
+ function truncate(str, max) {
78
+ if (str.length <= max)
79
+ return str.padEnd(max);
80
+ return str.slice(0, max - 1) + "…";
81
+ }
82
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
83
+ flexDirection: "column",
84
+ children: [
85
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
86
+ marginBottom: 1,
87
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
88
+ bold: true,
89
+ children: [
90
+ " ",
91
+ "Name".padEnd(COL.name),
92
+ "Status".padEnd(COL.status),
93
+ "Discord App ID".padEnd(COL.appId),
94
+ "Convex URL".padEnd(COL.url),
95
+ "Last Connected"
96
+ ]
97
+ }, undefined, true, undefined, this)
98
+ }, undefined, false, undefined, this),
99
+ bots.map((bot, i) => {
100
+ const isSelected = selectedIndex === i;
101
+ return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
102
+ flexDirection: "column",
103
+ children: [
104
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
105
+ children: [
106
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
107
+ color: isSelected ? "cyan" : undefined,
108
+ children: isSelected ? "→ " : " "
109
+ }, undefined, false, undefined, this),
110
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
111
+ bold: isSelected,
112
+ children: truncate(bot.name, COL.name)
113
+ }, undefined, false, undefined, this),
114
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(StatusBadge, {
115
+ status: bot.status,
116
+ width: COL.status
117
+ }, undefined, false, undefined, this),
118
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
119
+ dimColor: true,
120
+ children: bot.discordAppId.padEnd(COL.appId)
121
+ }, undefined, false, undefined, this),
122
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
123
+ dimColor: true,
124
+ children: truncate(bot.convexUrl.replace("https://", ""), COL.url)
125
+ }, undefined, false, undefined, this),
126
+ /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
127
+ dimColor: true,
128
+ children: relativeTime(bot.lastConnectedAt)
129
+ }, undefined, false, undefined, this)
130
+ ]
131
+ }, undefined, true, undefined, this),
132
+ bot.errorMessage && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
133
+ marginLeft: 4,
134
+ children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
135
+ color: "red",
136
+ dimColor: true,
137
+ children: [
138
+ "└ ",
139
+ bot.errorMessage
140
+ ]
141
+ }, undefined, true, undefined, this)
142
+ }, undefined, false, undefined, this)
143
+ ]
144
+ }, bot._id, true, undefined, this);
145
+ })
146
+ ]
147
+ }, undefined, true, undefined, this);
148
+ }
149
+ export {
150
+ BotList
151
+ };
152
+
153
+ export { BotList };
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Type definitions for calabasas
2
- // Project: https://calabasas.dev
2
+ // Project: https://calabasas-web.vercel.app
3
3
 
4
4
  export type SyncConfig = {
5
5
  guilds?: boolean;