From d754f8ad8dde5174b9d909126664795f10c8398a Mon Sep 17 00:00:00 2001 From: Chai Jie Date: Mon, 26 Oct 2026 11:35:18 +0800 Subject: [PATCH] feat: add seekmoon as a plugin install target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SeekMoon (moonbitlang/openseek) reads MCP servers from `mcpServers.` in `/host-mcp.json`, the same shape Claude Desktop uses, so the adapter reuses the shared mcpWriter instead of growing a new writer: macOS ~/Library/Application Support/SeekMoon/host-mcp.json Windows %APPDATA%/SeekMoon/host-mcp.json Linux ~/.config/SeekMoon/host-mcp.json The desktop keeps its own `seekmoon` entry (a per-launch localhost tool server) in that file; the shared upsert only touches `mcpServers.everme-memory`, so the desktop's entry and any hand-added server survive, and uninstall removes only ours. The install result reports the step that actually makes the server live. SeekMoon connects its MCP servers once per engine process and keeps those connections across turns; a desktop conversation runs its own engine, spawned with `--mcp-config=/host-mcp.json` (internal/openseek/serve/loop.mbt). A new entry is therefore picked up by the next conversation or the next app launch, never by a conversation that is already open — which is what the NextStep says. Verified locally with go1.27.3: `go build ./...`, `gofmt -l` clean, `go test ./internal/plugin/` green (including the six SeekMoon tests), and `plugin list` detects this machine's SeekMoon at the right config path. `plugin install seekmoon` reaches the backend and is refused there with `platform: seekmoon does not validate as known_platform` (20004) — the platform enum is server-side, so this adapter needs a matching backend release before install can mint an agent. Co-Authored-By: SeekMoon --- CHANGELOG.md | 6 + README.md | 4 +- README.zh.md | 4 +- cli/AGENTS.md | 2 +- cli/README.md | 2 +- cli/internal/plugin/registry.go | 10 ++ cli/internal/plugin/registry_test.go | 3 +- cli/internal/plugin/seekmoon.go | 154 +++++++++++++++++++++ cli/internal/plugin/seekmoon_test.go | 193 +++++++++++++++++++++++++++ cli/internal/plugin/types.go | 1 + 10 files changed, 374 insertions(+), 5 deletions(-) create mode 100644 cli/internal/plugin/seekmoon.go create mode 100644 cli/internal/plugin/seekmoon_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index e1a8b04..62b7aee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ the open-source home for EverMe CLI and agent plugins. ### CLI +- Add `evercli plugin install seekmoon`. SeekMoon (moonbitlang/openseek) reads + MCP servers from `mcpServers.` in its runtime directory's + `host-mcp.json`, so the adapter reuses the shared MCP writer and preserves + the desktop's own `seekmoon` entry; uninstall removes only EverMe's. The + install reports a new-conversation next step: a desktop conversation's engine + connects its MCP servers once at startup. - Sync the `cli/` Go tree to the `evercli` v0.32.0 release. Earlier public snapshots trailed the published binaries; the tree now matches what `npm install -g @everme/cli` and the release archives ship. diff --git a/README.md b/README.md index 7f491aa..9a8318c 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,14 @@ evercli plugin install kimicode evercli plugin install opencode evercli plugin install openclaw evercli plugin install raven +evercli plugin install seekmoon evercli plugin install workbuddy # 4. Verify evercli doctor ``` -Kimi Code needs one final host-owned step after staging: run `/plugins install ~/.kimi-code/everme` inside its TUI. WorkBuddy asks you to trust the new MCP server in its MCP management dialog. +Kimi Code needs one final host-owned step after staging: run `/plugins install ~/.kimi-code/everme` inside its TUI. WorkBuddy asks you to trust the new MCP server in its MCP management dialog. SeekMoon connects its MCP servers when a conversation starts, so open a new conversation (or relaunch the app) to get `everme-memory`. Once installed, open your Agent and ask "what do you remember about me?" — it will use the MCP `mem://profile` resource to recall. @@ -137,6 +138,7 @@ Each Agent has its own configuration surface. `evercli plugin install ` a | **OpenCode** | `evercli plugin install opencode` | `~/.config/opencode/opencode.json` MCP entry | | **OpenClaw** | `evercli plugin install openclaw` | OpenClaw plugin registration | | **Raven** | `evercli plugin install raven` | `~/.raven/config.json` + embedded MemoryBackend | +| **SeekMoon** | `evercli plugin install seekmoon` | App runtime dir `host-mcp.json` MCP entry + new-conversation step | | **WorkBuddy** | `evercli plugin install workbuddy` | `~/.workbuddy/mcp.json` + first-connection trust step | The memory each Agent reads and writes lives in **one shared memory pool** keyed to your account — so context follows *you*, not the app. diff --git a/README.zh.md b/README.zh.md index 834395f..7bb6665 100644 --- a/README.zh.md +++ b/README.zh.md @@ -87,13 +87,14 @@ evercli plugin install kimicode evercli plugin install opencode evercli plugin install openclaw evercli plugin install raven +evercli plugin install seekmoon evercli plugin install workbuddy # 4. 自检 evercli doctor ``` -Kimi Code 完成预配置后,还需要在 TUI 内运行 `/plugins install ~/.kimi-code/everme`;WorkBuddy 则需要在 MCP 管理界面信任新增的服务。 +Kimi Code 完成预配置后,还需要在 TUI 内运行 `/plugins install ~/.kimi-code/everme`;WorkBuddy 则需要在 MCP 管理界面信任新增的服务。SeekMoon 在会话启动时连接 MCP 服务,因此请新开一个会话(或重启应用)来启用 `everme-memory`。 装好后打开你的 Agent,问它 "what do you remember about me?" —— 它会通过 MCP `mem://profile` 资源去召回你的记忆。 @@ -137,6 +138,7 @@ Kimi Code 完成预配置后,还需要在 TUI 内运行 `/plugins install ~/.k | **OpenCode** | `evercli plugin install opencode` | `~/.config/opencode/opencode.json` MCP 条目 | | **OpenClaw** | `evercli plugin install openclaw` | OpenClaw 插件注册 | | **Raven** | `evercli plugin install raven` | `~/.raven/config.json` + 内置 MemoryBackend | +| **SeekMoon** | `evercli plugin install seekmoon` | 应用运行目录的 `host-mcp.json` MCP 条目 + 新会话步骤 | | **WorkBuddy** | `evercli plugin install workbuddy` | `~/.workbuddy/mcp.json` + 首次连接信任步骤 | 所有 Agent 读写的记忆都落在**同一份记忆池**里,按你的账号隔离 —— 所以上下文跟着**你**走,而不是被锁在某个 App 里。 diff --git a/cli/AGENTS.md b/cli/AGENTS.md index fa6723a..c1cff40 100644 --- a/cli/AGENTS.md +++ b/cli/AGENTS.md @@ -13,7 +13,7 @@ This file is self-contained and governs `cli/` only — it references no files o Five subcommands, intentionally minimal: - `auth` — login / logout / status / me -- `plugin` — list / install / uninstall (Claude Code, OpenClaw, Cursor, Claude Desktop, Codex, Hermes, Devin, WorkBuddy, opencode, Kimi Code, Raven) +- `plugin` — list / install / uninstall (Claude Code, OpenClaw, Cursor, Claude Desktop, Codex, Hermes, Devin, WorkBuddy, SeekMoon, opencode, Kimi Code, Raven) - `import` — conversations scan / run (cold-start session + markdown import) - `doctor` — slim self-checks (network reachability + credential backend) - `skill` — browse / install / manage EverMe skills diff --git a/cli/README.md b/cli/README.md index 9aef411..c48d859 100644 --- a/cli/README.md +++ b/cli/README.md @@ -28,7 +28,7 @@ evercli --version # build identity | Command | Purpose | |-----------|------------------------------------------------------| | `auth` | login / logout / status / me | -| `plugin` | list / install / uninstall (Claude Code, OpenClaw, Cursor, Claude Desktop, Codex, DeepSeek Harness, Hermes, Devin, WorkBuddy, opencode, Kimi Code, Raven) | +| `plugin` | list / install / uninstall (Claude Code, OpenClaw, Cursor, Claude Desktop, Codex, DeepSeek Harness, Hermes, Devin, WorkBuddy, SeekMoon, opencode, Kimi Code, Raven) | | `import` | conversations scan / run (cold-start session + markdown import) | | `doctor` | minimal self-checks (connectivity + credential) | | `skill` | browse / install / manage EverMe skills | diff --git a/cli/internal/plugin/registry.go b/cli/internal/plugin/registry.go index 71291cd..f491d40 100644 --- a/cli/internal/plugin/registry.go +++ b/cli/internal/plugin/registry.go @@ -83,6 +83,14 @@ type registry struct { // a protected ~/.dsh/.env credential block because DSH scrubs inherited // credential-shaped variables before spawning stdio MCP servers. // Implements Preparer, Verifier and Remover. See dsh.go. +// +// - PlatformSeekMoon → seekMoonWriter +// SeekMoon reads MCP servers from `mcpServers.` in its runtime +// directory's host-mcp.json, so it reuses mcpWriter. The desktop keeps +// its own `seekmoon` entry (a per-launch localhost tool server) in the +// same file; the shared upsert preserves it. Commit adds a restart +// NextStep because a conversation fixes its server list at engine +// session start. See seekmoon.go. func DefaultRegistry() *registry { return ®istry{ detectors: map[Platform]Detector{ @@ -98,6 +106,7 @@ func DefaultRegistry() *registry { PlatformKimiCode: kimiCodeDetector{}, PlatformRaven: ravenDetector{}, PlatformDSH: dshDetector{}, + PlatformSeekMoon: seekMoonDetector{}, }, writers: map[Platform]Writer{ PlatformClaudeCode: newClaudeCodeWriter(), @@ -112,6 +121,7 @@ func DefaultRegistry() *registry { PlatformKimiCode: newKimiCodeWriter(), PlatformRaven: newRavenWriter(), PlatformDSH: newDSHWriter(), + PlatformSeekMoon: newSeekMoonWriter(), }, } } diff --git a/cli/internal/plugin/registry_test.go b/cli/internal/plugin/registry_test.go index 9141b64..bfa1724 100644 --- a/cli/internal/plugin/registry_test.go +++ b/cli/internal/plugin/registry_test.go @@ -11,7 +11,7 @@ import ( // make install hand back a nil writer/detector at runtime. func TestDefaultRegistry_NewHostsRegistered(t *testing.T) { r := DefaultRegistry() - for _, p := range []Platform{PlatformDSH, PlatformDevin, PlatformOpenCode, PlatformWorkBuddy} { + for _, p := range []Platform{PlatformDSH, PlatformDevin, PlatformOpenCode, PlatformWorkBuddy, PlatformSeekMoon} { assert.True(t, r.Has(p), "detector missing for %s", p) assert.NotNil(t, r.writer(p), "writer missing for %s", p) assert.NotNil(t, r.detector(p), "detector nil for %s", p) @@ -22,4 +22,5 @@ func TestDefaultRegistry_NewHostsRegistered(t *testing.T) { assert.Contains(t, supported, PlatformDevin) assert.Contains(t, supported, PlatformOpenCode) assert.Contains(t, supported, PlatformWorkBuddy) + assert.Contains(t, supported, PlatformSeekMoon) } diff --git a/cli/internal/plugin/seekmoon.go b/cli/internal/plugin/seekmoon.go new file mode 100644 index 0000000..28399ef --- /dev/null +++ b/cli/internal/plugin/seekmoon.go @@ -0,0 +1,154 @@ +// Package plugin — SeekMoon support. +// +// SeekMoon (moonbitlang/openseek) is a desktop agent whose engine reads MCP +// servers from a JSON file with the same top-level `mcpServers.` shape as +// Claude Desktop, so the writer reuses `mcpWriter` verbatim. What differs is +// where that file lives: the desktop keeps it in its runtime directory, next to +// `engine-settings.json`. +// +// macOS ~/Library/Application Support/SeekMoon/host-mcp.json +// Windows %APPDATA%\SeekMoon\host-mcp.json +// Linux ~/.config/SeekMoon/host-mcp.json +// +// SeekMoon also writes its own `seekmoon` entry into that same file — the +// desktop's tool server, reachable at a per-launch localhost URL. The shared +// upsert in mcp.go only touches `mcpServers.`, so the desktop's +// entry and any server the user added by hand survive the install unchanged. +// +// EVERCLI_SEEKMOON_CONFIG_DIR pins the runtime directory (tests), and +// EVERCLI_SEEKMOON_APP_PATH pins the macOS bundle path. +package plugin + +import ( + "context" + "os" + "os/exec" + "path/filepath" + + "evercli/internal/output" +) + +// seekMoonConfigFile is the only file SeekMoon reads user MCP servers from. +// `engine-settings.json` next to it holds model/provider settings; `skills/` +// and `schedules/` are the app's own state. Do not probe alternatives. +const seekMoonConfigFile = "host-mcp.json" + +type seekMoonDetector struct{} + +func (seekMoonDetector) Platform() Platform { return PlatformSeekMoon } + +func (seekMoonDetector) DisplayName() string { return "SeekMoon" } + +func (seekMoonDetector) Detect(_ context.Context) (*Detection, error) { + dir, err := seekMoonConfigDir() + if err != nil { + return &Detection{Platform: PlatformSeekMoon, DisplayName: "SeekMoon"}, nil + } + detection := &Detection{ + Platform: PlatformSeekMoon, + DisplayName: "SeekMoon", + ConfigPath: seekMoonConfigPathInDir(dir), + Installed: seekMoonInstalled(dir), + } + + config, exists, err := readConfig(detection.ConfigPath) + if err != nil { + return detection, err + } + detection.ConfigExists = exists + if exists { + detection.HasEverMeEntry = nestedMcpServersHasEntry(config, claudeCodeServersPath, mcpEntryName) + } + return detection, nil +} + +func seekMoonConfigPath() (string, error) { + dir, err := seekMoonConfigDir() + if err != nil { + return "", err + } + return seekMoonConfigPathInDir(dir), nil +} + +func seekMoonConfigPathInDir(dir string) string { + return filepath.Join(dir, seekMoonConfigFile) +} + +// seekMoonConfigDir resolves SeekMoon's runtime directory. The desktop creates +// it on first launch; the layout mirrors the app's own resolution so an install +// lands where the engine actually reads. +func seekMoonConfigDir() (string, error) { + if dir := os.Getenv("EVERCLI_SEEKMOON_CONFIG_DIR"); dir != "" { + return dir, nil + } + home, err := os.UserHomeDir() + if err != nil { + return "", output.IOErr("seekmoon", "resolve-home", err) + } + switch runtimeGOOS() { + case "darwin": + return filepath.Join(home, "Library", "Application Support", "SeekMoon"), nil + case "windows": + // The desktop uses the Roaming profile for its runtime directory; + // os.UserConfigDir() already points there on Windows. + if appdata, err := os.UserConfigDir(); err == nil && appdata != "" { + return filepath.Join(appdata, "SeekMoon"), nil + } + return filepath.Join(home, "AppData", "Roaming", "SeekMoon"), nil + default: + return filepath.Join(home, ".config", "SeekMoon"), nil + } +} + +// seekMoonInstalled reports whether SeekMoon is on this machine. A desktop app +// has no canonical CLI, so the runtime directory and the macOS bundle are the +// presence signals; `seekmoon` / `openseek` on PATH covers the CLI-only +// installs that ship next to the desktop build. +func seekMoonInstalled(configDir string) bool { + if _, err := os.Stat(configDir); err == nil { + return true + } + if appPath := os.Getenv("EVERCLI_SEEKMOON_APP_PATH"); appPath != "" { + if _, err := os.Stat(appPath); err == nil { + return true + } + // Stale override: fall through to the PATH / darwin probes + // instead of declaring SeekMoon absent outright. + } + for _, name := range []string{"seekmoon", "openseek"} { + if _, err := exec.LookPath(name); err == nil { + return true + } + } + if runtimeGOOS() == "darwin" { + for _, path := range []string{"/Applications/SeekMoon.app", filepath.Join(os.Getenv("HOME"), "Applications", "SeekMoon.app")} { + if _, err := os.Stat(path); err == nil { + return true + } + } + } + return false +} + +// seekMoonWriter wraps the shared mcpWriter to say when the entry takes effect. +// SeekMoon connects its MCP servers once per engine process and reuses those +// connections across turns: a desktop conversation runs its own engine, spawned +// with `--mcp-config=/host-mcp.json`, and connects at startup +// (internal/openseek/serve/loop.mbt). A config written now is therefore picked +// up by the next engine — a new conversation, or a relaunch of the app. +type seekMoonWriter struct { + *mcpWriter +} + +func newSeekMoonWriter() Writer { + return seekMoonWriter{newMCPWriter(PlatformSeekMoon)} +} + +func (w seekMoonWriter) Commit(ctx context.Context, plan *WritePlan, params WriteParams) (*WriteResult, error) { + res, err := w.mcpWriter.Commit(ctx, plan, params) + if res != nil { + res.NextSteps = append(res.NextSteps, + "start a new conversation in SeekMoon (or relaunch the app): a conversation's engine connects its MCP servers once at startup and keeps them for its lifetime, so this conversation will not see everme-memory") + } + return res, err +} diff --git a/cli/internal/plugin/seekmoon_test.go b/cli/internal/plugin/seekmoon_test.go new file mode 100644 index 0000000..2ddd636 --- /dev/null +++ b/cli/internal/plugin/seekmoon_test.go @@ -0,0 +1,193 @@ +package plugin + +import ( + "context" + "encoding/json" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestSeekMoonConfigPathIsCanonical(t *testing.T) { + t.Run("override pins the runtime directory", func(t *testing.T) { + dir := t.TempDir() + t.Setenv("EVERCLI_SEEKMOON_CONFIG_DIR", dir) + + got, err := seekMoonConfigPath() + require.NoError(t, err) + assert.Equal(t, filepath.Join(dir, "host-mcp.json"), got) + }) + + t.Run("defaults into the app runtime directory", func(t *testing.T) { + t.Setenv("EVERCLI_SEEKMOON_CONFIG_DIR", "") + + got, err := seekMoonConfigPath() + require.NoError(t, err) + dir, err := seekMoonConfigDir() + require.NoError(t, err) + assert.Equal(t, filepath.Join(dir, "host-mcp.json"), got) + // The app's own directory name is part of the contract: SeekMoon + // reads host-mcp.json from its runtime directory only. + assert.True(t, strings.HasSuffix(dir, "SeekMoon"), "runtime dir = %q", dir) + }) +} + +func TestSeekMoonDetectorUsesDirectoryOrAppAndFindsEverMe(t *testing.T) { + t.Run("runtime directory with an existing entry", func(t *testing.T) { + dir := t.TempDir() + t.Setenv("EVERCLI_SEEKMOON_CONFIG_DIR", dir) + path := filepath.Join(dir, "host-mcp.json") + require.NoError(t, os.WriteFile(path, []byte(`{"mcpServers":{"seekmoon":{"url":"http://127.0.0.1:1/mcp"},"everme-memory":{}}}`), 0o600)) + + detection, err := (seekMoonDetector{}).Detect(t.Context()) + require.NoError(t, err) + assert.Equal(t, PlatformSeekMoon, detection.Platform) + assert.Equal(t, "SeekMoon", detection.DisplayName) + assert.True(t, detection.Installed) + assert.True(t, detection.ConfigExists) + assert.True(t, detection.HasEverMeEntry) + assert.Equal(t, path, detection.ConfigPath) + }) + + t.Run("application bundle only", func(t *testing.T) { + root := t.TempDir() + configDir := filepath.Join(root, "missing-config") + appPath := filepath.Join(root, "SeekMoon.app") + require.NoError(t, os.MkdirAll(appPath, 0o700)) + t.Setenv("EVERCLI_SEEKMOON_CONFIG_DIR", configDir) + t.Setenv("EVERCLI_SEEKMOON_APP_PATH", appPath) + + detection, err := (seekMoonDetector{}).Detect(t.Context()) + require.NoError(t, err) + assert.True(t, detection.Installed) + assert.False(t, detection.ConfigExists) + assert.False(t, detection.HasEverMeEntry) + assert.Equal(t, filepath.Join(configDir, "host-mcp.json"), detection.ConfigPath) + }) +} + +// The desktop publishes its own `seekmoon` tool server in the same file. An +// install must leave that entry — and any server the user added — untouched. +func TestSeekMoonWriterPreservesDesktopAndUserServers(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, "host-mcp.json") + require.NoError(t, os.WriteFile(path, []byte(`{ + "mcpServers": { + "seekmoon": {"url": "${OPENSEEK_DESKTOP_TOOLS_URL}","headers":{"Authorization":"Bearer ${OPENSEEK_DESKTOP_TOOLS_TOKEN}"}}, + "user-server": {"command":"node","args":["server.js"]} + } +}`), 0o600)) + + writer := newSeekMoonWriter() + plan, err := writer.Plan(context.Background(), path) + require.NoError(t, err) + _, err = writer.Commit(context.Background(), plan, WriteParams{ + AgentID: "agt_seekmoon", + AgentToken: "test-token", + APIBaseURL: "https://api.test", + }) + require.NoError(t, err) + + raw, err := os.ReadFile(path) + require.NoError(t, err) + var config struct { + MCPServers map[string]json.RawMessage `json:"mcpServers"` + } + require.NoError(t, json.Unmarshal(raw, &config)) + assert.Contains(t, config.MCPServers, "seekmoon") + assert.Contains(t, config.MCPServers, "user-server") + assert.Contains(t, config.MCPServers, mcpEntryName) + + var entry struct { + Command string `json:"command"` + Args []string `json:"args"` + Env map[string]string `json:"env"` + } + require.NoError(t, json.Unmarshal(config.MCPServers[mcpEntryName], &entry)) + assert.NotEmpty(t, entry.Command) + assert.Contains(t, entry.Env, "EVERME_AGENT_TOKEN") + assert.Equal(t, "test-token", entry.Env["EVERME_AGENT_TOKEN"]) +} + +// A conversation's engine connects its MCP servers once at startup, so the +// install result has to send the user to a new conversation instead of leaving +// them waiting for a server that will never appear in the current one. +func TestSeekMoonWriterCommitSurfacesNewConversationStep(t *testing.T) { + path := filepath.Join(t.TempDir(), "host-mcp.json") + writer := newSeekMoonWriter() + plan, err := writer.Plan(context.Background(), path) + require.NoError(t, err) + res, err := writer.Commit(context.Background(), plan, WriteParams{ + AgentID: "agt_seekmoon", + AgentToken: "test-token", + APIBaseURL: "https://api.test", + }) + require.NoError(t, err) + require.Len(t, res.NextSteps, 1) + assert.Contains(t, res.NextSteps[0], "new conversation") +} + +func TestSeekMoonWriterCreatesSecureConfig(t *testing.T) { + path := filepath.Join(t.TempDir(), "host-mcp.json") + writer := newSeekMoonWriter() + plan, err := writer.Plan(context.Background(), path) + require.NoError(t, err) + _, err = writer.Commit(context.Background(), plan, WriteParams{ + AgentID: "agt_seekmoon", + AgentToken: "test-token", + APIBaseURL: "https://api.test", + }) + require.NoError(t, err) + + info, err := os.Stat(path) + require.NoError(t, err) + assert.Equal(t, os.FileMode(0o600), info.Mode().Perm()) +} + +// Uninstall must drop only EverMe's entry: the desktop's own server is not ours +// to delete, and a missing entry is a successful no-op. +func TestSeekMoonWriterRemoveKeepsDesktopServer(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, "host-mcp.json") + writer := newSeekMoonWriter() + plan, err := writer.Plan(context.Background(), path) + require.NoError(t, err) + _, err = writer.Commit(context.Background(), plan, WriteParams{ + AgentID: "agt_seekmoon", + AgentToken: "test-token", + APIBaseURL: "https://api.test", + }) + require.NoError(t, err) + + // Add the desktop's own entry the way SeekMoon does at launch. + cfg, exists, err := readConfig(path) + require.NoError(t, err) + require.True(t, exists) + servers, ok := cfg["mcpServers"].(map[string]interface{}) + require.True(t, ok) + servers["seekmoon"] = map[string]interface{}{"url": "http://127.0.0.1:1/mcp"} + require.NoError(t, writeConfigAtomic(path, cfg, configCarriesToken)) + + remover := writer.(Remover) + result, err := remover.Remove(context.Background(), path) + require.NoError(t, err) + assert.True(t, result.Removed) + + raw, err := os.ReadFile(path) + require.NoError(t, err) + var after struct { + MCPServers map[string]json.RawMessage `json:"mcpServers"` + } + require.NoError(t, json.Unmarshal(raw, &after)) + assert.Contains(t, after.MCPServers, "seekmoon") + assert.NotContains(t, after.MCPServers, mcpEntryName) + + // Idempotent: removing again changes nothing and reports not-removed. + second, err := remover.Remove(context.Background(), path) + require.NoError(t, err) + assert.False(t, second.Removed) +} diff --git a/cli/internal/plugin/types.go b/cli/internal/plugin/types.go index bbc8654..0fe056b 100644 --- a/cli/internal/plugin/types.go +++ b/cli/internal/plugin/types.go @@ -36,6 +36,7 @@ const ( PlatformKimiCode Platform = "kimicode" PlatformRaven Platform = "raven" PlatformDSH Platform = "dsh" + PlatformSeekMoon Platform = "seekmoon" ) // Detection is the result of inspecting the local filesystem for one