upfynai-code 2.6.3 → 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.
Files changed (3) hide show
  1. package/bin/cli.js +31 -3
  2. package/package.json +1 -1
  3. package/src/auth.js +10 -2
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.3')
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
- .action(async () => {
28
- await login();
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",
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
- console.log(chalk.red('\n Connection error. Check your network and try again.\n'));
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
  }