Files
archie/.okf/codebase/internal/skill/plugin.md
T
sam 7c34bdae5a okf: scaffold knowledge bundle and MCP server config
Adds a harvested .okf/ knowledge bundle (codebase concepts + starter
architecture/services/rules scaffolding) and .mcp.json pointing at the
shared okf MCP service (http://localhost:8765/archie-core/), which
serves multiple projects' bundles from a single process.
2026-07-22 04:36:50 +10:00

1.1 KiB

description, resource, tags, timestamp, title, type
description resource tags timestamp title type
Source module internal/skill/plugin.go (83 lines). internal/skill/plugin.go
go
source
2026-07-21T18:36:22Z plugin.go Module

Module plugin.go

Path: internal/skill/plugin.go
Lines: 83

Snippet Preview

package skill

import (
	"fmt"
	"os"
	"path/filepath"
	"sort"
	"strings"

	"github.com/traefik/yaegi/interp"
	"github.com/traefik/yaegi/stdlib"
)

// Plugin is a discovered Yaegi-interpreted .go file in a skill's plugins/
// directory. The source must be a valid Go package exporting a Run function:
//
//	func Run(input string) string
type Plugin struct {
	Name string // filename without .go extension
	Path string // full path to the .go file
	Src  string // source code content
}

// Run interprets the plugin source via Yaegi and calls its Run function
// with the given input. The plugin runs with full standard library access.
func (p *Plugin) Run(input string) (string, error) {
	i := interp.New(interp.Options{})
	if err := i.Use(stdlib.Symbols); err != nil {
		return "", fmt.Errorf("plugin %s: stdlib: %w", p.Name, err)
	}