Skip to content

Annotation Reference Guide

Purpose: Reference document: Annotation Reference Guide Detail Level: Full reference


Every file that participates in the annotation system must have a @libar-docs opt-in marker. Files without this marker are invisible to the scanner.

TypeScript — file-level JSDoc block:

/**
* @libar-docs
* @libar-docs-pattern MyPattern
* @libar-docs-status roadmap
* @libar-docs-uses EventStore, CommandBus
*
* ## My Pattern - Description
*/

Gherkin — file-level tags before Feature::

@libar-docs
@libar-docs-pattern:MyPattern
@libar-docs-status:roadmap
@libar-docs-phase:14
Feature: My Pattern
**Problem:**
Description of the problem.
PresetPrefixCategoriesUse Case
libar-generic (default)@libar-docs-3Simple projects
ddd-es-cqrs@libar-docs-21DDD/Event Sourcing monorepos
generic@docs-3Simple projects, short prefix
SourceOwnsExample Tags
TypeScriptImplementation: runtime deps, category, shapesuses, used-by, extract-shapes, shape
GherkinPlanning: status, phase, timeline, dependenciesstatus, phase, depends-on, quarter

Shape extraction pulls TypeScript type definitions (interfaces, type aliases, enums, functions, consts) into generated documentation. There are three modes:

List specific declaration names in the file-level JSDoc:

/**
* @libar-docs
* @libar-docs-extract-shapes MasterDatasetSchema, StatusGroupsSchema
*/

Names appear in the generated output in the order listed.

/**
* @libar-docs
* @libar-docs-extract-shapes *
*/

Wildcard must be the sole value — *, Foo is invalid.

Tag individual declarations with @libar-docs-shape, optionally with a group name:

/** @libar-docs-shape api-types */
export interface CommandInput {
readonly aggregateId: string;
readonly payload: unknown;
}

The optional group name (api-types) enables filtering in diagram scopes and product area documents via @libar-docs-include.


For Zod files, extract the schema constant (with Schema suffix), not the inferred type alias:

Wrong (type alias)Correct (schema constant)
@extract-shapes MasterDataset@extract-shapes MasterDatasetSchema
Shows: z.infer<typeof ...> (unhelpful)Shows: z.object({...}) (full structure)

Terminal window
# Tag usage inventory (counts per tag and value)
pnpm process:query -- tags
# Find files missing @libar-docs opt-in marker
pnpm process:query -- unannotated --path src/types
# File inventory by type (TS, Gherkin, Stubs)
pnpm process:query -- sources
# Full pattern JSON including extractedShapes
pnpm process:query -- query getPattern MyPattern
# Generate complete tag reference
npx generate-tag-taxonomy -o TAG_TAXONOMY.md -f

SymptomCauseFix
Pattern not in scanner outputMissing @libar-docs opt-in markerAdd file-level @libar-docs JSDoc/tag
Shape shows z.infer<> wrapperExtracted type alias, not schemaUse schema constant name (e.g., FooSchema)
Shape not in product area docMissing @libar-docs-product-areaAdd product-area tag to file-level annotation
Declaration-level shape missingNo @libar-docs-shape on declAdd @libar-docs-shape JSDoc to the declaration
Tag value rejectedWrong format or invalid enum valueCheck format type in taxonomy reference
Anti-pattern validation errorTag on wrong source typeMove tag to correct source (TS vs Gherkin)