@sdd-method/maintain-cli 0.0.0-stage → 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.
- package/LICENSE +201 -0
- package/NOTICE +17 -0
- package/README.md +6 -2
- package/dist/lib/adr-origin.js +59 -0
- package/dist/lib/agent-harness.js +28 -0
- package/dist/lib/briefing/index.js +13 -0
- package/dist/lib/briefing/render.js +123 -0
- package/dist/lib/briefing/variables.js +92 -0
- package/dist/lib/bundle.js +123 -0
- package/dist/lib/catalogue/aggregate.js +2404 -0
- package/dist/lib/catalogue/aggregation-manifest-loader.js +173 -0
- package/dist/lib/catalogue/application-archetype/expectations.js +119 -0
- package/dist/lib/catalogue/application-archetype/vocabulary.js +177 -0
- package/dist/lib/catalogue/archetype/maps/android.yaml +66 -0
- package/dist/lib/catalogue/archetype/maps/swiftui.yaml +58 -0
- package/dist/lib/catalogue/archetype/maps/uikit.yaml +48 -0
- package/dist/lib/catalogue/archetype/maps/web-generic.yaml +86 -0
- package/dist/lib/catalogue/archetype/openui-archetype-vocabulary.yaml +46 -0
- package/dist/lib/catalogue/archetype/resolver.js +103 -0
- package/dist/lib/catalogue/archetype/wireframe.js +418 -0
- package/dist/lib/catalogue/baseline-check.js +151 -0
- package/dist/lib/catalogue/build.js +1502 -0
- package/dist/lib/catalogue/builders/adr-supersedes.js +103 -0
- package/dist/lib/catalogue/builders/adrs.js +222 -0
- package/dist/lib/catalogue/builders/application-conformance-coverage.js +47 -0
- package/dist/lib/catalogue/builders/application-data-plane-bindings.js +115 -0
- package/dist/lib/catalogue/builders/c4-components.js +229 -0
- package/dist/lib/catalogue/builders/c4-containers.js +240 -0
- package/dist/lib/catalogue/builders/c4-entity-rollups.js +87 -0
- package/dist/lib/catalogue/builders/c4-external-systems.js +194 -0
- package/dist/lib/catalogue/builders/c4-l1-candidates.js +107 -0
- package/dist/lib/catalogue/builders/c4-systems.js +98 -0
- package/dist/lib/catalogue/builders/capabilities.js +488 -0
- package/dist/lib/catalogue/builders/capability-domain-model.js +74 -0
- package/dist/lib/catalogue/builders/capability-edges.js +256 -0
- package/dist/lib/catalogue/builders/capability-spec-walker.js +99 -0
- package/dist/lib/catalogue/builders/capability-spec.js +348 -0
- package/dist/lib/catalogue/builders/container-dependency.js +183 -0
- package/dist/lib/catalogue/builders/contracts.js +402 -0
- package/dist/lib/catalogue/builders/data-items.js +344 -0
- package/dist/lib/catalogue/builders/data-store-mapping.js +113 -0
- package/dist/lib/catalogue/builders/domain-models.js +175 -0
- package/dist/lib/catalogue/builders/domains.js +119 -0
- package/dist/lib/catalogue/builders/edge-label-merge.js +19 -0
- package/dist/lib/catalogue/builders/entities-manifest.js +160 -0
- package/dist/lib/catalogue/builders/entities-mermaid.js +189 -0
- package/dist/lib/catalogue/builders/entity-persistence.js +102 -0
- package/dist/lib/catalogue/builders/entity-slug.js +47 -0
- package/dist/lib/catalogue/builders/event-catalog-walker.js +186 -0
- package/dist/lib/catalogue/builders/event-edges.js +327 -0
- package/dist/lib/catalogue/builders/events.js +168 -0
- package/dist/lib/catalogue/builders/evidence-class.js +43 -0
- package/dist/lib/catalogue/builders/evidence-target-repo.js +67 -0
- package/dist/lib/catalogue/builders/external-system-exemption.js +120 -0
- package/dist/lib/catalogue/builders/feature-contract.js +77 -0
- package/dist/lib/catalogue/builders/feature-domain-model.js +50 -0
- package/dist/lib/catalogue/builders/feature-grounding-walker.js +254 -0
- package/dist/lib/catalogue/builders/feature-grounding.js +391 -0
- package/dist/lib/catalogue/builders/feature-groups.js +63 -0
- package/dist/lib/catalogue/builders/feature-subscription-channels.js +228 -0
- package/dist/lib/catalogue/builders/feature-tree-walker.js +295 -0
- package/dist/lib/catalogue/builders/features.js +300 -0
- package/dist/lib/catalogue/builders/glossary-xref.js +378 -0
- package/dist/lib/catalogue/builders/glossary.js +204 -0
- package/dist/lib/catalogue/builders/implementations.js +214 -0
- package/dist/lib/catalogue/builders/index.js +64 -0
- package/dist/lib/catalogue/builders/integration-components.js +344 -0
- package/dist/lib/catalogue/builders/integrations.js +181 -0
- package/dist/lib/catalogue/builders/persona-c4system.js +149 -0
- package/dist/lib/catalogue/builders/persona-container.js +133 -0
- package/dist/lib/catalogue/builders/persona-journey-edges.js +133 -0
- package/dist/lib/catalogue/builders/personas.js +152 -0
- package/dist/lib/catalogue/builders/product-edges.js +106 -0
- package/dist/lib/catalogue/builders/product-platform-dependencies.js +405 -0
- package/dist/lib/catalogue/builders/products.js +162 -0
- package/dist/lib/catalogue/builders/quality-scores.js +635 -0
- package/dist/lib/catalogue/builders/repo-capability-exemption.js +61 -0
- package/dist/lib/catalogue/builders/repo-dependency.js +127 -0
- package/dist/lib/catalogue/builders/repo-edges.js +340 -0
- package/dist/lib/catalogue/builders/repositories.js +458 -0
- package/dist/lib/catalogue/builders/scaffolds.js +197 -0
- package/dist/lib/catalogue/builders/screen-tree.js +222 -0
- package/dist/lib/catalogue/builders/screens.js +396 -0
- package/dist/lib/catalogue/builders/service-capability-exemption.js +63 -0
- package/dist/lib/catalogue/builders/service-contract-consumes.js +186 -0
- package/dist/lib/catalogue/builders/service-contract.js +74 -0
- package/dist/lib/catalogue/builders/service-entity-tables.js +187 -0
- package/dist/lib/catalogue/builders/services.js +232 -0
- package/dist/lib/catalogue/builders/system-external-dependency.js +115 -0
- package/dist/lib/catalogue/builders/user-journeys.js +253 -0
- package/dist/lib/catalogue/canonical-schema.yaml +4117 -0
- package/dist/lib/catalogue/cli-version.js +10 -0
- package/dist/lib/catalogue/contract-id.js +49 -0
- package/dist/lib/catalogue/contract-path-resolution.js +149 -0
- package/dist/lib/catalogue/coverage-predicates.js +603 -0
- package/dist/lib/catalogue/coverage-render.js +552 -0
- package/dist/lib/catalogue/coverage-run.js +115 -0
- package/dist/lib/catalogue/csv-reader.js +97 -0
- package/dist/lib/catalogue/csv-writer.js +96 -0
- package/dist/lib/catalogue/data-item-coverage.js +142 -0
- package/dist/lib/catalogue/data-plane-coherence.js +77 -0
- package/dist/lib/catalogue/ddl-generator.js +233 -0
- package/dist/lib/catalogue/dedupe-keyed-tables.js +0 -0
- package/dist/lib/catalogue/engine-validator.js +239 -0
- package/dist/lib/catalogue/ext-id.js +76 -0
- package/dist/lib/catalogue/feature-grounding-aliases-loader.js +65 -0
- package/dist/lib/catalogue/feature-repo-zero-resolution-summary.js +31 -0
- package/dist/lib/catalogue/finding-identity.js +183 -0
- package/dist/lib/catalogue/findings.js +46 -0
- package/dist/lib/catalogue/fk-validator.js +136 -0
- package/dist/lib/catalogue/freshness.js +69 -0
- package/dist/lib/catalogue/gate-checks.js +338 -0
- package/dist/lib/catalogue/graph-projection.js +346 -0
- package/dist/lib/catalogue/graph-run.js +64 -0
- package/dist/lib/catalogue/impact-run.js +228 -0
- package/dist/lib/catalogue/manifest-loader.js +435 -0
- package/dist/lib/catalogue/platform-scope.js +7 -0
- package/dist/lib/catalogue/population-checks.js +87 -0
- package/dist/lib/catalogue/relationship-semantics.js +66 -0
- package/dist/lib/catalogue/reverse-product-quality.js +99 -0
- package/dist/lib/catalogue/rubric-coverage-map.yaml +871 -0
- package/dist/lib/catalogue/runway-vocabulary-loader.js +56 -0
- package/dist/lib/catalogue/scaffold-delta.js +261 -0
- package/dist/lib/catalogue/schema-compat.js +52 -0
- package/dist/lib/catalogue/schema-loader.js +87 -0
- package/dist/lib/catalogue/scores-coverage.js +573 -0
- package/dist/lib/catalogue/screen-validation-loader.js +89 -0
- package/dist/lib/catalogue/service-architecture-parser.js +193 -0
- package/dist/lib/catalogue/service-contract-aliases-loader.js +109 -0
- package/dist/lib/catalogue/staleness-verdicts.js +345 -0
- package/dist/lib/catalogue/traceability-loader.js +350 -0
- package/dist/lib/catalogue/validate.js +200 -0
- package/dist/lib/catalogue/version.js +18 -0
- package/dist/lib/ci-binding/index.js +220 -0
- package/dist/lib/ci-binding/module.js +204 -0
- package/dist/lib/conformance/binding.js +70 -0
- package/dist/lib/context-pull/index.js +151 -0
- package/dist/lib/context-pull/resolve.js +70 -0
- package/dist/lib/generate-briefing/index.js +77 -0
- package/dist/lib/hooks-seed/copilot.js +167 -0
- package/dist/lib/hooks-seed/entries.js +47 -0
- package/dist/lib/hooks-seed/index.js +17 -0
- package/dist/lib/hooks-seed/lifecycle-mapping.js +28 -0
- package/dist/lib/hooks-seed/merge.js +128 -0
- package/dist/lib/hooks-seed/types.js +20 -0
- package/dist/lib/init/ci-workflow.js +98 -0
- package/dist/lib/list/discover.js +100 -0
- package/dist/lib/list/format.js +84 -0
- package/dist/lib/list/index.js +16 -0
- package/dist/lib/lock-file.js +437 -0
- package/dist/lib/mcp-seed/entries.js +14 -0
- package/dist/lib/mcp-seed/index.js +28 -0
- package/dist/lib/mcp-seed/merge.js +99 -0
- package/dist/lib/mcp-seed/types.js +13 -0
- package/dist/lib/pack/builder.js +303 -0
- package/dist/lib/pack/index.js +87 -0
- package/dist/lib/pack/leakage.js +144 -0
- package/dist/lib/pack/log.js +18 -0
- package/dist/lib/pack/publish-transform.js +233 -0
- package/dist/lib/pack/reference-closure.js +125 -0
- package/dist/lib/pack/schema.js +121 -0
- package/dist/lib/pack/seed.js +182 -0
- package/dist/lib/pack/validate.js +49 -0
- package/dist/lib/package-version.js +92 -0
- package/dist/lib/repo-kind.js +129 -0
- package/dist/lib/scripts.js +7 -0
- package/dist/lib/snapshot/catalogue-diff.js +219 -0
- package/dist/lib/snapshot/manifest.js +206 -0
- package/dist/lib/sync/adr-transitions.js +250 -0
- package/dist/lib/sync/apply.js +91 -0
- package/dist/lib/sync/briefing-merge.js +90 -0
- package/dist/lib/sync/bundle-cache.js +109 -0
- package/dist/lib/sync/bundle-source.js +61 -0
- package/dist/lib/sync/config.js +72 -0
- package/dist/lib/sync/copilot-hooks-merge.js +108 -0
- package/dist/lib/sync/diff.js +251 -0
- package/dist/lib/sync/index.js +818 -0
- package/dist/lib/sync/settings-merge.js +216 -0
- package/dist/lib/sync/yaml-block-merge.js +120 -0
- package/dist/lib/validate/aggregate.js +51 -0
- package/dist/lib/validate/bundle-coherence.js +74 -0
- package/dist/lib/validate/dispatch.js +243 -0
- package/dist/lib/validate/index.js +110 -0
- package/dist/lib/validate/plan.js +54 -0
- package/dist/lib/validate/runner.js +85 -0
- package/dist/lib/validate/yaml-parse.js +112 -0
- package/dist/maintain-bin.js +8 -0
- package/dist/maintain-program.js +91 -0
- package/dist/maintain-version.json +4 -0
- package/dist/verbs/catalogue-maintain.js +110 -0
- package/dist/verbs/catalogue-verify.js +114 -0
- package/dist/verbs/context.js +39 -0
- package/dist/verbs/generate-briefing.js +29 -0
- package/dist/verbs/list.js +45 -0
- package/dist/verbs/pack-build.js +31 -0
- package/dist/verbs/pack-validate.js +17 -0
- package/dist/verbs/path-option.js +25 -0
- package/dist/verbs/render.js +87 -0
- package/dist/verbs/sync.js +110 -0
- package/dist/verbs/validate.js +48 -0
- package/dist/verify-program.js +122 -0
- package/dist/verify-version.json +4 -0
- package/package.json +32 -4
- package/scripts/validate-app-dependencies.sh +664 -0
- package/scripts/validate-app-docs.sh +199 -0
- package/scripts/validate-integration-docs.sh +505 -0
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-cli
|
|
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
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sdd-method/maintain-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`sdd-maintain` brings an SDD repository current and rebuilds its derived model, and **cannot author specification content** (M-ADR 0218).
|
|
4
|
+
|
|
5
|
+
Verbs: everything in `@sdd-method/verify-cli`, plus `sync`, `generate-briefing`, `context pull`, `catalogue build`, `catalogue aggregate`, `catalogue graph`, `catalogue diff`, `pack build`, `render screen`.
|
|
6
|
+
|
|
7
|
+
Each writes only derived or method-managed content, and two runs on the same commit write the same bytes. Authoring verbs — `init`, `scaffold`, `plan`, `mcp`, `conformance` and the rest — are not present in it, and are in `@sdd-method/sdd-cli`. Invoking one fails with exit 1.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Single source of truth for ADR origin prefixes (M-ADR 0140 §4.1 / M-ADR 0186).
|
|
2
|
+
//
|
|
3
|
+
// The origin prefix is CANONICAL and marks the producer tier — method /
|
|
4
|
+
// reference-architecture / adopter-platform / adopter-domain. It is derived two
|
|
5
|
+
// ways, by design (M-ADR 0186 §4.3):
|
|
6
|
+
// - PRODUCER prefixes are a pure function of the NUMBER band, because
|
|
7
|
+
// `0xxx`/`9xxx` are globally-unique producer namespaces (disjoint ranges).
|
|
8
|
+
// - ADOPTER prefixes (`P-`/`D-`) are a function of SCOPE — where the ADR lives
|
|
9
|
+
// — because adopter numbers are a flat local sequence (`1000–8999`, M-ADR
|
|
10
|
+
// 0140) that does not globally encode platform-vs-domain. A platform ADR is
|
|
11
|
+
// `P-ADR` and a domain ADR is `D-ADR` at whatever number it holds.
|
|
12
|
+
//
|
|
13
|
+
// Every ADR detection/parse point resolves by NUMBER and treats the prefix as an
|
|
14
|
+
// interchangeable origin marker, so a bare `ADR NNNN` (legacy / unmigrated /
|
|
15
|
+
// human) and any prefixed form map to the same `ADR-NNNN` identity during the
|
|
16
|
+
// dual-resolution window. Adding a future tier is a one-line change here.
|
|
17
|
+
/**
|
|
18
|
+
* The producer origin prefix for an ADR number, by globally-unique band:
|
|
19
|
+
* `0000–0999` → `M-ADR` (method)
|
|
20
|
+
* `9000–9999` → `RA-ADR` (reference architecture)
|
|
21
|
+
* Adopter numbers (`1000–8999`) are NOT number-derivable — their prefix depends
|
|
22
|
+
* on scope; see `originPrefixForPath`. Returns `null` for them.
|
|
23
|
+
*/
|
|
24
|
+
export function originPrefixForNumber(num) {
|
|
25
|
+
if (/^0\d{3}$/.test(num))
|
|
26
|
+
return "M-ADR";
|
|
27
|
+
if (/^9\d{3}$/.test(num))
|
|
28
|
+
return "RA-ADR";
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The canonical origin prefix for an ADR at a repo-relative path (M-ADR 0186):
|
|
33
|
+
* producer ADRs by number band; adopter ADRs by SCOPE (directory) — a domain
|
|
34
|
+
* ADR (`docs/domains/<d>/…/adr/`) is `D-ADR`, a platform ADR (`docs/platform/adr/`)
|
|
35
|
+
* is `P-ADR`. `docs/method/platform-adr/` holds method (`0xxx`) ADRs, resolved by
|
|
36
|
+
* number to `M-ADR` before the scope check. Returns `null` if undeterminable.
|
|
37
|
+
*/
|
|
38
|
+
export function originPrefixForPath(relPath, num) {
|
|
39
|
+
const byNum = originPrefixForNumber(num);
|
|
40
|
+
if (byNum)
|
|
41
|
+
return byNum;
|
|
42
|
+
if (/\/domains\/[^/]+\/(?:.*\/)?adr\//.test(relPath))
|
|
43
|
+
return "D-ADR";
|
|
44
|
+
if (/\/platform\/adr\//.test(relPath))
|
|
45
|
+
return "P-ADR";
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Regex source matching the optional origin prefix that precedes `ADR` in a
|
|
50
|
+
* filename, heading, or reference — `M-`, `RA-`, `P-`, `D-`, or none (a bare or
|
|
51
|
+
* not-yet-migrated identifier). Non-capturing, so composing it does not shift a
|
|
52
|
+
* caller's group indices.
|
|
53
|
+
*/
|
|
54
|
+
export const ORIGIN_PREFIX_SRC = "(?:M-|RA-|P-|D-)?";
|
|
55
|
+
/** Strip a leading origin prefix (`M-ADR 0044` → `ADR 0044`); a bare id is returned unchanged. */
|
|
56
|
+
export function stripOriginPrefix(id) {
|
|
57
|
+
return id.replace(/^(?:M-|RA-|P-|D-)(?=ADR\b)/i, "");
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=adr-origin.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-harness identifiers — the value space of `--agent-harness` on
|
|
3
|
+
* `sdd-cli init` and `sdd-cli sync` per ADR 0141 §4.6.
|
|
4
|
+
*
|
|
5
|
+
* Claude Code is the reference implementation per ADR 0141 §4.4 and
|
|
6
|
+
* the default. GitHub Copilot CLI is the second reference per
|
|
7
|
+
* `docs/method/methods/hook-contracts.md`. Adopters using a different
|
|
8
|
+
* harness implement the portable contracts themselves per ADR 0141 §4.5.
|
|
9
|
+
*/
|
|
10
|
+
export const AGENT_HARNESSES = ["claude-code", "github-copilot-cli"];
|
|
11
|
+
export const DEFAULT_AGENT_HARNESS = "claude-code";
|
|
12
|
+
export function isAgentHarness(value) {
|
|
13
|
+
return AGENT_HARNESSES.includes(value);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve an optional CLI input to a concrete harness, falling back to
|
|
17
|
+
* the reference default when unset. Throws on an unsupported value so
|
|
18
|
+
* the CLI can surface a clear error to the caller.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveAgentHarness(input) {
|
|
21
|
+
if (input === undefined)
|
|
22
|
+
return DEFAULT_AGENT_HARNESS;
|
|
23
|
+
if (!isAgentHarness(input)) {
|
|
24
|
+
throw new Error(`Unsupported --agent-harness "${input}". Supported: ${AGENT_HARNESSES.join(", ")}.`);
|
|
25
|
+
}
|
|
26
|
+
return input;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=agent-harness.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public facade for the briefing layer (ADR 0148).
|
|
3
|
+
*
|
|
4
|
+
* `agent-instructions.md` is the harness-neutral canonical briefing
|
|
5
|
+
* (fully method-managed; sync overwrites unconditionally). Harness
|
|
6
|
+
* wrappers (`CLAUDE.md`, `AGENTS.md`, …) are thin pointers with a
|
|
7
|
+
* `<!-- method-managed: begin/end -->` block at the top; adopter
|
|
8
|
+
* content below survives sync via the existing `writeMarkedBlockFile`
|
|
9
|
+
* machinery.
|
|
10
|
+
*/
|
|
11
|
+
export { AGENT_INSTRUCTIONS_REL_PATH, BRIEFING_TEMPLATE_ROOT, WRAPPER_BLOCK_BEGIN, WRAPPER_BLOCK_END, extractWrapperBlock, findUnresolvedPlaceholders, harnessWrapperOutputPath, renderAgentInstructions, renderHarnessWrapper, splitWrapperTemplate, substitute, } from "./render.js";
|
|
12
|
+
export { resolveBriefingVariables } from "./variables.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renderer for the briefing-layer templates per ADR 0148 + Phase 4 of
|
|
3
|
+
* `adopt-agent-instructions-briefing-layer.md`.
|
|
4
|
+
*
|
|
5
|
+
* Templates ship via the method baseline bundle and land at
|
|
6
|
+
* `<target>/orchestration/templates/briefing/...` after sync's
|
|
7
|
+
* `copyManagedFiles` step. Both `sdd-cli init` and `sdd-cli sync` read
|
|
8
|
+
* the on-disk templates and substitute the four canonical variables.
|
|
9
|
+
*
|
|
10
|
+
* Substitution is a deliberate Handlebars *subset* — `{{var}}` only,
|
|
11
|
+
* no helpers / conditionals / partials. Keeps the runtime-dep
|
|
12
|
+
* allowlist clean (no Handlebars package) and matches the template
|
|
13
|
+
* shapes shipped upstream.
|
|
14
|
+
*/
|
|
15
|
+
import { access, readFile } from "node:fs/promises";
|
|
16
|
+
import { join } from "node:path";
|
|
17
|
+
export const BRIEFING_TEMPLATE_ROOT = "orchestration/templates/briefing";
|
|
18
|
+
export const AGENT_INSTRUCTIONS_REL_PATH = "agent-instructions.md";
|
|
19
|
+
const HARNESS_WRAPPER_TEMPLATE = {
|
|
20
|
+
"claude-code": {
|
|
21
|
+
templateRel: "claude-code/CLAUDE.md.hbs",
|
|
22
|
+
outputRel: "CLAUDE.md",
|
|
23
|
+
},
|
|
24
|
+
"github-copilot-cli": {
|
|
25
|
+
templateRel: "github-copilot-cli/AGENTS.md.hbs",
|
|
26
|
+
outputRel: "AGENTS.md",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/** Output filename per harness — e.g. `CLAUDE.md` or `AGENTS.md`. */
|
|
30
|
+
export function harnessWrapperOutputPath(harness) {
|
|
31
|
+
return HARNESS_WRAPPER_TEMPLATE[harness].outputRel;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Marker pair the wrapper templates use to delimit the method-managed
|
|
35
|
+
* region. The wrapper sync path slices this region out of the freshly
|
|
36
|
+
* rendered template and hands it to `writeMarkedBlockFile`.
|
|
37
|
+
*/
|
|
38
|
+
export const WRAPPER_BLOCK_BEGIN = "<!-- method-managed: begin -->";
|
|
39
|
+
export const WRAPPER_BLOCK_END = "<!-- method-managed: end -->";
|
|
40
|
+
/**
|
|
41
|
+
* Substitute the four canonical variables into a template string. Any
|
|
42
|
+
* `{{var}}` placeholder whose name is not in the variable set is left
|
|
43
|
+
* verbatim — callers may pre-check for leftovers if strict rendering
|
|
44
|
+
* is desired.
|
|
45
|
+
*/
|
|
46
|
+
export function substitute(template, vars) {
|
|
47
|
+
const map = {
|
|
48
|
+
sdd_name: vars.sdd_name,
|
|
49
|
+
repo_kind: vars.repo_kind,
|
|
50
|
+
baseline_version: vars.baseline_version,
|
|
51
|
+
sync_date: vars.sync_date,
|
|
52
|
+
};
|
|
53
|
+
return template.replace(/\{\{\s*([a-z_][a-z0-9_]*)\s*\}\}/g, (full, key) => {
|
|
54
|
+
return key in map ? map[key] : full;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Find any unresolved `{{var}}` placeholders. Returns the set of
|
|
59
|
+
* placeholder names (de-duplicated). Callers use this to decide
|
|
60
|
+
* whether to warn or hard-fail on a stale template.
|
|
61
|
+
*/
|
|
62
|
+
export function findUnresolvedPlaceholders(rendered) {
|
|
63
|
+
const found = new Set();
|
|
64
|
+
for (const m of rendered.matchAll(/\{\{\s*([a-z_][a-z0-9_]*)\s*\}\}/g)) {
|
|
65
|
+
found.add(m[1]);
|
|
66
|
+
}
|
|
67
|
+
return [...found];
|
|
68
|
+
}
|
|
69
|
+
export async function renderAgentInstructions(targetRepo, vars) {
|
|
70
|
+
const templatePath = join(targetRepo, BRIEFING_TEMPLATE_ROOT, "agent-instructions.md.hbs");
|
|
71
|
+
return renderFromPath(templatePath, vars);
|
|
72
|
+
}
|
|
73
|
+
export async function renderHarnessWrapper(targetRepo, harness, vars) {
|
|
74
|
+
const { templateRel } = HARNESS_WRAPPER_TEMPLATE[harness];
|
|
75
|
+
const templatePath = join(targetRepo, BRIEFING_TEMPLATE_ROOT, templateRel);
|
|
76
|
+
return renderFromPath(templatePath, vars);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Split a fully-rendered wrapper template at the method-managed
|
|
80
|
+
* markers. The sync flow merges `block` into the existing wrapper and
|
|
81
|
+
* uses `pre`/`post` as scaffold-fill for blank regions around it.
|
|
82
|
+
*
|
|
83
|
+
* Throws when the markers aren't both found — that's a template-
|
|
84
|
+
* authoring bug, not an adopter-side issue.
|
|
85
|
+
*/
|
|
86
|
+
export function splitWrapperTemplate(rendered) {
|
|
87
|
+
const beginIdx = rendered.indexOf(WRAPPER_BLOCK_BEGIN);
|
|
88
|
+
const endIdx = rendered.indexOf(WRAPPER_BLOCK_END, beginIdx);
|
|
89
|
+
if (beginIdx === -1 || endIdx === -1) {
|
|
90
|
+
throw new Error("Wrapper template missing method-managed markers: " +
|
|
91
|
+
`expected ${WRAPPER_BLOCK_BEGIN} ... ${WRAPPER_BLOCK_END} (template-authoring bug)`);
|
|
92
|
+
}
|
|
93
|
+
const blockEnd = endIdx + WRAPPER_BLOCK_END.length;
|
|
94
|
+
return {
|
|
95
|
+
pre: rendered.slice(0, beginIdx),
|
|
96
|
+
block: rendered.slice(beginIdx, blockEnd),
|
|
97
|
+
post: rendered.slice(blockEnd),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Extract the method-managed slice (begin marker through end marker,
|
|
102
|
+
* inclusive) from a fully-rendered wrapper template.
|
|
103
|
+
*/
|
|
104
|
+
export function extractWrapperBlock(rendered) {
|
|
105
|
+
return splitWrapperTemplate(rendered).block;
|
|
106
|
+
}
|
|
107
|
+
async function renderFromPath(templatePath, vars) {
|
|
108
|
+
if (!(await fileExists(templatePath)))
|
|
109
|
+
return null;
|
|
110
|
+
const raw = await readFile(templatePath, "utf8");
|
|
111
|
+
const content = substitute(raw, vars);
|
|
112
|
+
return { content, unresolved: findUnresolvedPlaceholders(content) };
|
|
113
|
+
}
|
|
114
|
+
async function fileExists(path) {
|
|
115
|
+
try {
|
|
116
|
+
await access(path);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variable resolution for the briefing layer per ADR 0148 §4.1 + the
|
|
3
|
+
* Phase 4 setup notes in `adopt-agent-instructions-briefing-layer.md`.
|
|
4
|
+
*
|
|
5
|
+
* The four variables are sourced from target-repo state:
|
|
6
|
+
*
|
|
7
|
+
* sdd_name basename(targetRepo) — overridden by
|
|
8
|
+
* `.sdd/sdd-manifest.yaml::sdd_id` when present.
|
|
9
|
+
* repo_kind `.sdd-repo-kind` content (platform-product /
|
|
10
|
+
* application-product / integration-product /
|
|
11
|
+
* reverse-corpus).
|
|
12
|
+
* baseline_version forward-base bundle's `bundle_version` from
|
|
13
|
+
* `method-baseline.lock`.
|
|
14
|
+
* sync_date caller-supplied ISO date (today for init/sync).
|
|
15
|
+
*
|
|
16
|
+
* No new YAML parser added — the manifest is a single optional scalar
|
|
17
|
+
* read; existing scalar-line parser in src/lib/bundle.ts is the
|
|
18
|
+
* precedent for this style.
|
|
19
|
+
*/
|
|
20
|
+
import { access, readFile } from "node:fs/promises";
|
|
21
|
+
import { basename, join } from "node:path";
|
|
22
|
+
import { readLockFile } from "../lock-file.js";
|
|
23
|
+
import { readRepoKind } from "../repo-kind.js";
|
|
24
|
+
export async function resolveBriefingVariables(opts) {
|
|
25
|
+
const sdd_name = await resolveSddName(opts.targetRepo);
|
|
26
|
+
const repo_kind = opts.repoKindOverride ?? (await requireRepoKind(opts.targetRepo));
|
|
27
|
+
const baseline_version = opts.baselineVersionOverride ??
|
|
28
|
+
(await resolveBaselineVersion(opts.targetRepo));
|
|
29
|
+
const sync_date = opts.syncDate ?? todayIso();
|
|
30
|
+
return { sdd_name, repo_kind, baseline_version, sync_date };
|
|
31
|
+
}
|
|
32
|
+
async function resolveSddName(targetRepo) {
|
|
33
|
+
const fromManifest = await tryReadSddManifestId(targetRepo);
|
|
34
|
+
if (fromManifest !== null)
|
|
35
|
+
return fromManifest;
|
|
36
|
+
return basename(targetRepo);
|
|
37
|
+
}
|
|
38
|
+
async function tryReadSddManifestId(targetRepo) {
|
|
39
|
+
const path = join(targetRepo, ".sdd", "sdd-manifest.yaml");
|
|
40
|
+
if (!(await fileExists(path)))
|
|
41
|
+
return null;
|
|
42
|
+
let raw;
|
|
43
|
+
try {
|
|
44
|
+
raw = await readFile(path, "utf8");
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
// Single-scalar line parse, matching bundle.ts style. The catalogue
|
|
50
|
+
// surface uses a full YAML loader elsewhere; here we only want one
|
|
51
|
+
// optional field, so this stays dependency-light.
|
|
52
|
+
for (const line of raw.split("\n")) {
|
|
53
|
+
const m = /^sdd_id: (.+)$/.exec(line.trim());
|
|
54
|
+
if (m) {
|
|
55
|
+
const value = m[1].trim().replace(/^["']|["']$/g, "");
|
|
56
|
+
if (value.length > 0)
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
async function requireRepoKind(targetRepo) {
|
|
63
|
+
const kind = await readRepoKind(targetRepo);
|
|
64
|
+
if (!kind) {
|
|
65
|
+
throw new Error(`Cannot resolve briefing variables: .sdd-repo-kind missing at ${targetRepo}`);
|
|
66
|
+
}
|
|
67
|
+
return kind;
|
|
68
|
+
}
|
|
69
|
+
async function resolveBaselineVersion(targetRepo) {
|
|
70
|
+
const lock = await readLockFile(targetRepo);
|
|
71
|
+
if (!lock) {
|
|
72
|
+
throw new Error(`Cannot resolve baseline_version: method-baseline.lock missing at ${targetRepo}`);
|
|
73
|
+
}
|
|
74
|
+
const forwardBase = lock.bundles.find((b) => b.isForwardBase);
|
|
75
|
+
if (!forwardBase) {
|
|
76
|
+
throw new Error(`Cannot resolve baseline_version: no forward-base bundle in method-baseline.lock at ${targetRepo}`);
|
|
77
|
+
}
|
|
78
|
+
return forwardBase.bundleVersion;
|
|
79
|
+
}
|
|
80
|
+
function todayIso() {
|
|
81
|
+
return new Date().toISOString().slice(0, 10);
|
|
82
|
+
}
|
|
83
|
+
async function fileExists(path) {
|
|
84
|
+
try {
|
|
85
|
+
await access(path);
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=variables.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { execFile as execFileCb } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readFile, readdir, rm } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { parse as parseYaml } from "yaml";
|
|
7
|
+
import { isBundleName, isForwardBase } from "./repo-kind.js";
|
|
8
|
+
const execFile = promisify(execFileCb);
|
|
9
|
+
export const MANIFEST_FILE = "BUNDLE_MANIFEST.yaml";
|
|
10
|
+
export const MANAGED_PATHS_FILE = "MANAGED_PATHS.txt";
|
|
11
|
+
export const PAYLOAD_DIR = "payload";
|
|
12
|
+
export async function loadBundle(bundlePath) {
|
|
13
|
+
const extractionDir = await mkdtemp(join(tmpdir(), "sdd-cli-bundle-"));
|
|
14
|
+
let rootDir;
|
|
15
|
+
try {
|
|
16
|
+
await execFile("tar", ["-xzf", bundlePath, "-C", extractionDir]);
|
|
17
|
+
rootDir = await findBundleRoot(extractionDir);
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
await rm(extractionDir, { recursive: true, force: true });
|
|
21
|
+
throw err;
|
|
22
|
+
}
|
|
23
|
+
const manifestPath = join(rootDir, MANIFEST_FILE);
|
|
24
|
+
const managedPathsPath = join(rootDir, MANAGED_PATHS_FILE);
|
|
25
|
+
const payloadDir = join(rootDir, PAYLOAD_DIR);
|
|
26
|
+
const manifestRaw = await readFile(manifestPath, "utf8");
|
|
27
|
+
const manifest = parseManifest(manifestRaw);
|
|
28
|
+
const managedPathsRaw = await readFile(managedPathsPath, "utf8");
|
|
29
|
+
const managedPaths = parseManagedPaths(managedPathsRaw);
|
|
30
|
+
return {
|
|
31
|
+
manifest,
|
|
32
|
+
managedPaths,
|
|
33
|
+
rootDir,
|
|
34
|
+
payloadDir,
|
|
35
|
+
cleanup: () => rm(extractionDir, { recursive: true, force: true }),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function findBundleRoot(extractionDir) {
|
|
39
|
+
const entries = await readdir(extractionDir, { withFileTypes: true });
|
|
40
|
+
const dirs = entries.filter((e) => e.isDirectory());
|
|
41
|
+
if (dirs.length !== 1) {
|
|
42
|
+
throw new Error(`Expected exactly one top-level directory in bundle; found ${dirs.length}`);
|
|
43
|
+
}
|
|
44
|
+
return join(extractionDir, dirs[0].name);
|
|
45
|
+
}
|
|
46
|
+
export function parseManifest(raw) {
|
|
47
|
+
const parsed = parseYaml(raw);
|
|
48
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
49
|
+
throw new Error("BUNDLE_MANIFEST.yaml is not a YAML object");
|
|
50
|
+
}
|
|
51
|
+
const bundleName = asStringOrUndefined(parsed.bundle_name);
|
|
52
|
+
const bundleVersion = asStringOrUndefined(parsed.bundle_version);
|
|
53
|
+
const sourceCommit = asStringOrUndefined(parsed.source_commit);
|
|
54
|
+
if (!bundleName || !bundleVersion || sourceCommit === undefined) {
|
|
55
|
+
throw new Error(`BUNDLE_MANIFEST.yaml missing required keys (bundle_name, bundle_version, source_commit)`);
|
|
56
|
+
}
|
|
57
|
+
// Backward-compatible default: sdd-method bundles omit is_forward_base
|
|
58
|
+
// in their manifest; if absent, infer from the forward-base set. This
|
|
59
|
+
// MUST use isForwardBase (not isBundleName) — additive bundles like
|
|
60
|
+
// reverse-extension-baseline are known bundle names but are NOT forward
|
|
61
|
+
// bases, and inferring them as forward bases makes sync demand a profile
|
|
62
|
+
// mapping they don't have ("Forward-base bundle ... has no profile mapping").
|
|
63
|
+
const isForwardBaseRaw = parsed.is_forward_base === undefined ? null : Boolean(parsed.is_forward_base);
|
|
64
|
+
const isForwardBaseInferred = isForwardBaseRaw === null ? isForwardBase(bundleName) : isForwardBaseRaw;
|
|
65
|
+
// Forward bases must use a known bundle name; adopter packs may use
|
|
66
|
+
// any string. This enforces the closed enum where it matters and
|
|
67
|
+
// opens it where ADR 0151 requires.
|
|
68
|
+
if (isForwardBaseInferred && !isBundleName(bundleName)) {
|
|
69
|
+
throw new Error(`Unknown bundle_name in manifest for forward base: ${JSON.stringify(bundleName)}`);
|
|
70
|
+
}
|
|
71
|
+
const manifest = {
|
|
72
|
+
bundleName,
|
|
73
|
+
bundleVersion,
|
|
74
|
+
sourceCommit,
|
|
75
|
+
isForwardBase: isForwardBaseInferred,
|
|
76
|
+
};
|
|
77
|
+
const minVer = asStringOrUndefined(parsed.minimum_sdd_cli_version);
|
|
78
|
+
if (minVer)
|
|
79
|
+
manifest.minimumSddCliVersion = minVer;
|
|
80
|
+
if (parsed.requires_forward_base) {
|
|
81
|
+
const fb = parsed.requires_forward_base;
|
|
82
|
+
const bundle = asStringOrUndefined(fb.bundle);
|
|
83
|
+
const minimumVersion = asStringOrUndefined(fb.minimum_version);
|
|
84
|
+
const sourceRepo = asStringOrUndefined(fb.source_repo) ?? "sdd-method";
|
|
85
|
+
if (bundle && minimumVersion) {
|
|
86
|
+
manifest.requiresForwardBase = { bundle, minimumVersion, sourceRepo };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (parsed.requires_pack) {
|
|
90
|
+
const rp = parsed.requires_pack;
|
|
91
|
+
const name = asStringOrUndefined(rp.name);
|
|
92
|
+
const version = asStringOrUndefined(rp.version);
|
|
93
|
+
if (name && version) {
|
|
94
|
+
manifest.requiresPack = { name, version };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const producer = asStringOrUndefined(parsed.produced_by_adopter);
|
|
98
|
+
if (producer)
|
|
99
|
+
manifest.producedByAdopter = producer;
|
|
100
|
+
const scope = asStringOrUndefined(parsed.scope);
|
|
101
|
+
if (scope)
|
|
102
|
+
manifest.scope = scope;
|
|
103
|
+
if (Array.isArray(parsed.scaffold_source_paths)) {
|
|
104
|
+
const ssp = parsed.scaffold_source_paths.filter((e) => typeof e === "string" && e.length > 0);
|
|
105
|
+
if (ssp.length > 0)
|
|
106
|
+
manifest.scaffoldSourcePaths = ssp;
|
|
107
|
+
}
|
|
108
|
+
return manifest;
|
|
109
|
+
}
|
|
110
|
+
export function parseManagedPaths(raw) {
|
|
111
|
+
return raw
|
|
112
|
+
.split("\n")
|
|
113
|
+
.map((line) => line.trim())
|
|
114
|
+
.filter((line) => line.length > 0);
|
|
115
|
+
}
|
|
116
|
+
function asStringOrUndefined(value) {
|
|
117
|
+
if (typeof value !== "string")
|
|
118
|
+
return undefined;
|
|
119
|
+
if (value.length === 0)
|
|
120
|
+
return undefined;
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=bundle.js.map
|