config

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config validates the managed metadata files devsys owns inside a project's .devsys/ directory (方案 §14.1/§14.2/§14.3, 实施计划 M0.4).

Validation is strict: unknown keys, wrong types and missing required fields are reported with their file, line and field, and every problem is collected before the command fails. A file whose schema_version this build does not understand is reported and otherwise left uninterpreted — reading a version we do not know must never tempt a caller into writing (方案 §14.1: 读到未知版本 时拒绝写入、仅允许只读诊断).

Index

Constants

View Source
const (
	ProjectFile      = "project.yaml"
	ConfigFile       = "config.yaml"
	CurrentStateFile = "state/current.yaml"
	MilestonesFile   = "state/milestones.yaml"
)

Managed metadata files, paths relative to .devsys/, slash-separated.

View Source
const SeverityWarning = "warning"

SeverityWarning marks a problem as advisory: it is recorded and rendered, but it is not a reason to refuse the file. An empty Severity is an error.

View Source
const SupportedSchemaVersion = 1

SupportedSchemaVersion is the only schema_version this build understands.

Variables

This section is empty.

Functions

func Diagnose

func Diagnose(root string) (*Metadata, Problems)

Diagnose is Load plus missing-file problems: the read-only view behind `workloom config check`. It reads files plainly — no lock, no recovery, no writes — so it also works on state that write commands must refuse.

func Load

func Load(root string) (*Metadata, Problems)

Load validates every managed metadata file that exists under root (the project root; the .devsys/ prefix is added here). Missing files are not problems: creating them is devsys init's job, so a write command may run on a partial layout as long as every present file is valid.

func ManagedFiles

func ManagedFiles() []string

ManagedFiles returns the managed metadata files in report order.

Types

type Config

type Config struct {
	SchemaVersion int `json:"schema_version"`
	// WorkspaceRoot is where execution workspaces are created (方案 §4.8):
	// absolute, or relative to the project root. Empty selects the default
	// below .devsys/.
	WorkspaceRoot string `json:"workspace_root,omitempty"`
	// DispatchCommand is the command a scheduling tick runs for each attempt
	// it dispatches (M6.4). Empty means the tick refuses to start attempts.
	DispatchCommand string `json:"dispatch_command,omitempty"`
	// KnowledgePages are the page-layer roots (project-relative directories)
	// the knowledge commands read and validate (M5.1, 方案 §12.6). Empty means
	// the built-in candidates of knowledge.DefaultRoots.
	KnowledgePages []string `json:"knowledge_pages,omitempty"`
	// KnowledgeGenerator is the page generator command a refresh runs
	// (M5.3, 方案 §12.6). Empty means no page generator is installed, which the
	// layer reports as the documented degradation rather than as a failure.
	KnowledgeGenerator string `json:"knowledge_generator,omitempty"`
	// DefaultPolicy is the workflow policy id governing work items that
	// declare no instance of their own (方案 §4.7/§5.3). Empty keeps them
	// ungated: gates then apply only where a work item bound a policy.
	DefaultPolicy string `json:"default_policy,omitempty"`
}

Config is the strict view of config.yaml. No project-level options are defined yet, so only schema_version is accepted; later milestones extend both the whitelist and this struct.

type Metadata

type Metadata struct {
	Project *domain.Project
	Config  *Config
}

Metadata is what Load or Diagnose could read. A field is nil when its file was missing or invalid; callers must not fabricate defaults for it.

type Problem

type Problem struct {
	File     string `json:"file"`
	Line     int    `json:"line,omitempty"`
	Field    string `json:"field,omitempty"`
	Severity string `json:"severity,omitempty"`
	Reason   string `json:"reason"`
}

Problem is one located defect in a managed file. Line is 1-based and zero when the file as a whole is at fault; Field is empty when the defect does not belong to a single field. Severity is SeverityWarning for advisories and empty for errors.

func (Problem) String

func (p Problem) String() string

String renders the location as `[warning: ]file[:line][: field]: reason`.

type Problems

type Problems []Problem

Problems is a non-empty list of located defects. It implements error so a write path can refuse with it unchanged.

func (Problems) Error

func (ps Problems) Error() string

Jump to

Keyboard shortcuts

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