Files
kandev/apps/backend/cmd/plugin-fixture/fixture_package_test.go
T
João Salavisa 1ba81a7cd0 refactor(plugins): remove the unused tools feature (#1776)
Plugin `tools[]` overlapped with MCP, kandev's established mechanism for
exposing tools to agents (`internal/mcp/`), and the `InvokeTool` path was
never wired into agent tool sets — the `listTools` handler was
listing-only. Rather than maintain a half-built parallel surface, remove
it. If plugins ever contribute agent tools, they should feed through MCP,
not a separate `InvokeTool` RPC.

Removes:
- proto `InvokeTool` RPC + `ToolRequest`/`ToolResponse`/`ToolContext`
  messages (regenerated `*.pb.go` / `*_grpc.pb.go`)
- pkg/pluginsdk `InvokeTool` from the `Plugin` interface and
  `UnimplementedPlugin`, the Tool* Go-native types, and the
  `RemotePlugin`/`GRPCServer` dispatch
- internal/plugins `Service.InvokeTool`, the `listTools` handler +
  `GET /api/plugins/tools` route, `PluginToolDTO`, and the manifest
  `Tools` field + tool-name uniqueness validation
- frontend `PluginTool`/`PluginToolDTO` types, `listPluginTools`, and the
  manifest-card tools list
- fixture/e2e `InvokeTool` echo impl and the `tools:` manifest block

Test doubles that used the "crash" tool to exercise crash-restart now use
a "crash" webhook key instead. Internal specs (GRPC-CONTRACT, spec) drop
the tool RPC/feature; docs/public was already updated in #1774.

Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 17:03:13 +01:00

53 lines
1.8 KiB
Go

// Guards fixture-package/manifest.yaml against drift: it must stay a valid,
// runtime-managed manifest that declares the id, webhook, and UI
// bundle path the e2e suite and `make e2e-plugin-package` depend on. See
// docs/plans/plugins/GRPC-CONTRACT.md §6.
package main
import (
_ "embed"
"testing"
"github.com/kandev/kandev/internal/plugins/manifest"
"github.com/stretchr/testify/require"
)
//go:embed fixture-package/manifest.yaml
var fixtureManifestYAML []byte
func TestFixtureManifest_ParsesAndValidates(t *testing.T) {
m, err := manifest.Parse(fixtureManifestYAML)
require.NoError(t, err)
require.NoError(t, m.Validate())
require.Equal(t, "kandev-plugin-e2e", m.ID)
require.Equal(t, 1, m.APIVersion)
require.Equal(t, "1.0.0", m.Version)
require.True(t, m.IsManaged())
require.Equal(t, "/ui/bundle.js", m.UI.Bundle)
require.True(t, m.HasEvent("task.created"))
require.True(t, m.Capabilities.State)
require.Len(t, m.Webhooks, 1)
require.Equal(t, "test-hook", m.Webhooks[0].Key)
require.Equal(t, "POST", m.Webhooks[0].Method)
}
func TestFixtureManifest_DeclaresHostPlatformExecutable(t *testing.T) {
m, err := manifest.Parse(fixtureManifestYAML)
require.NoError(t, err)
// The Makefile's `e2e-plugin-package` target only ever builds/packs for
// the host platform, but the committed manifest lists every platform
// the fixture might run on in CI (linux/darwin/windows, amd64/arm64).
for platformKey, execPath := range map[string]string{
"linux-amd64": "server/plugin-linux-amd64",
"linux-arm64": "server/plugin-linux-arm64",
"darwin-amd64": "server/plugin-darwin-amd64",
"darwin-arm64": "server/plugin-darwin-arm64",
"windows-amd64": "server/plugin-windows-amd64.exe",
} {
require.Equal(t, execPath, m.Runtime.Executables[platformKey], "platform %s", platformKey)
}
}