upfynai-code 2.6.2 → 2.6.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/bin/cli.js +31 -3
- package/package.json +1 -1
- package/src/auth.js +12 -4
- package/src/connect.js +2 -2
- package/src/launch.js +4 -4
- package/src/mcp.js +3 -3
package/bin/cli.js
CHANGED
|
@@ -5,13 +5,15 @@ import { login, logout, status } from '../src/auth.js';
|
|
|
5
5
|
import { openHosted, startLocal } from '../src/launch.js';
|
|
6
6
|
import { connect } from '../src/connect.js';
|
|
7
7
|
import { mcp } from '../src/mcp.js';
|
|
8
|
+
import { readConfig, writeConfig, DEFAULTS } from '../src/config.js';
|
|
9
|
+
import chalk from 'chalk';
|
|
8
10
|
|
|
9
11
|
const program = new Command();
|
|
10
12
|
|
|
11
13
|
program
|
|
12
14
|
.name('upfynai-code')
|
|
13
15
|
.description('Launch Upfyn AI coding environment from your terminal')
|
|
14
|
-
.version('2.6.
|
|
16
|
+
.version('2.6.4')
|
|
15
17
|
.option('--local', 'Start a local server instead of opening the hosted app')
|
|
16
18
|
.action(async (options) => {
|
|
17
19
|
if (options.local) {
|
|
@@ -24,8 +26,9 @@ program
|
|
|
24
26
|
program
|
|
25
27
|
.command('login')
|
|
26
28
|
.description('Authenticate with your Upfyn account')
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
+
.option('--server <url>', 'Server URL to authenticate against')
|
|
30
|
+
.action(async (options) => {
|
|
31
|
+
await login(options);
|
|
29
32
|
});
|
|
30
33
|
|
|
31
34
|
program
|
|
@@ -60,4 +63,29 @@ program
|
|
|
60
63
|
await mcp(options);
|
|
61
64
|
});
|
|
62
65
|
|
|
66
|
+
program
|
|
67
|
+
.command('config')
|
|
68
|
+
.description('View or update CLI configuration')
|
|
69
|
+
.option('--server <url>', 'Set the server URL')
|
|
70
|
+
.option('--reset', 'Reset config to defaults')
|
|
71
|
+
.action((options) => {
|
|
72
|
+
if (options.reset) {
|
|
73
|
+
writeConfig({ serverUrl: DEFAULTS.serverUrl, localPort: DEFAULTS.localPort });
|
|
74
|
+
console.log(chalk.green('\n Config reset to defaults.\n'));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (options.server) {
|
|
78
|
+
writeConfig({ serverUrl: options.server.replace(/\/+$/, '') });
|
|
79
|
+
console.log(chalk.green(`\n Server URL set to: ${options.server.replace(/\/+$/, '')}\n`));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Show current config
|
|
83
|
+
const config = readConfig();
|
|
84
|
+
console.log(chalk.bold('\n Upfyn Code — Config\n'));
|
|
85
|
+
console.log(` Server: ${chalk.cyan(config.serverUrl)}`);
|
|
86
|
+
console.log(` Local port: ${chalk.cyan(config.localPort)}`);
|
|
87
|
+
console.log(` Logged in: ${config.token ? chalk.green('Yes') : chalk.yellow('No')}`);
|
|
88
|
+
console.log(` Default: ${chalk.dim(DEFAULTS.serverUrl)}\n`);
|
|
89
|
+
});
|
|
90
|
+
|
|
63
91
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upfynai-code",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4",
|
|
4
4
|
"description": "Unified AI coding interface — access AI chat, terminal, file explorer, git, and visual canvas from any browser. Connect your local machine and code from anywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/auth.js
CHANGED
|
@@ -36,7 +36,12 @@ export async function validateToken() {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export async function login() {
|
|
39
|
+
export async function login(options = {}) {
|
|
40
|
+
// Allow --server flag to override the server URL
|
|
41
|
+
if (options.server) {
|
|
42
|
+
writeConfig({ serverUrl: options.server.replace(/\/+$/, '') });
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
console.log(chalk.bold('\n Upfyn Code — Login\n'));
|
|
41
46
|
|
|
42
47
|
const response = await prompts([
|
|
@@ -82,7 +87,10 @@ export async function login() {
|
|
|
82
87
|
const name = data.user.first_name || data.user.username;
|
|
83
88
|
console.log(chalk.green(`\n Logged in as ${chalk.bold(name)}!\n`));
|
|
84
89
|
} catch (err) {
|
|
85
|
-
|
|
90
|
+
const config = readConfig();
|
|
91
|
+
console.log(chalk.red(`\n Connection error: ${err.message}`));
|
|
92
|
+
console.log(chalk.dim(` Server: ${config.serverUrl}`));
|
|
93
|
+
console.log(chalk.dim(' Check your network or run: uc config --server <url>\n'));
|
|
86
94
|
process.exit(1);
|
|
87
95
|
}
|
|
88
96
|
}
|
|
@@ -96,7 +104,7 @@ export async function status() {
|
|
|
96
104
|
const config = readConfig();
|
|
97
105
|
|
|
98
106
|
if (!config.token) {
|
|
99
|
-
console.log(chalk.yellow('\n Not logged in. Run `
|
|
107
|
+
console.log(chalk.yellow('\n Not logged in. Run `uc login` to authenticate.\n'));
|
|
100
108
|
return;
|
|
101
109
|
}
|
|
102
110
|
|
|
@@ -104,7 +112,7 @@ export async function status() {
|
|
|
104
112
|
const user = await validateToken();
|
|
105
113
|
|
|
106
114
|
if (!user) {
|
|
107
|
-
console.log(chalk.yellow(' Session expired. Run `
|
|
115
|
+
console.log(chalk.yellow(' Session expired. Run `uc login` to re-authenticate.\n'));
|
|
108
116
|
return;
|
|
109
117
|
}
|
|
110
118
|
|
package/src/connect.js
CHANGED
|
@@ -204,14 +204,14 @@ export async function connect(options = {}) {
|
|
|
204
204
|
if (!relayKey) {
|
|
205
205
|
const token = getToken();
|
|
206
206
|
if (!token) {
|
|
207
|
-
console.log(chalk.yellow('\n No account found. Run `
|
|
207
|
+
console.log(chalk.yellow('\n No account found. Run `uc login` first.\n'));
|
|
208
208
|
process.exit(1);
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
console.log(chalk.dim('\n Validating session...'));
|
|
212
212
|
const user = await validateToken();
|
|
213
213
|
if (!user) {
|
|
214
|
-
console.log(chalk.yellow(' Session expired. Run `
|
|
214
|
+
console.log(chalk.yellow(' Session expired. Run `uc login` to re-authenticate.\n'));
|
|
215
215
|
process.exit(1);
|
|
216
216
|
}
|
|
217
217
|
|
package/src/launch.js
CHANGED
|
@@ -8,7 +8,7 @@ export async function openHosted() {
|
|
|
8
8
|
const token = getToken();
|
|
9
9
|
|
|
10
10
|
if (!token) {
|
|
11
|
-
console.log(chalk.yellow('\n No account found. Run `
|
|
11
|
+
console.log(chalk.yellow('\n No account found. Run `uc login` first.\n'));
|
|
12
12
|
process.exit(1);
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ export async function openHosted() {
|
|
|
16
16
|
const user = await validateToken();
|
|
17
17
|
|
|
18
18
|
if (!user) {
|
|
19
|
-
console.log(chalk.yellow(' Session expired. Run `
|
|
19
|
+
console.log(chalk.yellow(' Session expired. Run `uc login` to re-authenticate.\n'));
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -34,7 +34,7 @@ export async function startLocal() {
|
|
|
34
34
|
const token = getToken();
|
|
35
35
|
|
|
36
36
|
if (!token) {
|
|
37
|
-
console.log(chalk.yellow('\n No account found. Run `
|
|
37
|
+
console.log(chalk.yellow('\n No account found. Run `uc login` first.\n'));
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ export async function startLocal() {
|
|
|
42
42
|
const user = await validateToken();
|
|
43
43
|
|
|
44
44
|
if (!user) {
|
|
45
|
-
console.log(chalk.yellow(' Session expired. Run `
|
|
45
|
+
console.log(chalk.yellow(' Session expired. Run `uc login` to re-authenticate.\n'));
|
|
46
46
|
process.exit(1);
|
|
47
47
|
}
|
|
48
48
|
|
package/src/mcp.js
CHANGED
|
@@ -15,13 +15,13 @@ export async function mcp(options = {}) {
|
|
|
15
15
|
if (!relayKey) {
|
|
16
16
|
const token = getToken();
|
|
17
17
|
if (!token) {
|
|
18
|
-
console.log(chalk.yellow('\n No account found. Run `
|
|
18
|
+
console.log(chalk.yellow('\n No account found. Run `uc login` first.\n'));
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const user = await validateToken();
|
|
23
23
|
if (!user) {
|
|
24
|
-
console.log(chalk.yellow('\n Session expired. Run `
|
|
24
|
+
console.log(chalk.yellow('\n Session expired. Run `uc login` to re-authenticate.\n'));
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -40,7 +40,7 @@ export async function mcp(options = {}) {
|
|
|
40
40
|
|
|
41
41
|
const mcpConfig = {
|
|
42
42
|
mcpServers: {
|
|
43
|
-
'
|
|
43
|
+
'upfynai-code': {
|
|
44
44
|
url: `${serverUrl}/mcp`,
|
|
45
45
|
headers: {
|
|
46
46
|
Authorization: `Bearer ${relayKey}`,
|