Skip to content

SDK examples

Run command-equivalent workflows directly in code with @i18nprune/core.

These scripts in examples/sdk/** are the canonical starting point when you need:

  • CI scripts without spawning a CLI process
  • app/server integration with runtime adapters
  • deterministic JSON/result handling from runXxx operations

Example index

OperationExample scriptTypical use
doctorexamples/sdk/doctor/runDoctor.tsEnvironment/path readiness checks in scripts
missingexamples/sdk/missing/runMissing.tsMissing key analysis inside custom tooling
syncexamples/sdk/sync/runSync.tsLocale topology alignment from Node jobs
reviewexamples/sdk/review/runReview.tsDrift/parity review automation
qualityexamples/sdk/quality/runQuality.tsQuality checks for CI and dashboards
generateexamples/sdk/generate/runGenerate.tsProvider-backed translation flows
translateexamples/sdk/translate/runTranslate.tsTranslation-provider focused usage
share listexamples/sdk/share/runShareList.tsShare cache introspection from scripts

Minimal host pattern (Node)

ts
import { resolveContext, runSync } from '@i18nprune/core';
import { createNodeRuntimeAdapters } from '@i18nprune/core/runtime/node';

const ctx = await resolveContext({
  projectRoot: process.cwd(),
  adapters: createNodeRuntimeAdapters(),
});

const res = await runSync(ctx, { dryRun: true });
console.log(res);

Notes for SDK consumers

  • Runtime adapters are host-owned (runtime/node, runtime/web, runtime/edge).
  • CLI-style human output is not required; consume typed results directly.
  • The same issue-code contracts used by CLI --json are available in SDK results.
  • For translation/share flows, keep secrets and cache directories under your host policy.