Skip to content

Delivery Process Methodology

Git is the event store. Documentation artifacts are projections. Annotated code is the single source of truth.

This document explains the why behind @libar-dev/delivery-process. For how, see README.md and TAXONOMY.md.


Traditional documentation fails because it exists outside the code. Developers update code, forget to update docs, and the gap widens until docs become fiction.

The USDP (Unified Software Delivery Process) inverts this:

Traditional ApproachUSDP Approach
Docs are writtenDocs are generated
Status is tracked manuallyStatus is FSM-enforced
Requirements live in JiraRequirements are Gherkin scenarios
AI agents parse stale MarkdownAI agents query typed APIs

Event sourcing teaches us: derive state, don’t store it. Apply this to documentation:

  • Events = Git commits (changes to annotated code)
  • Projections = Generated docs (PATTERNS.md, ROADMAP.md)
  • Read Model = MasterDataset (consumed by codecs, validators, and Data API CLI)

When you run generate-docs, you’re rebuilding read models from the event stream. The source annotations are always authoritative.


Every pattern in this package uses its own annotation system. Real examples:

Document Extractor (pattern extraction):

/**
* @libar-docs
* @libar-docs-pattern Document Extractor
* @libar-docs-status completed
* @libar-docs-uses Pattern Scanner, Tag Registry, Zod
* @libar-docs-used-by Orchestrator, Generators
*/
export function extractPatterns(
scannedFiles: readonly ScannedFile[], baseDir: string, registry?: TagRegistry
): ExtractionResults { ... }

Pattern Scanner (file discovery):

/**
* @libar-docs
* @libar-docs-pattern Pattern Scanner
* @libar-docs-status completed
* @libar-docs-uses glob, AST Parser
* @libar-docs-used-by Doc Extractor, Orchestrator
*/
export async function scanPatterns(
config: ScannerConfig, registry?: TagRegistry
): Promise<Result<ScanResults, never>> { ... }

Run pnpm docs:patterns and these annotations become a searchable pattern registry with dependency graphs.


SessionInputOutputFSM State
PlanningPattern briefRoadmap spec (.feature)Creates roadmap
DesignComplex requirementDecision specs + code stubsNone
ImplementationRoadmap specCode + testsroadmapactivecompleted
Planning + DesignPattern briefSpec + stubsCreates roadmap

When to skip sessions:

SkipWhen
DesignSingle valid approach, straightforward implementation
Planning + DesignReady to code, clear scope, no decisions
NeitherMulti-session work, architectural decisions

Split-Ownership Principle: Feature files own what and when (planning). Code stubs own how and with what (implementation). Neither duplicates the other.

TagPurpose
@<prefix>-statusFSM state (roadmap, active, completed, deferred)
@<prefix>-phaseMilestone sequencing
@<prefix>-depends-onPattern-level roadmap dependencies
@<prefix>-enablesWhat this unblocks
@<prefix>-releaseVersion targeting
TagPurpose
@<prefix>-usesTechnical dependencies (what this calls)
@<prefix>-used-byTechnical consumers (what calls this)
@<prefix>-usecaseWhen/how to use
Category flagsDomain classification (core, api, infra, etc.)

Feature file (specs/my-pattern.feature):

@libar-docs
@libar-docs-pattern:EventStoreDurability
@libar-docs-status:roadmap
@libar-docs-phase:18
@libar-docs-depends-on:EventStoreFoundation
@libar-docs-enables:SagaEngine
Feature: Event Store Durability

Code stub (src/event-store/durability.ts):

/**
* @libar-docs
* @libar-docs-status roadmap
* @libar-docs-event-sourcing
* @libar-docs-uses EventStoreFoundation, Workpool
* @libar-docs-used-by SagaEngine, CommandOrchestrator
*/

Note: Code stubs must NOT use @<prefix>-pattern. The feature file is the canonical pattern definition.


TierLocationPurposeExecutable
Roadmapdelivery-process/specs/Planning, deliverables, acceptance criteriaNo
Package{pkg}/tests/features/Implementation proof, regression testingYes

Traceability:

  • Roadmap spec: @<prefix>-executable-specs:{package}/tests/features/behavior/{feature}
  • Package spec: @<prefix>-implements:{PatternName}

This separation keeps test output clean (no roadmap noise) while maintaining bidirectional traceability.


Code is the source of truth. Feature files reference code, not duplicate it.

/**
* @libar-docs
* @libar-docs-status roadmap
*
* ## Reservation Pattern - TTL-Based Pre-Creation Uniqueness
*/
export function reserve(ctx: MutationCtx, args: ReserveArgs): Promise<ReservationResult> {
throw new Error('ReservationPattern not yet implemented - roadmap pattern');
}
LevelContainsWhen
MinimalJSDoc annotations onlyQuick exploration
InterfaceTypes + stub functionsAPI contracts
PartialWorking code + some stubsProgressive implementation

Two types of stubs serve different purposes and live in different locations:

Design session code stubs define API shapes with throw new Error("Not implemented"). They live outside src/ to avoid TypeScript compilation and ESLint issues:

delivery-process/
├── stubs/ # Design session code stubs (not compiled)
│ └── {pattern-name}/ # One directory per pattern
│ └── *.ts # API shapes, interfaces, throw-not-implemented
├── specs/ # Tier 1 roadmap specs
└── ...
PhaseLocationStatus
Designdelivery-process/stubs/{pattern}/throw new Error("Not implemented")
ImplementationMove/copy to src/Replace with real logic
Completedsrc/Production code

Stubs are scanned by the documentation pipeline (via -i 'delivery-process/stubs/**/*.ts') but excluded from TypeScript compilation (tsconfig.json includes only src/**/*) and ESLint (eslint targets src tests).

Planning Stubs (Test Step Definition Stubs)

Section titled “Planning Stubs (Test Step Definition Stubs)”

Step definitions created during Planning sessions go in a separate directory excluded from test execution:

tests/
├── steps/ # Executable (included in test runner)
├── planning-stubs/ # Not yet implemented (excluded)
└── features/ # Feature files
PhaseLocationStatus
Planningplanning-stubs/throw new Error("Not implemented")
ImplementationMove to steps/Replace with real logic
Completedsteps/Fully executable

This avoids .skip() (forbidden by test safety policy) while preserving planning artifacts.


DocumentPurpose
README.mdQuick start, FSM diagram, Data API CLI usage
PROCESS-GUARD.mdFSM validation rules, protection levels, CLI
CONFIGURATION.mdTag prefixes, presets, customization
GHERKIN-PATTERNS.mdWriting effective specs
TAXONOMY.mdTag taxonomy concepts and API