config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultOllamaModel = "glm-5.2:cloud"

Variables

View Source
var PredefinedDefaultGroup = AgentGroup{
	Name:     "Default",
	AgentIDs: []string{"pm", "developer", "qa", "recommender"},
}

PredefinedDefaultGroup is the built-in default agent group containing pm, developer, and qa.

Functions

func AddMilestone

func AddMilestone(configPath string, ms Milestone) error

AddMilestone saves a compact milestone index entry to milestone.yml.

func DefaultDisableBoldForEnvironment

func DefaultDisableBoldForEnvironment() bool

DefaultDisableBoldForEnvironment resolves the startup bold setting while allowing VS Code terminals to opt into safer rendering only when settings do not say otherwise.

NOTE: The VS Code integrated terminal has known compatibility issues with bold formatting in certain themes/fonts, causing character overlapping, alignment issues, or cursor offset bugs. Therefore, we auto-detect TERM_PROGRAM == "vscode" to disable bold styling by default. Modifying or bypassing this default auto-detection without explicit user config will cause visual rendering/alignment bugs in the VS Code integrated terminal.

func DefaultDisableRoundedBordersForEnvironment

func DefaultDisableRoundedBordersForEnvironment() bool

DefaultDisableRoundedBordersForEnvironment resolves the startup border setting while allowing VS Code terminals to opt into normal borders only when settings do not say otherwise.

NOTE: The VS Code integrated terminal frequently suffers from visual glitches when rendering Unicode rounded border characters, resulting in double-width border gaps, alignment issues, or disjointed boxes. To ensure layout integrity, we auto-detect TERM_PROGRAM == "vscode" and default to normal/square ASCII-safe borders unless explicitly overridden by configuration settings. Modifying or bypassing this fallback logic will lead to broken layout borders and visual degradation in the VS Code terminal environment.

func DeleteMilestone

func DeleteMilestone(configPath, statePath, milestoneID string) error

DeleteMilestone removes a milestone from config and state files, and cleans up specs and reports.

func DeleteMilestoneCycle

func DeleteMilestoneCycle(configPath, statePath, milestoneID string, cycleNum int) error

DeleteMilestoneCycle removes a specific cycle, renumbers the remaining cycles sequentially, and renames report files to prevent collisions.

func GenerateDefaultConfig

func GenerateDefaultConfig(path string) error

GenerateDefaultConfig creates an empty milestone index for a new project.

func GetGlobalConfigDir

func GetGlobalConfigDir() string

GetGlobalConfigDir returns the default directory path for global configurations.

func InitializeMilestonesConfig

func InitializeMilestonesConfig(path string) error

InitializeMilestonesConfig creates the default config and companion milestones directory.

func IsValidLLM

func IsValidLLM(val string) bool

IsValidLLM checks if a given LLM runner name is supported.

func SaveGlobalSettings

func SaveGlobalSettings(s Settings) error

SaveGlobalSettings saves settings to the global settings file.

func SaveProjectSettings

func SaveProjectSettings(s Settings) error

SaveProjectSettings saves settings to the project settings file.

func SaveProjectSettingsAt

func SaveProjectSettingsAt(path string, s Settings) error

SaveProjectSettingsAt saves project settings to an explicit settings.yml path.

func SaveState

func SaveState(path string, state *State) error

SaveState writes state.json back to disk.

Types

type Agent

type Agent struct {
	ID             string `json:"id"`
	Name           string `yaml:"name" json:"name"`
	Description    string `yaml:"description" json:"description"`
	Order          int    `yaml:"order" json:"order"`
	RunnerBinary   string `yaml:"runner_binary" json:"runner_binary"`
	OutputContract string `yaml:"output_contract,omitempty" json:"output_contract,omitempty"`
	PromptPath     string `json:"prompt_path"`
	PromptBody     string `json:"prompt_body"`
}

Agent represents a dynamic agent loaded from prompts.

func LoadDynamicAgents

func LoadDynamicAgents() ([]Agent, error)

LoadDynamicAgents scans global config (~/.config/cyclestone/agents/) and local config (.cyclestone/agents/).

type AgentActionLog

type AgentActionLog struct {
	AgentID    string    `json:"agent_id"`
	Timestamp  time.Time `json:"timestamp"`
	ExitCode   int       `json:"exit_code"`
	InputFile  string    `json:"input_file"`
	OutputFile string    `json:"output_file"`
	Duration   string    `json:"duration,omitempty"`
}

AgentActionLog tracks an execution step.

type AgentFrontmatter

type AgentFrontmatter struct {
	Name           string `yaml:"name"`
	Description    string `yaml:"description"`
	Order          *int   `yaml:"order"`
	RunnerBinary   string `yaml:"runner_binary"`
	OutputContract string `yaml:"output_contract"`
}

AgentFrontmatter is used for parsing agent configuration from Markdown frontmatter.

type AgentGroup

type AgentGroup struct {
	Name     string   `yaml:"name" json:"name"`
	AgentIDs []string `yaml:"agent_ids" json:"agent_ids"`
}

AgentGroup represents a serialized pipeline group of agents.

func MergeAgentGroups

func MergeAgentGroups(global, project []AgentGroup) []AgentGroup

MergeAgentGroups merges global and project agent groups, project groups overriding global ones with same name.

type Config

type Config struct {
	Milestones   []Milestone `yaml:"milestones"`
	Repositories []string    `yaml:"repositories,omitempty"`
}

Config wraps a collection of Milestones.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads the milestone.yml file.

type Milestone

type Milestone struct {
	ID                 string   `yaml:"id" json:"id"`
	Title              string   `yaml:"title" json:"title"`
	SpecPath           string   `yaml:"spec_path,omitempty" json:"spec_path,omitempty"`
	Goal               string   `yaml:"goal,omitempty" json:"goal,omitempty"`
	AcceptanceCriteria []string `yaml:"acceptance_criteria,omitempty" json:"acceptance_criteria,omitempty"`
	Status             string   `yaml:"status,omitempty" json:"status,omitempty"` // legacy: runtime state now lives in state.json
	Cycles             int      `yaml:"cycles,omitempty" json:"cycles,omitempty"` // legacy: runtime state now lives in state.json
	Checks             []string `yaml:"checks,omitempty" json:"checks,omitempty"`
}

Milestone defines a milestone's configuration structure.

type MilestoneCycleLog

type MilestoneCycleLog struct {
	CycleNumber int              `json:"cycle_number"`
	Timestamp   time.Time        `json:"timestamp"`
	Branch      string           `json:"branch"`
	CommitHash  string           `json:"commit_hash,omitempty"`
	Status      string           `json:"status"` // "approved", "blocked", "failed"
	UserNote    string           `json:"user_note"`
	Actions     []AgentActionLog `json:"actions"`
	Duration    string           `json:"duration,omitempty"`
}

MilestoneCycleLog represents one run cycle of the milestone.

type MilestoneMigrationResult

type MilestoneMigrationResult struct {
	Milestones     int
	SpecsCreated   int
	StatusesCopied int
	CyclesCopied   int
	Changed        bool
}

MilestoneMigrationResult summarizes a legacy milestone storage migration.

func MigrateMilestoneStorage

func MigrateMilestoneStorage(configPath, statePath string) (MilestoneMigrationResult, error)

MigrateMilestoneStorage moves legacy milestone definitions into compact index entries.

type Settings

type Settings struct {
	DefaultLLM             string `yaml:"default_llm,omitempty" json:"default_llm,omitempty"`                         // "codex", "agy", "aider", "ollama", "ollama-codex", or "" (inherit)
	DefaultMode            string `yaml:"default_mode,omitempty" json:"default_mode,omitempty"`                       // "sandbox", "unrestricted", or "" (inherit)
	AutoGitBranch          *bool  `yaml:"auto_git_branch,omitempty" json:"auto_git_branch,omitempty"`                 // pointer to bool, nil if unset/inherit
	CreateMilestoneBranch  *bool  `yaml:"create_milestone_branch,omitempty" json:"create_milestone_branch,omitempty"` // pointer to bool, nil if unset/inherit
	DisableBold            *bool  `yaml:"disable_bold,omitempty" json:"disable_bold,omitempty"`                       // pointer to bool, nil if unset/inherit
	DisableRoundedBorders  *bool  `yaml:"disable_rounded_borders,omitempty" json:"disable_rounded_borders,omitempty"` // pointer to bool, nil if unset/inherit
	DefaultGitBranchPrefix string `yaml:"default_git_branch_prefix,omitempty" json:"default_git_branch_prefix,omitempty"`

	AiderModel                      string       `yaml:"aider_model,omitempty" json:"aider_model,omitempty"`
	OllamaModel                     string       `yaml:"ollama_model,omitempty" json:"ollama_model,omitempty"`
	OllamaCodexModel                string       `yaml:"ollama_codex_model,omitempty" json:"ollama_codex_model,omitempty"`
	OllamaHost                      string       `yaml:"ollama_host,omitempty" json:"ollama_host,omitempty"`
	EnableContextCaching            *bool        `yaml:"enable_context_caching,omitempty" json:"enable_context_caching,omitempty"`
	EnableCompactPhaseHandoffs      *bool        `yaml:"enable_compact_phase_handoffs,omitempty" json:"enable_compact_phase_handoffs,omitempty"`
	EnableCodexSessionResume        *bool        `yaml:"enable_codex_session_resume,omitempty" json:"enable_codex_session_resume,omitempty"`
	CacheTTLMinutes                 int          `yaml:"cache_ttl_minutes,omitempty" json:"cache_ttl_minutes,omitempty"`
	MaxHandoffChars                 int          `yaml:"max_handoff_chars,omitempty" json:"max_handoff_chars,omitempty"`
	OllamaNumCtx                    int          `yaml:"ollama_num_ctx,omitempty" json:"ollama_num_ctx,omitempty"`
	OllamaNumPredict                int          `yaml:"ollama_num_predict,omitempty" json:"ollama_num_predict,omitempty"`
	MaxModelCallsPerPhase           int          `yaml:"max_model_calls_per_phase,omitempty" json:"max_model_calls_per_phase,omitempty"`
	MaxTokenBudgetPerPhase          int          `yaml:"max_token_budget_per_phase,omitempty" json:"max_token_budget_per_phase,omitempty"`
	MaxLLMInputChars                int          `yaml:"max_llm_input_chars,omitempty" json:"max_llm_input_chars,omitempty"`
	MaxRetainedConversationMessages int          `yaml:"max_retained_conversation_messages,omitempty" json:"max_retained_conversation_messages,omitempty"`
	AgentGroups                     []AgentGroup `yaml:"agent_groups,omitempty" json:"agent_groups,omitempty"`
}

Settings represents global and project configurations.

func LoadDefaultSettings

func LoadDefaultSettings() Settings

LoadDefaultSettings returns the default settings object.

func LoadGlobalSettings

func LoadGlobalSettings() (Settings, error)

LoadGlobalSettings reads the global settings.yml if it exists.

func LoadMergedSettings

func LoadMergedSettings() Settings

LoadMergedSettings merges global and project configurations (project overrides global).

func LoadProjectSettings

func LoadProjectSettings() (Settings, error)

LoadProjectSettings reads the local project settings.yml if it exists.

type State

type State struct {
	ActiveMilestoneID        string                         `json:"active_milestone_id"`
	MilestoneStatuses        map[string]string              `json:"milestone_statuses"` // milestone ID -> status
	MilestoneCycles          map[string]int                 `json:"milestone_cycles"`   // milestone ID -> cycle count
	MilestoneRecommendations map[string]int                 `json:"milestone_recommendations"`
	History                  map[string][]MilestoneCycleLog `json:"history"` // milestone ID -> list of cycles
	// contains filtered or unexported fields
}

State tracks the runtime / progress state of the milestones.

func LoadState

func LoadState(path string) (*State, error)

LoadState reads the state.json tracking file and migrates legacy formats if necessary.

func (*State) AddCycleLog

func (s *State) AddCycleLog(id string, log MilestoneCycleLog)

func (*State) GetActiveMilestoneID

func (s *State) GetActiveMilestoneID() string

func (*State) GetHistory

func (s *State) GetHistory(id string) []MilestoneCycleLog

func (*State) GetMilestoneCycles

func (s *State) GetMilestoneCycles(id string) int

func (*State) GetMilestoneRecommendation

func (s *State) GetMilestoneRecommendation(id string) int

func (*State) GetMilestoneStatus

func (s *State) GetMilestoneStatus(id string) string

func (*State) IncrementMilestoneCycles

func (s *State) IncrementMilestoneCycles(id string) int

func (*State) SetActiveMilestoneID

func (s *State) SetActiveMilestoneID(id string)

func (*State) SetMilestoneCycles

func (s *State) SetMilestoneCycles(id string, cycles int)

func (*State) SetMilestoneRecommendation

func (s *State) SetMilestoneRecommendation(id string, score int)

func (*State) SetMilestoneStatus

func (s *State) SetMilestoneStatus(id, status string)

func (*State) UpdateLastCycleLog

func (s *State) UpdateLastCycleLog(id string, updateFn func(log *MilestoneCycleLog))

Jump to

Keyboard shortcuts

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