Documentation
¶
Overview ¶
Package config manages DevSpecs configuration: global home directory, repo-local .devspecs/config.yaml, and sensible defaults.
Index ¶
- Constants
- func DBPath() (string, error)
- func HomeDir() (string, error)
- func RepoConfigPath(repoRoot string) string
- func ValidateKind(kind string) error
- func ValidateRepoConfig(cfg *RepoConfig) error
- func ValidateSourceRules(rules []SourceRule) error
- func ValidateSubtype(kind, subtype string) error
- func WriteRepoConfig(repoRoot string, cfg *RepoConfig) error
- type ArtifactConfig
- type ExperimentConfig
- type RepoConfig
- func CloneRepoConfig(cfg *RepoConfig) *RepoConfig
- func DefaultRepoConfig() *RepoConfig
- func LoadRepoConfig(repoRoot string) (*RepoConfig, error)
- func WithCodeCommentArtifacts(cfg *RepoConfig, enabled bool) *RepoConfig
- func WithDefaultIntentCandidateDiscovery(cfg *RepoConfig, enabled bool) *RepoConfig
- func WithIntentCandidateDiscovery(cfg *RepoConfig, enabled bool) *RepoConfig
- func WithSupportDocDiscovery(cfg *RepoConfig, enabled bool) *RepoConfig
- func WithTestCaseArtifacts(cfg *RepoConfig, enabled bool) *RepoConfig
- type SourceConfig
- type SourceRule
Constants ¶
const ( KindPlan = "plan" KindSpec = "spec" KindRequirements = "requirements" KindDesign = "design" KindContract = "contract" KindDecision = "decision" KindMarkdownArtifact = "markdown_artifact" KindSourceContext = "source_context" )
Canonical artifact kinds (closed vocabulary).
const ( SubtypeADR = "adr" SubtypeOpenspecChange = "openspec_change" SubtypeOpenspecCollection = "openspec_collection" SubtypeOpenspecChangeBundle = "openspec_change_bundle" SubtypeOpenspecChild = "openspec_child" SubtypeOpenspecCapabilitySpec = "openspec_capability_spec" SubtypePRD = "prd" SubtypeAgentInstruction = "agent_instruction" SubtypeSkill = "skill" SubtypeMaintainerPolicy = "maintainer_policy" SubtypeOwnershipPolicy = "ownership_policy" SubtypeGovernancePolicy = "governance_policy" SubtypeContributionPolicy = "contribution_policy" SubtypeSecurityPolicy = "security_policy" SubtypeProcedure = "procedure" SubtypeRunbook = "runbook" SubtypeStandard = "standard" SubtypeAPIContract = "api_contract" SubtypeSchemaModel = "schema_model" SubtypeConfiguration = "configuration" SubtypeWorkflowDefinition = "workflow_definition" SubtypeDocumentTemplate = "document_template" SubtypePromptTemplate = "prompt_template" SubtypeIssueTemplate = "issue_template" SubtypePullRequestTemplate = "pull_request_template" SubtypeTestCase = "test_case" SubtypeCodeComment = "code_comment" )
Known subtypes per kind (empty subtype is always allowed).
Variables ¶
This section is empty.
Functions ¶
func HomeDir ¶
HomeDir returns the DevSpecs global directory (~/.devspecs or DEVSPECS_HOME override).
func RepoConfigPath ¶
RepoConfigPath returns the path to the repo config file for the given root.
func ValidateKind ¶
ValidateKind returns an error if kind is not in the closed vocabulary.
func ValidateRepoConfig ¶
func ValidateRepoConfig(cfg *RepoConfig) error
ValidateRepoConfig checks kinds in markdown source rules.
func ValidateSourceRules ¶
func ValidateSourceRules(rules []SourceRule) error
ValidateSourceRules checks source rule kinds and subtypes.
func ValidateSubtype ¶
ValidateSubtype returns an error if subtype is non-empty but not allowed for the given kind.
func WriteRepoConfig ¶
func WriteRepoConfig(repoRoot string, cfg *RepoConfig) error
WriteRepoConfig writes the config to .devspecs/config.yaml, creating the directory if needed.
Types ¶
type ArtifactConfig ¶ added in v0.1.0
type ArtifactConfig struct {
TestCases *bool `yaml:"test_cases,omitempty"`
CodeComments *bool `yaml:"code_comments,omitempty"`
}
ArtifactConfig holds canonical opt-in artifact sources that can be expensive or noisy on large repositories.
type ExperimentConfig ¶ added in v0.1.0
type ExperimentConfig struct {
IntentCandidateDiscovery *bool `yaml:"intent_candidate_discovery,omitempty"`
TestCaseArtifacts *bool `yaml:"test_case_artifacts,omitempty"`
SupportDocDiscovery *bool `yaml:"support_doc_discovery,omitempty"`
}
ExperimentConfig holds legacy opt-in scan/indexing experiments. New callers should prefer ArtifactConfig; these fields remain for config compatibility.
func (ExperimentConfig) IntentCandidateDiscoveryEnabled ¶ added in v0.1.0
func (e ExperimentConfig) IntentCandidateDiscoveryEnabled(defaultValue bool) bool
func (ExperimentConfig) SupportDocDiscoveryEnabled ¶ added in v0.1.0
func (e ExperimentConfig) SupportDocDiscoveryEnabled(defaultValue bool) bool
func (ExperimentConfig) TestCaseArtifactsEnabled ¶ added in v0.1.0
func (e ExperimentConfig) TestCaseArtifactsEnabled(defaultValue bool) bool
type RepoConfig ¶
type RepoConfig struct {
Version int `yaml:"version"`
Sources []SourceConfig `yaml:"sources"`
Artifacts ArtifactConfig `yaml:"artifacts,omitempty"`
Experiments ExperimentConfig `yaml:"experiments,omitempty"`
}
RepoConfig represents the .devspecs/config.yaml file in a repository.
func CloneRepoConfig ¶ added in v0.1.0
func CloneRepoConfig(cfg *RepoConfig) *RepoConfig
CloneRepoConfig returns a deep-enough copy for scan-time option mutation.
func DefaultRepoConfig ¶
func DefaultRepoConfig() *RepoConfig
DefaultRepoConfig returns sensible defaults per spec §10.
func LoadRepoConfig ¶
func LoadRepoConfig(repoRoot string) (*RepoConfig, error)
LoadRepoConfig reads and parses .devspecs/config.yaml from the given repo root. Returns nil, nil if the file does not exist.
func WithCodeCommentArtifacts ¶ added in v0.1.0
func WithCodeCommentArtifacts(cfg *RepoConfig, enabled bool) *RepoConfig
WithCodeCommentArtifacts returns a config copy with code-comment artifact indexing set.
func WithDefaultIntentCandidateDiscovery ¶ added in v0.1.0
func WithDefaultIntentCandidateDiscovery(cfg *RepoConfig, enabled bool) *RepoConfig
WithDefaultIntentCandidateDiscovery enables broad intent discovery only when the repo config did not explicitly opt in or out.
func WithIntentCandidateDiscovery ¶ added in v0.1.0
func WithIntentCandidateDiscovery(cfg *RepoConfig, enabled bool) *RepoConfig
WithIntentCandidateDiscovery returns a config copy with the intent candidate discovery experiment set. A nil input starts from the default repo config.
func WithSupportDocDiscovery ¶ added in v0.1.0
func WithSupportDocDiscovery(cfg *RepoConfig, enabled bool) *RepoConfig
WithSupportDocDiscovery returns a config copy with bounded support-doc discovery set.
func WithTestCaseArtifacts ¶ added in v0.1.0
func WithTestCaseArtifacts(cfg *RepoConfig, enabled bool) *RepoConfig
WithTestCaseArtifacts returns a config copy with test-case artifact indexing set.
func (RepoConfig) CodeCommentArtifactsEnabled ¶ added in v0.1.0
func (c RepoConfig) CodeCommentArtifactsEnabled(defaultValue bool) bool
func (RepoConfig) TestCaseArtifactsEnabled ¶ added in v0.1.0
func (c RepoConfig) TestCaseArtifactsEnabled(defaultValue bool) bool
type SourceConfig ¶
type SourceConfig struct {
Type string `yaml:"type"`
Path string `yaml:"path,omitempty"`
Paths []string `yaml:"paths,omitempty"`
Rules []SourceRule `yaml:"rules,omitempty"`
}
SourceConfig defines a source type and its discovery paths.