config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config는 위키별 설정 파일(engram.yaml)을 읽어 프론트매터 속성, 임계값, 디렉토리 매핑이 확정된 구성을 반환한다.

병합 순서는 기본값, 프리셋, 파일이다. 파일에 없는 키는 기본값이 남는다. 설정 파일이 없는 것은 에러가 아니며 기본값으로 동작한다.

Index

Constants

View Source
const (
	DefaultBridgeWordMin  = 0.30
	DefaultBridgeEmbedMin = 0.72
)

bridge 하한 기본값이다. 단어 축 0.30 은 ADR 0028 이후 쓰던 값이다. 임베딩 축 0.72 는 upstream 실측값에서 출발했다(ADR 0075). 토크나이저가 달라 단어 축을 upstream 값 0.18 로 옮기지 않았다.

View Source
const ConfigFileName = "engram.yaml"

ConfigFileName은 위키 루트에 두는 설정 파일 이름이다. ADR 0017.

View Source
const DefaultPreset = PresetPersonal

DefaultPreset은 프리셋을 지정하지 않았을 때의 기본값이다.

Variables

This section is empty.

Functions

This section is empty.

Types

type Axis

type Axis string

Axis는 프론트매터 스키마의 속성이다. 한국어 표기는 "속성"이고 코드 식별자와 engram.yaml 키는 axis, axes 로 남는다. ADR 0048.

const (
	AxisType           Axis = "type"
	AxisArtifactStage  Axis = "artifact_stage"
	AxisStatus         Axis = "status"
	AxisIndexable      Axis = "indexable"
	AxisTags           Axis = "tags"
	AxisSourceRefs     Axis = "source_refs"
	AxisDerivedFrom    Axis = "derived_from"
	AxisRelated        Axis = "related"
	AxisSourceChannel  Axis = "source_channel"
	AxisDerivedContext Axis = "derived_context"
	AxisScope          Axis = "scope"
	AxisSensitivity    Axis = "sensitivity"
	AxisTriggerMode    Axis = "trigger_mode"
	AxisWorkflow       Axis = "workflow"
)

type ClosedSet

type ClosedSet struct {
	Values []string
}

ClosedSet은 미정의 값이 오류인 값 집합이다.

type Config

type Config struct {
	Preset     Preset
	Axes       map[Axis]bool
	Schema     Schema
	Thresholds Thresholds
	PageDirs   []string
	RootFiles  []string
	// IgnoreFiles는 page_dirs 아래 어느 깊이에 있든 문서가 아닌 파일로
	// 순회에서 빼는 파일명이다. ADR 0036.
	IgnoreFiles []string
	// DeprecatedFields는 이 위키가 폐기한 프론트매터 키다. 목록에 있는
	// 키가 문서에 있으면 lint 가 error 로 잡는다. 폐기 목록은 위키마다
	// 다르므로 기본값은 빈 목록이다. ADR 0071.
	DeprecatedFields []string
	// UnknownKeys는 설정 파일에 있었지만 스키마가 모르는 키다.
	// 오타를 조용히 삼키지 않기 위해 호출자에게 넘긴다.
	UnknownKeys []string
	// Origins는 키별 값 출처다. 속성 키는 "axes.<속성 이름>" 형태다.
	Origins map[string]Origin
}

Config는 한 위키의 확정된 구성이다.

func Load

func Load(wikiRoot string) (Config, error)

Load는 위키 루트의 engram.yaml을 읽어 구성을 반환한다. 파일이 없으면 기본값으로 동작한다.

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile은 설정 파일 하나를 읽어 구성을 반환한다.

type DateField

type DateField struct {
	Name    string
	Layouts []string
}

DateField는 날짜 필드 하나의 허용 형식이다. Layouts는 time.Parse 레이아웃이다.

type DateFields

type DateFields struct {
	Created   DateField
	SourcedAt DateField
	Updated   DateField
}

DateFields는 날짜 필드 셋이다. created는 정확도를 모르는 자료를 위해 연월 형식을 함께 허용한다. ADR 0009.

type OpenSet

type OpenSet struct {
	Values []string
}

OpenSet은 미정의 값이 경고인 값 집합이다.

type Origin

type Origin string

Origin은 설정 값의 출처다. config list --origin이 이 값을 출력한다.

const (
	OriginDefault Origin = "default"
	OriginPreset  Origin = "preset"
	OriginFile    Origin = "file"
)

type Preset

type Preset string

Preset은 프론트매터 속성의 시작점이 되는 프리셋이다. 포함 관계는 minimal이 personal에, personal이 team에 포함된다. ADR 0009, 0048.

const (
	PresetMinimal  Preset = "minimal"
	PresetPersonal Preset = "personal"
	PresetTeam     Preset = "team"
)

type Schema

type Schema struct {
	Types          []string
	ArtifactStages ClosedSet
	Statuses       ClosedSet
	Scopes         ClosedSet
	Sensitivities  ClosedSet
	TriggerModes   ClosedSet
	Dates          DateFields
	Taxonomy       Taxonomy
}

Schema는 lint가 문서 필드 값을 대조할 허용값 집합이다. source_channel과 workflow는 개방 집합이라 여기 담지 않는다.

type Taxonomy

type Taxonomy struct {
	Topics OpenSet
	Forms  ClosedSet
}

Taxonomy는 주제와 문서 형태 두 facet을 담는다. 미정의 값의 판정이 경고냐 오류냐로 갈리므로 서로 다른 타입으로 구분한다. 판정은 lint가 한다.

type Thresholds

type Thresholds struct {
	MinWikilinks   int
	StaleDays      int
	MaxLines       int
	BroadTopicPct  int
	BridgeWordMin  float64
	BridgeEmbedMin float64
}

Thresholds는 게이트와 경고의 임계값이다. min_wikilinks만 승급 거절 사유이고 나머지는 경고에 쓰인다. bridge 하한 둘은 코사인 유사도의 축별 값으로 단어 축과 임베딩 축이 눈금이 다르므로 따로 둔다(ADR 0075).

Jump to

Keyboard shortcuts

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