@vibedhost/cli 1.0.4 → 1.0.5

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/dist/index.js +168 -0
  2. package/package.json +1 -1
  3. package/src/index.ts +187 -0
package/dist/index.js CHANGED
@@ -20,6 +20,12 @@ async function main() {
20
20
  case "whoami":
21
21
  await handleWhoami();
22
22
  break;
23
+ case "token":
24
+ await handleToken();
25
+ break;
26
+ case "app":
27
+ await handleApp();
28
+ break;
23
29
  case "deploy":
24
30
  await handleDeploy();
25
31
  break;
@@ -69,6 +75,8 @@ Commands:
69
75
  login Authenticate this terminal with your VibedHost account
70
76
  logout Disconnect active account credentials from this machine
71
77
  whoami Display authenticated account and workspace inventory
78
+ token Display authenticated MCP API token and client configuration
79
+ app <create|list> Launch 1-Click catalog applications (WordPress, n8n, Ghost, etc.)
72
80
  deploy [dir] Package and deploy local project to dedicated workspace
73
81
  status [app] Check real-time application deployment and routing status
74
82
  logs [app] Stream live application logs or container build output
@@ -978,6 +986,166 @@ async function handleDb() {
978
986
  }
979
987
  console.log("Usage: vibed db [create|list|link|unlink] (or npx @vibedhost/cli db [create|list|link|unlink])");
980
988
  }
989
+ async function handleToken() {
990
+ const config = (0, utils_1.readGlobalConfig)();
991
+ if (!config?.token) {
992
+ console.log("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login') to connect your account.");
993
+ return;
994
+ }
995
+ console.log("\nVibedHost Personal Access Token & MCP Configuration");
996
+ console.log("------------------------------------------------------------");
997
+ console.log(`Account: ${config.email || "Authenticated User"}`);
998
+ console.log(`Token: ${config.token}`);
999
+ console.log("\nAdd to Claude Code, Cursor, or ChatGPT MCP Settings (JSON):");
1000
+ console.log(JSON.stringify({
1001
+ mcpServers: {
1002
+ vibedhost: {
1003
+ url: `${utils_1.API_BASE_URL}/api/mcp`,
1004
+ headers: {
1005
+ Authorization: `Bearer ${config.token}`
1006
+ }
1007
+ }
1008
+ }
1009
+ }, null, 2));
1010
+ console.log("------------------------------------------------------------\n");
1011
+ }
1012
+ async function handleApp() {
1013
+ const config = (0, utils_1.readGlobalConfig)();
1014
+ if (!config?.token) {
1015
+ console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
1016
+ process.exit(1);
1017
+ }
1018
+ const subCommand = args[1] || "list";
1019
+ const projectConfig = (0, utils_1.readProjectConfig)();
1020
+ // 1. APP LIST
1021
+ if (subCommand === "list") {
1022
+ try {
1023
+ const res = await fetch(`${utils_1.API_BASE_URL}/api/cli/workspaces`, {
1024
+ headers: { Authorization: `Bearer ${config.token}` }
1025
+ });
1026
+ const data = (await res.json());
1027
+ if (!res.ok) {
1028
+ console.error(`Error: ${data.error || "Failed to fetch applications."}`);
1029
+ process.exit(1);
1030
+ }
1031
+ console.log("\nActive Web Applications & Services:");
1032
+ console.log("------------------------------------------------------------");
1033
+ let totalAppCount = 0;
1034
+ (data.workspaces || []).forEach((ws) => {
1035
+ const webApps = (ws.apps || []).filter((a) => a.type !== "DATABASE");
1036
+ if (webApps.length > 0) {
1037
+ console.log(`Workspace: ${ws.name} (${ws.planName})`);
1038
+ webApps.forEach((a, idx) => {
1039
+ totalAppCount++;
1040
+ const urlStr = a.domain ? `https://${a.domain}` : "Initializing";
1041
+ console.log(` [${idx + 1}] ${a.name} (${a.type}) • Status: ${a.status}`);
1042
+ console.log(` URL: ${urlStr}`);
1043
+ });
1044
+ console.log("");
1045
+ }
1046
+ });
1047
+ if (totalAppCount === 0) {
1048
+ console.log("No web applications deployed yet.");
1049
+ console.log("Run 'vibed deploy' inside a project folder or 'vibed app create <name>' to launch a 1-Click app.\n");
1050
+ }
1051
+ else {
1052
+ console.log("------------------------------------------------------------\n");
1053
+ }
1054
+ }
1055
+ catch (err) {
1056
+ console.error(`Connection error: ${err.message}`);
1057
+ }
1058
+ return;
1059
+ }
1060
+ // 2. APP CREATE (1-Click Catalog Launcher)
1061
+ if (subCommand === "create") {
1062
+ let appName = args[2] && !args[2].startsWith("--") ? args[2] : "";
1063
+ const catalogIndex = args.indexOf("--catalog");
1064
+ const appFlagIndex = args.indexOf("--app");
1065
+ let explicitCatalog = catalogIndex !== -1 ? args[catalogIndex + 1] : appFlagIndex !== -1 ? args[appFlagIndex + 1] : "";
1066
+ if (!appName && process.stdin.isTTY) {
1067
+ appName = await (0, utils_1.askQuestion)("Application Service Name", "my-wordpress");
1068
+ }
1069
+ else if (!appName) {
1070
+ appName = "my-wordpress";
1071
+ }
1072
+ if (!explicitCatalog && process.stdin.isTTY) {
1073
+ console.log("\nSelect 1-Click Application to Launch:");
1074
+ console.log(" [1] WordPress (CMS + Dedicated MySQL 8.0)");
1075
+ console.log(" [2] n8n.io (Workflow Automation + Postgres)");
1076
+ console.log(" [3] PocketBase (Lean Backend + SQLite)");
1077
+ console.log(" [4] Ghost (Publishing + MySQL 8.0)");
1078
+ console.log(" [5] Directus (BaaS + Postgres)");
1079
+ console.log(" [6] MinIO (S3-Compatible Object Storage)");
1080
+ console.log(" [7] Uptime Kuma (Uptime Monitoring & Status Pages)");
1081
+ console.log(" [8] Umami (Privacy Analytics + Postgres)");
1082
+ console.log(" [9] MeiliSearch (High-Speed Full-Text Search)");
1083
+ console.log(" [10] Qdrant (Vector AI Database)");
1084
+ const chosen = await (0, utils_1.askQuestion)("Enter number", "1");
1085
+ const map = {
1086
+ "1": "wordpress",
1087
+ "2": "n8n",
1088
+ "3": "pocketbase",
1089
+ "4": "ghost",
1090
+ "5": "directus",
1091
+ "6": "minio",
1092
+ "7": "uptime-kuma",
1093
+ "8": "umami",
1094
+ "9": "meilisearch",
1095
+ "10": "qdrant"
1096
+ };
1097
+ explicitCatalog = map[chosen] || "wordpress";
1098
+ }
1099
+ const cleanCatalogKey = (explicitCatalog || "wordpress").toLowerCase().trim();
1100
+ console.log(`\nLaunching 1-Click '${cleanCatalogKey}' as '${appName}' on dedicated workspace...`);
1101
+ try {
1102
+ const res = await fetch(`${utils_1.API_BASE_URL}/api/cli/app`, {
1103
+ method: "POST",
1104
+ headers: {
1105
+ Authorization: `Bearer ${config.token}`,
1106
+ "Content-Type": "application/json"
1107
+ },
1108
+ body: JSON.stringify({
1109
+ action: "CREATE_APP",
1110
+ workspaceId: projectConfig?.workspaceId,
1111
+ name: appName,
1112
+ catalogKey: cleanCatalogKey
1113
+ })
1114
+ });
1115
+ const rawText = await res.text();
1116
+ let data = {};
1117
+ try {
1118
+ data = JSON.parse(rawText);
1119
+ }
1120
+ catch {
1121
+ throw new Error("Application launch request submitted. Run 'vibed app list' to check status.");
1122
+ }
1123
+ if (!res.ok || !data.success) {
1124
+ console.error(`Launch error: ${data.error || "Failed to launch catalog application."}`);
1125
+ process.exit(1);
1126
+ }
1127
+ console.log(`\nApplication Initialized!`);
1128
+ console.log("------------------------------------------------------------");
1129
+ console.log(`Service Name: ${data.name}`);
1130
+ console.log(`Catalog Type: ${data.catalogKey}`);
1131
+ console.log(`Workspace: ${data.workspaceName}`);
1132
+ console.log(`Live Domain: https://${data.domain}`);
1133
+ if (data.defaultUser) {
1134
+ console.log(`Admin User: ${data.defaultUser}`);
1135
+ }
1136
+ if (data.defaultPassword) {
1137
+ console.log(`Admin Pass: ${data.defaultPassword}`);
1138
+ }
1139
+ console.log("------------------------------------------------------------");
1140
+ console.log(`Check live build and startup logs with: vibed logs ${data.name}\n`);
1141
+ }
1142
+ catch (err) {
1143
+ console.error(`Connection error: ${err.message}`);
1144
+ }
1145
+ return;
1146
+ }
1147
+ console.log("Usage: vibed app [create|list] (or npx @vibedhost/cli app [create|list])");
1148
+ }
981
1149
  main().catch((err) => {
982
1150
  console.error(`Execution error: ${err.message}`);
983
1151
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedhost/cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "VibedHost Cloud Engine CLI: Deploy applications to dedicated cloud workspaces directly from your terminal.",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -32,6 +32,12 @@ async function main() {
32
32
  case "whoami":
33
33
  await handleWhoami();
34
34
  break;
35
+ case "token":
36
+ await handleToken();
37
+ break;
38
+ case "app":
39
+ await handleApp();
40
+ break;
35
41
  case "deploy":
36
42
  await handleDeploy();
37
43
  break;
@@ -82,6 +88,8 @@ Commands:
82
88
  login Authenticate this terminal with your VibedHost account
83
89
  logout Disconnect active account credentials from this machine
84
90
  whoami Display authenticated account and workspace inventory
91
+ token Display authenticated MCP API token and client configuration
92
+ app <create|list> Launch 1-Click catalog applications (WordPress, n8n, Ghost, etc.)
85
93
  deploy [dir] Package and deploy local project to dedicated workspace
86
94
  status [app] Check real-time application deployment and routing status
87
95
  logs [app] Stream live application logs or container build output
@@ -1094,6 +1102,185 @@ async function handleDb() {
1094
1102
  console.log("Usage: vibed db [create|list|link|unlink] (or npx @vibedhost/cli db [create|list|link|unlink])");
1095
1103
  }
1096
1104
 
1105
+ async function handleToken() {
1106
+ const config = readGlobalConfig();
1107
+ if (!config?.token) {
1108
+ console.log("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login') to connect your account.");
1109
+ return;
1110
+ }
1111
+
1112
+ console.log("\nVibedHost Personal Access Token & MCP Configuration");
1113
+ console.log("------------------------------------------------------------");
1114
+ console.log(`Account: ${config.email || "Authenticated User"}`);
1115
+ console.log(`Token: ${config.token}`);
1116
+ console.log("\nAdd to Claude Code, Cursor, or ChatGPT MCP Settings (JSON):");
1117
+ console.log(
1118
+ JSON.stringify(
1119
+ {
1120
+ mcpServers: {
1121
+ vibedhost: {
1122
+ url: `${API_BASE_URL}/api/mcp`,
1123
+ headers: {
1124
+ Authorization: `Bearer ${config.token}`
1125
+ }
1126
+ }
1127
+ }
1128
+ },
1129
+ null,
1130
+ 2
1131
+ )
1132
+ );
1133
+ console.log("------------------------------------------------------------\n");
1134
+ }
1135
+
1136
+ async function handleApp() {
1137
+ const config = readGlobalConfig();
1138
+ if (!config?.token) {
1139
+ console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
1140
+ process.exit(1);
1141
+ }
1142
+
1143
+ const subCommand = args[1] || "list";
1144
+ const projectConfig = readProjectConfig();
1145
+
1146
+ // 1. APP LIST
1147
+ if (subCommand === "list") {
1148
+ try {
1149
+ const res = await fetch(`${API_BASE_URL}/api/cli/workspaces`, {
1150
+ headers: { Authorization: `Bearer ${config.token}` }
1151
+ });
1152
+ const data = (await res.json()) as any;
1153
+
1154
+ if (!res.ok) {
1155
+ console.error(`Error: ${data.error || "Failed to fetch applications."}`);
1156
+ process.exit(1);
1157
+ }
1158
+
1159
+ console.log("\nActive Web Applications & Services:");
1160
+ console.log("------------------------------------------------------------");
1161
+
1162
+ let totalAppCount = 0;
1163
+ (data.workspaces || []).forEach((ws: any) => {
1164
+ const webApps = (ws.apps || []).filter((a: any) => a.type !== "DATABASE");
1165
+ if (webApps.length > 0) {
1166
+ console.log(`Workspace: ${ws.name} (${ws.planName})`);
1167
+ webApps.forEach((a: any, idx: number) => {
1168
+ totalAppCount++;
1169
+ const urlStr = a.domain ? `https://${a.domain}` : "Initializing";
1170
+ console.log(` [${idx + 1}] ${a.name} (${a.type}) • Status: ${a.status}`);
1171
+ console.log(` URL: ${urlStr}`);
1172
+ });
1173
+ console.log("");
1174
+ }
1175
+ });
1176
+
1177
+ if (totalAppCount === 0) {
1178
+ console.log("No web applications deployed yet.");
1179
+ console.log("Run 'vibed deploy' inside a project folder or 'vibed app create <name>' to launch a 1-Click app.\n");
1180
+ } else {
1181
+ console.log("------------------------------------------------------------\n");
1182
+ }
1183
+ } catch (err: any) {
1184
+ console.error(`Connection error: ${err.message}`);
1185
+ }
1186
+ return;
1187
+ }
1188
+
1189
+ // 2. APP CREATE (1-Click Catalog Launcher)
1190
+ if (subCommand === "create") {
1191
+ let appName = args[2] && !args[2].startsWith("--") ? args[2] : "";
1192
+ const catalogIndex = args.indexOf("--catalog");
1193
+ const appFlagIndex = args.indexOf("--app");
1194
+ let explicitCatalog = catalogIndex !== -1 ? args[catalogIndex + 1] : appFlagIndex !== -1 ? args[appFlagIndex + 1] : "";
1195
+
1196
+ if (!appName && process.stdin.isTTY) {
1197
+ appName = await askQuestion("Application Service Name", "my-wordpress");
1198
+ } else if (!appName) {
1199
+ appName = "my-wordpress";
1200
+ }
1201
+
1202
+ if (!explicitCatalog && process.stdin.isTTY) {
1203
+ console.log("\nSelect 1-Click Application to Launch:");
1204
+ console.log(" [1] WordPress (CMS + Dedicated MySQL 8.0)");
1205
+ console.log(" [2] n8n.io (Workflow Automation + Postgres)");
1206
+ console.log(" [3] PocketBase (Lean Backend + SQLite)");
1207
+ console.log(" [4] Ghost (Publishing + MySQL 8.0)");
1208
+ console.log(" [5] Directus (BaaS + Postgres)");
1209
+ console.log(" [6] MinIO (S3-Compatible Object Storage)");
1210
+ console.log(" [7] Uptime Kuma (Uptime Monitoring & Status Pages)");
1211
+ console.log(" [8] Umami (Privacy Analytics + Postgres)");
1212
+ console.log(" [9] MeiliSearch (High-Speed Full-Text Search)");
1213
+ console.log(" [10] Qdrant (Vector AI Database)");
1214
+ const chosen = await askQuestion("Enter number", "1");
1215
+ const map: Record<string, string> = {
1216
+ "1": "wordpress",
1217
+ "2": "n8n",
1218
+ "3": "pocketbase",
1219
+ "4": "ghost",
1220
+ "5": "directus",
1221
+ "6": "minio",
1222
+ "7": "uptime-kuma",
1223
+ "8": "umami",
1224
+ "9": "meilisearch",
1225
+ "10": "qdrant"
1226
+ };
1227
+ explicitCatalog = map[chosen] || "wordpress";
1228
+ }
1229
+
1230
+ const cleanCatalogKey = (explicitCatalog || "wordpress").toLowerCase().trim();
1231
+ console.log(`\nLaunching 1-Click '${cleanCatalogKey}' as '${appName}' on dedicated workspace...`);
1232
+
1233
+ try {
1234
+ const res = await fetch(`${API_BASE_URL}/api/cli/app`, {
1235
+ method: "POST",
1236
+ headers: {
1237
+ Authorization: `Bearer ${config.token}`,
1238
+ "Content-Type": "application/json"
1239
+ },
1240
+ body: JSON.stringify({
1241
+ action: "CREATE_APP",
1242
+ workspaceId: projectConfig?.workspaceId,
1243
+ name: appName,
1244
+ catalogKey: cleanCatalogKey
1245
+ })
1246
+ });
1247
+
1248
+ const rawText = await res.text();
1249
+ let data: any = {};
1250
+ try {
1251
+ data = JSON.parse(rawText);
1252
+ } catch {
1253
+ throw new Error("Application launch request submitted. Run 'vibed app list' to check status.");
1254
+ }
1255
+
1256
+ if (!res.ok || !data.success) {
1257
+ console.error(`Launch error: ${data.error || "Failed to launch catalog application."}`);
1258
+ process.exit(1);
1259
+ }
1260
+
1261
+ console.log(`\nApplication Initialized!`);
1262
+ console.log("------------------------------------------------------------");
1263
+ console.log(`Service Name: ${data.name}`);
1264
+ console.log(`Catalog Type: ${data.catalogKey}`);
1265
+ console.log(`Workspace: ${data.workspaceName}`);
1266
+ console.log(`Live Domain: https://${data.domain}`);
1267
+ if (data.defaultUser) {
1268
+ console.log(`Admin User: ${data.defaultUser}`);
1269
+ }
1270
+ if (data.defaultPassword) {
1271
+ console.log(`Admin Pass: ${data.defaultPassword}`);
1272
+ }
1273
+ console.log("------------------------------------------------------------");
1274
+ console.log(`Check live build and startup logs with: vibed logs ${data.name}\n`);
1275
+ } catch (err: any) {
1276
+ console.error(`Connection error: ${err.message}`);
1277
+ }
1278
+ return;
1279
+ }
1280
+
1281
+ console.log("Usage: vibed app [create|list] (or npx @vibedhost/cli app [create|list])");
1282
+ }
1283
+
1097
1284
  main().catch((err) => {
1098
1285
  console.error(`Execution error: ${err.message}`);
1099
1286
  process.exit(1);