@mundy/agrep 0.1.6 → 0.4.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agrep contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,26 +1,33 @@
1
1
  # agrep
2
2
 
3
- grep your AI coding agents' chat history - Claude Code, Codex, opencode, Antigravity,
4
- Kimi CLI, Cline - straight from the shell. One searchable cross-agent history, a context-window command
5
- (`agrep around`) built for agents and humans, native session resume, and a local web
6
- explorer (`agrep ui`).
3
+ Find, open, resume and watch your AI agents' work - Claude Code, Codex,
4
+ opencode, Antigravity, Kimi CLI, Cline, Gemini CLI, crush, Cursor, pi, and
5
+ oh-my-pi - straight from the shell. One local index of every conversation,
6
+ tool call and result, with native resume and a live board across tools.
7
7
 
8
8
  This npm package is a thin shim: agrep is a python package with a bundled rust binary,
9
9
  and the shim runs it through [uv](https://docs.astral.sh/uv/) (or pipx). uv manages
10
10
  python itself, so this works even on a machine with no python installed.
11
11
 
12
12
  ```
13
- npm i -g @mundy/agrep
14
- # or: npm i -g agrep-cli
13
+ uvx agrep "race condition" # zero-install try (uv runs the real PyPI package)
14
+ # or on npm: npm i -g @mundy/agrep (npx @mundy/agrep "race condition")
15
15
  agrep "race condition" # first run indexes your agent stores, then greps
16
16
  ```
17
17
 
18
- Global npm installs also try to preinstall the matching PyPI tool with
19
- `uv tool install` when uv is available. npm's own `bin` shim is still the PATH
20
- entrypoint, so `agrep` works even if uv's tool directory is not on PATH.
18
+ Global npm installs run one-time setup from postinstall
19
+ (`agrep setup --yes --no-semantic --no-archive`): the index is built and the
20
+ detected agents are taught immediately; every written block is disclosed in
21
+ the setup output and undone by `agrep remove`. That includes the
22
+ uninstall-cleanup sentinel (a launchd agent, systemd user units, or a
23
+ scheduled task) whose only job is stripping agrep's own blocks and hooks if
24
+ the package disappears. Set `AGREP_NO_AUTO_SETUP=1` to only warm uv's cache
25
+ instead, or `AGREP_SKIP_POSTINSTALL=1` to skip postinstall entirely. npm's
26
+ own `bin` shim remains the PATH entrypoint, so the install does not create
27
+ or replace a persistent uv-managed command.
21
28
 
22
29
  The npm shim pins the matching PyPI version under the hood, so npm and PyPI releases
23
- do not drift. Prefer the direct route? `uv tool install agrep==0.1.5` - same thing,
24
- no node in the middle.
30
+ do not drift. Prefer the direct route? `uv tool install agrep` installs the same
31
+ agrep package without the Node shim.
25
32
 
26
33
  Full docs: https://github.com/dannyisbad/agrep
package/bin.js CHANGED
@@ -4,7 +4,7 @@
4
4
  // box with no python at all. pipx is the fallback. If neither exists we print the
5
5
  // one-liner that fixes it instead of half-installing anything ourselves.
6
6
  //
7
- // AGREP_PYPI_SPEC overrides what gets run (e.g. a local wheel path, or agrep==0.1.0).
7
+ // AGREP_PYPI_SPEC overrides what gets run (e.g. a local wheel path, or agrep==X.Y.Z).
8
8
 
9
9
  "use strict";
10
10
  const { spawnSync } = require("child_process");
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@mundy/agrep",
3
- "version": "0.1.6",
4
- "description": "grep your AI coding agents' chat history (Claude Code, Codex, opencode, Antigravity, Kimi, Cline) - npm shim that runs the real package via uv/pipx",
3
+ "version": "0.4.0",
4
+ "description": "Find, open, resume and watch your AI agents' work (Claude Code, Codex, opencode, Antigravity, Kimi, Cline, Gemini, crush, Cursor, pi, oh-my-pi) - npm shim that runs the real package via uv/pipx",
5
5
  "bin": { "agrep": "bin.js" },
6
6
  "scripts": {
7
7
  "postinstall": "node postinstall.js"
8
8
  },
9
- "files": ["bin.js", "postinstall.js", "README.md"],
9
+ "files": ["bin.js", "postinstall.js", "README.md", "LICENSE"],
10
10
  "engines": { "node": ">=16" },
11
- "keywords": ["claude", "codex", "opencode", "kimi", "cline", "agent", "chat", "history", "grep", "cli"],
11
+ "keywords": ["claude", "codex", "opencode", "antigravity", "kimi", "cline", "gemini", "crush", "cursor", "pi", "oh-my-pi", "agent", "chat", "history", "grep", "cli"],
12
12
  "repository": { "type": "git", "url": "git+https://github.com/dannyisbad/agrep.git" },
13
13
  "homepage": "https://github.com/dannyisbad/agrep#readme",
14
14
  "author": "mundy (https://mundy.sh)",
package/postinstall.js CHANGED
@@ -1,7 +1,15 @@
1
1
  #!/usr/bin/env node
2
- // Warm the matching PyPI tool when installed globally through npm. npm's own
3
- // `bin` shim is still the portable PATH entrypoint; this just makes the Python
4
- // side ready too when uv is available.
2
+ // Global installs finish enrolled, not merely downloaded: after warming uv's
3
+ // ephemeral tool cache, run the pinned `agrep setup --yes` so the box is
4
+ // indexed and the detected agents are taught the moment `npm install -g`
5
+ // returns. Everything setup writes is disclosed in its output, owned by
6
+ // agrep, and undone by `agrep remove`; --no-semantic defers the ~52MiB model
7
+ // fetch to the first semantic use, and --no-archive leaves source-store
8
+ // retention off until someone asks for it (`agrep setup --archive`).
9
+ //
10
+ // AGREP_NO_AUTO_SETUP=1 restores the old warm-only behavior;
11
+ // AGREP_SKIP_POSTINSTALL=1 skips this script entirely. The npm shim remains
12
+ // the entrypoint and resolves the pinned PyPI package on every run.
5
13
 
6
14
  "use strict";
7
15
 
@@ -11,6 +19,9 @@ const { version } = require("./package.json");
11
19
  const spec = process.env.AGREP_PYPI_SPEC || `agrep==${version}`;
12
20
  const npmGlobal = String(process.env.npm_config_global || "").toLowerCase() === "true";
13
21
  const forced = Boolean(process.env.AGREP_POSTINSTALL_FORCE);
22
+ const strict = Boolean(process.env.AGREP_POSTINSTALL_STRICT);
23
+ const autoSetup = !process.env.AGREP_NO_AUTO_SETUP;
24
+ const SETUP_TIMEOUT_MS = 15 * 60 * 1000;
14
25
 
15
26
  if (process.env.AGREP_SKIP_POSTINSTALL) {
16
27
  process.exit(0);
@@ -25,28 +36,45 @@ function has(cmd) {
25
36
  return probe.status === 0;
26
37
  }
27
38
 
28
- function tryRun(cmd, args) {
29
- const result = spawnSync(cmd, args, { stdio: "inherit", shell: false });
39
+ function tryRun(cmd, args, options) {
40
+ const result = spawnSync(cmd, args, { shell: false, ...options });
30
41
  return !result.error && result.status === 0;
31
42
  }
32
43
 
33
- if (has("uv")) {
34
- console.log(`agrep: installing matching PyPI tool with uv (${spec})`);
35
- const ok = tryRun("uv", [
36
- "tool",
37
- "install",
38
- "--force",
39
- "--exclude-newer-package",
40
- "agrep=false",
41
- spec,
42
- ]);
43
- if (!ok) {
44
- console.warn("agrep: uv tool install failed; npm's agrep shim will still run via uv at command time.");
45
- }
46
- process.exit(0);
44
+ function agrepArgs(...rest) {
45
+ return [
46
+ "tool", "run",
47
+ "--exclude-newer-package", "agrep=false",
48
+ "--from", spec,
49
+ "agrep", ...rest,
50
+ ];
47
51
  }
48
52
 
49
- console.warn(
50
- "agrep: uv was not found, so the PyPI tool was not preinstalled. " +
51
- "npm's agrep shim is still installed; install uv for first-run execution."
52
- );
53
+ let done = false;
54
+ const uvAvailable = has("uv");
55
+ if (uvAvailable && autoSetup) {
56
+ // Inherited stdio: npm surfaces this with --foreground-scripts (and on
57
+ // failure), so every file setup touches is disclosed, never silent.
58
+ console.log(
59
+ "agrep: running one-time setup (agrep setup --yes) - writes agent instruction blocks"
60
+ + " and an uninstall-cleanup sentinel, all undone by `agrep remove`;"
61
+ + " AGREP_NO_AUTO_SETUP=1 skips this.");
62
+ done = tryRun(
63
+ "uv", agrepArgs("setup", "--yes", "--no-semantic", "--no-archive"),
64
+ { stdio: "inherit", timeout: SETUP_TIMEOUT_MS });
65
+ if (!done) {
66
+ console.warn("agrep: automatic setup did not finish; `agrep setup` completes it any time.");
67
+ }
68
+ } else if (uvAvailable) {
69
+ // Warm-only: keep npm output clean; the shim provisions on first run.
70
+ done = tryRun("uv", agrepArgs("--version"), { stdio: "ignore" });
71
+ if (!done) {
72
+ console.warn("agrep: uv cache warm failed; the first agrep run will retry");
73
+ }
74
+ } else {
75
+ console.warn("agrep: install uv (https://docs.astral.sh/uv) - agrep needs it on first run.");
76
+ }
77
+ if (!done && strict) {
78
+ console.error("agrep: postinstall failed to provision the pinned PyPI tool");
79
+ process.exit(1);
80
+ }