omnish 2.1.3 → 2.1.5
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/CHANGELOG.md +22 -0
- package/README.md +6 -0
- package/dist/downloads/omnish-claude.tar.gz +0 -0
- package/dist/downloads/omnish-cursor.tar.gz +0 -0
- package/dist/index.js +241 -238
- package/package.json +4 -1
- package/scripts/check-native-modules.mjs +11 -3
- package/scripts/check-node-version.cjs +22 -0
- package/scripts/node-version.cjs +243 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnish",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "omnish — allowlisted inbox → your real shell (WhatsApp, Telegram, Discord, Slack, and 20+ channels). No AI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist",
|
|
28
28
|
"scripts/check-native-modules.mjs",
|
|
29
|
+
"scripts/check-node-version.cjs",
|
|
30
|
+
"scripts/node-version.cjs",
|
|
29
31
|
"scripts/fix-node-pty-perms.mjs",
|
|
30
32
|
"README.md",
|
|
31
33
|
"CHANGELOG.md",
|
|
@@ -78,6 +80,7 @@
|
|
|
78
80
|
},
|
|
79
81
|
"scripts": {
|
|
80
82
|
"reinstall": "rm -rf node_modules && pnpm install",
|
|
83
|
+
"preinstall": "node scripts/check-node-version.cjs",
|
|
81
84
|
"postinstall": "node scripts/check-native-modules.mjs && node scripts/fix-node-pty-perms.mjs",
|
|
82
85
|
"build": "node scripts/build-bundle.mjs",
|
|
83
86
|
"build:doc-index": "node scripts/build-doc-index.mjs",
|
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
|
|
6
6
|
const require = createRequire(import.meta.url);
|
|
7
|
+
const { formatNativeModuleNodeHint } = require("./node-version.cjs");
|
|
7
8
|
|
|
8
9
|
const modules = ["better-sqlite3", "node-pty", "@parcel/watcher"];
|
|
9
10
|
|
|
10
11
|
let failed = false;
|
|
12
|
+
let printedNodeHint = false;
|
|
11
13
|
for (const name of modules) {
|
|
12
14
|
try {
|
|
13
15
|
require(name);
|
|
@@ -17,9 +19,15 @@ for (const name of modules) {
|
|
|
17
19
|
`omnish: native module "${name}" failed to load for Node ${process.version} (ABI ${process.versions.modules}).`,
|
|
18
20
|
);
|
|
19
21
|
console.error(` ${err instanceof Error ? err.message : String(err)}`);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
if (!printedNodeHint) {
|
|
23
|
+
printedNodeHint = true;
|
|
24
|
+
console.error(
|
|
25
|
+
" Fix: use Node 22.13+ (see package.json engines), then reinstall or rebuild:",
|
|
26
|
+
);
|
|
27
|
+
console.error(" npm install -g omnish");
|
|
28
|
+
console.error(" npm rebuild -g omnish");
|
|
29
|
+
console.error(formatNativeModuleNodeHint());
|
|
30
|
+
}
|
|
23
31
|
}
|
|
24
32
|
}
|
|
25
33
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* preinstall guard — block unsupported Node with actionable upgrade steps.
|
|
4
|
+
* CommonJS so this runs on Node 10+ (including ancient distro Node 12).
|
|
5
|
+
* Skip with OMNISH_SKIP_NODE_CHECK=1 (not recommended).
|
|
6
|
+
*/
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
var nodeVersion = require("./node-version.cjs");
|
|
10
|
+
|
|
11
|
+
if (process.env.OMNISH_SKIP_NODE_CHECK === "1") {
|
|
12
|
+
console.warn("omnish: skipping Node version check (OMNISH_SKIP_NODE_CHECK=1)");
|
|
13
|
+
process.exit(0);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var result = nodeVersion.checkNodeVersion();
|
|
17
|
+
if (result.ok) {
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
console.error(nodeVersion.formatNodeUpgradeHelp(result));
|
|
22
|
+
process.exit(1);
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js version policy for omnish installs (CommonJS, parseable on Node 10+).
|
|
3
|
+
* Used by preinstall on hosts that may still run distro Node 12/14/16/18.
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
var fs = require("fs");
|
|
8
|
+
var os = require("os");
|
|
9
|
+
var path = require("path");
|
|
10
|
+
|
|
11
|
+
var DEFAULT_ENGINES_NODE = ">=22.13";
|
|
12
|
+
var RECOMMENDED_NODE = "22";
|
|
13
|
+
|
|
14
|
+
function readEnginesNode() {
|
|
15
|
+
try {
|
|
16
|
+
var pkg = JSON.parse(
|
|
17
|
+
fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"),
|
|
18
|
+
);
|
|
19
|
+
if (pkg.engines && typeof pkg.engines.node === "string") {
|
|
20
|
+
return pkg.engines.node;
|
|
21
|
+
}
|
|
22
|
+
return DEFAULT_ENGINES_NODE;
|
|
23
|
+
} catch (err) {
|
|
24
|
+
return DEFAULT_ENGINES_NODE;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function parseSemver(version) {
|
|
29
|
+
var raw = String(version).trim().replace(/^v/, "");
|
|
30
|
+
var m = /^(\d+)\.(\d+)\.(\d+)/.exec(raw);
|
|
31
|
+
if (!m) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return { major: Number(m[1]), minor: Number(m[2]), patch: Number(m[3]) };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function parseEnginesConstraint(constraint) {
|
|
38
|
+
var m = /^(>=|>|<=|<|=)?\s*v?(\d+)(?:\.(\d+))?(?:\.(\d+))?/.exec(
|
|
39
|
+
String(constraint).trim(),
|
|
40
|
+
);
|
|
41
|
+
if (!m) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
op: m[1] || ">=",
|
|
46
|
+
major: Number(m[2]),
|
|
47
|
+
minor: m[3] !== undefined ? Number(m[3]) : 0,
|
|
48
|
+
patch: m[4] !== undefined ? Number(m[4]) : 0,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function satisfiesEngines(current, required) {
|
|
53
|
+
function cmp(a, b) {
|
|
54
|
+
if (a.major !== b.major) {
|
|
55
|
+
return a.major - b.major;
|
|
56
|
+
}
|
|
57
|
+
if (a.minor !== b.minor) {
|
|
58
|
+
return a.minor - b.minor;
|
|
59
|
+
}
|
|
60
|
+
return a.patch - b.patch;
|
|
61
|
+
}
|
|
62
|
+
var delta = cmp(current, required);
|
|
63
|
+
switch (required.op) {
|
|
64
|
+
case ">=":
|
|
65
|
+
return delta >= 0;
|
|
66
|
+
case ">":
|
|
67
|
+
return delta > 0;
|
|
68
|
+
case "<=":
|
|
69
|
+
return delta <= 0;
|
|
70
|
+
case "<":
|
|
71
|
+
return delta < 0;
|
|
72
|
+
case "=":
|
|
73
|
+
return delta === 0;
|
|
74
|
+
default:
|
|
75
|
+
return delta >= 0;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function checkNodeVersion(nodeVersion, enginesNode) {
|
|
80
|
+
if (nodeVersion === undefined) {
|
|
81
|
+
nodeVersion = process.version;
|
|
82
|
+
}
|
|
83
|
+
if (enginesNode === undefined) {
|
|
84
|
+
enginesNode = readEnginesNode();
|
|
85
|
+
}
|
|
86
|
+
var current = parseSemver(nodeVersion);
|
|
87
|
+
var required = parseEnginesConstraint(enginesNode);
|
|
88
|
+
if (!current || !required) {
|
|
89
|
+
return {
|
|
90
|
+
ok: false,
|
|
91
|
+
current: nodeVersion,
|
|
92
|
+
required: enginesNode,
|
|
93
|
+
recommended: RECOMMENDED_NODE,
|
|
94
|
+
reason: "could not parse Node or engines constraint",
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
var ok = satisfiesEngines(current, required);
|
|
98
|
+
return {
|
|
99
|
+
ok: ok,
|
|
100
|
+
current: "v" + current.major + "." + current.minor + "." + current.patch,
|
|
101
|
+
required: enginesNode,
|
|
102
|
+
recommended: RECOMMENDED_NODE,
|
|
103
|
+
reason: ok
|
|
104
|
+
? null
|
|
105
|
+
: "need Node " +
|
|
106
|
+
enginesNode +
|
|
107
|
+
", found v" +
|
|
108
|
+
current.major +
|
|
109
|
+
"." +
|
|
110
|
+
current.minor +
|
|
111
|
+
"." +
|
|
112
|
+
current.patch,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function shellComment(platform) {
|
|
117
|
+
if (platform === "win32") {
|
|
118
|
+
return "REM";
|
|
119
|
+
}
|
|
120
|
+
return "#";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function formatNodeUpgradeHelp(result, platform) {
|
|
124
|
+
if (platform === undefined) {
|
|
125
|
+
platform = os.platform();
|
|
126
|
+
}
|
|
127
|
+
var lines = [];
|
|
128
|
+
var c = shellComment(platform);
|
|
129
|
+
lines.push("");
|
|
130
|
+
lines.push("omnish needs a newer Node.js to install and run.");
|
|
131
|
+
lines.push(" Required : Node " + result.required + " (see package.json engines)");
|
|
132
|
+
lines.push(" You have : " + result.current);
|
|
133
|
+
lines.push(" Recommend: Node " + result.recommended + " (matches .nvmrc in the repo)");
|
|
134
|
+
lines.push("");
|
|
135
|
+
lines.push("Why: omnish ships native addons (better-sqlite3, node-pty) and depends on");
|
|
136
|
+
lines.push("packages that require Node 22+. Older Node cannot install or run omnish.");
|
|
137
|
+
lines.push("");
|
|
138
|
+
lines.push("Pick one upgrade path, then re-run:");
|
|
139
|
+
lines.push(" npm install -g omnish");
|
|
140
|
+
lines.push("");
|
|
141
|
+
|
|
142
|
+
if (platform === "win32") {
|
|
143
|
+
lines.push("Windows — nvm-windows (recommended if you use nvm):");
|
|
144
|
+
lines.push(" nvm install 22");
|
|
145
|
+
lines.push(" nvm use 22");
|
|
146
|
+
lines.push(" node -v");
|
|
147
|
+
lines.push(" npm install -g omnish");
|
|
148
|
+
lines.push("");
|
|
149
|
+
lines.push("Windows — official installer / winget:");
|
|
150
|
+
lines.push(" winget install OpenJS.NodeJS.LTS");
|
|
151
|
+
lines.push(" node -v");
|
|
152
|
+
lines.push(" npm install -g omnish");
|
|
153
|
+
lines.push("");
|
|
154
|
+
lines.push("If npm still uses an old Node, open a new terminal after upgrading.");
|
|
155
|
+
return lines.join("\n");
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (platform === "darwin") {
|
|
159
|
+
lines.push("macOS — nvm (install + set default + install omnish):");
|
|
160
|
+
lines.push(c + " install nvm: https://github.com/nvm-sh/nvm#installing-and-updating");
|
|
161
|
+
lines.push(
|
|
162
|
+
" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash",
|
|
163
|
+
);
|
|
164
|
+
lines.push(c + " restart your shell, then:");
|
|
165
|
+
lines.push(" nvm install 22");
|
|
166
|
+
lines.push(" nvm alias default 22");
|
|
167
|
+
lines.push(" node -v");
|
|
168
|
+
lines.push(" npm install -g omnish");
|
|
169
|
+
lines.push("");
|
|
170
|
+
lines.push("macOS — Homebrew:");
|
|
171
|
+
lines.push(" brew install node@22");
|
|
172
|
+
lines.push(" brew link --overwrite --force node@22");
|
|
173
|
+
lines.push(" node -v");
|
|
174
|
+
lines.push(" npm install -g omnish");
|
|
175
|
+
lines.push("");
|
|
176
|
+
lines.push("macOS — fnm:");
|
|
177
|
+
lines.push(" fnm install 22");
|
|
178
|
+
lines.push(" fnm default 22");
|
|
179
|
+
lines.push(" npm install -g omnish");
|
|
180
|
+
return lines.join("\n");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
lines.push("Linux VPS / server — Debian or Ubuntu (replaces old apt node, e.g. v12):");
|
|
184
|
+
lines.push(" curl -fsSL https://deb.nodesource.com/setup_22.x | bash -");
|
|
185
|
+
lines.push(" apt-get install -y nodejs");
|
|
186
|
+
lines.push(" node -v");
|
|
187
|
+
lines.push(" npm install -g omnish");
|
|
188
|
+
lines.push("");
|
|
189
|
+
lines.push("Linux — nvm (install + set default + install omnish):");
|
|
190
|
+
lines.push(c + " install nvm: https://github.com/nvm-sh/nvm#installing-and-updating");
|
|
191
|
+
lines.push(
|
|
192
|
+
" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash",
|
|
193
|
+
);
|
|
194
|
+
lines.push(c + " restart your shell, then:");
|
|
195
|
+
lines.push(" nvm install 22");
|
|
196
|
+
lines.push(" nvm alias default 22");
|
|
197
|
+
lines.push(" node -v");
|
|
198
|
+
lines.push(" npm install -g omnish");
|
|
199
|
+
lines.push("");
|
|
200
|
+
lines.push("Linux — fnm:");
|
|
201
|
+
lines.push(" fnm install 22");
|
|
202
|
+
lines.push(" fnm default 22");
|
|
203
|
+
lines.push(" npm install -g omnish");
|
|
204
|
+
lines.push("");
|
|
205
|
+
lines.push("Linux — official builds:");
|
|
206
|
+
lines.push(" https://nodejs.org/en/download (pick 22.x)");
|
|
207
|
+
lines.push("");
|
|
208
|
+
lines.push("One-liner bootstrap (tries nvm/fnm, then installs omnish):");
|
|
209
|
+
lines.push(
|
|
210
|
+
" curl -fsSL https://raw.githubusercontent.com/labKnowledge/omnish/main/contrib/install-omnish.sh | bash",
|
|
211
|
+
);
|
|
212
|
+
return lines.join("\n");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function formatNativeModuleNodeHint(overrides) {
|
|
216
|
+
overrides = overrides || {};
|
|
217
|
+
var current =
|
|
218
|
+
overrides.current !== undefined ? overrides.current : process.version;
|
|
219
|
+
var result = checkNodeVersion(current, overrides.required);
|
|
220
|
+
var lines = [
|
|
221
|
+
"",
|
|
222
|
+
"This often means Node was upgraded/downgraded after omnish was installed, or npm used",
|
|
223
|
+
"a different Node than your shell default.",
|
|
224
|
+
"",
|
|
225
|
+
"Node now: " + result.current + " (required: " + result.required + ")",
|
|
226
|
+
"",
|
|
227
|
+
"Fix:",
|
|
228
|
+
" 1. Switch to Node 22+ and set it as default (see commands below)",
|
|
229
|
+
" 2. Reinstall: npm install -g omnish",
|
|
230
|
+
" 3. Or rebuild natives: npm rebuild -g omnish",
|
|
231
|
+
formatNodeUpgradeHelp(result),
|
|
232
|
+
];
|
|
233
|
+
return lines.join("\n");
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
module.exports = {
|
|
237
|
+
parseSemver: parseSemver,
|
|
238
|
+
parseEnginesConstraint: parseEnginesConstraint,
|
|
239
|
+
satisfiesEngines: satisfiesEngines,
|
|
240
|
+
checkNodeVersion: checkNodeVersion,
|
|
241
|
+
formatNodeUpgradeHelp: formatNodeUpgradeHelp,
|
|
242
|
+
formatNativeModuleNodeHint: formatNativeModuleNodeHint,
|
|
243
|
+
};
|