CLIKontract

How to

Activate guidance

Prepare workspace guidance before spec or contract work.

What changes

kontract init writes the design profile in sumr.yaml, activates Contract Copy guidance, and can configure one source and target. Profile choices affect examples, not generation behavior or application architecture.

When this helps

  • A repo is starting to use Kontract.
  • AI guidance for contract work is missing or stale.

Run this command

terminal
sumr kontract init# activate guidancesumr kontract init --api-style json-api --async-style cloud-events --schema-layout-style by-api-surface# choose profile axessumr kontract init --source api --input ./schema --target effect-schemas --output ./generated --generator typescript-effect# configure one source and targetsumr kontract init --json# automation output

Flags you can use

--api-style <style>

Set API schema example style: pragmatic-rest, resource-oriented, json-api, odata, rpc-action, graphql-http, hypermedia-rest, webhook-callback, or mixed.

--async-style <style>

Set async schema example style: command-event, event-driven, request-reply, cloud-events, or mixed.

--schema-layout-style <style>

Set schema layout example style: by-product-capability, by-api-surface, by-service-owner, by-resource-area, by-workflow, by-message-family, or mixed.

--source <name>

Set the source name.

--input <path>

Set the workspace-relative OpenAPI or AsyncAPI file or directory.

--target <name>

Set the generated target name.

--output <path>

Set the workspace-relative generated output directory.

--generator <type>

Choose the target generator, including typescript-effect for schema-only output.

--json

Output a machine-readable JSON envelope.

--quiet

Suppress all output except errors.

--help, -h

Show the command syntax, supported flags, and examples without changing files.

Keep in mind

  • This prepares authoring guidance and configuration; it does not generate files.
  • Use --source, --input, --target, --output, and --generator together.
  • Write concise operation summaries in the source YAML. Add descriptions only when they clarify behavior, then review and validate before generation.
  • Setup also adds VS Code Material Icon associations for *.api.yml, *.api.yaml, *.async.yml, and *.async.yaml source files.
  • Existing profile values stay unchanged unless a flag or interactive choice updates them.
  • Use sumr kontract config to view or update the profile later without hand-editing YAML.
  • After setup, validate specs before generating outputs.