lucentracode 0.2.0 → 0.2.2
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/lucentracode.js +41 -1
- package/package.json +13 -13
package/bin/lucentracode.js
CHANGED
|
@@ -166,6 +166,33 @@ if (typeof resolved !== "string") {
|
|
|
166
166
|
process.exit(1)
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
// Make sure the binary is actually executable before trying to run it.
|
|
170
|
+
//
|
|
171
|
+
// It frequently is not. These packages are built and published from Windows, which has
|
|
172
|
+
// no POSIX permission bits, so npm records mode 0644 in the tar header and every macOS
|
|
173
|
+
// and Linux install extracts a binary it is not allowed to execute:
|
|
174
|
+
//
|
|
175
|
+
// spawnSync .../bin/lucentracode EACCES
|
|
176
|
+
//
|
|
177
|
+
// Fixing it at pack time would mean the release only ever being publishable from a
|
|
178
|
+
// POSIX machine -- a rule that holds until the day someone publishes from a laptop.
|
|
179
|
+
// Fixing it here makes the tar mode irrelevant, which is the property worth having.
|
|
180
|
+
function ensureExecutable(file) {
|
|
181
|
+
if (platform === "windows") return null
|
|
182
|
+
try {
|
|
183
|
+
const mode = fs.statSync(file).mode
|
|
184
|
+
if (mode & 0o111) return null
|
|
185
|
+
fs.chmodSync(file, (mode & 0o7777) | 0o755)
|
|
186
|
+
return null
|
|
187
|
+
} catch (err) {
|
|
188
|
+
// A read-only or root-owned install directory. Report it rather than failing with
|
|
189
|
+
// a bare EACCES, because the fix is one command and the user cannot guess it.
|
|
190
|
+
return err
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const chmodError = ensureExecutable(resolved)
|
|
195
|
+
|
|
169
196
|
// `stdio: "inherit"` hands the real terminal to the child, which the TUI requires: it
|
|
170
197
|
// needs a genuine TTY for raw mode, resize events and colour. It also means the
|
|
171
198
|
// terminal delivers Ctrl+C to the foreground process group, so the child sees the
|
|
@@ -173,7 +200,20 @@ if (typeof resolved !== "string") {
|
|
|
173
200
|
const result = spawnSync(resolved, process.argv.slice(2), { stdio: "inherit", windowsHide: false })
|
|
174
201
|
|
|
175
202
|
if (result.error) {
|
|
176
|
-
|
|
203
|
+
const lines = [`${PRODUCT}: could not start the binary.`, ` ${resolved}`, ``, `${result.error.message}`]
|
|
204
|
+
if (result.error.code === "EACCES") {
|
|
205
|
+
lines.push(
|
|
206
|
+
``,
|
|
207
|
+
`The binary is not marked executable.` +
|
|
208
|
+
(chmodError ? ` Making it executable failed: ${chmodError.message}` : ``),
|
|
209
|
+
``,
|
|
210
|
+
`Fix it with:`,
|
|
211
|
+
` chmod +x ${resolved}`,
|
|
212
|
+
``,
|
|
213
|
+
`If that is denied, reinstall somewhere you own, or use sudo for the chmod.`,
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
process.stderr.write(lines.join("\n") + "\n")
|
|
177
217
|
process.exit(1)
|
|
178
218
|
}
|
|
179
219
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lucentracode",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "AI coding agent for the terminal, powered by the LucentraCode gateway.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"x64"
|
|
37
37
|
],
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"lucentracode-windows-x64-baseline": "0.2.
|
|
40
|
-
"lucentracode-windows-x64": "0.2.
|
|
41
|
-
"lucentracode-windows-arm64": "0.2.
|
|
42
|
-
"lucentracode-linux-x64-musl": "0.2.
|
|
43
|
-
"lucentracode-linux-x64-baseline-musl": "0.2.
|
|
44
|
-
"lucentracode-linux-x64-baseline": "0.2.
|
|
45
|
-
"lucentracode-linux-x64": "0.2.
|
|
46
|
-
"lucentracode-linux-arm64-musl": "0.2.
|
|
47
|
-
"lucentracode-linux-arm64": "0.2.
|
|
48
|
-
"lucentracode-darwin-x64-baseline": "0.2.
|
|
49
|
-
"lucentracode-darwin-x64": "0.2.
|
|
50
|
-
"lucentracode-darwin-arm64": "0.2.
|
|
39
|
+
"lucentracode-windows-x64-baseline": "0.2.2",
|
|
40
|
+
"lucentracode-windows-x64": "0.2.2",
|
|
41
|
+
"lucentracode-windows-arm64": "0.2.2",
|
|
42
|
+
"lucentracode-linux-x64-musl": "0.2.2",
|
|
43
|
+
"lucentracode-linux-x64-baseline-musl": "0.2.2",
|
|
44
|
+
"lucentracode-linux-x64-baseline": "0.2.2",
|
|
45
|
+
"lucentracode-linux-x64": "0.2.2",
|
|
46
|
+
"lucentracode-linux-arm64-musl": "0.2.2",
|
|
47
|
+
"lucentracode-linux-arm64": "0.2.2",
|
|
48
|
+
"lucentracode-darwin-x64-baseline": "0.2.2",
|
|
49
|
+
"lucentracode-darwin-x64": "0.2.2",
|
|
50
|
+
"lucentracode-darwin-arm64": "0.2.2"
|
|
51
51
|
}
|
|
52
52
|
}
|