@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,428 @@
1
+ /**
2
+ * @intent The FEATURE PLAN: everything the emitters need, resolved once from
3
+ * the `# Génération` block, the introspected schemas (D19), the manifest's
4
+ * `generation` block and the feature's place on the map — names, columns,
5
+ * operations with their models and holes, motif instances, the guard imports.
6
+ * Pure derivation: the same inputs always yield the same plan, and every
7
+ * emitter reads the plan only, never the block or the schemas directly.
8
+ * What the block or the schemas cannot answer was refused by `check` before
9
+ * this runs; the plan therefore throws only on an invariant `check` already
10
+ * guarantees.
11
+ */
12
+ import { type DeriveHole, type GenerationBlock, type HttpOperation, type ProjectHole, type TransformHole, type ValidateHole, type ViewHole } from "../generation-block.schema.js";
13
+ import type { ParsedBehavior } from "../behavior-grammar.js";
14
+ import { type GenerationTarget, type GuardRegistryEntry, type ManifestGeneration, type ValidationMode } from "../manifest-generation.schema.js";
15
+ import { type HttpOperationKind, type Motifs } from "../motif-catalog.js";
16
+ import { type FieldModel, type SchemaModels } from "../zod-introspection.js";
17
+ export interface FeaturePlanInput {
18
+ featureId: string;
19
+ /** Folder of the feature, relative to the repo root. */
20
+ folder: string;
21
+ /** Path of the API app, relative to the repo root. */
22
+ appPath: string;
23
+ specPath: string;
24
+ block: GenerationBlock;
25
+ schemas: SchemaModels;
26
+ generation: ManifestGeneration;
27
+ /** SQL tenant column (`workspace_id`), from the manifest's `tenancy.column` — absent for a target without tenant (D33). */
28
+ tenantColumn?: string;
29
+ /** File name of the migration, resolved by the caller (stable across regenerations). */
30
+ migrationFileName: string;
31
+ generatorVersion: string;
32
+ /** The behavior lines of the spec, parsed and bound by `check` (D20): one generated test each. */
33
+ behaviors: readonly BoundBehaviorInput[];
34
+ }
35
+ /** What `check` established about one behavior line: parsed, and either derivable or carried by a hole. */
36
+ export interface BoundBehaviorInput {
37
+ behavior: ParsedBehavior;
38
+ status: "derivable" | "hole";
39
+ }
40
+ export interface BehaviorPlan {
41
+ raw: string;
42
+ operation: OperationPlan;
43
+ behavior: ParsedBehavior;
44
+ /** The hole carrying the line, when its case or expectation is outside the vocabulary. */
45
+ hole: HolePlan | null;
46
+ }
47
+ export interface ColumnPlan {
48
+ /** TS key on the Drizzle table and the row, e.g. `effectiveDate`. */
49
+ key: string;
50
+ /** Logical column name (camelCase): the key, unless an adopted table renames it (D36). SQL Server renders it PascalCase, Postgres snake_case. */
51
+ columnName: string;
52
+ /** SQL column name, e.g. `effective_date`. */
53
+ sqlName: string;
54
+ /** Drizzle builder expression, e.g. `date("effective_date")`. */
55
+ drizzle: string;
56
+ /** SQL type, e.g. `date`, `numeric(12,4)`, `text`. */
57
+ sqlType: string;
58
+ nullable: boolean;
59
+ /** Extra SQL clauses: `check (...)`, references, defaults. */
60
+ sqlClauses: string[];
61
+ /** The resource field model behind it (null for the tenant column). */
62
+ model: FieldModel | null;
63
+ }
64
+ export interface ResourceFieldPlan {
65
+ name: string;
66
+ model: FieldModel;
67
+ /** `row.createdAt.toISOString()` for a datetime, `row.x` otherwise. */
68
+ dtoExpression: string;
69
+ }
70
+ export interface ValidateHolePlan {
71
+ kind: "validate";
72
+ id: string;
73
+ hole: ValidateHole;
74
+ /** Fields the hole reads, in declared order. */
75
+ reads: string[];
76
+ /** The input type the reads are picked from, e.g. `CreateRateInput`. */
77
+ inputTypeName: string;
78
+ errorCode: string;
79
+ accepts: Record<string, unknown>[];
80
+ reject: Record<string, unknown>;
81
+ }
82
+ export interface TransformHolePlan {
83
+ kind: "transform";
84
+ id: string;
85
+ hole: TransformHole;
86
+ columns: string[];
87
+ /** The code the operation's import motif answers — the hole's own, or the motif's. */
88
+ errorCode: string;
89
+ /** `ParseRateCsvRow` — the row type the hole returns. */
90
+ rowTypeName: string;
91
+ }
92
+ /** D32: computes ONE resource field from the input before persistence. */
93
+ export interface DeriveHolePlan {
94
+ kind: "derive";
95
+ id: string;
96
+ hole: DeriveHole;
97
+ reads: string[];
98
+ writes: string;
99
+ /** The input type the reads are picked from, e.g. `CreateGradeInput`. */
100
+ inputTypeName: string;
101
+ /** The model of the written field — the `T` of HoleResult<T, Code>. */
102
+ writesModel: FieldModel;
103
+ /** The operation's 400 when the derivation refuses; null when the hole never refuses. */
104
+ errorCode: string | null;
105
+ accepts: Array<{
106
+ input: Record<string, unknown>;
107
+ output: unknown;
108
+ }>;
109
+ reject: Record<string, unknown> | null;
110
+ }
111
+ /** D32: shapes the output of a read by caller — receives the guard's context (without its db) and the computed output. */
112
+ export interface ProjectHolePlan {
113
+ kind: "project";
114
+ id: string;
115
+ hole: ProjectHole;
116
+ /** The context fields the hole reads — its first parameter is `Pick<ProjectionContext, reads>`. */
117
+ reads: string[];
118
+ writes: string[];
119
+ /** The read's output type, e.g. `ListGradesOutput`. */
120
+ outputTypeName: string;
121
+ accepts: Array<{
122
+ context: Record<string, unknown>;
123
+ input: unknown;
124
+ output: unknown;
125
+ }>;
126
+ }
127
+ /** D32: a computation the database does — SQL in the migration, read by the repository as a read-only table. */
128
+ export interface ViewHolePlan {
129
+ kind: "view";
130
+ id: string;
131
+ hole: ViewHole;
132
+ /** SQL name of the view. */
133
+ name: string;
134
+ /** Drizzle constant of its read-only mapping, e.g. `gradeAxisTargets`. */
135
+ tsName: string;
136
+ rowType: string;
137
+ writes: string;
138
+ /** `array`: one view row per item of the element's array field; `scalar`: one row per resource row. */
139
+ shape: "array" | "scalar";
140
+ writesModel: FieldModel;
141
+ /** The columns the SQL must produce: tenant column, parent key, then the item fields (array) or the value (scalar). */
142
+ columns: ColumnPlan[];
143
+ from: string[];
144
+ }
145
+ export type HolePlan = ValidateHolePlan | TransformHolePlan | DeriveHolePlan | ProjectHolePlan | ViewHolePlan;
146
+ /** D36: one replayable step of the bounded ALTER an adopted table receives. */
147
+ export type AlterPlan = {
148
+ kind: "dropCheck";
149
+ name: string;
150
+ } | {
151
+ kind: "addCheck";
152
+ name: string;
153
+ column: ColumnPlan;
154
+ } | {
155
+ kind: "addForeignKey";
156
+ name: string;
157
+ columns: ColumnPlan[];
158
+ references: {
159
+ table: string;
160
+ columns: ColumnPlan[];
161
+ };
162
+ onDelete: "cascade" | "restrict";
163
+ } | {
164
+ kind: "addColumn";
165
+ name: string;
166
+ column: ColumnPlan;
167
+ };
168
+ export interface TablePlan {
169
+ sqlName: string;
170
+ tsName: string;
171
+ rowType: string;
172
+ newType: string;
173
+ /** D36: `owned` — created and owned by the generator; `adopted` — exists in the product, declared shape, never created. */
174
+ mode: "owned" | "adopted";
175
+ /** Whether the table has the `id` column; without it the key is the row's identity (D36). */
176
+ hasId: boolean;
177
+ /** SQL columns of the primary key when there is no id column (tenant column first); empty otherwise. */
178
+ primaryKey: string[];
179
+ /** D36: the bounded ALTER of an adopted table, in declaration order; empty for an owned table. */
180
+ alter: AlterPlan[];
181
+ columns: ColumnPlan[];
182
+ /** Secondary indexes as SQL column lists, tenant column prefixed. */
183
+ indexes: Array<{
184
+ name: string;
185
+ columns: string[];
186
+ }>;
187
+ /** Unique indexes (a partial one carries its `where`). */
188
+ uniques: Array<{
189
+ name: string;
190
+ columns: string[];
191
+ where: string | null;
192
+ }>;
193
+ /** Composite foreign keys, SQL columns on both sides. */
194
+ foreignKeys: Array<{
195
+ name: string;
196
+ columns: string[];
197
+ references: {
198
+ table: string;
199
+ columns: string[];
200
+ };
201
+ onDelete: "cascade" | "restrict";
202
+ }>;
203
+ }
204
+ /** D28: a detail table of values by composite key (resource key, slot key). */
205
+ export interface SlotPlan {
206
+ name: string;
207
+ schemaName: string;
208
+ typeName: string;
209
+ model: FieldModel;
210
+ /** The slot key field, e.g. `criterionCode`, second path parameter of a setOrClear. */
211
+ key: string;
212
+ /** Every value of the slot key when it is an enum — the element lists them all, null for the unset ones. */
213
+ keyValues: Array<string | number> | null;
214
+ /** The value field, e.g. `target`. */
215
+ value: string;
216
+ /** The array field of the read element, e.g. `targets`. */
217
+ field: string;
218
+ /** The TS/SQL column of the slot table pointing at the resource key, e.g. `gradeCode` / `grade_code`. */
219
+ parentKey: string;
220
+ parentColumn: string;
221
+ table: TablePlan;
222
+ /** The slot fields the element lists, in schema order — the DTO of a slot row. */
223
+ fields: ResourceFieldPlan[];
224
+ }
225
+ /** D28: a table that points at the resource — counted by refuseWhenReferenced, exposed by countField. */
226
+ export interface ReferencePlan {
227
+ name: string;
228
+ tableSql: string;
229
+ /** The TS/SQL column of the referencing row carrying the resource key. */
230
+ column: string;
231
+ columnSql: string;
232
+ /** The owned table when the block gives a schema (emitted with its factory); null when another feature owns it. */
233
+ table: TablePlan | null;
234
+ schemaName: string | null;
235
+ typeName: string | null;
236
+ countField: string | null;
237
+ }
238
+ /** The element of a read output: the one array whose element covers the resource. */
239
+ export interface ElementPlan {
240
+ collection: string;
241
+ schemaName: string;
242
+ typeName: string;
243
+ model: FieldModel;
244
+ }
245
+ export interface OrderPlan {
246
+ /** A field ordered by an enum schema's declaration order (`ordre TierSchema`). */
247
+ enumOrder: {
248
+ field: string;
249
+ values: Array<string | number>;
250
+ } | null;
251
+ tuples: Array<{
252
+ field: string;
253
+ direction: "asc" | "desc";
254
+ }>;
255
+ }
256
+ export interface OperationPlan {
257
+ id: string;
258
+ pascalId: string;
259
+ /** Service function, e.g. `runImport`. */
260
+ serviceName: string;
261
+ kind: HttpOperationKind;
262
+ method: HttpOperation["method"];
263
+ path: string;
264
+ /** The path parameters, in order: the key, then the slot key. */
265
+ pathParameters: string[];
266
+ guardName: string;
267
+ /** D34: the code the guard's perFeature refusal answers for this operation. */
268
+ guardDeniedCode: string | null;
269
+ inputSchema: string;
270
+ inputType: string;
271
+ inputModel: FieldModel;
272
+ outputSchema: string;
273
+ outputType: string;
274
+ outputModel: FieldModel;
275
+ /** read (and respondsWith): the collection field of the output; create: the resource field; import: the count field. */
276
+ outputField: string;
277
+ /** read: output fields echoed from the input, by name. */
278
+ echoFields: string[];
279
+ /** The element of the collection, for a read and for a write that responds with one. */
280
+ element: ElementPlan | null;
281
+ successStatus: number;
282
+ motif: {
283
+ name: string;
284
+ method: string | null;
285
+ } | null;
286
+ /** D28: the business key field of a keyed write, and its 404. */
287
+ by: string | null;
288
+ notFound: string | null;
289
+ slot: SlotPlan | null;
290
+ /** D30: the read operation whose output this write serves. */
291
+ respondsWith: string | null;
292
+ validateHoles: ValidateHolePlan[];
293
+ transformHole: TransformHolePlan | null;
294
+ deriveHoles: DeriveHolePlan[];
295
+ projectHoles: ProjectHolePlan[];
296
+ viewHoles: ViewHolePlan[];
297
+ order: OrderPlan | null;
298
+ limit: number | null;
299
+ range: string | null;
300
+ invalidates: string[];
301
+ }
302
+ export interface AppendOnlyPlan {
303
+ /** `[group, order]` TS keys. */
304
+ key: [string, string];
305
+ errors: {
306
+ duplicate: string;
307
+ mismatch: string;
308
+ alreadySuperseded: string;
309
+ notFound: string;
310
+ };
311
+ /** Name of the partial unique index on the current rows. */
312
+ currentKeyUniqueName: string;
313
+ /** The enum values of the group field, when it is an enum (latestPerKey order). */
314
+ groupValues: Array<string | number> | null;
315
+ }
316
+ export interface ImportPlan {
317
+ rowSchema: string;
318
+ rowType: string;
319
+ appliesTo: string;
320
+ maxBytes: number;
321
+ errorCode: string;
322
+ }
323
+ export interface GuardPlan {
324
+ name: string;
325
+ entry: GuardRegistryEntry;
326
+ /** Import path of the guard module from the feature folder. */
327
+ importPath: string;
328
+ /** Import path of the fixtures module from the feature folder. */
329
+ fixturesImportPath: string;
330
+ /** The context type this guard returns — its own `context`, or the product's tenant context (D34). */
331
+ contextTypeName: string;
332
+ contextImportPath: string;
333
+ }
334
+ export interface FeaturePlan {
335
+ featureId: string;
336
+ pascalName: string;
337
+ camelName: string;
338
+ folder: string;
339
+ appPath: string;
340
+ specPath: string;
341
+ generatorVersion: string;
342
+ migrationFileName: string;
343
+ /** Repo-relative path of the migration file. */
344
+ migrationPath: string;
345
+ /** The tenant column, its TS key and the table it references — null for a target without tenant (D33). */
346
+ tenant: {
347
+ column: string;
348
+ columnKey: string;
349
+ table: string;
350
+ } | null;
351
+ /** D33 (M2): the database port the repositories call when there is no tenant facade (`src/db.ts#Database`); null with a tenant. */
352
+ databasePort: {
353
+ typeName: string;
354
+ importPath: string;
355
+ } | null;
356
+ context: {
357
+ typeName: string;
358
+ importPath: string;
359
+ };
360
+ testBench: {
361
+ exportName: string;
362
+ importPath: string;
363
+ };
364
+ guards: GuardPlan[];
365
+ resource: {
366
+ schemaName: string;
367
+ typeName: string;
368
+ model: FieldModel;
369
+ fields: ResourceFieldPlan[];
370
+ };
371
+ table: TablePlan;
372
+ appendOnly: AppendOnlyPlan | null;
373
+ importMotif: ImportPlan | null;
374
+ /** The block's motif configurations as declared — the statuses of their refusals come from the catalog. */
375
+ motifs: Motifs;
376
+ /** D33: where and how the feature is emitted. */
377
+ target: GenerationTarget;
378
+ /** D37: how the routes validate — the type provider on the route, or `parse` in the handler. */
379
+ validation: ValidationMode;
380
+ /** D37: the code the target answers to a violated contract, what the tests expect. */
381
+ contractViolationCode: string;
382
+ /** D28: the business key of the keyed writes — its field, its column, the unique that makes it a key. */
383
+ key: {
384
+ field: string;
385
+ column: ColumnPlan;
386
+ uniqueName: string;
387
+ } | null;
388
+ slots: SlotPlan[];
389
+ references: ReferencePlan[];
390
+ /** D31: the four motifs of lot 3, as instantiated. */
391
+ signed: {
392
+ by: string;
393
+ at: string;
394
+ } | null;
395
+ unique: {
396
+ key: string[];
397
+ indexName: string;
398
+ error: string;
399
+ } | null;
400
+ referenced: {
401
+ reference: ReferencePlan;
402
+ error: string;
403
+ } | null;
404
+ idempotent: {
405
+ slot: SlotPlan;
406
+ } | null;
407
+ /** D31: the product's signer function, when the manifest names one. */
408
+ signature: {
409
+ exportName: string;
410
+ importPath: string;
411
+ } | null;
412
+ operations: OperationPlan[];
413
+ holes: HolePlan[];
414
+ behaviors: BehaviorPlan[];
415
+ /** Every schema export name of the module, for index.ts. */
416
+ schemaExports: string[];
417
+ /** The introspected schemas, for what needs a field's type after planning (hole shapes). */
418
+ schemaModels: Readonly<Record<string, FieldModel>>;
419
+ }
420
+ /** How a row field becomes its DTO value: an instant as ISO text; on SQL Server a DATE comes back as a Date and is rendered YYYY-MM-DD (D33 precision, M3). */
421
+ export declare function dtoExpressionOf(name: string, model: FieldModel, sqlType: string | undefined, database: GenerationTarget["database"]): string;
422
+ /** The tenant of a plan, for the emitters of a target that has one — the Postgres emitters never run without it. */
423
+ export declare function tenantOf(plan: FeaturePlan): {
424
+ column: string;
425
+ columnKey: string;
426
+ table: string;
427
+ };
428
+ export declare function buildFeaturePlan(input: FeaturePlanInput): FeaturePlan;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @intent Emits `repository.gen.ts`: the only file of the feature touching the
3
+ * database, always through tenantDb (AGENTS.md §Multi-tenant). The motifs land
4
+ * here as functions: appendOnlySupersedes — the current rows per key for every
5
+ * read operation (its order, limit and range), and the insert that marks the
6
+ * superseded row BEFORE inserting the new one (id drawn app-side, deferred
7
+ * foreign key, partial unique index as the belt) — and the all-or-nothing
8
+ * import's database half (lot 2); the keyed writes of D28 — load by business
9
+ * key or answer the operation's 404, update the fields sent, set or clear a
10
+ * slot (same value: nothing written, D31), delete unless a reference points at
11
+ * the row (409 with the count in cause, D31) —, uniqueKey (409 on a taken
12
+ * key), signedWrite (who and when on every write), the slot and reference
13
+ * reads, and the read of every view hole through its read-only mapping (D32).
14
+ */
15
+ import type { FeaturePlan } from "./plan.js";
16
+ export declare function emitRepository(plan: FeaturePlan): string;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @intent Emits `routes.gen.ts`: one Fastify route per operation, no business
3
+ * logic — the guard the manifest declares resolves the context, the Zod
4
+ * schemas validate the contract (CONTRACT_VALIDATION_FAILED with suggestedFix
5
+ * through the app's error handler) — path parameters included for the keyed
6
+ * writes (D28: the key, then the slot key, each validated by the schema of its
7
+ * field) —, the service runs the pipeline (D22). An import route bounds its
8
+ * body at maxBytes plus a margin so the motif's structured 400 precedes the
9
+ * server's 413.
10
+ */
11
+ import type { FieldModel } from "../zod-introspection.js";
12
+ import type { FeaturePlan, OperationPlan } from "./plan.js";
13
+ /** The exported schema whose model is exactly this field's — how a path parameter gets its schema. */
14
+ export declare function schemaNameOfField(plan: FeaturePlan, model: FieldModel): string | null;
15
+ /** The schema of each path parameter of a keyed write: the resource key's, then the slot key's. */
16
+ export declare function pathParameterSchemas(plan: FeaturePlan, operation: OperationPlan): Array<{
17
+ name: string;
18
+ schema: string;
19
+ }>;
20
+ /** The arguments the service takes after `deps`: the path parameters, then the input — read on the request (type provider) or on the parsed variables (D37, handler-parse). */
21
+ export declare function serviceArguments(operation: OperationPlan, requestExpression: string, parsed?: boolean): string;
22
+ export declare function emitRoutes(plan: FeaturePlan): string;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @intent Emits the three files that frame the holes of a feature (D21, D23,
3
+ * D32): `holes.runtime.gen.ts` — HoleResult, accept/refuse, and `todo`, the
4
+ * body of an unfilled hole, raising OGYGIE_HOLE_UNFILLED; `logic.ts` — the hole
5
+ * signatures between `// @hole` / `// @end-hole` markers, the ONLY file of
6
+ * the folder a human or an agent writes, and only BETWEEN the markers: at
7
+ * every regeneration a body is kept when its signature is unchanged and reset
8
+ * to `todo` otherwise, while everything else in the file (header, imports,
9
+ * row types, signatures, markers) is generated and compared like a `.gen`
10
+ * file; and `index.ts`, the feature's sole public export point, generated
11
+ * under its canonical name. A declared effect is a parameter of the signature
12
+ * (`clock`, `db`) and makes the hole asynchronous; a `view` hole has no
13
+ * TypeScript signature — its body is SQL in the migration. The runtime is
14
+ * emitted INTO the feature so a product depends on the generator only at
15
+ * development time.
16
+ */
17
+ import type { FeaturePlan, HolePlan } from "./plan.js";
18
+ export declare function emitHolesRuntime(plan: FeaturePlan): string;
19
+ /** The declared effects of a hole, as signature parameters (D32): `clock: Clock`, `db: <tenant facade>`. */
20
+ export declare function effectParameterLines(hole: HolePlan, plan: FeaturePlan): string[];
21
+ /** True when the hole declares an effect: its signature is then asynchronous. */
22
+ export declare function isAsyncHole(hole: HolePlan): boolean;
23
+ /** The TypeScript type of the value a derive hole writes, from its field model. */
24
+ export declare function tsTypeOfModel(model: {
25
+ kind: string;
26
+ nullable: boolean;
27
+ values?: Array<string | number>;
28
+ integer?: boolean;
29
+ }): string;
30
+ /** The generated signature of one hole, from `// @hole` to the opening brace; empty for a view (its body is SQL). */
31
+ export declare function holeSignatureLines(hole: HolePlan, plan?: FeaturePlan): string[];
32
+ /** `todo` body of a hole, between its signature and its end marker. */
33
+ export declare function holeTodoBodyLines(hole: HolePlan): string[];
34
+ /** One `// @hole` section of an existing logic.ts: its literal signature and its body. */
35
+ export interface LogicSection {
36
+ id: string;
37
+ /** From `export function` to the opening brace included. */
38
+ signature: string;
39
+ /** The lines between the opening brace and the closing `}` of the function. */
40
+ body: string;
41
+ }
42
+ /** Reads the hole sections of an existing logic.ts (or of a migration's `-- @hole` sections) — what a regeneration must not lose. */
43
+ export declare function parseLogicSections(logic: string, marker?: string): Map<string, LogicSection>;
44
+ /** The body a regeneration gives a hole: the existing one when its signature is unchanged, `todo` otherwise (B3). */
45
+ export declare function bodyLinesFor(hole: HolePlan, existing: Map<string, LogicSection>, plan?: FeaturePlan): string[];
46
+ export declare function emitLogic(plan: FeaturePlan, existingLogic?: string | null): string;
47
+ export declare function emitIndex(plan: FeaturePlan): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @intent Emits the CONTAINER of a screen, `<Ecran>.container.gen.tsx` (D40):
3
+ * the hooks — every consumed read and write — a ScreenState on the primary
4
+ * read, and the body called with served data and actions. Also emits the
5
+ * body's props interface and the copy interface the body fills: the container
6
+ * imports `screenCopy` from the written body, the body imports its props type
7
+ * from here (a type-only cycle, erased at runtime). And `routes.gen.tsx` (D43,
8
+ * router code): a createRoute factory the app's router adds to its children.
9
+ * And `index.ts`, the sole public export point of the feature.
10
+ */
11
+ import type { ScreenPlan } from "../screen-plan.js";
12
+ export declare function bodyPropsLines(plan: ScreenPlan): string[];
13
+ export declare function emitScreenContainer(plan: ScreenPlan): string;
14
+ /** The default body, emitted ONCE when the file is absent and never compared (D40): the views in the block's order, the copy of the states. */
15
+ export declare function emitScreenBodyDefault(plan: ScreenPlan): string;
16
+ export declare function emitScreenRoutes(plan: ScreenPlan): string;
17
+ export declare function emitScreenIndex(plan: ScreenPlan): string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @intent Emits `fixtures.gen.ts` of a screen: the deterministic data its
3
+ * tests serve and send — for every consumed read, the output with two distinct
4
+ * rows and the empty collection; for every consumed write, the valid input
5
+ * (the consumed schema's sample under the accept examples of the operation's
6
+ * holes, D23) and the served output; the OgygieError bodies of an access
7
+ * denied, of a server failure and of each write's own refusal. Test support
8
+ * only: imported by the generated tests, never by the screen.
9
+ */
10
+ import type { ScreenOperationPlan, ScreenPlan } from "../screen-plan.js";
11
+ /** An OgygieError body as the api answers it — the shape every Ogygie failure carries. */
12
+ export declare function failureBodyOf(code: string, message: string, cause: string, suggestedFix: string): Record<string, unknown>;
13
+ export declare function refusalFixtureNameOf(operation: ScreenOperationPlan): string;
14
+ export declare function emitScreenFixtures(plan: ScreenPlan): string;
@@ -0,0 +1,2 @@
1
+ import type { CustomViewPlan, ScreenPlan } from "../screen-plan.js";
2
+ export declare function emitScreenHoleDoc(plan: ScreenPlan, view: CustomViewPlan): string;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @intent Emits `<Ecran>.previews.gen.test.tsx` for the `static-render` front
3
+ * target (spec ogygie-hosted-mode B10, D53): the PREVIEWS of a screen — one
4
+ * self-contained HTML page per UI state, rendered by the front's bench on the
5
+ * fixtures the tests already serve: loading (nothing in the cache), error and
6
+ * denied (the primary read failed with the OgygieFailure an api would answer),
7
+ * empty (the primary collection served empty, the other reads served) and
8
+ * nominal (every read served). The preview IS the real screen — the same
9
+ * container, the same patterns, the same data as the tests — not a drawing of
10
+ * it.
11
+ *
12
+ * It is a test: it proves every state renders, in the loop, under the
13
+ * product's own Vite transform (the i18n macro). With `OGYGIE_PREVIEW_OUT` set
14
+ * to a directory, it also WRITES the pages there — that is how `ogygie
15
+ * generate preview` and the `speculate` job publish them on the spec branch,
16
+ * under `previews/<id>/<state>.html`, where the hosted studio shows them.
17
+ * The product's stylesheet, when the front target names one, is inlined
18
+ * through Vite's `?inline` import so the page carries its tokens.
19
+ */
20
+ import type { ScreenPlan } from "../screen-plan.js";
21
+ export declare const PREVIEWS_FILE_SUFFIX = ".previews.gen.test.tsx";
22
+ /** The states a preview covers, in the order the hosted studio shows them. */
23
+ export declare function previewStatesOf(plan: ScreenPlan): string[];
24
+ export declare function emitScreenPreviews(plan: ScreenPlan): string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @intent Emits `queries.gen.ts` of a screen (D42): one TanStack Query hook
3
+ * per consumed READ, its cache key the one the manifest client of the core
4
+ * derives — written as a literal — and its call through `fetchContract` on the
5
+ * consumed feature's output schema. No key is written by hand in a generated
6
+ * feature; a read with path parameters or query fields takes them as the
7
+ * hook's arguments and carries them in its key.
8
+ */
9
+ import type { ScreenPlan } from "../screen-plan.js";
10
+ export declare function emitScreenQueries(plan: ScreenPlan): string;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @intent What every screen emitter shares (D40 to D43): the import of the
3
+ * consumed contracts, the `<Trans>` of a source text, the URL helpers a hook
4
+ * or a test emits, the names of the body props. Deterministic string building
5
+ * only, as names.ts.
6
+ */
7
+ import type { ScreenOperationPlan, ScreenPlan } from "../screen-plan.js";
8
+ /** `<Trans>Effective date</Trans>` — every human text an emitted screen shows goes through the i18n macro (D43). */
9
+ export declare function trans(text: string): string;
10
+ /** The `import { … } from "<contracts>"` line of one consumed feature, values and types sorted. */
11
+ export declare function contractsImportLine(contractsImport: string, values: readonly string[], types: readonly string[]): string | null;
12
+ /** Every consumed feature's contracts import, one line each, grouped by specifier. */
13
+ export declare function contractsImportLines(plan: ScreenPlan, pick: (operation: ScreenOperationPlan) => {
14
+ values: string[];
15
+ types: string[];
16
+ }): string[];
17
+ export declare const URL_OF_LINES: string[];
18
+ export declare const PATH_WITH_LINES: string[];
19
+ /** The URL expression of a call: the literal path, with its parameters and, for a GET with input, its query string. */
20
+ export declare function urlExpressionOf(operation: ScreenOperationPlan, paramsExpression: string | null, inputExpression: string | null): string;
21
+ /** `{ code, criterionCode }` — the parameters object of a keyed call, from identifiers of the same names. */
22
+ export declare function paramsObjectOf(operation: ScreenOperationPlan): string | null;
23
+ /** The variables a write hook receives: the input alone, or the parameters with the input. */
24
+ export declare function writeVariablesTypeOf(operation: ScreenOperationPlan): {
25
+ typeName: string;
26
+ lines: string[];
27
+ } | null;
28
+ /** The type a MutationLike of a write takes as variables: the `<Op>Variables` of a keyed write (path parameters and input), the input alone otherwise. */
29
+ export declare function mutationVariablesTypeOf(operation: ScreenOperationPlan): string;
30
+ /** The `<Op>Variables` type names a set of writes declares in writes.gen.ts — what a file typing their MutationLike imports from there. */
31
+ export declare function variablesTypesOf(operations: readonly ScreenOperationPlan[]): string[];
32
+ /** `RATES_LIST_ALL` — the fixture prefix of an operation. */
33
+ export declare function fixturePrefixOf(operation: ScreenOperationPlan): string;
34
+ /** The JSON literal of a fixture, two-space indented, deterministic key order as given. */
35
+ export declare function jsonLiteral(value: unknown, indent?: number): string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @intent The generated part of a SCREEN spec's `# Contrats de données` (D41,
3
+ * D42): what the screen consumes — each operation with its route, its hook,
4
+ * the cache key derived from the map and the roots a write makes stale —, its
5
+ * views with their fields and the file each one lives in, its custom holes,
6
+ * and its route. Written between the same `@generated` markers as a feature's,
7
+ * compared by verify the same way. French prose, English identifiers.
8
+ */
9
+ import type { ScreenPlan } from "../screen-plan.js";
10
+ export declare function emitScreenSpecContracts(plan: ScreenPlan): string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @intent Emits `<Ecran>.gen.test.tsx` for the `static-render` front target
3
+ * (D20 for screens, D43): one test per behavior line of the spec, named by the
4
+ * line, rendering the CONTAINER to HTML with the front's bench
5
+ * (`renderToStaticMarkup` under the product's providers) — no recording
6
+ * `fetch`, no gesture. The state of a line is ARRANGED in the query cache
7
+ * before the render: the consumed reads served from the fixtures, the read the
8
+ * line speaks of served, emptied or failed with the OgygieFailure an api would
9
+ * answer, or left unseeded for loading; the renders the line names are read on
10
+ * the markup — `data-state` of ScreenState, `data-pattern` of the patterns,
11
+ * `data-view` of a view, the rows of its table and the text of their cells. A
12
+ * line about a form is a GESTURE (typing, submitting, a refused write): it
13
+ * stays bound by the grammar — the vocabulary does not depend on the target —
14
+ * and is a todo here that says why; the jsdom target proves it. A custom view
15
+ * is proven on its example, red until its body is written; a line carried by a
16
+ * hole is a todo.
17
+ */
18
+ import type { ScreenPlan } from "../screen-plan.js";
19
+ /** Why a form line is a todo on this target — the name of the todo ends with it. */
20
+ export declare const STATIC_RENDER_GESTURE_REASON = "geste, hors cible static-render";
21
+ export declare function emitStaticScreenTests(plan: ScreenPlan): string;