core

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package core provides the Publisher interface for marketplace submissions.

Index

Constants

View Source
const DefaultDirMode = 0755

DefaultDirMode is the default permission for created directories.

View Source
const DefaultFileMode = 0600

DefaultFileMode is the default permission for created files.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthError

type AuthError struct {
	Message string
}

AuthError indicates an authentication failure.

func (*AuthError) Error

func (e *AuthError) Error() string

type BranchError

type BranchError struct {
	Branch string
	Err    error
}

BranchError indicates a failure to create or update a branch.

func (*BranchError) Error

func (e *BranchError) Error() string

func (*BranchError) Unwrap

func (e *BranchError) Unwrap() error

type CommitError

type CommitError struct {
	Message string
	Err     error
}

CommitError indicates a failure to create a commit.

func (*CommitError) Error

func (e *CommitError) Error() string

func (*CommitError) Unwrap

func (e *CommitError) Unwrap() error

type ForkError

type ForkError struct {
	Owner string
	Repo  string
	Err   error
}

ForkError indicates a failure to fork the repository.

func (*ForkError) Error

func (e *ForkError) Error() string

func (*ForkError) Unwrap

func (e *ForkError) Unwrap() error

type MarketplaceConfig

type MarketplaceConfig struct {
	// Owner is the GitHub org/user that owns the marketplace repo.
	Owner string

	// Repo is the repository name.
	Repo string

	// BaseBranch is the default branch to target (usually "main").
	BaseBranch string

	// PluginPath is the path within the repo where plugins are stored.
	// e.g., "external_plugins" for Claude official marketplace.
	PluginPath string

	// RequiredFiles lists files that must exist in the plugin directory.
	RequiredFiles []string
}

MarketplaceConfig defines the target repository for a marketplace.

type PRError

type PRError struct {
	Title string
	Err   error
}

PRError indicates a failure to create a pull request.

func (*PRError) Error

func (e *PRError) Error() string

func (*PRError) Unwrap

func (e *PRError) Unwrap() error

type PublishOptions

type PublishOptions struct {
	// PluginDir is the local directory containing the plugin files.
	PluginDir string

	// PluginName is the name of the plugin (used as directory name in marketplace).
	PluginName string

	// GitHubToken is the GitHub personal access token for API authentication.
	// Required scopes: repo, workflow
	GitHubToken string

	// ForkOwner is the GitHub username/org that owns the fork.
	// If empty, uses the authenticated user.
	ForkOwner string

	// Branch is the name of the branch to create for the PR.
	// If empty, defaults to "add-<plugin-name>".
	Branch string

	// Title is the PR title.
	// If empty, defaults to "Add <plugin-name> plugin".
	Title string

	// Body is the PR description.
	// If empty, a default description is generated.
	Body string

	// DryRun if true, validates and prepares but doesn't create the PR.
	DryRun bool

	// Verbose enables detailed logging.
	Verbose bool
}

PublishOptions configures the publish operation.

type PublishResult

type PublishResult struct {
	// PRURL is the URL of the created pull request.
	PRURL string

	// PRNumber is the PR number.
	PRNumber int

	// Branch is the branch name used for the PR.
	Branch string

	// ForkURL is the URL of the fork repository.
	ForkURL string

	// Status is a human-readable status message.
	Status string

	// FilesAdded lists the files that were added/updated.
	FilesAdded []string
}

PublishResult contains the result of a publish operation.

type Publisher

type Publisher interface {
	// Name returns the marketplace identifier (e.g., "claude", "gemini").
	Name() string

	// Validate checks if the plugin directory has all required files.
	Validate(pluginDir string) error

	// Publish submits the plugin to the marketplace.
	// Returns the PR URL on success.
	Publish(ctx context.Context, opts PublishOptions) (*PublishResult, error)
}

Publisher defines the interface for publishing plugins to marketplaces.

type ValidationError

type ValidationError struct {
	PluginDir string
	Message   string
	Missing   []string // Missing required files
}

ValidationError indicates the plugin failed validation.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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