realontext 0.8.2 → 0.10.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/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -2
- package/bin/realontext.js +3 -2
- package/lib/binary.js +16 -1
- package/lib/mcp.js +6 -1
- package/lib/update.js +8 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -73,8 +73,7 @@ turns this off.
|
|
|
73
73
|
## From the shell
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
echo "why does loading yaml crash" | realontext query --k 20
|
|
77
|
-
realontext symbols
|
|
76
|
+
echo "why does loading yaml crash" | realontext query --k 20 --pattern '(?i)yaml|load'
|
|
78
77
|
```
|
|
79
78
|
|
|
80
79
|
Builds: macOS on Apple Silicon (13 and later), x64 Linux and x64 Windows.
|
package/bin/realontext.js
CHANGED
|
@@ -26,9 +26,10 @@ if (terminal && (command === undefined || (command === "setup" && rest.length ==
|
|
|
26
26
|
} else if (command === "setup") {
|
|
27
27
|
process.exit(require("../lib/setup.js").setup(rest));
|
|
28
28
|
} else {
|
|
29
|
+
const binary = require("../lib/binary.js");
|
|
29
30
|
let path;
|
|
30
31
|
try {
|
|
31
|
-
path =
|
|
32
|
+
path = binary();
|
|
32
33
|
} catch (e) {
|
|
33
34
|
console.error(`realontext: ${e.message}`);
|
|
34
35
|
process.exit(1);
|
|
@@ -36,7 +37,7 @@ if (terminal && (command === undefined || (command === "setup" && rest.length ==
|
|
|
36
37
|
if (command === "mcp") {
|
|
37
38
|
require("../lib/mcp.js")(path, rest).then(exit);
|
|
38
39
|
} else {
|
|
39
|
-
const run = spawnSync(path, process.argv.slice(2), { stdio: "inherit" });
|
|
40
|
+
const run = spawnSync(path, process.argv.slice(2), { stdio: "inherit", env: binary.env(path) });
|
|
40
41
|
if (run.error) {
|
|
41
42
|
console.error(`realontext: ${run.error.message}`);
|
|
42
43
|
process.exit(1);
|
package/lib/binary.js
CHANGED
|
@@ -76,4 +76,19 @@ function binary() {
|
|
|
76
76
|
// The version `binary()` runs.
|
|
77
77
|
binary.version = () => installed()?.version ?? version;
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
// The environment to run the binary at `file` in: the rg shipped beside it
|
|
80
|
+
// first on PATH (D97). Windows spells the key as it likes, and one key it stays.
|
|
81
|
+
// Windows also looks for a bare `rg` in the current directory, the repository
|
|
82
|
+
// being searched, before PATH; NoDefaultCurrentDirectoryInExePath stops that.
|
|
83
|
+
// Nothing else reads it.
|
|
84
|
+
function env(file) {
|
|
85
|
+
const key = Object.keys(process.env).find((k) => k.toUpperCase() === "PATH") ?? "PATH";
|
|
86
|
+
const rest = process.env[key];
|
|
87
|
+
return {
|
|
88
|
+
...process.env,
|
|
89
|
+
[key]: rest ? path.dirname(file) + path.delimiter + rest : path.dirname(file),
|
|
90
|
+
NoDefaultCurrentDirectoryInExePath: "1",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
module.exports = Object.assign(binary, { packageName, home, exe, newer, env });
|
package/lib/mcp.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
const readline = require("readline");
|
|
10
10
|
const { spawn } = require("child_process");
|
|
11
|
+
const binary = require("./binary.js");
|
|
11
12
|
const update = require("./update.js");
|
|
12
13
|
|
|
13
14
|
const replay = "realontext-switch"; // the id of the replayed initialize
|
|
@@ -33,7 +34,11 @@ module.exports = function mcp(path, args) {
|
|
|
33
34
|
const held = []; // the agent's lines not sent yet
|
|
34
35
|
|
|
35
36
|
function start() {
|
|
36
|
-
const c = spawn(path, ["mcp", ...args], {
|
|
37
|
+
const c = spawn(path, ["mcp", ...args], {
|
|
38
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
39
|
+
windowsHide: true,
|
|
40
|
+
env: binary.env(path),
|
|
41
|
+
});
|
|
37
42
|
child = c;
|
|
38
43
|
c.stdin.on("error", () => {});
|
|
39
44
|
readline.createInterface({ input: c.stdout, crlfDelay: Infinity }).on("line", (line) => {
|
package/lib/update.js
CHANGED
|
@@ -71,11 +71,18 @@ async function install(v) {
|
|
|
71
71
|
if (crypto.createHash(algorithm).update(tgz).digest("base64") !== digest) {
|
|
72
72
|
throw new Error(`${name}@${v}: the download does not match the registry's integrity`);
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const tar = zlib.gunzipSync(tgz);
|
|
75
|
+
const file = untar(tar, `package/bin/${binary.exe}`);
|
|
75
76
|
// Written beside, then renamed: a start never finds half a binary.
|
|
76
77
|
const tmp = `${dir}.${process.pid}`;
|
|
77
78
|
fs.mkdirSync(tmp, { recursive: true });
|
|
78
79
|
fs.writeFileSync(path.join(tmp, binary.exe), file, { mode: 0o755 });
|
|
80
|
+
// ripgrep, which the binary runs from PATH with its own directory first
|
|
81
|
+
// (D97); a version from before it has none.
|
|
82
|
+
const rg = process.platform === "win32" ? "rg.exe" : "rg";
|
|
83
|
+
try {
|
|
84
|
+
fs.writeFileSync(path.join(tmp, rg), untar(tar, `package/bin/${rg}`), { mode: 0o755 });
|
|
85
|
+
} catch {}
|
|
79
86
|
try {
|
|
80
87
|
fs.renameSync(tmp, dir);
|
|
81
88
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realontext",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Code search for coding agents, over the directory you are in. CLI and MCP server.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"react": "^18.3.1"
|
|
25
25
|
},
|
|
26
26
|
"optionalDependencies": {
|
|
27
|
-
"@realontext/darwin-arm64": "0.
|
|
28
|
-
"@realontext/linux-x64": "0.
|
|
29
|
-
"@realontext/win32-x64": "0.
|
|
27
|
+
"@realontext/darwin-arm64": "0.10.0",
|
|
28
|
+
"@realontext/linux-x64": "0.10.0",
|
|
29
|
+
"@realontext/win32-x64": "0.10.0"
|
|
30
30
|
}
|
|
31
31
|
}
|