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 ¶
const ( ProjectFile = "project.yaml" ConfigFile = "config.yaml" CurrentStateFile = "state/current.yaml" MilestonesFile = "state/milestones.yaml" )
Managed metadata files, paths relative to .devsys/, slash-separated.
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.
const SupportedSchemaVersion = 1
SupportedSchemaVersion is the only schema_version this build understands.
Variables ¶
This section is empty.
Functions ¶
func Diagnose ¶
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 ¶
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 ¶
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.