feat(notify): bundle KDCO notify with ownership migration

This commit is contained in:
Kenny
2026-04-19 14:07:08 +08:00
parent af15e8a413
commit f5a11281f8
17 changed files with 906 additions and 13 deletions
+29 -1
View File
@@ -1,8 +1,10 @@
// postinstall.mjs
// Runs after npm install to verify platform binary is available
import { readFileSync } from "node:fs";
import { existsSync, readFileSync } from "node:fs";
import { createRequire } from "node:module";
import { dirname } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { getPlatformPackageCandidates, getBinaryPath } from "./bin/platform.js";
const require = createRequire(import.meta.url);
@@ -128,6 +130,32 @@ function main() {
console.warn(` The CLI may not work on this platform.`);
// Don't fail installation - let user try anyway
}
void runBundledNotifyBootstrap();
}
async function runBundledNotifyBootstrap() {
try {
const packageRoot = dirname(fileURLToPath(import.meta.url));
const ownershipModulePath = `${packageRoot}/dist/shared/bundled-notify-ownership.js`;
if (!existsSync(ownershipModulePath)) {
return;
}
const ownershipModule = await import(pathToFileURL(ownershipModulePath).href);
if (typeof ownershipModule.ensureBundledNotifyOwnership !== "function") {
return;
}
ownershipModule.ensureBundledNotifyOwnership({
projectDirectory: process.cwd(),
packageRoot,
env: process.env,
});
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
console.warn(`⚠ oh-my-opencode bundled notify bootstrap: ${message}`);
}
}
main();