@vibedhost/cli 1.0.2 → 1.0.4

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/dist/index.js CHANGED
@@ -72,7 +72,7 @@ Commands:
72
72
  deploy [dir] Package and deploy local project to dedicated workspace
73
73
  status [app] Check real-time application deployment and routing status
74
74
  logs [app] Stream live application logs or container build output
75
- db <create|list|link> Manage dedicated databases and link to applications
75
+ db <create|list|link|unlink> Manage dedicated databases and link to applications
76
76
  env <get|set> Manage container environment variables
77
77
  port set <port> Update container listening port (e.g. 3000, 8080)
78
78
 
@@ -934,7 +934,49 @@ async function handleDb() {
934
934
  }
935
935
  return;
936
936
  }
937
- console.log("Usage: vibed db [create|list|link] (or npx @vibedhost/cli db [create|list|link])");
937
+ // 4. DATABASE UNLINK
938
+ if (subCommand === "unlink") {
939
+ const targetAppName = (args[2] && !args[2].startsWith("--"))
940
+ ? args[2]
941
+ : (projectConfig?.appName || (0, utils_1.inferAppName)(process.cwd()));
942
+ if (!targetAppName) {
943
+ console.error("Usage: vibed db unlink <application-name> (or npx @vibedhost/cli db unlink <application-name>)");
944
+ process.exit(1);
945
+ }
946
+ console.log(`Unlinking database from application '${targetAppName}'...`);
947
+ try {
948
+ const res = await fetch(`${utils_1.API_BASE_URL}/api/cli/db`, {
949
+ method: "POST",
950
+ headers: {
951
+ Authorization: `Bearer ${config.token}`,
952
+ "Content-Type": "application/json"
953
+ },
954
+ body: JSON.stringify({
955
+ action: "UNLINK_DB",
956
+ appName: targetAppName
957
+ })
958
+ });
959
+ const rawText = await res.text();
960
+ let data = {};
961
+ try {
962
+ data = JSON.parse(rawText);
963
+ }
964
+ catch {
965
+ throw new Error("Database unlink request is processing on the workspace.");
966
+ }
967
+ if (!res.ok || !data.success) {
968
+ console.error(`Unlink error: ${data.error || "Failed to unlink database."}`);
969
+ process.exit(1);
970
+ }
971
+ console.log(`\nSuccessfully unlinked database from '${data.appName}'!`);
972
+ console.log(`Database connection variables removed from container. Service restarted.\n`);
973
+ }
974
+ catch (err) {
975
+ console.error(`Connection error: ${err.message}`);
976
+ }
977
+ return;
978
+ }
979
+ console.log("Usage: vibed db [create|list|link|unlink] (or npx @vibedhost/cli db [create|list|link|unlink])");
938
980
  }
939
981
  main().catch((err) => {
940
982
  console.error(`Execution error: ${err.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedhost/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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
@@ -85,7 +85,7 @@ Commands:
85
85
  deploy [dir] Package and deploy local project to dedicated workspace
86
86
  status [app] Check real-time application deployment and routing status
87
87
  logs [app] Stream live application logs or container build output
88
- db <create|list|link> Manage dedicated databases and link to applications
88
+ db <create|list|link|unlink> Manage dedicated databases and link to applications
89
89
  env <get|set> Manage container environment variables
90
90
  port set <port> Update container listening port (e.g. 3000, 8080)
91
91
 
@@ -1044,7 +1044,54 @@ async function handleDb() {
1044
1044
  return;
1045
1045
  }
1046
1046
 
1047
- console.log("Usage: vibed db [create|list|link] (or npx @vibedhost/cli db [create|list|link])");
1047
+ // 4. DATABASE UNLINK
1048
+ if (subCommand === "unlink") {
1049
+ const targetAppName = (args[2] && !args[2].startsWith("--"))
1050
+ ? args[2]
1051
+ : (projectConfig?.appName || inferAppName(process.cwd()));
1052
+
1053
+ if (!targetAppName) {
1054
+ console.error("Usage: vibed db unlink <application-name> (or npx @vibedhost/cli db unlink <application-name>)");
1055
+ process.exit(1);
1056
+ }
1057
+
1058
+ console.log(`Unlinking database from application '${targetAppName}'...`);
1059
+
1060
+ try {
1061
+ const res = await fetch(`${API_BASE_URL}/api/cli/db`, {
1062
+ method: "POST",
1063
+ headers: {
1064
+ Authorization: `Bearer ${config.token}`,
1065
+ "Content-Type": "application/json"
1066
+ },
1067
+ body: JSON.stringify({
1068
+ action: "UNLINK_DB",
1069
+ appName: targetAppName
1070
+ })
1071
+ });
1072
+
1073
+ const rawText = await res.text();
1074
+ let data: any = {};
1075
+ try {
1076
+ data = JSON.parse(rawText);
1077
+ } catch {
1078
+ throw new Error("Database unlink request is processing on the workspace.");
1079
+ }
1080
+
1081
+ if (!res.ok || !data.success) {
1082
+ console.error(`Unlink error: ${data.error || "Failed to unlink database."}`);
1083
+ process.exit(1);
1084
+ }
1085
+
1086
+ console.log(`\nSuccessfully unlinked database from '${data.appName}'!`);
1087
+ console.log(`Database connection variables removed from container. Service restarted.\n`);
1088
+ } catch (err: any) {
1089
+ console.error(`Connection error: ${err.message}`);
1090
+ }
1091
+ return;
1092
+ }
1093
+
1094
+ console.log("Usage: vibed db [create|list|link|unlink] (or npx @vibedhost/cli db [create|list|link|unlink])");
1048
1095
  }
1049
1096
 
1050
1097
  main().catch((err) => {