CLIKontract

Kontract

Design profile

Choose how examples should look for API contracts, async contracts, and schema folders. The profile guides docs and AI assistants; it does not change generated code or application architecture.

Set it, then change it safely

Store the profile in sumr.yaml.

Use sumr kontract init for first-time setup, thensumr kontract config to view or update profile values later without hand-editing YAML. Setup also adds VS Code icons for `.api.yml` and `.async.yml` schema files.

terminal
sumr kontract init --api-style pragmatic-rest --async-style command-event --schema-layout-style by-product-capability# choose all profile axes during setupsumr kontract config --api-style rpc-action --schema-layout-style by-workflow# change selected axes later

API styles

Pick the path and component style that matches the API schema surface.

StyleChoose this whenSample pathSample names
pragmatic-restUse for predictable REST without strict methodology overhead./v1/orders/{orderId}/itemsOrder, CreateOrderBody
resource-orientedUse when the API follows resource hierarchy and standard methods closely./v1/publishers/{publisherId}/books/{bookId}Book, ListBooksResponse
json-apiUse when clients expect JSON:API documents, relationships, and sparse fields./articles/1/relationships/commentsArticleResource, ArticleRelationship
odataUse when consumers need OData query, filter, and metadata conventions./Products?$filter=price gt 10ProductEntity, ProductCollection
rpc-actionUse when operations are action-first and not naturally modeled as CRUD./v1/reports:generateGenerateReportRequest, GenerateReportResult
graphql-httpUse when API requests carry GraphQL operations./graphqlGetOrderVariables
hypermedia-restUse when clients navigate links and state transitions from representations./v1/orders/{orderId} with links.cancelOrderLinks, OrderRepresentation
webhook-callbackUse when the contract documents callbacks or externally delivered HTTP events./webhooks/order-createdOrderCreatedWebhook, WebhookAck
mixedUse when multiple API styles are intentional and documented by surface./v1/orders and /graphqlNames match each surface

Async schema styles

Pick the channel and message style that matches the async contract.

StyleChoose this whenSample channelSample names
command-eventUse when commands and events are separate contract families.cmd.billing.invoices.create, evt.billing.invoices.createdCreateInvoiceCommand, InvoiceCreatedEvent
event-drivenUse when services primarily publish facts that subscribers react to.billing.invoice.createdInvoiceCreated
request-replyUse for query/reply or command/reply messaging interactions.qry.catalog.products.getGetProductQuery, ProductReply
cloud-eventsUse when events must follow CloudEvents envelope semantics.com.example.invoice.createdInvoiceCreatedCloudEvent
mixedUse when multiple messaging styles are intentional and documented by family.cmd.*, evt.*, and CloudEvents topicsNames match each family

Schema source styles

Pick how schema files and folders should be grouped after choosing the schema type: API schema-only, async schema-only, or both with shared neutral components such as enums.

StyleChoose this whenSample layout
by-product-capabilityUse when a product capability owns the selected schema roots. API schema-only repos, async schema-only repos, and repos that use both should show different examples.API schema-only: schema/recipes/recipes.api.yml; both: schema/recipes/{recipes.api.yml, recipes.async.yml, models/enums.yml}
by-api-surfaceUse when public, partner, admin, internal, or messaging surfaces release separately.API schema-only: schema/public.api.yml; async schema-only: schema/internal-events.async.yml
by-service-ownerUse when teams generate contracts by deployable service ownership.schema/catalog-service/catalog.api.yml or schema/notification-service/notifications.async.yml
by-resource-areaUse when specs are easiest to review by stable resource area. Do not nest resource areas under product capabilities unless style is mixed.schema/books/books.api.yml, schema/authors/authors.api.yml
by-workflowUse when one workflow spans several resources and needs one contract owner.schema/checkout/checkout.api.yml or schema/fulfillment/fulfillment.async.yml
by-message-familyUse when messaging files are owned by command, event, query, or reply family. This is normally async schema-only.schema/events/book-events.async.yml
mixedUse when legacy or multi-team layouts intentionally differ by folder. Document each folder's style and schema type.schema/public.api.yml plus schema/events/book-events.async.yml plus documented mixed folders