realontext 0.11.0 → 0.12.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/.claude-plugin/plugin.json +1 -1
- package/README.md +18 -14
- package/bin/realontext.js +6 -6
- package/hooks/hint.js +1 -1
- package/hooks/hint.md +1 -1
- package/lib/agents.js +2 -2
- package/lib/binary.js +2 -2
- package/lib/hook.js +1 -1
- package/lib/mcp.js +2 -2
- package/lib/rules.md +1 -1
- package/lib/setup.js +1 -1
- package/lib/tui.mjs +1 -1
- package/lib/update.js +2 -2
- package/package.json +4 -4
- package/pi/realontext.js +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# realontext
|
|
2
2
|
|
|
3
|
-
Code search for coding agents, over the directory you are in:
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Code search for coding agents, over the directory you are in: whole functions
|
|
4
|
+
and classes, ranked on the machine and, when you are logged in, by a model
|
|
5
|
+
through the realontext Relay.
|
|
6
6
|
|
|
7
7
|
## Installing
|
|
8
8
|
|
|
@@ -51,12 +51,11 @@ realontext login # in the browser
|
|
|
51
51
|
realontext login --paste # when the browser is on another machine
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
With a Token,
|
|
55
|
-
signatures, which function bodies, then the top five again) and sends it the
|
|
54
|
+
With a Token, a described query is ranked at the Relay, which is sent the
|
|
56
55
|
query, file paths and function names, and the code of the candidate functions.
|
|
57
|
-
Without a Token nothing leaves the machine: the results
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
Without a Token nothing leaves the machine: the results are ranked locally,
|
|
57
|
+
with a notice saying so. `REALONTEXT_TOKEN` overrides the saved Token; set to
|
|
58
|
+
an empty string, it keeps that process local.
|
|
60
59
|
|
|
61
60
|
## Updates
|
|
62
61
|
|
|
@@ -73,13 +72,18 @@ turns this off.
|
|
|
73
72
|
## From the shell
|
|
74
73
|
|
|
75
74
|
```bash
|
|
76
|
-
realontext query
|
|
77
|
-
realontext query "why does loading yaml crash"
|
|
78
|
-
|
|
75
|
+
realontext query -i --pattern 'yaml|load' # the current directory
|
|
76
|
+
realontext query --pattern 'yaml|load' --query "why does loading yaml crash" # described: the Relay ranks
|
|
77
|
+
realontext query --pattern 'yaml|load' --path src --path lib -g '*.rs' # paths, and rg's options
|
|
78
|
+
git log --oneline | realontext query --pattern fix # stdin, line by line
|
|
79
|
+
cat loader.rs | realontext query --label loader.rs --pattern yaml # stdin, named for its grammar
|
|
79
80
|
```
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
The regex is `--pattern`, the description `--query`, each place to search
|
|
83
|
+
`--path`; every other word goes to ripgrep as one of its options. Code comes back as
|
|
84
|
+
whole functions and classes, any other file line by line. With `--query`, a
|
|
85
|
+
description of the code, the Relay ranks the results; without it, the
|
|
86
|
+
pattern's words do. As with grep: text on stdout (`--json` for programs), exit
|
|
87
|
+
status 0 with results, 1 without, 2 on error.
|
|
84
88
|
|
|
85
89
|
Builds: macOS on Apple Silicon (13 and later), x64 Linux and x64 Windows.
|
package/bin/realontext.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// The `realontext` command npm installs: runs the binary of this platform with
|
|
3
|
-
// this process's arguments, stdio and exit status
|
|
4
|
-
// instead is what Node does better: `setup` edits agents' configs
|
|
5
|
-
// `hook` answers the hooks it wrote
|
|
6
|
-
// terminal, a menu of everything
|
|
7
|
-
// the background
|
|
8
|
-
// newer binary in its middle
|
|
3
|
+
// this process's arguments, stdio and exit status. What is written here
|
|
4
|
+
// instead is what Node does better: `setup` edits agents' configs,
|
|
5
|
+
// `hook` answers the hooks it wrote, and with no command, in a
|
|
6
|
+
// terminal, a menu of everything. Each start may update the binary in
|
|
7
|
+
// the background; `mcp` passes the session through and switches to a
|
|
8
|
+
// newer binary in its middle.
|
|
9
9
|
"use strict";
|
|
10
10
|
|
|
11
11
|
const { spawnSync } = require("child_process");
|
package/hooks/hint.js
CHANGED
package/hooks/hint.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<realontext>
|
|
2
|
-
To search source code, call codebase-retrieval instead of grep or rg: it returns whole functions ranked by what you ask, with line numbers. `pattern` is the regex you would grep for
|
|
2
|
+
To search source code, call codebase-retrieval instead of grep or rg: it returns whole functions ranked by what you ask, with line numbers. `pattern` is the regex you would grep for; add `query`, an English description of the code, when you are describing behavior, and leave it out for a name you know. For docs, configs, logs and a command's output, use `realontext query --pattern RE [--path PATH]...` in the shell, or pipe into it: `git log | realontext query --pattern fix`. Do not run grep or rg at all.
|
|
3
3
|
</realontext>
|
package/lib/agents.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// How realontext is connected to each agent
|
|
1
|
+
// How realontext is connected to each agent, the data `setup.js` acts
|
|
2
2
|
// on and `hook.js` answers from. An agent is a list of steps, each one of:
|
|
3
3
|
//
|
|
4
4
|
// run a command of the agent's own CLI; `clear` first, quietly, when
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//
|
|
13
13
|
// A path starting with `~/` is under the home directory, a relative one under
|
|
14
14
|
// the directory `setup` runs in. Three things go in: the MCP server, everywhere;
|
|
15
|
-
// the once-a-session reminder
|
|
15
|
+
// the once-a-session reminder, where the agent has a hook that adds
|
|
16
16
|
// context the model sees; the usage rules, where the agent is known not to
|
|
17
17
|
// pass the server's instructions to the model. `hook` names the event the
|
|
18
18
|
// reminder answers and, with `flat`, that the answer is not wrapped in
|
package/lib/binary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The binary this machine runs: the one the platform package npm picked
|
|
2
|
-
// through optionalDependencies
|
|
3
|
-
// versions
|
|
2
|
+
// through optionalDependencies, or the newer one the updater put in
|
|
3
|
+
// versions/. Throws when there is neither.
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const fs = require("fs");
|
package/lib/hook.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `realontext hook <agent
|
|
1
|
+
// `realontext hook <agent>`: the first time an agent's session
|
|
2
2
|
// fires the hook `setup` wrote, the model is reminded that codebase-retrieval
|
|
3
3
|
// searches source code. Once a session, and only context: the agent goes on
|
|
4
4
|
// as it would, and any failure here is silent. Which event it answers, and in
|
package/lib/mcp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// `realontext mcp` through the wrapper
|
|
1
|
+
// `realontext mcp` through the wrapper: the agent's JSON-RPC lines go to
|
|
2
2
|
// the binary in order and its lines come back. Before each tools/call the
|
|
3
|
-
// version is asked for
|
|
3
|
+
// version is asked for; when that gives a newer binary, it is started,
|
|
4
4
|
// the session's initialize is replayed to it and its answer dropped, and the
|
|
5
5
|
// call goes to it. The old binary's stdin is closed: it answers what it was
|
|
6
6
|
// sent and exits.
|
package/lib/rules.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
## Code search
|
|
2
2
|
|
|
3
|
-
This repository is searched with
|
|
3
|
+
This repository is searched with realontext, which replaces grep. Its MCP tool `codebase-retrieval` searches the code: every time you need to know where something is in the source (where or how something is done, where a name you know is defined, what calls it, where it is used, which line of a file it is on), call `codebase-retrieval` yourself, at every step of the task (if your tools are deferred, load it first). For text in docs, configs and logs, and for a command's output, run `realontext query --pattern RE [--path PATH]...` in the shell, or pipe into it: `git log | realontext query --pattern fix`. Do not run grep, rg, git grep or any other text search, as a tool or in the shell, alone or inside a longer command. Listing files by name stays with your own tools. Every call needs a `pattern`: the grep you would have run, in ripgrep's syntax: a name exactly (`truncate_name\(` for every call of it), or for a description the keywords the code must contain, broad and case-insensitive (`(?i)retry|backoff`); only code with a matching line is searched. Add a `query`, an English description of the behavior with words likely to appear in the code, when you are describing behavior: the Relay then orders the results. Leave it out for a name you know: the pattern's words answer at once. If nothing comes back, loosen the pattern; if 20 results are not enough, narrow it.
|
package/lib/setup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// `realontext setup [agent...]`: connects agents to `realontext mcp`, run from
|
|
2
|
-
// the repository root
|
|
2
|
+
// the repository root. What each agent gets is in `agents.js`;
|
|
3
3
|
// this file carries the steps out. With no agent named, the menu in `tui.mjs`
|
|
4
4
|
// asks which. Running it again replaces what an earlier run wrote, such as an
|
|
5
5
|
// older `npx` entry, and leaves everything else in the files as it was.
|
package/lib/tui.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// What `realontext` opens with no command, in a terminal
|
|
1
|
+
// What `realontext` opens with no command, in a terminal: the account
|
|
2
2
|
// behind the Token, connecting agents, logging in. The Relay is asked through
|
|
3
3
|
// the binary (`usage`, `login`), agents are connected through `setup.js`.
|
|
4
4
|
//
|
package/lib/update.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Keeps the binary at the version the Relay names
|
|
1
|
+
// Keeps the binary at the version the Relay names. The Relay's GET
|
|
2
2
|
// /v1/client names the version; when it is newer than npm's, that version's
|
|
3
3
|
// platform package comes from the registry, checked against the registry's
|
|
4
4
|
// integrity, into versions/<version>/, and `current` names it. A version no
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// `start()` runs this file as a detached process, at most once an hour: the
|
|
9
9
|
// command it was started for does not wait, the next start runs the new
|
|
10
10
|
// version. `latest()` does the same in this process, for `mcp` before each
|
|
11
|
-
// call
|
|
11
|
+
// call, which switches to what it returns.
|
|
12
12
|
"use strict";
|
|
13
13
|
|
|
14
14
|
const crypto = require("crypto");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realontext",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"react": "^18.3.1"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@realontext/darwin-arm64": "0.
|
|
38
|
-
"@realontext/linux-x64": "0.
|
|
39
|
-
"@realontext/win32-x64": "0.
|
|
37
|
+
"@realontext/darwin-arm64": "0.12.1",
|
|
38
|
+
"@realontext/linux-x64": "0.12.1",
|
|
39
|
+
"@realontext/win32-x64": "0.12.1"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/pi/realontext.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// The Pi extension
|
|
1
|
+
// The Pi extension. Pi has no MCP client, so this is one, for
|
|
2
2
|
// `realontext mcp` alone: it starts the server with this package's own
|
|
3
3
|
// command, registers the tools the server lists, with their names,
|
|
4
4
|
// descriptions and schemas as they are, and appends the server's
|