flowstore

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package flowstore manages flow stores (taps) for sharing AI flows via GitHub.

Index

Constants

View Source
const (
	// OfficialStoreName is the name of the official Astonish flow store
	OfficialStoreName = "official"
	// OfficialStoreURL is the GitHub repository for the official store
	OfficialStoreURL = "github.com/schardosin/astonish-flows"
)

Variables

This section is empty.

Functions

func GetFlowsDir

func GetFlowsDir() (string, error)

GetFlowsDir returns the new flows directory (for user-created flows)

Types

type Flow

type Flow struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Tags        []string `json:"tags"`
	TapName     string   `json:"tap_name"`   // Which tap this flow belongs to
	Installed   bool     `json:"installed"`  // Whether it's installed locally
	LocalPath   string   `json:"local_path"` // Path if installed
}

Flow represents a flow available in a store

type FlowMeta

type FlowMeta struct {
	Description string   `yaml:"description" json:"description"`
	Tags        []string `yaml:"tags" json:"tags"`
}

FlowMeta contains metadata about a flow from the manifest

type GitHubFile

type GitHubFile struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	Type        string `json:"type"` // "file" or "dir"
	DownloadURL string `json:"download_url"`
	Content     string `json:"content"`
	Encoding    string `json:"encoding"`
}

GitHubFile represents a file from the GitHub API

type MCPMeta added in v1.2.8

type MCPMeta struct {
	ID             string            `yaml:"id" json:"id"`     // Unique identifier (e.g., "github.com/owner/repo")
	Name           string            `yaml:"name" json:"name"` // Display name (can have spaces)
	Description    string            `yaml:"description" json:"description"`
	Author         string            `yaml:"author" json:"author"`
	GithubUrl      string            `yaml:"githubUrl" json:"githubUrl"`
	GithubStars    int               `yaml:"githubStars" json:"githubStars"`
	RequiresApiKey bool              `yaml:"requiresApiKey" json:"requiresApiKey"`
	Command        string            `yaml:"command" json:"command"`
	Args           []string          `yaml:"args" json:"args"`
	Env            map[string]string `yaml:"env" json:"env"`
	Tags           []string          `yaml:"tags" json:"tags"`
	Transport      string            `yaml:"transport" json:"transport"` // "stdio" or "sse"
	URL            string            `yaml:"url" json:"url"`             // For SSE transport
}

MCPMeta contains metadata about an MCP server from the manifest

type Manifest

type Manifest struct {
	Name        string              `yaml:"name" json:"name"`
	Author      string              `yaml:"author" json:"author"`
	Description string              `yaml:"description" json:"description"`
	Flows       map[string]FlowMeta `yaml:"flows" json:"flows"`
	MCPs        map[string]MCPMeta  `yaml:"mcps" json:"mcps"` // MCP servers from this tap
}

Manifest represents the required manifest.yaml in a tap repository

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages all flow stores

func NewStore

func NewStore() (*Store, error)

NewStore creates a new store manager

func (*Store) AddTap

func (s *Store) AddTap(urlOrShorthand string, alias string) (string, error)

AddTap adds a new tap by GitHub URL with smart naming: - "owner" → assumes owner/astonish-flows, tap name = "owner" - "owner/repo" → if repo != "astonish-flows", tap name = "owner-repo" - alias parameter overrides the tap name Validates that the repository exists and contains a manifest.yaml

func (*Store) FetchFlow

func (s *Store) FetchFlow(tap *Tap, flowName string) ([]byte, error)

FetchFlow downloads a specific flow YAML file from a tap

func (*Store) FetchManifest

func (s *Store) FetchManifest(tap *Tap) (*Manifest, error)

FetchManifest fetches the manifest.yaml from a tap's GitHub repository

func (*Store) FetchManifestForceRefresh added in v1.3.0

func (s *Store) FetchManifestForceRefresh(tap *Tap) (*Manifest, error)

FetchManifestForceRefresh fetches the manifest from GitHub, bypassing CDN cache Uses the commit SHA instead of branch name to guarantee no CDN caching

func (*Store) ForceRefreshAllManifests added in v1.3.0

func (s *Store) ForceRefreshAllManifests() error

ForceRefreshAllManifests fetches manifests from remote, ignoring all caches including GitHub CDN cache by fetching via commit SHA

func (*Store) GetAllTaps

func (s *Store) GetAllTaps() []*Tap

GetAllTaps returns official + custom taps

func (*Store) GetInstalledFlowPath

func (s *Store) GetInstalledFlowPath(tapName, flowName string) (string, bool)

GetInstalledFlowPath returns the path to an installed flow, if it exists

func (*Store) GetOfficialTap

func (s *Store) GetOfficialTap() *Tap

GetOfficialTap returns the official store tap

func (*Store) GetStoreDir

func (s *Store) GetStoreDir() string

GetStoreDir returns the store directory

func (*Store) GetTaps

func (s *Store) GetTaps() []Tap

GetTaps returns all custom taps

func (*Store) InstallFlow

func (s *Store) InstallFlow(tapName, flowName string) error

InstallFlow downloads and caches a flow locally

func (*Store) ListAllFlows

func (s *Store) ListAllFlows() []Flow

ListAllFlows returns all flows from all taps (requires manifests to be loaded)

func (*Store) ListAllMCPs added in v1.2.8

func (s *Store) ListAllMCPs() []TappedMCP

ListAllMCPs returns all MCP servers from all taps (requires manifests to be loaded)

func (*Store) RemoveTap

func (s *Store) RemoveTap(name string) error

RemoveTap removes a tap by name

func (*Store) UninstallFlow

func (s *Store) UninstallFlow(tapName, flowName string) error

UninstallFlow removes a cached flow

func (*Store) UpdateAllManifests

func (s *Store) UpdateAllManifests() error

UpdateAllManifests fetches fresh manifests for all taps

type StoreConfig

type StoreConfig struct {
	Taps []Tap `yaml:"taps" json:"taps"`
}

StoreConfig is persisted in config.yaml

type Tap

type Tap struct {
	Name     string    `yaml:"name" json:"name"`     // e.g., "myuser/my-flows" or "official"
	URL      string    `yaml:"url" json:"url"`       // Full GitHub URL
	Branch   string    `yaml:"branch" json:"branch"` // Git branch (defaults to "main")
	Manifest *Manifest `yaml:"-" json:"-"`           // Cached manifest (not persisted)
}

Tap represents a flow store repository

type TappedMCP added in v1.2.8

type TappedMCP struct {
	ID             string            `json:"id"`   // Unique identifier
	Name           string            `json:"name"` // Display name
	Description    string            `json:"description"`
	Author         string            `json:"author"`
	GithubUrl      string            `json:"githubUrl"`
	GithubStars    int               `json:"githubStars"`
	RequiresApiKey bool              `json:"requiresApiKey"`
	Command        string            `json:"command"`
	Args           []string          `json:"args"`
	Env            map[string]string `json:"env"`
	Tags           []string          `json:"tags"`
	Transport      string            `json:"transport"` // "stdio" or "sse"
	URL            string            `json:"url"`       // For SSE transport
	TapName        string            `json:"tap_name"`  // Which tap this MCP belongs to
}

TappedMCP represents an MCP server available from a tapped repository

Jump to

Keyboard shortcuts

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