Skip to content

Validation Tools

Quick reference for choosing and running the right validation command.


Need to check annotation quality?
├─ Yes → lint-patterns
Need to check vitest-cucumber compatibility?
├─ Yes → lint-steps
Need FSM workflow validation?
├─ Yes → lint-process
Need cross-source or DoD validation?
├─ Yes → validate-patterns
Running pre-commit hook?
└─ lint-process --staged (default)
CommandPurposeWhen to Use
lint-patternsAnnotation qualityEnsure patterns have required tags
lint-stepsvitest-cucumber compatibilityAfter writing/modifying feature or step files
lint-processFSM workflow enforcementPre-commit hooks, CI pipelines
validate-patternsCross-source + DoD + anti-patternRelease validation, comprehensive

Validates @<prefix>-* annotation quality in TypeScript files.

Terminal window
# Basic usage
npx lint-patterns -i "src/**/*.ts"
# Strict mode (CI)
npx lint-patterns -i "src/**/*.ts" --strict
FlagShortDescriptionDefault
--input <pattern>-iGlob pattern (required, repeatable)required
--exclude <pattern>-eExclude pattern (repeatable)-
--base-dir <dir>-bBase directorycwd
--strictTreat warnings as errorsfalse
--format <type>-fOutput: pretty or jsonpretty
--quiet-qOnly show errorsfalse
--min-severity <level>error, warning, info-
RuleSeverityWhat It Checks
missing-pattern-nameerrorMust have @<prefix>-pattern
invalid-statuserrorStatus must be valid FSM value
tautological-descriptionerrorDescription cannot just repeat name
pattern-conflict-in-implementserrorPattern cannot implement itself (circular ref)
missing-relationship-targetwarningRelationship targets must reference known patterns
missing-statuswarningShould have status tag
missing-when-to-usewarningShould have “When to Use” section
missing-relationshipsinfoConsider adding uses/used-by

Static analyzer for vitest-cucumber feature/step compatibility. Catches mismatches that cause cryptic runtime failures.

Terminal window
# Standard check
pnpm lint:steps
# Strict mode (CI)
pnpm lint:steps --strict

What it validates:

  • Feature file syntax traps (# in descriptions, keywords in descriptions, duplicate And steps)
  • Step definition anti-patterns (regex patterns, {phrase} usage, repeated registrations)
  • Cross-file mismatches (ScenarioOutline param pattern, missing And/Rule destructuring)

12 rules across 3 categories (8 error, 4 warning).

Detailed rules and examples: See GHERKIN-PATTERNS.md — Step Linting


FSM validation for delivery workflow (PDR-005). Enforces status transitions and protection levels.

Terminal window
# Pre-commit (default)
npx lint-process --staged
# CI pipeline
npx lint-process --all --strict

What it validates:

  • Status transitions follow FSM (roadmap -> active -> completed)
  • Completed specs require unlock reason to modify
  • Active specs cannot add new deliverables (scope protection)
  • Session scope rules (optional)

Detailed rules and escape hatches: See PROCESS-GUARD.md


Cross-source validator combining multiple checks.

Terminal window
# Full validation suite
npx validate-patterns \
-i "src/**/*.ts" \
-F "specs/**/*.feature" \
--dod \
--anti-patterns
FlagShortDescriptionDefault
--input-iGlob for TypeScript files (required, repeatable)required
--features-FGlob for Gherkin files (required, repeatable)required
--exclude-eExclude pattern (repeatable)-
--base-dir-bBase directorycwd
--strictTreat warnings as errors (exit 2)false
--verboseShow info-level messagesfalse
--format-fOutput: pretty or jsonpretty
--dodEnable Definition of Done validationfalse
--phaseValidate specific phase (repeatable)-
--anti-patternsEnable anti-pattern detectionfalse
--scenario-thresholdMax scenarios per feature30
--mega-feature-thresholdMax lines per feature750
--magic-comment-thresholdMax magic comments5
FlagWhat It Validates
(always runs)Cross-source Feature/TypeScript consistency
--dodCompleted patterns have all deliverables done
--anti-patternsDual-source ownership rules not violated

Cross-source validation now consumes the MasterDataset via the shared pipeline factory (buildMasterDataset()) with mergeConflictStrategy: 'concatenate'. This enables implements-aware matching through relationshipIndex.implementedBy — the validator no longer re-derives cross-source relationships from raw scanner output.

Raw scans are retained only for DoD and anti-pattern detection, which are stage-1 consumers that validate annotation syntax directly on scanned files (no relationship resolution needed).

Detects process metadata tags that belong in feature files but appear in TypeScript code (process-in-code):

Tag Suffix (Feature-Only)What It Tracks
@<prefix>-quarterTimeline metadata
@<prefix>-teamOwnership metadata
@<prefix>-effortEstimation metadata
@<prefix>-effort-actualActual effort
@<prefix>-workflowWorkflow metadata
@<prefix>-completedCompletion timestamp

Additional anti-pattern checks:

IDSeverityWhat It Detects
process-in-codeerrorFeature-only tags found in TS code
magic-commentswarningGenerator hints in feature files
scenario-bloatwarningToo many scenarios per feature file
mega-featurewarningFeature file exceeds line threshold

For patterns with completed status, checks:

  • All deliverables are in a terminal state (complete, n/a, or superseded)
  • At least one @acceptance-criteria scenario exists in the spec

Add these scripts to your project’s package.json:

{
"scripts": {
"lint:patterns": "lint-patterns -i 'src/**/*.ts'",
"lint:steps": "lint-steps",
"lint:steps:ci": "lint-steps --strict",
"lint:process": "lint-process --staged",
"lint:process:ci": "lint-process --all --strict",
"validate:all": "validate-patterns -i 'src/**/*.ts' -F 'specs/**/*.feature' --dod --anti-patterns"
}
}
.husky/pre-commit
npx lint-process --staged
- name: Lint annotations
run: npx lint-patterns -i "src/**/*.ts" --strict
- name: Lint steps
run: npx lint-steps --strict
- name: Validate patterns
run: npx validate-patterns -i "src/**/*.ts" -F "specs/**/*.feature" --dod --anti-patterns

Codelint-patterns / lint-steps / lint-processvalidate-patterns
0No errors (warnings allowed unless --strict)No issues found
1Errors found (or warnings with --strict)Errors found
2Warnings found (with --strict only)

All validation tools expose programmatic APIs. Import from subpaths:

// Pattern linting
import { lintFiles, hasFailures } from '@libar-dev/delivery-process/lint';
// Step linting
import { runStepLint, STEP_LINT_RULES } from '@libar-dev/delivery-process/lint';
// Process guard
import { deriveProcessState, validateChanges } from '@libar-dev/delivery-process/lint';
// Anti-patterns and DoD
import { detectAntiPatterns, validateDoD } from '@libar-dev/delivery-process/validation';

validatePatterns() now accepts a RuntimeMasterDataset. Build one via buildMasterDataset() from @libar-dev/delivery-process/generators.

See ARCHITECTURE.md for detailed API documentation.


DocumentContent
GHERKIN-PATTERNS.mdStep linting rules, examples, and CLI
PROCESS-GUARD.mdFSM rules, error fixes, escapes
TAXONOMY.mdTag taxonomy concepts and API
ARCHITECTURE.mdProgrammatic API details