uplink-cli 0.1.13 → 0.1.14
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/cli/src/subcommands/menu.ts +29 -54
- package/package.json +1 -1
|
@@ -93,6 +93,7 @@ const ASCII_UPLINK = colorCyan([
|
|
|
93
93
|
" ╚═════╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝",
|
|
94
94
|
].join("\n"));
|
|
95
95
|
|
|
96
|
+
|
|
96
97
|
function truncate(text: string, max: number) {
|
|
97
98
|
if (text.length <= max) return text;
|
|
98
99
|
return text.slice(0, max - 1) + "…";
|
|
@@ -1160,18 +1161,14 @@ export const menuCommand = new Command("menu")
|
|
|
1160
1161
|
clearScreen();
|
|
1161
1162
|
console.log();
|
|
1162
1163
|
console.log(ASCII_UPLINK);
|
|
1163
|
-
console.log();
|
|
1164
1164
|
|
|
1165
|
-
// Status
|
|
1165
|
+
// Status indicator below logo
|
|
1166
1166
|
if (menuStack.length === 1 && cachedRelayStatus) {
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
// Show active tunnels if we're at the main menu (use cached value, no scanning)
|
|
1172
|
-
if (menuStack.length === 1 && cachedActiveTunnels) {
|
|
1173
|
-
console.log(cachedActiveTunnels);
|
|
1167
|
+
const statusIndicator = cachedRelayStatus.includes("ok") ? colorGreen("›") : colorRed("›");
|
|
1168
|
+
const statusText = cachedRelayStatus.includes("ok") ? "connected" : "offline";
|
|
1169
|
+
console.log(statusIndicator + colorDim(" " + statusText));
|
|
1174
1170
|
}
|
|
1171
|
+
console.log();
|
|
1175
1172
|
|
|
1176
1173
|
console.log();
|
|
1177
1174
|
|
|
@@ -1180,64 +1177,54 @@ export const menuCommand = new Command("menu")
|
|
|
1180
1177
|
// Breadcrumb navigation
|
|
1181
1178
|
if (menuPath.length > 0) {
|
|
1182
1179
|
const breadcrumb = menuPath.map((p, i) =>
|
|
1183
|
-
i === menuPath.length - 1 ?
|
|
1180
|
+
i === menuPath.length - 1 ? colorBold(p) : colorDim(p)
|
|
1184
1181
|
).join(colorDim(" › "));
|
|
1185
1182
|
console.log(breadcrumb);
|
|
1186
1183
|
console.log();
|
|
1187
1184
|
}
|
|
1188
1185
|
|
|
1189
|
-
// Menu items
|
|
1186
|
+
// Menu items - simple list style
|
|
1190
1187
|
currentMenu.forEach((choice, idx) => {
|
|
1191
|
-
const isLast = idx === currentMenu.length - 1;
|
|
1192
1188
|
const isSelected = idx === selected;
|
|
1193
|
-
const branch = isLast ? "└─" : "├─";
|
|
1194
1189
|
|
|
1195
1190
|
// Clean up labels - remove emojis for cleaner look
|
|
1196
1191
|
let cleanLabel = choice.label
|
|
1197
1192
|
.replace(/^🚀\s*/, "")
|
|
1198
|
-
.replace(/^⚠️\s*/, "")
|
|
1193
|
+
.replace(/^⚠️\s*/, "⚠ ")
|
|
1199
1194
|
.replace(/^✅\s*/, "")
|
|
1200
1195
|
.replace(/^❌\s*/, "");
|
|
1201
1196
|
|
|
1202
|
-
//
|
|
1203
|
-
|
|
1204
|
-
|
|
1197
|
+
// Has submenu indicator
|
|
1198
|
+
const hasSubmenu = !!choice.subMenu;
|
|
1199
|
+
const suffix = hasSubmenu ? " ›" : "";
|
|
1205
1200
|
|
|
1201
|
+
// Style based on selection
|
|
1202
|
+
let line: string;
|
|
1206
1203
|
if (isSelected) {
|
|
1207
|
-
branchColor = colorCyan(branch);
|
|
1208
1204
|
if (cleanLabel.toLowerCase().includes("exit")) {
|
|
1209
|
-
|
|
1210
|
-
} else if (cleanLabel.toLowerCase().includes("stop all") || cleanLabel.toLowerCase().includes("
|
|
1211
|
-
|
|
1212
|
-
} else if (cleanLabel.toLowerCase().includes("get started")) {
|
|
1213
|
-
label = colorGreen(cleanLabel);
|
|
1205
|
+
line = colorDim("› " + cleanLabel + suffix);
|
|
1206
|
+
} else if (cleanLabel.toLowerCase().includes("stop all") || cleanLabel.toLowerCase().includes("⚠")) {
|
|
1207
|
+
line = colorRed("› " + cleanLabel + suffix);
|
|
1214
1208
|
} else {
|
|
1215
|
-
|
|
1209
|
+
line = colorBold("› " + cleanLabel + suffix);
|
|
1216
1210
|
}
|
|
1217
1211
|
} else {
|
|
1218
|
-
branchColor = colorDim(branch);
|
|
1219
1212
|
if (cleanLabel.toLowerCase().includes("exit")) {
|
|
1220
|
-
|
|
1221
|
-
} else if (cleanLabel.toLowerCase().includes("stop all") || cleanLabel.toLowerCase().includes("
|
|
1222
|
-
|
|
1223
|
-
} else if (cleanLabel.toLowerCase().includes("get started")) {
|
|
1224
|
-
label = colorGreen(cleanLabel);
|
|
1213
|
+
line = colorDim(" " + cleanLabel + suffix);
|
|
1214
|
+
} else if (cleanLabel.toLowerCase().includes("stop all") || cleanLabel.toLowerCase().includes("⚠")) {
|
|
1215
|
+
line = colorDim(" ") + colorRed(cleanLabel + suffix);
|
|
1225
1216
|
} else {
|
|
1226
|
-
|
|
1217
|
+
line = colorDim(" " + cleanLabel + suffix);
|
|
1227
1218
|
}
|
|
1228
1219
|
}
|
|
1229
1220
|
|
|
1230
|
-
|
|
1231
|
-
const indicator = choice.subMenu ? colorDim(" ›") : "";
|
|
1232
|
-
|
|
1233
|
-
console.log(`${branchColor} ${label}${indicator}`);
|
|
1221
|
+
console.log(line);
|
|
1234
1222
|
});
|
|
1235
1223
|
|
|
1236
1224
|
// Message area
|
|
1237
1225
|
if (busy) {
|
|
1238
1226
|
console.log();
|
|
1239
|
-
console.log(colorDim("
|
|
1240
|
-
console.log(colorCyan("│ ") + colorDim("Working..."));
|
|
1227
|
+
console.log(colorDim("Working..."));
|
|
1241
1228
|
} else if (message && message !== "Use ↑/↓ and Enter. ← to go back. Ctrl+C to quit.") {
|
|
1242
1229
|
console.log();
|
|
1243
1230
|
// Format multi-line messages nicely
|
|
@@ -1245,28 +1232,16 @@ export const menuCommand = new Command("menu")
|
|
|
1245
1232
|
lines.forEach((line) => {
|
|
1246
1233
|
// Color success/error indicators
|
|
1247
1234
|
let styledLine = line
|
|
1248
|
-
.replace(
|
|
1249
|
-
.replace(
|
|
1250
|
-
.replace(
|
|
1251
|
-
|
|
1252
|
-
.replace(/^🌐/, colorCyan("→"))
|
|
1253
|
-
.replace(/^📡/, colorCyan("→"))
|
|
1254
|
-
.replace(/^💡/, colorYellow("→"));
|
|
1255
|
-
console.log(colorDim("│ ") + styledLine);
|
|
1235
|
+
.replace(/^✓/, colorGreen("✓"))
|
|
1236
|
+
.replace(/^✗/, colorRed("✗"))
|
|
1237
|
+
.replace(/^→/, colorCyan("→"));
|
|
1238
|
+
console.log(styledLine);
|
|
1256
1239
|
});
|
|
1257
1240
|
}
|
|
1258
1241
|
|
|
1259
1242
|
// Footer hints
|
|
1260
1243
|
console.log();
|
|
1261
|
-
|
|
1262
|
-
colorDim("↑↓") + " navigate",
|
|
1263
|
-
colorDim("↵") + " select",
|
|
1264
|
-
];
|
|
1265
|
-
if (menuStack.length > 1) {
|
|
1266
|
-
hints.push(colorDim("←") + " back");
|
|
1267
|
-
}
|
|
1268
|
-
hints.push(colorDim("^C") + " exit");
|
|
1269
|
-
console.log(colorDim(hints.join(" ")));
|
|
1244
|
+
console.log(colorDim("↑↓ navigate ↵ select ^C exit"));
|
|
1270
1245
|
};
|
|
1271
1246
|
|
|
1272
1247
|
const cleanup = () => {
|
package/package.json
CHANGED