@sumrco/cli 0.3.5 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +137 -2
  2. package/ai/modules/kontract/resources/api-generation-standards.rf.md +2 -0
  3. package/ai/modules/kontract/resources/authoring/configuration.rf.md +13 -0
  4. package/ai/modules/kontract/resources/authoring/design-profile/api-styles.rf.md +11 -0
  5. package/ai/modules/kontract/resources/authoring/design-profile/async-styles.rf.md +53 -0
  6. package/ai/modules/kontract/resources/authoring/overview.md +3 -0
  7. package/ai/modules/kontract/resources/authoring/schema-reuse.rf.md +3 -0
  8. package/ai/modules/kontract/resources/authoring/spec-layout.rf.md +12 -4
  9. package/ai/modules/kontract/resources/authoring/team-members/spec-author.tm.md +3 -0
  10. package/ai/modules/kontract/resources/authoring/workflows/{spec-change.wf.md → spec-change.cmd.md} +5 -3
  11. package/ai/modules/kontract/resources/generated-output.rf.md +99 -4
  12. package/ai/modules/kontract/resources/overview.md +3 -0
  13. package/ai/modules/mission/resources/flow-actions.rf.md +28 -3
  14. package/ai/modules/mission/resources/flow-config.rf.md +2 -2
  15. package/ai/modules/mission/resources/flow-safety-boundaries.rf.md +7 -0
  16. package/ai/modules/mission/resources/overview.md +69 -11
  17. package/ai/modules/mission/resources/stage-closeout.rf.md +15 -5
  18. package/ai/modules/mission/resources/stage-delivery.rf.md +19 -6
  19. package/ai/modules/mission/resources/stage-intake.rf.md +58 -8
  20. package/ai/modules/mission/resources/stage-planning.rf.md +17 -3
  21. package/ai/modules/mission/resources/stage-pull-request.rf.md +5 -2
  22. package/ai/modules/mission/resources/stage-quality.rf.md +25 -4
  23. package/ai/modules/mission/resources/team-members/delivery-lead.tm.md +5 -3
  24. package/ai/modules/mission/resources/team-members/implementer.tm.md +10 -3
  25. package/ai/modules/mission/resources/team-members/planner.tm.md +25 -15
  26. package/ai/modules/mission/resources/team-members/pr-writer.tm.md +4 -3
  27. package/ai/modules/mission/resources/team-members/product-owner.tm.md +8 -2
  28. package/ai/modules/mission/resources/team-members/quality-lead.tm.md +16 -3
  29. package/ai/modules/mission/resources/workflows/{daily-triage.wf.md → daily-triage.cmd.md} +5 -4
  30. package/ai/modules/mission/resources/workflows/{full-delivery.wf.md → full-delivery.cmd.md} +3 -3
  31. package/ai/modules/mission/resources/workflows/{mission-cycle.wf.md → mission-cycle.cmd.md} +9 -5
  32. package/ai/modules/mission/resources/workflows/{planning-only.wf.md → planning-only.cmd.md} +5 -4
  33. package/ai/modules/mission/resources/workflows/{pr-assist.wf.md → pr-assist.cmd.md} +5 -4
  34. package/ai/modules/mission/resources/workflows/{standard-delivery.wf.md → standard-delivery.cmd.md} +3 -3
  35. package/ai/modules/mission/sumr.module.yaml +20 -2
  36. package/ai/modules/playbook/resources/authoring/content-structure.rf.md +16 -1
  37. package/ai/modules/playbook/resources/authoring/extraction.rf.md +4 -2
  38. package/ai/modules/playbook/resources/authoring/markdown.rf.md +20 -0
  39. package/ai/modules/playbook/resources/authoring/overview.md +31 -1
  40. package/ai/modules/playbook/resources/authoring/patterns.rf.md +99 -0
  41. package/ai/modules/playbook/sumr.module.yaml +3 -0
  42. package/index.js +565 -397
  43. package/package.json +9 -9
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  </h1>
6
6
 
7
7
  <p align="center">
8
- <strong>The official SUMR CLI for project setup, account access, and AI workflow tooling.</strong>
8
+ <strong>Keep developers and AI tools aligned with repeatable project setup, API contracts, team knowledge, and delivery workflows.</strong>
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -17,20 +17,155 @@
17
17
  <a href="#-install">Install</a>
18
18
  ·
19
19
  <a href="#-quick-start">Quick start</a>
20
+ ·
21
+ <a href="#-commands">Commands</a>
22
+ ·
23
+ <a href="#-modules">Modules</a>
20
24
  </p>
21
25
 
22
26
  ---
23
27
 
28
+ ## ✨ Why the SUMR CLI?
29
+
30
+ Store shared setup beside the code it affects. Developers and AI tools use the same versioned files
31
+ and repeatable commands.
32
+
33
+ Use it to:
34
+
35
+ - create and migrate a project's `sumr.yaml` configuration;
36
+ - generate and validate API contract artifacts with Kontract;
37
+ - sync Playbook Documents into supported AI Channels;
38
+ - track plans, evidence, reviews, and next actions with Mission.
39
+
24
40
  ## 🚀 Install
25
41
 
42
+ The CLI requires [Bun](https://bun.sh/) 1.1 or later.
43
+
26
44
  ```bash
27
45
  bun add -g @sumrco/cli
28
46
  ```
29
47
 
48
+ Confirm the installation and check local requirements:
49
+
50
+ ```bash
51
+ sumr --help
52
+ sumr doctor
53
+ ```
54
+
30
55
  ## ⚡ Quick start
31
56
 
57
+ Run these commands from your project directory:
58
+
32
59
  ```bash
60
+ # Create sumr.yaml for this project
61
+ sumr init
62
+
63
+ # Check local requirements
64
+ sumr doctor
65
+
66
+ # Explore every command and module
33
67
  sumr --help
34
- sumr login
68
+ ```
69
+
70
+ Sign in with `sumr login` only when a workflow needs SUMR account access.
71
+
72
+ To inspect a command before it changes files, add `--help`:
73
+
74
+ ```bash
75
+ sumr playbook sync --help
76
+ sumr kontract generate --help
77
+ sumr mission start --help
78
+ ```
79
+
80
+ ## 🧭 Commands
81
+
82
+ | Command | Purpose |
83
+ | --- | --- |
84
+ | `sumr login` | Sign in to SUMR. |
85
+ | `sumr logout` | Sign out of SUMR. |
86
+ | `sumr whoami` | Show the currently signed-in user. |
87
+ | `sumr account` | Manage the account used by SUMR API requests. |
88
+ | `sumr init` | Create a `sumr.yaml` config for the current project. |
89
+ | `sumr migrate` | Apply pending `sumr.yaml` migrations. |
90
+ | `sumr doctor` | Check runtime and tool requirements. |
91
+ | `sumr kontract` | Generate and validate API contract artifacts. |
92
+ | `sumr playbook` | Sync Playbook Documents into AI tools. |
93
+ | `sumr mission` | Track AI-assisted work state and next actions. |
94
+
95
+ Run `sumr <command> --help` for usage, options, and examples.
96
+
97
+ ## 🧩 Modules
98
+
99
+ ### Kontract
100
+
101
+ Generate multiple contract artifacts from API and async API specifications configured in
102
+ `sumr.yaml`.
103
+
104
+ ```bash
105
+ # Generate configured artifacts
106
+ sumr kontract generate
107
+
108
+ # Validate configured specifications
109
+ sumr kontract validate
110
+
111
+ # Activate Kontract guidance for this workspace
112
+ sumr kontract init
113
+ ```
114
+
115
+ ### Playbook
116
+
117
+ Turn Playbook Documents into instructions and resources for supported AI Channels: Claude, Codex,
118
+ Cursor, GitHub Copilot, Gemini, and OpenCode.
119
+
120
+ ```bash
121
+ # Configure Playbook for this project
122
+ sumr playbook config
123
+
124
+ # Validate Documents without writing generated files
125
+ sumr playbook validate
126
+
127
+ # Sync configured AI Channels
128
+ sumr playbook sync
129
+ ```
130
+
131
+ ### Mission
132
+
133
+ Keep AI-assisted work inspectable with local plans, execution state, evidence, reviews, and explicit
134
+ next actions.
135
+
136
+ ```bash
137
+ # Configure Mission for this repository
138
+ sumr mission init
139
+
140
+ # Start or resume work from an issue
141
+ sumr mission start <issue-key>
142
+
143
+ # Show current state and the next action
144
+ sumr mission status <issue-key>
145
+ ```
146
+
147
+ Mission records work locally. External writes require explicit commands and gates. Run
148
+ `sumr mission --help` to inspect the complete workflow.
149
+
150
+ ## 📝 Project config
151
+
152
+ SUMR tools share a versioned `sumr.yaml` at the project root. Start with:
153
+
154
+ ```bash
35
155
  sumr init
36
156
  ```
157
+
158
+ Each module then adds or reads only the configuration it owns. Commit `sumr.yaml` when your team
159
+ should share the same setup.
160
+
161
+ ## 🤖 AI tool resources
162
+
163
+ The npm package includes public Playbook resources for the shipped modules. Playbook uses these
164
+ resources when generating guidance for configured AI Channels, so the installed CLI and its AI
165
+ instructions stay aligned.
166
+
167
+ ## Help and links
168
+
169
+ - Run `sumr --help` or `sumr <command> --help` for command documentation.
170
+ - Report bugs and request features in the [SUMR CLI repository](https://github.com/SUMRco/Cli/issues).
171
+ - View releases on [npm](https://www.npmjs.com/package/@sumrco/cli).
@@ -55,6 +55,8 @@ the source contract.
55
55
  API.
56
56
  - Keep operation IDs stable. They become generated operation metadata, SDK method
57
57
  names, and review anchors.
58
+ - Give every operation a concise `summary`. Add `description` when callers need
59
+ context about outcome, scope, permissions, side effects, or constraints.
58
60
 
59
61
  ## Generator implementation rules
60
62
 
@@ -117,6 +117,7 @@ tests, and breaking-change reports.
117
117
  | `dtos: true` | Emits `http/dto/*.dto.ts`; also keeps the compatibility behavior of emitting `http/swagger.ts`. |
118
118
  | `swagger: true` | Emits per-service `http/swagger.ts` operation metadata and one shared `shared/http/decorators/api-doc.ts` helper for NestJS controllers. |
119
119
  | `sdk: true` | Emits a fetch-based `http/sdk/` client that reuses the target's `http/models/` and `http/enums/` types. |
120
+ | `runtime: true` | Emits one shared `shared/contract-runtime.ts` helper (`toContract`) that feeds domain/persistence objects into the generated Zod schemas — converts `Date` to ISO strings and drops nullish values before validating. Works alongside `zod: true`. |
120
121
 
121
122
  `dtos` is the canonical spelling. `dto: true` is accepted as a compatibility
122
123
  alias and is normalized internally to `dtos: true`.
@@ -129,6 +130,12 @@ generated HTTP API. Use a standalone `typescript-fetch`, `typescript-axios`, or
129
130
  `typescript-angular` target when a frontend/admin app should own its SDK output
130
131
  separately.
131
132
 
133
+ Use `runtime: true` when services hand entities or domain objects to generated
134
+ schemas. It emits one generic `toContract` helper in `shared/contract-runtime.ts`,
135
+ not per-schema code, and is independent of the Zod/DTO flavors. The flag is set on
136
+ the NestJS target; NATS consumers on the same output root import the same helper
137
+ from `shared/`.
138
+
132
139
  ## API schema schema mode
133
140
 
134
141
  Standalone SDK and model targets default to `schemaMode: normalize`. In this
@@ -194,6 +201,12 @@ emit service folders with `models.ts`, `runtime.ts`, and `api.ts`; the NestJS
194
201
  composed SDK emits under `http/sdk/` and imports types from existing
195
202
  `http/models/` and `http/enums/`.
196
203
 
204
+ ### `shared/contract-runtime.ts` is missing
205
+
206
+ Check that a `typescript-nestjs` target on this output root has `runtime: true`.
207
+ The helper is emitted once per output root, so any single NestJS target that
208
+ enables `runtime` provides `toContract` for every service under that root.
209
+
197
210
  ### Generated files are stale
198
211
 
199
212
  Run a scoped clean generation:
@@ -44,8 +44,10 @@ paths:
44
44
  /v1/orders/{orderId}:
45
45
  get:
46
46
  operationId: getOrder
47
+ summary: Get order
47
48
  responses:
48
49
  "200":
50
+ description: Order returned.
49
51
  content:
50
52
  application/json:
51
53
  schema:
@@ -68,6 +70,7 @@ paths:
68
70
  /v1/publishers/{publisherId}/books/{bookId}:
69
71
  get:
70
72
  operationId: getPublisherBook
73
+ summary: Get publisher book
71
74
  parameters:
72
75
  - name: publisherId
73
76
  in: path
@@ -89,6 +92,7 @@ paths:
89
92
  /articles/{articleId}/relationships/comments:
90
93
  get:
91
94
  operationId: listArticleCommentRelationships
95
+ summary: List article comment relationships
92
96
  components:
93
97
  schemas:
94
98
  ArticleResource:
@@ -112,6 +116,7 @@ paths:
112
116
  /Products:
113
117
  get:
114
118
  operationId: listProducts
119
+ summary: List products
115
120
  parameters:
116
121
  - name: $filter
117
122
  in: query
@@ -135,6 +140,7 @@ paths:
135
140
  /v1/reports:generate:
136
141
  post:
137
142
  operationId: generateReport
143
+ summary: Generate report
138
144
  requestBody:
139
145
  content:
140
146
  application/json:
@@ -155,6 +161,7 @@ paths:
155
161
  /graphql:
156
162
  post:
157
163
  operationId: executeGraphqlOperation
164
+ summary: Execute GraphQL operation
158
165
  requestBody:
159
166
  content:
160
167
  application/json:
@@ -199,6 +206,7 @@ paths:
199
206
  /webhooks/order-created:
200
207
  post:
201
208
  operationId: receiveOrderCreatedWebhook
209
+ summary: Receive order-created webhook
202
210
  requestBody:
203
211
  content:
204
212
  application/json:
@@ -221,14 +229,17 @@ paths:
221
229
  get:
222
230
  tags: [pragmatic-rest]
223
231
  operationId: listOrders
232
+ summary: List orders
224
233
  /graphql:
225
234
  post:
226
235
  tags: [graphql-http]
227
236
  operationId: executeGraphqlOperation
237
+ summary: Execute GraphQL operation
228
238
  /v1/reports:generate:
229
239
  post:
230
240
  tags: [rpc-action]
231
241
  operationId: generateReport
242
+ summary: Generate report
232
243
  ```
233
244
 
234
245
  ## Guardrails
@@ -41,6 +41,18 @@ channels:
41
41
  messages:
42
42
  invoiceCreatedEvent:
43
43
  $ref: "#/components/messages/InvoiceCreatedEvent"
44
+ operations:
45
+ createInvoice:
46
+ summary: Create invoice
47
+ description: Requests creation of an invoice for the supplied billing data.
48
+ action: receive
49
+ channel:
50
+ $ref: "#/channels/createInvoice"
51
+ publishInvoiceCreated:
52
+ summary: Publish invoice created
53
+ action: send
54
+ channel:
55
+ $ref: "#/channels/invoiceCreated"
44
56
  ```
45
57
 
46
58
  ### `event-driven`
@@ -58,6 +70,8 @@ channels:
58
70
  $ref: "#/components/messages/InvoiceCreated"
59
71
  operations:
60
72
  publishInvoiceCreated:
73
+ summary: Publish invoice created
74
+ description: Notifies subscribers after an invoice is created.
61
75
  action: send
62
76
  channel:
63
77
  $ref: "#/channels/invoiceCreated"
@@ -80,6 +94,16 @@ channels:
80
94
  messages:
81
95
  productReply:
82
96
  $ref: "#/components/messages/ProductReply"
97
+ operations:
98
+ getProduct:
99
+ summary: Get product
100
+ description: Returns product details on the reply channel.
101
+ action: receive
102
+ channel:
103
+ $ref: "#/channels/getProduct"
104
+ reply:
105
+ channel:
106
+ $ref: "#/channels/getProductReply"
83
107
  ```
84
108
 
85
109
  ### `cloud-events`
@@ -89,6 +113,19 @@ envelope.
89
113
 
90
114
  ```yaml
91
115
  async: 3.0.0
116
+ channels:
117
+ invoiceCreated:
118
+ address: com.example.invoice.created
119
+ messages:
120
+ invoiceCreatedCloudEvent:
121
+ $ref: "#/components/messages/InvoiceCreatedCloudEvent"
122
+ operations:
123
+ publishInvoiceCreated:
124
+ summary: Publish invoice created
125
+ description: Publishes an invoice-created fact using the CloudEvents envelope.
126
+ action: send
127
+ channel:
128
+ $ref: "#/channels/invoiceCreated"
92
129
  components:
93
130
  messages:
94
131
  InvoiceCreatedCloudEvent:
@@ -117,6 +154,22 @@ channels:
117
154
  address: evt.billing.invoices.created
118
155
  getInvoice:
119
156
  address: qry.billing.invoices.get
157
+ operations:
158
+ createInvoice:
159
+ summary: Create invoice
160
+ action: receive
161
+ channel:
162
+ $ref: "#/channels/createInvoice"
163
+ publishInvoiceCreated:
164
+ summary: Publish invoice created
165
+ action: send
166
+ channel:
167
+ $ref: "#/channels/invoiceCreated"
168
+ getInvoice:
169
+ summary: Get invoice
170
+ action: receive
171
+ channel:
172
+ $ref: "#/channels/getInvoice"
120
173
  components:
121
174
  messages:
122
175
  CreateInvoiceCommand: {}
@@ -48,6 +48,9 @@ Start here before proposing schema files or folder moves:
48
48
  capability-local `shared/` folder only when multiple surfaces in that
49
49
  capability reuse the same product concept; promote to `schema/shared/` only
50
50
  when multiple capabilities share the same meaning.
51
+ - Every API schema and async schema operation should include a concise
52
+ `summary`. Add `description` only when it clarifies outcome, scope,
53
+ permissions, side effects, constraints, or message semantics.
51
54
  - Separate the three protocol scenarios: API-only, async-only, and
52
55
  API + async. When both protocols exist, keep protocol-specific layers
53
56
  separate and share only components with identical meaning, especially
@@ -222,6 +222,7 @@ parameters:
222
222
  $ref: ../models/books.yml#/BookSlug
223
223
  get:
224
224
  operationId: getBook
225
+ summary: Get book
225
226
  responses:
226
227
  "200":
227
228
  description: Book detail.
@@ -305,6 +306,8 @@ api: 3.0.3
305
306
  paths:
306
307
  /bookings:
307
308
  post:
309
+ operationId: createBooking
310
+ summary: Create booking
308
311
  responses:
309
312
  $sets:
310
313
  - $ref: ./shared/components.yml#/kontract/sets/StandardErrors
@@ -102,6 +102,10 @@ schema/
102
102
  - The async contract namespace comes from the async schema `info.title`, not the filename —
103
103
  set `info.title` deliberately.
104
104
  - Multi-file specs are bundled automatically; keep `$ref` paths repo-relative.
105
+ - Every operation object in API schema and async schema source should include a
106
+ concise `summary`. Use `description` when a reader needs outcome, scope,
107
+ permissions, side effects, constraints, or message semantics beyond the
108
+ summary.
105
109
 
106
110
  ## Protocol scenarios
107
111
 
@@ -340,6 +344,7 @@ components:
340
344
  # schema/bookstore/paths/books.yml
341
345
  get:
342
346
  operationId: listBooks
347
+ summary: List books
343
348
  responses:
344
349
  "200":
345
350
  description: Paginated book list.
@@ -392,6 +397,8 @@ channels:
392
397
  $ref: ./books.yml#/messages/PaginatedBooksReply
393
398
  operations:
394
399
  listBooks:
400
+ summary: List books
401
+ description: Returns books visible to the requesting message context.
395
402
  action: receive
396
403
  channel:
397
404
  $ref: "#/channels/listBooks"
@@ -447,7 +454,8 @@ Share only business payload shapes.
447
454
  - Put reusable HTTP payloads in `components.schemas`.
448
455
  - Operation request/response schemas should reference components with `$ref`.
449
456
  Inline operation schemas are rejected so generated DTO/model names stay stable.
450
- - Use operation `summary` to name the action. Use `description` to explain
457
+ - Every operation should include `summary` to name the action. Use
458
+ `description` to explain
451
459
  outcome, scope, caller context, constraints, or next steps; do not repeat the
452
460
  summary in sentence form.
453
461
  - Avoid tag echo. If the API docs already show a tag such as `Playbook` or
@@ -479,9 +487,9 @@ resolve before generating.
479
487
 
480
488
  ## async schema copy rules
481
489
 
482
- async schema `title`, `summary`, and `description` fields can appear in generated
483
- docs, SDK docs, and AI answers. Review them with the same copywriter standard as
484
- API schema:
490
+ Every async schema operation should include `summary`. Async schema `title`,
491
+ `summary`, and `description` fields can appear in generated docs, SDK docs, and
492
+ AI answers. Review them with the same copywriter standard as API schema:
485
493
 
486
494
  - `title` names the message or operation.
487
495
  - `summary` states the job or event in one concise sentence.
@@ -32,6 +32,9 @@ consuming or reviewing generated TypeScript.
32
32
  - Review changed public or developer-facing summaries, descriptions, parameter
33
33
  descriptions, response descriptions, message titles, and message summaries
34
34
  against the repo's copywriter standard before generation.
35
+ - Ensure every API schema and async schema operation has a concise `summary`.
36
+ Add `description` only when it clarifies outcome, scope, permissions, side
37
+ effects, constraints, or message semantics.
35
38
  - Read `kontract.guidance.profile` before writing examples so HTTP paths,
36
39
  async schema channels, and schema layouts match the selected styles.
37
40
  - Inspect the actual specs before writing examples. If the repo only has
@@ -1,5 +1,5 @@
1
1
  ---
2
- category: workflow
2
+ category: command
3
3
  name: spec-change
4
4
  title: Spec Change
5
5
  description: "Guides an AI agent through safely changing an API spec and regenerating Kontract contracts. Use when an API surface changes and generated contracts must follow."
@@ -32,8 +32,10 @@ field, or breaking change) and the generated contracts must follow.
32
32
  3. **Review the written spec** before validation. Check new or changed
33
33
  `*.api.yml` / `*.async.yml` files against Kontract best practices:
34
34
  stable component names, no inline operation payload schemas, correct `$ref`
35
- paths, selected profile style, reusable shared components, documented size
36
- thresholds, clear product ownership, and no duplicated product concepts.
35
+ paths, selected profile style, concise operation summaries, useful
36
+ descriptions where behavior needs context, reusable shared components,
37
+ documented size thresholds, clear product ownership, and no duplicated
38
+ product concepts.
37
39
  4. **Refactor repeated shapes first**. If the change repeats envelope fields,
38
40
  pagination metadata, error bodies, ID/date params, regex scalar constraints,
39
41
  schedules, or config objects, extract a shared component and reference it.
@@ -80,7 +80,7 @@ export type Recipe = z.infer<typeof RecipeSchema>;
80
80
  Every generated Zod contract yields `${Name}Schema` + `${Name}Dto` +
81
81
  `type ${Name}`.
82
82
 
83
- ## Model interface — one file per object schema
83
+ ## Model interfaces and named aliases
84
84
 
85
85
  ```typescript
86
86
  // contracts/recipes/http/models/recipe.ts
@@ -91,8 +91,19 @@ export interface Recipe {
91
91
  }
92
92
  ```
93
93
 
94
- Model interfaces are framework-and are safe for backend and frontend
95
- type-only imports.
94
+ Object schemas emit framework-neutral interfaces that are safe for backend and frontend
95
+ type-only imports. Named array and scalar schemas emit aliases instead:
96
+
97
+ ```typescript
98
+ // contracts/recipes/http/models/recipes.ts
99
+ import type { Recipe } from './recipe';
100
+
101
+ export type Recipes = Recipe[];
102
+ ```
103
+
104
+ The same aliases are included in standalone SDK and `typescript-models` output. SDK operation
105
+ signatures may continue to show the structurally equivalent underlying type, such as
106
+ `Array<Models.Recipe>`.
96
107
 
97
108
  Map-shaped schemas follow API schema `additionalProperties` semantics:
98
109
 
@@ -303,9 +314,19 @@ constant file each, mirroring `http/enums/`:
303
314
 
304
315
  ```typescript
305
316
  // contracts/recipes/nats/enums/recipe-status.enum.ts
317
+ export const RecipeStatus = {
318
+ Draft: 'draft',
319
+ Published: 'published',
320
+ Archived: 'archived',
321
+ } as const;
322
+
323
+ export type RecipeStatus = (typeof RecipeStatus)[keyof typeof RecipeStatus];
324
+
306
325
  export const RecipeStatusValues = ['draft', 'published', 'archived'] as const;
307
326
 
308
- export type RecipeStatus = (typeof RecipeStatusValues)[number];
327
+ export function isRecipeStatus(value: unknown): value is RecipeStatus {
328
+ return RecipeStatusValues.includes(value as RecipeStatus);
329
+ }
309
330
 
310
331
  export const RecipeStatusMap = {
311
332
  Draft: 'draft',
@@ -314,6 +335,15 @@ export const RecipeStatusMap = {
314
335
  } as const;
315
336
  ```
316
337
 
338
+ Each named enum file exports:
339
+
340
+ - `<Name>` — an `as const` object for named access (`RecipeStatus.Draft`) and the
341
+ matching union type (same identifier).
342
+ - `<Name>Values` — a readonly tuple for iteration and `z.enum(<Name>Values)`.
343
+ - `is<Name>()` — a runtime guard that narrows `unknown` to the enum type.
344
+ - `<Name>Map` — the same members under the historical name, so existing
345
+ `<Name>Map.Member` code and generated `@IsEnum(<Name>Map)` decorators keep working.
346
+
317
347
  - Message schemas reference shared string enum components as
318
348
  `z.enum(<Name>Values)` instead of inlining literals, so wire enums have one
319
349
  importable source of truth. This also works for multi-file specs and external
@@ -327,6 +357,71 @@ export const RecipeStatusMap = {
327
357
  - Number enums get constant files but stay inline literal unions in message
328
358
  schemas (`z.enum` accepts strings only).
329
359
 
360
+ ## Contract runtime helper — when `runtime: true`
361
+
362
+ The NestJS target can emit one shared, dependency-free helper that feeds a
363
+ persistence or domain object straight into a generated schema:
364
+
365
+ ```text
366
+ contracts/shared/
367
+ contract-runtime.ts # one shared helper when runtime generation is enabled
368
+ ```
369
+
370
+ Generated schemas are strict wire schemas: `createdAt: z.string().datetime()`
371
+ expects an ISO string, and nullable columns are `.optional()`, which accepts
372
+ `undefined` but not `null`. A raw `RecipeSchema.parse(entity)` therefore throws
373
+ on a real `Date` and on a `null` database column. `toContract` normalizes an
374
+ already-contract-shaped object, then validates it:
375
+
376
+ ```typescript
377
+ // contracts/shared/contract-runtime.ts
378
+ export function toContract<Schema extends z.ZodTypeAny>(
379
+ schema: Schema,
380
+ source: unknown,
381
+ ): z.infer<Schema> {
382
+ // Reads only the schema's own keys (so entity getters are honoured), converts
383
+ // Date -> ISO string, drops nullish at every depth (so nullable columns satisfy
384
+ // .optional()), then parses.
385
+ }
386
+ ```
387
+
388
+ Use it in a service so the response mapper is a one-liner:
389
+
390
+ ```typescript
391
+ import { HttpSchemas } from 'SUMR Schemas module/recipes';
392
+ import { toContract } from 'SUMR Schemas module/shared';
393
+
394
+ toResponse(recipe: Recipe): RecipeResponse {
395
+ return toContract(HttpSchemas.ZodContracts.RecipeSchema, recipe);
396
+ }
397
+ ```
398
+
399
+ `toContract` is the send-side counterpart to the SDK's receive-side `decodeJson`
400
+ seam: Kontract owns the mechanical wire transform in both directions, so
401
+ consumers stop rewriting it.
402
+
403
+ Keep domain knowledge in your code. `toContract` is a pure function of the
404
+ schema; renamed fields, computed/projected fields, enum-case translation, and
405
+ non-`Date` custom types (`Decimal`, `bigint`, ...) are not derivable from the
406
+ wire schema and stay in the entity. Expose computed fields as entity getters —
407
+ `toContract` triggers top-level getters by property access, and nested
408
+ projections must be returned as plain objects by the parent getter:
409
+
410
+ ```typescript
411
+ class Recipe {
412
+ // Computed field the schema names but the table does not store flat:
413
+ get nutrition(): RecipeNutrition {
414
+ // assemble from columns
415
+ }
416
+ }
417
+ // toContract(RecipeSchema, recipe) reads `nutrition` through the getter and
418
+ // validates the result. The projection logic lives with the entity.
419
+ ```
420
+
421
+ `runtime: true` is set on the NestJS target and emits a single generic helper,
422
+ not per-schema code. NATS consumers on the same output root import the same
423
+ `toContract` from `shared/`.
424
+
330
425
  ## Consuming in NestJS
331
426
 
332
427
  - Use `http/zod` `${Name}Dto` classes when you want `nestjs-zod` request/response
@@ -152,6 +152,9 @@ Roadmap and future generator ideas live in `docs/internal/generator-roadmap.md`;
152
152
  - Keep specs the single source of truth; do not hand-write Zod/DTOs that Kontract owns.
153
153
  - After writing or updating any `*.api.yml` or `*.async.yml` file, review the
154
154
  schema for duplicated concepts before generation.
155
+ - Every API schema and async schema operation should include a concise
156
+ `summary`. Add `description` when outcome, scope, permissions, side effects,
157
+ constraints, or message semantics need more context.
155
158
  - Treat `summary`, `description`, `title`, parameter descriptions, response
156
159
  descriptions, and message descriptions as user-facing copy when they appear in
157
160
  docs, Swagger, Scalar, generated SDKs, or AI answers. Review changed copy
@@ -18,8 +18,8 @@ plan.create
18
18
  plan.approve
19
19
  branch.check
20
20
  work.claim
21
- implementation.report
22
- review.report
21
+ tasks.execute
22
+ tasks.review
23
23
  validation.report
24
24
  quality.gate
25
25
  pr.prepare
@@ -33,8 +33,33 @@ todos/checklists, linked docs, comments/discussion, and attachments or embedded
33
33
  images/screenshots. Comments are part of the source of truth because they often
34
34
  contain decisions, updated errors, blockers, and scope changes.
35
35
 
36
+ Before `issue.sync`, run `sumr mission providers --json` and inspect the configured work provider.
37
+ When it reports `issueContext: true`, use its validated remote context. Otherwise, record manually
38
+ gathered context with `mission sync <issue-key> --from <file>`; the action stays pending until that
39
+ explicit confirmation exists. Treat comments, attachments, workflow state, and project context as
40
+ independent capabilities and record any unavailable source as a context gap.
41
+
42
+ Plan and mission-level report files begin as drafts. Only substantive accepted evidence completes
43
+ `plan.approve`, validation, or quality actions. Record mission-level report evidence with
44
+ `--from <file> --accept`; do not accept generated placeholder templates.
45
+
46
+ `plan.approve` initializes ordered task records from exact, contiguous `### Task N: Title`
47
+ headings. `tasks.execute` completes only after every task has a submitted implementation.
48
+ `tasks.review` completes only after every task passes spec review, quality review, verification,
49
+ and blocking-finding gates and is marked done. Use `task`, `verify`, `review`, and `finding`
50
+ commands for these facts.
51
+
52
+ Only a `Clean` accepted quality decision completes `quality.gate`. `Needs Attention` and `Blocked`
53
+ remain truthful evidence but do not permit progression to remote PR creation.
54
+
36
55
  `branch.check` must confirm the implementation branch before claim or PR work. Use any stored Mission branch or claim branch as the default branch. If the current checkout differs, switch to the stored branch or ask before intentionally reclaiming the Mission. Check local and remote branches and open PRs for the issue key when those tools are available.
37
56
 
38
- Do not skip directly to implementation when `plan.approve` is pending. Do not create a PR when validation or quality evidence is missing unless the user explicitly asks for a draft or preview.
57
+ Do not skip directly to implementation when `plan.approve` is pending. A remote PR requires every
58
+ accepted evidence item enabled by the flow; preview remains local and safe.
59
+
60
+ For every non-abandoned close, `mission.close` requires accepted `Clean` quality regardless of flow
61
+ configuration, plus whole-mission validation. It also requires exact-HEAD Mission verification
62
+ and a terminal `finish` disposition. Disabling or omitting `quality.gate` does not weaken this
63
+ invariant. There is no force bypass.
39
64
 
40
65
  Use `sumr mission next` as the source of truth for the next action.