Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Web search queries the `mixedbread/web` store in addition to your local store, m
| --- | --- |
| `mgrep` / `mgrep search <pattern> [path]` | Natural-language search with many `grep`-style flags (`-i`, `-r`, `-m`...). |
| `mgrep watch` | Index current repo and keep the Mixedbread store in sync via file watchers. |
| `mgrep list` | List active mgrep watch processes with their working directories. |
| `mgrep login` & `mgrep logout` | Manage device-based authentication with Mixedbread. |
| `mgrep install-claude-code` | Authenticate, add the Mixedbread mgrep plugin to Claude Code. |
| `mgrep install-opencode` | Authenticate and add the Mixedbread mgrep to OpenCode. |
Expand Down Expand Up @@ -208,6 +209,19 @@ mgrep watch --max-file-size 1048576 # limit uploads to files under 1MB
mgrep watch --max-file-count 5000 # limit uploads to directories with 5000 files or fewer
```

### mgrep list

`mgrep list` shows all running `mgrep watch` processes with their working directories.

**Example:**
```bash
mgrep list
# /home/user/project-a
# /home/user/project-b
```

Output is one directory per line.

## Mixedbread under the hood

- Every file is pushed into a Mixedbread Store using the same SDK your apps get.
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
"istextorbinary": "^9.5.0",
"open": "^10.2.0",
"ora": "^5.4.1",
"pid-cwd": "^1.2.0",
"ps-list": "^9.0.0",
"p-limit": "^3.1.0",
"winston": "^3.18.3",
"winston-daily-rotate-file": "^5.0.0",
Expand Down
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions src/commands/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Command } from "commander";
import pidCwd from "pid-cwd";
import psList from "ps-list";

interface WatcherInfo {
pid: number;
directory: string;
}

async function getWatchers(): Promise<WatcherInfo[]> {
const processes = await psList();
const watchers: WatcherInfo[] = [];

for (const proc of processes) {
const cmd = proc.cmd || "";
if (cmd.includes("mgrep watch")) {
const cwd = await pidCwd(proc.pid).catch(() => null);
if (cwd) {
watchers.push({ pid: proc.pid, directory: cwd });
}
}
Comment thread
felixzsh marked this conversation as resolved.
}

return watchers;
}

export async function listAction(): Promise<void> {
if (process.platform === "win32") {
console.error("mgrep list is not supported on Windows.");
process.exitCode = 1;
return;
}

const watchers = await getWatchers();

if (watchers.length === 0) {
console.error("No active mgrep watch processes found.");
process.exitCode = 0;
return;
}

for (const w of watchers) {
console.log(w.directory);
}
}

export const list = new Command("list")
.description("List active mgrep watch processes")
.action(async () => {
await listAction();
});
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as fs from "node:fs";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
import { program } from "commander";
import { list } from "./commands/list.js";
import { login } from "./commands/login.js";
import { logout } from "./commands/logout.js";
import { search } from "./commands/search.js";
Expand Down Expand Up @@ -39,6 +40,7 @@ program

program.addCommand(search, { isDefault: true });
program.addCommand(watch);
program.addCommand(list);
program.addCommand(installClaudeCode);
program.addCommand(uninstallClaudeCode);
program.addCommand(installCodex);
Expand Down