@sumrco/cli 0.3.5 → 0.3.7
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.
- package/ai/modules/kontract/resources/api-generation-standards.rf.md +2 -0
- package/ai/modules/kontract/resources/authoring/configuration.rf.md +13 -0
- package/ai/modules/kontract/resources/authoring/design-profile/api-styles.rf.md +11 -0
- package/ai/modules/kontract/resources/authoring/design-profile/async-styles.rf.md +53 -0
- package/ai/modules/kontract/resources/authoring/overview.md +3 -0
- package/ai/modules/kontract/resources/authoring/schema-reuse.rf.md +3 -0
- package/ai/modules/kontract/resources/authoring/spec-layout.rf.md +12 -4
- package/ai/modules/kontract/resources/authoring/team-members/spec-author.tm.md +3 -0
- package/ai/modules/kontract/resources/authoring/workflows/{spec-change.wf.md → spec-change.cmd.md} +5 -3
- package/ai/modules/kontract/resources/generated-output.rf.md +99 -4
- package/ai/modules/kontract/resources/overview.md +3 -0
- package/ai/modules/mission/resources/flow-actions.rf.md +28 -3
- package/ai/modules/mission/resources/flow-config.rf.md +2 -2
- package/ai/modules/mission/resources/flow-safety-boundaries.rf.md +7 -0
- package/ai/modules/mission/resources/overview.md +69 -11
- package/ai/modules/mission/resources/stage-closeout.rf.md +15 -5
- package/ai/modules/mission/resources/stage-delivery.rf.md +19 -6
- package/ai/modules/mission/resources/stage-intake.rf.md +58 -8
- package/ai/modules/mission/resources/stage-planning.rf.md +17 -3
- package/ai/modules/mission/resources/stage-pull-request.rf.md +5 -2
- package/ai/modules/mission/resources/stage-quality.rf.md +25 -4
- package/ai/modules/mission/resources/team-members/delivery-lead.tm.md +5 -3
- package/ai/modules/mission/resources/team-members/implementer.tm.md +10 -3
- package/ai/modules/mission/resources/team-members/planner.tm.md +25 -15
- package/ai/modules/mission/resources/team-members/pr-writer.tm.md +4 -3
- package/ai/modules/mission/resources/team-members/product-owner.tm.md +8 -2
- package/ai/modules/mission/resources/team-members/quality-lead.tm.md +16 -3
- package/ai/modules/mission/resources/workflows/{daily-triage.wf.md → daily-triage.cmd.md} +5 -4
- package/ai/modules/mission/resources/workflows/{full-delivery.wf.md → full-delivery.cmd.md} +3 -3
- package/ai/modules/mission/resources/workflows/{mission-cycle.wf.md → mission-cycle.cmd.md} +9 -5
- package/ai/modules/mission/resources/workflows/{planning-only.wf.md → planning-only.cmd.md} +5 -4
- package/ai/modules/mission/resources/workflows/{pr-assist.wf.md → pr-assist.cmd.md} +5 -4
- package/ai/modules/mission/resources/workflows/{standard-delivery.wf.md → standard-delivery.cmd.md} +3 -3
- package/ai/modules/mission/sumr.module.yaml +20 -2
- package/ai/modules/playbook/resources/authoring/content-structure.rf.md +16 -1
- package/ai/modules/playbook/resources/authoring/extraction.rf.md +4 -2
- package/ai/modules/playbook/resources/authoring/markdown.rf.md +20 -0
- package/ai/modules/playbook/resources/authoring/overview.md +9 -1
- package/ai/modules/playbook/resources/authoring/patterns.rf.md +99 -0
- package/ai/modules/playbook/sumr.module.yaml +3 -0
- package/index.js +475 -319
- package/package.json +8 -8
|
@@ -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
|
-
-
|
|
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
|
|
483
|
-
|
|
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
|
package/ai/modules/kontract/resources/authoring/workflows/{spec-change.wf.md → spec-change.cmd.md}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
category:
|
|
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,
|
|
36
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
22
|
-
review
|
|
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.
|
|
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.
|
|
@@ -14,9 +14,9 @@ Mission flow is repo configuration in `sumr.yaml`; runtime state stays in `.sumr
|
|
|
14
14
|
```yaml
|
|
15
15
|
mission:
|
|
16
16
|
tracker:
|
|
17
|
-
provider:
|
|
17
|
+
provider: {{MISSION_TRACKER_PROVIDER}}
|
|
18
18
|
git:
|
|
19
|
-
provider:
|
|
19
|
+
provider: {{MISSION_GIT_PROVIDER}}
|
|
20
20
|
prMode: ask
|
|
21
21
|
flow:
|
|
22
22
|
preset: standard-delivery
|
|
@@ -21,3 +21,10 @@ External writes include:
|
|
|
21
21
|
- dispatching CI/deployments
|
|
22
22
|
|
|
23
23
|
Default to preview-only. Use `sumr mission pr <key> --preview` before `--create-draft` or `--create`.
|
|
24
|
+
|
|
25
|
+
PR mode `preview` forbids remote creation. Remote creation also requires a reviewed placeholder-free
|
|
26
|
+
preview accepted with `--accept-preview`, an unchanged preview hash, accepted required evidence, a
|
|
27
|
+
`Clean` quality gate when configured, and the recorded Mission branch.
|
|
28
|
+
|
|
29
|
+
Cleanup is preview-only by default. Delete closed cache only with both `--delete` and `--yes`; never
|
|
30
|
+
delete an open Mission.
|
|
@@ -13,6 +13,15 @@ Use Mission when AI-assisted work needs durable state across sessions, agents, t
|
|
|
13
13
|
|
|
14
14
|
{{MISSION_IDENTIFIER_GUIDANCE}}
|
|
15
15
|
|
|
16
|
+
## Configured Providers
|
|
17
|
+
|
|
18
|
+
- Work provider: `{{MISSION_TRACKER_PROVIDER_LABEL}}` (`{{MISSION_TRACKER_PROVIDER}}`)
|
|
19
|
+
- Repository provider: `{{MISSION_GIT_PROVIDER_LABEL}}` (`{{MISSION_GIT_PROVIDER}}`)
|
|
20
|
+
|
|
21
|
+
Run `sumr mission providers --json` before assuming that either configured provider supports a
|
|
22
|
+
capability. The runtime catalogs, not product names or remembered behavior, are the source of
|
|
23
|
+
truth.
|
|
24
|
+
|
|
16
25
|
## Configured Mission Flow
|
|
17
26
|
|
|
18
27
|
This repo uses `{{MISSION_FLOW_PRESET}}`.
|
|
@@ -31,18 +40,42 @@ PR mode: `{{MISSION_PR_MODE}}`
|
|
|
31
40
|
|
|
32
41
|
```bash
|
|
33
42
|
sumr mission init
|
|
34
|
-
sumr mission
|
|
35
|
-
sumr mission
|
|
36
|
-
sumr mission
|
|
37
|
-
sumr mission
|
|
38
|
-
sumr mission
|
|
39
|
-
sumr mission
|
|
40
|
-
sumr mission
|
|
41
|
-
sumr mission
|
|
42
|
-
sumr mission
|
|
43
|
-
sumr mission
|
|
43
|
+
sumr mission providers --json
|
|
44
|
+
sumr mission start {{MISSION_ISSUE_KEY_EXAMPLE}} --title "Fix checkout flow"
|
|
45
|
+
sumr mission sync {{MISSION_ISSUE_KEY_EXAMPLE}}
|
|
46
|
+
sumr mission status {{MISSION_ISSUE_KEY_EXAMPLE}}
|
|
47
|
+
sumr mission plan {{MISSION_ISSUE_KEY_EXAMPLE}} --from plan.md
|
|
48
|
+
sumr mission approve {{MISSION_ISSUE_KEY_EXAMPLE}}
|
|
49
|
+
sumr mission claim {{MISSION_ISSUE_KEY_EXAMPLE}} --agent <actor> --workspace-owner <owner> --confirm-branch
|
|
50
|
+
sumr mission task list {{MISSION_ISSUE_KEY_EXAMPLE}}
|
|
51
|
+
sumr mission task start {{MISSION_ISSUE_KEY_EXAMPLE}} task-1 --actor <actor>
|
|
52
|
+
sumr mission task submit {{MISSION_ISSUE_KEY_EXAMPLE}} task-1 --from task-1.md --actor <actor>
|
|
53
|
+
sumr mission verify record {{MISSION_ISSUE_KEY_EXAMPLE}} --from task-receipt.json
|
|
54
|
+
sumr mission review {{MISSION_ISSUE_KEY_EXAMPLE}} task-1 --from spec-review.json
|
|
55
|
+
sumr mission review {{MISSION_ISSUE_KEY_EXAMPLE}} task-1 --from quality-review.json
|
|
56
|
+
sumr mission finding resolve {{MISSION_ISSUE_KEY_EXAMPLE}} task-1 <finding-id> --resolution fixed --reason "Fixed and ready for re-review" --actor <actor>
|
|
57
|
+
sumr mission task complete {{MISSION_ISSUE_KEY_EXAMPLE}} task-1 --actor <actor>
|
|
58
|
+
sumr mission report {{MISSION_ISSUE_KEY_EXAMPLE}} --type validation --from validation.md --accept
|
|
59
|
+
sumr mission report {{MISSION_ISSUE_KEY_EXAMPLE}} --type quality --from quality.md --accept
|
|
60
|
+
sumr mission verify record {{MISSION_ISSUE_KEY_EXAMPLE}} --from mission-receipt.json
|
|
61
|
+
sumr mission pr {{MISSION_ISSUE_KEY_EXAMPLE}} --preview
|
|
62
|
+
sumr mission pr {{MISSION_ISSUE_KEY_EXAMPLE}} --accept-preview
|
|
63
|
+
sumr mission finish {{MISSION_ISSUE_KEY_EXAMPLE}} --from disposition.json
|
|
64
|
+
sumr mission close {{MISSION_ISSUE_KEY_EXAMPLE}}
|
|
44
65
|
```
|
|
45
66
|
|
|
67
|
+
## Facts and Methodology
|
|
68
|
+
|
|
69
|
+
Mission records facts: accepted-plan tasks, claims, blockers, implementation submissions,
|
|
70
|
+
verification receipts, reviews, finding resolutions, workspace provenance, and finish disposition.
|
|
71
|
+
Playbook defines methodology: how to research and size work, which checks to run, which reviewers to
|
|
72
|
+
dispatch, and whether to use TDD, debugging protocols, or worktrees.
|
|
73
|
+
|
|
74
|
+
Mission ledger, evidence-import, and finish commands never push, create or remove worktrees, delete
|
|
75
|
+
branches, merge, or mutate a work provider. The explicit bounded push exception is
|
|
76
|
+
`pr --create-draft` and `pr --create`: after every PR safety gate passes, these commands ask for
|
|
77
|
+
human approval before pushing and creating the remote PR.
|
|
78
|
+
|
|
46
79
|
## Operating Rules
|
|
47
80
|
|
|
48
81
|
- Check `sumr mission status <issueKey>` before editing for existing work.
|
|
@@ -52,10 +85,35 @@ sumr mission close GH-123
|
|
|
52
85
|
rely on the issue description alone.
|
|
53
86
|
- Stop on `human` and `ask` gates until the user or repo automation policy explicitly approves continuing.
|
|
54
87
|
- Treat `pr.create`, issue comments, issue transitions, merges, deploys, and other external mutations as human-approved actions only.
|
|
55
|
-
- Store durable plans,
|
|
88
|
+
- Store durable plans, task facts, receipts, reviews, validation, PR previews, blockers, and
|
|
89
|
+
handoffs in Mission state.
|
|
90
|
+
- Treat generated plan/report templates as drafts. Only substantive accepted evidence satisfies a flow step.
|
|
91
|
+
- Write accepted plans with contiguous top-level headings in the exact form
|
|
92
|
+
`### Task N: Title`, starting at task 1. Approval creates the ordered execution ledger.
|
|
93
|
+
- Use `task submit` for task implementation evidence and structured `review` imports for task
|
|
94
|
+
review. These task facts are the only sources for the execution and review task gates.
|
|
95
|
+
- Resolve critical or important findings with `finding resolve`, then import a later fresh passing
|
|
96
|
+
review of the same kind before completing the task.
|
|
97
|
+
- Treat verification receipts as attestations from the responsible tool or human. Mission validates
|
|
98
|
+
and records them but never executes the recorded command.
|
|
99
|
+
- Check `sumr mission providers --json` before synchronization. When the configured work provider
|
|
100
|
+
reports `issueContext: true`, run `mission sync` and use its validated context. Otherwise, gather
|
|
101
|
+
the complete work item and record it with `mission sync --from <file>` before planning; do not
|
|
102
|
+
imply that remote context was fetched.
|
|
103
|
+
- Never combine plan creation with approval. Stop after the draft and wait for the separate
|
|
104
|
+
`mission approve` action at a human gate.
|
|
105
|
+
- At an `ask` branch gate, confirm the selected branch before passing `--confirm-branch` to claim.
|
|
106
|
+
- Set `--workspace-owner` explicitly to `user`, `mission`, `platform`, or `external`; Mission never
|
|
107
|
+
infers ownership from the checkout path.
|
|
108
|
+
- Edit the PR preview, remove placeholders/local paths, then record review with `--accept-preview`.
|
|
109
|
+
- Use `mission reopen --reason ...` for QA rejection; it invalidates stale validation and quality.
|
|
110
|
+
- Treat `mission clean` as preview-only unless the user explicitly supplies `--delete --yes`.
|
|
56
111
|
- Worktrees are optional. The default implementation path is the current checkout.
|
|
57
112
|
- If a worktree is used, record branch, target branch, changed files, conflicts, and merge-back status before closing.
|
|
58
113
|
- Do not close a mission while the only copy of the work is hidden in a worktree.
|
|
114
|
+
- Record `finish` explicitly. `handoff_required` is nonterminal; delivered work requires
|
|
115
|
+
`pr_created`, `merged`, or `branch_kept`, while `abandoned` requires an actor and reason.
|
|
116
|
+
- `mission close` has no force bypass.
|
|
59
117
|
- Do not invent local `status.json`, `feature_list.json`, `thoughts/`, or duplicate task-state folders.
|
|
60
118
|
|
|
61
119
|
## Worktree Merge-Back Contract
|