Skip to Content
PhasesPhase — Generate

Phase — Generate

Status: shipped (foundations). User docs: commands/generate, behavior / JSON.

This file is development-only (see repo .gitignore for docs/phases/).

Note: “Missing keys in source” is i18nprune missing — see commands/missing — not a generate flag.


1. Foundations — done

GoalImplementation
--json + no promptsNon-interactive runs require --target; throws USAGE with a clear message (packages/cli/src/commands/generate/run.ts).
Meta defaults--target present → catalog-backed englishName, nativeName; direction from --direction or default ltr (mergeGenerateOptionsFromEnv + prompts when interactive).
Direction--direction rtl | ltr supported; aligned with meta sidecar writes.

Acceptance: covered by command behaviour + commands/generate.


2. Shared missing-key helper — moved

computeMissingLiteralKeys lives in packages/cli/src/core/validate/missingLiterals.ts and is used by validate and missing — not part of generate.


Optional follow-ups (implemented)

  • RTL vs --direction (warn-only): heuristic list in packages/cli/src/core/languages/rtlHint.tsgenerate warns when a typical RTL code uses ltr, or a typical LTR code uses --direction rtl (human mode only; suppressed in --json).
  • Reports: generate calls pushReportEntry + finalizeReportFile on success and when skipping because the target already covers the source (aligned with fill / sync).

Planning — per-target progress summary in the final envelope

Status: Backlog (design + implementation). Today’s generate --json already returns aggregate fields (leavesProcessed, dynamicKeySites, targetResults[] with status, paths, counts). This plan tightens observability so each target has an explicit progress / outcome summary suitable for CI and agents — especially when multiple --target values are passed or when --yes forces a re-generate (no parity skip).

Goals

GoalDescription
Per-target summaryFor each entry in targetResults[] (or equivalent), include a progress summary block that reflects work done for that target only: e.g. leaves touched, preserved, skipped-with-reason, parity skip vs forced rewrite, timing (startedAt / durationMs optional), and any warning-level issues scoped to that target.
Multi-target runsIf --target a,b,c, the single stdout CliJsonEnvelope remains one document; data.targetResults (or nested structure) carries one summary object per target, in stable order (same as argv / catalog order), so integrators can slice by target without scraping logs.
Forced re-generate (--yes)When --yes causes a full pass (no parity short-circuit), each affected target’s row must still expose progress-style fields (not only “written”) — e.g. confirm re-generation was applied and record the same counters as a cold write, so automation can distinguish skip vs rewrite vs error.
Human vs JSONHuman mode may keep or extend the existing banner + logger story; --json must encode the same per-target facts in data (see JSON output, json-long).

Non-goals (this planning slice)

  • Per-leaf translation traces in the envelope (still report/report-file territory unless explicitly added later).
  • Changing ok semantics: envelope-level success remains overall command success; per-target failures should be targetResults[].status / issues[] with stable codes, consistent with current generate behavior.

Schema direction (illustrative)

Exact field names belong in packages/cli/src/types/command/generate/json.ts (or equivalent). Conceptually each targetResults[i] may grow:

  • progress: { leavesWritten?, leavesPreserved?, paritySkipped?, forcedRegenerate?, durationMs?, ... } — align names with fill / sync where concepts overlap.
  • issues (optional): target-scoped warnings, or continue to fold into top-level issues[] with target / locale metadata — pick one approach and document it in commands/generate.

Acceptance (when implementing)

  • Fixture or integration test: --target with ≥2 locales shows distinct per-target summary fields in data.
  • --yes path: when parity would have skipped but --yes forces work, targetResults reflects forced run with non-zero progress counts where applicable.
  • Docs: commands/generate, json README row for generate, and this file — no drift between example JSON and runtime.

See also