[codex] add codemap plugin install flow#60
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69a67caf29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
plugins/install.go
Outdated
| "name": CodemapPluginName, | ||
| "source": map[string]any{ | ||
| "source": "local", | ||
| "path": "./plugins/codemap", |
There was a problem hiding this comment.
Use install target path when writing marketplace entry
The installer advertises --plugin-path (and --home) overrides, but the marketplace entry is always written with "path": "./plugins/codemap". In runs where the bundle is installed anywhere else, Codex will resolve the plugin from the hardcoded default path instead of the actual installed location, so the plugin can fail to load even though installation succeeded.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds a packaged Codemap Codex plugin bundle and a first-class installation + MCP runtime flow so users can install the plugin from a released codemap binary and run the MCP server via codemap mcp (while keeping codemap-mcp as a wrapper target).
Changes:
- Introduces an embedded plugin bundle (
plugins/codemap) and an installer that extracts it to~/plugins/codemapand updates~/.agents/plugins/marketplace.json. - Refactors the MCP server into a reusable package and wires
codemap mcpinto the main CLI while keepingcodemap-mcpas a separate build target. - Updates docs and adds tests covering the plugin installation flow and CLI wiring.
Reviewed changes
Copilot reviewed 18 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/install.go | Implements embedded bundle extraction + marketplace entry management for plugin installation. |
| plugins/install_test.go | Adds tests validating bundle extraction, script permissions, marketplace creation, and idempotency. |
| plugins/codemap/README.md | Documents what the plugin bundle contains and how to install it. |
| plugins/codemap/.mcp.json | MCP server configuration for the plugin bundle. |
| plugins/codemap/.codex-plugin/plugin.json | Codex plugin manifest describing skills, MCP servers, and UI metadata. |
| plugins/codemap/scripts/run-codemap-mcp.sh | Launcher script preferring codemap mcp with fallback to codemap-mcp. |
| plugins/codemap/skills/codemap/SKILL.md | Bundled skill documentation for Codemap usage within Codex. |
| cmd/plugin.go | Adds codemap plugin install subcommand wiring to the installer. |
| cmd/plugin_test.go | Adds CLI-level test coverage for codemap plugin install. |
| mcp/main.go | Converts MCP server entrypoint into a package with NewServer() and Run(ctx). |
| mcp/main_test.go | Updates tests to match new MCP package name. |
| mcp/main_more_test.go | Updates tests to match new MCP package name. |
| cmd/codemap-mcp/main.go | Adds standalone codemap-mcp wrapper that runs the packaged MCP server. |
| main.go | Adds mcp and plugin pre-flag-parsing subcommands and help text entries. |
| docs/MCP.md | Updates MCP setup guidance to prefer codemap mcp. |
| README.md | Mentions codemap mcp and codemap plugin install in the quickstart commands. |
| Makefile | Updates build-mcp target to build the new wrapper command. |
| .gitignore | Anchors ignored built binaries to repo root paths. |
| .agents/plugins/marketplace.json | Adds a repo-local marketplace manifest for local plugin discovery during development. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
plugins/install.go
Outdated
| entry := map[string]any{ | ||
| "name": CodemapPluginName, | ||
| "source": map[string]any{ | ||
| "source": "local", | ||
| "path": "./plugins/codemap", |
There was a problem hiding this comment.
The installer always writes the marketplace entry with source.path = "./plugins/codemap", ignoring the actual install location (opts.PluginPath / --plugin-path). If a user overrides the plugin path, the marketplace will point to the wrong directory. Consider passing the installed plugin path into ensureMarketplaceEntry and writing that path (absolute or correctly relativized against the marketplace file) instead of a hard-coded value.
| entry := map[string]any{ | |
| "name": CodemapPluginName, | |
| "source": map[string]any{ | |
| "source": "local", | |
| "path": "./plugins/codemap", | |
| // Determine the plugin source path for the marketplace entry. Default to the | |
| // existing relative path to preserve behavior if no explicit plugin path is set. | |
| pluginSourcePath := "./plugins/" + CodemapPluginName | |
| if pluginPath != "" { | |
| if rel, err := filepath.Rel(filepath.Dir(marketplacePath), pluginPath); err == nil { | |
| pluginSourcePath = rel | |
| } else { | |
| // Fall back to the raw pluginPath (likely absolute) if relativization fails. | |
| pluginSourcePath = pluginPath | |
| } | |
| } | |
| entry := map[string]any{ | |
| "name": CodemapPluginName, | |
| "source": map[string]any{ | |
| "source": "local", | |
| "path": pluginSourcePath, |
plugins/codemap/README.md
Outdated
| It bundles: | ||
|
|
||
| - the Codemap skill under `./skills/` | ||
| - a local MCP configuration in [`.mcp.json`](/Users/jordan/Code/codemap/plugins/codemap/.mcp.json) |
There was a problem hiding this comment.
This README link points to an absolute local filesystem path ("/Users/jordan/..."), which will be broken for other developers and in the installed plugin bundle. Update it to a repo-relative link (e.g., "./.mcp.json" or ".mcp.json").
| - a local MCP configuration in [`.mcp.json`](/Users/jordan/Code/codemap/plugins/codemap/.mcp.json) | |
| - a local MCP configuration in [`.mcp.json`](./.mcp.json) |
cmd/plugin.go
Outdated
| case "install": | ||
| runPluginInstall(args[1:]) | ||
| default: | ||
| fmt.Println("Usage: codemap plugin <install>") |
There was a problem hiding this comment.
The usage string Usage: codemap plugin <install> is misleading since install is a literal subcommand (not a placeholder). It should read Usage: codemap plugin install or Usage: codemap plugin <command> to match typical CLI help output.
| fmt.Println("Usage: codemap plugin <install>") | |
| fmt.Println("Usage: codemap plugin install") |
Summary
plugins/codemapwith manifest, MCP config, assets, and bundled skill docscodemap mcpfrom the main binary and keepcodemap-mcpas a standalone wrapper build targetcodemap plugin installto install the plugin into~/plugins/codemapand update~/.agents/plugins/marketplace.jsonWhy
Codemap had local plugin scaffolding and MCP functionality, but no stable release path that let an installed
codemapbinary make the Codex plugin actually available on a user machine.User Impact
After this ships in a release, users can:
codemap plugin installRoot Cause
The project had the pieces for an MCP server and plugin bundle, but not a productized installation path tying the released binary, home plugin directory, and marketplace registration together.
Validation
go test ./...make build build-mcp./codemap mcpsmoke test./codemap plugin install --home <tempdir>smoke test