@kernaut/kernaut 0.1.5 → 0.1.6-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.
Files changed (2) hide show
  1. package/bin/kernaut.js +52 -1
  2. package/package.json +3 -6
package/bin/kernaut.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Unified entry point for the Kernaut CLI.
3
3
 
4
4
  import { spawn } from "node:child_process";
5
- import { existsSync, realpathSync } from "fs";
5
+ import { existsSync, readFileSync, realpathSync } from "fs";
6
6
  import { createRequire } from "node:module";
7
7
  import path from "path";
8
8
  import { fileURLToPath } from "url";
@@ -132,6 +132,57 @@ const env = {
132
132
  CODEX_MANAGED_PACKAGE_ROOT: realpathSync(path.join(__dirname, "..")),
133
133
  };
134
134
 
135
+ // Point the binary at the resources package when it is installed alongside
136
+ // (see product_design/2026-09-17 capability distribution design, §4 layer 4).
137
+ // The binary self-syncs capability snapshots into ~/.kernaut/resources/ when the
138
+ // postinstall script was blocked, and falls back to reading the package
139
+ // directly when the home drop point is unusable. Resolution goes through
140
+ // node's own module resolution (scoped first, then unscoped) so pnpm and
141
+ // non-hoisted layouts work; the plain sibling candidates remain as a last
142
+ // resort for exotic layouts.
143
+ function resolveResourcesPackageRoot() {
144
+ const packageRoot = realpathSync(path.join(__dirname, ".."));
145
+ let scope = "";
146
+ try {
147
+ const self = JSON.parse(
148
+ readFileSync(path.join(packageRoot, "package.json"), "utf8"),
149
+ );
150
+ if (typeof self.name === "string" && self.name.startsWith("@")) {
151
+ scope = self.name.split("/")[0];
152
+ }
153
+ } catch {
154
+ // Fall back to the unscoped package name.
155
+ }
156
+ const specifiers = [
157
+ scope ? `${scope}/kernaut-resources/package.json` : null,
158
+ "kernaut-resources/package.json",
159
+ ].filter(Boolean);
160
+ for (const specifier of specifiers) {
161
+ try {
162
+ return realpathSync(path.dirname(require.resolve(specifier)));
163
+ } catch {
164
+ // Try the next specifier.
165
+ }
166
+ }
167
+ const candidates = [
168
+ path.join(packageRoot, "node_modules", "kernaut-resources"),
169
+ path.join(packageRoot, "..", "kernaut-resources"),
170
+ ];
171
+ for (const candidate of candidates) {
172
+ try {
173
+ return realpathSync(candidate);
174
+ } catch {
175
+ // Try the next layout.
176
+ }
177
+ }
178
+ return null;
179
+ }
180
+
181
+ const resourcesPackageRoot = resolveResourcesPackageRoot();
182
+ if (resourcesPackageRoot) {
183
+ env.KERNELCLI_NPM_RESOURCES = resourcesPackageRoot;
184
+ }
185
+
135
186
  const child = spawn(binaryPath, process.argv.slice(2), {
136
187
  stdio: "inherit",
137
188
  env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernaut/kernaut",
3
- "version": "0.1.5",
3
+ "version": "0.1.6-beta.1",
4
4
  "description": "Kernaut CLI is a coding agent for kernel and operator optimization workflows.",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
@@ -15,10 +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.5-linux-x64",
19
- "@kernaut/kernaut-linux-arm64": "npm:@kernaut/kernaut@0.1.5-linux-arm64",
20
- "@kernaut/kernaut-darwin-x64": "npm:@kernaut/kernaut@0.1.5-darwin-x64",
21
- "@kernaut/kernaut-darwin-arm64": "npm:@kernaut/kernaut@0.1.5-darwin-arm64",
22
- "@kernaut/kernaut-win32-x64": "npm:@kernaut/kernaut@0.1.5-win32-x64"
18
+ "@kernaut/kernaut-linux-x64": "npm:@kernaut/kernaut@0.1.6-beta.1-linux-x64",
19
+ "@kernaut/kernaut-resources": "0.1.6-beta.1"
23
20
  }
24
21
  }