centralu 0.1.0-beta.2 → 0.1.0-beta.3

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/centralu.mjs CHANGED
@@ -16,6 +16,7 @@
16
16
  * instead of being rediscovered in every function.
17
17
  */
18
18
  import { execFileSync, spawn } from 'node:child_process'
19
+ import { isNewer } from './semver.mjs'
19
20
  import { chmodSync, existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'
20
21
  import { createRequire } from 'node:module'
21
22
  import { homedir } from 'node:os'
@@ -45,6 +46,7 @@ const DESKTOP_ENTRY = join(homedir(), '.local/share/applications/centralu.deskto
45
46
  */
46
47
  const TARGETS = {
47
48
  'darwin-arm64': { pkg: 'centralu-darwin-arm64', artifact: BUNDLE },
49
+ 'linux-arm64': { pkg: 'centralu-linux-arm64', artifact: `${APP_NAME}.AppImage` },
48
50
  'linux-x64': { pkg: 'centralu-linux-x64', artifact: `${APP_NAME}.AppImage` },
49
51
  }
50
52
 
@@ -219,17 +221,6 @@ async function latestVersion(timeoutMs = 2000) {
219
221
  }
220
222
  }
221
223
 
222
- /** `1.2.10` > `1.2.9` — 문자열 비교로는 틀린다 */
223
- function isNewer(a, b) {
224
- const pa = String(a).split('.').map(Number)
225
- const pb = String(b).split('.').map(Number)
226
- for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
227
- const x = pa[i] ?? 0
228
- const y = pb[i] ?? 0
229
- if (x !== y) return x > y
230
- }
231
- return false
232
- }
233
224
 
234
225
  async function update() {
235
226
  const res = await latestVersion(8000)
package/bin/semver.mjs ADDED
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Version comparison for the launcher's update check.
3
+ *
4
+ * Lives in its own file so it can be tested (tooling/launcher-semver.test.ts):
5
+ * the launcher itself runs commands at import time and cannot be imported by a
6
+ * test. package.json "files" lists the whole bin/ directory, so this ships
7
+ * automatically — but note npm silently drops anything "files" does not cover,
8
+ * and an unshipped import only crashes on users' machines.
9
+ *
10
+ * Why not `.split('.').map(Number)`: that turns `0.1.0-beta.2` into
11
+ * [0, 1, NaN, 2], and `NaN !== NaN` ends the comparison at the third slot with
12
+ * `NaN > NaN` = false — so no beta ever saw the next beta. That is exactly how
13
+ * `centralu update` on 0.1.0-beta.1 answered "이미 최신입니다" while beta.2 sat
14
+ * on the registry (found the day beta.2 shipped).
15
+ */
16
+ export function isNewer(a, b) {
17
+ const [coreA, preA] = split(String(a))
18
+ const [coreB, preB] = split(String(b))
19
+ for (let i = 0; i < 3; i++) {
20
+ const x = coreA[i] ?? 0
21
+ const y = coreB[i] ?? 0
22
+ if (x !== y) return x > y
23
+ }
24
+ // Same core: a release outranks any prerelease of it (1.0.0 > 1.0.0-beta.9).
25
+ if (preA === null && preB === null) return false
26
+ if (preA === null) return true
27
+ if (preB === null) return false
28
+ // Both prereleases: compare dot-separated identifiers, numeric ones as
29
+ // numbers (semver: numeric identifiers always rank below alphanumeric).
30
+ const ia = preA.split('.')
31
+ const ib = preB.split('.')
32
+ for (let i = 0; i < Math.max(ia.length, ib.length); i++) {
33
+ const x = ia[i]
34
+ const y = ib[i]
35
+ if (x === undefined) return false // shorter prerelease ranks lower
36
+ if (y === undefined) return true
37
+ const nx = /^\d+$/.test(x) ? Number(x) : null
38
+ const ny = /^\d+$/.test(y) ? Number(y) : null
39
+ if (nx !== null && ny !== null) {
40
+ if (nx !== ny) return nx > ny
41
+ } else if (nx !== null) {
42
+ return false // numeric < alphanumeric
43
+ } else if (ny !== null) {
44
+ return true
45
+ } else if (x !== y) {
46
+ return x > y
47
+ }
48
+ }
49
+ return false
50
+ }
51
+
52
+ function split(v) {
53
+ const dash = v.indexOf('-')
54
+ const core = (dash === -1 ? v : v.slice(0, dash)).split('.').map(Number)
55
+ const pre = dash === -1 ? null : v.slice(dash + 1)
56
+ return [core, pre]
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centralu",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "Run, watch and steer several Claude Code and Codex CLI sessions from one window",
5
5
  "license": "MIT",
6
6
  "author": "ijun17",
@@ -35,7 +35,8 @@
35
35
  "linux"
36
36
  ],
37
37
  "optionalDependencies": {
38
- "centralu-darwin-arm64": "0.1.0-beta.2",
39
- "centralu-linux-x64": "0.1.0-beta.2"
38
+ "centralu-darwin-arm64": "0.1.0-beta.3",
39
+ "centralu-linux-arm64": "0.1.0-beta.3",
40
+ "centralu-linux-x64": "0.1.0-beta.3"
40
41
  }
41
42
  }