clip

package
v0.97.8 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package clip provides the clip capability for creating shareable markdown clips.

Index

Constants

View Source
const (
	// OpCreate creates a shareable markdown clip and returns its public URL.
	OpCreate = "create"
	// OpGet loads a clip by slug.
	OpGet = "get"
	// OpHealth reports whether the clip capability is registered and ready.
	OpHealth = "health"
)
View Source
const (

	// MaxContentBytes is the maximum accepted markdown body size for create.
	MaxContentBytes = 512 * 1024
)

Variables

This section is empty.

Functions

func Register

func Register() error

Register registers the clip capability with hub and invoker registry.

func SetMetaLLMForTest

func SetMetaLLMForTest(fn metaLLMFunc)

SetMetaLLMForTest overrides LLM metadata generation in unit tests.

func SetPersister

func SetPersister(p Persister)

SetPersister wires the persistence backend used by clip.create.

func WordCount

func WordCount(content string) int

WordCount returns a rough word count for markdown display metadata.

Types

type Meta

type Meta struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

Meta holds LLM-generated (or fallback) title and description.

type Persister

type Persister interface {
	// CreateClip inserts a clip row keyed by slug.
	CreateClip(ctx context.Context, slug, title, description, content, createdBy string) error
	// GetClipBySlug returns a clip by slug, or nil when not found.
	GetClipBySlug(ctx context.Context, slug string) (*Record, error)
}

Persister stores and loads clips.

type Record

type Record struct {
	// Slug is the public short identifier.
	Slug string
	// Title is the clip title.
	Title string
	// Description is the short preview text.
	Description string
	// Content is the markdown body.
	Content string
	// CreatedBy is the optional creator identifier.
	CreatedBy string
	// CreatedAt is when the clip was created.
	CreatedAt time.Time
}

Record is a persisted clip returned by get operations.

Jump to

Keyboard shortcuts

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