easyi18n_cli library
Programmatic entry point for the easyi18n CLI.
Most users run the bundled easyi18n executable; this library exposes the
same command set so you can embed it in your own Dart tooling:
import 'package:easyi18n_cli/easyi18n_cli.dart';
Future<void> main(List<String> args) =>
Easyi18nCommandRunner().run(args);
Classes
- AndroidAdapter
-
The Android file-first adapter (decision D0/D13, #2285): the base
res/values/strings.xmlis the truth.syncuploads it plus eachvalues-<qualifier>/strings.xmlunder its language, andpullwrites the translatedvalues-<qualifier>/files into the sameres/, never onto the base. No extractor: the strings already live in resources. - ApplyPlan
- Planning has closed the client; applying needs no network or presenter callback.
- ApplyResult
- ApplyRunner
- CatalogLanguageGaps
-
The gaps between the catalog just written and what the project configures
(#592). Both are warn-only:
--require-completeis the flag for CI that wants red, and a catalog legitimately carrying an extra locale must not start failing every build. - CliLogger
-
Minimal output sink so commands stay testable:
outis captured in tests,errgoes to stderr in production. No color/ANSI to keep CI logs clean. - CliOutput
- One output mode shared by the runner and its command presenters.
- DartFlutterAdapter
- DoctorFinding
- A completed check result; presentation and JSON consume the same data.
- DoctorReport
- DoctorRunner
- Shared config, credential and published-coverage checks plus the stack adapter.
- Easyi18nCommandRunner
-
The
easyi18nCLI. Wires up the commands and the global options - a--configthe commands share for config-path resolution, and a--versionthe runner itself answers. - ExtractResult
- Full extraction for text presenters, with bounded lists for JSON consumers.
- ExtractRunner
- Read-only, offline extraction and comparison against the project lockfile.
- InitReport
- InitRunner
- InitStep
- One completed setup action, replayed before the next action starts.
- LanguageAddResult
- LanguageAddRunner
-
POST /v1/projects/{id}/languages, shared byeasyi18n languages addand the MCPadd_languagetool. - OutputFormatResult
- OutputFormatRunner
- PullOutcome
- Paths and coverage only; served file contents stay inside the pull.
- PullRunner
-
The pull machinery, extracted from
PullCommandsoeasyi18n synccan reuse it (ci-sync.md Fase 2): fetch → guard every path → prune → atomic write → record state. - PushPreview
- The scan plus its dry run. result is null when the scan was empty and no request was made; the shape stays the same so a consumer reads one contract.
- PushReport
-
The whole push as one record: the preview it was judged on, what the real
push did (null when nothing was sent), what
--publishminted and whether the lockfile moved. - PushResult
- Aggregated view across batched translate calls.
- PushRunner
- PushScan
- What a push knows before it talks to the server.
- RollbackResult
- The flagged cells are still served by the restored snapshot.
- RollbackRunner
- StatusResult
- StatusRunner
- Read-only comparison of the last pull with the project's live metadata.
- SyncDelivery
- The publish and the pull that close a sync.
- SyncOutcome
- What the run loop settled, once every job it paid for is accounted for.
- SyncPreview
- The scan plus its dry run: the cost gate a real sync is judged on, and the bytes and claim the real POSTs re-send unchanged.
- SyncReport
- The whole sync as one record: what it was priced on, what the run settled, and what reached the disk.
- SyncRunner
-
The logic half of
easyi18n sync(docs/specs/ci-sync.md§4): what the run decides and asks of the server, with none of the lines it prints. The command owns the transcript; this owns the flow. - SyncRunProgress
- When the run loop produces a line, never what it says. Every word stays in the command, which owns the transcript; this is the order.
- SyncScan
- The file-first half of a sync, decided before any credential or network call: which catalog this run uploads and writes back to.
- XcstringsAdapter
-
The file-first adapter (decision D0/D13): the translation catalog the
project already owns is the truth, not the calls in the source.
initwrites a config pointing at it,syncuploads it and writes the translated one back, anddoctorgrades the file rather than a runtime wiring the stack has no way to use.
Mixins
- JsonPresenter
- Opts a command into structured output; the presenter owns its payload.
Constants
- packageVersion → const String
- The version of this package, pinned by hand.
Functions
-
requireToken(
{String? token, required Map< String, String> environment, String scope = 'read', String? baseUrl}) → String -
withProject<
T> ({required Easyi18nConfig config, required String token, required CliLogger logger, ApiClientFactory? apiClientFactory, required Future< T> body(TranslationsApiClient client, String projectId)}) → Future<T> - Owns the client through resolution and the body, including either failure.
Typedefs
- DeliveryClientFactory = DeliveryClient Function({required String baseUrl})
- Builds the public delivery client used by the runtime health checks.
Exceptions / Errors
- CliException
- A user-facing CLI failure: printed without a stack trace and mapped to a non-zero exit code. Anything else bubbles up as an unexpected error.