91bdee3d3a
* feat(plugins): show source repo link on installed plugin list and settings Installed plugins carried no repository URL — a "Repo" link existed only on marketplace catalog cards, whose repo_url is registry-derived from plugins.yaml and never reaches an installed record. Let the manifest declare an optional repo_url so sideloaded and directly-installed plugins surface the same link. - manifest: add optional RepoURL (repo_url); validate http(s)-only at registration so a javascript: scheme can't reach the operator's session. - Record embeds the manifest, so repo_url flows through JSON to the frontend PluginRecord with no extra plumbing. - frontend: extract the shared, guarded PluginRepoLink (+ isHttpUrl) from the marketplace row and render it on the installed plugin row and the plugin detail header. - fixture + docs: exercise repo_url in the e2e fixture manifest and document the field in the public manifest reference. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(plugins): harden repo_url handling per review - PluginRepoLink accepts string|undefined|null and isHttpUrl null-checks before trim, so it can't throw on an absent repo_url (CodeRabbit); drop the now-redundant truthiness guards at the call sites. - validateRepoURL trims m.RepoURL in place so the stored/serialised value matches what was validated (Greptile). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
54 lines
1.9 KiB
Go
54 lines
1.9 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, "https://github.com/kdlbs/kandev-plugin-template", m.RepoURL)
|
|
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)
|
|
}
|
|
}
|