Skip to content

emulator: expose EmulatorSpec via plugin + chant emulator up|down|status CLI #920

Closed

Description

@lex00

Supports behold's serve --local (emulator-aware local mode). A consumer needs to boot a lexicon's local emulator (Floci for aws, floci-az, floci-gcp, spritzer/flaps for fly) and point apply + observe at it — creds-free, no cloud account.

Finding

Emulators exist today only as lexicon activities (flociUp/flociAzUp/…) on the core emulatorLifecycle(spec), used inside Ops (they boot and tear down per run). There's no way to boot a persistent emulator from the CLI, and core can't dispatch to a lexicon's emulator (dependency direction: core ↛ lexicons). So we need to surface it.

Want

1. Plugin capability (data only)

EmulatorSpec ({ name, image, containerPort, healthPath, ready?, runArgs? }) is already data. Add an optional emulator?: EmulatorSpec to LexiconPlugin (packages/core/src/lexicon.ts). Each lexicon with one exposes its spec — no behavior in the lexicon, just the spec:

  • aws → Floci (floci/floci:latest, :4566, /_localstack/health)
  • azure → floci-az · gcp → floci-gcp · fly → spritzer/flaps
    (reuse the specs already in lexicons/*/src/op/activities/*emulator*/floci*.ts.)

2. chant emulator CLI

chant emulator up|down|status [--lexicon <name> | --all] [--json]:

  • loads the project's configured plugins; for each with an emulator, runs emulatorLifecycle(spec).up()/down() / a health check for status.
  • --json prints, per emulator, { lexicon, name, endpoint, env: { AWS_ENDPOINT_URL, … } } — the env a consumer applies so the aws SDK / chant graph --live and any Op it runs target the emulator.
  • persistent: up leaves the container running (unlike the in-Op boot/teardown); down removes it; idempotent (reuse a running container of the same name).

Consumer

behold serve --local shells chant emulator up --all --json, applies the env, observes against the emulator, and chant emulator down on exit.

Acceptance

  • chant emulator up --lexicon aws --json boots Floci and prints its endpoint + env; status reports up/down; down removes it. Idempotent.
  • Lexicons without an emulator are skipped; --all does every configured lexicon that has one.
  • Plugin-capability + CLI-wiring unit-tested; the container up/down is Docker-gated (document, not in gating CI).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions