@kernaut/kernaut 0.1.6-beta.1 → 0.1.6-beta.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/kernaut.js +43 -1
- package/package.json +3 -3
package/bin/kernaut.js
CHANGED
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
// Unified entry point for the Kernaut CLI.
|
|
3
3
|
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
existsSync,
|
|
7
|
+
mkdirSync,
|
|
8
|
+
readFileSync,
|
|
9
|
+
realpathSync,
|
|
10
|
+
rmSync,
|
|
11
|
+
symlinkSync,
|
|
12
|
+
} from "fs";
|
|
6
13
|
import { createRequire } from "node:module";
|
|
14
|
+
import os from "os";
|
|
7
15
|
import path from "path";
|
|
8
16
|
import { fileURLToPath } from "url";
|
|
9
17
|
|
|
@@ -183,6 +191,40 @@ if (resourcesPackageRoot) {
|
|
|
183
191
|
env.KERNELCLI_NPM_RESOURCES = resourcesPackageRoot;
|
|
184
192
|
}
|
|
185
193
|
|
|
194
|
+
// Compatibility shim for tooling bundled with the capability pack: the
|
|
195
|
+
// humanize helpers invoke the host CLI as `codex` (command -v codex, then
|
|
196
|
+
// `codex exec ... --full-auto ...`). The binary treats argv[0] "codex" as an
|
|
197
|
+
// ordinary invocation (only sandbox/apply-patch aliases are special) and its
|
|
198
|
+
// exec surface keeps a --full-auto compatibility trap, so a symlink is enough.
|
|
199
|
+
// Best effort: when the home is unwritable the child simply runs without the
|
|
200
|
+
// alias.
|
|
201
|
+
function ensureCodexShim(binPath) {
|
|
202
|
+
const home =
|
|
203
|
+
process.env.KERNELCLI_HOME || path.join(os.homedir(), ".kernaut");
|
|
204
|
+
const shimDir = path.join(home, "bin");
|
|
205
|
+
const shim = path.join(shimDir, "codex");
|
|
206
|
+
try {
|
|
207
|
+
mkdirSync(shimDir, { recursive: true });
|
|
208
|
+
try {
|
|
209
|
+
if (realpathSync(shim) === binPath) {
|
|
210
|
+
return shimDir;
|
|
211
|
+
}
|
|
212
|
+
} catch {
|
|
213
|
+
// No usable shim yet; create one below.
|
|
214
|
+
}
|
|
215
|
+
rmSync(shim, { force: true });
|
|
216
|
+
symlinkSync(binPath, shim);
|
|
217
|
+
return shimDir;
|
|
218
|
+
} catch {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const codexShimDir = ensureCodexShim(binaryPath);
|
|
224
|
+
if (codexShimDir) {
|
|
225
|
+
env.PATH = `${codexShimDir}${path.delimiter}${env.PATH ?? process.env.PATH}`;
|
|
226
|
+
}
|
|
227
|
+
|
|
186
228
|
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
187
229
|
stdio: "inherit",
|
|
188
230
|
env,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernaut/kernaut",
|
|
3
|
-
"version": "0.1.6-beta.
|
|
3
|
+
"version": "0.1.6-beta.2",
|
|
4
4
|
"description": "Kernaut CLI is a coding agent for kernel and operator optimization workflows.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@kernaut/kernaut-linux-x64": "npm:@kernaut/kernaut@0.1.6-beta.
|
|
19
|
-
"@kernaut/kernaut-resources": "0.1.6-beta.
|
|
18
|
+
"@kernaut/kernaut-linux-x64": "npm:@kernaut/kernaut@0.1.6-beta.2-linux-x64",
|
|
19
|
+
"@kernaut/kernaut-resources": "0.1.6-beta.2"
|
|
20
20
|
}
|
|
21
21
|
}
|