@hevmind/ask 0.1.0 → 0.1.1
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/ask-launcher.mjs +19 -2
- package/package.json +6 -6
package/bin/ask-launcher.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { accessSync, chmodSync, constants as fsConstants, existsSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { createRequire } from 'node:module';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -42,12 +42,29 @@ function resolvePackagedBinary() {
|
|
|
42
42
|
try {
|
|
43
43
|
const packageJson = require.resolve(`${packageName}/package.json`);
|
|
44
44
|
const candidate = path.join(path.dirname(packageJson), 'bin', executableName());
|
|
45
|
-
|
|
45
|
+
if (!existsSync(candidate)) return null;
|
|
46
|
+
ensureExecutable(candidate);
|
|
47
|
+
return candidate;
|
|
46
48
|
} catch {
|
|
47
49
|
return null;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
// Some package managers strip the executable bit when packing/extracting
|
|
54
|
+
// (pnpm pack only preserves it for a package's own declared bins).
|
|
55
|
+
function ensureExecutable(file) {
|
|
56
|
+
if (process.platform === 'win32') return;
|
|
57
|
+
try {
|
|
58
|
+
accessSync(file, fsConstants.X_OK);
|
|
59
|
+
} catch {
|
|
60
|
+
try {
|
|
61
|
+
chmodSync(file, 0o755);
|
|
62
|
+
} catch {
|
|
63
|
+
// spawn will surface the real error if this didn't help
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
51
68
|
function platformPackageName() {
|
|
52
69
|
const platform = process.platform;
|
|
53
70
|
const arch = process.arch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hevmind/ask",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "hev ask: a heading-anchored, agentic search overlay for Astro docs sites.",
|
|
6
6
|
"keywords": [
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"ask": "./bin/ask.mjs"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@hevmind/ask-darwin-arm64": "0.1.
|
|
32
|
-
"@hevmind/ask-
|
|
33
|
-
"@hevmind/ask-
|
|
34
|
-
"@hevmind/ask-linux-
|
|
35
|
-
"@hevmind/ask-
|
|
31
|
+
"@hevmind/ask-darwin-arm64": "0.1.1",
|
|
32
|
+
"@hevmind/ask-darwin-x64": "0.1.1",
|
|
33
|
+
"@hevmind/ask-win32-x64": "0.1.1",
|
|
34
|
+
"@hevmind/ask-linux-arm64": "0.1.1",
|
|
35
|
+
"@hevmind/ask-linux-x64": "0.1.1"
|
|
36
36
|
},
|
|
37
37
|
"exports": {
|
|
38
38
|
".": "./src/index.ts",
|