2.4 KiB
Agent Guide
Guidance for anyone writing code in PureYAML.
Rule Loading
At the start of a session, read this file and the rules under docs/rules/ that
match the task. Confirm by replying with rules-loaded and name the files you
loaded.
For code changes, load at minimum:
docs/rules/code-style.mddocs/rules/namespacing.mddocs/rules/cross-platform.mddocs/rules/testing.mddocs/rules/verification.mddocs/rules/commits.mddocs/rules/research-compatibility.md
What PureYAML Is
PureYAML is a dependency-free YAML package written entirely in Swift.
The package must stay:
- pure Swift
- root Swift package layout, with
Package.swiftat repository root - dependency-free
- Linux-compatible
- WebAssembly/WASI-compatible
- namespaced under
PureYAML
The private PureYAMLResearch repo is for studying Yams and libyaml behavior.
Do not copy C code or upstream Yams source into this public package.
Keep attribution in ATTRIBUTION.md accurate when compatibility work references
Yams or CYaml behavior.
Compatibility work must start from that research source. Before changing parser, emitter, validation, or typed conversion behavior, inspect the matching PureYAMLResearch source or fixture and use it only to define behavior and tests.
Namespace Rules
Every public type lives under the PureYAML namespace tree and mirrors its
folder:
Sources/Model/Value.swiftdeclaresPureYAML.Model.ValueSources/Parsing/Parser.swiftdeclaresPureYAML.Parsing.ParserSources/Emitting/Dumper.swiftdeclaresPureYAML.Emitting.DumperSources/Validation/Validator.swiftdeclaresPureYAML.Validation.Validator
No top-level public concrete types except the root public enum PureYAML.
Dependency Rules
Package.swift must keep dependencies: [].
Do not add external packages, C targets, system libraries, Foundation-only workarounds, JavaScript tooling, or generated parser dependencies without an explicit maintainer decision.
Verification
Before claiming a change is complete, run and cite:
bash scripts/check-style.sh
bash scripts/check-namespacing.sh
bash scripts/check-forbidden-patterns.sh
bash scripts/check-changelog-touched.sh
swiftformat . --config .swiftformat --lint
swiftlint --config .swiftlint.yml --strict
swift build
swift test
bash scripts/check-linux.sh
bash scripts/check-wasm.sh
Enable local hooks:
git config core.hooksPath .githooks