config library
Config loading, discovery, path resolution, and ignore matching.
Classes
- DiscoveredClayConfig
-
Result of locating
clay.yamland 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
configis not compatible with Clay. -
collectClayConfigSearchPaths(
{required String startDir}) → List< String> -
Collects candidate
clay.yamlpaths when walking up fromstartDir. -
discoverClayConfig(
{String? configPath, String? cwd}) → DiscoveredClayConfig -
Discovers
clay.yamlusing an explicitconfigPathor walk-up fromcwd. -
expandIgnorePattern(
String pattern) → List< String> -
Expands a gitignore-style
patterninto glob patterns for matching. -
ignorePatternValidationError(
String pattern) → String? -
Returns an error message when
patternis invalid for ignore matching. -
isClayConfigCompatibleWithClay(
ClayConfig config) → bool -
Returns whether
configis compatible with the current Clay library version. -
loadClayConfig(
{required String configPath, ClayConfig parseConfigMapForTesting(Map< String, dynamic> map)?}) → Future<ClayConfig> -
Loads and parses
clay.yamlfromconfigPath. -
matchesIgnorePattern(
{required String relativePath, required String pattern}) → bool -
Returns whether
relativePathmatches a single gitignore-stylepattern. -
matchesIgnorePatterns(
{required String relativePath, required List< String> patterns}) → bool -
Returns whether
relativePathis excluded bypatterns. -
relativePathWithinRoot(
{required String rootDirectory, required String absolutePath}) → String? -
Returns the normalized path of
absolutePathrelative torootDirectory. -
resolvePathFromProjectRoot(
{required String projectRoot, required String path}) → String -
Resolves
pathrelative toprojectRoot, or returns the normalizedpathwhen 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
absolutePathunderrootDirectoryis excluded bypatterns. -
validateIgnorePatterns(
List< String> patterns) → void -
Validates
patternsfor ignore matching.
Exceptions / Errors
- ClayConfigException
-
Thrown when
clay.yamlcannot be loaded or parsed. - ClayConfigNotFoundException
-
Thrown when
clay.yamlcannot be discovered. - ClayIncompatibleException
-
Thrown when the running Clay version does not satisfy
environment.clay.