alpha-cli-toolkit 1.1.0 → 1.3.0
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/bin/alpha.js +3 -2
- package/package.json +1 -1
- package/utils/auth.js +2 -2
package/bin/alpha.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
require('dotenv').config();
|
|
2
3
|
const { Command } = require('commander');
|
|
3
4
|
const chalk = require('chalk');
|
|
4
5
|
const gradient = require('gradient-string');
|
|
@@ -6,7 +7,7 @@ const Table = require('cli-table3');
|
|
|
6
7
|
const { authenticateViaBrowser, getToken, clearToken } = require('../utils/auth');
|
|
7
8
|
|
|
8
9
|
const program = new Command();
|
|
9
|
-
const BACKEND_URL = process.env.ALPHA_BACKEND_URL;
|
|
10
|
+
const BACKEND_URL = process.env.ALPHA_BACKEND_URL || 'https://alpha-cli.onrender.com/api';
|
|
10
11
|
|
|
11
12
|
program
|
|
12
13
|
.name('alpha')
|
|
@@ -70,7 +71,7 @@ program
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
// Backend health
|
|
73
|
-
const healthUrl =
|
|
74
|
+
const healthUrl = `${BACKEND_URL.replace(/\/api$/, '')}/health`;
|
|
74
75
|
try {
|
|
75
76
|
const { data } = await axios.get(healthUrl, { timeout: 3000 });
|
|
76
77
|
console.log(chalk.green(' ✅ Backend online') + chalk.grey(` (${data.timestamp})`));
|
package/package.json
CHANGED
package/utils/auth.js
CHANGED
|
@@ -78,9 +78,9 @@ async function authenticateViaBrowser() {
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
server.listen(0, async () => {
|
|
81
|
-
const FRONTEND_URL = process.env.FRONTEND_URL;
|
|
81
|
+
const FRONTEND_URL = process.env.FRONTEND_URL || 'https://alpha-cli-ui.vercel.app';
|
|
82
82
|
const port = server.address().port;
|
|
83
|
-
const loginUrl = `${FRONTEND_URL}/?callback=${encodeURIComponent(
|
|
83
|
+
const loginUrl = `${FRONTEND_URL}/?callback=${encodeURIComponent(`http://localhost:${port}`)}`;
|
|
84
84
|
|
|
85
85
|
// Dynamic import for `open` (ESM-only since v9)
|
|
86
86
|
const open = (await import('open')).default;
|