@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
@@ -1,19 +1,21 @@
1
- // ADR-0034 scaffold-and-own — these built-in generator factories remain the engine's
2
- // internal composers, but importing them from `@metaobjectsdev/codegen-ts/generators`
3
- // into a consumer's `metaobjects.config.ts` is DEPRECATED. The recommended path is to
4
- // own copyable reference templates in your repo (`meta init` scaffolds them into
5
- // `codegen/generators/*.ts`) and import those locally. This package export will be
6
- // removed in a future major. See spec/decisions/ADR-0034-codegen-scaffold-and-own.md.
7
- /** @deprecated ADR-0034 own a copy instead: `import { entityFile } from "./codegen/generators/entity"` (scaffolded by `meta init`). */
8
- export { entityFile } from "./entity-file.js";
9
- /** @deprecated ADR-0034 — own a copy instead: `import { queriesFile } from "./codegen/generators/queries"` (scaffolded by `meta init`). */
10
- export { queriesFile } from "./queries-file.js";
1
+ // Built-in generator factories.
2
+ //
3
+ // ADR-0034 scaffold-and-own `entityFile`, `queriesFile`, `routesFile` and `barrel` were
4
+ // exported here and DEPRECATED; 1.0 REMOVED them (ADR-0035 A3, `docs/1.0-readiness.md` G2,
5
+ // `docs/features/migrations/0.x-to-1.0.md` §11). Own a copy instead: `meta init` scaffolds
6
+ // them into `codegen/generators/*.ts` and `meta eject <name>` copies one at any time. They
7
+ // remain in this directory as the engine's internal composers and as the oracle the
8
+ // byte-identity gate holds each reference template to — they are no longer public API.
9
+ //
10
+ // The factories BELOW are not deprecated and this subpath is their supported public home:
11
+ // the prompt/output tier (`promptRender`, `outputParser`, `outputPrompt`, `extractor`,
12
+ // `renderHelper`, `traceHelperFile`) is upstream-owned and has no ownable copy — the CLI's
13
+ // own prompt-gate warning names this import path — and `routesFileHono` / `namesFile` /
14
+ // `callableFile` are stock generators a consumer wires directly.
15
+ // See spec/decisions/ADR-0034-codegen-scaffold-and-own.md.
11
16
  export { callableFile } from "./callable-file.js";
12
- /** @deprecated ADR-0034 — own a copy instead: `import { routesFile } from "./codegen/generators/routes"` (scaffolded by `meta init`). */
13
- export { routesFile } from "./routes-file.js";
14
17
  export { routesFileHono } from "./routes-file-hono.js";
15
- /** @deprecated ADR-0034 — own a copy instead: `import { barrel } from "./codegen/generators/barrel"` (scaffolded by `meta init`). */
16
- export { barrel } from "./barrel.js";
18
+ export { namesFile } from "./names-file.js";
17
19
  /** @deprecated ADR-0021 D1 — neutral artifact owned by `meta docs` (ADR-0020); not part of the recommended `meta gen` suite. */
18
20
  export { mermaidErDiagram } from "./mermaid-er.js";
19
21
  export { promptRender } from "./prompt-render-file.js";
@@ -34,4 +36,7 @@ export { buildTemplateDocData } from "./template-doc-builder.js";
34
36
  // behaviour composes its own generator instead of filing an issue here.
35
37
  export { requirementTests } from "./requirement-tests.js";
36
38
  export { requirementsFile } from "./requirements-file.js";
39
+ // The `agent` docs surface — internal engine of `meta docs --agent`, like docsFile()
40
+ // and apiDocsFile(). Not a `meta gen` config generator.
41
+ export { agentDocsFile } from "./agent-docs-file.js";
37
42
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,sFAAsF;AACtF,sFAAsF;AACtF,iFAAiF;AACjF,mFAAmF;AACnF,sFAAsF;AAEtF,yIAAyI;AACzI,OAAO,EAAE,UAAU,EAAuB,MAAM,kBAAkB,CAAC;AACnE,2IAA2I;AAC3I,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AACzE,yIAAyI;AACzI,OAAO,EAAE,UAAU,EAAuB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,cAAc,EAA2B,MAAM,uBAAuB,CAAC;AAChF,qIAAqI;AACrI,OAAO,EAAE,MAAM,EAAmB,MAAM,aAAa,CAAC;AACtD,gIAAgI;AAChI,OAAO,EAAE,gBAAgB,EAAyB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAyB,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAyB,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAsB,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAyB,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAyB,MAAM,yBAAyB,CAAC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E,OAAO,EAAE,YAAY,EAAyB,MAAM,yBAAyB,CAAC;AAC9E,oKAAoK;AACpK,OAAO,EAAE,WAAW,EAAwB,MAAM,oBAAoB,CAAC;AACvE,iJAAiJ;AACjJ,OAAO,EAAE,QAAQ,EAAqB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACL,iBAAiB,GAIlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAwB,MAAM,wBAAwB,CAAC;AAS/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,6EAA6E;AAC7E,8EAA8E;AAC9E,wEAAwE;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,qFAAqF;AACrF,wDAAwD;AACxD,OAAO,EAAE,aAAa,EAA0B,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Generator } from "../generator.js";
2
+ /**
3
+ * §A1/§A2/§A6 — `<Entity>Names`: the physical database names for one object, as constants a
4
+ * hand-written consumer references instead of a string literal.
5
+ *
6
+ * This is the built-in twin of `src/reference/names.ts` (ADR-0034 scaffold-and-own —
7
+ * `meta init` copies the reference file into the adopter's repo; this one stays the
8
+ * engine's internal composer and the reference-byte-identical gate's other half). Same
9
+ * `generate` body; only the import paths differ (relative package-internal here, the
10
+ * public `@metaobjectsdev/codegen-ts` barrel there).
11
+ *
12
+ * Deliberately a SEPARATE generator, never a boolean on the entity generator — a new
13
+ * artifact is a MINOR under docs/compatibility-policy.md and adds zero bytes to existing
14
+ * files, where a flag would move every $table-carrying golden for the same functionality.
15
+ */
16
+ export declare function namesFile(): Generator;
17
+ //# sourceMappingURL=names-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names-file.d.ts","sourceRoot":"","sources":["../../src/generators/names-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAA2B,MAAM,iBAAiB,CAAC;AAM1E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,IAAI,SAAS,CA6ErC"}
@@ -0,0 +1,95 @@
1
+ import { entityOutputPath, crossEntitySpecifier } from "../import-path.js";
2
+ import { renderNamesDecl } from "../templates/names-decl.js";
3
+ import { namesArtifactSuperOf, resolveObjectNames } from "../names.js";
4
+ /**
5
+ * §A1/§A2/§A6 — `<Entity>Names`: the physical database names for one object, as constants a
6
+ * hand-written consumer references instead of a string literal.
7
+ *
8
+ * This is the built-in twin of `src/reference/names.ts` (ADR-0034 scaffold-and-own —
9
+ * `meta init` copies the reference file into the adopter's repo; this one stays the
10
+ * engine's internal composer and the reference-byte-identical gate's other half). Same
11
+ * `generate` body; only the import paths differ (relative package-internal here, the
12
+ * public `@metaobjectsdev/codegen-ts` barrel there).
13
+ *
14
+ * Deliberately a SEPARATE generator, never a boolean on the entity generator — a new
15
+ * artifact is a MINOR under docs/compatibility-policy.md and adds zero bytes to existing
16
+ * files, where a flag would move every $table-carrying golden for the same functionality.
17
+ */
18
+ export function namesFile() {
19
+ return {
20
+ name: "names",
21
+ // §A6 — the marker the runner aggregates into ResolvedGenConfig.includeNames, so the
22
+ // entity generator can tell whether this artifact will exist. Exactly the mechanism
23
+ // routesFileHono already uses via emitsHonoRoutes/includeHonoRoutes.
24
+ emitsNames: true,
25
+ generate: (ctx) => {
26
+ const layout = ctx.config.outputLayout ?? "flat";
27
+ const extStyle = ctx.config.extStyle ?? "js";
28
+ // The strategy lives on the RENDER CONTEXT, not on ResolvedGenConfig — `ctx.config`
29
+ // carries outDir/extStyle/dbImport/dialect and nothing about naming.
30
+ const strategy = ctx.renderContext?.columnNamingStrategy;
31
+ const pathOf = (obj) =>
32
+ // entityOutputPath, not a bare filename: §A6 makes the entity module IMPORT these
33
+ // constants, so the artifact has to land in the same directory the entity module
34
+ // does. Under outputLayout: "package" a bare name puts it at the target ROOT while
35
+ // its entity sits at <pkg>/<Entity>.ts — an unresolvable import, and a hard
36
+ // conflicting-duplicate-path failure as soon as two packages declare a
37
+ // same-bare-named entity.
38
+ entityOutputPath(layout, obj.package, `${obj.name}.names.ts`);
39
+ const superSpecifierFor = (obj) => {
40
+ const sup = namesArtifactSuperOf(obj);
41
+ return sup === undefined
42
+ ? undefined
43
+ : crossEntitySpecifier(layout, obj.package, sup.package, `${sup.name}.names`, extStyle);
44
+ };
45
+ const out = [];
46
+ // Pass 1 — every matched object that participates in the database (#248).
47
+ // `emitted` tracks what pass 1 actually WROTE, not what it looked at: a matched
48
+ // abstract base emits nothing here, and seeding it as already-emitted is what would
49
+ // make pass 2 skip the very object it exists to produce.
50
+ const emitted = new Set();
51
+ const participants = ctx.entities.filter(ctx.matches);
52
+ for (const entity of participants) {
53
+ const content = renderNamesDecl(entity, {
54
+ strategy, superSpecifier: superSpecifierFor(entity),
55
+ });
56
+ if (content === "")
57
+ continue; // no primary source ⇒ no names artifact (#248)
58
+ emitted.add(entity.resolutionKey());
59
+ out.push({ path: pathOf(entity), content });
60
+ }
61
+ // Pass 2 — the abstract bases those participants EXTEND. Each carries the columns it
62
+ // declares, so a child states them once rather than restating its parent's.
63
+ //
64
+ // Reached by walking UP from a participant, never by scanning for abstracts: that is
65
+ // what keeps #248 intact. A sourceless object nothing persistable extends — an
66
+ // `object.value`, say — is not reached, so it acquires no artifact and no phantom
67
+ // participation. Two children of one base both reach it and emit the same file at
68
+ // the same path with the same bytes; the runner collapses byte-identical duplicates
69
+ // (#266), so it is written once. `emitted` keeps that from even arising, and keeps
70
+ // the walk from re-rendering the same base once per child.
71
+ for (const entity of participants) {
72
+ if (resolveObjectNames(entity, strategy) === undefined)
73
+ continue;
74
+ for (let sup = namesArtifactSuperOf(entity); sup !== undefined; sup = namesArtifactSuperOf(sup)) {
75
+ const key = sup.resolutionKey();
76
+ if (emitted.has(key))
77
+ break; // already emitted, and so is everything above it
78
+ emitted.add(key);
79
+ // `fragment` says "this is an ancestor render", not which shape to render:
80
+ // `renderNamesDecl` derives that from the object itself, so a TPH base reached
81
+ // by this walk keeps the shared table it owns. Deciding it there rather than
82
+ // here is what makes the EJECTED copy of this generator correct too.
83
+ const content = renderNamesDecl(sup, {
84
+ strategy, superSpecifier: superSpecifierFor(sup), fragment: true,
85
+ });
86
+ if (content === "")
87
+ continue;
88
+ out.push({ path: pathOf(sup), content });
89
+ }
90
+ }
91
+ return out;
92
+ },
93
+ };
94
+ }
95
+ //# sourceMappingURL=names-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names-file.js","sourceRoot":"","sources":["../../src/generators/names-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGvE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,IAAI,EAAE,OAAO;QACb,qFAAqF;QACrF,oFAAoF;QACpF,qEAAqE;QACrE,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,CAAC,GAAe,EAAiB,EAAE;YAC3C,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC;YACjD,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC;YAC7C,oFAAoF;YACpF,qEAAqE;YACrE,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,EAAE,oBAAoB,CAAC;YAEzD,MAAM,MAAM,GAAG,CAAC,GAAe,EAAU,EAAE;YACzC,kFAAkF;YAClF,iFAAiF;YACjF,mFAAmF;YACnF,4EAA4E;YAC5E,uEAAuE;YACvE,0BAA0B;YAC1B,gBAAgB,CAAC,MAAM,EAAE,GAAG,C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AE,CAAC;gBAClC,IAAI,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,SAAS;oBAAE,SAAS;gBACjE,KAAK,IAAI,GAAG,GAAG,oBAAoB,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,SAAS,EACzD,GAAG,GAAG,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;oBACrC,MAAM,GAAG,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC;oBAChC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;wBAAE,MAAM,CAAG,iDAAiD;oBAChF,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;oBACjB,2EAA2E;oBAC3E,+EAA+E;oBAC/E,6EAA6E;oBAC7E,qEAAqE;oBACrE,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,EAAE;wBACnC,QAAQ,EAAE,cAAc,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI;qBACjE,CAAC,CAAC;oBACH,IAAI,OAAO,KAAK,EAAE;wBAAE,SAAS;oBAC7B,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -6,5 +6,22 @@ import type { RequirementRow } from "./requirements-view.js";
6
6
  * The generator keys on that to emit no file at all, which is in turn what lets the
7
7
  * surface default to on without changing output for any project lacking a ledger.
8
8
  */
9
- export declare function renderRequirementsMarkdown(rows: readonly RequirementRow[]): string;
9
+ export interface RequirementsMarkdownOpts {
10
+ /**
11
+ * Render the ledger as a SECTION of a larger page rather than as the page.
12
+ *
13
+ * The `agent/requirements.md` surface carries this ledger under its own `## The ledger`
14
+ * heading, and an embedded copy that keeps its `# Requirements` title gives the page two
15
+ * H1s and reparents every entry as a sibling of the section that contains it — the
16
+ * document silently loses its outline. So the title is dropped and every heading moves
17
+ * down one level.
18
+ *
19
+ * A POST-HOC REGEX OVER THIS FUNCTION'S OUTPUT would do the same thing and would be the
20
+ * wrong shape: heading depth is this renderer's decision (it already caps at h6), and a
21
+ * caller rewriting it from outside would have to re-derive that cap and would drift from
22
+ * it the next time this file changes.
23
+ */
24
+ readonly embedded?: boolean;
25
+ }
26
+ export declare function renderRequirementsMarkdown(rows: readonly RequirementRow[], opts?: RequirementsMarkdownOpts): string;
10
27
  //# sourceMappingURL=requirements-markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"requirements-markdown.d.ts","sourceRoot":"","sources":["../../src/generators/requirements-markdown.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA8D7D;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAUlF"}
1
+ {"version":3,"file":"requirements-markdown.d.ts","sourceRoot":"","sources":["../../src/generators/requirements-markdown.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA8D7D;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,SAAS,cAAc,EAAE,EAC/B,IAAI,CAAC,EAAE,wBAAwB,GAC9B,MAAM,CAuBR"}
@@ -76,22 +76,24 @@ function renderOne(r) {
76
76
  }
77
77
  return out.join("\n");
78
78
  }
79
- /**
80
- * Render the ledger as one markdown index.
81
- *
82
- * Returns the EMPTY STRING for an empty ledger rather than a headed-but-empty page.
83
- * The generator keys on that to emit no file at all, which is in turn what lets the
84
- * surface default to on without changing output for any project lacking a ledger.
85
- */
86
- export function renderRequirementsMarkdown(rows) {
79
+ export function renderRequirementsMarkdown(rows, opts) {
87
80
  if (rows.length === 0)
88
81
  return "";
82
+ const body = rows.map(renderOne);
83
+ if (opts?.embedded === true) {
84
+ return [
85
+ `${rows.length} declared requirement${rows.length === 1 ? "" : "s"}, in declaration order.`,
86
+ "",
87
+ // One extra `#` on every heading line, capped at h6 exactly as `heading()` caps.
88
+ ...body.map((entry) => entry.replace(/^(#{1,6}) /gm, (_m, hashes) => `${"#".repeat(Math.min(hashes.length + 1, 6))} `)),
89
+ ].join("\n");
90
+ }
89
91
  return [
90
92
  "# Requirements",
91
93
  "",
92
94
  `${rows.length} declared requirement${rows.length === 1 ? "" : "s"}, in declaration order.`,
93
95
  "",
94
- ...rows.map(renderOne),
96
+ ...body,
95
97
  ].join("\n");
96
98
  }
97
99
  //# sourceMappingURL=requirements-markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"requirements-markdown.js","sourceRoot":"","sources":["../../src/generators/requirements-markdown.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,sFAAsF;AACtF,EAAE;AACF,sFAAsF;AACtF,EAAE;AACF,sFAAsF;AACtF,wFAAwF;AACxF,qDAAqD;AACrD,EAAE;AACF,yFAAyF;AACzF,wFAAwF;AACxF,wFAAwF;AACxF,mFAAmF;AACnF,mFAAmF;AACnF,EAAE;AACF,yFAAyF;AACzF,oFAAoF;AAIpF,wFAAwF;AACxF,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,WAAW,CAAC,CAAiB;IACpC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACnD,MAAM,KAAK,GAAG,KAAK,KAAK,SAAS,IAAI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AAC,cAAc,KAAK,SAAS;QAAE,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,cAAc,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5F,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAE7D,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAA+B;IACxE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEjC,OAAO;QACL,gBAAgB;QAChB,EAAE;QACF,GAAG,IAAI,CAAC,MAAM,wBAAwB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,yBAAyB;QAC3F,EAAE;QACF,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;KACvB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"requirements-markdown.js","sourceRoot":"","sources":["../../src/generators/requirements-markdown.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,sFAAsF;AACtF,EAAE;AACF,sFAAsF;AACtF,EAAE;AACF,sFAAsF;AACtF,wFAAwF;AACxF,qDAAqD;AACrD,EAAE;AACF,yFAAyF;AACzF,wFAAwF;AACxF,wFAAwF;AACxF,mFAAmF;AACn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,EAAE,CAAC;QAC5B,OAAO;YACL,GAAG,IAAI,CAAC,MAAM,wBAAwB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,yBAAyB;YAC3F,EAAE;YACF,iFAAiF;YACjF,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACpB,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,EAAE,EAAE,MAAc,EAAE,EAAE,CACnD,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CACjD,CACF;SACF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IACD,OAAO;QACL,gBAAgB;QAChB,EAAE;QACF,GAAG,IAAI,CAAC,MAAM,wBAAwB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,yBAAyB;QAC3F,EAAE;QACF,GAAG,IAAI;KACR,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -1,7 +1,18 @@
1
1
  import type { MetaObject } from "@metaobjectsdev/metadata";
2
2
  import { type GeneratorFactory } from "../generator.js";
3
+ import { type ExposeOption } from "../routes-expose.js";
3
4
  export interface RoutesFileHonoOpts {
4
5
  filter?: (entity: MetaObject) => boolean;
6
+ /**
7
+ * Which CRUD verbs the emitted file mounts (#348). Verbs, or a per-entity function;
8
+ * absent means all five and emits byte-identical output.
9
+ *
10
+ * routesFileHono({ expose: (e) => e.name === "AuditEntry" ? ["list", "get"] : undefined })
11
+ *
12
+ * A `filter` cannot express this — it decides whether the file emits AT ALL, so it can
13
+ * only remove the whole surface, not restrict it to a subset of verbs.
14
+ */
15
+ expose?: ExposeOption;
5
16
  target?: string;
6
17
  }
7
18
  /**
@@ -14,8 +25,12 @@ export interface RoutesFileHonoOpts {
14
25
  * consumers running Hono can replace hand-written route registration with
15
26
  * this generator output one entity at a time.
16
27
  *
17
- * Per-entity opt-out via `@emitRoutes: false` is honored. If the user
18
- * supplies their own filter, both must pass (AND).
28
+ * If the user supplies their own filter, it AND-composes with the built-in gates.
29
+ *
30
+ * Decide per generator what you consume: wire only the generators whose output you
31
+ * actually import, and narrow this one with its `filter` option. There is no `@emit*`
32
+ * metadata attribute — those were never registered vocabulary, so `meta verify` rejects
33
+ * them (ERR_UNKNOWN_ATTR).
19
34
  *
20
35
  * #248 R2: an object with no declared/inherited source.rdb (of ANY kind) isn't
21
36
  * backed by any store — gated by `hasAnyRdbSource` (does NOT add TPH handling;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-file-hono.d.ts","sourceRoot":"","sources":["../../src/generators/routes-file-hono.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAQnF,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc,EA2DtB,gBAAgB,CAAC,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"routes-file-hono.d.ts","sourceRoot":"","sources":["../../src/generators/routes-file-hono.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnF,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,EAsDtB,gBAAgB,CAAC,kBAAkB,CAAC,CAAC"}
@@ -3,8 +3,8 @@ import { renderRoutesFileHono } from "../templates/routes-file-hono.js";
3
3
  import { hasAnyRdbSource } from "../source-detect.js";
4
4
  import { formatTs } from "../format.js";
5
5
  import { entityOutputPath } from "../import-path.js";
6
- import { CODEGEN_ATTR_EMIT_ROUTES } from "../constants.js";
7
6
  import { isTphSubtype } from "../templates/zod-validators.js";
7
+ import { resolveExpose } from "../routes-expose.js";
8
8
  /**
9
9
  * Hono variant of routesFile() — emits `<Entity>.routes.hono.ts` mounting
10
10
  * the same five CRUD verbs (GET list / GET :id / POST / PATCH+PUT / DELETE)
@@ -15,8 +15,12 @@ import { isTphSubtype } from "../templates/zod-validators.js";
15
15
  * consumers running Hono can replace hand-written route registration with
16
16
  * this generator output one entity at a time.
17
17
  *
18
- * Per-entity opt-out via `@emitRoutes: false` is honored. If the user
19
- * supplies their own filter, both must pass (AND).
18
+ * If the user supplies their own filter, it AND-composes with the built-in gates.
19
+ *
20
+ * Decide per generator what you consume: wire only the generators whose output you
21
+ * actually import, and narrow this one with its `filter` option. There is no `@emit*`
22
+ * metadata attribute — those were never registered vocabulary, so `meta verify` rejects
23
+ * them (ERR_UNKNOWN_ATTR).
20
24
  *
21
25
  * #248 R2: an object with no declared/inherited source.rdb (of ANY kind) isn't
22
26
  * backed by any store — gated by `hasAnyRdbSource` (does NOT add TPH handling;
@@ -28,18 +32,12 @@ export const routesFileHono = function routesFileHono(opts) {
28
32
  // below cannot drift apart. They differ only by `!isTphSubtype` vs `isTphSubtype`, and
29
33
  // written out twice a later edit to one silently makes an entity either stop emitting
30
34
  // without being named as held back, or get warned about while still emitting.
31
- const passesOtherGates = (e) =>
32
- // ADR-0039: resolving — a concrete entity may inherit @emitRoutes via extends.
33
- e.attr(CODEGEN_ATTR_EMIT_ROUTES) !== false
34
- && hasAnyRdbSource(e)
35
- && userFilter(e);
35
+ const passesOtherGates = (e) => hasAnyRdbSource(e) && userFilter(e);
36
36
  const generator = {
37
37
  name: "routes-file-hono",
38
38
  // Marks this as the Hono routes generator so the runner can aggregate
39
39
  // `ctx.config.includeHonoRoutes` and api-docs auto-documents the Hono surface.
40
40
  emitsHonoRoutes: true,
41
- // ADR-0039: resolving — a concrete entity may inherit @emitRoutes via extends.
42
- //
43
41
  // TPH subtypes are EXCLUDED, matching the Fastify generator. A TPH subtype shares
44
42
  // its base's table, so mounting vanilla CRUD for it produced routes with no
45
43
  // discriminator scoping at all: the list returned EVERY subtype's rows, and
@@ -68,7 +66,7 @@ export const routesFileHono = function routesFileHono(opts) {
68
66
  }
69
67
  return {
70
68
  path: entityOutputPath(ctx.config.outputLayout ?? "flat", entity.package, `${entity.name}.routes.hono.ts`),
71
- content: await formatTs(renderRoutesFileHono(entity, ctx.renderContext)),
69
+ content: await formatTs(renderRoutesFileHono(entity, ctx.renderContext, resolveExpose(entity, opts?.expose))),
72
70
  };
73
71
  });
74
72
  if (opts?.target) {
@@ -1 +1 @@
1
- {"version":3,"file":"routes-file-hono.js","sourceRoot":"","sources":["../../src/generators/routes-file-hono.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAyC,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAO9D;;;;;;;;;;;;;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F,CAAC;IACF,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;QACzC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QACD,OAAO;YACL,IAAI,EAAE,gBAAgB,CACpB,GAAG,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,EACjC,MAAM,CAAC,OAAO,EACd,GAAG,MAAM,CAAC,IAAI,iBAAiB,CAChC;YACD,OAAO,EAAE,MAAM,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,aAAa,EAAE,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;SAC9G,CAAC;IACN,CAAC,CAAC,CAAC;IACH,IAAI,IAAI,EAAE,MAAM,EAAE,CAAC;QACjB,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAyC,CAAC"}
@@ -1,12 +1,27 @@
1
1
  import type { MetaObject } from "@metaobjectsdev/metadata";
2
2
  import { type GeneratorFactory } from "../generator.js";
3
+ import { type ExposeOption } from "../routes-expose.js";
3
4
  export interface RoutesFileOpts {
4
5
  filter?: (entity: MetaObject) => boolean;
6
+ /**
7
+ * Which CRUD verbs the emitted file mounts (#348). Verbs, or a per-entity function;
8
+ * absent means all five and emits byte-identical output.
9
+ *
10
+ * routesFile({ expose: (e) => e.name === "AuditEntry" ? ["list", "get"] : undefined })
11
+ *
12
+ * A `filter` cannot express this — it decides whether the file emits AT ALL, so it can
13
+ * only remove the whole surface, not restrict it to a subset of verbs.
14
+ */
15
+ expose?: ExposeOption;
5
16
  target?: string;
6
17
  }
7
18
  /**
8
- * Per-entity opt-out via `@emitRoutes: false` is honored. If the user supplies
9
- * their own filter, both must pass (AND).
19
+ * If the user supplies their own filter, it AND-composes with the built-in gates.
20
+ *
21
+ * Decide per generator what you consume: wire only the generators whose output you
22
+ * actually import, and narrow this one with its `filter` option. There is no `@emit*`
23
+ * metadata attribute — those were never registered vocabulary, so `meta verify` rejects
24
+ * them (ERR_UNKNOWN_ATTR).
10
25
  *
11
26
  * #248 R2: an object with no declared/inherited source.rdb (of ANY kind) isn't
12
27
  * backed by any store — routes against it would import Drizzle table/allowlist
@@ -1 +1 @@
1
- {"version":3,"file":"routes-file.d.ts","sourceRoot":"","sources":["../../src/generators/routes-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAQnF,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAsBlB,gBAAgB,CAAC,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"routes-file.d.ts","sourceRoot":"","sources":["../../src/generators/routes-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnF,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvE,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,EAqBlB,gBAAgB,CAAC,cAAc,CAAC,CAAC"}
@@ -4,10 +4,14 @@ import { isTphSubtype } from "../templates/zod-validators.js";
4
4
  import { hasAnyRdbSource } from "../source-detect.js";
5
5
  import { formatTs } from "../format.js";
6
6
  import { entityOutputPath } from "../import-path.js";
7
- import { CODEGEN_ATTR_EMIT_ROUTES } from "../constants.js";
7
+ import { resolveExpose } from "../routes-expose.js";
8
8
  /**
9
- * Per-entity opt-out via `@emitRoutes: false` is honored. If the user supplies
10
- * their own filter, both must pass (AND).
9
+ * If the user supplies their own filter, it AND-composes with the built-in gates.
10
+ *
11
+ * Decide per generator what you consume: wire only the generators whose output you
12
+ * actually import, and narrow this one with its `filter` option. There is no `@emit*`
13
+ * metadata attribute — those were never registered vocabulary, so `meta verify` rejects
14
+ * them (ERR_UNKNOWN_ATTR).
11
15
  *
12
16
  * #248 R2: an object with no declared/inherited source.rdb (of ANY kind) isn't
13
17
  * backed by any store — routes against it would import Drizzle table/allowlist
@@ -20,17 +24,15 @@ export const routesFile = function routesFile(opts) {
20
24
  const userFilter = opts?.filter ?? (() => true);
21
25
  const generator = {
22
26
  name: "routes-file",
23
- // Always set: AND-composes metadata opt-out with optional user filter.
24
- filter: (e) =>
25
- // ADR-0039: resolving — a concrete entity may inherit its @emit* opt-out flag via extends.
26
- e.attr(CODEGEN_ATTR_EMIT_ROUTES) !== false && hasAnyRdbSource(e) && !isTphSubtype(e) && userFilter(e),
27
+ // Always set: AND-composes the built-in gates with the optional user filter.
28
+ filter: (e) => hasAnyRdbSource(e) && !isTphSubtype(e) && userFilter(e),
27
29
  generate: perEntity(async (entity, ctx) => {
28
30
  if (!ctx.renderContext) {
29
31
  throw new Error("routes-file: renderContext is required (provided by runGen)");
30
32
  }
31
33
  return {
32
34
  path: entityOutputPath(ctx.config.outputLayout ?? "flat", entity.package, `${entity.name}.routes.ts`),
33
- content: await formatTs(renderRoutesFile(entity, ctx.renderContext)),
35
+ content: await formatTs(renderRoutesFile(entity, ctx.renderContext, resolveExpose(entity, opts?.expose))),
34
36
  };
35
37
  }),
36
38
  };
@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,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAChF;;+EAE2E;IAC3E,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;+EAC2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;uEAEmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;8EAE0E;IAC1E,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC;IACzC;;;;;uDAKmD;IACnD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAkCD,eAAO,MAAM,iBAAiB,EAyDzB,gBAAgB,CAAC,qBAAqB,CAAC,CAAC"}
@@ -5,13 +5,27 @@
5
5
  // generators; just adds the "Mustache template" + "walk that yields a
6
6
  // data dict per output" primitives.
7
7
  //
8
- // Design line we adopted (from the design doc):
9
- // Code → hand-coded generators (ts-poet, idiomatic per-port).
10
- // Documents templateGenerator (shared Mustache templates).
8
+ // SUPERSEDED, and left here as a correction because the old line still circulates:
9
+ // the original 2026-05-28 split was "Code → hand-coded generators, Documents
10
+ // templateGenerator", with code emission an explicit NON-GOAL for this primitive.
11
+ // SP-1 (docs/superpowers/specs/2026-06-28-mustache-codegen-parity-design.md §2)
12
+ // moved past it — its goal is a consumer authoring "a working code generator, on ANY
13
+ // port, with NO generator code", and its worked outputPattern is
14
+ // "{package}/{name}Service.java". Source, not a document.
11
15
  //
12
- // docsFile() is the first templateGenerator instance (rc.12). OpenAPI specs,
13
- // Mermaid diagrams, HTML doc sites, etc. follow as templates + a walk
14
- // function each.
16
+ // The axis is NOT what kind of file comes out. It is: pick a template when the output
17
+ // SHAPE is what you are iterating on, or when you want the same output across
18
+ // languages (that is what the neutral data dict buys); pick a hand-coded generator
19
+ // when the logic is gnarly or the run is hot. Tradeoff table:
20
+ // docs/features/codegen-concepts.md §3.
21
+ //
22
+ // This matters most where a port has no choice: C# and Python expose closed built-in
23
+ // generator registries, so the declarative spec is the ONLY consumer authoring path
24
+ // there — and a documents-only reading of this primitive would tell those adopters
25
+ // their port cannot emit a custom shape at all.
26
+ //
27
+ // docsFile() is the first templateGenerator instance (rc.12), which is why the
28
+ // documents framing stuck; it is the first instance, not the boundary.
15
29
  import { render } from "@metaobjectsdev/render";
16
30
  import { projectProvider } from "../render-engine/framework-provider.js";
17
31
  import { expandOutputPattern } from "../template-codegen/output-pattern.js";
@@ -1 +1 @@
1
- {"version":3,"file":"template-generator.js","sourceRoot":"","sources":["../../src/generators/template-generator.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,sEAAsE;AACtE,oCAAoC;AACpC,EAAE;AACF,gDAAgD;AAChD,gEAAgE;AAChE,+DAA+D;AAC/D,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AACtE,iBAAiB;AAGjB,OAAO,EAAE,MAAM,EAAoC,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,EACtB,SAAS,GACV,MAAM,sCAAsC,CAAC;AAsD9C;yEACyE;AACzE,SAAS,SAAS,CAChB,KAAoB,EACpB,OAAe;IAEf,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;QACrE,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;YAC1B,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC1B,IA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B,IAAI,CAAC;oBACH,OAAO,GAAG,MAAM,CAAC;wBACf,GAAG,EAAE,IAAI,CAAC,QAAQ;wBAClB,OAAO,EAAE,IAAI;wBACb,QAAQ;wBACR,MAAM,EAAE,GAAG;qBACZ,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBAC7D,MAAM,IAAI,KAAK,CACb,qBAAqB,IAAI,CAAC,IAAI,uBAAuB,IAAI,CAAC,QAAQ,UAAU,UAAU,MAAM,GAAG,EAAE,EACjG,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAClD,CAAC;gBACJ,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IACF,IAAI,IAAI,CAAC,MAAM;QAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAChD,IAAI,IAAI,CAAC,MAAM;QAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAChD,OAAO,SAAS,CAAC;AACnB,CAA4C,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,8 +10,10 @@ export type { TemplateSpecEntry, TemplateSpecFile } from "./template-codegen/tem
10
10
  export type { TemplateScope } from "./generators/template-generator.js";
11
11
  export { generatorRegistry, listGenerators, getGenerator, } from "./generator-registry.js";
12
12
  export type { GeneratorRegistryEntry, GeneratorTier } from "./generator-registry.js";
13
- export type { MetaobjectsGenConfig, NormalizedMetaobjectsGenConfig, ResolvedGenConfig, Dialect, ExtStyle, ColumnNamingStrategy, MetaDataTypeProvider, GeneratorSpec, DocsConfig, ResolvedDocsConfig, DocsSurface, ApiSurface } from "./metaobjects-config.js";
13
+ export type { MetaobjectsGenConfig, NormalizedMetaobjectsGenConfig, ResolvedGenConfig, Dialect, ExtStyle, ColumnNamingStrategy, MetaDataTypeProvider, GeneratorSpec, DocsConfig, ResolvedDocsConfig, DocsSurface, ApiSurface, VerifyConfig } from "./metaobjects-config.js";
14
14
  export { defineConfig, normalizeConfig, resolveGenerators, resolveDocsConfig } from "./metaobjects-config.js";
15
+ export { DEFAULT_DIALECT } from "./metaobjects-config.js";
16
+ export { dbEmittingObjects, missingDialectMessage } from "./db-emitting.js";
15
17
  export { apiLabel } from "./generators/api-label.js";
16
18
  export type { ColumnSpec, DefaultExpr } from "./column-mapper.js";
17
19
  export { mapColumnType } from "./column-mapper.js";
@@ -25,7 +27,8 @@ export type { WriteStatus, WriteResult, MergeStrategy, BaselineMode, DecideAndWr
25
27
  export { decideAndWrite, GitMissingError } from "./overwrite-policy.js";
26
28
  export { contentHash, readGeneratedHash, listGeneratedPaths } from "./overwrite-policy.js";
27
29
  export { CodegenError } from "./errors.js";
28
- export { GENERATED_HEADER, EXTRA_SUFFIX, DEFAULT_OUT_DIR, CODEGEN_ATTR_EMIT_TANSTACK, CODEGEN_ATTR_EMIT_GRID, CODEGEN_ATTR_EMIT_FORM, CODEGEN_ATTR_EMIT_ROUTES } from "./constants.js";
30
+ export { GENERATED_HEADER, DEFAULT_OUT_DIR, RETIRED_CODEGEN_ATTRS, type RetiredCodegenAttr } from "./constants.js";
31
+ export { warnRetiredCodegenAttrs } from "./retired-codegen-attrs.js";
29
32
  export { formatTs } from "./format.js";
30
33
  export { pluralize, columnNameFromField, tableNameFromEntity, viewNameFromProjection } from "./naming.js";
31
34
  export { packageToPath, entityOutputPath, crossEntitySpecifier, barrelEntrySpecifier, relativeModuleSpecifier, entityModuleSpecifier, siblingSpecifier, barrelModuleSpecifier } from "./import-path.js";
@@ -34,11 +37,14 @@ export { docPageOutputPath, docPageHref, docPageNode, effectivePackage, assertNo
34
37
  export type { DocPageNode, DocPagePlacement } from "./docs-paths.js";
35
38
  export { isProjection, isWriteThrough } from "./projection/projection-detector.js";
36
39
  export { isAbstract, emitsInstanceArtifacts, emitsWriteArtifacts } from "./instance-artifacts.js";
37
- export { servesReadApi, servesWriteApi } from "./api-surface.js";
40
+ export { hasGeneratedForm, restPath, servesReadApi, servesWriteApi } from "./api-surface.js";
41
+ export { viewForContext, VIEW_CONTEXT_FORM, VIEW_CONTEXT_GRID } from "./view-context.js";
42
+ export { humanize, inferViewKind, labelFor, currencyMetaFor, valueObjectFor } from "./templates/field-meta.js";
38
43
  export { renderEntityMetaFile, entityMetaFileName, entityMetaSpecifier } from "./templates/entity-meta-file.js";
39
44
  export { isTphDiscriminatorBase, tphConcreteSubtypes, collectTphSubtypeFields, tphPlan, tphRouteSegment } from "./templates/tph-discriminator.js";
40
45
  export type { TphPlan, TphSubtypePlan } from "./templates/tph-discriminator.js";
41
- export { isTphSubtype, tphDiscriminatorPin } from "./templates/zod-validators.js";
46
+ export { isTphSubtype, tphDiscriminatorBase, tphDiscriminatorPin } from "./templates/zod-validators.js";
47
+ export { isSortableField, sortableFields } from "./templates/filter-shared.js";
42
48
  export { renderTphDiscriminatorUnion } from "./templates/tph-discriminator.js";
43
49
  export { hasWritableRdbSource, hasAnyRdbSource } from "./source-detect.js";
44
50
  export { renderSharedEnumsFile, SHARED_ENUMS_BASENAME } from "./templates/enums-file.js";
@@ -46,7 +52,8 @@ export { resolveReferenceRoot, readReferenceTemplate, REFERENCE_GENERATOR_NAMES,
46
52
  export type { ReferenceGeneratorName } from "./reference-templates.js";
47
53
  export { code, imp, joinCode } from "ts-poet";
48
54
  export type { Code } from "ts-poet";
49
- export { renderFindByIdFn, renderListFn, renderCreateFn, renderUpdateFn, renderDeleteByIdFn, renderReverseFinderFns, reverseFksFor, getPkInfo, } from "./templates/queries.js";
55
+ export { renderFindByIdFn, renderListFn, renderCreateFn, renderInsertPreservingFn, renderUpdateFn, renderDeleteByIdFn, renderReverseFinderFns, reverseFksFor, getPkInfo, } from "./templates/queries.js";
56
+ export { hasAutoSetFields } from "./templates/zod-validators.js";
50
57
  export { renderEntityFile } from "./templates/entity-file.js";
51
58
  export type { RenderEntityFileOpts } from "./templates/entity-file.js";
52
59
  export { renderZodValidators } from "./templates/zod-validators.js";
@@ -58,9 +65,14 @@ export { renderFilterType } from "./templates/filter-type.js";
58
65
  export { renderFilterAllowlist, renderSortAllowlist } from "./templates/filter-allowlist.js";
59
66
  export { renderEntityConstants, resourcePath } from "./templates/entity-constants.js";
60
67
  export { renderQueriesFile } from "./templates/queries-file.js";
68
+ export { CRUD_VERBS, resolveExpose, intersectExpose, exposeLine } from "./routes-expose.js";
69
+ export type { CrudVerb, ExposeOption } from "./routes-expose.js";
61
70
  export { renderRoutesFile } from "./templates/routes-file.js";
62
71
  export { renderRoutesFileHono } from "./templates/routes-file-hono.js";
63
72
  export { renderValueObjectFile } from "./templates/value-object-file.js";
73
+ export { renderNamesDecl } from "./templates/names-decl.js";
74
+ export type { NamesDeclOpts } from "./templates/names-decl.js";
75
+ export { resolveObjectNames, resolveSuperFragmentNames, namesArtifactSuperOf, namesRef, namesConstArg, physicalNameExpr, columnExpr, type ObjectNames, type FieldNames, type SuperNames, } from "./names.js";
64
76
  export { renderProjectionDecl } from "./templates/projection-decl.js";
65
77
  export type { ProjectionDeclOpts } from "./templates/projection-decl.js";
66
78
  export { extractViewSpec } from "./projection/extract-view-spec.js";
@@ -79,6 +91,9 @@ export type { TemplateDocData, TemplateOutputPart } from "./generators/template-
79
91
  export { buildTemplateDocData } from "./generators/template-doc-builder.js";
80
92
  export { requirementTests } from "./generators/requirement-tests.js";
81
93
  export { requirementsFile } from "./generators/requirements-file.js";
94
+ export { agentDocsFile } from "./generators/agent-docs-file.js";
95
+ export type { AgentDocsFileOpts } from "./generators/agent-docs-file.js";
96
+ export type { AgentSchemaInput, SchemaColumnLike, SchemaTableLike, SchemaViewLike, } from "./generators/agent-schema-input.js";
82
97
  export type { RequirementRow } from "./generators/requirements-view.js";
83
98
  export { requirementRows } from "./generators/requirements-view.js";
84
99
  export type { RequirementTestsOpts, RequirementTestRenderer, } from "./generators/requirement-tests.js";