@phenx-inc/ctlsurf 0.3.10 → 0.3.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phenx-inc/ctlsurf",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "Agent-agnostic terminal and desktop app for ctlsurf — run Claude Code, Codex, or any coding agent with live session logging and remote control",
5
5
  "main": "out/main/index.js",
6
6
  "bin": {
@@ -27,11 +27,24 @@ function rebrand() {
27
27
 
28
28
  if (fs.existsSync(SENTINEL)) return true
29
29
 
30
- let pathTxtPath = path.join(ELECTRON_DIR, 'path.txt')
30
+ const pathTxtPath = path.join(ELECTRON_DIR, 'path.txt')
31
31
  if (!fs.existsSync(pathTxtPath)) return false
32
32
 
33
- const relBin = fs.readFileSync(pathTxtPath, 'utf-8').trim()
34
- const electronBinary = path.join(ELECTRON_DIR, relBin)
33
+ // Resolve the actual binary path using electron's own resolver so we don't
34
+ // have to reverse-engineer its path.txt convention (it joins __dirname +
35
+ // 'dist' + path.txt content).
36
+ let electronBinary
37
+ try {
38
+ delete require.cache[require.resolve(ELECTRON_DIR)]
39
+ electronBinary = require(ELECTRON_DIR)
40
+ } catch (err) {
41
+ log(`could not resolve electron binary: ${err.message}`)
42
+ return false
43
+ }
44
+ if (!electronBinary || !fs.existsSync(electronBinary)) {
45
+ log(`electron binary not found at ${electronBinary}`)
46
+ return false
47
+ }
35
48
 
36
49
  try {
37
50
  if (process.platform === 'darwin') {
@@ -100,8 +113,9 @@ function rebrandDarwin(electronBinary, pathTxtPath) {
100
113
  finalAppDir = newAppDir
101
114
  }
102
115
 
103
- // 6) Update path.txt to point at new bundle/binary
104
- const newRel = path.join('dist', `${PRODUCT_NAME}.app`, 'Contents', 'MacOS', PRODUCT_NAME)
116
+ // 6) Update path.txt to point at new bundle/binary. electron/index.js joins
117
+ // __dirname + 'dist' + path.txt, so we write the path relative to dist/.
118
+ const newRel = path.join(`${PRODUCT_NAME}.app`, 'Contents', 'MacOS', PRODUCT_NAME)
105
119
  fs.writeFileSync(pathTxtPath, newRel)
106
120
 
107
121
  // 7) Re-sign ad-hoc — original signature is invalidated by our edits, and
@@ -162,7 +176,8 @@ function rebrandLinux(electronBinary, pathTxtPath) {
162
176
  if (fs.existsSync(electronBinary) && !fs.existsSync(newBinary)) {
163
177
  fs.renameSync(electronBinary, newBinary)
164
178
  }
165
- fs.writeFileSync(pathTxtPath, path.join('dist', PRODUCT_NAME))
179
+ // path.txt is relative to dist/
180
+ fs.writeFileSync(pathTxtPath, PRODUCT_NAME)
166
181
  }
167
182
 
168
183
  // ─── Windows ────────────────────────────────────────
@@ -177,7 +192,8 @@ function rebrandWin32(electronBinary, pathTxtPath) {
177
192
  if (fs.existsSync(electronBinary) && !fs.existsSync(newBinary)) {
178
193
  fs.renameSync(electronBinary, newBinary)
179
194
  }
180
- fs.writeFileSync(pathTxtPath, path.join('dist', `${PRODUCT_NAME}.exe`))
195
+ // path.txt is relative to dist/
196
+ fs.writeFileSync(pathTxtPath, `${PRODUCT_NAME}.exe`)
181
197
  }
182
198
 
183
199
  // ─── Entry ──────────────────────────────────────────