metadata

package
v1.0.29 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// MetadataVersion is the current schema version
	MetadataVersion = "1.0.0"

	// DefaultMetadataFile is the default filename for project metadata
	DefaultMetadataFile = "specledger/specledger.yaml"
)

Variables

This section is empty.

Functions

func HasYAMLMetadata

func HasYAMLMetadata(projectRoot string) bool

HasYAMLMetadata checks if a project has the new YAML metadata file

func Save

func Save(metadata *ProjectMetadata, path string) error

Save writes ProjectMetadata to a YAML file

func SaveToProject

func SaveToProject(metadata *ProjectMetadata, projectRoot string) error

SaveToProject saves metadata to a project directory It writes to specledger/specledger.yaml relative to projectRoot

func ValidateArtifactPath added in v1.0.6

func ValidateArtifactPath(path string) error

ValidateArtifactPath validates artifact path format (relative, no parent directory references)

func ValidateCommitSHA

func ValidateCommitSHA(sha string) error

ValidateCommitSHA validates commit SHA format (40-character hex)

func ValidateGitURL

func ValidateGitURL(url string) error

ValidateGitURL validates git URL format (SSH, HTTPS, or local path)

func ValidateProjectName

func ValidateProjectName(name string) error

ValidateProjectName validates project name format

func ValidateShortCode

func ValidateShortCode(code string) error

ValidateShortCode validates short code format

Types

type Dependency

type Dependency struct {
	URL            string          `yaml:"url"`
	Branch         string          `yaml:"branch,omitempty"`
	Alias          string          `yaml:"alias,omitempty"`
	ArtifactPath   string          `yaml:"artifact_path,omitempty"` // Path to artifacts within dependency repo
	ResolvedCommit string          `yaml:"resolved_commit,omitempty"`
	Framework      FrameworkChoice `yaml:"framework,omitempty"`   // speckit, openspec, both, none
	ImportPath     string          `yaml:"import_path,omitempty"` // @alias/spec format for AI imports
}

Dependency represents an external spec dependency

type FrameworkChoice

type FrameworkChoice string

FrameworkChoice is an enum (deprecated)

const (
	FrameworkSpecKit  FrameworkChoice = "speckit"
	FrameworkOpenSpec FrameworkChoice = "openspec"
	FrameworkBoth     FrameworkChoice = "both"
	FrameworkNone     FrameworkChoice = "none"
)

type FrameworkInfo

type FrameworkInfo struct {
	Choice      FrameworkChoice `yaml:"choice"`
	InstalledAt *time.Time      `yaml:"installed_at,omitempty"`
}

FrameworkInfo records SDD framework choice (deprecated, kept for migration compatibility)

type PlaybookInfo

type PlaybookInfo struct {
	Name      string     `yaml:"name"`                 // Name of the playbook (e.g., "specledger")
	Version   string     `yaml:"version"`              // Version of the playbook that was applied
	AppliedAt *time.Time `yaml:"applied_at,omitempty"` // When the playbook was applied
	Structure []string   `yaml:"structure,omitempty"`  // Folder structure created by the playbook
}

PlaybookInfo records the playbook applied to this project

type ProjectInfo

type ProjectInfo struct {
	Name      string    `yaml:"name"`
	ShortCode string    `yaml:"short_code"`
	Created   time.Time `yaml:"created"`
	Modified  time.Time `yaml:"modified"`
	Version   string    `yaml:"version"`
}

ProjectInfo contains project identification

type ProjectMetadata

type ProjectMetadata struct {
	Version         string          `yaml:"version"`
	Project         ProjectInfo     `yaml:"project"`
	Playbook        PlaybookInfo    `yaml:"playbook"`
	TemplateVersion string          `yaml:"template_version,omitempty"` // CLI version that created/updated templates
	TaskTracker     TaskTrackerInfo `yaml:"task_tracker,omitempty"`
	ArtifactPath    string          `yaml:"artifact_path,omitempty"` // Path to artifacts directory
	Dependencies    []Dependency    `yaml:"dependencies,omitempty"`
}

ProjectMetadata represents specledger.yaml

func Load

func Load(path string) (*ProjectMetadata, error)

Load reads and parses a specledger.yaml file

func LoadFromProject

func LoadFromProject(projectRoot string) (*ProjectMetadata, error)

LoadFromProject loads metadata from a project directory It looks for specledger/specledger.yaml relative to projectRoot

func NewProjectMetadata

func NewProjectMetadata(name, shortCode string, playbookName string, playbookVersion string, playbookStructure []string, templateVersion string) *ProjectMetadata

NewProjectMetadata creates a new ProjectMetadata with default values

func (*ProjectMetadata) GetArtifactPath added in v1.0.6

func (m *ProjectMetadata) GetArtifactPath() string

GetArtifactPath returns the artifact path, with default fallback

func (*ProjectMetadata) Validate

func (m *ProjectMetadata) Validate() error

Validate validates the entire ProjectMetadata structure

type TaskTrackerChoice

type TaskTrackerChoice string

TaskTrackerChoice is an enum for task/issue tracking systems

const (
	TaskTrackerBuiltin TaskTrackerChoice = "builtin" // Built-in sl issue tracking
	TaskTrackerBeads   TaskTrackerChoice = "beads"   // Deprecated: use builtin
	TaskTrackerNone    TaskTrackerChoice = "none"
)

type TaskTrackerInfo

type TaskTrackerInfo struct {
	Choice    TaskTrackerChoice `yaml:"choice"`
	EnabledAt *time.Time        `yaml:"enabled_at,omitempty"`
}

TaskTrackerInfo records task/issue tracker choice

type ToolCategory

type ToolCategory string

ToolCategory is an enum

const (
	ToolCategoryCore      ToolCategory = "core"
	ToolCategoryFramework ToolCategory = "framework"
)

type ToolStatus

type ToolStatus struct {
	Name      string
	Installed bool
	Version   string
	Path      string
	Category  ToolCategory
}

ToolStatus represents runtime tool detection (not persisted)

Jump to

Keyboard shortcuts

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