Purpose: Configuration product area overview
Detail Level: Full reference
How do I configure the tool? Configuration is the entry boundary — it transforms a user-authored delivery-process.config.ts file into a fully resolved DeliveryProcessInstance that powers the entire pipeline. The flow is: defineConfig() provides type-safe authoring (Vite convention, zero validation), ConfigLoader discovers and loads the file, ProjectConfigSchema validates via Zod, ConfigResolver applies defaults and merges stubs into sources, and DeliveryProcessFactory builds the final instance with TagRegistry and RegexBuilders. Three presets define escalating taxonomy complexity — from 3 categories (generic, libar-generic) to 21 (ddd-es-cqrs). SourceMerger computes per-generator source overrides, enabling generators like changelog to pull from different feature sets than the base config.
Preset-based taxonomy: generic (3 categories, @docs-), libar-generic (3 categories, @libar-docs-), ddd-es-cqrs (21 categories, full DDD). Presets replace base categories entirely — they define prefix, categories, and metadata tags as a unit
Resolution pipeline: defineConfig() → ConfigLoader → ProjectConfigSchema (Zod) → ConfigResolver → DeliveryProcessFactory → DeliveryProcessInstance. Each stage has a single responsibility
Stubs merged at resolution time: Stub directory globs are appended to typescript sources, making stubs transparent to the downstream pipeline
Source override composition: SourceMerger applies per-generator overrides (replaceFeatures, additionalFeatures, additionalInput) to base sources. Exclude is always inherited from base
Tag prefix for directives (e.g., “@docs-” or “@libar-docs-”)
fileOptInTag
File-level opt-in tag (e.g., “@docs” or “@libar-docs”)
categories
Category definitions for pattern classification
metadataTags
Optional metadata tag definitions
contextInferenceRules
Optional context inference rules for auto-inferring bounded context from file paths. When provided, these rules are merged with the default rules. User-provided rules take precedence over defaults (applied first in the rule list). typescript contextInferenceRules: [ { pattern: 'packages/orders/**', context: 'orders' }, { pattern: 'packages/inventory/**', context: 'inventory' }, ]
Default generator names to run when CLI doesn’t specify —generators
generatorOverrides
Per-generator source and output overrides
contextInferenceRules
Rules for auto-inferring bounded context from file paths
workflowPath
Path to custom workflow config JSON (relative to config file)
codecOptions
Per-codec options for fine-tuning document generation. Keys match codec names (e.g., ‘business-rules’, ‘patterns’). Passed through to codec factories at generation time.
referenceDocConfigs
Reference document configurations for convention-based doc generation. Each config defines one reference document’s content composition via convention tags, shape sources, behavior categories, and diagram scopes. When not specified, no reference generators are registered. Import LIBAR_REFERENCE_CONFIGS from the generators module to use the built-in set.
* Centralizes what previously lived in CLI --input/--features flags.
*/
interface SourcesConfig {
/** Glob patterns for TypeScript source files (replaces --input) */
readonly typescript:readonly string[];
/**
* Glob patterns for Gherkin feature files (replaces --features).
* Includes both `.feature` and `.feature.md` files.
*/
readonly features?:readonly string[];
/**
* Glob patterns for design stub files.
* Stubs are TypeScript files that live outside `src/` (e.g., `delivery-process/stubs/`).
* Merged into TypeScript sources at resolution time.
*/
readonly stubs?:readonly string[];
/** Glob patterns to exclude from all scanning */
readonly exclude?:readonly string[];
}
Property
Description
typescript
Glob patterns for TypeScript source files (replaces —input)
features
Glob patterns for Gherkin feature files (replaces —features). Includes both .feature and .feature.md files.
stubs
Glob patterns for design stub files. Stubs are TypeScript files that live outside src/ (e.g., delivery-process/stubs/). Merged into TypeScript sources at resolution time.
loadDefaultWorkflow() returns a LoadedWorkflow without file system access. It cannot fail. The default workflow constant uses only canonical status values from src/taxonomy/status-values.ts.
The file-based loading path (catalogue/workflows/) has been dead code since monorepo extraction. Both callers (orchestrator, process-api) already handle the failure gracefully, proving the system works without it. Making the function synchronous and infallible removes the try-catch ceremony and the warning noise.
Custom workflow files still work via —workflow flag
loadWorkflowFromPath() remains available for projects that need custom workflow definitions. The --workflow <file> CLI flag and workflowPath config field continue to work.
The inline default replaces file-based default loading, not file-based custom loading. Projects may define custom phases or additional statuses via JSON files.
FSM validation and Process Guard are not affected
The FSM transition matrix, protection levels, and Process Guard rules remain hardcoded in src/validation/fsm/ and src/lint/process-guard/. They do not read from LoadedWorkflow.
FSM and workflow are separate concerns. FSM enforces status transitions (4-state model from PDR-005). Workflow defines phase structure (6-phase USDP). The workflow JSON declared transitionsTo on its statuses, but no code ever read those values — the FSM uses its own VALID_TRANSITIONS constant. This separation is correct and intentional. Blast radius analysis confirmed zero workflow imports in: - src/validation/fsm/ (4 files) - src/lint/process-guard/ (5 files) - src/taxonomy/ (all files)
Workflow as a configurable preset field is deferred
The inline default workflow constant is the only workflow source until preset integration is implemented. No preset or project config field exposes workflow customization.
Coupling workflow into the preset/config system before the inline fix ships would widen the blast radius and risk type regressions across all config consumers. Adding workflow as a field on DeliveryProcessConfig (presets) and DeliveryProcessProjectConfig (project config) is a natural next step but NOT required for the MVP fix. The inline constant in workflow-loader.ts resolves the warning. Moving workflow into the preset/config system enables: - Different presets with different default phases (e.g., 3-phase generic) - Per-project phase customization in delivery-process.config.ts - Phase definitions appearing in generated documentation See ideation artifact for design options: delivery-process/ideations/2026-02-15-workflow-config-and-fsm-extensibility.feature
Config files are discovered by walking up directories
The config loader must search for configuration files starting from the current directory and walking up parent directories until a match is found or the filesystem root is reached.
Projects may run CLI commands from subdirectories — upward traversal ensures the nearest config file is always found regardless of working directory.
Config discovery stops at repo root
Directory traversal must stop at repository root markers (e.g., .git directory) and not search beyond them.
Searching beyond the repo root could find unrelated config files from parent projects, producing confusing cross-project behavior.
Config is loaded and validated
Loaded config files must have a valid default export matching the expected configuration schema, with appropriate error messages for invalid formats.
Invalid configurations produce cryptic downstream errors — early validation with clear messages prevents debugging wasted on malformed config.
Config errors are formatted for display
Configuration loading errors must be formatted as human-readable messages including the file path and specific error description.
Raw error objects are not actionable — developers need the config file path and a clear description to diagnose and fix configuration issues.
Factory creates configured instances with correct defaults
The configuration factory must produce a fully initialized instance for any supported preset, with the libar-generic preset as the default when no arguments are provided.
A sensible default preset eliminates boilerplate for the common case while still supporting specialized presets (ddd-es-cqrs) for advanced monorepo configurations.
Custom prefix configuration works correctly
Custom tag prefix and file opt-in tag overrides must be applied to the configuration instance, replacing the preset defaults.
Consuming projects may use different annotation prefixes — custom prefixes enable the toolkit to work with any tag convention without forking presets.
Preset categories replace base categories entirely
When a preset defines its own category set, it must fully replace (not merge with) the base categories.
Category sets are curated per-preset — merging would include irrelevant categories (e.g., DDD categories in a generic project) that pollute taxonomy reports.
Regex builders use configured prefix
All regex builders (hasFileOptIn, hasDocDirectives, normalizeTag) must use the configured tag prefix, not a hardcoded one.
Regex patterns that ignore the configured prefix would miss annotations in projects using custom prefixes, silently skipping source files.
The defineConfig helper must return its input unchanged, serving only as a type annotation aid for IDE autocomplete.
defineConfig exists for TypeScript type inference in config files — any transformation would surprise users who expect their config object to pass through unmodified.
Schema validates correct configurations
Valid configuration objects (both minimal and fully-specified) must pass schema validation without errors.
The schema must accept all legitimate configuration shapes — rejecting valid configs would block users from using supported features.
Schema rejects invalid configurations
The configuration schema must reject invalid values including empty globs, directory traversal patterns, mutually exclusive options, invalid preset names, and unknown fields.
Schema validation is the first line of defense against misconfiguration — permissive validation lets invalid configs produce confusing downstream errors.
Type guards distinguish config formats
The isProjectConfig and isLegacyInstance type guards must correctly distinguish between new-style project configs and legacy configuration instances.
The codebase supports both config formats during migration — incorrect type detection would apply the wrong loading path and produce runtime errors.
When no source overrides are provided, the merged result must be identical to the base source configuration.
The merge function must be safe to call unconditionally — returning modified results without overrides would corrupt default source paths.
Feature overrides control feature source selection
additionalFeatures must append to base feature sources while replaceFeatures must completely replace them, and these two options are mutually exclusive.
Projects need both additive and replacement strategies — additive for extending (monorepo packages), replacement for narrowing (focused generation runs).