@kernaut/kernaut 0.1.6-beta.4 → 0.1.17-beta.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/init-config.js +38 -0
- package/package.json +8 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
|
|
7
|
+
// Defaults are inserted before any TOML table so they apply to every turn,
|
|
8
|
+
// including automatic goal continuations. Explicit user settings take priority.
|
|
9
|
+
try {
|
|
10
|
+
const home = process.env.KERNELCLI_HOME || path.join(os.homedir(), ".kernaut");
|
|
11
|
+
const configPath = path.join(home, "config.toml");
|
|
12
|
+
let contents = "";
|
|
13
|
+
try {
|
|
14
|
+
contents = readFileSync(configPath, "utf8");
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error.code !== "ENOENT") throw error;
|
|
17
|
+
}
|
|
18
|
+
const root = contents.split(/^[ \t]*\[/m, 1)[0];
|
|
19
|
+
const defaults = [
|
|
20
|
+
["model_context_window", 1048576],
|
|
21
|
+
["model_auto_compact_token_limit", 943718],
|
|
22
|
+
];
|
|
23
|
+
const missing = defaults.filter(([key]) => {
|
|
24
|
+
const assignment = new RegExp(
|
|
25
|
+
`^[ \\t]*(?:${key}|"${key}"|'${key}')[ \\t]*=`,
|
|
26
|
+
"m",
|
|
27
|
+
);
|
|
28
|
+
return !assignment.test(root);
|
|
29
|
+
});
|
|
30
|
+
if (missing.length > 0) {
|
|
31
|
+
mkdirSync(home, { recursive: true });
|
|
32
|
+
const prefix = missing.map(([key, value]) => `${key} = ${value}\n`).join("");
|
|
33
|
+
writeFileSync(configPath, prefix + contents, { mode: 0o600 });
|
|
34
|
+
}
|
|
35
|
+
} catch (error) {
|
|
36
|
+
// An unwritable home must not prevent the CLI package from installing.
|
|
37
|
+
console.warn(`Kernaut: could not initialize config defaults: ${error.message}`);
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernaut/kernaut",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17-beta.1",
|
|
4
4
|
"description": "Kernaut CLI is a coding agent for kernel and operator optimization workflows.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kernaut": "bin/kernaut.js"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"postinstall": "node bin/init-config.js"
|
|
12
|
+
},
|
|
10
13
|
"engines": {
|
|
11
14
|
"node": ">=16"
|
|
12
15
|
},
|
|
13
16
|
"files": [
|
|
14
|
-
"bin/kernaut.js"
|
|
17
|
+
"bin/kernaut.js",
|
|
18
|
+
"bin/init-config.js"
|
|
15
19
|
],
|
|
16
20
|
"packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319",
|
|
17
21
|
"optionalDependencies": {
|
|
18
|
-
"@kernaut/kernaut-linux-x64": "npm:@kernaut/kernaut@0.1.
|
|
19
|
-
"@kernaut/kernaut-resources": "0.1.
|
|
22
|
+
"@kernaut/kernaut-linux-x64": "npm:@kernaut/kernaut@0.1.17-beta.1-linux-x64",
|
|
23
|
+
"@kernaut/kernaut-resources": "0.1.17-beta.1"
|
|
20
24
|
}
|
|
21
25
|
}
|