@ogygie/generate 0.0.0-stage → 0.19.0

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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -2
  3. package/dist/behavior-binding.d.ts +47 -0
  4. package/dist/behavior-grammar.d.ts +53 -0
  5. package/dist/check-spec.d.ts +53 -0
  6. package/dist/chunk-WVFHAPGC.js +10992 -0
  7. package/dist/cli/check-command.d.ts +3 -0
  8. package/dist/cli/fill-command.d.ts +39 -0
  9. package/dist/cli/generate-command.d.ts +8 -0
  10. package/dist/cli/generate-screen-command.d.ts +6 -0
  11. package/dist/cli/output.d.ts +9 -0
  12. package/dist/cli/preview-command.d.ts +19 -0
  13. package/dist/cli/project.d.ts +97 -0
  14. package/dist/cli/run.d.ts +13 -0
  15. package/dist/cli/run.js +1127 -0
  16. package/dist/cli/schemas-command.d.ts +31 -0
  17. package/dist/cli/verify-command.d.ts +3 -0
  18. package/dist/consumed-feature.d.ts +32 -0
  19. package/dist/emit/db.d.ts +27 -0
  20. package/dist/emit/factories.d.ts +14 -0
  21. package/dist/emit/hole-doc.d.ts +18 -0
  22. package/dist/emit/hole-tests.d.ts +28 -0
  23. package/dist/emit/manifest-entry.d.ts +44 -0
  24. package/dist/emit/mssql/migration.d.ts +2 -0
  25. package/dist/emit/mssql/repository.d.ts +17 -0
  26. package/dist/emit/mssql/sql-types.d.ts +23 -0
  27. package/dist/emit/mssql/statements.d.ts +55 -0
  28. package/dist/emit/mssql/stub.d.ts +17 -0
  29. package/dist/emit/names.d.ts +34 -0
  30. package/dist/emit/plan.d.ts +428 -0
  31. package/dist/emit/repository.d.ts +16 -0
  32. package/dist/emit/routes.d.ts +22 -0
  33. package/dist/emit/runtime.d.ts +47 -0
  34. package/dist/emit/screen/container.d.ts +17 -0
  35. package/dist/emit/screen/fixtures.d.ts +14 -0
  36. package/dist/emit/screen/hole-doc.d.ts +2 -0
  37. package/dist/emit/screen/previews.d.ts +24 -0
  38. package/dist/emit/screen/queries.d.ts +10 -0
  39. package/dist/emit/screen/shared.d.ts +35 -0
  40. package/dist/emit/screen/spec-contracts.d.ts +10 -0
  41. package/dist/emit/screen/tests-static.d.ts +21 -0
  42. package/dist/emit/screen/tests.d.ts +19 -0
  43. package/dist/emit/screen/views.d.ts +10 -0
  44. package/dist/emit/screen/writes.d.ts +9 -0
  45. package/dist/emit/screen-plan.d.ts +187 -0
  46. package/dist/emit/service.d.ts +18 -0
  47. package/dist/emit/spec-contracts.d.ts +27 -0
  48. package/dist/emit/tests.d.ts +3 -0
  49. package/dist/fill/body.d.ts +26 -0
  50. package/dist/fill/fill.d.ts +97 -0
  51. package/dist/fill/model-draw.d.ts +25 -0
  52. package/dist/generate-feature.d.ts +23 -0
  53. package/dist/generate-screen.d.ts +19 -0
  54. package/dist/generation-block.schema.d.ts +1279 -0
  55. package/dist/hole-shape.d.ts +100 -0
  56. package/dist/index.d.ts +45 -0
  57. package/dist/index.js +401 -0
  58. package/dist/manifest-generation.schema.d.ts +239 -0
  59. package/dist/motif-catalog.d.ts +175 -0
  60. package/dist/package-root.d.ts +5 -0
  61. package/dist/prompt-card.d.ts +3 -0
  62. package/dist/schema-checks.d.ts +32 -0
  63. package/dist/schemas/draft.d.ts +111 -0
  64. package/dist/screen-block.schema.d.ts +146 -0
  65. package/dist/screen-checks.d.ts +34 -0
  66. package/dist/screen-grammar.d.ts +36 -0
  67. package/dist/screen-vocabulary.d.ts +47 -0
  68. package/dist/spec-sections.d.ts +51 -0
  69. package/dist/verify-generation.d.ts +93 -0
  70. package/dist/vocabulary.d.ts +39 -0
  71. package/dist/zod-introspection.d.ts +119 -0
  72. package/holes-library/27560e1760bb184c.json +28 -0
  73. package/holes-library/2c26136fc6bff99a.json +30 -0
  74. package/holes-library/43a27770407bb38a.json +27 -0
  75. package/holes-library/46e67880a81012bc.json +27 -0
  76. package/holes-library/48dc5c44dc2cf3b7.json +32 -0
  77. package/holes-library/63d0825a61f6f5d3.json +27 -0
  78. package/holes-library/6784ed6c8e353dac.json +27 -0
  79. package/holes-library/8b4e4c8f04a5fc6a.json +31 -0
  80. package/holes-library/README.md +33 -0
  81. package/holes-library/d3597f50c265ba0c.json +27 -0
  82. package/holes-library/e48695e16221ff1a.json +32 -0
  83. package/package.json +59 -3
@@ -0,0 +1,239 @@
1
+ /**
2
+ * @intent The `generation` block of `ogygie.manifest.json`: what is PRODUCT
3
+ * and not feature (DECISIONS.md D18, D33, D34). `target` says where and how a
4
+ * feature is emitted — database, tenancy, tests, migrations folder, column
5
+ * casing — and the `# Génération` block of a spec never knows it. A guard is a
6
+ * function `(app, request) → Promise<context>` exported by a module of the API
7
+ * app; the block names it (`module`, `export`), the type it returns when richer
8
+ * than the tenant context (`context`), the French case meaning « a session this
9
+ * guard accepts » (`valid.case`), other VALID sessions and their case
10
+ * (`variants[]`, another role) and every REFUSAL it can answer (`denials[]`:
11
+ * status, code, case phrase, `perFeature` when an operation may rename the
12
+ * code) — each with the test fixture that provokes it, exported by
13
+ * `fixturesModule`. `signature` names the function giving the signer of a
14
+ * signed write. `testBench` is the product's in-memory bench, `tenantTable`
15
+ * the table the tenant column references, `tenantContext` the product's alias
16
+ * of TenantContext — both required when `target.tenancy` is `column`.
17
+ * Declared once per product, never repeated spec by spec.
18
+ *
19
+ * The block is OPTIONAL and owned by this package: the core's manifest schema
20
+ * strips the keys it does not know, so a product declares it without any
21
+ * change to `@ogygie/core`.
22
+ */
23
+ import { z } from "zod";
24
+ import { type OgygieError } from "@ogygie/core/errors";
25
+ /** A function exported by a module of the API app, path relative to the app folder. */
26
+ export declare const ModuleExportSchema: z.ZodObject<{
27
+ module: z.ZodString;
28
+ export: z.ZodString;
29
+ }, z.core.$strict>;
30
+ export type ModuleExport = z.infer<typeof ModuleExportSchema>;
31
+ /** A TYPE exported by a module of the API app. */
32
+ export declare const ModuleTypeSchema: z.ZodObject<{
33
+ module: z.ZodString;
34
+ export: z.ZodString;
35
+ }, z.core.$strict>;
36
+ export type ModuleType = z.infer<typeof ModuleTypeSchema>;
37
+ /** D33: the emission target of the product. */
38
+ export declare const GenerationTargetSchema: z.ZodObject<{
39
+ database: z.ZodEnum<{
40
+ "postgres-drizzle": "postgres-drizzle";
41
+ "mssql-raw": "mssql-raw";
42
+ }>;
43
+ tenancy: z.ZodEnum<{
44
+ column: "column";
45
+ none: "none";
46
+ }>;
47
+ tests: z.ZodEnum<{
48
+ bench: "bench";
49
+ stub: "stub";
50
+ }>;
51
+ migrations: z.ZodString;
52
+ naming: z.ZodEnum<{
53
+ camel: "camel";
54
+ pascal: "pascal";
55
+ }>;
56
+ schema: z.ZodOptional<z.ZodString>;
57
+ validation: z.ZodOptional<z.ZodEnum<{
58
+ "type-provider": "type-provider";
59
+ "handler-parse": "handler-parse";
60
+ }>>;
61
+ contractViolationCode: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strict>;
63
+ export type GenerationTarget = z.infer<typeof GenerationTargetSchema>;
64
+ export type ValidationMode = NonNullable<GenerationTarget["validation"]>;
65
+ /** D37: the validation mode of a target, `type-provider` when it says nothing. */
66
+ export declare function validationOf(target: Pick<GenerationTarget, "validation">): ValidationMode;
67
+ /** D37: the code a target answers to a violated contract, the generator's word when it says nothing. */
68
+ export declare function contractViolationCodeOf(target: Pick<GenerationTarget, "contractViolationCode"> | null | undefined): string;
69
+ /**
70
+ * D43: the FRONT target of the product — how a screen (D41) is emitted and
71
+ * tested. `contracts` is the import specifier of a consumed feature's
72
+ * `schemas.ts` from the front, `{feature}` replaced by the feature id;
73
+ * `testBench` the function of the front app rendering an element under its
74
+ * providers (query client, i18n), path relative to the front app. Its shape
75
+ * follows `tests`: on `jsdom` the render of Testing Library, `(element) =>
76
+ * render`; on `static-render` (lot 4 M2) `(element, arrange?) => string` — a
77
+ * fresh query client that `arrange` fills before the element is rendered to
78
+ * HTML by `renderToStaticMarkup`, and the markup returned.
79
+ */
80
+ export declare const FrontTargetSchema: z.ZodObject<{
81
+ tests: z.ZodEnum<{
82
+ jsdom: "jsdom";
83
+ "static-render": "static-render";
84
+ }>;
85
+ i18n: z.ZodEnum<{
86
+ lingui: "lingui";
87
+ }>;
88
+ router: z.ZodEnum<{
89
+ code: "code";
90
+ file: "file";
91
+ }>;
92
+ contracts: z.ZodString;
93
+ testBench: z.ZodObject<{
94
+ module: z.ZodString;
95
+ export: z.ZodString;
96
+ }, z.core.$strict>;
97
+ stylesheet: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>;
99
+ export type FrontTarget = z.infer<typeof FrontTargetSchema>;
100
+ export declare const GuardDenialSchema: z.ZodObject<{
101
+ status: z.ZodNumber;
102
+ code: z.ZodString;
103
+ case: z.ZodString;
104
+ fixture: z.ZodString;
105
+ perFeature: z.ZodOptional<z.ZodBoolean>;
106
+ }, z.core.$strict>;
107
+ export type GuardDenial = z.infer<typeof GuardDenialSchema>;
108
+ /** D34: another VALID session — a role — whose case becomes a word of the vocabulary. */
109
+ export declare const GuardVariantSchema: z.ZodObject<{
110
+ case: z.ZodString;
111
+ fixture: z.ZodString;
112
+ }, z.core.$strict>;
113
+ export type GuardVariant = z.infer<typeof GuardVariantSchema>;
114
+ export declare const GuardRegistryEntrySchema: z.ZodObject<{
115
+ module: z.ZodString;
116
+ export: z.ZodString;
117
+ context: z.ZodOptional<z.ZodObject<{
118
+ module: z.ZodString;
119
+ export: z.ZodString;
120
+ }, z.core.$strict>>;
121
+ valid: z.ZodObject<{
122
+ case: z.ZodString;
123
+ fixture: z.ZodString;
124
+ }, z.core.$strict>;
125
+ variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
126
+ case: z.ZodString;
127
+ fixture: z.ZodString;
128
+ }, z.core.$strict>>>;
129
+ denials: z.ZodArray<z.ZodObject<{
130
+ status: z.ZodNumber;
131
+ code: z.ZodString;
132
+ case: z.ZodString;
133
+ fixture: z.ZodString;
134
+ perFeature: z.ZodOptional<z.ZodBoolean>;
135
+ }, z.core.$strict>>;
136
+ fixturesModule: z.ZodString;
137
+ }, z.core.$strict>;
138
+ export type GuardRegistryEntry = z.infer<typeof GuardRegistryEntrySchema>;
139
+ export declare const ManifestGenerationSchema: z.ZodObject<{
140
+ target: z.ZodObject<{
141
+ database: z.ZodEnum<{
142
+ "postgres-drizzle": "postgres-drizzle";
143
+ "mssql-raw": "mssql-raw";
144
+ }>;
145
+ tenancy: z.ZodEnum<{
146
+ column: "column";
147
+ none: "none";
148
+ }>;
149
+ tests: z.ZodEnum<{
150
+ bench: "bench";
151
+ stub: "stub";
152
+ }>;
153
+ migrations: z.ZodString;
154
+ naming: z.ZodEnum<{
155
+ camel: "camel";
156
+ pascal: "pascal";
157
+ }>;
158
+ schema: z.ZodOptional<z.ZodString>;
159
+ validation: z.ZodOptional<z.ZodEnum<{
160
+ "type-provider": "type-provider";
161
+ "handler-parse": "handler-parse";
162
+ }>>;
163
+ contractViolationCode: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strict>;
165
+ tenantTable: z.ZodOptional<z.ZodString>;
166
+ tenantContext: z.ZodOptional<z.ZodObject<{
167
+ module: z.ZodString;
168
+ export: z.ZodString;
169
+ }, z.core.$strict>>;
170
+ databasePort: z.ZodOptional<z.ZodObject<{
171
+ module: z.ZodString;
172
+ export: z.ZodString;
173
+ }, z.core.$strict>>;
174
+ signature: z.ZodOptional<z.ZodObject<{
175
+ module: z.ZodString;
176
+ export: z.ZodString;
177
+ }, z.core.$strict>>;
178
+ testBench: z.ZodObject<{
179
+ module: z.ZodString;
180
+ export: z.ZodString;
181
+ }, z.core.$strict>;
182
+ guards: z.ZodRecord<z.ZodString, z.ZodObject<{
183
+ module: z.ZodString;
184
+ export: z.ZodString;
185
+ context: z.ZodOptional<z.ZodObject<{
186
+ module: z.ZodString;
187
+ export: z.ZodString;
188
+ }, z.core.$strict>>;
189
+ valid: z.ZodObject<{
190
+ case: z.ZodString;
191
+ fixture: z.ZodString;
192
+ }, z.core.$strict>;
193
+ variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
194
+ case: z.ZodString;
195
+ fixture: z.ZodString;
196
+ }, z.core.$strict>>>;
197
+ denials: z.ZodArray<z.ZodObject<{
198
+ status: z.ZodNumber;
199
+ code: z.ZodString;
200
+ case: z.ZodString;
201
+ fixture: z.ZodString;
202
+ perFeature: z.ZodOptional<z.ZodBoolean>;
203
+ }, z.core.$strict>>;
204
+ fixturesModule: z.ZodString;
205
+ }, z.core.$strict>>;
206
+ front: z.ZodOptional<z.ZodObject<{
207
+ tests: z.ZodEnum<{
208
+ jsdom: "jsdom";
209
+ "static-render": "static-render";
210
+ }>;
211
+ i18n: z.ZodEnum<{
212
+ lingui: "lingui";
213
+ }>;
214
+ router: z.ZodEnum<{
215
+ code: "code";
216
+ file: "file";
217
+ }>;
218
+ contracts: z.ZodString;
219
+ testBench: z.ZodObject<{
220
+ module: z.ZodString;
221
+ export: z.ZodString;
222
+ }, z.core.$strict>;
223
+ stylesheet: z.ZodOptional<z.ZodString>;
224
+ }, z.core.$strict>>;
225
+ }, z.core.$strict>;
226
+ export type ManifestGeneration = z.infer<typeof ManifestGenerationSchema>;
227
+ export type GuardRegistry = ManifestGeneration["guards"];
228
+ export declare const EMPTY_GUARD_REGISTRY: GuardRegistry;
229
+ /** `sans session` → `without:session` ; `avec x` or `x` → `with:x` — the binder's case keys. */
230
+ export declare function caseKeyOfPhrase(phrase: string): string;
231
+ export type ManifestGenerationRead = {
232
+ ok: true;
233
+ generation: ManifestGeneration | null;
234
+ } | {
235
+ ok: false;
236
+ problems: OgygieError[];
237
+ };
238
+ /** Reads the block from the RAW manifest JSON (the core's parse would have stripped it). */
239
+ export declare function readManifestGeneration(rawManifest: unknown, manifestPath?: string): ManifestGenerationRead;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * @intent The CLOSED catalogue of motifs a spec may instantiate under the
3
+ * `motifs` key of its `# Génération` block (DECISIONS.md D25, D31): for each
4
+ * motif, its configuration schema, the methods it exposes to
5
+ * `operations[].uses` (and which operation kinds each method serves), the HTTP
6
+ * status every error it raises comes back with, and the VOCABULARY it lends
7
+ * to behavior lines (D20) — the cases and expectations a line may use and
8
+ * still be derived without a model. Everything here is DATA: the generation
9
+ * code of a motif lives next to the emitters, never in a product.
10
+ *
11
+ * Six motifs: the two of lot 1 (append-only rows superseded by key, the
12
+ * all-or-nothing import) and the four of lot 3 (D31) — a key taken once per
13
+ * tenant, a delete refused while something points at the row, the slot set or
14
+ * cleared idempotently, and the signature of every write. `signedWrite` is
15
+ * IMPLICIT: instantiated under `motifs`, it applies to every write operation
16
+ * without `uses`.
17
+ *
18
+ * Case and expectation phrases are French (a spec is for the humans of the
19
+ * project, AGENTS.md principle 8) and name the configured FIELDS, never a
20
+ * natural-language rendering of them: `supersedes d'un autre shareClass`,
21
+ * not « d'une autre classe » — the motif cannot guess the latter. They carry
22
+ * no word of any domain either: rows, couples, keys, files, references,
23
+ * slots (« cible ») and signatures, so that the same motif reads the same in
24
+ * every product.
25
+ */
26
+ import { z } from "zod";
27
+ /** A camelCase field of the resource schema. */
28
+ export declare const FieldNameSchema: z.ZodString;
29
+ /** A PascalCase exported Zod schema name, `Schema`-suffixed (AGENTS.md template 2). */
30
+ export declare const SchemaNameSchema: z.ZodString;
31
+ /** A camelCase identifier: operation id, hole id, guard name, slot or reference name. */
32
+ export declare const IdentifierSchema: z.ZodString;
33
+ /** A stable error code, the same shape OgygieError enforces. */
34
+ export declare const ErrorCodeSchema: z.ZodString;
35
+ /** The operation kinds the generator emits (D22, D28). */
36
+ export declare const HTTP_OPERATION_KINDS: readonly ["read", "create", "import", "update", "setOrClear", "delete"];
37
+ export type HttpOperationKind = (typeof HTTP_OPERATION_KINDS)[number];
38
+ /** The kinds that write — what `signedWrite` applies to, what `respondsWith` is for. */
39
+ export declare const WRITE_OPERATION_KINDS: readonly HttpOperationKind[];
40
+ /** The kinds that address ONE row by its business key (D28). */
41
+ export declare const KEYED_OPERATION_KINDS: readonly HttpOperationKind[];
42
+ export declare const AppendOnlySupersedesConfigSchema: z.ZodObject<{
43
+ key: z.ZodTuple<[z.ZodString, z.ZodString], null>;
44
+ errors: z.ZodObject<{
45
+ duplicate: z.ZodString;
46
+ mismatch: z.ZodString;
47
+ alreadySuperseded: z.ZodString;
48
+ notFound: z.ZodString;
49
+ }, z.core.$strict>;
50
+ }, z.core.$strict>;
51
+ export type AppendOnlySupersedesConfig = z.infer<typeof AppendOnlySupersedesConfigSchema>;
52
+ export declare const AllOrNothingImportConfigSchema: z.ZodObject<{
53
+ rowSchema: z.ZodString;
54
+ applies: z.ZodString;
55
+ maxBytes: z.ZodNumber;
56
+ error: z.ZodString;
57
+ }, z.core.$strict>;
58
+ export type AllOrNothingImportConfig = z.infer<typeof AllOrNothingImportConfigSchema>;
59
+ /** D31: the key is taken once per tenant — a unique index, a 409 on the doublon. */
60
+ export declare const UniqueKeyConfigSchema: z.ZodObject<{
61
+ key: z.ZodArray<z.ZodString>;
62
+ error: z.ZodString;
63
+ }, z.core.$strict>;
64
+ export type UniqueKeyConfig = z.infer<typeof UniqueKeyConfigSchema>;
65
+ /** D31: a delete refused while a declared reference points at the row — the count in `cause`. */
66
+ export declare const RefuseWhenReferencedConfigSchema: z.ZodObject<{
67
+ reference: z.ZodString;
68
+ error: z.ZodString;
69
+ }, z.core.$strict>;
70
+ export type RefuseWhenReferencedConfig = z.infer<typeof RefuseWhenReferencedConfigSchema>;
71
+ /** D31: the slot rule — same value, nothing written and the signature untouched; null clears. */
72
+ export declare const IdempotentSetOrClearConfigSchema: z.ZodObject<{
73
+ slot: z.ZodString;
74
+ }, z.core.$strict>;
75
+ export type IdempotentSetOrClearConfig = z.infer<typeof IdempotentSetOrClearConfigSchema>;
76
+ /** D31: who and when on every write of the resource and its slots — IMPLICIT, no `uses`. */
77
+ export declare const SignedWriteConfigSchema: z.ZodObject<{
78
+ by: z.ZodString;
79
+ at: z.ZodString;
80
+ }, z.core.$strict>;
81
+ export type SignedWriteConfig = z.infer<typeof SignedWriteConfigSchema>;
82
+ /** One instance per motif and per feature: the keys ARE the motif names. */
83
+ export declare const MotifsSchema: z.ZodObject<{
84
+ appendOnlySupersedes: z.ZodOptional<z.ZodObject<{
85
+ key: z.ZodTuple<[z.ZodString, z.ZodString], null>;
86
+ errors: z.ZodObject<{
87
+ duplicate: z.ZodString;
88
+ mismatch: z.ZodString;
89
+ alreadySuperseded: z.ZodString;
90
+ notFound: z.ZodString;
91
+ }, z.core.$strict>;
92
+ }, z.core.$strict>>;
93
+ allOrNothingImport: z.ZodOptional<z.ZodObject<{
94
+ rowSchema: z.ZodString;
95
+ applies: z.ZodString;
96
+ maxBytes: z.ZodNumber;
97
+ error: z.ZodString;
98
+ }, z.core.$strict>>;
99
+ uniqueKey: z.ZodOptional<z.ZodObject<{
100
+ key: z.ZodArray<z.ZodString>;
101
+ error: z.ZodString;
102
+ }, z.core.$strict>>;
103
+ refuseWhenReferenced: z.ZodOptional<z.ZodObject<{
104
+ reference: z.ZodString;
105
+ error: z.ZodString;
106
+ }, z.core.$strict>>;
107
+ idempotentSetOrClear: z.ZodOptional<z.ZodObject<{
108
+ slot: z.ZodString;
109
+ }, z.core.$strict>>;
110
+ signedWrite: z.ZodOptional<z.ZodObject<{
111
+ by: z.ZodString;
112
+ at: z.ZodString;
113
+ }, z.core.$strict>>;
114
+ }, z.core.$strict>;
115
+ export type Motifs = z.infer<typeof MotifsSchema>;
116
+ export type MotifName = keyof Motifs;
117
+ export declare const MOTIF_NAMES: readonly MotifName[];
118
+ export interface MotifMethodDescriptor {
119
+ readonly name: string;
120
+ /** The operation kinds this method may serve. */
121
+ readonly kinds: readonly HttpOperationKind[];
122
+ }
123
+ export interface MotifDescriptor {
124
+ /** True when `uses` must name a method (`<motif>.<method>`). */
125
+ readonly requiresMethod: boolean;
126
+ /** The kinds the motif serves when used without a method. */
127
+ readonly kinds: readonly HttpOperationKind[];
128
+ readonly methods: readonly MotifMethodDescriptor[];
129
+ /** True when the motif applies to every write of the feature without `uses` (signedWrite). */
130
+ readonly implicit: boolean;
131
+ /**
132
+ * D31 precision (2026-10-17): a motif admitted UNDER the D25 threshold on the
133
+ * authority of the lot 3 brief. `missing` names the occurrence that would
134
+ * make it a full motif; the flag goes away in one line the day a second
135
+ * repo uses it in a `delivered` feature. Nothing else of the catalogue
136
+ * treats it differently.
137
+ */
138
+ readonly provisional?: {
139
+ readonly missing: string;
140
+ };
141
+ }
142
+ export declare const MOTIF_CATALOG: Readonly<Record<MotifName, MotifDescriptor>>;
143
+ /** The motifs admitted under the D25 threshold, each with the occurrence it still lacks. */
144
+ export declare function provisionalMotifs(): Array<{
145
+ name: MotifName;
146
+ missing: string;
147
+ }>;
148
+ export declare function isMotifName(candidate: string): candidate is MotifName;
149
+ /** `appendOnlySupersedes.insert` → motif + method ; `allOrNothingImport` → motif alone. */
150
+ export declare function parseUses(uses: string): {
151
+ motif: string;
152
+ method: string | null;
153
+ };
154
+ /**
155
+ * The HTTP status each motif error comes back with, for the METHOD an
156
+ * operation uses — a read method raises nothing, `insert` raises the four
157
+ * errors of the append-only rule, a taken key and a referenced row are 409.
158
+ * The binder checks a line against it.
159
+ */
160
+ export declare function motifErrorStatuses(motifs: Motifs, name: MotifName, method: string | null): ReadonlyMap<string, number>;
161
+ /** The words a motif lends to the behavior lines of the operations using it (D20). */
162
+ export interface MotifVocabulary {
163
+ /** `with:<phrase>` / `without:<phrase>` — the normalized case keys. */
164
+ readonly cases: readonly string[];
165
+ /** What may stand on the right of `<path> = …`. */
166
+ readonly namedValues: readonly string[];
167
+ /** Whole expectations without a path. */
168
+ readonly phrases: readonly string[];
169
+ }
170
+ /**
171
+ * Per METHOD, because a word only has a factory behind it where the method
172
+ * can produce the situation: `couple déjà en vigueur` is an `insert` case, a
173
+ * `latestPerKey` read cannot set it up.
174
+ */
175
+ export declare function motifVocabulary(motifs: Motifs, name: MotifName, method: string | null): MotifVocabulary;
@@ -0,0 +1,5 @@
1
+ export declare const PACKAGE_NAME = "@ogygie/generate";
2
+ export declare function packageRootOf(moduleUrl: string): string;
3
+ export declare const PACKAGE_ROOT: string;
4
+ /** The version of the package as its package.json says — stamped in every `@generated` header, compared by `verify` (D27). */
5
+ export declare const PACKAGE_VERSION: string;
@@ -0,0 +1,3 @@
1
+ import { type ManifestGeneration } from "./manifest-generation.schema.js";
2
+ /** The card, in the language of the brief: the model writes the block and the lines from it, the parser judges them. */
3
+ export declare function generationGrammarCard(generation: ManifestGeneration | null): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @intent What the `# Génération` block can only be checked against WITH the
3
+ * schemas module (DECISIONS.md D19 — spec ogygie-generate B1): every schema
4
+ * name it cites exists; a hole reads fields its operation's input (or the
5
+ * import's row schema) has; columns, indexes, order, range, the contracts key
6
+ * and the motif keys name fields of the resource; the append-only motif finds
7
+ * `supersedes` and `supersededBy`; an import's input is the `{ csv }`
8
+ * envelope; every field a factory must populate is derivable or carries an
9
+ * example the schema accepts; the holes of one operation agree on the fields
10
+ * their accept examples share; every output can be mapped — a read's element
11
+ * COVERS the resource and adds only what the block declares (slot arrays,
12
+ * reference counts, view and project fields), a keyed write's input matches
13
+ * its kind (partial body, slot value, nothing), a derive writes a resource
14
+ * field the input does not carry, a signed resource carries its signature and
15
+ * so do its slots. Each refusal is `OGYGIE_GENERATION_BLOCK_INVALID` at its
16
+ * path — a schema field is addressed `<module>#<Schema>.<field>`.
17
+ */
18
+ import { type OgygieError } from "@ogygie/core/errors";
19
+ import { type GenerationBlock } from "./generation-block.schema.js";
20
+ import { type FieldModel, type SchemaModels } from "./zod-introspection.js";
21
+ export interface SchemaCheckInput {
22
+ block: GenerationBlock;
23
+ schemas: SchemaModels;
24
+ /** Spec path, relative to the repo root — the `file` of every refusal. */
25
+ specPath: string;
26
+ }
27
+ /** The collection of a read output: the ONE array field whose element covers the resource. */
28
+ export declare function readCollectionOf(output: FieldModel, resource: FieldModel): {
29
+ collection: string;
30
+ element: FieldModel;
31
+ } | null;
32
+ export declare function checkBlockAgainstSchemas(input: SchemaCheckInput): OgygieError[];
@@ -0,0 +1,111 @@
1
+ /**
2
+ * @intent The first `schemas.ts` of a NEW feature as a hole (DECISIONS.md
3
+ * D52): produced by the `spec` model from the spec alone — its block, its
4
+ * behaviours, its data contracts — and judged as a hole is, by the gates
5
+ * themselves: the module is pure (zod and sibling contracts, nothing else),
6
+ * every schema the block cites is exported, `check` passes against the
7
+ * introspected module, every example of the `holes` block parses against the
8
+ * fields it reads, and the external gates the command runs (typecheck, the
9
+ * purity of contracts) are green. Two attempts, the problems of the first fed
10
+ * to the second; then `needs-operator`. Nothing here reads a disk or calls a
11
+ * model: every effect is injected, so the decision is proven in memory and the
12
+ * real effects stay in the command. Once retained, the module belongs to the
13
+ * repo like `logic.ts` (D21): never regenerated (D19, amended in this one
14
+ * point).
15
+ */
16
+ import type { GenerationBlock } from "../generation-block.schema.js";
17
+ export declare const SCHEMAS_NEEDS_OPERATOR = "OGYGIE_SCHEMAS_NEEDS_OPERATOR";
18
+ /** D52: two attempts, then the operator. */
19
+ export declare const SCHEMAS_ATTEMPTS = 2;
20
+ /** The stable instructions — the spec is the user turn. */
21
+ export declare const SCHEMAS_SYSTEM_PROMPT: string;
22
+ export interface SchemasCandidate {
23
+ source: string;
24
+ model: string;
25
+ usage: {
26
+ inputTokens: number;
27
+ outputTokens: number;
28
+ };
29
+ }
30
+ export interface SchemasJudgement {
31
+ /** Empty when the candidate passes every gate. */
32
+ problems: string[];
33
+ }
34
+ export interface SchemasDraftDeps {
35
+ /** One module from the `spec` model; `previous` carries the refused attempt and its problems. */
36
+ draw(previous: {
37
+ source: string;
38
+ problems: string[];
39
+ } | undefined): Promise<SchemasCandidate>;
40
+ /** Writes the candidate where the block expects it, then runs every gate; the problems name what refused it. */
41
+ judge(source: string, attempt: number): Promise<SchemasJudgement>;
42
+ /** Removes a refused candidate: nothing half-written stays on the branch. */
43
+ discard(): Promise<void>;
44
+ log(line: string): void;
45
+ }
46
+ export interface SchemasDraftResult {
47
+ outcome: "written" | "needs-operator";
48
+ attempts: number;
49
+ /** The problems of the LAST refused attempt — what the operator reads first. */
50
+ problems: string[];
51
+ model: string | null;
52
+ usage: {
53
+ inputTokens: number;
54
+ outputTokens: number;
55
+ model: string;
56
+ }[];
57
+ }
58
+ /** D52's loop: draw, judge, at most twice; the first green is written for good, the second red names the operator. */
59
+ export declare function draftSchemas(deps: SchemasDraftDeps, attempts?: number): Promise<SchemasDraftResult>;
60
+ /** The module in a model's answer: the first fenced block when there is one, otherwise the whole answer, trimmed, one final newline. */
61
+ export declare function extractModuleSource(answer: string): string;
62
+ /**
63
+ * What a contracts module may not carry — AGENTS.md's bans, and what the
64
+ * purity of contracts forbids (`verify-contracts`: zod and sibling contracts,
65
+ * nothing that runs). The banned words are ASSEMBLED from fragments: the
66
+ * repo's own lint reads source text.
67
+ */
68
+ export declare function forbiddenInSchemas(source: string): string[];
69
+ /** Every schema name the block cites, with where — what the module MUST export. */
70
+ export declare function citedSchemaNamesOf(block: GenerationBlock): {
71
+ name: string;
72
+ role: string;
73
+ }[];
74
+ /**
75
+ * D52: every example of the `holes` block parsed by the schema it targets —
76
+ * field by field, against the input of the operation that lists the hole (the
77
+ * row schema of an import). A field the schema does not expose is a problem
78
+ * `check` names already; a field that refuses its example is named here.
79
+ */
80
+ export declare function holeExampleProblems(block: GenerationBlock, moduleExports: Record<string, unknown>): string[];
81
+ /**
82
+ * What the generated tests will hold the inputs to, checked before any test
83
+ * runs (épreuve pdlc 2026-10-29): an `update` input refuses an empty body —
84
+ * `.partial()` alone accepts `{}`, and the contract test of the operation
85
+ * expects a 400.
86
+ */
87
+ export declare function writeInputProblems(block: GenerationBlock, moduleExports: Record<string, unknown>): string[];
88
+ /**
89
+ * Every field of the resource must come from somewhere at a create (épreuve
90
+ * pdlc 2026-10-29): the create's input, a derive hole, the signature of a
91
+ * signed write, or the identity — a field nobody sends nor derives is a
92
+ * column the generated insert cannot fill, and the product's typecheck is
93
+ * the first to say so, too late.
94
+ */
95
+ export declare function resourceCoverageProblems(block: GenerationBlock, moduleExports: Record<string, unknown>): string[];
96
+ /** The schemas the block cites that the module does not export — the first thing a draft gets wrong. */
97
+ export declare function missingExportsOf(block: GenerationBlock, exportedNames: readonly string[]): string[];
98
+ export interface SchemasPromptInput {
99
+ featureId: string;
100
+ specPath: string;
101
+ /** Repo-relative path of the module to write. */
102
+ modulePath: string;
103
+ specMarkdown: string;
104
+ block: GenerationBlock;
105
+ previous: {
106
+ source: string;
107
+ problems: string[];
108
+ } | undefined;
109
+ }
110
+ /** The user turn: the spec whole, the names the block cites, the refused attempt when there is one. */
111
+ export declare function buildSchemasPrompt(input: SchemasPromptInput): string;