@pbuilder/sdk 0.14.0 → 0.15.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 (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 +13 -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 +7 -5
  37. package/dist/{scaffold → bounded-contexts/authoring/domain/services}/filename-pipeline.js +28 -8
  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
@@ -0,0 +1,69 @@
1
+ import { type Handle } from "../../../../domain/services/define-dialect.ts";
2
+ import { type YamlStream } from "./ast.ts";
3
+ import type { DocumentOption, YamlPath, YamlValue } from "./paths.ts";
4
+ import { type CollectionStyle, type CommentOptions, type ScalarStyle } from "./presentation.ts";
5
+ import { type KeyOptions } from "./structural.ts";
6
+ export * as astLibrary from "yaml";
7
+ export type { YamlStream, YamlPath, YamlValue };
8
+ type YamlOps = {
9
+ setValue: (ast: YamlStream, path: YamlPath, value: YamlValue, options?: KeyOptions) => void;
10
+ addKey: (ast: YamlStream, path: YamlPath, value: YamlValue, options?: KeyOptions) => void;
11
+ removeKey: (ast: YamlStream, path: YamlPath, options?: DocumentOption) => void;
12
+ renameKey: (ast: YamlStream, path: YamlPath, newKey: string, options?: DocumentOption) => void;
13
+ insertItem: (ast: YamlStream, path: YamlPath, index: number, value: YamlValue, options?: DocumentOption) => void;
14
+ appendItem: (ast: YamlStream, path: YamlPath, value: YamlValue, options?: DocumentOption & {
15
+ unique?: boolean;
16
+ }) => void;
17
+ removeItem: (ast: YamlStream, path: YamlPath, index: number, options?: DocumentOption) => void;
18
+ removeValue: (ast: YamlStream, path: YamlPath, value: YamlValue, options?: DocumentOption) => void;
19
+ replaceItem: (ast: YamlStream, path: YamlPath, index: number, value: YamlValue, options?: DocumentOption) => void;
20
+ moveItem: (ast: YamlStream, path: YamlPath, from: number, to: number, options?: DocumentOption) => void;
21
+ merge: (ast: YamlStream, path: YamlPath, value: {
22
+ [key: string]: YamlValue;
23
+ }, options?: DocumentOption) => void;
24
+ updateValue: (ast: YamlStream, path: YamlPath, fn: (current: YamlValue | undefined) => YamlValue, options?: DocumentOption) => void;
25
+ setComment: (ast: YamlStream, path: YamlPath, comment: string, options?: CommentOptions) => void;
26
+ removeComment: (ast: YamlStream, path: YamlPath, options?: CommentOptions) => void;
27
+ setAnchor: (ast: YamlStream, path: YamlPath, name: string, options?: DocumentOption) => void;
28
+ removeAnchor: (ast: YamlStream, path: YamlPath, options?: DocumentOption) => void;
29
+ setAlias: (ast: YamlStream, path: YamlPath, anchor: string, options?: DocumentOption) => void;
30
+ addMergeKey: (ast: YamlStream, path: YamlPath, anchor: string, options?: DocumentOption) => void;
31
+ setStyle: (ast: YamlStream, path: YamlPath, style: CollectionStyle | ScalarStyle, options?: DocumentOption) => void;
32
+ addDocument: (ast: YamlStream, value: YamlValue, options?: {
33
+ index?: number;
34
+ }) => void;
35
+ removeDocument: (ast: YamlStream, index: number) => void;
36
+ moveValue: (ast: YamlStream, from: YamlPath, to: YamlPath, options?: DocumentOption) => void;
37
+ copyValue: (ast: YamlStream, from: YamlPath, to: YamlPath, options?: DocumentOption) => void;
38
+ sortKeys: (ast: YamlStream, path: YamlPath, options?: DocumentOption & {
39
+ recursive?: boolean;
40
+ }) => void;
41
+ setTag: (ast: YamlStream, path: YamlPath, tag: string | null, options?: DocumentOption) => void;
42
+ };
43
+ /**
44
+ * Opens a `.yaml` or `.yml` file for YAML-dialect editing. The basename must end in one of those
45
+ * extensions after a non-empty stem; every other path throws synchronously, before any op runs,
46
+ * with the `dialect operation failed: ` prefix.
47
+ *
48
+ * Every named op addresses a node by a path array (`["services", "web", "ports", 0]`) and takes
49
+ * an optional last `{ document }` option selecting a document of a multi-document file.
50
+ * Documents no op touched print byte-identical to their source.
51
+ *
52
+ * @example
53
+ * import * as yaml from "@pbuilder/sdk/yaml";
54
+ *
55
+ * // compose.yaml before: services:\n web:\n image: node\n
56
+ * export const run = async () => {
57
+ * await yaml
58
+ * .find("compose.yaml")
59
+ * .setValue(["services", "web", "ports"], ["3000:3000"])
60
+ * .setComment(["services", "web"], "Frontend");
61
+ * };
62
+ * // -> services:
63
+ * // -> # Frontend
64
+ * // -> web:
65
+ * // -> image: node
66
+ * // -> ports:
67
+ * // -> - 3000:3000
68
+ */
69
+ export declare function find(path: string): Handle<"found", YamlStream, YamlOps>;
@@ -0,0 +1,70 @@
1
+ // The YAML dialect module, `@pbuilder/sdk/yaml`. Composes the sanctioned kit surface only
2
+ // (`defineDialect`/`defineOpPack`/`withOps`), mirroring the other dialect modules.
3
+ import { defineDialect, defineOpPack, withOps } from "../../../../domain/services/define-dialect.js";
4
+ import { parse, print } from "./ast.js";
5
+ import { addDocument, removeDocument } from "./documents.js";
6
+ import { addMergeKey, removeAnchor, removeComment, setAlias, setAnchor, setComment, setStyle, setTag, } from "./presentation.js";
7
+ import { addKey, appendItem, copyValue, insertItem, merge, moveItem, moveValue, removeItem, removeKey, removeValue, renameKey, replaceItem, setValue, sortKeys, updateValue, } from "./structural.js";
8
+ export * as astLibrary from "yaml";
9
+ const opsPack = defineOpPack({
10
+ setValue,
11
+ addKey,
12
+ removeKey,
13
+ renameKey,
14
+ insertItem,
15
+ appendItem,
16
+ removeItem,
17
+ removeValue,
18
+ replaceItem,
19
+ moveItem,
20
+ merge,
21
+ updateValue,
22
+ setComment,
23
+ removeComment,
24
+ setAnchor,
25
+ removeAnchor,
26
+ setAlias,
27
+ addMergeKey,
28
+ setStyle,
29
+ addDocument,
30
+ removeDocument,
31
+ moveValue,
32
+ copyValue,
33
+ sortKeys,
34
+ setTag,
35
+ });
36
+ const baseDialect = defineDialect({
37
+ extensions: [".yaml", ".yml"],
38
+ ast: { parse, print },
39
+ ops: {},
40
+ });
41
+ const yamlDialect = withOps(baseDialect, opsPack);
42
+ /**
43
+ * Opens a `.yaml` or `.yml` file for YAML-dialect editing. The basename must end in one of those
44
+ * extensions after a non-empty stem; every other path throws synchronously, before any op runs,
45
+ * with the `dialect operation failed: ` prefix.
46
+ *
47
+ * Every named op addresses a node by a path array (`["services", "web", "ports", 0]`) and takes
48
+ * an optional last `{ document }` option selecting a document of a multi-document file.
49
+ * Documents no op touched print byte-identical to their source.
50
+ *
51
+ * @example
52
+ * import * as yaml from "@pbuilder/sdk/yaml";
53
+ *
54
+ * // compose.yaml before: services:\n web:\n image: node\n
55
+ * export const run = async () => {
56
+ * await yaml
57
+ * .find("compose.yaml")
58
+ * .setValue(["services", "web", "ports"], ["3000:3000"])
59
+ * .setComment(["services", "web"], "Frontend");
60
+ * };
61
+ * // -> services:
62
+ * // -> # Frontend
63
+ * // -> web:
64
+ * // -> image: node
65
+ * // -> ports:
66
+ * // -> - 3000:3000
67
+ */
68
+ export function find(path) {
69
+ return yamlDialect.find(path);
70
+ }
@@ -1,5 +1,5 @@
1
1
  import { Pair, type Document, type Node, type YAMLMap, type YAMLSeq } from "yaml";
2
- import { type JsonPath, type JsonValue } from "../../core/json-value.ts";
2
+ import { type JsonPath, type JsonValue } from "../../../../domain/valueobjects/json-value.ts";
3
3
  import { type YamlStream } from "./ast.ts";
4
4
  export type YamlValue = JsonValue;
5
5
  export type YamlPath = JsonPath;
@@ -1,8 +1,8 @@
1
1
  // Shared plumbing for the YAML ops: document selection, path resolution over `yaml` nodes,
2
2
  // node replacement that keeps comments and anchors, and the alias-order invariant.
3
3
  import { Pair, Scalar, isAlias, isMap, isNode, isScalar, isSeq, visit } from "yaml";
4
- import { dialectError } from "../../core/dialect-error.js";
5
- import { assertJsonValue, formatPath } from "../../core/json-value.js";
4
+ import { dialectError } from "../../../../domain/valueobjects/dialect-error.js";
5
+ import { assertJsonValue, formatPath } from "../../../../domain/valueobjects/json-value.js";
6
6
  import { newDocument } from "./ast.js";
7
7
  export function fail(op, path, tail) {
8
8
  throw dialectError(path === null ? `${op}: ${tail}` : `${op} ${formatPath(path)}: ${tail}`);
@@ -1,6 +1,6 @@
1
1
  // Presentation ops only YAML has: comments, anchors, aliases, merge keys, styles, and tags.
2
2
  import { Alias, Document, Pair, Scalar, isAlias, isMap, isScalar, isSeq, parseDocument, visit } from "yaml";
3
- import { deepEqual } from "../../core/deep-equal.js";
3
+ import { deepEqual } from "../../../../../../platform/deep-equal.js";
4
4
  import { assertAliasesResolve, assertPath, fail, findAnchored, findPair, resolve, selectDocument, toValue, writeSlot, } from "./paths.js";
5
5
  function existingSlot(op, document, path) {
6
6
  const slot = resolve(op, document, path, "write");
@@ -1,8 +1,8 @@
1
1
  // Structural ops: the JSON dialect's catalogue over `yaml` nodes, with "object" read as mapping
2
2
  // and "array" as sequence.
3
3
  import { isAlias, isMap, isSeq } from "yaml";
4
- import { deepEqual } from "../../core/deep-equal.js";
5
- import { formatPath } from "../../core/json-value.js";
4
+ import { deepEqual } from "../../../../../../platform/deep-equal.js";
5
+ import { formatPath } from "../../../../domain/valueobjects/json-value.js";
6
6
  import { assertAliasesResolve, assertPath, assertPosition, assertValue, createNode, fail, findPair, isPlainObject, keyLabel, replacement, resolve, resolveAlias, selectDocument, toValue, writeSlot, } from "./paths.js";
7
7
  function upsert(op, document, path, value, options) {
8
8
  assertPosition(op, path, document, options);
@@ -0,0 +1,8 @@
1
+ import { type PackageFiles } from "../../../domain/ports/package-files.ts";
2
+ /**
3
+ * The reserved lifecycle name among a package folder's own entry names — a
4
+ * `pre-execute`/`post-execute` file (`.ts`/`.js`, case-insensitive) or directory — or
5
+ * `undefined`. Never run-time inputs or `schema.json` field names (REQ-RLN-01.4).
6
+ */
7
+ export declare function reservedSiblingIn(entryNames: readonly string[]): string | undefined;
8
+ export declare const nodePackageFiles: PackageFiles;
@@ -0,0 +1,133 @@
1
+ // The node:fs adapter of the package-files port. ENOENT is absence; any other failure is
2
+ // described in author vocabulary, never by its raw errno message.
3
+ import { lstatSync, readdirSync, readFileSync, statSync } from "node:fs";
4
+ import { join, relative } from "node:path";
5
+ import { PackageReadFailure, } from "../../../domain/ports/package-files.js";
6
+ import { RESERVED_LIFECYCLE_NAMES } from "../../../domain/valueobjects/schema-model.js";
7
+ import { isErrnoException } from "../../../../../platform/fs-errors.js";
8
+ function describeReadFailure(err) {
9
+ if (isErrnoException(err)) {
10
+ if (err.code === "EACCES" || err.code === "EPERM")
11
+ return "permission denied";
12
+ if (err.code === "EISDIR")
13
+ return "is a directory, not a file";
14
+ }
15
+ return "unreadable";
16
+ }
17
+ function unlessAbsent(read) {
18
+ try {
19
+ return read();
20
+ }
21
+ catch (err) {
22
+ if (isErrnoException(err) && err.code === "ENOENT")
23
+ return undefined;
24
+ throw new PackageReadFailure(describeReadFailure(err));
25
+ }
26
+ }
27
+ const RESERVED_EXTENSIONS = [".ts", ".js"];
28
+ // Strips a recognized extension (case-insensitively) so `pre-execute.ts`, `PRE-EXECUTE.TS`,
29
+ // and the dir-form entry `pre-execute` (no extension at all) all normalize to the same
30
+ // lowercase kebab token before comparison (ADR-0028: case-insensitive, strip-extension).
31
+ function normalizeEntry(name) {
32
+ const lower = name.toLowerCase();
33
+ for (const ext of RESERVED_EXTENSIONS) {
34
+ if (lower.endsWith(ext))
35
+ return lower.slice(0, -ext.length);
36
+ }
37
+ return lower;
38
+ }
39
+ /**
40
+ * The reserved lifecycle name among a package folder's own entry names — a
41
+ * `pre-execute`/`post-execute` file (`.ts`/`.js`, case-insensitive) or directory — or
42
+ * `undefined`. Never run-time inputs or `schema.json` field names (REQ-RLN-01.4).
43
+ */
44
+ export function reservedSiblingIn(entryNames) {
45
+ for (const entry of entryNames) {
46
+ const normalized = normalizeEntry(entry);
47
+ const match = RESERVED_LIFECYCLE_NAMES.find((name) => name === normalized);
48
+ if (match !== undefined)
49
+ return match;
50
+ }
51
+ return undefined;
52
+ }
53
+ // The path is joined lexically, never canonicalized on disk; the operating system resolves a
54
+ // relative package folder against the working directory. This file is in the runner closure,
55
+ // where `path.resolve` (it reads the working directory) is not an admitted origin.
56
+ function statSource(packageDir, relPath) {
57
+ try {
58
+ const stat = statSync(join(packageDir, relPath));
59
+ if (stat.isDirectory())
60
+ return { kind: "directory" };
61
+ return stat.isFile() ? { kind: "file", size: stat.size } : { kind: "other" };
62
+ }
63
+ catch (err) {
64
+ if (isErrnoException(err)) {
65
+ // ENOTDIR/ENAMETOOLONG both mean the path, as given, does not exist: a segment along
66
+ // the way is a regular file, or the resolved string exceeds the filesystem's name
67
+ // limit. Neither is a permission or I/O failure on an existing path.
68
+ if (err.code === "ENOENT" || err.code === "ENOTDIR" || err.code === "ENAMETOOLONG")
69
+ return { kind: "missing" };
70
+ if (err.code === "ELOOP")
71
+ return { kind: "unreadable", detail: "symlink cycle" };
72
+ if (err.code === "ERR_INVALID_ARG_VALUE")
73
+ return { kind: "unreadable", detail: "path contains an invalid character" };
74
+ }
75
+ // EACCES/EPERM/EMFILE/…, or no `.code` at all: never interpolates the raw error.
76
+ return { kind: "unreadable", detail: "permission or I/O error" };
77
+ }
78
+ }
79
+ // The walk names a vanished entry and a non-folder root differently from every other failure.
80
+ function entryFailure(err) {
81
+ if (isErrnoException(err) && err.code === "ENOENT")
82
+ return "missing";
83
+ if (isErrnoException(err) && err.code === "ENOTDIR")
84
+ return "not-a-directory";
85
+ return "unreadable";
86
+ }
87
+ function entryAt(path) {
88
+ try {
89
+ const stat = lstatSync(path);
90
+ if (stat.isSymbolicLink())
91
+ return { kind: "symlink" };
92
+ return { kind: stat.isDirectory() ? "directory" : "other" };
93
+ }
94
+ catch (err) {
95
+ return { failure: entryFailure(err) };
96
+ }
97
+ }
98
+ function namesIn(dir) {
99
+ try {
100
+ return readdirSync(dir);
101
+ }
102
+ catch (err) {
103
+ return { failure: entryFailure(err) };
104
+ }
105
+ }
106
+ function isFolder(path) {
107
+ try {
108
+ return statSync(path).isDirectory();
109
+ }
110
+ catch {
111
+ return false;
112
+ }
113
+ }
114
+ export const nodePackageFiles = {
115
+ readText: (path) => unlessAbsent(() => readFileSync(path, "utf-8")),
116
+ findReservedSibling: (packageDir) => {
117
+ const entries = unlessAbsent(() => readdirSync(packageDir));
118
+ return entries === undefined ? undefined : reservedSiblingIn(entries);
119
+ },
120
+ relativeToCwd: (path) => relative(process.cwd(), path),
121
+ statSource,
122
+ readBytes: (packageDir, relPath) => {
123
+ try {
124
+ return readFileSync(join(packageDir, relPath));
125
+ }
126
+ catch (err) {
127
+ throw new PackageReadFailure(describeReadFailure(err));
128
+ }
129
+ },
130
+ entryAt,
131
+ namesIn,
132
+ isFolder,
133
+ };
@@ -0,0 +1,157 @@
1
+ import type { Dialect, Handle, OpPack } from "../../domain/services/define-dialect.ts";
2
+ /**
3
+ * Runtime module contract; native namespace exports also preserve upstream types.
4
+ *
5
+ * @example
6
+ * import type { DialectModule } from "@pbuilder/sdk/conformance";
7
+ * import * as typescript from "@pbuilder/sdk/typescript";
8
+ *
9
+ * const module: DialectModule<typeof typescript.astLibrary> = typescript;
10
+ * const project = new module.astLibrary.Project({ useInMemoryFileSystem: true });
11
+ * const ast = project.createSourceFile("example.ts", "const answer = 1;\n");
12
+ * console.assert(module.astLibrary.Node.isSourceFile(ast));
13
+ */
14
+ export interface DialectModule<Library extends object = object> {
15
+ readonly find: (path: string) => Handle<"found", unknown, {}>;
16
+ readonly astLibrary: Library;
17
+ }
18
+ /**
19
+ * Actual entrypoint, independent adapter-library evidence, and a byte-exact editing exercise.
20
+ * The library exercise receives two arguments; public handle callbacks still receive only the AST.
21
+ *
22
+ * @example
23
+ * // In this repository's test/conformance/ directory:
24
+ * import { testDialect, type DialectFixture } from "@pbuilder/sdk/conformance";
25
+ * import * as module from "@pbuilder/sdk/typescript";
26
+ * import * as expectedAstLibrary from "ts-morph";
27
+ * import { defineDialect } from "../../src/core/define-dialect.ts";
28
+ * import { parse, print } from "../../src/bounded-contexts/authoring/infrastructure/out/dialects/typescript/ast.ts";
29
+ *
30
+ * const exerciseLibrary: DialectFixture<typeof expectedAstLibrary>["libraryExercise"]["modify"] = (ast, library) => {
31
+ * if (!(ast instanceof library.SourceFile) || !library.Node.isSourceFile(ast)) {
32
+ * throw new Error("incompatible adapter library");
33
+ * }
34
+ * ast.getVariableStatements()[0]!.setDeclarationKind(library.VariableDeclarationKind.Const);
35
+ * };
36
+ * const fixture: DialectFixture<typeof expectedAstLibrary> = {
37
+ * dialect: defineDialect({ extensions: [".ts"], ast: { parse, print }, ops: {} }),
38
+ * samples: ["const x = 1;\n"],
39
+ * module,
40
+ * expectedAstLibrary,
41
+ * libraryExercise: {
42
+ * path: "example.ts", seed: "let answer = 1;\n", expect: "const answer = 1;\n",
43
+ * modify: exerciseLibrary,
44
+ * },
45
+ * };
46
+ * await testDialect(fixture);
47
+ */
48
+ export interface DialectFixture<Library extends object = object> {
49
+ /** The dialect instance to exercise. */
50
+ dialect: Dialect;
51
+ /** Representative source strings the dialect's parse/print round-trip must survive byte-exact. */
52
+ samples: string[];
53
+ module: DialectModule<Library>;
54
+ /** Independent evidence from the adapter's library dependency, not the tested export. */
55
+ expectedAstLibrary: Library;
56
+ libraryExercise: {
57
+ path: string;
58
+ seed: string;
59
+ expect: string;
60
+ modify: (ast: unknown, library: Library) => void;
61
+ };
62
+ }
63
+ /**
64
+ * One op-invocation recipe `testOpPack` applies to a seeded target: seed the file, run the
65
+ * op `chain` (named pack ops and/or the universal `.modify`), and assert the coalesced
66
+ * `modify`'s content is BYTE-EXACT `expect` — a full-output comparison, never a substring,
67
+ * so one assertion proves both the op's intended effect AND that every other region is
68
+ * byte-stable (REQ-DC-02's unchanged-elsewhere).
69
+ *
70
+ * @example
71
+ * const exercise: OpExercise = {
72
+ * seed: "export const x = 1;",
73
+ * chain: [{ op: "addImport", args: ["readFileSync", "node:fs"] }],
74
+ * expect: 'import { readFileSync } from "node:fs";\nexport const x = 1;',
75
+ * };
76
+ */
77
+ export interface OpExercise {
78
+ /** Initial content seeded at `path` (flush-seed-rule, REQ-MC-04) — never a `create()` target. */
79
+ seed: string;
80
+ /** Optional target path; the kit defaults to a stable name using `baseDialect.extensions[0]`. */
81
+ path?: string;
82
+ /** Ops applied in order: a named pack op (`op` + `args`), or the universal `.modify`. */
83
+ chain: ReadonlyArray<{
84
+ readonly op: string;
85
+ readonly args: readonly unknown[];
86
+ } | {
87
+ readonly modify: (ast: unknown) => void;
88
+ }>;
89
+ /** BYTE-EXACT printed content of the coalesced `modify` directive after the chain runs. */
90
+ expect: string;
91
+ }
92
+ /**
93
+ * Fixture passed to `testOpPack` to drive the conformance suite.
94
+ * The fixture supplies the op-pack under test, the base dialect it augments, and the
95
+ * op-invocation recipes (`exercises`) the kit needs to actually apply each op and assert
96
+ * byte-exact effects — REQUIRED at the type level so an exercise-less fixture cannot
97
+ * silently skip `testOpPack`'s load-bearing per-op assertions (REQ-DC-02..04).
98
+ *
99
+ * @example
100
+ * const fixture: OpPackFixture = {
101
+ * opPack: myInsertImportOps,
102
+ * baseDialect: myTypeScriptDialect,
103
+ * exercises: [
104
+ * {
105
+ * seed: "export const x = 1;",
106
+ * chain: [{ op: "addImport", args: ["readFileSync", "node:fs"] }],
107
+ * expect: 'import { readFileSync } from "node:fs";\nexport const x = 1;',
108
+ * },
109
+ * ],
110
+ * };
111
+ */
112
+ export interface OpPackFixture {
113
+ /** The op-pack to exercise against a real base dialect (not a mock). */
114
+ opPack: OpPack;
115
+ /** The base dialect that holds the live AST — required by ADR-0012 (op-packs tested against real dialects). */
116
+ baseDialect: Dialect;
117
+ /** The op-invocation recipes `testOpPack` applies — REQUIRED (rev 5, ADR-0012 amendment). */
118
+ exercises: readonly OpExercise[];
119
+ }
120
+ /**
121
+ * Runs the conformance suite for a dialect: asserts parse/print no-op round-trip fidelity
122
+ * (REQ-DC-01) — `print(parse(sample)) === sample` BYTE-EXACT, never AST-equal, for every
123
+ * sample in `fixture.samples` PLUS the four mandatory adversarial samples the kit injects on
124
+ * every run (REQ-DC-06 — additive, not opt-out-able). Before each round-trip check, verifies
125
+ * `fixture.dialect.ast.parse` is a REAL parser, not an identity/stub function (REQ-DC-08): a
126
+ * `parse` returning `null`/`undefined`, or the input string unchanged, fails BEFORE the
127
+ * round-trip assertion could vacuously pass.
128
+ *
129
+ * Requires runtime library exports matching independent adapter evidence, then exercises
130
+ * the actual module's `find().modify()` through a real run with byte-exact emitted output.
131
+ */
132
+ export declare function testDialect<Library extends object>(fixture: DialectFixture<Library>): Promise<void>;
133
+ /**
134
+ * Runs the conformance suite for an op-pack against a REAL base dialect (never a mock,
135
+ * ADR-0012): for each of `fixture.exercises`, asserts single-op fidelity +
136
+ * unchanged-elsewhere (REQ-DC-02) / coalescing-to-one content-verified (REQ-DC-03) via a
137
+ * no-read run, seam-serializability (REQ-DC-04) over every emitted directive, and — for
138
+ * every multi-op exercise — the read-boundary split (REQ-DC-05.2's live counterpart): a
139
+ * mid-chain `read()` must force exactly TWO cumulative modify directives, never one. Finally,
140
+ * asserts `fixture.baseDialect` survives the four mandatory adversarial samples' round-trip +
141
+ * real-base probe (REQ-DC-06/REQ-DC-08 — additive, not opt-out-able, same mechanism
142
+ * `testDialect` runs), unconditionally on every call whose exercises pass.
143
+ *
144
+ * @example
145
+ * await testOpPack({
146
+ * opPack: myInsertImportOps,
147
+ * baseDialect: myTypeScriptDialect,
148
+ * exercises: [
149
+ * {
150
+ * seed: "export const x = 1;",
151
+ * chain: [{ op: "addImport", args: ["readFileSync", "node:fs"] }],
152
+ * expect: 'import { readFileSync } from "node:fs";\nexport const x = 1;',
153
+ * },
154
+ * ],
155
+ * });
156
+ */
157
+ export declare function testOpPack(fixture: OpPackFixture): Promise<void>;