githubgen

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package githubgen generates CSF's GitHub protocol client inputs from GitHub's own OpenAPI description: Filter cuts the description down to an allowlist of operations, and Tools writes the MCP tool registrations for the same operations, so the oapi-codegen client and the tools are two projections of one filtered document and cannot drift.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownOperation = errors.New("githubgen: operation not in the description")

ErrUnknownOperation reports an allowlisted operationId the description does not have.

Functions

func ClientName

func ClientName(operationID string) string

ClientName is oapi-codegen's name for an operationId's client method stem: the first letter capitalized, a slash dropped, a dash capitalizing the next letter, issues/create-comment as IssuescreateComment.

func Filter

func Filter(description []byte, operations []string) ([]byte, error)

Filter keeps the allowlisted operations of an OpenAPI 3.0 description, their success responses only, and the components they reach; examples are dropped. An inline JSON success schema is hoisted into components/schemas/<operation>-result so every success type has a name. The output is indented JSON with sorted keys: the same input always yields the same bytes.

func Operations

func Operations(filtered []byte) ([]string, error)

Operations lists the operationIds a filtered document holds, sorted.

func ReadAllowlist

func ReadAllowlist(content []byte) []string

ReadAllowlist reads one operationId per line; blank lines and # comments are skipped.

func ResultSchemaName

func ResultSchemaName(operationID string) string

ResultSchemaName is the component an operation's inline success schema is hoisted into.

func ToolName

func ToolName(operationID string) string

ToolName is the MCP tool an operationId is served as: each word of it capitalized, issues/create-comment as IssuesCreateComment.

func Tools

func Tools(filtered []byte) ([]byte, error)

Tools writes csf/githubtools/tools.gen.go for a filtered description: per operation an input type, a handler calling the oapi-codegen client and returning its typed success body, and the operation's registration.

Types

This section is empty.

Directories

Path Synopsis
Command githubgen projects GitHub's OpenAPI description for CSF:
Command githubgen projects GitHub's OpenAPI description for CSF:

Jump to

Keyboard shortcuts

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