@vibedhost/cli 1.0.0 → 1.0.2
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 +75 -46
- package/package.json +2 -2
- package/src/index.ts +71 -46
package/dist/index.js
CHANGED
|
@@ -48,7 +48,7 @@ async function main() {
|
|
|
48
48
|
}
|
|
49
49
|
function printHelp() {
|
|
50
50
|
console.log(`
|
|
51
|
-
VibedHost Cloud Engine
|
|
51
|
+
VibedHost Cloud Engine: Command Line Interface
|
|
52
52
|
--------------------------------------------------------------------------
|
|
53
53
|
Deploy web applications and manage dedicated cloud workspaces directly from
|
|
54
54
|
your terminal, Claude Code, Cursor, or automated CI/CD pipelines.
|
|
@@ -57,12 +57,13 @@ Website: https://www.vibedhost.com
|
|
|
57
57
|
Dashboard: https://www.vibedhost.com/dashboard/workspaces
|
|
58
58
|
|
|
59
59
|
Usage:
|
|
60
|
-
npx
|
|
60
|
+
npx @vibedhost/cli [command] [options]
|
|
61
|
+
vibed [command] [options]
|
|
61
62
|
|
|
62
63
|
Getting Started:
|
|
63
64
|
1. Create account & workspace: https://www.vibedhost.com/register
|
|
64
|
-
2. Authenticate terminal: npx
|
|
65
|
-
3. Deploy local project: npx
|
|
65
|
+
2. Authenticate terminal: npx @vibedhost/cli login
|
|
66
|
+
3. Deploy local project: npx @vibedhost/cli deploy
|
|
66
67
|
|
|
67
68
|
Commands:
|
|
68
69
|
login Authenticate this terminal with your VibedHost account
|
|
@@ -86,13 +87,13 @@ Inspection Options:
|
|
|
86
87
|
--ai Format latest error snippet for AI coding assistants
|
|
87
88
|
|
|
88
89
|
Examples:
|
|
89
|
-
npx
|
|
90
|
-
npx
|
|
91
|
-
npx
|
|
92
|
-
npx
|
|
93
|
-
npx
|
|
94
|
-
npx
|
|
95
|
-
npx
|
|
90
|
+
npx @vibedhost/cli login
|
|
91
|
+
npx @vibedhost/cli deploy
|
|
92
|
+
npx @vibedhost/cli deploy ./dist --name frontend-spa
|
|
93
|
+
npx @vibedhost/cli status
|
|
94
|
+
npx @vibedhost/cli logs my-app
|
|
95
|
+
npx @vibedhost/cli logs my-app --ai
|
|
96
|
+
npx @vibedhost/cli env set DATABASE_URL=postgresql://...
|
|
96
97
|
`);
|
|
97
98
|
}
|
|
98
99
|
async function handleLogin() {
|
|
@@ -129,11 +130,11 @@ async function handleLogin() {
|
|
|
129
130
|
});
|
|
130
131
|
console.log(`\nAuthentication successful!`);
|
|
131
132
|
console.log(`Logged in as: ${pollData.user?.email || "Authenticated User"}`);
|
|
132
|
-
console.log(`Run 'npx
|
|
133
|
+
console.log(`Run 'vibed deploy' (or 'npx @vibedhost/cli deploy') inside any project directory to deploy.`);
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
if (pollData.status === "expired" || pollData.status === "invalid") {
|
|
136
|
-
console.error("\nSession expired or rejected. Please run 'npx
|
|
137
|
+
console.error("\nSession expired or rejected. Please run 'vibed login' (or 'npx @vibedhost/cli login') again.");
|
|
137
138
|
process.exit(1);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
@@ -152,7 +153,7 @@ function handleLogout() {
|
|
|
152
153
|
async function handleWhoami() {
|
|
153
154
|
const config = (0, utils_1.readGlobalConfig)();
|
|
154
155
|
if (!config?.token) {
|
|
155
|
-
console.log("Not authenticated. Run 'npx
|
|
156
|
+
console.log("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login') to connect your account.");
|
|
156
157
|
return;
|
|
157
158
|
}
|
|
158
159
|
try {
|
|
@@ -196,13 +197,13 @@ async function handleDeploy() {
|
|
|
196
197
|
const config = (0, utils_1.readGlobalConfig)();
|
|
197
198
|
if (!config?.token) {
|
|
198
199
|
console.log(`
|
|
199
|
-
VibedHost Cloud Engine
|
|
200
|
+
VibedHost Cloud Engine: Deployment Gateway
|
|
200
201
|
------------------------------------------------------------
|
|
201
202
|
You are not currently authenticated.
|
|
202
203
|
|
|
203
204
|
Get Started:
|
|
204
205
|
1. Create an account: https://www.vibedhost.com/register
|
|
205
|
-
2. Authenticate: npx
|
|
206
|
+
2. Authenticate: vibed login (or npx @vibedhost/cli login)
|
|
206
207
|
`);
|
|
207
208
|
process.exit(1);
|
|
208
209
|
}
|
|
@@ -234,7 +235,7 @@ Get Started:
|
|
|
234
235
|
});
|
|
235
236
|
const wsData = (await wsRes.json());
|
|
236
237
|
if (!wsRes.ok) {
|
|
237
|
-
console.error(`Authentication error: ${wsData.error || "Invalid token. Please run 'npx
|
|
238
|
+
console.error(`Authentication error: ${wsData.error || "Invalid token. Please run 'vibed login' (or 'npx @vibedhost/cli login')."}`);
|
|
238
239
|
process.exit(1);
|
|
239
240
|
}
|
|
240
241
|
workspaces = (wsData.workspaces || []).filter((w) => w.status === "running");
|
|
@@ -246,7 +247,7 @@ Wallet Balance: €${(wsData.walletBalance || 0).toFixed(2)}
|
|
|
246
247
|
To deploy applications, launch a dedicated cloud workspace:
|
|
247
248
|
https://www.vibedhost.com/dashboard/workspaces
|
|
248
249
|
|
|
249
|
-
Once provisioned, run 'npx
|
|
250
|
+
Once provisioned, run 'vibed deploy' (or 'npx @vibedhost/cli deploy') again.
|
|
250
251
|
`);
|
|
251
252
|
process.exit(1);
|
|
252
253
|
}
|
|
@@ -407,9 +408,9 @@ Workspace: ${targetWs.name}
|
|
|
407
408
|
Status: ${result.error || "A build is already in progress for this application."}
|
|
408
409
|
|
|
409
410
|
Troubleshooting:
|
|
410
|
-
- Stream live logs:
|
|
411
|
-
- Check status:
|
|
412
|
-
- Format for AI debug:
|
|
411
|
+
- Stream live logs: vibed logs ${appName}
|
|
412
|
+
- Check status: vibed status ${appName}
|
|
413
|
+
- Format for AI debug: vibed logs ${appName} --ai
|
|
413
414
|
`);
|
|
414
415
|
process.exit(1);
|
|
415
416
|
}
|
|
@@ -422,9 +423,9 @@ Workspace: ${targetWs.name}
|
|
|
422
423
|
Error: ${result.error || "Build failed. Please check your configuration."}
|
|
423
424
|
|
|
424
425
|
Troubleshooting:
|
|
425
|
-
- Stream logs:
|
|
426
|
-
- Format for AI debug:
|
|
427
|
-
- Adjust port:
|
|
426
|
+
- Stream logs: vibed logs ${appName}
|
|
427
|
+
- Format for AI debug: vibed logs ${appName} --ai
|
|
428
|
+
- Adjust port: vibed port set 3000
|
|
428
429
|
`);
|
|
429
430
|
process.exit(1);
|
|
430
431
|
}
|
|
@@ -483,7 +484,7 @@ Workspace: ${targetWs.name}
|
|
|
483
484
|
Status: Failed
|
|
484
485
|
|
|
485
486
|
Build unsuccessful.
|
|
486
|
-
Run '
|
|
487
|
+
Run 'vibed logs ${finalAppName}' to view container error logs.
|
|
487
488
|
------------------------------------------------------------
|
|
488
489
|
`);
|
|
489
490
|
process.exit(1);
|
|
@@ -497,8 +498,8 @@ Workspace: ${targetWs.name}
|
|
|
497
498
|
Status: Building
|
|
498
499
|
|
|
499
500
|
Your application is continuing to build in the background.
|
|
500
|
-
Run '
|
|
501
|
-
Run '
|
|
501
|
+
Run 'vibed status' to check status.
|
|
502
|
+
Run 'vibed logs' to view live build logs.
|
|
502
503
|
------------------------------------------------------------
|
|
503
504
|
`);
|
|
504
505
|
}
|
|
@@ -511,7 +512,7 @@ Run 'npx vibed logs' to view live build logs.
|
|
|
511
512
|
async function handleStatus() {
|
|
512
513
|
const config = (0, utils_1.readGlobalConfig)();
|
|
513
514
|
if (!config?.token) {
|
|
514
|
-
console.error("Not authenticated. Please run 'npx
|
|
515
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
515
516
|
process.exit(1);
|
|
516
517
|
}
|
|
517
518
|
const projectConfig = (0, utils_1.readProjectConfig)();
|
|
@@ -549,7 +550,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
549
550
|
Status: Failed
|
|
550
551
|
|
|
551
552
|
Build unsuccessful.
|
|
552
|
-
Run '
|
|
553
|
+
Run 'vibed logs ${appName}' to view error logs.
|
|
553
554
|
------------------------------------------------------------
|
|
554
555
|
`);
|
|
555
556
|
}
|
|
@@ -562,7 +563,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
562
563
|
Status: Building
|
|
563
564
|
|
|
564
565
|
Building application container in background.
|
|
565
|
-
Run '
|
|
566
|
+
Run 'vibed logs ${appName}' to view build progress.
|
|
566
567
|
------------------------------------------------------------
|
|
567
568
|
`);
|
|
568
569
|
}
|
|
@@ -611,7 +612,7 @@ Run 'npx vibed logs ${appName}' to view build progress.
|
|
|
611
612
|
async function handleLogs() {
|
|
612
613
|
const config = (0, utils_1.readGlobalConfig)();
|
|
613
614
|
if (!config?.token) {
|
|
614
|
-
console.error("Not authenticated. Please run 'npx
|
|
615
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
615
616
|
process.exit(1);
|
|
616
617
|
}
|
|
617
618
|
const isAiFormat = args.includes("--ai");
|
|
@@ -619,14 +620,21 @@ async function handleLogs() {
|
|
|
619
620
|
const projectConfig = (0, utils_1.readProjectConfig)();
|
|
620
621
|
const appName = filteredArgs[0] || projectConfig?.appName || (0, utils_1.inferAppName)(process.cwd());
|
|
621
622
|
if (!appName) {
|
|
622
|
-
console.error("Please specify application name: npx
|
|
623
|
+
console.error("Please specify application name: vibed logs <appName> (or npx @vibedhost/cli logs <appName>)");
|
|
623
624
|
process.exit(1);
|
|
624
625
|
}
|
|
625
626
|
try {
|
|
626
627
|
const res = await fetch(`${utils_1.API_BASE_URL}/api/cli/logs?appName=${encodeURIComponent(appName)}`, {
|
|
627
628
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
628
629
|
});
|
|
629
|
-
const
|
|
630
|
+
const rawText = await res.text();
|
|
631
|
+
let data = {};
|
|
632
|
+
try {
|
|
633
|
+
data = JSON.parse(rawText);
|
|
634
|
+
}
|
|
635
|
+
catch {
|
|
636
|
+
data = { logs: rawText };
|
|
637
|
+
}
|
|
630
638
|
if (!res.ok) {
|
|
631
639
|
console.error(`Error: ${data.error || "Failed to retrieve logs."}`);
|
|
632
640
|
process.exit(1);
|
|
@@ -661,20 +669,20 @@ Please analyze these logs and tell me how to resolve the error.
|
|
|
661
669
|
async function handleEnv() {
|
|
662
670
|
const config = (0, utils_1.readGlobalConfig)();
|
|
663
671
|
if (!config?.token) {
|
|
664
|
-
console.error("Not authenticated. Run 'npx
|
|
672
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
665
673
|
process.exit(1);
|
|
666
674
|
}
|
|
667
675
|
const subCommand = args[1];
|
|
668
676
|
const projectConfig = (0, utils_1.readProjectConfig)();
|
|
669
677
|
const appName = projectConfig?.appName || (0, utils_1.inferAppName)(process.cwd());
|
|
670
678
|
if (!appName) {
|
|
671
|
-
console.error("No linked project found in this folder. Run inside a project directory or run '
|
|
679
|
+
console.error("No linked project found in this folder. Run inside a project directory or run 'vibed deploy' first.");
|
|
672
680
|
process.exit(1);
|
|
673
681
|
}
|
|
674
682
|
if (subCommand === "set") {
|
|
675
683
|
const keyVal = args[2];
|
|
676
684
|
if (!keyVal || !keyVal.includes("=")) {
|
|
677
|
-
console.error("Usage: npx
|
|
685
|
+
console.error("Usage: vibed env set KEY=VALUE (or npx @vibedhost/cli env set KEY=VALUE)");
|
|
678
686
|
process.exit(1);
|
|
679
687
|
}
|
|
680
688
|
const idx = keyVal.indexOf("=");
|
|
@@ -730,7 +738,7 @@ async function handleEnv() {
|
|
|
730
738
|
async function handlePort() {
|
|
731
739
|
const config = (0, utils_1.readGlobalConfig)();
|
|
732
740
|
if (!config?.token) {
|
|
733
|
-
console.error("Not authenticated. Run 'npx
|
|
741
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
734
742
|
process.exit(1);
|
|
735
743
|
}
|
|
736
744
|
const subCommand = args[1];
|
|
@@ -742,7 +750,7 @@ async function handlePort() {
|
|
|
742
750
|
process.exit(1);
|
|
743
751
|
}
|
|
744
752
|
if (subCommand !== "set" || isNaN(portVal) || portVal < 1 || portVal > 65535) {
|
|
745
|
-
console.error("Usage: npx
|
|
753
|
+
console.error("Usage: vibed port set <1-65535> (or npx @vibedhost/cli port set <1-65535>)");
|
|
746
754
|
process.exit(1);
|
|
747
755
|
}
|
|
748
756
|
try {
|
|
@@ -771,7 +779,7 @@ async function handlePort() {
|
|
|
771
779
|
async function handleDb() {
|
|
772
780
|
const config = (0, utils_1.readGlobalConfig)();
|
|
773
781
|
if (!config?.token) {
|
|
774
|
-
console.error("Not authenticated. Please run 'npx
|
|
782
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
775
783
|
process.exit(1);
|
|
776
784
|
}
|
|
777
785
|
const subCommand = args[1] || "list";
|
|
@@ -782,7 +790,14 @@ async function handleDb() {
|
|
|
782
790
|
const res = await fetch(`${utils_1.API_BASE_URL}/api/cli/db`, {
|
|
783
791
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
784
792
|
});
|
|
785
|
-
const
|
|
793
|
+
const rawText = await res.text();
|
|
794
|
+
let data = {};
|
|
795
|
+
try {
|
|
796
|
+
data = JSON.parse(rawText);
|
|
797
|
+
}
|
|
798
|
+
catch {
|
|
799
|
+
throw new Error("Unable to retrieve database inventory from gateway.");
|
|
800
|
+
}
|
|
786
801
|
if (!res.ok) {
|
|
787
802
|
console.error(`Error: ${data.error || "Failed to fetch databases."}`);
|
|
788
803
|
process.exit(1);
|
|
@@ -792,7 +807,7 @@ async function handleDb() {
|
|
|
792
807
|
console.log("------------------------------------------------------------");
|
|
793
808
|
if (!data.databases || data.databases.length === 0) {
|
|
794
809
|
console.log("No databases provisioned yet.");
|
|
795
|
-
console.log("Run 'npx
|
|
810
|
+
console.log("Run 'vibed db create <name>' (or 'npx @vibedhost/cli db create <name>') to launch a database.\n");
|
|
796
811
|
return;
|
|
797
812
|
}
|
|
798
813
|
data.databases.forEach((d, idx) => {
|
|
@@ -851,7 +866,14 @@ async function handleDb() {
|
|
|
851
866
|
engine: cleanEngine
|
|
852
867
|
})
|
|
853
868
|
});
|
|
854
|
-
const
|
|
869
|
+
const rawText = await res.text();
|
|
870
|
+
let data = {};
|
|
871
|
+
try {
|
|
872
|
+
data = JSON.parse(rawText);
|
|
873
|
+
}
|
|
874
|
+
catch {
|
|
875
|
+
throw new Error("Database initialization started. Run 'vibed db' to check status.");
|
|
876
|
+
}
|
|
855
877
|
if (!res.ok || !data.success) {
|
|
856
878
|
console.error(`Database launch error: ${data.error || "Failed to create database."}`);
|
|
857
879
|
process.exit(1);
|
|
@@ -863,7 +885,7 @@ async function handleDb() {
|
|
|
863
885
|
console.log(`Workspace: ${data.workspaceName}`);
|
|
864
886
|
console.log(`URI: ${data.internalUri}`);
|
|
865
887
|
console.log("------------------------------------------------------------");
|
|
866
|
-
console.log(`To link to your app, run:
|
|
888
|
+
console.log(`To link to your app, run: vibed db link ${data.name}\n`);
|
|
867
889
|
}
|
|
868
890
|
catch (err) {
|
|
869
891
|
console.error(`Connection error: ${err.message}`);
|
|
@@ -875,7 +897,7 @@ async function handleDb() {
|
|
|
875
897
|
const dbTargetName = args[2] && !args[2].startsWith("--") ? args[2] : "";
|
|
876
898
|
const targetAppName = projectConfig?.appName || (0, utils_1.inferAppName)(process.cwd());
|
|
877
899
|
if (!dbTargetName) {
|
|
878
|
-
console.error("Usage: npx
|
|
900
|
+
console.error("Usage: vibed db link <database-name> (or npx @vibedhost/cli db link <database-name>)");
|
|
879
901
|
process.exit(1);
|
|
880
902
|
}
|
|
881
903
|
console.log(`Linking database '${dbTargetName}' to application '${targetAppName}'...`);
|
|
@@ -892,7 +914,14 @@ async function handleDb() {
|
|
|
892
914
|
dbName: dbTargetName
|
|
893
915
|
})
|
|
894
916
|
});
|
|
895
|
-
const
|
|
917
|
+
const rawText = await res.text();
|
|
918
|
+
let data = {};
|
|
919
|
+
try {
|
|
920
|
+
data = JSON.parse(rawText);
|
|
921
|
+
}
|
|
922
|
+
catch {
|
|
923
|
+
throw new Error("Database link request is processing on the workspace.");
|
|
924
|
+
}
|
|
896
925
|
if (!res.ok || !data.success) {
|
|
897
926
|
console.error(`Link error: ${data.error || "Failed to link database."}`);
|
|
898
927
|
process.exit(1);
|
|
@@ -905,7 +934,7 @@ async function handleDb() {
|
|
|
905
934
|
}
|
|
906
935
|
return;
|
|
907
936
|
}
|
|
908
|
-
console.log("Usage: npx
|
|
937
|
+
console.log("Usage: vibed db [create|list|link] (or npx @vibedhost/cli db [create|list|link])");
|
|
909
938
|
}
|
|
910
939
|
main().catch((err) => {
|
|
911
940
|
console.error(`Execution error: ${err.message}`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibedhost/cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "VibedHost Cloud Engine CLI
|
|
3
|
+
"version": "1.0.2",
|
|
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": {
|
|
7
7
|
"vibed": "./dist/index.js",
|
package/src/index.ts
CHANGED
|
@@ -61,7 +61,7 @@ async function main() {
|
|
|
61
61
|
|
|
62
62
|
function printHelp() {
|
|
63
63
|
console.log(`
|
|
64
|
-
VibedHost Cloud Engine
|
|
64
|
+
VibedHost Cloud Engine: Command Line Interface
|
|
65
65
|
--------------------------------------------------------------------------
|
|
66
66
|
Deploy web applications and manage dedicated cloud workspaces directly from
|
|
67
67
|
your terminal, Claude Code, Cursor, or automated CI/CD pipelines.
|
|
@@ -70,12 +70,13 @@ Website: https://www.vibedhost.com
|
|
|
70
70
|
Dashboard: https://www.vibedhost.com/dashboard/workspaces
|
|
71
71
|
|
|
72
72
|
Usage:
|
|
73
|
-
npx
|
|
73
|
+
npx @vibedhost/cli [command] [options]
|
|
74
|
+
vibed [command] [options]
|
|
74
75
|
|
|
75
76
|
Getting Started:
|
|
76
77
|
1. Create account & workspace: https://www.vibedhost.com/register
|
|
77
|
-
2. Authenticate terminal: npx
|
|
78
|
-
3. Deploy local project: npx
|
|
78
|
+
2. Authenticate terminal: npx @vibedhost/cli login
|
|
79
|
+
3. Deploy local project: npx @vibedhost/cli deploy
|
|
79
80
|
|
|
80
81
|
Commands:
|
|
81
82
|
login Authenticate this terminal with your VibedHost account
|
|
@@ -99,13 +100,13 @@ Inspection Options:
|
|
|
99
100
|
--ai Format latest error snippet for AI coding assistants
|
|
100
101
|
|
|
101
102
|
Examples:
|
|
102
|
-
npx
|
|
103
|
-
npx
|
|
104
|
-
npx
|
|
105
|
-
npx
|
|
106
|
-
npx
|
|
107
|
-
npx
|
|
108
|
-
npx
|
|
103
|
+
npx @vibedhost/cli login
|
|
104
|
+
npx @vibedhost/cli deploy
|
|
105
|
+
npx @vibedhost/cli deploy ./dist --name frontend-spa
|
|
106
|
+
npx @vibedhost/cli status
|
|
107
|
+
npx @vibedhost/cli logs my-app
|
|
108
|
+
npx @vibedhost/cli logs my-app --ai
|
|
109
|
+
npx @vibedhost/cli env set DATABASE_URL=postgresql://...
|
|
109
110
|
`);
|
|
110
111
|
}
|
|
111
112
|
|
|
@@ -153,12 +154,12 @@ async function handleLogin() {
|
|
|
153
154
|
|
|
154
155
|
console.log(`\nAuthentication successful!`);
|
|
155
156
|
console.log(`Logged in as: ${pollData.user?.email || "Authenticated User"}`);
|
|
156
|
-
console.log(`Run 'npx
|
|
157
|
+
console.log(`Run 'vibed deploy' (or 'npx @vibedhost/cli deploy') inside any project directory to deploy.`);
|
|
157
158
|
return;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
if (pollData.status === "expired" || pollData.status === "invalid") {
|
|
161
|
-
console.error("\nSession expired or rejected. Please run 'npx
|
|
162
|
+
console.error("\nSession expired or rejected. Please run 'vibed login' (or 'npx @vibedhost/cli login') again.");
|
|
162
163
|
process.exit(1);
|
|
163
164
|
}
|
|
164
165
|
}
|
|
@@ -179,7 +180,7 @@ function handleLogout() {
|
|
|
179
180
|
async function handleWhoami() {
|
|
180
181
|
const config = readGlobalConfig();
|
|
181
182
|
if (!config?.token) {
|
|
182
|
-
console.log("Not authenticated. Run 'npx
|
|
183
|
+
console.log("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login') to connect your account.");
|
|
183
184
|
return;
|
|
184
185
|
}
|
|
185
186
|
|
|
@@ -227,13 +228,13 @@ async function handleDeploy() {
|
|
|
227
228
|
const config = readGlobalConfig();
|
|
228
229
|
if (!config?.token) {
|
|
229
230
|
console.log(`
|
|
230
|
-
VibedHost Cloud Engine
|
|
231
|
+
VibedHost Cloud Engine: Deployment Gateway
|
|
231
232
|
------------------------------------------------------------
|
|
232
233
|
You are not currently authenticated.
|
|
233
234
|
|
|
234
235
|
Get Started:
|
|
235
236
|
1. Create an account: https://www.vibedhost.com/register
|
|
236
|
-
2. Authenticate: npx
|
|
237
|
+
2. Authenticate: vibed login (or npx @vibedhost/cli login)
|
|
237
238
|
`);
|
|
238
239
|
process.exit(1);
|
|
239
240
|
}
|
|
@@ -272,7 +273,7 @@ Get Started:
|
|
|
272
273
|
const wsData = (await wsRes.json()) as any;
|
|
273
274
|
|
|
274
275
|
if (!wsRes.ok) {
|
|
275
|
-
console.error(`Authentication error: ${wsData.error || "Invalid token. Please run 'npx
|
|
276
|
+
console.error(`Authentication error: ${wsData.error || "Invalid token. Please run 'vibed login' (or 'npx @vibedhost/cli login')."}`);
|
|
276
277
|
process.exit(1);
|
|
277
278
|
}
|
|
278
279
|
|
|
@@ -286,7 +287,7 @@ Wallet Balance: €${(wsData.walletBalance || 0).toFixed(2)}
|
|
|
286
287
|
To deploy applications, launch a dedicated cloud workspace:
|
|
287
288
|
https://www.vibedhost.com/dashboard/workspaces
|
|
288
289
|
|
|
289
|
-
Once provisioned, run 'npx
|
|
290
|
+
Once provisioned, run 'vibed deploy' (or 'npx @vibedhost/cli deploy') again.
|
|
290
291
|
`);
|
|
291
292
|
process.exit(1);
|
|
292
293
|
}
|
|
@@ -476,9 +477,9 @@ Workspace: ${targetWs.name}
|
|
|
476
477
|
Status: ${result.error || "A build is already in progress for this application."}
|
|
477
478
|
|
|
478
479
|
Troubleshooting:
|
|
479
|
-
- Stream live logs:
|
|
480
|
-
- Check status:
|
|
481
|
-
- Format for AI debug:
|
|
480
|
+
- Stream live logs: vibed logs ${appName}
|
|
481
|
+
- Check status: vibed status ${appName}
|
|
482
|
+
- Format for AI debug: vibed logs ${appName} --ai
|
|
482
483
|
`);
|
|
483
484
|
process.exit(1);
|
|
484
485
|
}
|
|
@@ -492,9 +493,9 @@ Workspace: ${targetWs.name}
|
|
|
492
493
|
Error: ${result.error || "Build failed. Please check your configuration."}
|
|
493
494
|
|
|
494
495
|
Troubleshooting:
|
|
495
|
-
- Stream logs:
|
|
496
|
-
- Format for AI debug:
|
|
497
|
-
- Adjust port:
|
|
496
|
+
- Stream logs: vibed logs ${appName}
|
|
497
|
+
- Format for AI debug: vibed logs ${appName} --ai
|
|
498
|
+
- Adjust port: vibed port set 3000
|
|
498
499
|
`);
|
|
499
500
|
process.exit(1);
|
|
500
501
|
}
|
|
@@ -562,7 +563,7 @@ Workspace: ${targetWs.name}
|
|
|
562
563
|
Status: Failed
|
|
563
564
|
|
|
564
565
|
Build unsuccessful.
|
|
565
|
-
Run '
|
|
566
|
+
Run 'vibed logs ${finalAppName}' to view container error logs.
|
|
566
567
|
------------------------------------------------------------
|
|
567
568
|
`);
|
|
568
569
|
process.exit(1);
|
|
@@ -575,8 +576,8 @@ Workspace: ${targetWs.name}
|
|
|
575
576
|
Status: Building
|
|
576
577
|
|
|
577
578
|
Your application is continuing to build in the background.
|
|
578
|
-
Run '
|
|
579
|
-
Run '
|
|
579
|
+
Run 'vibed status' to check status.
|
|
580
|
+
Run 'vibed logs' to view live build logs.
|
|
580
581
|
------------------------------------------------------------
|
|
581
582
|
`);
|
|
582
583
|
}
|
|
@@ -589,7 +590,7 @@ Run 'npx vibed logs' to view live build logs.
|
|
|
589
590
|
async function handleStatus() {
|
|
590
591
|
const config = readGlobalConfig();
|
|
591
592
|
if (!config?.token) {
|
|
592
|
-
console.error("Not authenticated. Please run 'npx
|
|
593
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
593
594
|
process.exit(1);
|
|
594
595
|
}
|
|
595
596
|
|
|
@@ -631,7 +632,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
631
632
|
Status: Failed
|
|
632
633
|
|
|
633
634
|
Build unsuccessful.
|
|
634
|
-
Run '
|
|
635
|
+
Run 'vibed logs ${appName}' to view error logs.
|
|
635
636
|
------------------------------------------------------------
|
|
636
637
|
`);
|
|
637
638
|
} else {
|
|
@@ -643,7 +644,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
643
644
|
Status: Building
|
|
644
645
|
|
|
645
646
|
Building application container in background.
|
|
646
|
-
Run '
|
|
647
|
+
Run 'vibed logs ${appName}' to view build progress.
|
|
647
648
|
------------------------------------------------------------
|
|
648
649
|
`);
|
|
649
650
|
}
|
|
@@ -697,7 +698,7 @@ Run 'npx vibed logs ${appName}' to view build progress.
|
|
|
697
698
|
async function handleLogs() {
|
|
698
699
|
const config = readGlobalConfig();
|
|
699
700
|
if (!config?.token) {
|
|
700
|
-
console.error("Not authenticated. Please run 'npx
|
|
701
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
701
702
|
process.exit(1);
|
|
702
703
|
}
|
|
703
704
|
|
|
@@ -707,7 +708,7 @@ async function handleLogs() {
|
|
|
707
708
|
const appName = filteredArgs[0] || projectConfig?.appName || inferAppName(process.cwd());
|
|
708
709
|
|
|
709
710
|
if (!appName) {
|
|
710
|
-
console.error("Please specify application name: npx
|
|
711
|
+
console.error("Please specify application name: vibed logs <appName> (or npx @vibedhost/cli logs <appName>)");
|
|
711
712
|
process.exit(1);
|
|
712
713
|
}
|
|
713
714
|
|
|
@@ -715,7 +716,13 @@ async function handleLogs() {
|
|
|
715
716
|
const res = await fetch(`${API_BASE_URL}/api/cli/logs?appName=${encodeURIComponent(appName)}`, {
|
|
716
717
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
717
718
|
});
|
|
718
|
-
const
|
|
719
|
+
const rawText = await res.text();
|
|
720
|
+
let data: any = {};
|
|
721
|
+
try {
|
|
722
|
+
data = JSON.parse(rawText);
|
|
723
|
+
} catch {
|
|
724
|
+
data = { logs: rawText };
|
|
725
|
+
}
|
|
719
726
|
|
|
720
727
|
if (!res.ok) {
|
|
721
728
|
console.error(`Error: ${data.error || "Failed to retrieve logs."}`);
|
|
@@ -751,7 +758,7 @@ Please analyze these logs and tell me how to resolve the error.
|
|
|
751
758
|
async function handleEnv() {
|
|
752
759
|
const config = readGlobalConfig();
|
|
753
760
|
if (!config?.token) {
|
|
754
|
-
console.error("Not authenticated. Run 'npx
|
|
761
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
755
762
|
process.exit(1);
|
|
756
763
|
}
|
|
757
764
|
|
|
@@ -760,14 +767,14 @@ async function handleEnv() {
|
|
|
760
767
|
const appName = projectConfig?.appName || inferAppName(process.cwd());
|
|
761
768
|
|
|
762
769
|
if (!appName) {
|
|
763
|
-
console.error("No linked project found in this folder. Run inside a project directory or run '
|
|
770
|
+
console.error("No linked project found in this folder. Run inside a project directory or run 'vibed deploy' first.");
|
|
764
771
|
process.exit(1);
|
|
765
772
|
}
|
|
766
773
|
|
|
767
774
|
if (subCommand === "set") {
|
|
768
775
|
const keyVal = args[2];
|
|
769
776
|
if (!keyVal || !keyVal.includes("=")) {
|
|
770
|
-
console.error("Usage: npx
|
|
777
|
+
console.error("Usage: vibed env set KEY=VALUE (or npx @vibedhost/cli env set KEY=VALUE)");
|
|
771
778
|
process.exit(1);
|
|
772
779
|
}
|
|
773
780
|
const idx = keyVal.indexOf("=");
|
|
@@ -822,7 +829,7 @@ async function handleEnv() {
|
|
|
822
829
|
async function handlePort() {
|
|
823
830
|
const config = readGlobalConfig();
|
|
824
831
|
if (!config?.token) {
|
|
825
|
-
console.error("Not authenticated. Run 'npx
|
|
832
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
826
833
|
process.exit(1);
|
|
827
834
|
}
|
|
828
835
|
|
|
@@ -837,7 +844,7 @@ async function handlePort() {
|
|
|
837
844
|
}
|
|
838
845
|
|
|
839
846
|
if (subCommand !== "set" || isNaN(portVal) || portVal < 1 || portVal > 65535) {
|
|
840
|
-
console.error("Usage: npx
|
|
847
|
+
console.error("Usage: vibed port set <1-65535> (or npx @vibedhost/cli port set <1-65535>)");
|
|
841
848
|
process.exit(1);
|
|
842
849
|
}
|
|
843
850
|
|
|
@@ -867,7 +874,7 @@ async function handlePort() {
|
|
|
867
874
|
async function handleDb() {
|
|
868
875
|
const config = readGlobalConfig();
|
|
869
876
|
if (!config?.token) {
|
|
870
|
-
console.error("Not authenticated. Please run 'npx
|
|
877
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
871
878
|
process.exit(1);
|
|
872
879
|
}
|
|
873
880
|
|
|
@@ -880,7 +887,13 @@ async function handleDb() {
|
|
|
880
887
|
const res = await fetch(`${API_BASE_URL}/api/cli/db`, {
|
|
881
888
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
882
889
|
});
|
|
883
|
-
const
|
|
890
|
+
const rawText = await res.text();
|
|
891
|
+
let data: any = {};
|
|
892
|
+
try {
|
|
893
|
+
data = JSON.parse(rawText);
|
|
894
|
+
} catch {
|
|
895
|
+
throw new Error("Unable to retrieve database inventory from gateway.");
|
|
896
|
+
}
|
|
884
897
|
|
|
885
898
|
if (!res.ok) {
|
|
886
899
|
console.error(`Error: ${data.error || "Failed to fetch databases."}`);
|
|
@@ -893,7 +906,7 @@ async function handleDb() {
|
|
|
893
906
|
|
|
894
907
|
if (!data.databases || data.databases.length === 0) {
|
|
895
908
|
console.log("No databases provisioned yet.");
|
|
896
|
-
console.log("Run 'npx
|
|
909
|
+
console.log("Run 'vibed db create <name>' (or 'npx @vibedhost/cli db create <name>') to launch a database.\n");
|
|
897
910
|
return;
|
|
898
911
|
}
|
|
899
912
|
|
|
@@ -957,7 +970,13 @@ async function handleDb() {
|
|
|
957
970
|
})
|
|
958
971
|
});
|
|
959
972
|
|
|
960
|
-
const
|
|
973
|
+
const rawText = await res.text();
|
|
974
|
+
let data: any = {};
|
|
975
|
+
try {
|
|
976
|
+
data = JSON.parse(rawText);
|
|
977
|
+
} catch {
|
|
978
|
+
throw new Error("Database initialization started. Run 'vibed db' to check status.");
|
|
979
|
+
}
|
|
961
980
|
|
|
962
981
|
if (!res.ok || !data.success) {
|
|
963
982
|
console.error(`Database launch error: ${data.error || "Failed to create database."}`);
|
|
@@ -971,7 +990,7 @@ async function handleDb() {
|
|
|
971
990
|
console.log(`Workspace: ${data.workspaceName}`);
|
|
972
991
|
console.log(`URI: ${data.internalUri}`);
|
|
973
992
|
console.log("------------------------------------------------------------");
|
|
974
|
-
console.log(`To link to your app, run:
|
|
993
|
+
console.log(`To link to your app, run: vibed db link ${data.name}\n`);
|
|
975
994
|
} catch (err: any) {
|
|
976
995
|
console.error(`Connection error: ${err.message}`);
|
|
977
996
|
}
|
|
@@ -984,7 +1003,7 @@ async function handleDb() {
|
|
|
984
1003
|
const targetAppName = projectConfig?.appName || inferAppName(process.cwd());
|
|
985
1004
|
|
|
986
1005
|
if (!dbTargetName) {
|
|
987
|
-
console.error("Usage: npx
|
|
1006
|
+
console.error("Usage: vibed db link <database-name> (or npx @vibedhost/cli db link <database-name>)");
|
|
988
1007
|
process.exit(1);
|
|
989
1008
|
}
|
|
990
1009
|
|
|
@@ -1004,7 +1023,13 @@ async function handleDb() {
|
|
|
1004
1023
|
})
|
|
1005
1024
|
});
|
|
1006
1025
|
|
|
1007
|
-
const
|
|
1026
|
+
const rawText = await res.text();
|
|
1027
|
+
let data: any = {};
|
|
1028
|
+
try {
|
|
1029
|
+
data = JSON.parse(rawText);
|
|
1030
|
+
} catch {
|
|
1031
|
+
throw new Error("Database link request is processing on the workspace.");
|
|
1032
|
+
}
|
|
1008
1033
|
|
|
1009
1034
|
if (!res.ok || !data.success) {
|
|
1010
1035
|
console.error(`Link error: ${data.error || "Failed to link database."}`);
|
|
@@ -1019,7 +1044,7 @@ async function handleDb() {
|
|
|
1019
1044
|
return;
|
|
1020
1045
|
}
|
|
1021
1046
|
|
|
1022
|
-
console.log("Usage: npx
|
|
1047
|
+
console.log("Usage: vibed db [create|list|link] (or npx @vibedhost/cli db [create|list|link])");
|
|
1023
1048
|
}
|
|
1024
1049
|
|
|
1025
1050
|
main().catch((err) => {
|