Skip to content

[codex] add codemap plugin install flow#60

Merged
JordanCoin merged 2 commits intomainfrom
codex/codemap-plugin-install
Mar 27, 2026
Merged

[codex] add codemap plugin install flow#60
JordanCoin merged 2 commits intomainfrom
codex/codemap-plugin-install

Conversation

@JordanCoin
Copy link
Copy Markdown
Owner

Summary

  • add a real Codemap plugin bundle under plugins/codemap with manifest, MCP config, assets, and bundled skill docs
  • expose codemap mcp from the main binary and keep codemap-mcp as a standalone wrapper build target
  • add codemap plugin install to install the plugin into ~/plugins/codemap and update ~/.agents/plugins/marketplace.json
  • update MCP/docs/install guidance and add test coverage for the installer flow

Why

Codemap had local plugin scaffolding and MCP functionality, but no stable release path that let an installed codemap binary make the Codex plugin actually available on a user machine.

User Impact

After this ships in a release, users can:

  • upgrade Codemap
  • run codemap plugin install
  • reload Codex and use the Codemap plugin without copying files around manually

Root 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 mcp smoke test
  • ./codemap plugin install --home <tempdir> smoke test

@JordanCoin JordanCoin marked this pull request as ready for review March 27, 2026 18:57
Copilot AI review requested due to automatic review settings March 27, 2026 18:57
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

"name": CodemapPluginName,
"source": map[string]any{
"source": "local",
"path": "./plugins/codemap",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/codemap and updates ~/.agents/plugins/marketplace.json.
  • Refactors the MCP server into a reusable package and wires codemap mcp into the main CLI while keeping codemap-mcp as 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.

Comment on lines +178 to +182
entry := map[string]any{
"name": CodemapPluginName,
"source": map[string]any{
"source": "local",
"path": "./plugins/codemap",
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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,

Copilot uses AI. Check for mistakes.
It bundles:

- the Codemap skill under `./skills/`
- a local MCP configuration in [`.mcp.json`](/Users/jordan/Code/codemap/plugins/codemap/.mcp.json)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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").

Suggested change
- a local MCP configuration in [`.mcp.json`](/Users/jordan/Code/codemap/plugins/codemap/.mcp.json)
- a local MCP configuration in [`.mcp.json`](./.mcp.json)

Copilot uses AI. Check for mistakes.
cmd/plugin.go Outdated
case "install":
runPluginInstall(args[1:])
default:
fmt.Println("Usage: codemap plugin <install>")
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
fmt.Println("Usage: codemap plugin <install>")
fmt.Println("Usage: codemap plugin install")

Copilot uses AI. Check for mistakes.
@JordanCoin JordanCoin merged commit 2ba872c into main Mar 27, 2026
12 checks passed
@JordanCoin JordanCoin deleted the codex/codemap-plugin-install branch March 27, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants