mirror of
https://github.com/sdwolf4103/opencode-working-memory.git
synced 2026-07-17 12:56:42 +02:00
fix: package memory-diag compiled runtime
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
const { execFileSync } = require("child_process");
|
||||
const { existsSync } = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
function isSupportedNodeVersion(version) {
|
||||
@@ -9,13 +10,19 @@ function isSupportedNodeVersion(version) {
|
||||
}
|
||||
|
||||
if (!isSupportedNodeVersion(process.versions.node)) {
|
||||
process.stderr.write(`memory-diag requires Node >=22.6.0 because it runs TypeScript with --experimental-strip-types. Current Node: v${process.versions.node}.\n`);
|
||||
process.stderr.write(`memory-diag requires Node >=22.6.0 per opencode-working-memory package engines. Current Node: v${process.versions.node}.\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const binDir = __dirname;
|
||||
const tsScript = path.join(binDir, "memory-diag.ts");
|
||||
const args = ["--experimental-strip-types", tsScript, ...process.argv.slice(2)];
|
||||
const compiledScript = path.join(binDir, "..", "dist", "scripts", "memory-diag.js");
|
||||
|
||||
if (!existsSync(compiledScript)) {
|
||||
process.stderr.write("memory-diag package is missing dist/scripts/memory-diag.js. Reinstall opencode-working-memory or run npm run build before using the local package.\n");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const args = [compiledScript, ...process.argv.slice(2)];
|
||||
try {
|
||||
execFileSync(process.execPath, args, { stdio: "inherit" });
|
||||
process.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user