source

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package source parses, normalizes, and classifies skill source references (git shorthand, full HTTPS/SSH, local path, url) into a canonical identity.

Index

Examples

Constants

This section is empty.

Variables

View Source
var ErrInvalidSource = errors.New("invalid source")

ErrInvalidSource is returned when a source argument cannot be parsed.

Functions

This section is empty.

Types

type Ref

type Ref struct {
	Type      Type
	Original  string
	URL       string
	Owner     string
	Repo      string
	Path      string
	LocalPath string
}

Ref is a parsed, normalized source reference.

func Parse

func Parse(raw string) (Ref, error)

Parse classifies and normalizes a raw source argument.

Example
package main

import (
	"fmt"

	"github.com/glapsfun/gskill/internal/source"
)

func main() {
	ref, _ := source.Parse("github.com/acme/widgets/my-skill")
	fmt.Println(ref.Type, ref.Owner, ref.Repo, ref.Path)
	fmt.Println(ref.URL)
}
Output:
git acme widgets my-skill
https://github.com/acme/widgets.git

func (Ref) Identity

func (s Ref) Identity() string

Identity returns the canonical identity string for the reference: the local path for local sources, or host/owner/repo[/path] for git sources.

type Type

type Type string

Type classifies where a skill comes from, as recorded in the lockfile.

const (
	TypeGit   Type = "git"
	TypeLocal Type = "local"
	TypeURL   Type = "url"
)

Source types (FR-007, FR-008).

func (Type) Valid

func (t Type) Valid() bool

Valid reports whether t is a recognized source type.

Jump to

Keyboard shortcuts

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