@codeenginestudio/kim-contract
v1.0.0
Published
Kim file contract: JSON Schemas and examples for harness files and kim CLI messages
Readme
contract (@codeenginestudio/kim-contract)
The file contract shared by the two parts of Kim: JSON Schemas and example files for the harness files and the kim CLI's messages to the Kim server. kim-server uses this folder in place; it is published as the versioned package @codeenginestudio/kim-contract, which ces-harness-creator pins as a dev dependency for its CI. Engineers never install it, and nobody copies the schemas.
The package is data only: schemas and examples, no code.
Schemas (v1)
| Schema | Shape of | Written by | Read by |
| --- | --- | --- | --- |
| schemas/v1/feature-list.schema.json | feature_list.json (copied from harness-creator's template, plus optional schemaVersion: 1) | harness-creator | kim-features merge driver, kim-server |
| schemas/v1/plan-frontmatter.schema.json | Plan doc frontmatter, as parsed JSON (optional schema-version: 1) | harness-creator | kim-server (vcs, at the pushed commit) |
| schemas/v1/claim.schema.json | kim claim → POST /claim: request, reply-200, reply-409 | kim CLI / API | API / kim CLI |
| schemas/v1/events.schema.json | kim event → POST /events: request, reply-200 | kim CLI / API | API / kim CLI |
| schemas/v1/issues-ready.schema.json | kim issues --ready reply: reply-200 | API | kim CLI |
| schemas/v1/id-next.schema.json | kim id next: request, reply-200 | kim CLI / API | API / kim CLI |
Message bodies are closed (additionalProperties: false): a renamed or extra field fails validation. Each message schema holds one entry under definitions per body; refer to one as <$id>#/definitions/<body>. The owner and device of a request come from the device token, never from the body.
Examples
examples/v1/<schema>/valid-*.json feature-list, plan-frontmatter
examples/v1/<schema>/<body>/valid-*.json message schemas, one folder per body
examples/v1/<...>/invalid-*.json must fail validation
examples/v1/unblocked/*.json unblocked-rule casesEvery schema and every message body has at least one valid and one invalid example; the test fails otherwise.
Unblocked cases are { "name", "input": <feature list>, "expected": [ids] }. A feature is unblocked when its status is not-started and every id in its dependencies names a feature whose status is done (ADR-0048, ADR-0057). expected is sorted. A missing dependency id or a cycle leaves the feature blocked. harness-creator's computeUnblocked and Kim's Go rule both run these cases.
Versions
- The contract versions on its own, separate from kim-server and harness-creator.
- The package's major version equals the newest schema folder. Package 2.x will hold
schemas/v2/and still shipschemas/v1/, so the server can read the current and the previous version. - Minor and patch versions add to or fix the newest folder. Adding a field to a message is a minor version, published before either side sends it.
$ids (https://codeenginestudio.com/kim-contract/schemas/v1/<name>.schema.json) are names, not download URLs.
Change process and drift checks: docs/ARCHITECTURE-draft.md section 0.1.
Test
npm ci
npm testNeeds Node 22 or newer. The test compiles every schema with ajv (strict mode), checks every example against the schema or body its path names, checks the unblocked cases, checks the feature-list schema still matches harness-creator's template, validates kim-server's own feature_list.json, and checks what npm pack would publish. CI runs it on every pull request that touches contract/ (.github/workflows/contract-test.yml).
Release
- Bump
versioninpackage.jsonand merge. - The owner pushes the tag
contract-v<version>(for examplecontract-v1.0.0). .github/workflows/contract-publish.ymlchecks the tag matchespackage.json, runs the test, and publishes to npm through trusted publishing (GitHub OIDC; no stored token). The package's trusted publisher on npmjs.com namesCode-Engine-Studio/ces-kim-serverandcontract-publish.yml.
The very first version (1.0.0) is published once by hand (npm publish --access public in contract/), because a trusted publisher can only be added to a package that exists.
