@cdoing/opentuicli 0.1.28 → 0.1.30
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/cdoing-tui +21 -20
- package/package.json +8 -7
package/bin/cdoing-tui
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { spawnSync } from "node:child_process"
|
|
4
|
+
import { existsSync, realpathSync, symlinkSync } from "node:fs"
|
|
5
|
+
import { dirname, join } from "node:path"
|
|
6
|
+
import { platform as osPlatform, arch as osArch } from "node:os"
|
|
7
|
+
import { fileURLToPath } from "node:url"
|
|
7
8
|
|
|
8
9
|
function run(target) {
|
|
9
|
-
const result =
|
|
10
|
+
const result = spawnSync(target, process.argv.slice(2), {
|
|
10
11
|
stdio: "inherit",
|
|
11
12
|
})
|
|
12
13
|
if (result.error) {
|
|
@@ -22,12 +23,12 @@ if (envPath) {
|
|
|
22
23
|
run(envPath)
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
const scriptPath =
|
|
26
|
-
const scriptDir =
|
|
26
|
+
const scriptPath = realpathSync(fileURLToPath(import.meta.url))
|
|
27
|
+
const scriptDir = dirname(scriptPath)
|
|
27
28
|
|
|
28
29
|
// Cached binary path for fast subsequent launches
|
|
29
|
-
const cached =
|
|
30
|
-
if (
|
|
30
|
+
const cached = join(scriptDir, ".cdoing-tui")
|
|
31
|
+
if (existsSync(cached)) {
|
|
31
32
|
run(cached)
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -41,13 +42,13 @@ const archMap = {
|
|
|
41
42
|
arm64: "arm64",
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
let platform = platformMap[
|
|
45
|
+
let platform = platformMap[osPlatform()]
|
|
45
46
|
if (!platform) {
|
|
46
|
-
platform =
|
|
47
|
+
platform = osPlatform()
|
|
47
48
|
}
|
|
48
|
-
let arch = archMap[
|
|
49
|
+
let arch = archMap[osArch()]
|
|
49
50
|
if (!arch) {
|
|
50
|
-
arch =
|
|
51
|
+
arch = osArch()
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
const base = "@cdoing/opentuicli-" + platform + "-" + arch
|
|
@@ -58,14 +59,14 @@ const names = [base]
|
|
|
58
59
|
function findBinary(startDir) {
|
|
59
60
|
let current = startDir
|
|
60
61
|
for (;;) {
|
|
61
|
-
const modules =
|
|
62
|
-
if (
|
|
62
|
+
const modules = join(current, "node_modules")
|
|
63
|
+
if (existsSync(modules)) {
|
|
63
64
|
for (const name of names) {
|
|
64
|
-
const candidate =
|
|
65
|
-
if (
|
|
65
|
+
const candidate = join(modules, name, "bin", binary)
|
|
66
|
+
if (existsSync(candidate)) return candidate
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
|
-
const parent =
|
|
69
|
+
const parent = dirname(current)
|
|
69
70
|
if (parent === current) {
|
|
70
71
|
return
|
|
71
72
|
}
|
|
@@ -76,7 +77,7 @@ function findBinary(startDir) {
|
|
|
76
77
|
const resolved = findBinary(scriptDir)
|
|
77
78
|
if (!resolved) {
|
|
78
79
|
console.error(
|
|
79
|
-
"No pre-built binary found for your platform (" +
|
|
80
|
+
"No pre-built binary found for your platform (" + osPlatform() + "-" + osArch() + ").\n" +
|
|
80
81
|
"Try manually installing " +
|
|
81
82
|
names.map((n) => '"' + n + '"').join(" or ") +
|
|
82
83
|
" package"
|
|
@@ -86,7 +87,7 @@ if (!resolved) {
|
|
|
86
87
|
|
|
87
88
|
// Cache for fast subsequent launches
|
|
88
89
|
try {
|
|
89
|
-
|
|
90
|
+
symlinkSync(resolved, cached)
|
|
90
91
|
} catch {
|
|
91
92
|
// ignore — cache is optional
|
|
92
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdoing/opentuicli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"description": "OpenTUI-based terminal interface for cdoing agent (inspired by opencode's TUI)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "bun run build.ts --single",
|
|
16
|
+
"build:dev": "bun run build.ts --single && node postinstall.mjs",
|
|
16
17
|
"build:all": "bun run build.ts",
|
|
17
18
|
"typecheck": "tsc --noEmit",
|
|
18
|
-
"dev": "bun --watch src/index.ts",
|
|
19
|
+
"dev": "bun --preload ./preload.ts --watch src/index.ts",
|
|
19
20
|
"start": "./dist/cdoing-tui-current/bin/cdoing-tui",
|
|
20
21
|
"clean": "rm -rf dist"
|
|
21
22
|
},
|
|
@@ -37,10 +38,10 @@
|
|
|
37
38
|
},
|
|
38
39
|
"license": "Apache-2.0",
|
|
39
40
|
"optionalDependencies": {
|
|
40
|
-
"@cdoing/opentuicli-darwin-arm64": "0.1.
|
|
41
|
-
"@cdoing/opentuicli-darwin-x64": "0.1.
|
|
42
|
-
"@cdoing/opentuicli-linux-arm64": "0.1.
|
|
43
|
-
"@cdoing/opentuicli-linux-x64": "0.1.
|
|
44
|
-
"@cdoing/opentuicli-windows-x64": "0.1.
|
|
41
|
+
"@cdoing/opentuicli-darwin-arm64": "0.1.30",
|
|
42
|
+
"@cdoing/opentuicli-darwin-x64": "0.1.30",
|
|
43
|
+
"@cdoing/opentuicli-linux-arm64": "0.1.30",
|
|
44
|
+
"@cdoing/opentuicli-linux-x64": "0.1.30",
|
|
45
|
+
"@cdoing/opentuicli-windows-x64": "0.1.30"
|
|
45
46
|
}
|
|
46
47
|
}
|