Skip to main content
Glama
Workspace Radar

Workspace Radar

by Gresham429
README.md
[English](README.md) | [简体中文](README.zh-CN.md)

# Workspace Radar

[![Antigravity Plugin](https://img.shields.io/badge/Antigravity-Plugin-4F46E5)](https://github.com/gresham429/workspace-radar)
[![Codex Ready](https://img.shields.io/badge/Codex-Ready-0284C7)](adapters/codex)
[![MCP App](https://img.shields.io/badge/MCP-App%20UI-0D9488)](src/server/index.mjs)
[![Node.js >= 20](https://img.shields.io/badge/Node.js-%3E%3D20-059669)](package.json)
[![UI 中 / EN](https://img.shields.io/badge/UI-%E4%B8%AD%20%2F%20EN-7C3AED)](src/core/i18n.mjs)
[![License: MIT](https://img.shields.io/badge/License-MIT-64748B)](LICENSE)

**Workspace Radar** maps multi-folder projects into one live dashboard, groups files modified in your active conversation by workspace, and keeps a 3-column **Doing / Next / Done** Kanban board synced with agent steps.

![Workspace Radar Dashboard Preview](assets/preview.svg)

---

## Prerequisites

- **Node.js** `>= 20`
- **Git** (optional per subfolder, used for branch and uncommitted file counts)

---

## Configure for Antigravity

### 1. Clone and Build

```bash
git clone https://github.com/gresham429/workspace-radar.git
cd workspace-radar
npm install
npm run build
```

### 2. Install the Plugin

```bash
./scripts/install.sh --target antigravity
```

This installs the built plugin bundle into `~/.gemini/config/plugins/workspace-radar` (with `plugin.json`, `mcp_config.json`, `hooks.json`, `rules/AGENTS.md`, `skills/workspace-radar/`, `bin/`, and `dist/`). Antigravity discovers plugins in that directory automatically.

### 3. Open and Use

1. Open **Workspace Radar** from the side pane **`+`** menu or the left sidebar.
2. **Switch language**: Click **`中 | EN`** in the top-right corner at any time; the choice is saved locally.
3. **Open a running session**:
   - Sessions already running before installation will sync on their next turn (`PreInvocation`) or when you click **`↻`**.
   - You can also click **`+`** in the top-right bar and paste any project path directly.
4. **Inspect files and paths**:
   - Click **Copy** on the project path bar or any workspace card to copy its local path.
   - Expand any workspace card and click a file name to open it in the side pane file view.
5. **Edit workspace notes**: Click **Note** on any card to save a 1-line description to `.workspace-map.json` in the current UI language.

### Updating Later

```bash
cd workspace-radar
git pull
npm install
npm run build
./scripts/install.sh --target antigravity
```

Then restart or refresh the `workspace-radar_workspace-radar` server under **Additional Options (...) > MCP Servers**.

---

## Configure for Codex

Workspace Radar includes a Codex adapter under `adapters/codex/` and a standalone terminal CLI.

### Option A: Codex Plugin Bundle

```bash
./scripts/install.sh --target codex
# Optional custom path:
# ./scripts/install.sh --target codex --dest /path/to/plugins/workspace-radar
```

This creates a self-contained bundle with `.Codex-plugin/plugin.json`, `.mcp.json`, `hooks/hooks.json` (`SessionStart` and `PostToolUse` on `Write|Edit|MultiEdit|Bash|apply_patch|TodoWrite|update_plan|update_steps`), `commands/radar.md` (`/radar`), `skills/workspace-radar/`, `bin/`, and `dist/`.

### Option B: Codex CLI (`~/.codex/config.toml`)

Print the config block with the resolved absolute path:

```bash
./scripts/install.sh --target codex-cli
```

Paste the printed section into `~/.codex/config.toml`:

```toml
[mcp_servers.workspace_radar]
command = "bash"
args = ["/ABS/PATH/TO/workspace-radar/bin/workspace-radar-mcp"]
```

### Option C: Standalone Terminal CLI

```bash
./bin/workspace-radar scan /path/to/project
./bin/workspace-radar status /path/to/project
./bin/workspace-radar init /path/to/project
```

---

## Optional Project Config (`.workspace-map.json`)

Zero configuration is required. Workspaces are discovered automatically from nested `.git` repositories, `package.json` workspaces, `pnpm-workspace.yaml`, `Cargo.toml`, standard container folders (`packages/*`, `apps/*`, `services/*`, `libs/*`, `modules/*`), or meaningful top-level directories.

To pin folders, add custom names, or write bilingual descriptions, run `./bin/workspace-radar init /path/to/project` (or click **Note** in the UI) to create `.workspace-map.json` at the project root:

```json
{
  "version": 1,
  "ignore": ["node_modules", ".git", "dist", "build", ".next", "__pycache__", ".venv", "target"],
  "groups": ["Services", "Apps"],
  "workspaces": {
    "services/auth": {
      "name": "Auth Service",
      "group": "Services",
      "description": "JWT issuance and session middleware",
      "descriptionZh": "JWT 签发与会话鉴权中间件",
      "descriptionEn": "JWT issuance and session middleware",
      "pinned": true
    }
  }
}
```

| Field | Purpose |
| --- | --- |
| `ignore` | Directory names skipped during scanning |
| `groups` | Optional group labels used for organization |
| `workspaces.<relPath>.name` | Custom display name for the workspace |
| `workspaces.<relPath>.description` | Default fallback description |
| `workspaces.<relPath>.descriptionZh` | Description shown when UI is in Chinese (`中`) |
| `workspaces.<relPath>.descriptionEn` | Description shown when UI is in English (`EN`) |
| `workspaces.<relPath>.pinned` | Keep this workspace near the top of the list |

New subdirectories added later still appear automatically even if `.workspace-map.json` is not updated.

---

## Environment Variables & Local Data

| Variable | Default | Purpose |
| --- | --- | --- |
| `WORKSPACE_RADAR_DATA_DIR` | `~/.workspace-radar/data` | Overrides where session files, tasks, and preferences are stored |
| `PLUGIN_DATA` | Set by Antigravity | Used automatically by `--data-dir` when installed as a plugin |
| `WORKSPACE_RADAR_UI_HTML` | `dist/ui.html` | Optional path to load custom/unbundled UI HTML during development |

- State files (`index.json` and `projects/<hash>.json`) store only project roots, session IDs, modified file paths, task items, and language preference. Prompts, model names, and raw transcripts are never stored.

---

## Project Structure

```text
workspace-radar/
├── plugin.json                  # Antigravity plugin manifest
├── mcp_config.json              # Antigravity MCP server entry
├── hooks.json                   # Antigravity SessionStart / PreInvocation / PostToolUse hooks
├── assets/
│   ├── logo.svg                 # Plugin icon
│   └── preview.svg              # Dashboard preview graphic
├── bin/
│   ├── workspace-radar-mcp      # MCP server launcher (resolves Node path for GUI apps)
│   ├── workspace-radar-hook     # Hook entry wrapper
│   └── workspace-radar          # Standalone CLI wrapper
├── src/
│   ├── core/
│   │   ├── config.mjs           # .workspace-map.json reader/writer
│   │   ├── i18n.mjs             # Bilingual folder roles & engineering text localization
│   │   ├── scanner.mjs          # Multi-folder workspace & Git scanner
│   │   ├── session-sync.mjs     # Step/focus/file extraction & transcript backfill
│   │   ├── tracker.mjs          # Atomic session/task persistence & snapshot builder
│   │   ├── hook-handler.mjs     # Antigravity & Codex hook payload normalizer
│   │   └── hook-entry.mjs       # Stdin/stdout hook entrypoint
│   ├── server/index.mjs         # MCP server (tools + ui://workspace-radar/app.html)
│   ├── ui/                      # Single-file bundled MCP App dashboard (HTML/CSS/JS)
│   └── cli/index.mjs            # Terminal CLI (scan, status, init)
├── adapters/codex/              # Codex plugin manifest, MCP config, hooks, /radar command
├── skills/workspace-radar/      # Agent usage skill
├── rules/AGENTS.md              # Agent checklist sync rule
├── scripts/
│   ├── build.mjs                # esbuild bundler + HTML/JS build verification
│   └── install.sh               # Installer for Antigravity, Codex plugin, and Codex CLI
└── test/                        # Unit and MCP stdio integration tests
```

---

## MCP Tools

| Tool | Purpose |
| --- | --- |
| `workspace_radar_open` | Open the Workspace Radar UI panel and return a Markdown summary |
| `workspace_radar_scan` | Scan workspaces, Git branches, dirty counts, and session changes |
| `workspace_radar_sync_plan` | Sync session focus and `done` / `in_progress` / `todo` tasks (`titleZh` / `titleEn`) |
| `workspace_radar_config` | Read, initialize, or update entries in `.workspace-map.json` |

Internal UI tools (`workspace_radar_ui_refresh`, `workspace_radar_ui_task`, `workspace_radar_ui_workspace`, `workspace_radar_ui_prefs`, `workspace_radar_ui_projects`) handle interactive panel actions without cluttering the model tool list.

## Development & Testing

```bash
npm install
npm run build
npm test
```

## License

MIT