facets.yaml and facets.lock).
loadManifest(path)
Loads and validates a facet.yaml manifest from disk. Three-phase process: read file, parse YAML, validate with Zod.
| Parameter | Type | Description |
|---|---|---|
manifestPath | string | Absolute path to a facet.yaml file |
Promise<LoadManifestResult>
Config file functions
readFacetsYaml(projectRoot)
Reads and parses .opencode/facets.yaml. Returns a default empty object if the file doesn’t exist or is invalid.
writeFacetsYaml(projectRoot, data)
Writes facets.yaml back to disk, serializing the data as YAML.
readFacetsLock(projectRoot)
Reads and parses .opencode/facets.lock. Returns a default empty object if the file doesn’t exist.
writeFacetsLock(projectRoot, data)
Writes facets.lock back to disk.
Schemas
All schemas are defined with Zod v4 and exported for reuse:FacetManifestSchema
Validates a single facet’s facet.yaml. See Manifest Reference for the full field list.
FacetsYamlSchema
Validates the project-level facets.yaml:
FacetsLockSchema
Validates the lock file facets.lock:
Helper functions
normalizeRequires(requires)
Normalizes a requires field (string, string array, or undefined) to always return a string[].
resolvePromptPath(prompt)
Resolves a prompt field to a local file path. Returns null for URL-based prompts.