-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.go
More file actions
56 lines (45 loc) · 1.45 KB
/
plugin.go
File metadata and controls
56 lines (45 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package docmanager
import (
"database/sql"
"net/http"
"github.com/GoCodeAlone/workflow/plugin"
)
func init() {
plugin.RegisterNativePluginFactory(func(db *sql.DB, _ map[string]any) plugin.NativePlugin {
if db == nil {
return nil
}
return New(db)
})
}
// Compile-time interface check.
var _ plugin.NativePlugin = (*Plugin)(nil)
// Plugin implements the doc-manager native plugin, providing HTTP endpoints
// to create and manage markdown documentation for workflows.
type Plugin struct {
h *handler
}
// New creates a new doc-manager plugin. It eagerly creates the workflow_docs
// table so that initialization happens before the server starts handling
// requests (avoiding SQLITE_BUSY on lazy first-request init).
func New(db *sql.DB) *Plugin {
return &Plugin{h: newHandler(db)}
}
func (p *Plugin) Name() string { return "doc-manager" }
func (p *Plugin) Version() string { return "1.0.0" }
func (p *Plugin) Description() string {
return "Create and manage markdown documentation for workflows"
}
func (p *Plugin) Dependencies() []plugin.PluginDependency {
return nil
}
func (p *Plugin) UIPages() []plugin.UIPageDef {
return []plugin.UIPageDef{
{ID: "docs", Label: "Documentation", Icon: "book", Category: "docs"},
}
}
func (p *Plugin) RegisterRoutes(mux *http.ServeMux) {
p.h.registerRoutes(mux)
}
func (p *Plugin) OnEnable(_ plugin.PluginContext) error { return nil }
func (p *Plugin) OnDisable(_ plugin.PluginContext) error { return nil }