upfynai-code 2.6.4 → 2.6.5
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 +7 -7
- package/package.json +1 -1
- package/src/auth.js +4 -5
- package/src/config.js +7 -0
- package/src/connect.js +3 -3
package/bin/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ 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';
|
|
8
|
+
import { readConfig, writeConfig, DEFAULTS, displayUrl } from '../src/config.js';
|
|
9
9
|
import chalk from 'chalk';
|
|
10
10
|
|
|
11
11
|
const program = new Command();
|
|
@@ -13,7 +13,7 @@ const program = new Command();
|
|
|
13
13
|
program
|
|
14
14
|
.name('upfynai-code')
|
|
15
15
|
.description('Launch Upfyn AI coding environment from your terminal')
|
|
16
|
-
.version('2.6.
|
|
16
|
+
.version('2.6.5')
|
|
17
17
|
.option('--local', 'Start a local server instead of opening the hosted app')
|
|
18
18
|
.action(async (options) => {
|
|
19
19
|
if (options.local) {
|
|
@@ -75,17 +75,17 @@ program
|
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
if (options.server) {
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
const cleaned = options.server.replace(/\/+$/, '');
|
|
79
|
+
writeConfig({ serverUrl: cleaned });
|
|
80
|
+
console.log(chalk.green(`\n Server set to: ${displayUrl(cleaned)}\n`));
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
82
83
|
// Show current config
|
|
83
84
|
const config = readConfig();
|
|
84
85
|
console.log(chalk.bold('\n Upfyn Code — Config\n'));
|
|
85
|
-
console.log(` Server: ${chalk.cyan(config.serverUrl)}`);
|
|
86
|
+
console.log(` Server: ${chalk.cyan(displayUrl(config.serverUrl))}`);
|
|
86
87
|
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`);
|
|
88
|
+
console.log(` Logged in: ${config.token ? chalk.green('Yes') : chalk.yellow('No')}\n`);
|
|
89
89
|
});
|
|
90
90
|
|
|
91
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.5",
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import prompts from 'prompts';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import { readConfig, writeConfig, clearConfig } from './config.js';
|
|
3
|
+
import { readConfig, writeConfig, clearConfig, displayUrl } from './config.js';
|
|
4
4
|
|
|
5
5
|
async function apiCall(path, options = {}) {
|
|
6
6
|
const config = readConfig();
|
|
@@ -88,9 +88,8 @@ export async function login(options = {}) {
|
|
|
88
88
|
console.log(chalk.green(`\n Logged in as ${chalk.bold(name)}!\n`));
|
|
89
89
|
} catch (err) {
|
|
90
90
|
const config = readConfig();
|
|
91
|
-
console.log(chalk.red(`\n Connection error
|
|
92
|
-
console.log(chalk.dim(
|
|
93
|
-
console.log(chalk.dim(' Check your network or run: uc config --server <url>\n'));
|
|
91
|
+
console.log(chalk.red(`\n Connection error. Could not reach ${displayUrl(config.serverUrl)}.`));
|
|
92
|
+
console.log(chalk.dim(' Check your network and try again.\n'));
|
|
94
93
|
process.exit(1);
|
|
95
94
|
}
|
|
96
95
|
}
|
|
@@ -118,6 +117,6 @@ export async function status() {
|
|
|
118
117
|
|
|
119
118
|
const name = user.first_name || user.username;
|
|
120
119
|
console.log(chalk.bold(` Logged in as: ${chalk.cyan(name)} (${chalk.dim(user.username)})`));
|
|
121
|
-
console.log(chalk.dim(` Server: ${config.serverUrl}`));
|
|
120
|
+
console.log(chalk.dim(` Server: ${displayUrl(config.serverUrl)}`));
|
|
122
121
|
console.log(chalk.dim(` Local port: ${config.localPort}\n`));
|
|
123
122
|
}
|
package/src/config.js
CHANGED
|
@@ -30,4 +30,11 @@ export function clearConfig() {
|
|
|
30
30
|
writeFileSync(CONFIG_PATH, JSON.stringify(DEFAULTS, null, 2) + '\n', 'utf-8');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/** Display-friendly server label — masks the internal URL */
|
|
34
|
+
export function displayUrl(url) {
|
|
35
|
+
if (!url || url === DEFAULTS.serverUrl) return 'Upfyn Cloud';
|
|
36
|
+
// Custom server — show the hostname only
|
|
37
|
+
try { return new URL(url).host; } catch { return url; }
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
export { CONFIG_PATH, DEFAULTS };
|
package/src/connect.js
CHANGED
|
@@ -4,7 +4,7 @@ import { spawn } from 'child_process';
|
|
|
4
4
|
import { promises as fsPromises } from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
|
-
import { readConfig, writeConfig } from './config.js';
|
|
7
|
+
import { readConfig, writeConfig, displayUrl } from './config.js';
|
|
8
8
|
import { getToken, validateToken } from './auth.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -235,7 +235,7 @@ export async function connect(options = {}) {
|
|
|
235
235
|
const wsUrl = serverUrl.replace(/^http/, 'ws') + '/relay?token=' + encodeURIComponent(relayKey);
|
|
236
236
|
|
|
237
237
|
console.log(chalk.bold('\n Upfyn-Code Relay Client\n'));
|
|
238
|
-
console.log(` Server: ${chalk.cyan(serverUrl)}`);
|
|
238
|
+
console.log(` Server: ${chalk.cyan(displayUrl(serverUrl))}`);
|
|
239
239
|
console.log(` Machine: ${chalk.dim(os.hostname())}`);
|
|
240
240
|
console.log(` User: ${chalk.dim(os.userInfo().username)}\n`);
|
|
241
241
|
|
|
@@ -300,7 +300,7 @@ export async function connect(options = {}) {
|
|
|
300
300
|
|
|
301
301
|
ws.on('error', (err) => {
|
|
302
302
|
if (err.code === 'ECONNREFUSED') {
|
|
303
|
-
console.error(chalk.red(` Cannot reach ${serverUrl}. Is the server running?`));
|
|
303
|
+
console.error(chalk.red(` Cannot reach ${displayUrl(serverUrl)}. Is the server running?`));
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
306
|
}
|