propose

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package propose turns a local skill into a pull request on the registry, the only way to change a team skill.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoChanges reports a proposal identical to the registry version.
	ErrNoChanges = errors.New("the proposed skill does not differ from the registry")
	// ErrNoPullRequest reports that the branch was pushed but no pull request
	// could be opened; the developer has to open it manually.
	ErrNoPullRequest = errors.New("branch pushed but no pull request opened")
)

Functions

This section is empty.

Types

type CLIOpener

type CLIOpener struct {
	LookPath func(string) (string, error)
	Run      func(ctx context.Context, name string, args ...string) (string, error)
}

CLIOpener opens pull requests with gh (GitHub) or glab (GitLab) when installed.

func NewCLIOpener

func NewCLIOpener() CLIOpener

NewCLIOpener returns a CLIOpener using the tools found in PATH.

func (CLIOpener) Open

func (o CLIOpener) Open(ctx context.Context, remoteURL, base, branch, title, body string) (string, error)

Open opens a pull request (or GitLab merge request) from branch into base. Without a suitable tool it returns an error telling where to open it manually.

type Opener

type Opener interface {
	Open(ctx context.Context, remoteURL, base, branch, title, body string) (string, error)
}

Opener opens a pull request for a pushed branch and returns its URL.

type Request

type Request struct {
	Base     string // registry branch the PR targets, e.g. "main"
	Branch   string // branch to create and push, e.g. "skillcrew/review-20261011-120000"
	SkillDir string // skill directory inside the registry, slash-separated, e.g. "plugins/security/skills/review"
	Name     string // skill name in the registry; the proposed SKILL.md frontmatter name is reset to it
	Source   string // local directory holding the proposed skill files
	Title    string // commit message and PR title
	Body     string // PR body
}

Request describes a proposal.

type Result

type Result struct {
	Branch string
	URL    string // pull request URL, or empty if no PR could be opened
}

Result of a proposal.

func Propose

func Propose(ctx context.Context, repo *gitx.Repo, req Request, opener Opener) (Result, error)

Propose validates the skill in req.Source, commits it in place of req.SkillDir on a new branch based on origin's req.Base, pushes that branch (never forcing, never pushing anything else) and opens a pull request.

It returns ErrNoChanges when the skill matches the registry. When the push succeeds but opener fails (or is nil), it returns the Result with Branch set and an error wrapping both ErrNoPullRequest and the opener error, so the caller can tell the developer to open the pull request manually.

Jump to

Keyboard shortcuts

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