diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 0dae3bd..5fa8cb9 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -1,16 +1,16 @@ { "name": "cocoindex-code", "version": "1.0.0", - "description": "AST-based semantic code search for Claude Code, Cursor, and any skill-compatible coding agent — install in one command.", + "description": "AST-based semantic code search for Claude Code, Grok, Cursor, and any skill-compatible coding agent — install in one command.", "owner": { - "name": "Roxabi", - "email": "mickael@bouly.io" + "name": "CocoIndex", + "email": "hi@cocoindex.io" }, "plugins": [ { "name": "cocoindex-code", "source": "./", - "description": "Semantic code search skill — wraps the `ccc` CLI to give coding agents AST-aware search over the current codebase.", + "description": "Semantic code search — ccc skill, optional SessionStart index hook, and MCP server (Grok: disable hook/MCP for skill-only).", "category": "development", "tags": [ "semantic-search", @@ -20,8 +20,8 @@ "rag", "skill" ], - "homepage": "https://github.com/Roxabi/cocoindex-code", - "repository": "https://github.com/Roxabi/cocoindex-code", + "homepage": "https://github.com/cocoindex-io/cocoindex-code", + "repository": "https://github.com/cocoindex-io/cocoindex-code", "license": "Apache-2.0" } ] diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 2dabba4..22b80e3 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,13 +1,13 @@ { "name": "cocoindex-code", "version": "1.0.0", - "description": "AST-based semantic code search via the ccc CLI. Bundles the ccc skill so coding agents handle init, indexing, and search automatically.", + "description": "AST-based semantic code search via the ccc CLI. Bundles the ccc skill; Grok installs also activate a SessionStart index hook and MCP server (disable either for skill-only).", "author": { - "name": "Roxabi", - "email": "mickael@bouly.io" + "name": "CocoIndex", + "email": "hi@cocoindex.io" }, - "homepage": "https://github.com/Roxabi/cocoindex-code", - "repository": "https://github.com/Roxabi/cocoindex-code", + "homepage": "https://github.com/cocoindex-io/cocoindex-code", + "repository": "https://github.com/cocoindex-io/cocoindex-code", "license": "Apache-2.0", "keywords": [ "semantic-search", @@ -16,6 +16,7 @@ "rag", "indexing", "claude-code", + "grok", "skill" ] } diff --git a/.mcp.json b/.mcp.json new file mode 100644 index 0000000..9b4d937 --- /dev/null +++ b/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "cocoindex-code": { + "command": "ccc", + "args": ["mcp"] + } + } +} diff --git a/README.md b/README.md index b7d8b38..df99170 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,8 @@ Next, set up your [coding agent integration](#coding-agent-integration) — or j ## Coding Agent Integration +This repository is a **single plugin marketplace** (`.claude-plugin/marketplace.json`) consumed by both **Claude Code** and **Grok** — same plugin id `cocoindex-code`, same `ccc` skill. Grok optionally activates the bundled hooks and MCP server with `--trust`; Claude Code users can install the same marketplace and rely on the skill alone or load hooks/MCP from the plugin as needed. + ### Skill (Recommended) Install the `ccc` skill so your coding agent automatically uses semantic search when needed: @@ -82,11 +84,59 @@ Works with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) and oth For Claude Code users, this repository is also a [plugin marketplace](https://code.claude.com/docs/en/plugin-marketplaces). Install the skill from inside Claude Code with: ```text -/plugin marketplace add Roxabi/cocoindex-code +/plugin marketplace add cocoindex-io/cocoindex-code /plugin install cocoindex-code@cocoindex-code ``` -This bundles the same `ccc` skill, with version pinning and `/plugin marketplace update` for updates. +This bundles the same `ccc` skill, with version pinning and `/plugin marketplace update` for updates. The repository also ships `hooks/hooks.json` and `.mcp.json` for Grok (and Claude Code plugin installs that load those files); Claude users who want skill-only search can rely on the skill alone and add MCP manually in the [MCP Server](#mcp-server) section below instead of using the bundled `.mcp.json`. + +#### Grok plugin + +For [Grok](https://github.com/xai-org/grok) users, install via Grok's plugin system. The plugin bundles three components: + +| Component | Purpose | +|-----------|---------| +| **Skill** (`skills/ccc/`) | Agent runs `ccc search` / `ccc index` via the CLI (same as Claude Code above) | +| **Hook** (`hooks/hooks.json`) | `SessionStart` → incremental `ccc index` when `.cocoindex_code/` exists | +| **MCP** (`.mcp.json`) | `ccc mcp` stdio server — `search` tool with `refresh_index=true` by default | + +Grok does **not** import Claude's `enabledPlugins` or plugin cache; install separately even if you already use cocoindex in Claude Code. + +**Full install** (skill + hook + MCP): + +```bash +grok plugin marketplace add cocoindex-io/cocoindex-code +grok plugin install cocoindex-io/cocoindex-code --trust +grok plugin enable cocoindex-code +``` + +Prefer the GitHub shorthand (`cocoindex-io/cocoindex-code`) for install — `grok plugin install cocoindex-code` can fail when no marketplace plugin matches that bare name. + +`--trust` is required so Grok activates the plugin's hooks and MCP server (skills load when the plugin is enabled). + +**Skill-only** (match Claude Code — no auto-index hook, no MCP tool): + +Install and enable as above, then disable the optional components: + +1. **Hooks** — open `/hooks`, select the `SessionStart` hook from `cocoindex-code`, press `Space` to disable. +2. **MCP** — open `/mcps`, select `cocoindex-code`, press `Space` to disable; or persist in `~/.grok/config.toml`: + +```toml +[mcp_servers.cocoindex-code] +enabled = false +``` + +The agent still owns indexing via the `ccc` skill (`ccc index` / `ccc search --refresh` when stale), same as Claude Code. + +To avoid importing MCP servers from your Claude/Cursor user config (unrelated to this plugin): + +```toml +[compat.claude] +mcps = false + +[compat.cursor] +mcps = false +``` ### MCP Server diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..17dab18 --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,15 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "timeout": 60, + "command": "command -v ccc >/dev/null && test -d \"${CLAUDE_PROJECT_DIR}/.cocoindex_code\" && (cd \"${CLAUDE_PROJECT_DIR}\" && ccc index) 2>/dev/null || true" + } + ] + } + ] + } +}