🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@formtrieb/cdf-core

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formtrieb/cdf-core

Core library for the Component Description Format (CDF) — parsing, validation, profile inference, token-tree, and analysis primitives. Pure functions, framework-agnostic.

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
6
-77.78%
Maintainers
1
Weekly downloads
 
Created
Source

@formtrieb/cdf-core

Core library for the Component Description Format (CDF) — parsing, validation, profile inference, token-tree, and analysis primitives.

This package is framework-agnostic: pure TypeScript functions that take parsed YAML or JSON input and return typed results. It has no I/O of its own beyond optional file-reading helpers, no MCP layer, no skill-runtime assumptions. It is the substrate that both the @formtrieb/cdf-mcp adapter and the reference Angular generator consume.

Status

v1.0.1 — 2026-04-26. First usable public release (v1.0.0 was a no-op publish, see CHANGELOG.md). CDF spec v1.0.0 is frozen (Component / Profile / Target / Architecture, validated against Radix, shadcn, Primer, Material 3, USWDS). The library has shipped under workspace:* inside the Formtrieb monorepo for ~6 weeks; this version strips the monorepo-internal coupling and re-publishes it as a standalone npm package.

License: Apache-2.0.

Install

npm install @formtrieb/cdf-core
# or pnpm
pnpm add @formtrieb/cdf-core

Requires Node ≥ 20.

What's inside

SurfaceSymbolsPurpose
ParsingparseCDF, parseCDFFile, parseConfig, parseConfigFile, parseProfile, parseProfileFileRead and type-check CDF Component / Config / Profile YAML files. Returns typed CDFComponent / CDFConfig / CDFProfile.
Validationvalidate, validateFile, validateAll, validateProfile, validateProfileFileRun the CDF v1.0.0 rule set (≥30 rules across structural, semantic, vocabulary, theming, token-reference). Returns structured Issue[] with severity.
ResolutionresolveInheritance, resolveExtension, expandTokenPathResolve component inheritance (extends:, inherits:), token-path placeholders, profile-extends merge.
AnalysisanalyzeCoverage, analyzeComponentCoverage, suggestImprovements, detectVocabDivergencesCoverage report (which Profile vocabularies / grammars are unused), Component-level coverage delta, suggestion generator, vocab-near-miss detection (Levenshtein ≤2).
Profile scaffoldingscaffoldProfile, parseScaffoldInput, aggregateRawMaterial, enrichRawMaterial, applyStructuralDeltasAdapter-friendly scaffolder used by the cdf-profile-scaffold Skill. Emits typed ScaffoldResult with milestones and raw material; consumer (Skill or other adapter) drives the interview loop.
Token treeTokenTree, RawToken, TokenExtensions, ColorModifierGeneric DTCG token-tree walker. Inlined from formtrieb-tokens-core in v1.0.0; no MoPla-specific assumptions.
Vocab divergence applyapplyComponentRenameRewrite component spec value occurrences after a vocab-divergence resolution.

See src/index.ts for the full export list.

Minimal example

import { parseCDFFile, validate } from "@formtrieb/cdf-core";

const component = parseCDFFile("./specs/components/Button.spec.yaml");
const issues = validate(component);

for (const issue of issues) {
  console.log(`[${issue.severity}] ${issue.rule}: ${issue.message}`);
}

For Profile-level work:

import { parseProfileFile, validateProfile } from "@formtrieb/cdf-core";

const profile = parseProfileFile("./acme.profile.yaml");
const result = validateProfile(profile, { resolveTokens: true });

console.log(result.summary);

Relationship to other packages

PackageRole
@formtrieb/cdf-mcpMCP server exposing this library to LLM clients (Claude Desktop, MCP Inspector). Thin adapter — every business decision lives here.
formtrieb/cdf repoNormative specs (CDF-COMPONENT-SPEC, CDF-PROFILE-SPEC, CDF-TARGET-SPEC) + foreign-DS validation ports.

Development

pnpm install
pnpm --filter @formtrieb/cdf-core build
pnpm --filter @formtrieb/cdf-core test

License

Apache-2.0 — alignment with the CDF spec.

Keywords

cdf

FAQs

Package last updated on 27 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts