@vibedhost/cli 1.0.1 → 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 +64 -36
- package/package.json +3 -3
- package/src/index.ts +60 -36
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.
|
|
@@ -130,11 +130,11 @@ async function handleLogin() {
|
|
|
130
130
|
});
|
|
131
131
|
console.log(`\nAuthentication successful!`);
|
|
132
132
|
console.log(`Logged in as: ${pollData.user?.email || "Authenticated User"}`);
|
|
133
|
-
console.log(`Run 'npx
|
|
133
|
+
console.log(`Run 'vibed deploy' (or 'npx @vibedhost/cli deploy') inside any project directory to deploy.`);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
if (pollData.status === "expired" || pollData.status === "invalid") {
|
|
137
|
-
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.");
|
|
138
138
|
process.exit(1);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -153,7 +153,7 @@ function handleLogout() {
|
|
|
153
153
|
async function handleWhoami() {
|
|
154
154
|
const config = (0, utils_1.readGlobalConfig)();
|
|
155
155
|
if (!config?.token) {
|
|
156
|
-
console.log("Not authenticated. Run 'npx
|
|
156
|
+
console.log("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login') to connect your account.");
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
try {
|
|
@@ -197,13 +197,13 @@ async function handleDeploy() {
|
|
|
197
197
|
const config = (0, utils_1.readGlobalConfig)();
|
|
198
198
|
if (!config?.token) {
|
|
199
199
|
console.log(`
|
|
200
|
-
VibedHost Cloud Engine
|
|
200
|
+
VibedHost Cloud Engine: Deployment Gateway
|
|
201
201
|
------------------------------------------------------------
|
|
202
202
|
You are not currently authenticated.
|
|
203
203
|
|
|
204
204
|
Get Started:
|
|
205
205
|
1. Create an account: https://www.vibedhost.com/register
|
|
206
|
-
2. Authenticate: npx
|
|
206
|
+
2. Authenticate: vibed login (or npx @vibedhost/cli login)
|
|
207
207
|
`);
|
|
208
208
|
process.exit(1);
|
|
209
209
|
}
|
|
@@ -235,7 +235,7 @@ Get Started:
|
|
|
235
235
|
});
|
|
236
236
|
const wsData = (await wsRes.json());
|
|
237
237
|
if (!wsRes.ok) {
|
|
238
|
-
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')."}`);
|
|
239
239
|
process.exit(1);
|
|
240
240
|
}
|
|
241
241
|
workspaces = (wsData.workspaces || []).filter((w) => w.status === "running");
|
|
@@ -247,7 +247,7 @@ Wallet Balance: €${(wsData.walletBalance || 0).toFixed(2)}
|
|
|
247
247
|
To deploy applications, launch a dedicated cloud workspace:
|
|
248
248
|
https://www.vibedhost.com/dashboard/workspaces
|
|
249
249
|
|
|
250
|
-
Once provisioned, run 'npx
|
|
250
|
+
Once provisioned, run 'vibed deploy' (or 'npx @vibedhost/cli deploy') again.
|
|
251
251
|
`);
|
|
252
252
|
process.exit(1);
|
|
253
253
|
}
|
|
@@ -408,9 +408,9 @@ Workspace: ${targetWs.name}
|
|
|
408
408
|
Status: ${result.error || "A build is already in progress for this application."}
|
|
409
409
|
|
|
410
410
|
Troubleshooting:
|
|
411
|
-
- Stream live logs:
|
|
412
|
-
- Check status:
|
|
413
|
-
- 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
|
|
414
414
|
`);
|
|
415
415
|
process.exit(1);
|
|
416
416
|
}
|
|
@@ -423,9 +423,9 @@ Workspace: ${targetWs.name}
|
|
|
423
423
|
Error: ${result.error || "Build failed. Please check your configuration."}
|
|
424
424
|
|
|
425
425
|
Troubleshooting:
|
|
426
|
-
- Stream logs:
|
|
427
|
-
- Format for AI debug:
|
|
428
|
-
- Adjust port:
|
|
426
|
+
- Stream logs: vibed logs ${appName}
|
|
427
|
+
- Format for AI debug: vibed logs ${appName} --ai
|
|
428
|
+
- Adjust port: vibed port set 3000
|
|
429
429
|
`);
|
|
430
430
|
process.exit(1);
|
|
431
431
|
}
|
|
@@ -484,7 +484,7 @@ Workspace: ${targetWs.name}
|
|
|
484
484
|
Status: Failed
|
|
485
485
|
|
|
486
486
|
Build unsuccessful.
|
|
487
|
-
Run '
|
|
487
|
+
Run 'vibed logs ${finalAppName}' to view container error logs.
|
|
488
488
|
------------------------------------------------------------
|
|
489
489
|
`);
|
|
490
490
|
process.exit(1);
|
|
@@ -498,8 +498,8 @@ Workspace: ${targetWs.name}
|
|
|
498
498
|
Status: Building
|
|
499
499
|
|
|
500
500
|
Your application is continuing to build in the background.
|
|
501
|
-
Run '
|
|
502
|
-
Run '
|
|
501
|
+
Run 'vibed status' to check status.
|
|
502
|
+
Run 'vibed logs' to view live build logs.
|
|
503
503
|
------------------------------------------------------------
|
|
504
504
|
`);
|
|
505
505
|
}
|
|
@@ -512,7 +512,7 @@ Run 'npx vibed logs' to view live build logs.
|
|
|
512
512
|
async function handleStatus() {
|
|
513
513
|
const config = (0, utils_1.readGlobalConfig)();
|
|
514
514
|
if (!config?.token) {
|
|
515
|
-
console.error("Not authenticated. Please run 'npx
|
|
515
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
516
516
|
process.exit(1);
|
|
517
517
|
}
|
|
518
518
|
const projectConfig = (0, utils_1.readProjectConfig)();
|
|
@@ -550,7 +550,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
550
550
|
Status: Failed
|
|
551
551
|
|
|
552
552
|
Build unsuccessful.
|
|
553
|
-
Run '
|
|
553
|
+
Run 'vibed logs ${appName}' to view error logs.
|
|
554
554
|
------------------------------------------------------------
|
|
555
555
|
`);
|
|
556
556
|
}
|
|
@@ -563,7 +563,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
563
563
|
Status: Building
|
|
564
564
|
|
|
565
565
|
Building application container in background.
|
|
566
|
-
Run '
|
|
566
|
+
Run 'vibed logs ${appName}' to view build progress.
|
|
567
567
|
------------------------------------------------------------
|
|
568
568
|
`);
|
|
569
569
|
}
|
|
@@ -612,7 +612,7 @@ Run 'npx vibed logs ${appName}' to view build progress.
|
|
|
612
612
|
async function handleLogs() {
|
|
613
613
|
const config = (0, utils_1.readGlobalConfig)();
|
|
614
614
|
if (!config?.token) {
|
|
615
|
-
console.error("Not authenticated. Please run 'npx
|
|
615
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
616
616
|
process.exit(1);
|
|
617
617
|
}
|
|
618
618
|
const isAiFormat = args.includes("--ai");
|
|
@@ -620,14 +620,21 @@ async function handleLogs() {
|
|
|
620
620
|
const projectConfig = (0, utils_1.readProjectConfig)();
|
|
621
621
|
const appName = filteredArgs[0] || projectConfig?.appName || (0, utils_1.inferAppName)(process.cwd());
|
|
622
622
|
if (!appName) {
|
|
623
|
-
console.error("Please specify application name: npx
|
|
623
|
+
console.error("Please specify application name: vibed logs <appName> (or npx @vibedhost/cli logs <appName>)");
|
|
624
624
|
process.exit(1);
|
|
625
625
|
}
|
|
626
626
|
try {
|
|
627
627
|
const res = await fetch(`${utils_1.API_BASE_URL}/api/cli/logs?appName=${encodeURIComponent(appName)}`, {
|
|
628
628
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
629
629
|
});
|
|
630
|
-
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
|
+
}
|
|
631
638
|
if (!res.ok) {
|
|
632
639
|
console.error(`Error: ${data.error || "Failed to retrieve logs."}`);
|
|
633
640
|
process.exit(1);
|
|
@@ -662,20 +669,20 @@ Please analyze these logs and tell me how to resolve the error.
|
|
|
662
669
|
async function handleEnv() {
|
|
663
670
|
const config = (0, utils_1.readGlobalConfig)();
|
|
664
671
|
if (!config?.token) {
|
|
665
|
-
console.error("Not authenticated. Run 'npx
|
|
672
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
666
673
|
process.exit(1);
|
|
667
674
|
}
|
|
668
675
|
const subCommand = args[1];
|
|
669
676
|
const projectConfig = (0, utils_1.readProjectConfig)();
|
|
670
677
|
const appName = projectConfig?.appName || (0, utils_1.inferAppName)(process.cwd());
|
|
671
678
|
if (!appName) {
|
|
672
|
-
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.");
|
|
673
680
|
process.exit(1);
|
|
674
681
|
}
|
|
675
682
|
if (subCommand === "set") {
|
|
676
683
|
const keyVal = args[2];
|
|
677
684
|
if (!keyVal || !keyVal.includes("=")) {
|
|
678
|
-
console.error("Usage: npx
|
|
685
|
+
console.error("Usage: vibed env set KEY=VALUE (or npx @vibedhost/cli env set KEY=VALUE)");
|
|
679
686
|
process.exit(1);
|
|
680
687
|
}
|
|
681
688
|
const idx = keyVal.indexOf("=");
|
|
@@ -731,7 +738,7 @@ async function handleEnv() {
|
|
|
731
738
|
async function handlePort() {
|
|
732
739
|
const config = (0, utils_1.readGlobalConfig)();
|
|
733
740
|
if (!config?.token) {
|
|
734
|
-
console.error("Not authenticated. Run 'npx
|
|
741
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
735
742
|
process.exit(1);
|
|
736
743
|
}
|
|
737
744
|
const subCommand = args[1];
|
|
@@ -743,7 +750,7 @@ async function handlePort() {
|
|
|
743
750
|
process.exit(1);
|
|
744
751
|
}
|
|
745
752
|
if (subCommand !== "set" || isNaN(portVal) || portVal < 1 || portVal > 65535) {
|
|
746
|
-
console.error("Usage: npx
|
|
753
|
+
console.error("Usage: vibed port set <1-65535> (or npx @vibedhost/cli port set <1-65535>)");
|
|
747
754
|
process.exit(1);
|
|
748
755
|
}
|
|
749
756
|
try {
|
|
@@ -772,7 +779,7 @@ async function handlePort() {
|
|
|
772
779
|
async function handleDb() {
|
|
773
780
|
const config = (0, utils_1.readGlobalConfig)();
|
|
774
781
|
if (!config?.token) {
|
|
775
|
-
console.error("Not authenticated. Please run 'npx
|
|
782
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
776
783
|
process.exit(1);
|
|
777
784
|
}
|
|
778
785
|
const subCommand = args[1] || "list";
|
|
@@ -783,7 +790,14 @@ async function handleDb() {
|
|
|
783
790
|
const res = await fetch(`${utils_1.API_BASE_URL}/api/cli/db`, {
|
|
784
791
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
785
792
|
});
|
|
786
|
-
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
|
+
}
|
|
787
801
|
if (!res.ok) {
|
|
788
802
|
console.error(`Error: ${data.error || "Failed to fetch databases."}`);
|
|
789
803
|
process.exit(1);
|
|
@@ -793,7 +807,7 @@ async function handleDb() {
|
|
|
793
807
|
console.log("------------------------------------------------------------");
|
|
794
808
|
if (!data.databases || data.databases.length === 0) {
|
|
795
809
|
console.log("No databases provisioned yet.");
|
|
796
|
-
console.log("Run 'npx
|
|
810
|
+
console.log("Run 'vibed db create <name>' (or 'npx @vibedhost/cli db create <name>') to launch a database.\n");
|
|
797
811
|
return;
|
|
798
812
|
}
|
|
799
813
|
data.databases.forEach((d, idx) => {
|
|
@@ -852,7 +866,14 @@ async function handleDb() {
|
|
|
852
866
|
engine: cleanEngine
|
|
853
867
|
})
|
|
854
868
|
});
|
|
855
|
-
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
|
+
}
|
|
856
877
|
if (!res.ok || !data.success) {
|
|
857
878
|
console.error(`Database launch error: ${data.error || "Failed to create database."}`);
|
|
858
879
|
process.exit(1);
|
|
@@ -864,7 +885,7 @@ async function handleDb() {
|
|
|
864
885
|
console.log(`Workspace: ${data.workspaceName}`);
|
|
865
886
|
console.log(`URI: ${data.internalUri}`);
|
|
866
887
|
console.log("------------------------------------------------------------");
|
|
867
|
-
console.log(`To link to your app, run:
|
|
888
|
+
console.log(`To link to your app, run: vibed db link ${data.name}\n`);
|
|
868
889
|
}
|
|
869
890
|
catch (err) {
|
|
870
891
|
console.error(`Connection error: ${err.message}`);
|
|
@@ -876,7 +897,7 @@ async function handleDb() {
|
|
|
876
897
|
const dbTargetName = args[2] && !args[2].startsWith("--") ? args[2] : "";
|
|
877
898
|
const targetAppName = projectConfig?.appName || (0, utils_1.inferAppName)(process.cwd());
|
|
878
899
|
if (!dbTargetName) {
|
|
879
|
-
console.error("Usage: npx
|
|
900
|
+
console.error("Usage: vibed db link <database-name> (or npx @vibedhost/cli db link <database-name>)");
|
|
880
901
|
process.exit(1);
|
|
881
902
|
}
|
|
882
903
|
console.log(`Linking database '${dbTargetName}' to application '${targetAppName}'...`);
|
|
@@ -893,7 +914,14 @@ async function handleDb() {
|
|
|
893
914
|
dbName: dbTargetName
|
|
894
915
|
})
|
|
895
916
|
});
|
|
896
|
-
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
|
+
}
|
|
897
925
|
if (!res.ok || !data.success) {
|
|
898
926
|
console.error(`Link error: ${data.error || "Failed to link database."}`);
|
|
899
927
|
process.exit(1);
|
|
@@ -906,7 +934,7 @@ async function handleDb() {
|
|
|
906
934
|
}
|
|
907
935
|
return;
|
|
908
936
|
}
|
|
909
|
-
console.log("Usage: npx
|
|
937
|
+
console.log("Usage: vibed db [create|list|link] (or npx @vibedhost/cli db [create|list|link])");
|
|
910
938
|
}
|
|
911
939
|
main().catch((err) => {
|
|
912
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",
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"@types/node": "^20.14.0",
|
|
31
31
|
"typescript": "^5.4.5"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|
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.
|
|
@@ -154,12 +154,12 @@ async function handleLogin() {
|
|
|
154
154
|
|
|
155
155
|
console.log(`\nAuthentication successful!`);
|
|
156
156
|
console.log(`Logged in as: ${pollData.user?.email || "Authenticated User"}`);
|
|
157
|
-
console.log(`Run 'npx
|
|
157
|
+
console.log(`Run 'vibed deploy' (or 'npx @vibedhost/cli deploy') inside any project directory to deploy.`);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
if (pollData.status === "expired" || pollData.status === "invalid") {
|
|
162
|
-
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.");
|
|
163
163
|
process.exit(1);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -180,7 +180,7 @@ function handleLogout() {
|
|
|
180
180
|
async function handleWhoami() {
|
|
181
181
|
const config = readGlobalConfig();
|
|
182
182
|
if (!config?.token) {
|
|
183
|
-
console.log("Not authenticated. Run 'npx
|
|
183
|
+
console.log("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login') to connect your account.");
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -228,13 +228,13 @@ async function handleDeploy() {
|
|
|
228
228
|
const config = readGlobalConfig();
|
|
229
229
|
if (!config?.token) {
|
|
230
230
|
console.log(`
|
|
231
|
-
VibedHost Cloud Engine
|
|
231
|
+
VibedHost Cloud Engine: Deployment Gateway
|
|
232
232
|
------------------------------------------------------------
|
|
233
233
|
You are not currently authenticated.
|
|
234
234
|
|
|
235
235
|
Get Started:
|
|
236
236
|
1. Create an account: https://www.vibedhost.com/register
|
|
237
|
-
2. Authenticate: npx
|
|
237
|
+
2. Authenticate: vibed login (or npx @vibedhost/cli login)
|
|
238
238
|
`);
|
|
239
239
|
process.exit(1);
|
|
240
240
|
}
|
|
@@ -273,7 +273,7 @@ Get Started:
|
|
|
273
273
|
const wsData = (await wsRes.json()) as any;
|
|
274
274
|
|
|
275
275
|
if (!wsRes.ok) {
|
|
276
|
-
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')."}`);
|
|
277
277
|
process.exit(1);
|
|
278
278
|
}
|
|
279
279
|
|
|
@@ -287,7 +287,7 @@ Wallet Balance: €${(wsData.walletBalance || 0).toFixed(2)}
|
|
|
287
287
|
To deploy applications, launch a dedicated cloud workspace:
|
|
288
288
|
https://www.vibedhost.com/dashboard/workspaces
|
|
289
289
|
|
|
290
|
-
Once provisioned, run 'npx
|
|
290
|
+
Once provisioned, run 'vibed deploy' (or 'npx @vibedhost/cli deploy') again.
|
|
291
291
|
`);
|
|
292
292
|
process.exit(1);
|
|
293
293
|
}
|
|
@@ -477,9 +477,9 @@ Workspace: ${targetWs.name}
|
|
|
477
477
|
Status: ${result.error || "A build is already in progress for this application."}
|
|
478
478
|
|
|
479
479
|
Troubleshooting:
|
|
480
|
-
- Stream live logs:
|
|
481
|
-
- Check status:
|
|
482
|
-
- 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
|
|
483
483
|
`);
|
|
484
484
|
process.exit(1);
|
|
485
485
|
}
|
|
@@ -493,9 +493,9 @@ Workspace: ${targetWs.name}
|
|
|
493
493
|
Error: ${result.error || "Build failed. Please check your configuration."}
|
|
494
494
|
|
|
495
495
|
Troubleshooting:
|
|
496
|
-
- Stream logs:
|
|
497
|
-
- Format for AI debug:
|
|
498
|
-
- Adjust port:
|
|
496
|
+
- Stream logs: vibed logs ${appName}
|
|
497
|
+
- Format for AI debug: vibed logs ${appName} --ai
|
|
498
|
+
- Adjust port: vibed port set 3000
|
|
499
499
|
`);
|
|
500
500
|
process.exit(1);
|
|
501
501
|
}
|
|
@@ -563,7 +563,7 @@ Workspace: ${targetWs.name}
|
|
|
563
563
|
Status: Failed
|
|
564
564
|
|
|
565
565
|
Build unsuccessful.
|
|
566
|
-
Run '
|
|
566
|
+
Run 'vibed logs ${finalAppName}' to view container error logs.
|
|
567
567
|
------------------------------------------------------------
|
|
568
568
|
`);
|
|
569
569
|
process.exit(1);
|
|
@@ -576,8 +576,8 @@ Workspace: ${targetWs.name}
|
|
|
576
576
|
Status: Building
|
|
577
577
|
|
|
578
578
|
Your application is continuing to build in the background.
|
|
579
|
-
Run '
|
|
580
|
-
Run '
|
|
579
|
+
Run 'vibed status' to check status.
|
|
580
|
+
Run 'vibed logs' to view live build logs.
|
|
581
581
|
------------------------------------------------------------
|
|
582
582
|
`);
|
|
583
583
|
}
|
|
@@ -590,7 +590,7 @@ Run 'npx vibed logs' to view live build logs.
|
|
|
590
590
|
async function handleStatus() {
|
|
591
591
|
const config = readGlobalConfig();
|
|
592
592
|
if (!config?.token) {
|
|
593
|
-
console.error("Not authenticated. Please run 'npx
|
|
593
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
594
594
|
process.exit(1);
|
|
595
595
|
}
|
|
596
596
|
|
|
@@ -632,7 +632,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
632
632
|
Status: Failed
|
|
633
633
|
|
|
634
634
|
Build unsuccessful.
|
|
635
|
-
Run '
|
|
635
|
+
Run 'vibed logs ${appName}' to view error logs.
|
|
636
636
|
------------------------------------------------------------
|
|
637
637
|
`);
|
|
638
638
|
} else {
|
|
@@ -644,7 +644,7 @@ Workspace: ${data.workspaceName || "Workspace"}
|
|
|
644
644
|
Status: Building
|
|
645
645
|
|
|
646
646
|
Building application container in background.
|
|
647
|
-
Run '
|
|
647
|
+
Run 'vibed logs ${appName}' to view build progress.
|
|
648
648
|
------------------------------------------------------------
|
|
649
649
|
`);
|
|
650
650
|
}
|
|
@@ -698,7 +698,7 @@ Run 'npx vibed logs ${appName}' to view build progress.
|
|
|
698
698
|
async function handleLogs() {
|
|
699
699
|
const config = readGlobalConfig();
|
|
700
700
|
if (!config?.token) {
|
|
701
|
-
console.error("Not authenticated. Please run 'npx
|
|
701
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
702
702
|
process.exit(1);
|
|
703
703
|
}
|
|
704
704
|
|
|
@@ -708,7 +708,7 @@ async function handleLogs() {
|
|
|
708
708
|
const appName = filteredArgs[0] || projectConfig?.appName || inferAppName(process.cwd());
|
|
709
709
|
|
|
710
710
|
if (!appName) {
|
|
711
|
-
console.error("Please specify application name: npx
|
|
711
|
+
console.error("Please specify application name: vibed logs <appName> (or npx @vibedhost/cli logs <appName>)");
|
|
712
712
|
process.exit(1);
|
|
713
713
|
}
|
|
714
714
|
|
|
@@ -716,7 +716,13 @@ async function handleLogs() {
|
|
|
716
716
|
const res = await fetch(`${API_BASE_URL}/api/cli/logs?appName=${encodeURIComponent(appName)}`, {
|
|
717
717
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
718
718
|
});
|
|
719
|
-
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
|
+
}
|
|
720
726
|
|
|
721
727
|
if (!res.ok) {
|
|
722
728
|
console.error(`Error: ${data.error || "Failed to retrieve logs."}`);
|
|
@@ -752,7 +758,7 @@ Please analyze these logs and tell me how to resolve the error.
|
|
|
752
758
|
async function handleEnv() {
|
|
753
759
|
const config = readGlobalConfig();
|
|
754
760
|
if (!config?.token) {
|
|
755
|
-
console.error("Not authenticated. Run 'npx
|
|
761
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
756
762
|
process.exit(1);
|
|
757
763
|
}
|
|
758
764
|
|
|
@@ -761,14 +767,14 @@ async function handleEnv() {
|
|
|
761
767
|
const appName = projectConfig?.appName || inferAppName(process.cwd());
|
|
762
768
|
|
|
763
769
|
if (!appName) {
|
|
764
|
-
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.");
|
|
765
771
|
process.exit(1);
|
|
766
772
|
}
|
|
767
773
|
|
|
768
774
|
if (subCommand === "set") {
|
|
769
775
|
const keyVal = args[2];
|
|
770
776
|
if (!keyVal || !keyVal.includes("=")) {
|
|
771
|
-
console.error("Usage: npx
|
|
777
|
+
console.error("Usage: vibed env set KEY=VALUE (or npx @vibedhost/cli env set KEY=VALUE)");
|
|
772
778
|
process.exit(1);
|
|
773
779
|
}
|
|
774
780
|
const idx = keyVal.indexOf("=");
|
|
@@ -823,7 +829,7 @@ async function handleEnv() {
|
|
|
823
829
|
async function handlePort() {
|
|
824
830
|
const config = readGlobalConfig();
|
|
825
831
|
if (!config?.token) {
|
|
826
|
-
console.error("Not authenticated. Run 'npx
|
|
832
|
+
console.error("Not authenticated. Run 'vibed login' (or 'npx @vibedhost/cli login').");
|
|
827
833
|
process.exit(1);
|
|
828
834
|
}
|
|
829
835
|
|
|
@@ -838,7 +844,7 @@ async function handlePort() {
|
|
|
838
844
|
}
|
|
839
845
|
|
|
840
846
|
if (subCommand !== "set" || isNaN(portVal) || portVal < 1 || portVal > 65535) {
|
|
841
|
-
console.error("Usage: npx
|
|
847
|
+
console.error("Usage: vibed port set <1-65535> (or npx @vibedhost/cli port set <1-65535>)");
|
|
842
848
|
process.exit(1);
|
|
843
849
|
}
|
|
844
850
|
|
|
@@ -868,7 +874,7 @@ async function handlePort() {
|
|
|
868
874
|
async function handleDb() {
|
|
869
875
|
const config = readGlobalConfig();
|
|
870
876
|
if (!config?.token) {
|
|
871
|
-
console.error("Not authenticated. Please run 'npx
|
|
877
|
+
console.error("Not authenticated. Please run 'vibed login' (or 'npx @vibedhost/cli login') first.");
|
|
872
878
|
process.exit(1);
|
|
873
879
|
}
|
|
874
880
|
|
|
@@ -881,7 +887,13 @@ async function handleDb() {
|
|
|
881
887
|
const res = await fetch(`${API_BASE_URL}/api/cli/db`, {
|
|
882
888
|
headers: { Authorization: `Bearer ${config.token}` }
|
|
883
889
|
});
|
|
884
|
-
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
|
+
}
|
|
885
897
|
|
|
886
898
|
if (!res.ok) {
|
|
887
899
|
console.error(`Error: ${data.error || "Failed to fetch databases."}`);
|
|
@@ -894,7 +906,7 @@ async function handleDb() {
|
|
|
894
906
|
|
|
895
907
|
if (!data.databases || data.databases.length === 0) {
|
|
896
908
|
console.log("No databases provisioned yet.");
|
|
897
|
-
console.log("Run 'npx
|
|
909
|
+
console.log("Run 'vibed db create <name>' (or 'npx @vibedhost/cli db create <name>') to launch a database.\n");
|
|
898
910
|
return;
|
|
899
911
|
}
|
|
900
912
|
|
|
@@ -958,7 +970,13 @@ async function handleDb() {
|
|
|
958
970
|
})
|
|
959
971
|
});
|
|
960
972
|
|
|
961
|
-
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
|
+
}
|
|
962
980
|
|
|
963
981
|
if (!res.ok || !data.success) {
|
|
964
982
|
console.error(`Database launch error: ${data.error || "Failed to create database."}`);
|
|
@@ -972,7 +990,7 @@ async function handleDb() {
|
|
|
972
990
|
console.log(`Workspace: ${data.workspaceName}`);
|
|
973
991
|
console.log(`URI: ${data.internalUri}`);
|
|
974
992
|
console.log("------------------------------------------------------------");
|
|
975
|
-
console.log(`To link to your app, run:
|
|
993
|
+
console.log(`To link to your app, run: vibed db link ${data.name}\n`);
|
|
976
994
|
} catch (err: any) {
|
|
977
995
|
console.error(`Connection error: ${err.message}`);
|
|
978
996
|
}
|
|
@@ -985,7 +1003,7 @@ async function handleDb() {
|
|
|
985
1003
|
const targetAppName = projectConfig?.appName || inferAppName(process.cwd());
|
|
986
1004
|
|
|
987
1005
|
if (!dbTargetName) {
|
|
988
|
-
console.error("Usage: npx
|
|
1006
|
+
console.error("Usage: vibed db link <database-name> (or npx @vibedhost/cli db link <database-name>)");
|
|
989
1007
|
process.exit(1);
|
|
990
1008
|
}
|
|
991
1009
|
|
|
@@ -1005,7 +1023,13 @@ async function handleDb() {
|
|
|
1005
1023
|
})
|
|
1006
1024
|
});
|
|
1007
1025
|
|
|
1008
|
-
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
|
+
}
|
|
1009
1033
|
|
|
1010
1034
|
if (!res.ok || !data.success) {
|
|
1011
1035
|
console.error(`Link error: ${data.error || "Failed to link database."}`);
|
|
@@ -1020,7 +1044,7 @@ async function handleDb() {
|
|
|
1020
1044
|
return;
|
|
1021
1045
|
}
|
|
1022
1046
|
|
|
1023
|
-
console.log("Usage: npx
|
|
1047
|
+
console.log("Usage: vibed db [create|list|link] (or npx @vibedhost/cli db [create|list|link])");
|
|
1024
1048
|
}
|
|
1025
1049
|
|
|
1026
1050
|
main().catch((err) => {
|