@pbuilder/sdk 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/README.md +57 -42
  2. package/dist/{transport → acl/irwire}/frame-reader.d.ts +2 -0
  3. package/dist/{transport → acl/irwire}/frame-reader.js +57 -5
  4. package/dist/{transport → acl/irwire}/stdio-engine-client.d.ts +2 -2
  5. package/dist/{transport → acl/irwire}/stdio-engine-client.js +4 -4
  6. package/dist/bin/pbuilder-codegen.js +30 -35
  7. package/dist/bin/pbuilder-runner.js +6 -6
  8. package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.d.ts +106 -0
  9. package/dist/bounded-contexts/authoring/application/usecases/authoring-verbs/index.js +202 -0
  10. package/dist/{pending-directives → bounded-contexts/authoring/application/usecases/pending-directives}/render.d.ts +2 -2
  11. package/dist/{core → bounded-contexts/authoring/application/usecases/run-factory}/context.d.ts +12 -9
  12. package/dist/{core → bounded-contexts/authoring/application/usecases/run-factory}/context.js +59 -120
  13. package/dist/bounded-contexts/authoring/application/usecases/run-factory/driving.d.ts +5 -0
  14. package/dist/bounded-contexts/authoring/application/usecases/run-factory/driving.js +15 -0
  15. package/dist/bounded-contexts/authoring/application/usecases/scaffold/classify-transport.d.ts +51 -0
  16. package/dist/bounded-contexts/authoring/application/usecases/scaffold/classify-transport.js +105 -0
  17. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/expander.d.ts +2 -1
  18. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/expander.js +16 -7
  19. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/index.d.ts +1 -1
  20. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/index.js +7 -6
  21. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/path-guards.d.ts +11 -10
  22. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/path-guards.js +21 -48
  23. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/walk.d.ts +2 -3
  24. package/dist/{scaffold → bounded-contexts/authoring/application/usecases/scaffold}/walk.js +37 -56
  25. package/dist/{core → bounded-contexts/authoring/domain/aggregates/session}/session.d.ts +2 -2
  26. package/dist/{core → bounded-contexts/authoring/domain/aggregates/session}/session.js +1 -1
  27. package/dist/{core → bounded-contexts/authoring/domain/entities}/dialect-handle.d.ts +1 -1
  28. package/dist/{core → bounded-contexts/authoring/domain/entities}/dialect-handle.js +10 -10
  29. package/dist/{core → bounded-contexts/authoring/domain/ports}/engine-client.d.ts +1 -1
  30. package/dist/bounded-contexts/authoring/domain/ports/package-files.d.ts +53 -0
  31. package/dist/bounded-contexts/authoring/domain/ports/package-files.js +11 -0
  32. package/dist/{core → bounded-contexts/authoring/domain/services}/define-dialect.d.ts +2 -2
  33. package/dist/{core → bounded-contexts/authoring/domain/services}/define-dialect.js +3 -3
  34. package/dist/{core → bounded-contexts/authoring/domain/services}/directive-factory.d.ts +2 -2
  35. package/dist/{core → bounded-contexts/authoring/domain/services}/directive-factory.js +37 -12
  36. package/dist/{scaffold → bounded-contexts/authoring/domain/services}/filename-pipeline.d.ts +11 -1
  37. package/dist/{scaffold → bounded-contexts/authoring/domain/services}/filename-pipeline.js +94 -3
  38. package/dist/{core/jsx-name-validator.d.ts → bounded-contexts/authoring/domain/services/identifier-names.d.ts} +8 -4
  39. package/dist/{core/jsx-name-validator.js → bounded-contexts/authoring/domain/services/identifier-names.js} +21 -28
  40. package/dist/bounded-contexts/authoring/domain/services/reject-tail.d.ts +9 -0
  41. package/dist/bounded-contexts/authoring/domain/services/reject-tail.js +30 -0
  42. package/dist/bounded-contexts/authoring/domain/services/run-context.d.ts +5 -0
  43. package/dist/bounded-contexts/authoring/domain/services/run-context.js +70 -0
  44. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/input-rejection.d.ts +1 -1
  45. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/input-rejection.js +1 -1
  46. package/dist/bounded-contexts/authoring/domain/services/schema/schema-files.d.ts +2 -0
  47. package/dist/bounded-contexts/authoring/domain/services/schema/schema-files.js +6 -0
  48. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-locate.d.ts +2 -1
  49. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-locate.js +13 -2
  50. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-parse.d.ts +1 -1
  51. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-parse.js +2 -14
  52. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-sufficiency.d.ts +4 -3
  53. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-sufficiency.js +8 -4
  54. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-validate.d.ts +1 -1
  55. package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-validate.js +1 -1
  56. package/dist/{core → bounded-contexts/authoring/domain/valueobjects}/authoring-error.js +1 -1
  57. package/dist/{core → bounded-contexts/authoring/domain/valueobjects}/wire.d.ts +0 -3
  58. package/dist/bounded-contexts/authoring/domain/valueobjects/wire.js +28 -0
  59. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.d.ts +27 -0
  60. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/cli.js +306 -0
  61. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.d.ts +7 -0
  62. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.js +68 -0
  63. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.d.ts +19 -0
  64. package/dist/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.js +131 -0
  65. package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.d.ts +182 -0
  66. package/dist/bounded-contexts/authoring/infrastructure/in/commons/index.js +94 -0
  67. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.d.ts +63 -0
  68. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/angular/index.js +68 -0
  69. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/angular/ops.js +9 -9
  70. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.d.ts +40 -0
  71. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/css/index.js +38 -0
  72. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/css/ops.js +2 -2
  73. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.d.ts +55 -0
  74. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/json/index.js +54 -0
  75. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/json/ops.d.ts +1 -1
  76. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/json/ops.js +35 -8
  77. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.d.ts +43 -0
  78. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/nestjs/index.js +46 -0
  79. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/nestjs/ops.js +7 -7
  80. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.d.ts +52 -0
  81. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/index.js +73 -0
  82. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/jsx-names.d.ts +4 -0
  83. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/jsx-names.js +18 -0
  84. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/match-tails.d.ts +4 -0
  85. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/react/match-tails.js +25 -0
  86. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/react/ops.js +5 -3
  87. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/array-element.d.ts +7 -2
  88. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/array-element.js +29 -15
  89. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/ast.d.ts +5 -1
  90. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/ast.js +22 -4
  91. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/class-property.js +14 -19
  92. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.d.ts +53 -0
  93. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/typescript/index.js +37 -0
  94. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/ops.d.ts +6 -1
  95. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/ops.js +90 -54
  96. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.d.ts +69 -0
  97. package/dist/bounded-contexts/authoring/infrastructure/out/dialects/yaml/index.js +70 -0
  98. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/paths.d.ts +1 -1
  99. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/paths.js +2 -2
  100. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/presentation.js +1 -1
  101. package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/structural.js +2 -2
  102. package/dist/bounded-contexts/authoring/infrastructure/out/fs/package-files.d.ts +8 -0
  103. package/dist/bounded-contexts/authoring/infrastructure/out/fs/package-files.js +133 -0
  104. package/dist/bounded-contexts/authoring/testing/conformance/index.d.ts +157 -0
  105. package/dist/bounded-contexts/authoring/testing/conformance/index.js +261 -0
  106. package/dist/{testing → bounded-contexts/authoring/testing}/contract-fake.d.ts +2 -2
  107. package/dist/{testing → bounded-contexts/authoring/testing}/contract-fake.js +4 -3
  108. package/dist/bounded-contexts/authoring/testing/harness/index.d.ts +89 -0
  109. package/dist/bounded-contexts/authoring/testing/harness/index.js +85 -0
  110. package/dist/{conformance → bounded-contexts/authoring/testing}/run-vehicle.d.ts +1 -1
  111. package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/bootstrap-bridge.js +2 -2
  112. package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/exit-codes.js +5 -4
  113. package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/factory-pointer.js +1 -1
  114. package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/runner.d.ts +4 -0
  115. package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/runner.js +49 -23
  116. package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/single-instance-probe.js +1 -1
  117. package/dist/commons/index.d.ts +1 -278
  118. package/dist/commons/index.js +1 -286
  119. package/dist/conformance/index.d.ts +1 -157
  120. package/dist/conformance/index.js +1 -261
  121. package/dist/dialects/angular/index.d.ts +1 -63
  122. package/dist/dialects/angular/index.js +1 -68
  123. package/dist/dialects/css/index.d.ts +1 -40
  124. package/dist/dialects/css/index.js +1 -38
  125. package/dist/dialects/json/index.d.ts +1 -55
  126. package/dist/dialects/json/index.js +1 -54
  127. package/dist/dialects/nestjs/index.d.ts +1 -43
  128. package/dist/dialects/nestjs/index.js +1 -46
  129. package/dist/dialects/react/index.d.ts +1 -52
  130. package/dist/dialects/react/index.js +1 -73
  131. package/dist/dialects/typescript/index.d.ts +1 -53
  132. package/dist/dialects/typescript/index.js +1 -37
  133. package/dist/dialects/yaml/index.d.ts +1 -69
  134. package/dist/dialects/yaml/index.js +1 -70
  135. package/dist/{core → platform}/deep-equal.js +2 -2
  136. package/dist/{transport → platform}/error-text.js +2 -2
  137. package/dist/runner-manifest.json +66 -46
  138. package/dist/shared-kernel/batch-cap.d.ts +4 -0
  139. package/dist/{core/wire.js → shared-kernel/batch-cap.js} +9 -26
  140. package/dist/{transport → shared-kernel}/framing.js +2 -2
  141. package/dist/{transport → shared-kernel}/wire-protocol.js +1 -1
  142. package/dist/testing/index.d.ts +1 -84
  143. package/dist/testing/index.js +1 -82
  144. package/package.json +9 -3
  145. package/dist/core/index.d.ts +0 -10
  146. package/dist/core/index.js +0 -6
  147. package/dist/core/reject-tail.d.ts +0 -13
  148. package/dist/core/reject-tail.js +0 -52
  149. package/dist/core/schema/schema-discovery.d.ts +0 -13
  150. package/dist/core/schema/schema-discovery.js +0 -51
  151. package/dist/scaffold/classify-transport.d.ts +0 -54
  152. package/dist/scaffold/classify-transport.js +0 -119
  153. /package/dist/{pending-directives → bounded-contexts/authoring/application/usecases/pending-directives}/index.d.ts +0 -0
  154. /package/dist/{pending-directives → bounded-contexts/authoring/application/usecases/pending-directives}/index.js +0 -0
  155. /package/dist/{pending-directives → bounded-contexts/authoring/application/usecases/pending-directives}/render.js +0 -0
  156. /package/dist/{core → bounded-contexts/authoring/domain/entities}/base-handle.d.ts +0 -0
  157. /package/dist/{core → bounded-contexts/authoring/domain/entities}/base-handle.js +0 -0
  158. /package/dist/{core → bounded-contexts/authoring/domain/entities}/handle-state.d.ts +0 -0
  159. /package/dist/{core → bounded-contexts/authoring/domain/entities}/handle-state.js +0 -0
  160. /package/dist/{core → bounded-contexts/authoring/domain/ports}/emit-rejection.d.ts +0 -0
  161. /package/dist/{core → bounded-contexts/authoring/domain/ports}/emit-rejection.js +0 -0
  162. /package/dist/{core → bounded-contexts/authoring/domain/ports}/engine-client.js +0 -0
  163. /package/dist/{commons → bounded-contexts/authoring/domain/services}/classify-content.d.ts +0 -0
  164. /package/dist/{commons → bounded-contexts/authoring/domain/services}/classify-content.js +0 -0
  165. /package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-digest.d.ts +0 -0
  166. /package/dist/{core → bounded-contexts/authoring/domain/services}/schema/schema-digest.js +0 -0
  167. /package/dist/{core → bounded-contexts/authoring/domain/valueobjects}/authoring-error.d.ts +0 -0
  168. /package/dist/{core → bounded-contexts/authoring/domain/valueobjects}/dialect-error.d.ts +0 -0
  169. /package/dist/{core → bounded-contexts/authoring/domain/valueobjects}/dialect-error.js +0 -0
  170. /package/dist/{core → bounded-contexts/authoring/domain/valueobjects}/json-value.d.ts +0 -0
  171. /package/dist/{core → bounded-contexts/authoring/domain/valueobjects}/json-value.js +0 -0
  172. /package/dist/{core/schema → bounded-contexts/authoring/domain/valueobjects}/schema-model.d.ts +0 -0
  173. /package/dist/{core/schema → bounded-contexts/authoring/domain/valueobjects}/schema-model.js +0 -0
  174. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/angular/ops.d.ts +0 -0
  175. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/css/ast.d.ts +0 -0
  176. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/css/ast.js +0 -0
  177. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/css/ops.d.ts +0 -0
  178. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/json/ast.d.ts +0 -0
  179. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/json/ast.js +0 -0
  180. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/nestjs/ops.d.ts +0 -0
  181. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/react/ast.d.ts +0 -0
  182. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/react/ast.js +0 -0
  183. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/react/ops.d.ts +0 -0
  184. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/class-property.d.ts +0 -0
  185. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/import-order.d.ts +0 -0
  186. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/import-order.js +0 -0
  187. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/pack.d.ts +0 -0
  188. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/typescript/pack.js +0 -0
  189. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/ast.d.ts +0 -0
  190. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/ast.js +0 -0
  191. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/documents.d.ts +0 -0
  192. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/documents.js +0 -0
  193. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/presentation.d.ts +0 -0
  194. /package/dist/{dialects → bounded-contexts/authoring/infrastructure/out/dialects}/yaml/structural.d.ts +0 -0
  195. /package/dist/{testing → bounded-contexts/authoring/testing}/rejection-messages.d.ts +0 -0
  196. /package/dist/{testing → bounded-contexts/authoring/testing}/rejection-messages.js +0 -0
  197. /package/dist/{conformance → bounded-contexts/authoring/testing}/run-vehicle.js +0 -0
  198. /package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/bootstrap-bridge.d.ts +0 -0
  199. /package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/exit-codes.d.ts +0 -0
  200. /package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/factory-pointer.d.ts +0 -0
  201. /package/dist/{transport → bounded-contexts/runner-hosting/infrastructure/in}/single-instance-probe.d.ts +0 -0
  202. /package/dist/{core → platform}/deep-equal.d.ts +0 -0
  203. /package/dist/{transport → platform}/error-text.d.ts +0 -0
  204. /package/dist/{core → platform}/fs-errors.d.ts +0 -0
  205. /package/dist/{core → platform}/fs-errors.js +0 -0
  206. /package/dist/{transport → shared-kernel}/framing.d.ts +0 -0
  207. /package/dist/{transport → shared-kernel}/wire-protocol.d.ts +0 -0
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @pbuilder/sdk
2
2
 
3
- > The TypeScript/Bun authoring layer for [Project Builder](https://github.com/Project-Builder-Schematics) schematics.
3
+ > The TypeScript/Bun authoring layer for [Project Builder](https://schematics.pbuilder.dev/) schematics.
4
+ >
5
+ > Documentation: [schematics.pbuilder.dev](https://schematics.pbuilder.dev/)
4
6
 
5
7
  Project Builder exists to give developers — **and the AI agents working alongside them** —
6
8
  deterministic code generation. A prompt produces something different every run; a
@@ -139,7 +141,7 @@ following; every property needs a `label` (codegen fails without it):
139
141
  ```
140
142
 
141
143
  Property types are `string`, `number`, `boolean`, and `enum` (which requires a non-empty
142
- `choices` array); `default` and `description` are optional.
144
+ `choices` array of strings); `default` and `description` are optional.
143
145
 
144
146
  **4. Regenerate the input types:**
145
147
 
@@ -181,7 +183,7 @@ export default async (input: Input) => {
181
183
  The engine invokes the module's **default export** — that's the factory. (This one builds
182
184
  its output strings in TypeScript; the template language below is the declarative
183
185
  alternative. And if your editor flags the `.ts`-extension import or `bun:test`, that's
184
- just missing tsconfig settings — the [quickstart](./docs/quickstart.md) ships one; Bun
186
+ just missing tsconfig settings — the [quickstart](./docs/guides/quickstart.md) ships one; Bun
185
187
  itself runs fine without it.)
186
188
 
187
189
  **6. Execute it** — `default:hello` is `<collection>:<schematic>` as registered in
@@ -212,9 +214,9 @@ as it was.
212
214
  **7. Test it** without the CLI or a running engine — see
213
215
  [Testing your factory](#testing-your-factory) below.
214
216
 
215
- From here: [Authoring verbs](./docs/authoring-verbs.md) is the full reference for
217
+ From here: [Authoring verbs](./docs/guides/authoring-verbs.md) is the full reference for
216
218
  everything you can do inside a factory, and the
217
- [quickstart](./docs/quickstart.md) covers the standalone-package setup (tsconfig
219
+ [quickstart](./docs/guides/quickstart.md) covers the standalone-package setup (tsconfig
218
220
  included) in more depth.
219
221
 
220
222
  ## Project-wide type generation
@@ -298,13 +300,13 @@ Everything a factory can do to the tree is one of seven mutation verbs, all impo
298
300
 
299
301
  | Verb | What it schedules |
300
302
  |---|---|
301
- | [`create(path, opts)`](./docs/authoring-verbs.md#create) | A new file. `path` and `template` are template strings rendered against one `options` object; the `templateFile` overload renders a package-local file instead. |
302
- | [`replaceContent(path, content)`](./docs/authoring-verbs.md#replacecontent) | Wholesale replacement of an existing file's content. |
303
- | [`remove(path)`](./docs/authoring-verbs.md#remove) | A deletion. Idempotent on an absent path. |
304
- | [`rename(path, newName)`](./docs/authoring-verbs.md#rename) | A basename-only rename in place. |
305
- | [`move(path, toDir)`](./docs/authoring-verbs.md#move) | A move to a different directory. |
306
- | [`copy(from, to)`](./docs/authoring-verbs.md#copy) | A tree-to-tree copy, chainable via the returned handle. |
307
- | [`copyIn(from, to)`](./docs/authoring-verbs.md#copyin) | A package-local file copied into the tree **verbatim** — never rendered. |
303
+ | [`create(path, opts)`](./docs/guides/authoring-verbs.md#create) | A new file. `path` and `template` are template strings rendered against one `options` object; the `templateFile` overload renders a package-local file instead. |
304
+ | [`replaceContent(path, content)`](./docs/guides/authoring-verbs.md#replacecontent) | Wholesale replacement of an existing file's content. |
305
+ | [`remove(path)`](./docs/guides/authoring-verbs.md#remove) | A deletion. Idempotent on an absent path. |
306
+ | [`rename(path, newName)`](./docs/guides/authoring-verbs.md#rename) | A basename-only rename in place. |
307
+ | [`move(path, toDir)`](./docs/guides/authoring-verbs.md#move) | A move to a different directory. |
308
+ | [`copy(from, to)`](./docs/guides/authoring-verbs.md#copy) | A tree-to-tree copy, chainable via the returned handle. |
309
+ | [`copyIn(from, to)`](./docs/guides/authoring-verbs.md#copyin) | A package-local file copied into the tree **verbatim** — never rendered. |
308
310
 
309
311
  The verbs that write to a new path — `create`, `rename`, `move`, `copy`, `copyIn`, and
310
312
  `scaffold` — are fail-closed on collision and accept `{ force: true }` for a deliberate
@@ -313,12 +315,12 @@ trailing argument.
313
315
 
314
316
  Three companions round out the surface:
315
317
 
316
- - [`find(path).read()`](./docs/authoring-verbs.md#the-read-trichotomy-findpathread) — read
318
+ - [`find(path).read()`](./docs/guides/authoring-verbs.md#the-read-trichotomy-findpathread) — read
317
319
  a file back from the staging tree.
318
- - [`scaffold({ from, to, options })`](./docs/authoring-verbs.md#scaffold) — mirror an
320
+ - [`scaffold({ from, to, options })`](./docs/guides/authoring-verbs.md#scaffold) — mirror an
319
321
  entire package-local folder into the tree, with dynamic file names. The workhorse for
320
322
  multi-file generators — see [Scaffolding a folder of templates](#scaffolding-a-folder-of-templates).
321
- - [`pendingDirectives()`](./docs/pending-directives.md) — inspect the directives still **pending**. A `read()`
323
+ - [`pendingDirectives()`](./docs/guides/pending-directives.md) — inspect the directives still **pending**. A `read()`
322
324
  drains the buffer, so call it before reading if you want the full picture.
323
325
 
324
326
  ### What to keep in mind
@@ -344,7 +346,7 @@ Rules that save you real debugging time — each one is a mistake we've watched
344
346
  - **Errors are structured.** A rejected run surfaces an `AuthoringError` with
345
347
  `verb`/`path`/`reason` fields telling you which directive failed and why (one label
346
348
  quirk: content replacement reports `verb: "modify"` — including plain
347
- `replaceContent()`) — see the [error contract](./docs/authoring-errors.md).
349
+ `replaceContent()`) — see the [error contract](./docs/guides/authoring-errors.md).
348
350
 
349
351
  ## How templates work
350
352
 
@@ -412,7 +414,7 @@ never `eq .count 2`).
412
414
  If templating gets in your way, there is always a way out: build the final
413
415
  strings in TypeScript and pass a token-free template — it renders verbatim. For the full
414
416
  language — `with`, variables, whitespace rules, output-path templating, sandbox limits, and
415
- the error taxonomy — see [Authoring `create` templates](./docs/create-templates.md).
417
+ the error taxonomy — see [Authoring `create` templates](./docs/guides/create-templates.md).
416
418
 
417
419
  ## Scaffolding a folder of templates
418
420
 
@@ -473,14 +475,16 @@ second, `.template` strip last):
473
475
  - **`include` / `exclude`** — glob filters over the original paths (`*` within a segment,
474
476
  `**` across segments; `exclude` wins).
475
477
 
476
- Each surviving file is classified automatically: valid, in-budget text renders as a
477
- template; binary or over-budget files travel verbatim (`copyIn`). Caveats: an empty `from`
478
+ Each surviving file renders as a template, except the ones you list in `binary` (globs over
479
+ the original paths, like `include`), which are copied byte for byte (`copyIn`). A file that is
480
+ not valid text and is not listed rejects with a `binary: [...]` suggestion, and a file too
481
+ large for one emit frame rejects naming its size; neither is ever copied unrendered. Caveats: an empty `from`
478
482
  folder is a silent no-op (and npm packaging commonly drops empty directories — ship a
479
483
  placeholder if the folder's presence matters) while `include`/`exclude` filters that
480
484
  eliminate every entry reject loudly, nested symlinked directories are skipped
481
485
  silently while a symlinked `from` root rejects outright, and a single call caps at 10,000
482
486
  entries. Full edge-and-error semantics:
483
- [`scaffold` in Authoring verbs](./docs/authoring-verbs.md#scaffold).
487
+ [`scaffold` in Authoring verbs](./docs/guides/authoring-verbs.md#scaffold).
484
488
 
485
489
  `scaffold`, `copyIn`, and `create({ templateFile })` resolve **package-local** files
486
490
  (relative to your schematic's folder), so the run must know where that package is — the CLI
@@ -520,7 +524,7 @@ bun test schematics
520
524
  This runs only your schematic tests under Bun — your app's own test runner (Jest, Vitest,
521
525
  whatever you use) stays untouched and the two coexist in one repo.
522
526
 
523
- Two things to know:
527
+ Three things to know:
524
528
 
525
529
  - `result.tree` contains **committed writes only**. Files you pre-populate via the `seed`
526
530
  option are readable by the factory but never appear in the tree — which is exactly how
@@ -550,16 +554,27 @@ Two things to know:
550
554
  into schema-derived input validation against the adjacent `schema.json`. Without it those
551
555
  verbs have nothing to resolve against.
552
556
 
557
+ - `result.reads` counts the reads the engine served for each path, so a test can check
558
+ that the factory reads a file once however many ops it chains on it. A path the factory
559
+ never read is absent.
560
+
553
561
  Templates are stored **verbatim** in the test tree — rendering is the engine's job, and the
554
562
  harness doesn't fake it. `./testing` ships `0.x`, semver-exempt, until real use validates
555
563
  the result shape. (It tests *your factory*; the separate `./conformance` surface
556
564
  conformance-tests a *dialect or op-pack* implementation — not the same audience.)
557
565
 
566
+ One known gap: until [engine#227](https://github.com/Project-Builder-Schematics/project-builder-engine/issues/227)
567
+ lands, `builder execute` rejects a second write to the same path in one run with
568
+ `path-collision`. Two `replaceContent` calls on one file, a dialect edit followed by
569
+ `replaceContent`, or two edits of one file through dialect handles with a read of another
570
+ file between them all count. The harness doesn't model that rule: it keeps the last write,
571
+ as the engine will once it nets such writes out. Until then, write each file once per run.
572
+
558
573
  ## Beyond the verbs: dialects
559
574
 
560
575
  When string-level mutation isn't enough — "add an import to this module", "set a prop on
561
576
  this JSX element" — **dialects** provide structured, AST-aware operations for one file
562
- type: see [authoring a dialect](./docs/authoring-a-dialect.md) for the full story. Seven
577
+ type: see [authoring a dialect](./docs/guides/authoring-a-dialect.md) for the full story. Seven
563
578
  ship today: `@pbuilder/sdk/typescript`, `@pbuilder/sdk/react`, `@pbuilder/sdk/nestjs`,
564
579
  `@pbuilder/sdk/angular`, `@pbuilder/sdk/json`, `@pbuilder/sdk/yaml`, and `@pbuilder/sdk/css`.
565
580
 
@@ -593,9 +608,9 @@ await ts.find("src/index.ts")
593
608
  | `sortImports()` | Sorts import declarations by module (packages first, then relative paths) and the names inside each one's braces. Only reorders, never combines or removes; nothing moves across a blank line, a comment, or a side-effect import. A no-op on a sorted file. |
594
609
  | `addArrayElement(locator, element)` | Appends to the array literal `locator` points at (a variable, a call argument, or a decorator argument, then a `path` of keys and `{ key: "value" }` matches), keeping its layout. Creates missing keys; a no-op when the element is already listed. `element` is an identifier, or `{ expression }` for code. |
595
610
  | `addClassProperty(className, name, initializer, opts?)` | Adds `{scope }{readonly }name = initializer;` to the only class named `className`, after its last property. A no-op when the same property exists; any other member named `name` rejects. |
596
- | `addFunction(name, source, opts?)` | Appends a top-level function. `source` **includes** the braces (`"(): void {}"`). |
597
- | `addVariable(name, initializer, opts?)` | Appends a top-level variable (`kind` defaults to `const`). |
598
- | `addClass(name, source, opts?)` | Appends a top-level class. `source` **excludes** the braces — the op adds them. |
611
+ | `addFunction(name, source, opts?)` | Appends a top-level function. `source` **includes** the braces (`"(): void {}"`). A no-op when the same declaration exists; another binding of `name` rejects. |
612
+ | `addVariable(name, initializer, opts?)` | Appends a top-level variable (`kind` defaults to `const`). A no-op when the same declaration exists; another binding of `name` rejects. |
613
+ | `addClass(name, source, opts?)` | Appends a top-level class. `source` **excludes** the braces — the op adds them. A no-op when the same declaration exists; another binding of `name` rejects. |
599
614
  | `.modify(fn)` | The universal escape hatch: direct [ts-morph](https://ts-morph.com) access to the file's AST for anything the named ops don't cover. |
600
615
 
601
616
  The `add*` ops fail loud on a name collision with an existing value declaration or import
@@ -657,7 +672,7 @@ await json
657
672
  Named ops: `setValue`, `addKey`, `removeKey`, `renameKey`, `insertItem`, `appendItem`,
658
673
  `removeItem`, `removeValue`, `replaceItem`, `moveItem`, `merge`, `updateValue`, `moveValue`,
659
674
  `copyValue`, `sortKeys`. `.modify(fn)` exposes [jsonc-parser](https://github.com/microsoft/node-jsonc-parser).
660
- See [the JSON dialect guide](./docs/json-dialect.md).
675
+ See [the JSON dialect guide](./docs/guides/json-dialect.md).
661
676
 
662
677
  ### `@pbuilder/sdk/yaml`
663
678
 
@@ -676,7 +691,7 @@ await yaml
676
691
 
677
692
  Extra named ops: `setComment`, `removeComment`, `setAnchor`, `removeAnchor`, `setAlias`,
678
693
  `addMergeKey`, `setStyle`, `setTag`, `addDocument`, `removeDocument`. `.modify(fn)` exposes
679
- [yaml](https://eemeli.org/yaml/). See [the YAML dialect guide](./docs/yaml-dialect.md).
694
+ [yaml](https://eemeli.org/yaml/). See [the YAML dialect guide](./docs/guides/yaml-dialect.md).
680
695
 
681
696
  ### `@pbuilder/sdk/css`
682
697
 
@@ -696,7 +711,7 @@ await css
696
711
  Named ops: `setDeclaration`, `removeDeclaration`, and the query `getDeclaration(target, property)`,
697
712
  which ends the chain and resolves to `{ value, important }` (also exported as
698
713
  `getDeclaration(root, target, property)` for use inside `.modify(fn)`). `.modify(fn)` exposes
699
- [postcss](https://postcss.org/). See [the CSS dialect guide](./docs/css-dialect.md).
714
+ [postcss](https://postcss.org/). See [the CSS dialect guide](./docs/guides/css-dialect.md).
700
715
 
701
716
  ### `@pbuilder/sdk/nestjs`
702
717
 
@@ -713,7 +728,7 @@ await nestjs
713
728
  ```
714
729
 
715
730
  Extra named ops: `addProvider`, `addController`, `addModuleImport`, `addExport`. `.modify(fn)`
716
- exposes ts-morph. See [the NestJS dialect guide](./docs/nestjs-dialect.md).
731
+ exposes ts-morph. See [the NestJS dialect guide](./docs/guides/nestjs-dialect.md).
717
732
 
718
733
  ### `@pbuilder/sdk/angular`
719
734
 
@@ -735,7 +750,7 @@ Extra named ops: `addComponentImport`, `addComponentProvider`, `addRootProvider`
735
750
  `addLazyRoute`, `addInjection`, `addInput`, `addModel`, `addOutput`, `addSignal`, `addComputed`,
736
751
  `addNgModuleImport`, `addDeclaration`, `addNgModuleProvider`, `addNgModuleExport`, `addBootstrap`.
737
752
  `.modify(fn)` exposes ts-morph. See
738
- [the Angular dialect guide](./docs/angular-dialect.md).
753
+ [the Angular dialect guide](./docs/guides/angular-dialect.md).
739
754
 
740
755
  ### `.modify()` — the universal escape hatch
741
756
 
@@ -774,7 +789,7 @@ still flushes as a **single** write. Two things to respect:
774
789
  ### Going deeper
775
790
 
776
791
  Everything dialect-related lives in one reference page —
777
- [Authoring a dialect](./docs/authoring-a-dialect.md): the complete method-by-method
792
+ [Authoring a dialect](./docs/guides/authoring-a-dialect.md): the complete method-by-method
778
793
  contracts of both shipped dialects (collision rules, idempotency, rejection semantics),
779
794
  how coalescing turns chained edits into one directive, async usage, and building a dialect
780
795
  of your own with `defineDialect`/`defineOpPack`, validated by the conformance kit (the
@@ -784,14 +799,14 @@ is written down.
784
799
 
785
800
  ## Documentation
786
801
 
787
- The full reading path lives in [`docs/`](./docs/README.md):
802
+ The full reading path lives in [`docs/guides/`](./docs/guides/README.md):
788
803
 
789
- 1. [Quickstart](./docs/quickstart.md) — standalone factory package, tsconfig, codegen, test.
790
- 2. [Authoring verbs](./docs/authoring-verbs.md) — the seven verbs + `find().read()` in full.
791
- 3. [Authoring `create` templates](./docs/create-templates.md) — the template language.
792
- 4. [Error contract](./docs/authoring-errors.md) — `AuthoringError` and recovery.
793
- 5. [Pending Directives](./docs/pending-directives.md) — previewing pending changes.
794
- 6. [Authoring a dialect](./docs/authoring-a-dialect.md) — AST-aware mutation per file type.
804
+ 1. [Quickstart](./docs/guides/quickstart.md) — standalone factory package, tsconfig, codegen, test.
805
+ 2. [Authoring verbs](./docs/guides/authoring-verbs.md) — the seven verbs + `find().read()` in full.
806
+ 3. [Authoring `create` templates](./docs/guides/create-templates.md) — the template language.
807
+ 4. [Error contract](./docs/guides/authoring-errors.md) — `AuthoringError` and recovery.
808
+ 5. [Pending Directives](./docs/guides/pending-directives.md) — previewing pending changes.
809
+ 6. [Authoring a dialect](./docs/guides/authoring-a-dialect.md) — AST-aware mutation per file type.
795
810
 
796
811
  ## Design at a glance
797
812
 
@@ -810,13 +825,13 @@ bun test
810
825
  bun run typecheck
811
826
  ```
812
827
 
813
- Packaging note: `dist/core/**` ships in the tarball, documented, not stripped —
814
- `./testing`'s runtime imports it, so it must be physically present; `@pbuilder/sdk/core`
815
- stays unreachable via `package.json#exports` regardless (the boundary is
828
+ Packaging note: the internal kit under `dist/bounded-contexts/**` ships in the tarball,
829
+ documented, not stripped — `./testing`'s runtime imports it, so it must be physically present;
830
+ it stays unreachable via `package.json#exports` regardless (the boundary is
816
831
  advisory-by-convention, not enforced by tarball exclusion).
817
832
 
818
833
  `conformance/` — SDK↔engine live conformance corpus, consumed by `project-builder-engine` as a
819
- pinned git submodule; see `conformance/README.md` and `CONFORMANCE-CORPUS-HANDOFF.md`.
834
+ pinned git submodule; see `conformance/README.md` and `docs/contracts/CONFORMANCE-CORPUS-HANDOFF.md`.
820
835
 
821
836
  ### Local registry (Verdaccio)
822
837
 
@@ -6,5 +6,7 @@ export declare class FrameFault {
6
6
  export declare class FrameReader {
7
7
  #private;
8
8
  constructor(source: AsyncIterable<Uint8Array>);
9
+ /** Ends this reader: a read it left parked hands its bytes to the next reader of the source. */
10
+ close(): void;
9
11
  frames(): AsyncGenerator<unknown>;
10
12
  }
@@ -1,4 +1,4 @@
1
- // src/transport/frame-reader.ts — streaming reassembler over raw chunks (e.g. stdin) into
1
+ // src/acl/irwire/frame-reader.ts — streaming reassembler over raw chunks (e.g. stdin) into
2
2
  // logical frames. Owns chunk-boundary handling (split/coalesced/EOF-mid-frame, SEC-10);
3
3
  // never byte-scans for a delimiter — length-prefixed only. Delegates body decoding AND the
4
4
  // inbound reject-before-alloc cap check to framing.ts (single owner of the codec, fit-31 /
@@ -10,7 +10,7 @@
10
10
  // drifted" without risking false positives against REQ-WPS-03's silent-discard territory
11
11
  // (a structurally-odd-but-valid-JSON object, e.g. `{type:"notification"}`, is WPS-03's job,
12
12
  // never a frame-reader fail-closed fault).
13
- import { decodeFrameBody, isOversizeDeclaredLength, LENGTH_PREFIX_BYTES } from "./framing.js";
13
+ import { decodeFrameBody, isOversizeDeclaredLength, LENGTH_PREFIX_BYTES } from "../../shared-kernel/framing.js";
14
14
  import { TransportFault } from "./stdio-engine-client.js";
15
15
  // REQ-SEC-08.1: the per-frame fault marker. A malformed BODY is fully consumed by the time
16
16
  // decoding fails (its boundary was known from the length prefix), so failing the ONE pending
@@ -26,15 +26,67 @@ export class FrameFault {
26
26
  this.fault = fault;
27
27
  }
28
28
  }
29
+ /**
30
+ * One byte source shared by every reader of it, such as one stdin across sequential runs in one
31
+ * process. At most one read from the source is outstanding, and its chunk goes to a reader that
32
+ * is still open: a reader closed while its read is parked withdraws without taking the chunk, so
33
+ * the next reader of the same source gets it (#167).
34
+ */
35
+ class SharedSource {
36
+ source;
37
+ #iterator;
38
+ #pull;
39
+ constructor(source) {
40
+ this.source = source;
41
+ this.#iterator = iterate(source);
42
+ }
43
+ async next(isOpen) {
44
+ for (;;) {
45
+ this.#pull ??= this.#iterator.next();
46
+ const pull = this.#pull;
47
+ const result = await pull;
48
+ if (!isOpen())
49
+ return { value: undefined, done: true };
50
+ if (result.done)
51
+ return result;
52
+ if (this.#pull !== pull)
53
+ continue;
54
+ this.#pull = undefined;
55
+ return result;
56
+ }
57
+ }
58
+ }
59
+ // Drives `source` through one iterator. A named generator, since the runner closure admits
60
+ // neither `Symbol.asyncIterator` nor a keyed weak map (scripts/capability-admission.ts).
61
+ async function* iterate(source) {
62
+ yield* source;
63
+ }
64
+ // Sequential runs read the same input object, so remembering the last one is enough.
65
+ let lastShared;
66
+ function sharedSource(source) {
67
+ if (lastShared?.source !== source)
68
+ lastShared = new SharedSource(source);
69
+ return lastShared;
70
+ }
29
71
  export class FrameReader {
30
72
  #buffer = Buffer.alloc(0);
31
73
  #source;
74
+ #closed = false;
32
75
  constructor(source) {
33
- this.#source = source;
76
+ this.#source = sharedSource(source);
77
+ }
78
+ /** Ends this reader: a read it left parked hands its bytes to the next reader of the source. */
79
+ close() {
80
+ this.#closed = true;
34
81
  }
35
82
  async *frames() {
36
- for await (const chunk of this.#source) {
37
- this.#buffer = Buffer.concat([this.#buffer, chunk]);
83
+ for (;;) {
84
+ const next = await this.#source.next(() => !this.#closed);
85
+ if (this.#closed)
86
+ return;
87
+ if (next.done)
88
+ break;
89
+ this.#buffer = Buffer.concat([this.#buffer, next.value]);
38
90
  for (const frame of this.#drainCompleteFrames()) {
39
91
  yield frame;
40
92
  }
@@ -1,5 +1,5 @@
1
- import type { EngineClient } from "../core/engine-client.ts";
2
- import type { Batch } from "../core/wire.ts";
1
+ import type { EngineClient } from "../../bounded-contexts/authoring/domain/ports/engine-client.ts";
2
+ import type { Batch } from "../../bounded-contexts/authoring/domain/valueobjects/wire.ts";
3
3
  export interface FrameChannel {
4
4
  write(value: unknown): void;
5
5
  read(): Promise<unknown>;
@@ -13,10 +13,10 @@
13
13
  // Scope boundary (S-000, happy path only) CLOSED by S-001: routing/discard (WPS-03),
14
14
  // fail-closed propagation (SEC-08), injectable timeout (SEC-05), and the EmitRejection
15
15
  // precondition/degrade (SEC-04) all now hold.
16
- import { exceedsEmitBatchBudget } from "../core/wire.js";
17
- import { EmitRejection } from "../core/emit-rejection.js";
18
- import { encodeFrameBody, withPreserializedBody } from "./framing.js";
19
- import { boundMessage } from "./error-text.js";
16
+ import { exceedsEmitBatchBudget } from "../../bounded-contexts/authoring/domain/valueobjects/wire.js";
17
+ import { EmitRejection } from "../../bounded-contexts/authoring/domain/ports/emit-rejection.js";
18
+ import { encodeFrameBody, withPreserializedBody } from "../../shared-kernel/framing.js";
19
+ import { boundMessage } from "../../platform/error-text.js";
20
20
  const DEFAULT_TIMEOUT_MS = 30_000;
21
21
  // REQ-SEC-04: directive-level codes carry a failedIndex; batch-level codes never do.
22
22
  const DIRECTIVE_LEVEL_CODES = new Set(["collision", "not-found"]);
@@ -2,7 +2,7 @@
2
2
  import { createRequire } from "node:module";
3
3
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
4
 
5
- // bin/pbuilder-codegen.ts
5
+ // src/bounded-contexts/authoring/infrastructure/in/codegen/cli.ts
6
6
  import {
7
7
  readFileSync as readFileSync2,
8
8
  writeFileSync,
@@ -18,13 +18,13 @@ import {
18
18
  } from "node:fs";
19
19
  import { join as join3, dirname as dirname2, basename, resolve as resolve2, sep } from "node:path";
20
20
 
21
- // src/core/schema/schema-model.ts
21
+ // src/bounded-contexts/authoring/domain/valueobjects/schema-model.ts
22
22
  var FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
23
23
  function isPlainObject(value) {
24
24
  return value !== null && typeof value === "object" && !Array.isArray(value);
25
25
  }
26
26
 
27
- // src/core/schema/schema-locate.ts
27
+ // src/bounded-contexts/authoring/domain/services/schema/schema-locate.ts
28
28
  function ok(next) {
29
29
  return { ok: true, next };
30
30
  }
@@ -187,7 +187,14 @@ function offsetToLineColumn(raw, offset) {
187
187
  return { line, column: offset - lastNewlineAt };
188
188
  }
189
189
  function locateFirstJsonSyntaxError(raw) {
190
- const result = scanValue(raw, 0);
190
+ let result;
191
+ try {
192
+ result = scanValue(raw, 0);
193
+ } catch (err) {
194
+ if (err instanceof RangeError)
195
+ return;
196
+ throw err;
197
+ }
191
198
  if (!result.ok) {
192
199
  return offsetToLineColumn(raw, result.offset);
193
200
  }
@@ -198,7 +205,7 @@ function locateFirstJsonSyntaxError(raw) {
198
205
  return;
199
206
  }
200
207
 
201
- // src/core/schema/schema-parse.ts
208
+ // src/bounded-contexts/authoring/domain/services/schema/schema-parse.ts
202
209
  class SchemaParseFailure extends Error {
203
210
  problem;
204
211
  line;
@@ -219,14 +226,7 @@ function parseSchema(raw) {
219
226
  try {
220
227
  parsed = JSON.parse(raw);
221
228
  } catch (err) {
222
- let locator;
223
- if (err instanceof SyntaxError) {
224
- try {
225
- locator = locateFirstJsonSyntaxError(raw);
226
- } catch {
227
- locator = undefined;
228
- }
229
- }
229
+ const locator = err instanceof SyntaxError ? locateFirstJsonSyntaxError(raw) : undefined;
230
230
  throw new SchemaParseFailure({
231
231
  problem: "invalid JSON",
232
232
  line: locator?.line,
@@ -259,27 +259,20 @@ function parseSchema(raw) {
259
259
  return { properties };
260
260
  }
261
261
 
262
- // src/core/schema/schema-digest.ts
262
+ // src/bounded-contexts/authoring/domain/services/schema/schema-digest.ts
263
263
  import { createHash } from "node:crypto";
264
264
  function computeSchemaDigest(raw) {
265
265
  return createHash("sha256").update(raw, "utf8").digest("hex");
266
266
  }
267
267
 
268
- // src/core/schema/schema-discovery.ts
268
+ // src/bounded-contexts/authoring/domain/services/schema/schema-files.ts
269
269
  import { join } from "node:path";
270
-
271
- // src/core/fs-errors.ts
272
- function isErrnoException(err) {
273
- return err instanceof Error && "code" in err;
274
- }
275
-
276
- // src/core/schema/schema-discovery.ts
277
270
  var SCHEMA_FILENAME = "schema.json";
278
271
  function schemaPathFor(packageDir) {
279
272
  return join(packageDir, SCHEMA_FILENAME);
280
273
  }
281
274
 
282
- // src/core/schema/schema-sufficiency.ts
275
+ // src/bounded-contexts/authoring/domain/services/schema/schema-sufficiency.ts
283
276
  var RECOGNIZED_KINDS = new Set(["string", "number", "boolean", "enum"]);
284
277
  function checkSufficiency(raw) {
285
278
  const parsed = JSON.parse(raw);
@@ -303,6 +296,8 @@ function checkSufficiency(raw) {
303
296
  findings.push({ key, reason: "nonsensical-type", detail: String(type) });
304
297
  } else if (type === "enum" && (!Array.isArray(value.choices) || value.choices.length === 0)) {
305
298
  findings.push({ key, reason: "enum-missing-choices" });
299
+ } else if (type === "enum" && !value.choices.every((choice) => typeof choice === "string")) {
300
+ findings.push({ key, reason: "enum-non-string-choices" });
306
301
  }
307
302
  if (typeof value.label !== "string") {
308
303
  findings.push({ key, reason: "missing-label" });
@@ -311,7 +306,12 @@ function checkSufficiency(raw) {
311
306
  return findings;
312
307
  }
313
308
 
314
- // bin/emit-type.ts
309
+ // src/platform/fs-errors.ts
310
+ function isErrnoException(err) {
311
+ return err instanceof Error && "code" in err;
312
+ }
313
+
314
+ // src/bounded-contexts/authoring/infrastructure/in/codegen/emit-type.ts
315
315
  var GENERATED_HEADER = "// AUTO-GENERATED by pbuilder-codegen — do not edit. Regenerate: pbuilder-codegen <package-dir>";
316
316
  var IDENTIFIER_RE = /^[A-Za-z_$][\w$]*$/;
317
317
 
@@ -362,7 +362,7 @@ function emitInputType(schema, digest) {
362
362
  `);
363
363
  }
364
364
 
365
- // bin/project-codegen.ts
365
+ // src/bounded-contexts/authoring/infrastructure/in/codegen/project-codegen.ts
366
366
  import { lstatSync, statSync, readFileSync, realpathSync } from "node:fs";
367
367
  import { dirname, join as join2, resolve } from "node:path";
368
368
  function readObject(path) {
@@ -486,7 +486,7 @@ function discoverProject(directory) {
486
486
  return { ok: true, root, entries };
487
487
  }
488
488
 
489
- // bin/pbuilder-codegen.ts
489
+ // src/bounded-contexts/authoring/infrastructure/in/codegen/cli.ts
490
490
  var GENERATED_FILENAME = "schema.generated.ts";
491
491
  var SUCCESS_LINE = "pbuilder-codegen: wrote schema.generated.ts";
492
492
  var USAGE = [
@@ -628,6 +628,8 @@ function describeSufficiencyFinding(finding) {
628
628
  return `unrecognized property type for "${finding.key}"`;
629
629
  case "enum-missing-choices":
630
630
  return `enum property "${finding.key}" is missing choices`;
631
+ case "enum-non-string-choices":
632
+ return `enum property "${finding.key}" has a choice that is not a string`;
631
633
  case "missing-label":
632
634
  return `property "${finding.key}" is missing a label`;
633
635
  }
@@ -728,15 +730,8 @@ function runProject(directory) {
728
730
  console.log(`pbuilder-codegen: generated ${generated}, failed ${failed}, duplicates ${duplicates}`);
729
731
  return failed > 0 ? 1 : 0;
730
732
  }
733
+
734
+ // bin/pbuilder-codegen.ts
731
735
  if (__require.main == __require.module) {
732
736
  process.exitCode = runCli(process.argv.slice(2));
733
737
  }
734
- export {
735
- runCli,
736
- generateSchema,
737
- WriteContainmentRefusal,
738
- USAGE,
739
- SchemaSufficiencyFailure,
740
- SUCCESS_LINE,
741
- GENERATED_FILENAME
742
- };
@@ -9,14 +9,14 @@
9
9
  // REQ-RUN-08: the fd-1 frame writer is captured AND console.* is redirected to stderr
10
10
  // FIRST, before the composition root can import any factory code — the SAME defence-in-
11
11
  // depth guarantee the bridge path gives (BRB-02/03), belt-and-suspenders alongside the
12
- // engine's own pre-import fd dup (A2). All real work lives in src/transport/runner.ts, the
12
+ // engine's own pre-import fd dup (A2). All real work lives in src/bounded-contexts/runner-hosting/infrastructure/in/runner.ts, the
13
13
  // ONE validation-gate chokepoint both this entry and the bridge share (FIT-15 bars
14
14
  // src/ -> bin/ imports, so the shared root cannot live here).
15
- import { runRunner } from "../transport/runner.js";
16
- import { captureFd1FrameWriter, redirectConsoleToStderr } from "../transport/framing.js";
17
- import { classifyExitCode } from "../transport/exit-codes.js";
18
- import { TransportFault } from "../transport/stdio-engine-client.js";
19
- import { boundMessage } from "../transport/error-text.js";
15
+ import { runRunner } from "../bounded-contexts/runner-hosting/infrastructure/in/runner.js";
16
+ import { captureFd1FrameWriter, redirectConsoleToStderr } from "../shared-kernel/framing.js";
17
+ import { classifyExitCode } from "../bounded-contexts/runner-hosting/infrastructure/in/exit-codes.js";
18
+ import { TransportFault } from "../acl/irwire/stdio-engine-client.js";
19
+ import { boundMessage } from "../platform/error-text.js";
20
20
  if (import.meta.main) {
21
21
  const writeFrame = captureFd1FrameWriter();
22
22
  redirectConsoleToStderr();