mindctx 0.0.1-alpha.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/README.md +12 -0
- package/launcher.js +89 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# mindctx
|
|
2
|
+
|
|
3
|
+
Local context engineering layer for coding agents: **built-in tools get you "something"; mindctx gets you the right thing, within budget, and remembers.**
|
|
4
|
+
|
|
5
|
+
Rust single binary + MCP (default set of 4 tools: `search` / `glob` / `read` / `outline`; `remember` / `recall` / `pack` follow the milestone plan, gated). npm launcher spawns the platform binary as a subprocess (no postinstall, zero dependencies).
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm i -g mindctx
|
|
9
|
+
mindctx --version
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
> Work in progress — see [HouByte/mindctx](https://github.com/HouByte/mindctx) and `docs/design.md`.
|
package/launcher.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawn } = require("node:child_process");
|
|
5
|
+
const { existsSync } = require("node:fs");
|
|
6
|
+
const { dirname, join } = require("node:path");
|
|
7
|
+
|
|
8
|
+
const PLATFORM_PACKAGES = {
|
|
9
|
+
"win32-x64": "@mindctx/win32-x64",
|
|
10
|
+
"linux-x64": "@mindctx/linux-x64",
|
|
11
|
+
"linux-arm64": "@mindctx/linux-arm64",
|
|
12
|
+
"darwin-x64": "@mindctx/darwin-x64",
|
|
13
|
+
"darwin-arm64": "@mindctx/darwin-arm64",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function mapPlatform(platform) {
|
|
17
|
+
return PLATFORM_PACKAGES[platform];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function resolveBinPath(packageName, exe) {
|
|
21
|
+
try {
|
|
22
|
+
const pkgPath = require.resolve(`${packageName}/package.json`);
|
|
23
|
+
const pkgDir = dirname(pkgPath);
|
|
24
|
+
return join(pkgDir, "bin", exe);
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Export functions for testing when required as a module
|
|
31
|
+
if (require.main !== module) {
|
|
32
|
+
module.exports = { PLATFORM_PACKAGES, mapPlatform, resolveBinPath };
|
|
33
|
+
} else {
|
|
34
|
+
// Main CLI execution (only when run directly)
|
|
35
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
36
|
+
const packageName = mapPlatform(platform);
|
|
37
|
+
|
|
38
|
+
if (!packageName) {
|
|
39
|
+
console.error(`mindctx: unsupported platform ${platform}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const exe = process.platform === "win32" ? "mindctx.exe" : "mindctx";
|
|
44
|
+
const binPath = resolveBinPath(packageName, exe);
|
|
45
|
+
|
|
46
|
+
if (!binPath || !existsSync(binPath)) {
|
|
47
|
+
console.error(
|
|
48
|
+
`mindctx: platform package ${packageName} was not installed (registry mirror may lag). Retry with the official registry: npm config set registry https://registry.npmjs.org/`
|
|
49
|
+
);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const isServe = process.argv[2] === "serve";
|
|
54
|
+
const stdio = isServe ? ["pipe", "pipe", "pipe"] : "inherit";
|
|
55
|
+
|
|
56
|
+
const child = spawn(binPath, process.argv.slice(2), { stdio });
|
|
57
|
+
|
|
58
|
+
// Forward stdio for serve mode
|
|
59
|
+
if (isServe) {
|
|
60
|
+
process.stdin.pipe(child.stdin);
|
|
61
|
+
child.stdout.pipe(process.stdout);
|
|
62
|
+
child.stderr.pipe(process.stderr);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Forward signals with proper cleanup
|
|
66
|
+
const forwardSignal = (signal) => {
|
|
67
|
+
child.kill(signal);
|
|
68
|
+
const timeout = setTimeout(() => {
|
|
69
|
+
child.kill("SIGKILL");
|
|
70
|
+
}, 5000);
|
|
71
|
+
child.once("exit", () => clearTimeout(timeout));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
process.on("SIGINT", () => forwardSignal("SIGINT"));
|
|
75
|
+
process.on("SIGTERM", () => forwardSignal("SIGTERM"));
|
|
76
|
+
|
|
77
|
+
child.on("error", (err) => {
|
|
78
|
+
console.error(`mindctx: failed to start: ${err.message}`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
child.on("exit", (code, signal) => {
|
|
83
|
+
if (signal) {
|
|
84
|
+
process.kill(process.pid, signal);
|
|
85
|
+
} else {
|
|
86
|
+
process.exit(code ?? 1);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mindctx",
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"bin": {
|
|
5
|
+
"mindctx": "launcher.js"
|
|
6
|
+
},
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
10
|
+
"optionalDependencies": {
|
|
11
|
+
"@mindctx/win32-x64": "0.0.1-alpha.1",
|
|
12
|
+
"@mindctx/linux-x64": "0.0.1-alpha.1",
|
|
13
|
+
"@mindctx/darwin-x64": "0.0.1-alpha.1",
|
|
14
|
+
"@mindctx/darwin-arm64": "0.0.1-alpha.1"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"launcher.js",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
}
|
|
23
|
+
}
|