@metaobjectsdev/codegen-ts 0.24.5 → 1.0.0-rc.1

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 (237) hide show
  1. package/README.md +37 -12
  2. package/dist/api-surface.d.ts +29 -0
  3. package/dist/api-surface.d.ts.map +1 -1
  4. package/dist/api-surface.js +47 -0
  5. package/dist/api-surface.js.map +1 -1
  6. package/dist/column-mapper.d.ts +12 -0
  7. package/dist/column-mapper.d.ts.map +1 -1
  8. package/dist/column-mapper.js +1 -0
  9. package/dist/column-mapper.js.map +1 -1
  10. package/dist/constants.d.ts +24 -11
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +54 -19
  13. package/dist/constants.js.map +1 -1
  14. package/dist/db-emitting.d.ts +6 -0
  15. package/dist/db-emitting.d.ts.map +1 -0
  16. package/dist/db-emitting.js +26 -0
  17. package/dist/db-emitting.js.map +1 -0
  18. package/dist/generator-registry.d.ts.map +1 -1
  19. package/dist/generator-registry.js +14 -1
  20. package/dist/generator-registry.js.map +1 -1
  21. package/dist/generator.d.ts +5 -0
  22. package/dist/generator.d.ts.map +1 -1
  23. package/dist/generator.js.map +1 -1
  24. package/dist/generators/agent-docs-file.d.ts +19 -0
  25. package/dist/generators/agent-docs-file.d.ts.map +1 -0
  26. package/dist/generators/agent-docs-file.js +257 -0
  27. package/dist/generators/agent-docs-file.js.map +1 -0
  28. package/dist/generators/agent-requirements-page.d.ts +22 -0
  29. package/dist/generators/agent-requirements-page.d.ts.map +1 -0
  30. package/dist/generators/agent-requirements-page.js +175 -0
  31. package/dist/generators/agent-requirements-page.js.map +1 -0
  32. package/dist/generators/agent-schema-input.d.ts +69 -0
  33. package/dist/generators/agent-schema-input.d.ts.map +1 -0
  34. package/dist/generators/agent-schema-input.js +23 -0
  35. package/dist/generators/agent-schema-input.js.map +1 -0
  36. package/dist/generators/agent-schema-page.d.ts +21 -0
  37. package/dist/generators/agent-schema-page.d.ts.map +1 -0
  38. package/dist/generators/agent-schema-page.js +241 -0
  39. package/dist/generators/agent-schema-page.js.map +1 -0
  40. package/dist/generators/agent-ui-page.d.ts +22 -0
  41. package/dist/generators/agent-ui-page.d.ts.map +1 -0
  42. package/dist/generators/agent-ui-page.js +253 -0
  43. package/dist/generators/agent-ui-page.js.map +1 -0
  44. package/dist/generators/api-docs-file.d.ts.map +1 -1
  45. package/dist/generators/api-docs-file.js +13 -6
  46. package/dist/generators/api-docs-file.js.map +1 -1
  47. package/dist/generators/api-model.d.ts +6 -0
  48. package/dist/generators/api-model.d.ts.map +1 -1
  49. package/dist/generators/api-model.js +54 -35
  50. package/dist/generators/api-model.js.map +1 -1
  51. package/dist/generators/callable-file.js +1 -1
  52. package/dist/generators/callable-file.js.map +1 -1
  53. package/dist/generators/docs-data-builder.d.ts.map +1 -1
  54. package/dist/generators/docs-data-builder.js +47 -2
  55. package/dist/generators/docs-data-builder.js.map +1 -1
  56. package/dist/generators/docs-data.d.ts +6 -2
  57. package/dist/generators/docs-data.d.ts.map +1 -1
  58. package/dist/generators/index.d.ts +3 -8
  59. package/dist/generators/index.d.ts.map +1 -1
  60. package/dist/generators/index.js +19 -14
  61. package/dist/generators/index.js.map +1 -1
  62. package/dist/generators/names-file.d.ts +17 -0
  63. package/dist/generators/names-file.d.ts.map +1 -0
  64. package/dist/generators/names-file.js +95 -0
  65. package/dist/generators/names-file.js.map +1 -0
  66. package/dist/generators/requirements-markdown.d.ts +18 -1
  67. package/dist/generators/requirements-markdown.d.ts.map +1 -1
  68. package/dist/generators/requirements-markdown.js +11 -9
  69. package/dist/generators/requirements-markdown.js.map +1 -1
  70. package/dist/generators/routes-file-hono.d.ts +17 -2
  71. package/dist/generators/routes-file-hono.d.ts.map +1 -1
  72. package/dist/generators/routes-file-hono.js +9 -11
  73. package/dist/generators/routes-file-hono.js.map +1 -1
  74. package/dist/generators/routes-file.d.ts +17 -2
  75. package/dist/generators/routes-file.d.ts.map +1 -1
  76. package/dist/generators/routes-file.js +10 -8
  77. package/dist/generators/routes-file.js.map +1 -1
  78. package/dist/generators/template-generator.d.ts.map +1 -1
  79. package/dist/generators/template-generator.js +20 -6
  80. package/dist/generators/template-generator.js.map +1 -1
  81. package/dist/index.d.ts +20 -5
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +43 -4
  84. package/dist/index.js.map +1 -1
  85. package/dist/metaobjects-config.d.ts +38 -1
  86. package/dist/metaobjects-config.d.ts.map +1 -1
  87. package/dist/metaobjects-config.js +9 -1
  88. package/dist/metaobjects-config.js.map +1 -1
  89. package/dist/names.d.ts +275 -0
  90. package/dist/names.d.ts.map +1 -0
  91. package/dist/names.js +433 -0
  92. package/dist/names.js.map +1 -0
  93. package/dist/overwrite-policy.d.ts.map +1 -1
  94. package/dist/overwrite-policy.js +15 -3
  95. package/dist/overwrite-policy.js.map +1 -1
  96. package/dist/projection/extract-view-spec.d.ts +25 -1
  97. package/dist/projection/extract-view-spec.d.ts.map +1 -1
  98. package/dist/projection/extract-view-spec.js +79 -6
  99. package/dist/projection/extract-view-spec.js.map +1 -1
  100. package/dist/reference-templates.d.ts +1 -1
  101. package/dist/reference-templates.d.ts.map +1 -1
  102. package/dist/reference-templates.js +1 -1
  103. package/dist/reference-templates.js.map +1 -1
  104. package/dist/render-context.d.ts +12 -1
  105. package/dist/render-context.d.ts.map +1 -1
  106. package/dist/render-context.js +1 -0
  107. package/dist/render-context.js.map +1 -1
  108. package/dist/retired-codegen-attrs.d.ts +32 -0
  109. package/dist/retired-codegen-attrs.d.ts.map +1 -0
  110. package/dist/retired-codegen-attrs.js +47 -0
  111. package/dist/retired-codegen-attrs.js.map +1 -0
  112. package/dist/routes-expose.d.ts +63 -0
  113. package/dist/routes-expose.d.ts.map +1 -0
  114. package/dist/routes-expose.js +57 -0
  115. package/dist/routes-expose.js.map +1 -0
  116. package/dist/runner.d.ts +18 -0
  117. package/dist/runner.d.ts.map +1 -1
  118. package/dist/runner.js +109 -7
  119. package/dist/runner.js.map +1 -1
  120. package/dist/templates/callable-file.d.ts +7 -2
  121. package/dist/templates/callable-file.d.ts.map +1 -1
  122. package/dist/templates/callable-file.js +54 -9
  123. package/dist/templates/callable-file.js.map +1 -1
  124. package/dist/templates/drizzle-schema.d.ts.map +1 -1
  125. package/dist/templates/drizzle-schema.js +236 -65
  126. package/dist/templates/drizzle-schema.js.map +1 -1
  127. package/dist/templates/entity-constants.d.ts +15 -6
  128. package/dist/templates/entity-constants.d.ts.map +1 -1
  129. package/dist/templates/entity-constants.js +85 -161
  130. package/dist/templates/entity-constants.js.map +1 -1
  131. package/dist/templates/entity-file.d.ts.map +1 -1
  132. package/dist/templates/entity-file.js +38 -4
  133. package/dist/templates/entity-file.js.map +1 -1
  134. package/dist/templates/entity-meta-file.d.ts +15 -1
  135. package/dist/templates/entity-meta-file.d.ts.map +1 -1
  136. package/dist/templates/entity-meta-file.js +12 -2
  137. package/dist/templates/entity-meta-file.js.map +1 -1
  138. package/dist/templates/entity-ui-descriptor.d.ts +112 -0
  139. package/dist/templates/entity-ui-descriptor.d.ts.map +1 -0
  140. package/dist/templates/entity-ui-descriptor.js +238 -0
  141. package/dist/templates/entity-ui-descriptor.js.map +1 -0
  142. package/dist/templates/field-meta.d.ts +46 -9
  143. package/dist/templates/field-meta.d.ts.map +1 -1
  144. package/dist/templates/field-meta.js +95 -21
  145. package/dist/templates/field-meta.js.map +1 -1
  146. package/dist/templates/names-decl.d.ts +38 -0
  147. package/dist/templates/names-decl.d.ts.map +1 -0
  148. package/dist/templates/names-decl.js +104 -0
  149. package/dist/templates/names-decl.js.map +1 -0
  150. package/dist/templates/projection-decl.d.ts +21 -0
  151. package/dist/templates/projection-decl.d.ts.map +1 -1
  152. package/dist/templates/projection-decl.js +53 -29
  153. package/dist/templates/projection-decl.js.map +1 -1
  154. package/dist/templates/queries-file.d.ts.map +1 -1
  155. package/dist/templates/queries-file.js +17 -2
  156. package/dist/templates/queries-file.js.map +1 -1
  157. package/dist/templates/requirement-test.d.ts.map +1 -1
  158. package/dist/templates/requirement-test.js +13 -2
  159. package/dist/templates/requirement-test.js.map +1 -1
  160. package/dist/templates/routes-file-hono.d.ts +2 -1
  161. package/dist/templates/routes-file-hono.d.ts.map +1 -1
  162. package/dist/templates/routes-file-hono.js +11 -2
  163. package/dist/templates/routes-file-hono.js.map +1 -1
  164. package/dist/templates/routes-file.d.ts +2 -1
  165. package/dist/templates/routes-file.d.ts.map +1 -1
  166. package/dist/templates/routes-file.js +54 -21
  167. package/dist/templates/routes-file.js.map +1 -1
  168. package/dist/templates/value-object-file.d.ts.map +1 -1
  169. package/dist/templates/value-object-file.js +15 -1
  170. package/dist/templates/value-object-file.js.map +1 -1
  171. package/dist/templates/view-decl.d.ts +37 -1
  172. package/dist/templates/view-decl.d.ts.map +1 -1
  173. package/dist/templates/view-decl.js +27 -3
  174. package/dist/templates/view-decl.js.map +1 -1
  175. package/dist/templates/zod-validators.d.ts +21 -0
  176. package/dist/templates/zod-validators.d.ts.map +1 -1
  177. package/dist/templates/zod-validators.js +40 -5
  178. package/dist/templates/zod-validators.js.map +1 -1
  179. package/dist/view-context.d.ts +24 -0
  180. package/dist/view-context.d.ts.map +1 -0
  181. package/dist/view-context.js +81 -0
  182. package/dist/view-context.js.map +1 -0
  183. package/package.json +6 -6
  184. package/src/api-surface.ts +53 -0
  185. package/src/column-mapper.ts +13 -0
  186. package/src/constants.ts +91 -16
  187. package/src/db-emitting.ts +31 -0
  188. package/src/generator-registry.ts +14 -4
  189. package/src/generator.ts +5 -0
  190. package/src/generators/agent-docs-file.ts +297 -0
  191. package/src/generators/agent-requirements-page.ts +199 -0
  192. package/src/generators/agent-schema-input.ts +88 -0
  193. package/src/generators/agent-schema-page.ts +297 -0
  194. package/src/generators/agent-ui-page.ts +290 -0
  195. package/src/generators/api-docs-file.ts +13 -6
  196. package/src/generators/api-model.ts +63 -34
  197. package/src/generators/callable-file.ts +1 -1
  198. package/src/generators/docs-data-builder.ts +46 -2
  199. package/src/generators/docs-data.ts +6 -2
  200. package/src/generators/index.ts +25 -14
  201. package/src/generators/names-file.ts +98 -0
  202. package/src/generators/requirements-markdown.ts +36 -2
  203. package/src/generators/routes-file-hono.ts +19 -10
  204. package/src/generators/routes-file.ts +20 -7
  205. package/src/generators/template-generator.ts +20 -6
  206. package/src/index.ts +64 -4
  207. package/src/metaobjects-config.ts +48 -2
  208. package/src/names.ts +629 -0
  209. package/src/overwrite-policy.ts +15 -3
  210. package/src/projection/extract-view-spec.ts +85 -6
  211. package/src/reference/entity.ts +21 -2
  212. package/src/reference/names.ts +125 -0
  213. package/src/reference/queries.ts +19 -3
  214. package/src/reference/routes-hono.ts +19 -9
  215. package/src/reference/routes.ts +25 -9
  216. package/src/reference-templates.ts +1 -1
  217. package/src/render-context.ts +13 -1
  218. package/src/retired-codegen-attrs.ts +52 -0
  219. package/src/routes-expose.ts +86 -0
  220. package/src/runner.ts +122 -11
  221. package/src/templates/callable-file.ts +60 -8
  222. package/src/templates/drizzle-schema.ts +248 -60
  223. package/src/templates/entity-constants.ts +95 -184
  224. package/src/templates/entity-file.ts +46 -4
  225. package/src/templates/entity-meta-file.ts +16 -3
  226. package/src/templates/entity-ui-descriptor.ts +305 -0
  227. package/src/templates/field-meta.ts +100 -19
  228. package/src/templates/names-decl.ts +165 -0
  229. package/src/templates/projection-decl.ts +72 -31
  230. package/src/templates/queries-file.ts +17 -2
  231. package/src/templates/requirement-test.ts +13 -2
  232. package/src/templates/routes-file-hono.ts +14 -2
  233. package/src/templates/routes-file.ts +69 -24
  234. package/src/templates/value-object-file.ts +15 -1
  235. package/src/templates/view-decl.ts +53 -3
  236. package/src/templates/zod-validators.ts +41 -5
  237. package/src/view-context.ts +88 -0
@@ -0,0 +1,241 @@
1
+ // `agent/schema.md` — the physical schema, for an agent about to touch persistence.
2
+ //
3
+ // WHY THIS PAGE EXISTS AND WHY IT LOOKS LIKE THIS
4
+ //
5
+ // The strongest measured finding behind this surface is not about format: roughly 2K
6
+ // tokens of BUSINESS SEMANTICS beside the schema is worth an order of magnitude more
7
+ // than any table-versus-YAML-versus-DDL choice. So every table and column carries its
8
+ // `@description`, and the descriptions come from the snapshot itself — `migrate-ts`
9
+ // already threads them there to emit `COMMENT ON`, which means the page and the database
10
+ // comment cannot disagree.
11
+ //
12
+ // IT DOES NOT RESTATE THE DDL. The migration files ARE the DDL, they are generated, and
13
+ // they are what actually runs. A page that reproduces `CREATE TABLE` is a second spelling
14
+ // of the same fact that goes stale the first time someone regenerates without it — so
15
+ // this page describes the schema and CITES the migrations for the statements.
16
+ //
17
+ // It is TABLE-DRIVEN, not entity-driven, and that is deliberate: a TPH hierarchy folds
18
+ // several entities into one table, an abstract base has none, and an `@unmanaged` object
19
+ // is excluded — all rules `buildExpectedSchema`'s Pass 1 already owns. Walking entities
20
+ // here would mean re-implementing those skip rules and drifting from them. The declaring
21
+ // object is named per table from the provenance map instead.
22
+ import { GENERATION_INCREMENT, GENERATION_UUID } from "@metaobjectsdev/metadata";
23
+ import { GENERATED_HEADER } from "../constants.js";
24
+ const GENERATED_MARKER = `<!-- ${GENERATED_HEADER} — DO NOT EDIT. -->`;
25
+ /** Markdown-escape a cell whose text may contain a `|` (a CHECK expression can). */
26
+ function mdCell(text) {
27
+ return text.replace(/\|/g, "\\|");
28
+ }
29
+ /** Collapse a description to one line — a newline inside a table cell ends the row. */
30
+ function oneLine(text) {
31
+ return text.replace(/\s+/g, " ").trim();
32
+ }
33
+ /** `` `a`, `b` `` — a column list, or an em-dash when empty. */
34
+ function cols(list) {
35
+ return list.length === 0 ? "—" : list.map((c) => `\`${c}\``).join(", ");
36
+ }
37
+ /**
38
+ * The KEY cell: primary / foreign / unique / indexed, most-specific first.
39
+ *
40
+ * A COMPOSITE index is labelled as one. A bare `unique` on a column that is merely one
41
+ * member of a two-column unique index asserts that the column alone is unique — which is
42
+ * false, and false in the direction that makes a reader write a lookup that returns more
43
+ * than one row. The Indexes section below carries the full key; this cell only has to stop
44
+ * being wrong about it.
45
+ */
46
+ function keyCell(table, column) {
47
+ const roles = [];
48
+ if (table.primaryKey.includes(column.name)) {
49
+ roles.push(table.primaryKey.length > 1 ? "PK (composite)" : "PK");
50
+ }
51
+ const fk = table.foreignKeys.find((f) => f.columns.includes(column.name));
52
+ if (fk !== undefined)
53
+ roles.push(`FK → \`${fk.refTable}\``);
54
+ const covering = table.indexes.filter((i) => i.columns.includes(column.name));
55
+ const unique = covering.find((i) => i.unique);
56
+ const index = unique ?? covering[0];
57
+ if (index !== undefined) {
58
+ const label = unique !== undefined ? "unique" : "indexed";
59
+ roles.push(index.columns.length > 1 ? `${label} (composite)` : label);
60
+ }
61
+ return roles.length === 0 ? "" : roles.join(" · ");
62
+ }
63
+ /** The DEFAULT cell. An `expr` default is shown as SQL; a literal as a literal. */
64
+ function defaultCell(column) {
65
+ if (column.identity === GENERATION_INCREMENT)
66
+ return "auto-increment";
67
+ if (column.identity === GENERATION_UUID)
68
+ return "generated uuid";
69
+ if (column.default === undefined)
70
+ return "";
71
+ return `\`${mdCell(column.default.value)}\``;
72
+ }
73
+ function indexLine(ix) {
74
+ const key = ix.expr !== undefined ? `\`${mdCell(ix.expr)}\`` : cols(ix.columns);
75
+ const parts = [`\`${ix.name}\``, ix.unique ? "unique" : "index", `on ${key}`];
76
+ if (ix.using !== undefined && ix.using !== "" && ix.using !== "btree")
77
+ parts.push(`using \`${ix.using}\``);
78
+ if (ix.where !== undefined && ix.where !== "")
79
+ parts.push(`where \`${mdCell(ix.where)}\``);
80
+ return `- ${parts.join(" · ")}`;
81
+ }
82
+ function fkLine(fk) {
83
+ const parts = [
84
+ `\`${fk.name}\``,
85
+ `${cols(fk.columns)} → \`${fk.refTable}\`(${cols(fk.refColumns)})`,
86
+ ];
87
+ if (fk.onDelete !== undefined && fk.onDelete !== "")
88
+ parts.push(`on delete \`${fk.onDelete}\``);
89
+ if (fk.onUpdate !== undefined && fk.onUpdate !== "")
90
+ parts.push(`on update \`${fk.onUpdate}\``);
91
+ return `- ${parts.join(" · ")}`;
92
+ }
93
+ /**
94
+ * One table's section: the declaring object, its description, the column table, then
95
+ * whichever of indexes / foreign keys / checks the table actually has.
96
+ *
97
+ * `declaredBy` maps a physical column name back to the FIELD that declared it — the
98
+ * mapping an agent needs to go from a query it is reading to the metadata it must edit,
99
+ * and the one thing the snapshot alone cannot supply.
100
+ */
101
+ function tableSection(table, input, fqn, declaredBy) {
102
+ const out = [];
103
+ const qualified = table.schema === undefined ? `\`${table.name}\`` : `\`${table.schema}.${table.name}\``;
104
+ out.push(`### ${qualified}`);
105
+ out.push("");
106
+ if (fqn !== undefined)
107
+ out.push(`Declared by \`${fqn}\`.`);
108
+ if (table.description !== undefined && table.description !== "") {
109
+ out.push("");
110
+ out.push(`> ${oneLine(table.description)}`);
111
+ }
112
+ out.push("");
113
+ out.push("| Column | Field | Declared | SQL type | Null | Default | Key |");
114
+ out.push("|---|---|---|---|---|---|---|");
115
+ for (const c of table.columns) {
116
+ const declared = declaredBy.get(c.name);
117
+ out.push(`| \`${c.name}\` | ${declared === undefined ? "" : `\`${declared.field}\``} | ` +
118
+ `${declared === undefined ? "" : `\`${declared.type}\``} | \`${mdCell(input.columnType(c))}\` | ` +
119
+ `${c.nullable ? "yes" : "no"} | ${defaultCell(c)} | ${keyCell(table, c)} |`);
120
+ }
121
+ // Column descriptions ride BELOW the table rather than as an eighth cell: a sentence
122
+ // in a cell forces the whole table wide, and most columns have none.
123
+ const described = table.columns.filter((c) => c.description !== undefined && c.description !== "");
124
+ if (described.length > 0) {
125
+ out.push("");
126
+ for (const c of described)
127
+ out.push(`- \`${c.name}\` — ${oneLine(c.description ?? "")}`);
128
+ }
129
+ if (table.indexes.length > 0) {
130
+ out.push("");
131
+ out.push("**Indexes**");
132
+ out.push("");
133
+ for (const ix of table.indexes)
134
+ out.push(indexLine(ix));
135
+ }
136
+ if (table.foreignKeys.length > 0) {
137
+ out.push("");
138
+ out.push("**Foreign keys**");
139
+ out.push("");
140
+ for (const fk of table.foreignKeys)
141
+ out.push(fkLine(fk));
142
+ }
143
+ if (table.checks.length > 0) {
144
+ out.push("");
145
+ out.push("**Checks**");
146
+ out.push("");
147
+ for (const ck of table.checks)
148
+ out.push(`- \`${ck.name}\` — \`${mdCell(ck.expression)}\``);
149
+ }
150
+ out.push("");
151
+ return out;
152
+ }
153
+ /**
154
+ * Render the whole page. Returns "" when there is no physical schema at all, which is
155
+ * what lets the surface emit no FILE rather than a page describing nothing.
156
+ */
157
+ export function renderAgentSchemaPage(input, opts) {
158
+ if (input.tables.length === 0 && input.views.length === 0)
159
+ return "";
160
+ const out = [];
161
+ out.push(GENERATED_MARKER);
162
+ out.push("");
163
+ out.push("# Schema");
164
+ out.push("");
165
+ out.push(`The physical shape of the \`${input.dialect}\` database this model generates. ` +
166
+ "Read it before writing a query, a migration, or anything that names a table or a column.");
167
+ out.push("");
168
+ out.push("- The **DDL is not repeated here.** The migration files are the DDL, they are " +
169
+ "generated, and they are what runs — this page describes the schema they produce.");
170
+ out.push("- Change the schema by changing the **metadata** and running `meta migrate`. Never " +
171
+ "hand-apply SQL to a live database: it drifts from the migration history and " +
172
+ "collides at the next migrate.");
173
+ out.push("- `Field` and `Declared` are the METADATA names. Edit those; the column name follows.");
174
+ out.push("");
175
+ // The semantics nudge. A schema page carrying business meaning beside the columns is
176
+ // worth more to a reader working from it than any format choice this page could make —
177
+ // and those sentences come from `@description` on the entity and the field, which the
178
+ // snapshot already threads here to emit `COMMENT ON`. A model declaring none renders a
179
+ // page of names with nothing to disambiguate them, and says so, because silently
180
+ // omitting the highest-value content teaches an adopter that it does not exist.
181
+ const anyDescription = input.tables.some((t) => (t.description !== undefined && t.description !== "") ||
182
+ t.columns.some((c) => c.description !== undefined && c.description !== ""));
183
+ if (!anyDescription && input.tables.length > 0) {
184
+ out.push("> **Nothing in this model declares a `description`.** The tables and columns below " +
185
+ "are named but not explained. Adding `description` to an entity or a field is the " +
186
+ "single highest-value change to this page: it is what tells a reader *which* of " +
187
+ "two plausible columns to use, and it is the same text `meta migrate` emits as a " +
188
+ "`COMMENT ON`, so it lands in the database too.");
189
+ out.push("");
190
+ }
191
+ if (input.tables.length > 0) {
192
+ out.push("## Tables");
193
+ out.push("");
194
+ for (const table of [...input.tables].sort((a, b) => a.name.localeCompare(b.name))) {
195
+ const key = input.qualify(table);
196
+ out.push(...tableSection(table, input, input.provenance.get(key), opts.declaredBy.get(key) ?? new Map()));
197
+ }
198
+ }
199
+ if (input.views.length > 0) {
200
+ out.push("## Views");
201
+ out.push("");
202
+ out.push("A view is generated from its projection's `origin.*` children — it is derived, " +
203
+ "never hand-written. Editing the view SQL directly is drift the tool cannot see.");
204
+ out.push("");
205
+ for (const view of [...input.views].sort((a, b) => a.name.localeCompare(b.name))) {
206
+ const key = input.qualify(view);
207
+ const qualified = view.schema === undefined ? `\`${view.name}\`` : `\`${view.schema}.${view.name}\``;
208
+ out.push(`### ${qualified}`);
209
+ out.push("");
210
+ const fqn = input.provenance.get(key);
211
+ if (fqn !== undefined)
212
+ out.push(`Declared by \`${fqn}\`.`);
213
+ const lineage = opts.viewLineage.get(key) ?? [];
214
+ if (lineage.length > 0) {
215
+ out.push("");
216
+ out.push("| Column | Lineage |");
217
+ out.push("|---|---|");
218
+ out.push(...lineage);
219
+ }
220
+ out.push("");
221
+ }
222
+ }
223
+ if (opts.relationships.length > 0) {
224
+ out.push("## Relationships");
225
+ out.push("");
226
+ out.push(...opts.relationships);
227
+ out.push("");
228
+ }
229
+ if (opts.enums.length > 0) {
230
+ out.push("## Enums");
231
+ out.push("");
232
+ out.push("Members are the values the wire and the generated types use. Whether the DATABASE " +
233
+ "also refuses a value outside the set is that table's **Checks** above — an " +
234
+ "`@isArray` enum carries none, and neither does a view column.");
235
+ out.push("");
236
+ out.push(...opts.enums);
237
+ out.push("");
238
+ }
239
+ return `${out.join("\n").replace(/\n+$/, "")}\n`;
240
+ }
241
+ //# sourceMappingURL=agent-schema-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-schema-page.js","sourceRoot":"","sources":["../../src/generators/agent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AAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;QAChC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACb,GAAG,CAAC,IAAI,CACN,oFAAoF;YAClF,6EAA6E;YAC7E,+DAA+D,CAClE,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACb,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,CAAC;IAED,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AACnD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { MetaObject, MetaRoot } from "@metaobjectsdev/metadata";
2
+ /**
3
+ * True when a UI generator would emit for this object.
4
+ *
5
+ * `servesReadApi` — the api-surface predicate the hook, grid and form generators
6
+ * themselves gate on — NOT "has fields" and never an object-subtype test. A form, a grid
7
+ * and a hook are all clients of a generated endpoint, so an object with no endpoint has no
8
+ * UI to document.
9
+ *
10
+ * Getting this wrong is not cosmetic. Gating on "has fields" put a prompt payload
11
+ * (`object.value`, no source, no routes) on the page under a heading that announced an
12
+ * endpoint derived from its name — an address that does not exist, stated as fact, on the
13
+ * page an agent is told to trust. Instance artifacts derive from a declared SOURCE; the
14
+ * UI tier asks the endpoint question and never a storage or subtype one.
15
+ */
16
+ export declare function hasUiSurface(obj: MetaObject): boolean;
17
+ /**
18
+ * Render the page. Returns "" when no object in the model has a UI surface — the surface
19
+ * then emits no FILE, so a headless project sees nothing rather than an empty page.
20
+ */
21
+ export declare function renderAgentUiPage(root: MetaRoot, apiPrefix?: string): string;
22
+ //# sourceMappingURL=agent-ui-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-ui-page.d.ts","sourceRoot":"","sources":["../../src/generators/agent-ui-page.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAY,UAAU,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAiH/E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAErD;AAqBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,SAAK,GAAG,MAAM,CA4FxE"}
@@ -0,0 +1,253 @@
1
+ // `agent/ui.md` — the generated UI surface, for an agent about to touch a form or a grid.
2
+ //
3
+ // The gap this closes is narrow and real: the neutral model entity page renders NO
4
+ // `view.*` or `layout.*` metadata at all, so an agent asked to change a form had nowhere
5
+ // to learn what the form already is and would read the generated TSX — the disposable
6
+ // artifact — as if it were the source.
7
+ //
8
+ // EVERY FIELD ROW COMES FROM `buildEntityUiDescriptor`, the same derivation
9
+ // `renderEntityConstants` emits as the `<Entity>` const in `<Entity>.meta.ts`, which is
10
+ // what `useEntityForm` reads at runtime. One derivation, two renderings: the page cannot
11
+ // describe a control the form does not render, because both answers come from the same
12
+ // call. That is the point of the descriptor extraction, not a nicety.
13
+ //
14
+ // The three columns the descriptor does NOT carry — `@formExclude`, `@filterable` and
15
+ // `@sortable` — are read here from the field, and `@sortable`'s inherit-from-`@filterable`
16
+ // default resolves through `isSortableField`, the SAME predicate the generated
17
+ // `<Entity>SortAllowlist` is built from, so the page cannot say a field is sortable that
18
+ // the endpoint will reject. They are deliberately absent from the descriptor: the
19
+ // descriptor describes how a field is PRESENTED, while those three say whether it appears
20
+ // at all and what the LIST endpoint will accept, which is a different question the form
21
+ // control has no opinion on.
22
+ //
23
+ // THREE THINGS THE DESCRIPTOR ALONE CANNOT ANSWER, each read from the predicate the
24
+ // generator that decides it uses, never re-derived here:
25
+ //
26
+ // • WHERE the object is served — `restPath`, because a TPH subtype is mounted under its
27
+ // discriminator base and its own `$path` names nothing;
28
+ // • WHETHER a form exists at all — `hasGeneratedForm`, the form generator's own filter,
29
+ // because a discriminator base has a write endpoint and still gets no form;
30
+ // • WHAT the control is for a `field.object` — `valueObjectFor`, shared with the form
31
+ // generator, because a resolvable `@objectRef` is rendered as a nested sub-form and
32
+ // the field's view kind is not consulted.
33
+ import { FIELD_ATTR_FILTERABLE, FIELD_ATTR_FORM_EXCLUDE, LAYOUT_DATA_GRID_ATTR_COLUMNS, LAYOUT_DATA_GRID_ATTR_DEFAULT_SORT_FIELD, LAYOUT_DATA_GRID_ATTR_DEFAULT_SORT_ORDER, LAYOUT_DATA_GRID_ATTR_PAGE_SIZE, LAYOUT_SUBTYPE_DATA_GRID, TYPE_LAYOUT, } from "@metaobjectsdev/metadata";
34
+ import { GENERATED_HEADER } from "../constants.js";
35
+ import { hasGeneratedForm, restPath, servedPath, servesReadApi } from "../api-surface.js";
36
+ import { buildEntityUiDescriptor, } from "../templates/entity-ui-descriptor.js";
37
+ import { isSortableField } from "../templates/filter-shared.js";
38
+ import { isTphDiscriminatorBase } from "../templates/tph-discriminator.js";
39
+ import { declaresTphDiscriminator } from "../templates/zod-validators.js";
40
+ const GENERATED_MARKER = `<!-- ${GENERATED_HEADER} — DO NOT EDIT. -->`;
41
+ function mdCell(text) {
42
+ return text.replace(/\|/g, "\\|");
43
+ }
44
+ /** One rule, as a reader wants to see it — the value, not the message. */
45
+ function ruleText(r) {
46
+ switch (r.kind) {
47
+ case "required":
48
+ return "required";
49
+ case "minLength":
50
+ return `minLength ${r.value}`;
51
+ case "maxLength":
52
+ return `maxLength ${r.value}`;
53
+ case "pattern":
54
+ return `pattern \`${mdCell(r.pattern)}\``;
55
+ }
56
+ }
57
+ /**
58
+ * The CONTROL cell — what the generated form renders, which is not always a `view.*`
59
+ * subtype.
60
+ *
61
+ * A `field.object` whose `@objectRef` resolves is emitted as a nested `<fieldset>`
62
+ * sub-form (a `useFieldArray` repeatable group when the field is an array), and the form
63
+ * generator never consults the field's view kind for it. This column used to print that
64
+ * view kind — `text`, the `defaultViewForSubType` fallback — which said the control was a
65
+ * free-text input for a field that has no input at all. Same shape as the `field.enum`
66
+ * descriptor bug, one subtype family over; the predicate is shared with the form
67
+ * generator (`valueObjectFor`) so the two cannot answer differently again.
68
+ */
69
+ function controlCell(f) {
70
+ if (f.nested === undefined)
71
+ return `\`${f.view}\``;
72
+ return f.nested.isArray ? "nested sub-form (repeatable)" : "nested sub-form";
73
+ }
74
+ /** The HTML type cell — empty for a nested sub-form, which is not an input at all. */
75
+ function htmlTypeCell(f) {
76
+ if (f.nested !== undefined || f.htmlType === undefined)
77
+ return "";
78
+ return `\`${f.htmlType}\``;
79
+ }
80
+ /** `yes` / `` — an empty cell reads better than a column of "no". */
81
+ function flag(value) {
82
+ return value === true ? "yes" : "";
83
+ }
84
+ /**
85
+ * The endpoint line under an object's heading.
86
+ *
87
+ * THE `apiPrefix` IS PART OF THE ADDRESS. `routes-file.ts` registers every mount inside
88
+ * `fastify.register(…, { prefix: apiPrefix })`, so a project configuring `/api` serves
89
+ * `/api/owners` and nothing at `/owners`. This page states that its heading is the address
90
+ * the routes mount at, so omitting the prefix made that promise false for every project
91
+ * that sets one — and a reader following it gets a 404.
92
+ *
93
+ * `restPath`, NOT `descriptor.path`: a TPH subtype's own `$path` names an address
94
+ * nothing mounts — the hierarchy is mounted from the discriminator base, each subtype
95
+ * at `<base>/<segment>` — and this page printed that non-existent address as fact.
96
+ * Whether a form exists is `hasGeneratedForm` — the form generator's OWN filter —
97
+ * never `servesWriteApi`. A read-only object (a projection, a view-backed entity) has
98
+ * no Insert/Update schema; a TPH discriminator BASE has both and still gets no form,
99
+ * because you cannot create a base and its polymorphic mount is read-only by
100
+ * construction. Saying so is the difference between "the form is missing" and "there
101
+ * is deliberately no form"; asking the endpoint question announced one for every base.
102
+ */
103
+ function endpointLine(obj, root, apiPrefix) {
104
+ const endpoint = servedPath(obj, apiPrefix);
105
+ if (hasGeneratedForm(obj))
106
+ return `Endpoint \`${endpoint}\`.`;
107
+ // `isTphDiscriminatorBase`, which requires at least one CONCRETE subtype — the same
108
+ // predicate `routes-file.ts` switches on. `@discriminator` with no subtype yet is a
109
+ // refactor-in-progress shape: the routes generator emits the VANILLA full-CRUD file for
110
+ // it, so "each concrete subtype below has its own" would name subtypes that do not
111
+ // exist, on an object that does have a write endpoint.
112
+ // THREE reasons, not two. `isTphDiscriminatorBase` requires at least one CONCRETE
113
+ // subtype — the same predicate `routes-file.ts` switches on — and the case it excludes
114
+ // is real: an object declaring `@discriminator` with no subtype yet gets the VANILLA
115
+ // full-CRUD routes file, so it is NOT read-only, while the form generator declines it
116
+ // for declaring `@discriminator` at all. Calling that "read-only" is false in the one
117
+ // direction that matters, since a reader would conclude it cannot be written to.
118
+ const reason = isTphDiscriminatorBase(obj, root)
119
+ ? "for a discriminator base — its own mount is list/get only, and each concrete " +
120
+ "subtype below has its own form"
121
+ : declaresTphDiscriminator(obj)
122
+ ? "— the form generator declines any object declaring `@discriminator`, and this " +
123
+ "one has no concrete subtype yet. Its routes are the ordinary full CRUD set"
124
+ : "(read-only)";
125
+ return (`Endpoint \`${endpoint}\` — **no form is generated** ${reason}. ` +
126
+ "The fields below describe the grid and the filters.");
127
+ }
128
+ /** The `layout.dataGrid` children an object declares. ADR-0039: resolving. */
129
+ function dataGrids(obj) {
130
+ return obj
131
+ .children()
132
+ .filter((c) => c.type === TYPE_LAYOUT && c.subType === LAYOUT_SUBTYPE_DATA_GRID);
133
+ }
134
+ /**
135
+ * True when a UI generator would emit for this object.
136
+ *
137
+ * `servesReadApi` — the api-surface predicate the hook, grid and form generators
138
+ * themselves gate on — NOT "has fields" and never an object-subtype test. A form, a grid
139
+ * and a hook are all clients of a generated endpoint, so an object with no endpoint has no
140
+ * UI to document.
141
+ *
142
+ * Getting this wrong is not cosmetic. Gating on "has fields" put a prompt payload
143
+ * (`object.value`, no source, no routes) on the page under a heading that announced an
144
+ * endpoint derived from its name — an address that does not exist, stated as fact, on the
145
+ * page an agent is told to trust. Instance artifacts derive from a declared SOURCE; the
146
+ * UI tier asks the endpoint question and never a storage or subtype one.
147
+ */
148
+ export function hasUiSurface(obj) {
149
+ return servesReadApi(obj);
150
+ }
151
+ function gridSection(grid) {
152
+ const out = [];
153
+ out.push(`**Grid \`${grid.name}\`**`);
154
+ out.push("");
155
+ const columns = grid.attr(LAYOUT_DATA_GRID_ATTR_COLUMNS);
156
+ if (Array.isArray(columns) && columns.length > 0) {
157
+ out.push(`- columns: ${columns.map((c) => `\`${String(c)}\``).join(", ")}`);
158
+ }
159
+ const sortField = grid.attr(LAYOUT_DATA_GRID_ATTR_DEFAULT_SORT_FIELD);
160
+ if (typeof sortField === "string" && sortField !== "") {
161
+ const order = grid.attr(LAYOUT_DATA_GRID_ATTR_DEFAULT_SORT_ORDER);
162
+ const suffix = typeof order === "string" && order !== "" ? `:${order}` : "";
163
+ out.push(`- default sort: \`${sortField}${suffix}\``);
164
+ }
165
+ const pageSize = grid.attr(LAYOUT_DATA_GRID_ATTR_PAGE_SIZE);
166
+ if (typeof pageSize === "number")
167
+ out.push(`- page size: ${pageSize}`);
168
+ return out;
169
+ }
170
+ /**
171
+ * Render the page. Returns "" when no object in the model has a UI surface — the surface
172
+ * then emits no FILE, so a headless project sees nothing rather than an empty page.
173
+ */
174
+ export function renderAgentUiPage(root, apiPrefix = "") {
175
+ const objects = root.objects();
176
+ const withUi = objects.filter(hasUiSurface);
177
+ if (withUi.length === 0)
178
+ return "";
179
+ const out = [];
180
+ out.push(GENERATED_MARKER);
181
+ out.push("");
182
+ out.push("# UI");
183
+ out.push("");
184
+ out.push("What the generated forms and grids already are. Read it before changing a form, a " +
185
+ "grid or a filter — the generated `.tsx` is the disposable artifact, this is what " +
186
+ "produced it.");
187
+ out.push("");
188
+ out.push("- Every row here is the SAME derivation the runtime reads — `buildEntityUiDescriptor`, " +
189
+ "which is emitted as the `<Entity>` const in `<Entity>.meta.ts` and consumed by " +
190
+ "`useEntityForm`. Changing the metadata changes both. A READ-ONLY projection's const " +
191
+ "carries the subset that applies to it (no form, so no rules and no HTML type) plus " +
192
+ "the `dbCol` only a view-backed const has.");
193
+ out.push("- `Control` is what the FORM renders. A field declaring several views is described by " +
194
+ "the one named `form`; a `field.object` whose `@objectRef` resolves is not an input " +
195
+ "at all but a nested sub-form over that value object, and says so.");
196
+ out.push("- `Filter` / `Sort` are what the generated LIST endpoint accepts. `@sortable` " +
197
+ "defaults to `@filterable`, and the resolved answer is what is shown.");
198
+ out.push("");
199
+ for (const obj of withUi) {
200
+ out.push(`## \`${obj.resolutionKey()}\``);
201
+ out.push("");
202
+ const descriptor = buildEntityUiDescriptor(obj, root);
203
+ out.push(endpointLine(obj, root, apiPrefix));
204
+ out.push("");
205
+ if (descriptor.fields.length > 0) {
206
+ // The field nodes, keyed by name, so the three non-descriptor columns can be read
207
+ // off the field the descriptor row came from.
208
+ const byName = new Map(obj.fields().map((f) => [f.name, f]));
209
+ out.push("| Field | Label | Control | HTML type | Rules | Excluded | Filter | Sort |");
210
+ out.push("|---|---|---|---|---|---|---|---|");
211
+ for (const f of descriptor.fields) {
212
+ const node = byName.get(f.name);
213
+ const cells = [
214
+ `\`${f.name}\``,
215
+ mdCell(f.label),
216
+ controlCell(f),
217
+ htmlTypeCell(f),
218
+ f.rules.map(ruleText).join(" · "),
219
+ node === undefined ? "" : flag(node.attr(FIELD_ATTR_FORM_EXCLUDE)),
220
+ node === undefined ? "" : flag(node.attr(FIELD_ATTR_FILTERABLE)),
221
+ node === undefined ? "" : flag(isSortableField(node)),
222
+ ];
223
+ out.push(`| ${cells.join(" | ")} |`);
224
+ }
225
+ // Which value object a nested field expands into rides below the table: it is the
226
+ // one thing a reader needs to go and edit, and it does not fit a cell.
227
+ const nested = descriptor.fields.filter((f) => f.nested !== undefined);
228
+ if (nested.length > 0) {
229
+ out.push("");
230
+ for (const f of nested) {
231
+ out.push(`- \`${f.name}\` — expands \`${f.nested?.objectRef}\`` +
232
+ `${f.nested?.isArray === true ? ", one group per element" : ""}. Change the ` +
233
+ "fields inside it on that value object, not here.");
234
+ }
235
+ }
236
+ const money = descriptor.fields.filter((f) => f.currency !== undefined);
237
+ if (money.length > 0) {
238
+ out.push("");
239
+ for (const f of money) {
240
+ out.push(`- \`${f.name}\` — money: \`${f.currency?.currency}\` formatted for ` +
241
+ `\`${f.currency?.locale}\`. Stored and sent as INTEGER MINOR UNITS; never format it server-side.`);
242
+ }
243
+ }
244
+ }
245
+ for (const grid of dataGrids(obj)) {
246
+ out.push("");
247
+ out.push(...gridSection(grid));
248
+ }
249
+ out.push("");
250
+ }
251
+ return `${out.join("\n").replace(/\n+$/, "")}\n`;
252
+ }
253
+ //# sourceMappingURL=agent-ui-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-ui-page.js","sourceRoot":"","sources":["../../src/generators/agent-ui-page.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,EAAE;AACF,mFAAmF;AACnF,yFAAyF;AACzF,sFAAsF;AACtF,uCAAuC;AACvC,EAAE;AACF,4EAA4E;AAC5E,wFAAwF;AACxF,yFAAyF;AACzF,uFAAuF;AACvF,sEAAsE;AACtE,EAAE;AACF,sFAAsF;AACtF,2FAA2F;AAC3F,+EAA+E;AAC/E,yFAAyF;AACzF,kFAAkF;AAClF,0FAA0F;AAC1F,wFAAwF;AACxF,6BAA6B;AAC7B,EAAE;AACF,oFAAoF;AACpF,yDAAyD;AACzD,EAAE;AACF,0FAA0F;AAC1F,4DAA4D;AAC5D,0FAA0F;AAC1F,gFAAgF;AAChF,wFAAwF;AACxF,wFAAwF;AACxF,8CAA8C;AAE9C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,wCAAwC,EACxC,wCAAwC,EACxC,+BAA+B,EAC/B,wBAAwB,EACxB,WAAW,GACZ,MAAM,0BAA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CAAC;YAClC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACb,GAAG,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QACjC,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,CAAC;IAED,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AACnD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"api-docs-file.d.ts","sourceRoot":"","sources":["../../src/generators/api-docs-file.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAa,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AA2BhF,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;qEAGiE;IACjE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAwEnB,gBAAgB,CAAC,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"api-docs-file.d.ts","sourceRoot":"","sources":["../../src/generators/api-docs-file.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAa,gBAAgB,EAAe,MAAM,iBAAiB,CAAC;AA2BhF,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;qEAGiE;IACjE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EA2EnB,gBAAgB,CAAC,eAAe,CAAC,CAAC"}
@@ -18,12 +18,16 @@
18
18
  // Part 3) — so it appears in `gen --list` and is selectable by its stable name
19
19
  // `api-docs`. It is NOT a `meta docs` mode.
20
20
  //
21
- // It is NOT (yet) part of the default `meta gen` scaffold suite: it is
22
- // registry-listed but not auto-run. Turning it on by default in the scaffold,
23
- // and surfacing the agent form (AGENT-API.md) to a coding agent via a pointer
24
- // from the installed `.metaobjects/` context, are tracked as agent-context-
25
- // coordination follow-ups deliberately deferred here to avoid colliding with
26
- // the live agent-context work.
21
+ // It is NOT part of the default `meta gen` scaffold suite: it is registry-listed but not
22
+ // auto-run. `meta docs` is the door that emits it.
23
+ //
24
+ // THE POINTER IS NO LONGER DEFERRED. This header used to record "surfacing the agent form
25
+ // (AGENT-API.md) to a coding agent via a pointer from the installed `.metaobjects/`
26
+ // context" as an agent-context-coordination follow-up. It was deferred, no roadmap item
27
+ // tracked it, and for as long as that held, the page existed and nothing routed an agent
28
+ // to it. `agent-context/templates/always-on.md.mustache` now names this file and the three
29
+ // `agent/` pages, and says when to read each. If you rename or move this artifact, that
30
+ // template is the other half.
27
31
  import { docPageOutputPath, surfaceCrossHref, assertNoDuplicateDocPaths, } from "../docs-paths.js";
28
32
  import { projectProvider } from "../render-engine/framework-provider.js";
29
33
  import { buildApiModel } from "./api-model.js";
@@ -66,6 +70,9 @@ export const apiDocsFile = function apiDocsFile(opts) {
66
70
  loadedRoot: ctx.loadedRoot,
67
71
  outputLayout: layout,
68
72
  includeHonoRoutes: ctx.config.includeHonoRoutes ?? false,
73
+ // The project's prefix, because every route is mounted inside it. Without
74
+ // this the page documents `/authors` for routes served at `/api/authors`.
75
+ apiPrefix: ctx.renderContext?.apiPrefix ?? "",
69
76
  ...(ctx.renderContext?.pkMap !== undefined && { pkMap: ctx.renderContext.pkMap }),
70
77
  });
71
78
  // Track (path, fqn) for the SAME hard collision backstop docsFile() uses —
@@ -1 +1 @@
1
- {"version":3,"file":"api-docs-file.js","sourceRoot":"","sources":["../../src/generators/api-docs-file.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,sEAAsE;AACtE,gFAAgF;AAChF,0EAA0E;AAC1E,iFAAiF;AACjF,EAAE;AACF,kCAAkC;AAClC,0EAA0E;AAC1E,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,4CAA4C;AAC5C,EAAE;AACF,uEAAuE;AACvE,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,+BAA+B;AAI/B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,GAG1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAC/E,6EAA6E;AAC7E,gFAAgF;AAChF,kDAAkD;AAClD,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,4EAA4E;AAC5E,2EAA2E;AAC3E,MAAM,eAAe,GAAG,UAAU,CAAC;AAcnC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,WAAW,CAAC,IAAsB;IACpE,MAAM,SAAS,GAAc;QAC3B,IAAI,EAAE,UAAU;QAChB,QAAQ,CAAC,GAAG;YACV,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACnE,MAAM,MAAM,GAAG,GAA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S,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAsC,CAAC"}
1
+ {"version":3,"file":"api-docs-file.js","sourceRoot":"","sources":["../../src/generators/api-docs-file.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,sEAAsE;AACtE,gFAAgF;AAChF,0EAA0E;AAC1E,iFAAiF;AACjF,EAAE;AACF,kCAAkC;AAClC,0EAA0E;AAC1E,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,4CAA4C;AAC5C,EAAE;AACF,yFAAyF;AACzF,mDAAmD;AACnD,EAAE;AACF,0FAA0F;AAC1F,oFAAoF;AACpF,wFAAwF;AACxF,yFAAyF;AACzF,2FAA2F;AAC3F,wFAAwF;AACxF,8BAA8B;AAI9B,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,GAG1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAC/E,6EAA6E;AAC7E,gFAAgF;AAChF,kDAAkD;AAClD,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,4EAA4E;AAC5E,2EAA2E;AAC3E,MAAM,eAAe,GAAG,UAAU,CAAC;AAcnC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,WAAW,CAAC,IAAsB;IACpE,MAAM,SAAS,GAAc;QAC3B,IAAI,EAAE,UAAU;QAChB,QAAQ,CAAC,GAAG;YACV,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,WAAW,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tC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IACF,IAAI,IAAI,EAAE,MAAM;QAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACjD,IAAI,IAAI,EAAE,MAAM;QAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACjD,OAAO,SAAS,CAAC;AACnB,CAAsC,CAAC"}
@@ -117,6 +117,12 @@ export interface ApiModelContext {
117
117
  * run didn't configure). The Fastify REST surface is always documented (it is
118
118
  * the default-suite routes generator). Defaults to false. */
119
119
  includeHonoRoutes?: boolean;
120
+ /** The project's `apiPrefix`. Every generated route is mounted inside
121
+ * `fastify.register(…, { prefix: apiPrefix })`, so it is part of the address a
122
+ * documented endpoint is served at — a page that omits it is one path segment
123
+ * short. Threaded explicitly rather than read off the RenderContext below,
124
+ * which is a `{ pkMap }` shim and carries nothing else. Defaults to "". */
125
+ apiPrefix?: string;
120
126
  }
121
127
  export declare function buildApiModel(root: MetaRoot, ctx: ApiModelContext): ApiModel;
122
128
  //# sourceMappingURL=api-model.d.ts.map