orchestrate

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package orchestrate provides the core validation and analysis orchestration for skill directories. It coordinates calls to structure, content, contamination, and link checking packages, returning unified reports.

This package is intended for library consumers who want to run skill validation without the CLI layer.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllGroups

func AllGroups() map[CheckGroup]bool

AllGroups returns a map with all check groups enabled.

func RunAllChecks

func RunAllChecks(ctx context.Context, dir string, opts Options) *types.Report

RunAllChecks runs all enabled check groups against a single skill directory and returns a unified report. The context is used for cancellation of network operations (e.g. link checking).

Example
package main

import (
	"context"
	"fmt"
	"os"
	"path/filepath"

	"github.com/agent-ecosystem/skill-validator/orchestrate"
	"github.com/agent-ecosystem/skill-validator/report"
	"github.com/agent-ecosystem/skill-validator/structure"
)

func main() {
	dir, _ := filepath.Abs(filepath.Join("..", "testdata", "valid-skill"))

	opts := orchestrate.Options{
		Enabled:    orchestrate.AllGroups(),
		StructOpts: structure.Options{},
	}

	rpt := orchestrate.RunAllChecks(context.Background(), dir, opts)

	// Print human-readable output
	report.Print(os.Stdout, rpt, false)

	if rpt.Errors > 0 {
		fmt.Fprintf(os.Stderr, "%d error(s) found\n", rpt.Errors)
	}
}
Example (MultiSkill)
package main

import (
	"context"
	"os"
	"path/filepath"

	"github.com/agent-ecosystem/skill-validator/orchestrate"
	"github.com/agent-ecosystem/skill-validator/report"
	"github.com/agent-ecosystem/skill-validator/skillcheck"
	"github.com/agent-ecosystem/skill-validator/structure"
	"github.com/agent-ecosystem/skill-validator/types"
)

func main() {
	dir, _ := filepath.Abs(filepath.Join("..", "testdata", "multi-skill"))

	mode, dirs := skillcheck.DetectSkills(dir)
	if mode != types.MultiSkill {
		return
	}

	opts := orchestrate.Options{
		Enabled:    orchestrate.AllGroups(),
		StructOpts: structure.Options{},
	}

	for _, d := range dirs {
		rpt := orchestrate.RunAllChecks(context.Background(), d, opts)
		report.Print(os.Stdout, rpt, false)
	}
}
Example (StructureOnly)
package main

import (
	"context"
	"fmt"
	"path/filepath"

	"github.com/agent-ecosystem/skill-validator/orchestrate"
	"github.com/agent-ecosystem/skill-validator/structure"
	"github.com/agent-ecosystem/skill-validator/types"
)

func main() {
	dir, _ := filepath.Abs(filepath.Join("..", "testdata", "valid-skill"))

	opts := orchestrate.Options{
		Enabled: map[orchestrate.CheckGroup]bool{
			orchestrate.GroupStructure: true,
		},
		StructOpts: structure.Options{
			SkipOrphans: true,
		},
	}

	rpt := orchestrate.RunAllChecks(context.Background(), dir, opts)

	for _, r := range rpt.Results {
		if r.Level == types.Error {
			fmt.Printf("ERROR: %s\n", r.Message)
		}
	}
}

func RunContaminationAnalysis

func RunContaminationAnalysis(dir string) *types.Report

RunContaminationAnalysis runs cross-language contamination analysis on a single skill directory.

func RunContentAnalysis

func RunContentAnalysis(dir string) *types.Report

RunContentAnalysis runs content quality analysis on a single skill directory.

Example
package main

import (
	"fmt"
	"path/filepath"

	"github.com/agent-ecosystem/skill-validator/orchestrate"
)

func main() {
	dir, _ := filepath.Abs(filepath.Join("..", "testdata", "valid-skill"))

	rpt := orchestrate.RunContentAnalysis(dir)

	if rpt.ContentReport != nil {
		fmt.Printf("Word count: %d\n", rpt.ContentReport.WordCount)
		fmt.Printf("Imperative ratio: %.2f\n", rpt.ContentReport.ImperativeRatio)
	}
}

func RunLinkChecks

func RunLinkChecks(ctx context.Context, dir string) *types.Report

RunLinkChecks validates external HTTP/HTTPS links in a single skill directory.

Types

type CheckGroup

type CheckGroup string

CheckGroup identifies a category of checks that can be enabled or disabled.

const (
	// GroupStructure enables directory layout, frontmatter, and token checks.
	GroupStructure CheckGroup = "structure"
	// GroupLinks enables external HTTP/HTTPS link validation.
	GroupLinks CheckGroup = "links"
	// GroupContent enables content quality analysis.
	GroupContent CheckGroup = "content"
	// GroupContamination enables cross-language contamination analysis.
	GroupContamination CheckGroup = "contamination"
)

type Options

type Options struct {
	Enabled    map[CheckGroup]bool
	StructOpts structure.Options
}

Options controls which checks RunAllChecks performs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL