Files
Agent-System-Core/plugin_v2_test.go
weichenandCursor fdc0c1b933 Accept plugin manifest apiVersion 2.0-experimental
Why: Downstream repositories need a versioned public manifest for skills, MCP, knowledge, parsers, agents, channels, and pages without forking the base.
Evidence: go test ./... passed after omitzero on empty scope and backend so the golden plugin_manifest stays stable.
Impact: apiVersion 1.0 remains accepted. New provides fields are optional. Scope and backend are omitted when zero.
Refs: docs/proposals/2026-10-01-plugin-contract-v2.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 10:34:29 +00:00

27 lines
782 B
Go

package core
import "testing"
func TestPluginAPIAccepted(t *testing.T) {
if !PluginAPIAccepted(PluginAPIVersion) || !PluginAPIAccepted(PluginAPIVersionExperimental) {
t.Fatal("current and experimental windows must be accepted")
}
if PluginAPIAccepted("0.9") || PluginAPIAccepted("") {
t.Fatal("unknown or empty apiVersion must be rejected")
}
}
func TestPluginScopeAllows(t *testing.T) {
open := PluginScope{}
if !open.Allows("a", "p") {
t.Fatal("empty scope is visible to everyone")
}
scoped := PluginScope{Tenants: []string{"acme"}, Projects: []string{"p1"}}
if !scoped.Allows("acme", "p1") {
t.Fatal("matching tenant and project should pass")
}
if scoped.Allows("other", "p1") || scoped.Allows("acme", "p2") {
t.Fatal("scope must reject mismatches")
}
}