feat(cli): add compile command to emit GitHub/GitLab CI YAML from a single TS plan

Merged
TH
3mo ago
+267-3

Summary

Adds sverka compile --target github|gitlab so the same sverka.config.ts can be turned into either GitHub Actions or GitLab CI YAML through the existing canonical Plan IR.

What changed

  • @sverka/sdk now builds the canonical Plan IR during planning:
    • PlanResult gains plan: Plan
    • new Sverka.toPlan() and top-level toPlan() return the validated Plan IR directly
  • @sverka/cli depends on @sverka/compiler-github and @sverka/compiler-gitlab
  • new sverka compile command:
    • --target github|gitlab (required)
    • --output <path> / -o <path> to write the YAML to a file
    • defaults to YAML on stdout
    • supports --format json for tool integration
  • tests added in packages/cli/src/__tests__/compile.test.ts for both targets and --output

Example

sverka compile --target github --output .github/workflows/sverka.yml
sverka compile --target gitlab --output .gitlab-ci.yml

This keeps the thin-wrapper compiler design from ADR-004: the generated CI config runs sverka execute inside the CI runner, using the same Plan derivation as local runs.

Verification

  • bunx nx run-many --target=typecheck --all passes
  • bunx nx run-many --target=lint --all passes
  • bunx nx run-many --target=test --all passes