1 Interface-only Consumption (headers)

This tutorial shows how to consume an external module using only its interfaces (headers), without downloading the full implementation sources.

This is useful when:

  • You want to validate/compile your module against a dependency contract.
  • The dependency implementation is proprietary (you only publish headers).

The mechanism is: add a dependency in kumori.mod.json with a headers entry.

1.1 Add a dependency with headers

You’ll typically pin both:

  • The runtime module (requires[].target + requires[].version)
  • The headers module (requires[].headers.target + requires[].headers.version)

Example kumori.mod.json:

{
  "spec": "kumori/module/v1",
  "module": "kumori.tutorials/interface-only-consumer",
  "kumori": "0.0.1",
  "version": "0.0.1",
  "requires": [
    {
      "target": "gitlab.com/vendor/echo-module",
      "version": "1.2.0",
      "alias": "echo",
      "headers": {
        "target": "gitlab.com/vendor/echo-module-headers",
        "version": "1.2.0"
      }
    }
  ]
}

A typical command-line flow (mirrors your kdsl mod dep docs):

kdsl mod dep gitlab.com/vendor/echo-module@1.2.0 --alias echo --headers gitlab.com/vendor/echo-module-headers@1.2.0 --download

1.2 Import packages from the dependency

Just like any other dependency, you import a package.

If you used an alias (echo in the manifest), import via the alias:

import (
  "echo/service"
)

1.3 Reference artifacts normally

Once imported, you reference the artifact as package.ArtifactName.

For example, a deployment that targets service.EchoServer from the dependency:

import (
  "echo/service"
  "kumori"
)

deployment {
  name       "headers-only-consumer"
  artifact   service.EchoServer
  resilience 1

  config {
    Port     8080
    Response "Hello from headers"
    Scale    2
  }

  resource {
    Port kumori.Port("my-port")
  }
}