xytara 2.6.0 → 2.8.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.
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const {
6
+ createIntegrationRegistrySnapshotFromBundles,
7
+ exportIntegrationSubmissionBundleSet,
8
+ importIntegrationSubmissionBundle,
9
+ summarizeIntegrationPromotionActionPreview,
10
+ summarizeIntegrationPromotionActionSet,
11
+ summarizeIntegrationPromotionActionSetList,
12
+ summarizeIntegrationPromotionReadiness,
13
+ summarizeIntegrationPromotionWorkflow,
14
+ summarizeIntegrationPromotionWorkflowList,
15
+ summarizeIntegrationRegistrySnapshotReview,
16
+ summarizeIntegrationSubmissionBundleReview,
17
+ summarizeIntegrationSubmissionBundleSetReview,
18
+ validateIntegrationSubmissionBundle
19
+ } = require("../integrations/registry");
20
+
21
+ function readJson(filePath) {
22
+ return JSON.parse(fs.readFileSync(filePath, "utf8"));
23
+ }
24
+
25
+ function writeJson(payload) {
26
+ process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
27
+ }
28
+
29
+ function resolveExampleBundle(name) {
30
+ const filename = name === "settlement"
31
+ ? "example-third-party-settlement-registration.submission-bundle.json"
32
+ : name === "identity"
33
+ ? "example-third-party-identity-registration.submission-bundle.json"
34
+ : "example-third-party-registration.submission-bundle.json";
35
+ return path.resolve(__dirname, "..", "adapters", "examples", filename);
36
+ }
37
+
38
+ function importExampleBundles() {
39
+ return [
40
+ importIntegrationSubmissionBundle(readJson(resolveExampleBundle("protocol")), {
41
+ source: "third_party_example",
42
+ protocols: ["mcp"],
43
+ execution_backends: ["mcp"],
44
+ adapter_lanes: ["mcp"],
45
+ task_refs: ["adapter.mcp.invoke"]
46
+ }),
47
+ importIntegrationSubmissionBundle(readJson(resolveExampleBundle("identity")), {
48
+ source: "third_party_example",
49
+ protocols: [],
50
+ execution_backends: ["http", "chain"],
51
+ adapter_lanes: ["http", "chain"],
52
+ task_refs: ["registry.register", "trust.handoff.emit", "trust.handoff.validate"]
53
+ }),
54
+ importIntegrationSubmissionBundle(readJson(resolveExampleBundle("settlement")), {
55
+ source: "third_party_example",
56
+ protocols: [],
57
+ execution_backends: ["chain"],
58
+ adapter_lanes: ["chain"],
59
+ task_refs: ["anchoring.submit"]
60
+ })
61
+ ];
62
+ }
63
+
64
+ function parseArgs(argv) {
65
+ const [command, ...rest] = argv;
66
+ const options = {};
67
+ for (let index = 0; index < rest.length; index += 1) {
68
+ const token = rest[index];
69
+ if (!token.startsWith("--")) continue;
70
+ const key = token.slice(2);
71
+ const next = rest[index + 1];
72
+ if (!next || next.startsWith("--")) {
73
+ options[key] = true;
74
+ continue;
75
+ }
76
+ options[key] = next;
77
+ index += 1;
78
+ }
79
+ return {
80
+ command: command || "",
81
+ options
82
+ };
83
+ }
84
+
85
+ function runValidateBundle(options) {
86
+ const filePath = options.file
87
+ ? path.resolve(process.cwd(), options.file)
88
+ : resolveExampleBundle(options.example === "settlement" ? "settlement" : options.example === "identity" ? "identity" : "protocol");
89
+ const bundle = readJson(filePath);
90
+ const validation = validateIntegrationSubmissionBundle(bundle);
91
+ writeJson({
92
+ ok: validation.ok,
93
+ file: filePath,
94
+ errors: validation.errors
95
+ });
96
+ process.exitCode = validation.ok ? 0 : 1;
97
+ }
98
+
99
+ function runExportBundleSet(options) {
100
+ const payload = exportIntegrationSubmissionBundleSet({
101
+ source: "third_party_example",
102
+ bundled: "false"
103
+ }, options.notes || "generated by registry_cli");
104
+ writeJson(payload);
105
+ }
106
+
107
+ function runExportSnapshot(options) {
108
+ const snapshot = createIntegrationRegistrySnapshotFromBundles(
109
+ importExampleBundles(),
110
+ { source: "third_party_example" },
111
+ { source: "third_party_example" }
112
+ );
113
+ writeJson({
114
+ generated_by: "registry_cli",
115
+ mode: options.mode || "examples",
116
+ snapshot
117
+ });
118
+ }
119
+
120
+ function runReviewBundle(options) {
121
+ const filePath = options.file
122
+ ? path.resolve(process.cwd(), options.file)
123
+ : resolveExampleBundle(options.example === "settlement" ? "settlement" : options.example === "identity" ? "identity" : "protocol");
124
+ const bundle = readJson(filePath);
125
+ writeJson({
126
+ file: filePath,
127
+ review: summarizeIntegrationSubmissionBundleReview(bundle)
128
+ });
129
+ }
130
+
131
+ function runReviewBundleSet(options) {
132
+ const payload = exportIntegrationSubmissionBundleSet({
133
+ source: "third_party_example",
134
+ bundled: "false"
135
+ }, options.notes || "generated by registry_cli");
136
+ writeJson({
137
+ review: summarizeIntegrationSubmissionBundleSetReview(payload)
138
+ });
139
+ }
140
+
141
+ function runReviewSnapshot() {
142
+ const snapshot = createIntegrationRegistrySnapshotFromBundles(
143
+ importExampleBundles(),
144
+ { source: "third_party_example" },
145
+ { source: "third_party_example" }
146
+ );
147
+ writeJson({
148
+ review: summarizeIntegrationRegistrySnapshotReview(snapshot)
149
+ });
150
+ }
151
+
152
+ function runPromotionReadiness(options) {
153
+ const integrationId = options.integration || "partner.protocol.acme_mcp";
154
+ writeJson({
155
+ integration_id: integrationId,
156
+ review: summarizeIntegrationPromotionReadiness(integrationId)
157
+ });
158
+ }
159
+
160
+ function runPromotionWorkflow(options) {
161
+ const integrationId = options.integration || "partner.protocol.acme_mcp";
162
+ writeJson({
163
+ integration_id: integrationId,
164
+ review: summarizeIntegrationPromotionWorkflow(integrationId)
165
+ });
166
+ }
167
+
168
+ function runPromotionWorkflowSummary(options) {
169
+ writeJson({
170
+ review: summarizeIntegrationPromotionWorkflowList({
171
+ source: options.source || "",
172
+ bundled: options.bundled || ""
173
+ })
174
+ });
175
+ }
176
+
177
+ function runPromotionActionPreview(options) {
178
+ writeJson({
179
+ review: summarizeIntegrationPromotionActionPreview({
180
+ integration_id: options.integration || "partner.protocol.acme_mcp",
181
+ action: options.action || "complete_certification"
182
+ })
183
+ });
184
+ }
185
+
186
+ function runPromotionActionSet(options) {
187
+ const integrationId = options.integration || "partner.protocol.acme_mcp";
188
+ writeJson({
189
+ integration_id: integrationId,
190
+ review: summarizeIntegrationPromotionActionSet(integrationId)
191
+ });
192
+ }
193
+
194
+ function runPromotionActionSetSummary(options) {
195
+ writeJson({
196
+ review: summarizeIntegrationPromotionActionSetList({
197
+ source: options.source || "",
198
+ bundled: options.bundled || ""
199
+ })
200
+ });
201
+ }
202
+
203
+ function main() {
204
+ const { command, options } = parseArgs(process.argv.slice(2));
205
+ if (command === "validate-bundle") {
206
+ runValidateBundle(options);
207
+ return;
208
+ }
209
+ if (command === "export-bundle-set") {
210
+ runExportBundleSet(options);
211
+ return;
212
+ }
213
+ if (command === "export-snapshot") {
214
+ runExportSnapshot(options);
215
+ return;
216
+ }
217
+ if (command === "review-bundle") {
218
+ runReviewBundle(options);
219
+ return;
220
+ }
221
+ if (command === "review-bundle-set") {
222
+ runReviewBundleSet(options);
223
+ return;
224
+ }
225
+ if (command === "review-snapshot") {
226
+ runReviewSnapshot();
227
+ return;
228
+ }
229
+ if (command === "promotion-readiness") {
230
+ runPromotionReadiness(options);
231
+ return;
232
+ }
233
+ if (command === "promotion-workflow") {
234
+ runPromotionWorkflow(options);
235
+ return;
236
+ }
237
+ if (command === "promotion-workflow-summary") {
238
+ runPromotionWorkflowSummary(options);
239
+ return;
240
+ }
241
+ if (command === "promotion-action-preview") {
242
+ runPromotionActionPreview(options);
243
+ return;
244
+ }
245
+ if (command === "promotion-action-set") {
246
+ runPromotionActionSet(options);
247
+ return;
248
+ }
249
+ if (command === "promotion-action-set-summary") {
250
+ runPromotionActionSetSummary(options);
251
+ return;
252
+ }
253
+
254
+ writeJson({
255
+ ok: false,
256
+ usage: [
257
+ "node scripts/registry_cli.js validate-bundle [--file <path>] [--example protocol|settlement]",
258
+ "node scripts/registry_cli.js validate-bundle [--file <path>] [--example identity]",
259
+ "node scripts/registry_cli.js export-bundle-set [--notes <text>]",
260
+ "node scripts/registry_cli.js export-snapshot",
261
+ "node scripts/registry_cli.js review-bundle [--file <path>] [--example protocol|identity|settlement]",
262
+ "node scripts/registry_cli.js review-bundle-set [--notes <text>]",
263
+ "node scripts/registry_cli.js review-snapshot",
264
+ "node scripts/registry_cli.js promotion-readiness [--integration <integration_id>]",
265
+ "node scripts/registry_cli.js promotion-workflow [--integration <integration_id>]",
266
+ "node scripts/registry_cli.js promotion-workflow-summary [--source <source>] [--bundled true|false]",
267
+ "node scripts/registry_cli.js promotion-action-preview [--integration <integration_id>] [--action <action>]",
268
+ "node scripts/registry_cli.js promotion-action-set [--integration <integration_id>]",
269
+ "node scripts/registry_cli.js promotion-action-set-summary [--source <source>] [--bundled true|false]"
270
+ ]
271
+ });
272
+ process.exitCode = 1;
273
+ }
274
+
275
+ main();