upfynai-code 2.7.4 → 2.8.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/cli.js +1 -1
- package/dist/agents/claude.js +197 -0
- package/dist/agents/codex.js +48 -0
- package/dist/agents/cursor.js +48 -0
- package/dist/agents/detect.js +51 -0
- package/dist/agents/exec.js +31 -0
- package/dist/agents/files.js +105 -0
- package/dist/agents/git.js +18 -0
- package/dist/agents/index.js +87 -0
- package/dist/agents/shell.js +38 -0
- package/dist/agents/utils.js +136 -0
- package/package.json +4 -2
- package/scripts/prepublish.js +41 -0
- package/src/connect.js +61 -515
- package/src/launch.js +39 -15
package/src/launch.js
CHANGED
|
@@ -3,6 +3,11 @@ import chalk from 'chalk';
|
|
|
3
3
|
import { readConfig } from './config.js';
|
|
4
4
|
import { getToken, validateToken } from './auth.js';
|
|
5
5
|
import { startServer } from './server.js';
|
|
6
|
+
import { spawn } from 'child_process';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { dirname, join } from 'path';
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
11
|
|
|
7
12
|
export async function openHosted() {
|
|
8
13
|
const token = getToken();
|
|
@@ -31,24 +36,43 @@ export async function openHosted() {
|
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
export async function startLocal() {
|
|
34
|
-
const
|
|
39
|
+
const config = readConfig();
|
|
40
|
+
const port = config.localPort || 3001;
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
console.log(chalk.yellow('\n No account found. Run `uc login` first.\n'));
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
42
|
+
console.log(chalk.dim('\n Starting local server...'));
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
const
|
|
44
|
+
// Try the new local-server package first
|
|
45
|
+
const localServerPath = join(__dirname, '../../local-server/index.js');
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
process.
|
|
47
|
-
|
|
47
|
+
try {
|
|
48
|
+
// Dynamically import the local server
|
|
49
|
+
process.env.PORT = String(port);
|
|
50
|
+
await import(localServerPath);
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
// Auto-open browser after server starts
|
|
53
|
+
setTimeout(async () => {
|
|
54
|
+
const url = `http://localhost:${port}`;
|
|
55
|
+
console.log(chalk.dim(` Opening ${url} in browser...\n`));
|
|
56
|
+
await open(url);
|
|
57
|
+
}, 2000);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
// Fallback: if local-server fails (missing deps), use the old proxy approach
|
|
60
|
+
console.log(chalk.dim(` Local server not available (${err.message}), falling back to proxy mode...`));
|
|
61
|
+
|
|
62
|
+
const token = getToken();
|
|
63
|
+
if (!token) {
|
|
64
|
+
console.log(chalk.yellow('\n No account found. Run `uc login` first.\n'));
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
52
67
|
|
|
53
|
-
|
|
68
|
+
const user = await validateToken();
|
|
69
|
+
if (!user) {
|
|
70
|
+
console.log(chalk.yellow(' Session expired. Run `uc login` to re-authenticate.\n'));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const name = user.first_name || user.username;
|
|
75
|
+
console.log(chalk.green(` Welcome back, ${chalk.bold(name)}!`));
|
|
76
|
+
await startServer(port, config.serverUrl, token);
|
|
77
|
+
}
|
|
54
78
|
}
|