Documentation
¶
Overview ¶
Package kit implements Ether's plugin conformance kit and copy linter (SPEC §5.1–§5.6, WS11g), shared across install previews, Studio, the `ether plugin` CLI, and catalogue CI.
Index ¶
- func CheckInstall(ctx context.Context, manifest []byte, files map[string][]byte) error
- func GenerateTemplateFiles(opts TemplateOptions) (map[string][]byte, error)
- func Pack(pkg *Package) ([]byte, error)
- func Scaffold(opts TemplateOptions) error
- type CaseResult
- type FixtureCase
- type FixtureSuite
- type HotTiming
- type Issue
- type Package
- type Report
- type RouteTiming
- type TemplateOptions
- type TestReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckInstall ¶
CheckInstall adapts the conformance report to the plugin host's validation error.
func GenerateTemplateFiles ¶
func GenerateTemplateFiles(opts TemplateOptions) (map[string][]byte, error)
GenerateTemplateFiles returns the in-memory file map for a scaffolded plugin.
func Pack ¶
Pack compiles any TypeScript entry via wasm.Compile, bundles manifest, compiled JS/WASM, assets, schema, strings, and writes the verified `digest` entry into an installable .etherpkg archive.
func Scaffold ¶
func Scaffold(opts TemplateOptions) error
Scaffold generates a minimal working plugin for the requested kind and language in opts.Dir. Every generated template passes kit.Check out of the box.
Types ¶
type CaseResult ¶
type CaseResult struct {
Name string `json:"name"`
OK bool `json:"ok"`
Status int `json:"status"`
DurationMS float64 `json:"durationMs"`
Error string `json:"error,omitempty"`
}
CaseResult is the outcome of one fixture test case.
type FixtureCase ¶
type FixtureCase struct {
Name string `json:"name"`
Method string `json:"method"`
Path string `json:"path"`
Query map[string]string `json:"query,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Body json.RawMessage `json:"body,omitempty"`
WantStatus int `json:"wantStatus"`
WantFields map[string]any `json:"wantFields,omitempty"`
}
FixtureCase is one recorded test fixture in tests/fixtures.json.
type FixtureSuite ¶
type FixtureSuite struct {
Cases []FixtureCase `json:"cases"`
}
FixtureSuite is the schema of tests/fixtures.json.
type HotTiming ¶
type HotTiming struct {
Candidates int `json:"candidates"`
Batches int `json:"batches"`
TotalMS float64 `json:"totalMs"`
MaxBatchMS float64 `json:"maxBatchMs"`
PerCandP95MS float64 `json:"perCandidateP95Ms"`
SlowCount int `json:"slowCandidates"`
Deterministic bool `json:"deterministic"`
}
HotTiming records the outcome and timing of the 10k-candidate hot-path check.
type Issue ¶
type Issue struct {
Rule string `json:"rule"`
Field string `json:"field,omitempty"`
Message string `json:"message"`
}
Issue is one error or warning found by the conformance kit.
type Package ¶
type Package struct {
ManifestRaw json.RawMessage
Manifest plugins.Manifest
Files map[string][]byte
Dir string
}
Package holds an unpacked or directory-loaded plugin ready for checking or packing.
func LoadPkgBytes ¶
LoadPkgBytes loads a plugin package from .etherpkg zip bytes, verifying the digest entry when present.
type Report ¶
type Report struct {
PluginID string `json:"pluginId,omitempty"`
Version string `json:"version,omitempty"`
Kind string `json:"kind,omitempty"`
OK bool `json:"ok"`
Exports map[string]bool `json:"exports,omitempty"`
Errors []Issue `json:"errors,omitempty"`
Warnings []Issue `json:"warnings,omitempty"`
Routes []RouteTiming `json:"routes,omitempty"`
HotPath *HotTiming `json:"hotPath,omitempty"`
DeclaredHosts []string `json:"declaredHosts,omitempty"`
ObservedHosts []string `json:"observedHosts,omitempty"`
DurationMS float64 `json:"durationMs"`
}
Report is the structured result of Check.
type RouteTiming ¶
type RouteTiming struct {
Method string `json:"method"`
Route string `json:"route"`
Status int `json:"status"`
DurationMS float64 `json:"durationMs"`
DeadlineMS int64 `json:"deadlineMs"`
OK bool `json:"ok"`
Skipped bool `json:"skipped,omitempty"`
Error string `json:"error,omitempty"`
Duration time.Duration `json:"-"`
}
RouteTiming records the outcome and duration of one route check.
type TemplateOptions ¶
type TemplateOptions struct {
Kind string // source|integration|notification_channel|livetv_source|extension
Lang string // ts|js|python
Dir string
ID string
Name string
}
TemplateOptions configures a scaffolded plugin project.
type TestReport ¶
type TestReport struct {
PluginID string `json:"pluginId"`
OK bool `json:"ok"`
Cases []CaseResult `json:"cases"`
Integration *CaseResult `json:"integration,omitempty"`
}
TestReport is the outcome of RunTests.
func RunTests ¶
RunTests runs the plugin's recorded fixtures through the hosted runtime (or conformal check when no fixtures file is present), and when etherBin is non-empty, runs an integration check against a headless Ether process.
func (TestReport) Text ¶
func (tr TestReport) Text() string
Text formats the test report as plain human-readable lines.