Content SDK capabilities
Detail: reference.md (data flow, key files, merge semantics)
Read first: packages/core/src/capabilities.ts (CSDKCapabilities), the target package's capabilities module
When
- The developer says a feature needs a capability that Pages, Design Studio or another consumer reads from
.sitecore/metadata.jsonor editing config - A task changes a capability key, filter or package
/capabilitiesexport
Rules
- Confirm first: a consumer app must discover or gate the feature from the head app; whether it carries
metadata(agree the contract); whether it's unconditional or needs app wiring; which packages export it - Add the key to
CSDKCapabilitiesin core, then export it from each package's/capabilitiesdefault:nextjs/src/capabilities/index.ts,angular/src/server/capabilities/index.ts,cli/src/capabilities.ts. New packages need the./capabilitiessubpath inpackage.json - Keep key names identical across packages that share a tree; merge ORs booleans, deep-merges sub-capabilities and ANDs filters
- Unconditional features are
{ value: true }. Add afilteronly when the app must adopt a route, middleware, import or setting - Use the lightest correct filter:
- one known file:
fileExists/fileContains(hasEditingRenderRoute,hasPersonalizeMiddlewareonsrc/server.ts) - config: read
sitecoreConfigonly (hasCodeGenerationEnabled) - SDK import anywhere in
src/: reusesomeSourceFile+importsNamedExportfrom@sitecore-content-sdk/core/node-tools(hasDesignLibrary,hasPersonalizeProxy) - Tie matched export names to the package so a rename breaks the build:
keyof typeofatype * asnamespace import (Next.js), or a spec-side type check when the module can't compile undertsconfig.server.json(AngularDesignLibrary.spec.ts) - Keep filters synchronous and cheap; they run once per
sitecore-tools project build - Test merge behavior in
core/src/tools/capabilities/capabilities.test.tsand filters next to each package module; runapi-extractorafter contract changes; updatescripts/verify-sample-capabilities.jswhen sample keys change
Stop
- Stop if no consumer app will read the capability from metadata or editing config
- Stop if the change would alter the resolved JSON shape:
falseleaves, sub-capabilities nested under anything but sibling keys of the parent, orfilterwritten to output - Stop and discuss explicit config or a template change if detection would need a TypeScript program, bundler graph or scanning outside
src/