@cdoing/opentuicli 0.1.30 → 0.1.31

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 (2) hide show
  1. package/bin/cdoing-tui +18 -32
  2. package/package.json +6 -6
package/bin/cdoing-tui CHANGED
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
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"
3
+ const childProcess = require("child_process")
4
+ const fs = require("fs")
5
+ const path = require("path")
6
+ const os = require("os")
8
7
 
9
8
  function run(target) {
10
- const result = spawnSync(target, process.argv.slice(2), {
9
+ const result = childProcess.spawnSync(target, process.argv.slice(2), {
11
10
  stdio: "inherit",
12
11
  })
13
12
  if (result.error) {
@@ -23,14 +22,8 @@ if (envPath) {
23
22
  run(envPath)
24
23
  }
25
24
 
26
- const scriptPath = realpathSync(fileURLToPath(import.meta.url))
27
- const scriptDir = dirname(scriptPath)
28
-
29
- // Cached binary path for fast subsequent launches
30
- const cached = join(scriptDir, ".cdoing-tui")
31
- if (existsSync(cached)) {
32
- run(cached)
33
- }
25
+ const scriptPath = fs.realpathSync(__filename)
26
+ const scriptDir = path.dirname(scriptPath)
34
27
 
35
28
  const platformMap = {
36
29
  darwin: "darwin",
@@ -42,13 +35,13 @@ const archMap = {
42
35
  arm64: "arm64",
43
36
  }
44
37
 
45
- let platform = platformMap[osPlatform()]
38
+ let platform = platformMap[os.platform()]
46
39
  if (!platform) {
47
- platform = osPlatform()
40
+ platform = os.platform()
48
41
  }
49
- let arch = archMap[osArch()]
42
+ let arch = archMap[os.arch()]
50
43
  if (!arch) {
51
- arch = osArch()
44
+ arch = os.arch()
52
45
  }
53
46
 
54
47
  const base = "@cdoing/opentuicli-" + platform + "-" + arch
@@ -59,14 +52,14 @@ const names = [base]
59
52
  function findBinary(startDir) {
60
53
  let current = startDir
61
54
  for (;;) {
62
- const modules = join(current, "node_modules")
63
- if (existsSync(modules)) {
55
+ const modules = path.join(current, "node_modules")
56
+ if (fs.existsSync(modules)) {
64
57
  for (const name of names) {
65
- const candidate = join(modules, name, "bin", binary)
66
- if (existsSync(candidate)) return candidate
58
+ const candidate = path.join(modules, name, "bin", binary)
59
+ if (fs.existsSync(candidate)) return candidate
67
60
  }
68
61
  }
69
- const parent = dirname(current)
62
+ const parent = path.dirname(current)
70
63
  if (parent === current) {
71
64
  return
72
65
  }
@@ -77,19 +70,12 @@ function findBinary(startDir) {
77
70
  const resolved = findBinary(scriptDir)
78
71
  if (!resolved) {
79
72
  console.error(
80
- "No pre-built binary found for your platform (" + osPlatform() + "-" + osArch() + ").\n" +
73
+ "No pre-built binary found for your platform (" + os.platform() + "-" + os.arch() + ").\n" +
81
74
  "Try manually installing " +
82
75
  names.map((n) => '"' + n + '"').join(" or ") +
83
- " package"
76
+ " package",
84
77
  )
85
78
  process.exit(1)
86
79
  }
87
80
 
88
- // Cache for fast subsequent launches
89
- try {
90
- symlinkSync(resolved, cached)
91
- } catch {
92
- // ignore — cache is optional
93
- }
94
-
95
81
  run(resolved)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdoing/opentuicli",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",
@@ -38,10 +38,10 @@
38
38
  },
39
39
  "license": "Apache-2.0",
40
40
  "optionalDependencies": {
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"
41
+ "@cdoing/opentuicli-darwin-arm64": "0.1.31",
42
+ "@cdoing/opentuicli-darwin-x64": "0.1.31",
43
+ "@cdoing/opentuicli-linux-arm64": "0.1.31",
44
+ "@cdoing/opentuicli-linux-x64": "0.1.31",
45
+ "@cdoing/opentuicli-windows-x64": "0.1.31"
46
46
  }
47
47
  }