projectdef

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

pkg/projectdef

specscore-project.yaml schema and read/write operations for all repository config file types (spec, state, code, embedded state).

Outstanding Questions

None at this time.

Documentation

Overview

Package projectdef provides the specscore-project.yaml schema and read/write operations.

Index

Constants

View Source
const (
	SpecConfigFile    = "synchestra-spec-repo.yaml"
	StateConfigFile   = "synchestra-state-repo.yaml"
	CodeConfigFile    = "synchestra-code-repo.yaml"
	EmbeddedStateFile = "synchestra-state.yaml"
)

Variables

This section is empty.

Functions

func WriteCodeConfig

func WriteCodeConfig(dir string, cfg CodeConfig) error

WriteCodeConfig writes a CodeConfig to the given directory.

func WriteEmbeddedStateConfig

func WriteEmbeddedStateConfig(dir string, cfg EmbeddedStateConfig) error

WriteEmbeddedStateConfig writes an EmbeddedStateConfig to the given directory.

func WriteSpecConfig

func WriteSpecConfig(dir string, cfg SpecConfig) error

WriteSpecConfig writes a SpecConfig to the given directory.

func WriteStateConfig

func WriteStateConfig(dir string, cfg StateConfig) error

WriteStateConfig writes a StateConfig to the given directory.

Types

type CodeConfig

type CodeConfig struct {
	SpecRepos []string `yaml:"spec_repos"`
}

CodeConfig represents the contents of synchestra-code-repo.yaml.

func ReadCodeConfig

func ReadCodeConfig(dir string) (CodeConfig, error)

ReadCodeConfig reads a CodeConfig from the given directory.

type EmbeddedStateConfig

type EmbeddedStateConfig struct {
	Title        string           `yaml:"title"`
	Mode         string           `yaml:"mode"`
	SourceBranch string           `yaml:"source_branch"`
	Sync         *EmbeddedSyncCfg `yaml:"sync,omitempty"`
}

EmbeddedStateConfig lives on the orphan branch.

func ReadEmbeddedStateConfig

func ReadEmbeddedStateConfig(dir string) (EmbeddedStateConfig, error)

ReadEmbeddedStateConfig reads an EmbeddedStateConfig from the given directory.

type EmbeddedSyncCfg

type EmbeddedSyncCfg struct {
	Pull string `yaml:"pull"`
	Push string `yaml:"push"`
}

EmbeddedSyncCfg controls sync policy for embedded state.

type PlanningConfig

type PlanningConfig struct {
	WhatsNext string `yaml:"whats_next"`
}

PlanningConfig holds planning-related settings from synchestra-spec-repo.yaml.

type SpecConfig

type SpecConfig struct {
	Title     string          `yaml:"title"`
	StateRepo string          `yaml:"state_repo"`
	Repos     []string        `yaml:"repos"`
	Planning  *PlanningConfig `yaml:"planning,omitempty"`
}

SpecConfig represents the contents of synchestra-spec-repo.yaml.

func ReadSpecConfig

func ReadSpecConfig(dir string) (SpecConfig, error)

ReadSpecConfig reads a SpecConfig from the given directory.

func (SpecConfig) ParseStateRepo

func (c SpecConfig) ParseStateRepo() (mode, branch string)

ParseStateRepo parses the state_repo field. Returns (mode, branch):

  • ("worktree", branchName) for "worktree://branchName"
  • ("repo", "") for any other non-empty value
  • ("", "") if state_repo is empty

func (SpecConfig) WhatsNextMode

func (c SpecConfig) WhatsNextMode() string

WhatsNextMode returns the effective whats_next mode, defaulting to "disabled".

type StateConfig

type StateConfig struct {
	Title     string   `yaml:"title"`
	MainRepo  string   `yaml:"main_repo"`
	SpecRepos []string `yaml:"spec_repos"`
	CodeRepos []string `yaml:"code_repos,omitempty"`
}

StateConfig represents the contents of synchestra-state-repo.yaml.

func ReadStateConfig

func ReadStateConfig(dir string) (StateConfig, error)

ReadStateConfig reads a StateConfig from the given directory.

Jump to

Keyboard shortcuts

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