@sdd-method/cli-core 0.1.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 (89) hide show
  1. package/LIBRARY_SPEC.md +36 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +17 -0
  4. package/README.md +67 -0
  5. package/dist/archetypes/index.d.ts +5 -0
  6. package/dist/archetypes/index.d.ts.map +1 -0
  7. package/dist/archetypes/index.js +5 -0
  8. package/dist/archetypes/index.js.map +1 -0
  9. package/dist/archetypes/registry.d.ts +12 -0
  10. package/dist/archetypes/registry.d.ts.map +1 -0
  11. package/dist/archetypes/registry.js +77 -0
  12. package/dist/archetypes/registry.js.map +1 -0
  13. package/dist/archetypes/render.d.ts +29 -0
  14. package/dist/archetypes/render.d.ts.map +1 -0
  15. package/dist/archetypes/render.js +110 -0
  16. package/dist/archetypes/render.js.map +1 -0
  17. package/dist/archetypes/repo-config.d.ts +30 -0
  18. package/dist/archetypes/repo-config.d.ts.map +1 -0
  19. package/dist/archetypes/repo-config.js +44 -0
  20. package/dist/archetypes/repo-config.js.map +1 -0
  21. package/dist/archetypes/types.d.ts +31 -0
  22. package/dist/archetypes/types.d.ts.map +1 -0
  23. package/dist/archetypes/types.js +2 -0
  24. package/dist/archetypes/types.js.map +1 -0
  25. package/dist/index.d.ts +6 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +4 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/list.d.ts +12 -0
  30. package/dist/list.d.ts.map +1 -0
  31. package/dist/list.js +64 -0
  32. package/dist/list.js.map +1 -0
  33. package/dist/mcp/envelope.d.ts +23 -0
  34. package/dist/mcp/envelope.d.ts.map +1 -0
  35. package/dist/mcp/envelope.js +30 -0
  36. package/dist/mcp/envelope.js.map +1 -0
  37. package/dist/mcp/index.d.ts +15 -0
  38. package/dist/mcp/index.d.ts.map +1 -0
  39. package/dist/mcp/index.js +12 -0
  40. package/dist/mcp/index.js.map +1 -0
  41. package/dist/mcp/lifecycle.d.ts +15 -0
  42. package/dist/mcp/lifecycle.d.ts.map +1 -0
  43. package/dist/mcp/lifecycle.js +24 -0
  44. package/dist/mcp/lifecycle.js.map +1 -0
  45. package/dist/mcp/sdd-client.d.ts +36 -0
  46. package/dist/mcp/sdd-client.d.ts.map +1 -0
  47. package/dist/mcp/sdd-client.js +76 -0
  48. package/dist/mcp/sdd-client.js.map +1 -0
  49. package/dist/mcp/types.d.ts +25 -0
  50. package/dist/mcp/types.d.ts.map +1 -0
  51. package/dist/mcp/types.js +13 -0
  52. package/dist/mcp/types.js.map +1 -0
  53. package/dist/pins/artifacts.d.ts +17 -0
  54. package/dist/pins/artifacts.d.ts.map +1 -0
  55. package/dist/pins/artifacts.js +12 -0
  56. package/dist/pins/artifacts.js.map +1 -0
  57. package/dist/pins/contracts.d.ts +17 -0
  58. package/dist/pins/contracts.d.ts.map +1 -0
  59. package/dist/pins/contracts.js +12 -0
  60. package/dist/pins/contracts.js.map +1 -0
  61. package/dist/pins/index.d.ts +5 -0
  62. package/dist/pins/index.d.ts.map +1 -0
  63. package/dist/pins/index.js +3 -0
  64. package/dist/pins/index.js.map +1 -0
  65. package/dist/repo-kind.d.ts +13 -0
  66. package/dist/repo-kind.d.ts.map +1 -0
  67. package/dist/repo-kind.js +42 -0
  68. package/dist/repo-kind.js.map +1 -0
  69. package/dist/stability/index.d.ts +22 -0
  70. package/dist/stability/index.d.ts.map +1 -0
  71. package/dist/stability/index.js +12 -0
  72. package/dist/stability/index.js.map +1 -0
  73. package/dist/validate/archetype-metadata-check.d.ts +24 -0
  74. package/dist/validate/archetype-metadata-check.d.ts.map +1 -0
  75. package/dist/validate/archetype-metadata-check.js +44 -0
  76. package/dist/validate/archetype-metadata-check.js.map +1 -0
  77. package/dist/validate/index.d.ts +5 -0
  78. package/dist/validate/index.d.ts.map +1 -0
  79. package/dist/validate/index.js +3 -0
  80. package/dist/validate/index.js.map +1 -0
  81. package/dist/validate/manifest-check.d.ts +29 -0
  82. package/dist/validate/manifest-check.d.ts.map +1 -0
  83. package/dist/validate/manifest-check.js +96 -0
  84. package/dist/validate/manifest-check.js.map +1 -0
  85. package/dist/workspace.d.ts +7 -0
  86. package/dist/workspace.d.ts.map +1 -0
  87. package/dist/workspace.js +31 -0
  88. package/dist/workspace.js.map +1 -0
  89. package/package.json +66 -0
@@ -0,0 +1,36 @@
1
+ # @sdd-method/cli-core — Library Specification
2
+
3
+ This document records the public surface contract for `@sdd-method/cli-core` per [ADR 0152 §6.1](https://github.com/tomfosteruk/sdd-method/blob/main/docs/method/adr/ADR%200152:%20Upstream%20Code-CLI%20Core%20Library%20Scope%20and%20API%20Surface.md). The scope rationale, in/out decisions per domain, and pre-1.0 release-line discipline live in ADR 0152 — this file does not duplicate that content; it points at it.
4
+
5
+ ## What's in scope for v0.1.0
6
+
7
+ The eight sub-module export groups enumerated in [README.md § v0.1.0 public surface](README.md#v010-public-surface), matching ADR 0152 §4.3 "In" rows.
8
+
9
+ ## What's out of scope
10
+
11
+ The six sub-module export groups listed in [README.md § Out of scope for v0.1.0](README.md#out-of-scope-for-v010), matching ADR 0152 §4.3 "Out" rows. Authentication flow is the one "Candidate (v0.2.0+)" surface.
12
+
13
+ ## Versioning
14
+
15
+ Portable-contract semver per ADR 0141. See [README.md § Semver discipline](README.md#semver-discipline) and ADR 0152 §4.4.
16
+
17
+ ## What is the "public surface"?
18
+
19
+ Everything re-exported from:
20
+
21
+ - The package root (`./index.ts` → `@sdd-method/cli-core`).
22
+ - The sub-module entry points (`./archetypes/index.ts` → `@sdd-method/cli-core/archetypes`, etc.) declared in `package.json` `exports`.
23
+
24
+ Internal modules NOT re-exported from these entry points are free to change without MAJOR — for example, helper functions inside `src/archetypes/registry.ts` that aren't re-exported from `src/archetypes/index.ts` can move, rename, or disappear without a major bump.
25
+
26
+ ## Cross-reference rule
27
+
28
+ This library MAY reference [sdd-method](https://github.com/tomfosteruk/sdd-method) (method canon — ADRs, methods, foundations). It MUST NOT reference sdd-method-gov anywhere (governance docs).
29
+
30
+ ## What lands when
31
+
32
+ | Surface | When |
33
+ |---|---|
34
+ | Eight v0.1.0 sub-modules | v0.1.0 (this release) |
35
+ | Authentication flow | v0.2.0+ (pending second-adopter signal) |
36
+ | v1.0.0 surface lock | After two adopters validate against v0.x (parallel to ADR 0141 / 0148 / 0151 two-adopter discipline) |
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,17 @@
1
+ @sdd-method/cli-core
2
+ Copyright 2026 Tom Foster
3
+
4
+ This product includes software developed as part of the SDD method
5
+ distribution (https://github.com/tomfosteruk/sdd-method).
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @sdd-method/cli-core
2
+
3
+ Upstream shared TypeScript/Node core for SDD adopter `partner-cli` and `platform-cli` binaries. Implements the method-defined surfaces every SDD adopter's code-CLI pair recurs against per [ADR 0118](https://github.com/tomfosteruk/sdd-method/blob/main/docs/method/adr/ADR%200118:%20Partner%20CLI%20Role%20Framework.md) + [ADR 0120](https://github.com/tomfosteruk/sdd-method/blob/main/docs/method/adr/ADR%200120:%20Upstream%20Code-CLI%20Core%20Library%20for%20Partner%20and%20Platform%20CLIs.md) + [ADR 0127](https://github.com/tomfosteruk/sdd-method/blob/main/docs/method/adr/ADR%200127:%20CLIs%20as%20the%20Method%20Enforcement%20Primitive.md).
4
+
5
+ Scope is locked in [ADR 0152](https://github.com/tomfosteruk/sdd-method/blob/main/docs/method/adr/ADR%200152:%20Upstream%20Code-CLI%20Core%20Library%20Scope%20and%20API%20Surface.md). The [LIBRARY_SPEC.md](LIBRARY_SPEC.md) in this repo records the v0.1.0 public surface contract per ADR 0152 §6.1.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @sdd-method/cli-core
11
+ ```
12
+
13
+ Adopters consume sub-module exports directly:
14
+
15
+ ```ts
16
+ import { findSddRoot, discoverSddRepos } from "@sdd-method/cli-core";
17
+ import { loadRegistry, renderArchetype } from "@sdd-method/cli-core/archetypes";
18
+ import { jsonContent, getSddClient } from "@sdd-method/cli-core/mcp";
19
+ import { checkManifest, checkArchetypeMetadata } from "@sdd-method/cli-core/validate";
20
+ import { runContractsVerb } from "@sdd-method/cli-core/pins/contracts";
21
+ import { runArtifactsVerb } from "@sdd-method/cli-core/pins/artifacts";
22
+ ```
23
+
24
+ ## v0.1.0 public surface
25
+
26
+ Eight sub-module export groups, per ADR 0152 §4.3:
27
+
28
+ | Sub-module export | Purpose | Anchored in |
29
+ |---|---|---|
30
+ | **root** (`@sdd-method/cli-core`) | Workspace + repo-kind discovery — `findSddRoot`, `discoverSddRepos`, `readRepoKind`, `profileFromRepoKind`, `isRepoKind`, `REPO_KIND_FILE`, types `Profile`, `RepoKind`, `DiscoveredRepo` | ADR 0045 sibling-SDD layout, ADR 0118 profile framework |
31
+ | `./archetypes` | Archetype registry + render primitives + repo-config writer — `loadRegistry`, `filterByProfile`, `findArchetype`, `renderArchetype`, `writeRepoConfigEntry`, types `ArchetypeRegistry`, `ArchetypeDeclaration`, `RenderOptions`, `RenderOutcome`, `RenderVars`, `WriteRepoConfigInputs`, `WriteRepoConfigResult` | ADR 0118 §6 archetype-output compliance |
32
+ | `./stability` | Stability-class surfacing shape — `checkStabilityClass`, types `StabilityContext`, `StabilityCheckResult` | ADR 0118 §4.5, ADR 0127 verb stability semantics |
33
+ | `./pins` (and split sub-paths) | Pin-verb delegation shims — `runContractsVerb`, `runArtifactsVerb`, types `ContractsVerbOptions`, `ContractsVerbResult`, `ArtifactsVerbOptions`, `ArtifactsVerbResult` | ADR 0110 cross-SDD contract pins, ADR 0113 runtime artefact pins |
34
+ | `./mcp` | MCP envelope + lifecycle + sdd-mcp composition client — `jsonContent`, `errorContent`, `dedupeSources`, `getSddClient`, `shutdownSddClient`, `parseSddToolResult`, `runMcpServer`, `McpEnvelopeError`, types `McpErrorEnvelope`, `CompositionResult`, `SddClientOptions`, `ParsedSddToolResult`, `RunMcpServerOptions` | ADR 0130 Adopter MCP Composition Pattern |
35
+ | `./validate` | Manifest + archetype-metadata validators — `checkManifest`, `checkArchetypeMetadata`, types `ManifestCheckIssue`, `ManifestCheckResult`, `ManifestVocabulary`, `ArchetypeMetadataCheckIssue`, `ArchetypeMetadataCheckResult`, `ArchetypeMetadataCheckOptions` | ADR 0143 – ADR 0147 canonical manifest schemas |
36
+
37
+ ## Out of scope for v0.1.0
38
+
39
+ Six surfaces present in adopter reference implementations but explicitly NOT upstream (per ADR 0152 §4.3):
40
+
41
+ - Vocabulary validators (banned-vocabulary, README vocabulary, vocabulary config) — adopter-defined.
42
+ - Tsconfig compliance check — adopter-shaped tsconfig conventions.
43
+ - Eslint `any`-ban check — adopter-shaped lint config.
44
+ - Catalog operations — adopter catalogue portal; `sdd-cli catalogue` covers the method-CLI side.
45
+ - Doctor diagnostics — adopter-shaped environment checks (binary-version, container-runtime, linter, runtime).
46
+ - Telemetry emission — adopter-shaped observability stack.
47
+
48
+ Authentication flow is **candidate for v0.2.0+** pending a second-adopter signal on whether the OIDC/OAuth abstraction generalises (ADR 0152 §4.3).
49
+
50
+ ## Semver discipline
51
+
52
+ Portable-contract semver per [ADR 0141](https://github.com/tomfosteruk/sdd-method/blob/main/docs/method/adr/ADR%200141:%20Agent-Harness-Neutral%20Skills%20and%20Hooks.md). The public surface documented above and in `LIBRARY_SPEC.md` is the source of truth — a change to a documented surface element is MAJOR. Pre-1.0 narrowing via `^0.x.y` per npm convention. v1.0.0 cuts after the surface stabilises across at least two adopters (ADR 0152 §4.4).
53
+
54
+ ## Development
55
+
56
+ ```bash
57
+ npm install
58
+ npm run build # tsc -> dist/
59
+ npm run typecheck # tsc --noEmit
60
+ npm test # build + vitest run
61
+ ```
62
+
63
+ Node ≥ 20 required.
64
+
65
+ ## License
66
+
67
+ [Apache-2.0](LICENSE).
@@ -0,0 +1,5 @@
1
+ export * from "./types.js";
2
+ export { loadRegistry, filterByProfile, findArchetype } from "./registry.js";
3
+ export { renderArchetype, type RenderOptions } from "./render.js";
4
+ export { writeRepoConfigEntry, type WriteRepoConfigInputs, type WriteRepoConfigResult, } from "./repo-config.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/archetypes/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./types.js";
2
+ export { loadRegistry, filterByProfile, findArchetype } from "./registry.js";
3
+ export { renderArchetype } from "./render.js";
4
+ export { writeRepoConfigEntry, } from "./repo-config.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/archetypes/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAsB,MAAM,aAAa,CAAC;AAClE,OAAO,EACL,oBAAoB,GAGrB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Archetype-registry loader and filters. The registry mechanism is
3
+ * upstream-shaped (ADR 0118 §6 archetype-output compliance); the
4
+ * archetype *declarations* themselves are adopter-defined and ship
5
+ * outside this library.
6
+ */
7
+ import type { Profile } from "../repo-kind.js";
8
+ import type { ArchetypeDeclaration, ArchetypeRegistry } from "./types.js";
9
+ export declare function loadRegistry(registryPath: string): Promise<ArchetypeRegistry>;
10
+ export declare function filterByProfile(registry: ArchetypeRegistry, profile: Profile): ArchetypeDeclaration[];
11
+ export declare function findArchetype(registry: ArchetypeRegistry, id: string): ArchetypeDeclaration | undefined;
12
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/archetypes/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAiBpB,wBAAsB,YAAY,CAChC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,iBAAiB,CAAC,CAkB5B;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,OAAO,GACf,oBAAoB,EAAE,CAIxB;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,iBAAiB,EAC3B,EAAE,EAAE,MAAM,GACT,oBAAoB,GAAG,SAAS,CAElC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Archetype-registry loader and filters. The registry mechanism is
3
+ * upstream-shaped (ADR 0118 §6 archetype-output compliance); the
4
+ * archetype *declarations* themselves are adopter-defined and ship
5
+ * outside this library.
6
+ */
7
+ import { readFile } from "node:fs/promises";
8
+ import { dirname, isAbsolute, resolve } from "node:path";
9
+ import { parse as parseYaml } from "yaml";
10
+ export async function loadRegistry(registryPath) {
11
+ const raw = await readFile(registryPath, "utf8");
12
+ const parsed = parseYaml(raw);
13
+ if (!parsed || typeof parsed !== "object") {
14
+ throw new Error(`Registry at ${registryPath} did not parse to an object`);
15
+ }
16
+ const version = typeof parsed.version === "string" ? parsed.version : "0.0.0";
17
+ if (!Array.isArray(parsed.archetypes)) {
18
+ throw new Error(`Registry at ${registryPath} is missing "archetypes" array`);
19
+ }
20
+ const registryDir = dirname(registryPath);
21
+ const archetypes = parsed.archetypes.map((entry, index) => validateArchetype(entry, index, registryDir, registryPath));
22
+ return { version, archetypes };
23
+ }
24
+ export function filterByProfile(registry, profile) {
25
+ return registry.archetypes.filter((archetype) => archetype.applies_to_profile === profile);
26
+ }
27
+ export function findArchetype(registry, id) {
28
+ return registry.archetypes.find((archetype) => archetype.id === id);
29
+ }
30
+ function validateArchetype(raw, index, registryDir, registryPath) {
31
+ const ctx = `archetype[${index}] in ${registryPath}`;
32
+ if (!raw || typeof raw !== "object") {
33
+ throw new Error(`${ctx}: must be an object`);
34
+ }
35
+ const entry = raw;
36
+ const id = requireString(entry.id, `${ctx}.id`);
37
+ const description = requireString(entry.description, `${ctx}.description`);
38
+ const profile = requireProfile(entry.applies_to_profile, `${ctx}.applies_to_profile`);
39
+ const templateSourceRel = requireString(entry.template_source, `${ctx}.template_source`);
40
+ const serviceType = requireString(entry.service_type, `${ctx}.service_type`);
41
+ const requiredVars = requireStringArray(entry.required_vars, `${ctx}.required_vars`);
42
+ const optionalVars = entry.optional_vars === undefined
43
+ ? []
44
+ : requireStringArray(entry.optional_vars, `${ctx}.optional_vars`);
45
+ const absoluteTemplateSource = isAbsolute(templateSourceRel)
46
+ ? templateSourceRel
47
+ : resolve(registryDir, templateSourceRel);
48
+ return {
49
+ id,
50
+ description,
51
+ applies_to_profile: profile,
52
+ template_source: absoluteTemplateSource,
53
+ service_type: serviceType,
54
+ required_vars: requiredVars,
55
+ optional_vars: optionalVars,
56
+ };
57
+ }
58
+ function requireString(value, label) {
59
+ if (typeof value !== "string" || value.length === 0) {
60
+ throw new Error(`${label} must be a non-empty string`);
61
+ }
62
+ return value;
63
+ }
64
+ function requireStringArray(value, label) {
65
+ if (!Array.isArray(value)) {
66
+ throw new Error(`${label} must be an array of strings`);
67
+ }
68
+ return value.map((v, i) => requireString(v, `${label}[${i}]`));
69
+ }
70
+ function requireProfile(value, label) {
71
+ const s = requireString(value, label);
72
+ if (s !== "platform" && s !== "application" && s !== "integration") {
73
+ throw new Error(`${label} must be one of: platform | application | integration (got ${s})`);
74
+ }
75
+ return s;
76
+ }
77
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/archetypes/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAsB1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,YAAoB;IAEpB,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAgB,CAAC;IAE7C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,eAAe,YAAY,6BAA6B,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,eAAe,YAAY,gCAAgC,CAA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1D,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,cAAc,CAAC,KAAc,EAAE,KAAa;IACnD,MAAM,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,UAAU,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,KAAK,aAAa,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,8DAA8D,CAAC,GAAG,CAC3E,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Archetype-render primitives. Materialises a declared archetype's
3
+ * template_source tree into a target directory with `{{var_name}}`
4
+ * substitution from RenderVars. Adopters compose their archetypes
5
+ * against this primitive; the templates themselves ship in the adopter
6
+ * archetype declarations, not in this library.
7
+ */
8
+ import type { ArchetypeDeclaration, RenderOutcome, RenderVars } from "./types.js";
9
+ export interface RenderOptions {
10
+ allowExisting: boolean;
11
+ /**
12
+ * Target-relative paths that MAY be overwritten when they already exist.
13
+ * When `allowExisting` is true, any existing file NOT in this list is
14
+ * preserved (skipped). When `allowExisting` is false this has no effect —
15
+ * render refuses entirely on an occupied directory.
16
+ *
17
+ * Paths are compared by their final on-disk name (the template's `.hbs`
18
+ * suffix is stripped before matching). Use forward slashes.
19
+ */
20
+ overwritePaths?: readonly string[];
21
+ /**
22
+ * Preview mode: compute the intended operations and return them without
23
+ * writing anything. The target directory is not created. Useful for agent
24
+ * workflows that want to confirm a scaffold plan before committing.
25
+ */
26
+ dryRun?: boolean;
27
+ }
28
+ export declare function renderArchetype(archetype: ArchetypeDeclaration, vars: RenderVars, targetDir: string, options: RenderOptions): Promise<RenderOutcome>;
29
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/archetypes/render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAcD,wBAAsB,eAAe,CACnC,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,aAAa,CAAC,CA0DxB"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Archetype-render primitives. Materialises a declared archetype's
3
+ * template_source tree into a target directory with `{{var_name}}`
4
+ * substitution from RenderVars. Adopters compose their archetypes
5
+ * against this primitive; the templates themselves ship in the adopter
6
+ * archetype declarations, not in this library.
7
+ */
8
+ import { access, copyFile, mkdir, readdir, readFile, stat, writeFile, } from "node:fs/promises";
9
+ import { dirname, join, relative } from "node:path";
10
+ const TEMPLATE_EXT = ".hbs";
11
+ const VAR_PATTERN = /\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
12
+ async function fileExists(path) {
13
+ try {
14
+ await access(path);
15
+ return true;
16
+ }
17
+ catch {
18
+ return false;
19
+ }
20
+ }
21
+ export async function renderArchetype(archetype, vars, targetDir, options) {
22
+ validateVars(archetype, vars);
23
+ if (!options.allowExisting && (await targetDirIsOccupied(targetDir))) {
24
+ return {
25
+ status: "refused",
26
+ reason: `Target directory ${targetDir} already exists and is not empty. Pass --allow-existing to render on top of it.`,
27
+ };
28
+ }
29
+ const dryRun = options.dryRun === true;
30
+ const overwritePaths = new Set(options.overwritePaths ?? []);
31
+ const written = [];
32
+ const skipped = [];
33
+ const planned = [];
34
+ if (!dryRun) {
35
+ await mkdir(targetDir, { recursive: true });
36
+ }
37
+ for await (const templateFile of walkFiles(archetype.template_source)) {
38
+ const rel = relative(archetype.template_source, templateFile);
39
+ const outRel = rel.endsWith(TEMPLATE_EXT)
40
+ ? rel.slice(0, -TEMPLATE_EXT.length)
41
+ : rel;
42
+ const outPath = join(targetDir, outRel);
43
+ const normalisedRel = outRel.split("\\").join("/");
44
+ if (options.allowExisting && !overwritePaths.has(normalisedRel)) {
45
+ if (await fileExists(outPath)) {
46
+ skipped.push(outPath);
47
+ continue;
48
+ }
49
+ }
50
+ planned.push(outPath);
51
+ if (dryRun) {
52
+ continue;
53
+ }
54
+ await mkdir(dirname(outPath), { recursive: true });
55
+ if (rel.endsWith(TEMPLATE_EXT)) {
56
+ const raw = await readFile(templateFile, "utf8");
57
+ const rendered = substitute(raw, vars, templateFile);
58
+ await writeFile(outPath, rendered, "utf8");
59
+ }
60
+ else {
61
+ await copyFile(templateFile, outPath);
62
+ }
63
+ written.push(outPath);
64
+ }
65
+ return {
66
+ status: "rendered",
67
+ writtenFiles: written,
68
+ skippedFiles: skipped,
69
+ plannedFiles: planned,
70
+ };
71
+ }
72
+ function validateVars(archetype, vars) {
73
+ const missing = archetype.required_vars.filter((name) => typeof vars[name] !== "string" || vars[name]?.length === 0);
74
+ if (missing.length > 0) {
75
+ throw new Error(`Archetype ${archetype.id} is missing required vars: ${missing.join(", ")}`);
76
+ }
77
+ }
78
+ async function targetDirIsOccupied(dir) {
79
+ try {
80
+ const entries = await readdir(dir);
81
+ return entries.length > 0;
82
+ }
83
+ catch (err) {
84
+ if (err.code === "ENOENT")
85
+ return false;
86
+ throw err;
87
+ }
88
+ }
89
+ async function* walkFiles(dir) {
90
+ const entries = await readdir(dir);
91
+ for (const entry of entries) {
92
+ const full = join(dir, entry);
93
+ const s = await stat(full);
94
+ if (s.isDirectory()) {
95
+ yield* walkFiles(full);
96
+ }
97
+ else {
98
+ yield full;
99
+ }
100
+ }
101
+ }
102
+ function substitute(content, vars, sourcePath) {
103
+ return content.replace(VAR_PATTERN, (match, name) => {
104
+ if (!(name in vars)) {
105
+ throw new Error(`Unknown template variable "${name}" in ${sourcePath}. Provide it via --${name.replace(/_/g, "-")} or an archetype required_vars declaration.`);
106
+ }
107
+ return vars[name] ?? "";
108
+ });
109
+ }
110
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/archetypes/render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA2BpD,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,WAAW,GAAG,yCAAyC,CAAC;AAE9D,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,SAA+B,EAC/B,IAAgB,EAChB,SAAiB,EACjB,OAAsB;IAEtB,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAE9B,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,CAAC,MAAM,mBAAmB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QACrE,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,oBAAoB,SAAS,iFAAiF;SACvH,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,IA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AAE,CAAC;QACtB,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACnE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,SAAS,CAAC,GAAW;IACnC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9B,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACpB,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CACjB,OAAe,EACf,IAAgB,EAChB,UAAkB;IAElB,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAC1D,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,8BAA8B,IAAI,QAAQ,UAAU,sBAAsB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,6CAA6C,CAC/I,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Repo-config entry writer — emits an `orchestration/repo-config/<domain>/<service>.yaml`
3
+ * stub for a newly-scaffolded service per the method-canonical layout from
4
+ * ADR 0106. The scaffolder name + version are parameterised so adopters
5
+ * stamp their own binary identity into the banner.
6
+ */
7
+ export interface WriteRepoConfigInputs {
8
+ sddRoot: string;
9
+ domain: string;
10
+ serviceName: string;
11
+ serviceType: string;
12
+ archetypeId: string;
13
+ repoOrg: string;
14
+ /** If false and the file exists, refuse to write. Default semantics. */
15
+ overwrite: boolean;
16
+ /** Name of the scaffolding tool to stamp into the banner (e.g. the adopter binary name). */
17
+ scaffolderName: string;
18
+ /** Version string to stamp into the banner alongside the scaffolder name. */
19
+ scaffolderVersion: string;
20
+ /** Preview-only mode: compute the intended write path without writing. */
21
+ dryRun?: boolean;
22
+ }
23
+ export interface WriteRepoConfigResult {
24
+ /** `written` when the file was (or would be) created; `skipped` when it already existed and `overwrite` is false; `refused` for hard failures. */
25
+ status: "written" | "skipped" | "refused";
26
+ path: string;
27
+ reason?: string;
28
+ }
29
+ export declare function writeRepoConfigEntry(inputs: WriteRepoConfigInputs): Promise<WriteRepoConfigResult>;
30
+ //# sourceMappingURL=repo-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-config.d.ts","sourceRoot":"","sources":["../../src/archetypes/repo-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAC;IACnB,4FAA4F;IAC5F,cAAc,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,kJAAkJ;IAClJ,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAyChC"}