forked from molecule-ai/molecule-core
Pure mechanical split — no behavior changes. Groups the PluginsHandler
surface area by responsibility so each file stays focused and readable.
Before: plugins.go — 981 lines, 32 funcs
After:
plugins.go — 194 (struct, constructor, shared helpers)
plugins_sources.go — 14 (ListSources)
plugins_listing.go — 174 (ListRegistry, ListInstalled,
ListAvailableForWorkspace,
CheckRuntimeCompatibility)
plugins_install.go — 276 (Install, Uninstall, Download handlers)
plugins_install_pipeline.go — 368 (resolveAndStage, deliverToContainer,
copy/stream tar, CLAUDE.md marker
stripping, dirSize, httpErr,
installRequest/stageResult,
install-layer consts + envx caps)
plugins_test.go (1365 lines) untouched — tests pass unchanged.
go build, go vet, and go test -race ./internal/handlers/... all clean.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
15 lines
377 B
Go
15 lines
377 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// ListSources handles GET /plugins/sources — returns the list of
|
|
// registered install-source schemes so clients can show users which
|
|
// kinds of plugin sources they can install from.
|
|
func (h *PluginsHandler) ListSources(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{"schemes": h.sources.Schemes()})
|
|
}
|