ADR 011 — Runtime-neutral SDK host model
Status: Accepted
Date: 2026-05-09
Deciders: Abdisamed Mohamed
Related ADRs: ADR 006, ADR 009
Context
The same engines (validate, sync, generate, report, share prepare) must run in Node CLI, browser bundles, and worker isolates without forking semantics. Node-only imports (node:fs, child_process) must not leak into portable graphs.
Decision
@i18nprune/corealgorithms are runtime-neutral — noconsole.*; noprocess.*except via passedenv/ adapters.- Adapters per graph: import
i18nprune/core/runtime/node,runtime/web, orruntime/edge— each exports a coherentRuntimeAdaptersbundle (filesystem,path,system,network). - CLI resolves adapters through
resolveContext()→ctx.adaptersfor disk-touching commands. - Capability tiers: Tier A (read/analyze) fits browser/worker; Tier B (write locales, cleanup) expects Node or a backend you operate; product apps may combine both.
@i18nprune/uiis separate — runtime-cluster UI only (apps/web,apps/report, worker/docsshell); no imports from@i18nprune/coreor share/report domain code in the UI package.
Implementation
typescript
import { resolveContext } from '@i18nprune/core';
import { createNodeRuntimeAdapters } from 'i18nprune/core/runtime/node';
const ctx = await resolveContext({
projectRoot: process.cwd(),
adapters: createNodeRuntimeAdapters(),
});Public examples use @i18nprune/core for programmatic entry points; the published CLI tarball also exposes i18nprune/core re-exports for config helpers.
Consequences
Positive
- One implementation for CI scripts, CLI, and hosted prepare paths.
- Bundle graphs stay
node:-clean on web/edge.
Negative
- Host authors must supply adapters instead of assuming
fsglobals. - Not every command is meaningful in browser (no arbitrary repo
fs).
Mitigation
- Runtime overview and per-host pages (node, web, worker).
- SDK operations for
runXxxentry points.
Alternatives Considered
Separate core forks per runtime
- Pros: Smaller per-bundle surface.
- Cons: Semantic drift; rejected early in runtime export work.
CLI-only product (no SDK barrels)
- Pros: Narrower scope.
- Cons: Blocks IDE, worker upload, and init template SDK wording goals.
References
- Runtime overview
- SDK operations
- ADR 006
- Git:
packages/core/src/runtime/exports/; platform CI (bbb96f7,a5395e7)