@muthuishere/ctx-optimize 0.1.0
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/ctx-optimize.js +44 -0
- package/package.json +24 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Thin launcher: resolves the platform sub-package installed via
|
|
3
|
+
// optionalDependencies and execs its binary. No postinstall, no download.
|
|
4
|
+
"use strict";
|
|
5
|
+
const { spawn } = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
const platformMap = {
|
|
9
|
+
"darwin-arm64": "@muthuishere/ctx-optimize-darwin-arm64",
|
|
10
|
+
"darwin-x64": "@muthuishere/ctx-optimize-darwin-x64",
|
|
11
|
+
"linux-arm64": "@muthuishere/ctx-optimize-linux-arm64",
|
|
12
|
+
"linux-x64": "@muthuishere/ctx-optimize-linux-x64",
|
|
13
|
+
"win32-x64": "@muthuishere/ctx-optimize-windows-x64",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const key = `${process.platform}-${process.arch}`;
|
|
17
|
+
const pkg = platformMap[key];
|
|
18
|
+
if (!pkg) {
|
|
19
|
+
console.error(`ctx-optimize: unsupported platform ${key}`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const exe = process.platform === "win32" ? "ctx-optimize.exe" : "ctx-optimize";
|
|
24
|
+
let binPath;
|
|
25
|
+
try {
|
|
26
|
+
binPath = path.join(path.dirname(require.resolve(`${pkg}/package.json`)), "bin", exe);
|
|
27
|
+
} catch {
|
|
28
|
+
console.error(
|
|
29
|
+
`ctx-optimize: platform package ${pkg} is not installed.\n` +
|
|
30
|
+
`Your package manager skipped an optional dependency — reinstall with:\n` +
|
|
31
|
+
` npm install -g @muthuishere/ctx-optimize`
|
|
32
|
+
);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
37
|
+
child.on("exit", (code, signal) => {
|
|
38
|
+
if (signal) process.kill(process.pid, signal);
|
|
39
|
+
process.exit(code === null ? 1 : code);
|
|
40
|
+
});
|
|
41
|
+
child.on("error", (err) => {
|
|
42
|
+
console.error(`ctx-optimize: failed to start binary: ${err.message}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@muthuishere/ctx-optimize",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Gather a codebase (and its world) into one local knowledge store an AI agent answers from — deterministic, no LLM API, no DB.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"ctx-optimize": "bin/ctx-optimize.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/muthuishere/ctx-optimize.git"
|
|
16
|
+
},
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@muthuishere/ctx-optimize-darwin-arm64": "0.1.0",
|
|
19
|
+
"@muthuishere/ctx-optimize-darwin-x64": "0.1.0",
|
|
20
|
+
"@muthuishere/ctx-optimize-linux-arm64": "0.1.0",
|
|
21
|
+
"@muthuishere/ctx-optimize-linux-x64": "0.1.0",
|
|
22
|
+
"@muthuishere/ctx-optimize-windows-x64": "0.1.0"
|
|
23
|
+
}
|
|
24
|
+
}
|