@claudiv/core
v0.4.2
Published
Claudiv core engine — types, FQN, differ, context engine, executor, projector, plan processor
Readme
@claudiv/core
Core engine for the Claudiv declarative AI interaction platform
Overview
@claudiv/core provides the foundational types, parsers, and engines for the Claudiv platform. Interface-first component model with FQN addressing, diff-based change detection, context-driven prompt assembly, and headless Claude execution.
Installation
npm install @claudiv/coreExports
Types (types.ts)
All type definitions: FQN, ComponentDefinition, InterfaceDefinition, DependencyDefinition, CdmlDiffResult, PlanDirective, ContextManifest, AssembledPrompt, and more.
SDK Types (sdk-types.ts)
ClaudivSDK and FrameworkDetector interfaces for building framework-specific SDKs.
FQN Parser (fqn.ts)
parseFQN(raw)-- Parse FQN string into structured partsresolveFQN(fqn, scope, registry)-- Resolve to component referencebuildFQN(element, ancestors)-- Build FQN from DOM positionstringifyFQN(fqn)-- Convert back to string
Differ (differ.ts)
diffCdml(old, new)-- Structural diff of two CDML documentsgetChangedElements(diff)-- Extract only changed elements
Context Engine (context-engine.ts)
assembleContext(change, scope, manifest, registry, root)-- Full prompt assemblyresolveScope(manifest, path)-- Resolve scope chain from context manifest
Context Parser (context-parser.ts)
parseContextManifest(content)-- Parse.claudiv/context.cdmlloadContextManifest(path)-- Load from fileserializeContextManifest(manifest)-- Serialize back to CDML
Executor (executor.ts)
executeClaudeHeadless(prompt, config)-- CLI or API mode execution
Projector (projector.ts)
projectFacets(dep, interface)-- View-filtered interface projectionresolveProjectedDependencies(component, scope, registry)formatProjectedInterfaces(projections)-- Format for prompt inclusion
Plan Processor (plan-processor.ts)
detectPlanDirectives($)-- Find plan attributes/elementsparsePlanQuestions($)-- Parse plan:questions blockgeneratePlanQuestions(questions)-- Generate CDML blockquestionsToFacts(questions, source)-- Convert answers to factsbuildPlanPrompt(directive)-- Build expansion prompt
Scanner (scanner.ts)
scanProject(root, detector)-- Scan existing projectgenerateCdmlFromScan(name, files, root)-- Generate CDML skeleton
Environment (environment.ts)
detectEnvironmentFiles(base, platform?, arch?, distro?)mergeEnvironmentCascade(files)-- Element-level merge with overrides
Project Registry (project.ts)
loadProject(manifestPath)-- Load project manifest and build registryresolveComponent(fqn, registry)-- Lookup component by FQNresolveInterface(fqn, registry)-- Get interface only
Aspects (aspects.ts)
parseAspect(content, path)-- Parse aspect filediscoverAspects(dirs)-- Find aspect files by naming conventiongetAspectRelevantFacets(type)-- Get relevant facets for aspect typelinkAspects(components, aspects)-- Attach aspects to components
Parser (parser.ts)
parseSpecFile(content)-- Parse CDML into structured formextractInterface($),extractConstraints($),extractDependencies($)extractScopeConstraints($, element)-- Siblings as locked constraintsbuildPromptContext(component)-- Simple standalone context builder
Hierarchy Helpers
buildElementPath(),buildScopeChain(),getSiblingElements()getChildElementNames(),buildFQNFromPosition(),extractFullContent()
Development
pnpm install
pnpm run buildLicense
MIT
