config library

Config loading, discovery, path resolution, and ignore matching.

Classes

DiscoveredClayConfig
Result of locating clay.yaml and its project root.

Constants

clayConfigFileName → const String
Filename for the Clay project config at the project root.

Functions

assertClayCompatible(ClayConfig config) → void
Throws ClayIncompatibleException when config is not compatible with Clay.
collectClayConfigSearchPaths({required String startDir}) → List<String>
Collects candidate clay.yaml paths when walking up from startDir.
discoverClayConfig({String? configPath, String? cwd}) → DiscoveredClayConfig
Discovers clay.yaml using an explicit configPath or walk-up from cwd.
expandIgnorePattern(String pattern) → List<String>
Expands a gitignore-style pattern into glob patterns for matching.
ignorePatternValidationError(String pattern) → String?
Returns an error message when pattern is invalid for ignore matching.
isClayConfigCompatibleWithClay(ClayConfig config) → bool
Returns whether config is compatible with the current Clay library version.
loadClayConfig({required String configPath, ClayConfig parseConfigMapForTesting(Map<String, dynamic> map)?}) → Future<ClayConfig>
Loads and parses clay.yaml from configPath.
matchesIgnorePattern({required String relativePath, required String pattern}) → bool
Returns whether relativePath matches a single gitignore-style pattern.
matchesIgnorePatterns({required String relativePath, required List<String> patterns}) → bool
Returns whether relativePath is excluded by patterns.
relativePathWithinRoot({required String rootDirectory, required String absolutePath}) → String?
Returns the normalized path of absolutePath relative to rootDirectory.
resolvePathFromProjectRoot({required String projectRoot, required String path}) → String
Resolves path relative to projectRoot, or returns the normalized path when it is absolute.
resolveReferencePath({required String projectRoot, required ClayConfig config, String? cliOverride}) → String
Resolves the reference directory path.
resolveTargetPath({required String projectRoot, required ClayConfig config, String? cliOverride}) → String
Resolves the target directory path.
shouldIgnoreAtRoot({required String rootDirectory, required String absolutePath, required List<String> patterns}) → bool
Returns whether absolutePath under rootDirectory is excluded by patterns.
validateIgnorePatterns(List<String> patterns) → void
Validates patterns for ignore matching.

Exceptions / Errors

ClayConfigException
Thrown when clay.yaml cannot be loaded or parsed.
ClayConfigNotFoundException
Thrown when clay.yaml cannot be discovered.
ClayIncompatibleException
Thrown when the running Clay version does not satisfy environment.clay.