sysprom 1.26.0 → 1.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli/commands/update.js +82 -2
- package/dist/src/endpoint-types.js +36 -7
- package/dist/src/operations/add-external-reference.d.ts +534 -0
- package/dist/src/operations/add-external-reference.js +45 -0
- package/dist/src/operations/index.d.ts +2 -0
- package/dist/src/operations/index.js +2 -0
- package/dist/src/operations/remove-external-reference.d.ts +519 -0
- package/dist/src/operations/remove-external-reference.js +37 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
import { RelationshipType, NodeStatus } from "../../schema.js";
|
|
3
|
-
import { updateNodeOp, addRelationshipOp, removeRelationshipOp, updateMetadataOp, } from "../../operations/index.js";
|
|
2
|
+
import { RelationshipType, NodeStatus, ExternalReferenceRole, } from "../../schema.js";
|
|
3
|
+
import { updateNodeOp, addRelationshipOp, removeRelationshipOp, updateMetadataOp, addExternalReferenceOp, removeExternalReferenceOp, } from "../../operations/index.js";
|
|
4
4
|
import { mutationOpts, loadDoc, persistDoc } from "../shared.js";
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
// CLI helper functions
|
|
@@ -80,6 +80,25 @@ const metaOpts = mutationOpts.extend({
|
|
|
80
80
|
.array(z.string())
|
|
81
81
|
.describe("metadata field updates (key=value format)"),
|
|
82
82
|
});
|
|
83
|
+
const addRefArgs = z.object({
|
|
84
|
+
id: z.string().describe("node ID to add reference to"),
|
|
85
|
+
});
|
|
86
|
+
const addRefOpts = mutationOpts.extend({
|
|
87
|
+
role: ExternalReferenceRole.describe("reference role"),
|
|
88
|
+
identifier: z
|
|
89
|
+
.string()
|
|
90
|
+
.describe("reference identifier (URI, file path, etc.)"),
|
|
91
|
+
description: z
|
|
92
|
+
.string()
|
|
93
|
+
.optional()
|
|
94
|
+
.describe("optional description of the reference"),
|
|
95
|
+
});
|
|
96
|
+
const removeRefArgs = z.object({
|
|
97
|
+
id: z.string().describe("node ID to remove reference from"),
|
|
98
|
+
});
|
|
99
|
+
const removeRefOpts = mutationOpts.extend({
|
|
100
|
+
identifier: z.string().describe("identifier of the reference to remove"),
|
|
101
|
+
});
|
|
83
102
|
// ---------------------------------------------------------------------------
|
|
84
103
|
// Subcommands
|
|
85
104
|
// ---------------------------------------------------------------------------
|
|
@@ -218,6 +237,65 @@ const metaSubcommand = {
|
|
|
218
237
|
}
|
|
219
238
|
},
|
|
220
239
|
};
|
|
240
|
+
const addRefSubcommand = {
|
|
241
|
+
name: "add-ref",
|
|
242
|
+
description: addExternalReferenceOp.def.description,
|
|
243
|
+
apiLink: addExternalReferenceOp.def.name,
|
|
244
|
+
args: addRefArgs,
|
|
245
|
+
opts: addRefOpts,
|
|
246
|
+
action(rawArgs, rawOpts) {
|
|
247
|
+
const args = addRefArgs.parse(rawArgs);
|
|
248
|
+
const opts = addRefOpts.parse(rawOpts);
|
|
249
|
+
const loaded = loadDoc(opts.path);
|
|
250
|
+
const { doc } = loaded;
|
|
251
|
+
const newDoc = addExternalReferenceOp({
|
|
252
|
+
doc,
|
|
253
|
+
nodeId: args.id,
|
|
254
|
+
role: opts.role,
|
|
255
|
+
identifier: opts.identifier,
|
|
256
|
+
description: opts.description,
|
|
257
|
+
});
|
|
258
|
+
persistDoc(newDoc, loaded, opts);
|
|
259
|
+
if (opts.json) {
|
|
260
|
+
const node = newDoc.nodes.find((n) => n.id === args.id);
|
|
261
|
+
const ref = node?.external_references?.find((r) => r.identifier === opts.identifier);
|
|
262
|
+
console.log(JSON.stringify(ref, null, 2));
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
console.log(`${opts.dryRun ? "[dry-run] Would add" : "Added"} external reference to ${args.id}: ${opts.role} → ${opts.identifier}`);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
const removeRefSubcommand = {
|
|
270
|
+
name: "remove-ref",
|
|
271
|
+
description: removeExternalReferenceOp.def.description,
|
|
272
|
+
apiLink: removeExternalReferenceOp.def.name,
|
|
273
|
+
args: removeRefArgs,
|
|
274
|
+
opts: removeRefOpts,
|
|
275
|
+
action(rawArgs, rawOpts) {
|
|
276
|
+
const args = removeRefArgs.parse(rawArgs);
|
|
277
|
+
const opts = removeRefOpts.parse(rawOpts);
|
|
278
|
+
const loaded = loadDoc(opts.path);
|
|
279
|
+
const { doc } = loaded;
|
|
280
|
+
removeExternalReferenceOp({
|
|
281
|
+
doc,
|
|
282
|
+
nodeId: args.id,
|
|
283
|
+
identifier: opts.identifier,
|
|
284
|
+
});
|
|
285
|
+
const newDoc = removeExternalReferenceOp({
|
|
286
|
+
doc,
|
|
287
|
+
nodeId: args.id,
|
|
288
|
+
identifier: opts.identifier,
|
|
289
|
+
});
|
|
290
|
+
persistDoc(newDoc, loaded, opts);
|
|
291
|
+
if (opts.json) {
|
|
292
|
+
console.log(JSON.stringify({ nodeId: args.id, identifier: opts.identifier }, null, 2));
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
console.log(`${opts.dryRun ? "[dry-run] Would remove" : "Removed"} external reference from ${args.id}: ${opts.identifier}`);
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
};
|
|
221
299
|
// ---------------------------------------------------------------------------
|
|
222
300
|
// Main command
|
|
223
301
|
// ---------------------------------------------------------------------------
|
|
@@ -228,6 +306,8 @@ export const updateCommand = {
|
|
|
228
306
|
nodeSubcommand,
|
|
229
307
|
addRelSubcommand,
|
|
230
308
|
removeRelSubcommand,
|
|
309
|
+
addRefSubcommand,
|
|
310
|
+
removeRefSubcommand,
|
|
231
311
|
metaSubcommand,
|
|
232
312
|
],
|
|
233
313
|
};
|
|
@@ -16,6 +16,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
16
16
|
"realisation",
|
|
17
17
|
"principle",
|
|
18
18
|
"policy",
|
|
19
|
+
"milestone",
|
|
19
20
|
],
|
|
20
21
|
to: [
|
|
21
22
|
"intent",
|
|
@@ -29,13 +30,34 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
29
30
|
},
|
|
30
31
|
// Realises — implementation hierarchy
|
|
31
32
|
realises: {
|
|
32
|
-
from: [
|
|
33
|
-
|
|
33
|
+
from: [
|
|
34
|
+
"capability",
|
|
35
|
+
"element",
|
|
36
|
+
"realisation",
|
|
37
|
+
"artefact",
|
|
38
|
+
"mode",
|
|
39
|
+
"milestone",
|
|
40
|
+
],
|
|
41
|
+
to: [
|
|
42
|
+
"capability",
|
|
43
|
+
"element",
|
|
44
|
+
"realisation",
|
|
45
|
+
"concept",
|
|
46
|
+
"stage",
|
|
47
|
+
"milestone",
|
|
48
|
+
],
|
|
34
49
|
},
|
|
35
50
|
// Implements — operationalisation
|
|
36
51
|
implements: {
|
|
37
|
-
from: ["element", "realisation", "change", "stage"],
|
|
38
|
-
to: [
|
|
52
|
+
from: ["element", "realisation", "change", "stage", "milestone"],
|
|
53
|
+
to: [
|
|
54
|
+
"capability",
|
|
55
|
+
"element",
|
|
56
|
+
"realisation",
|
|
57
|
+
"decision",
|
|
58
|
+
"change",
|
|
59
|
+
"milestone",
|
|
60
|
+
],
|
|
39
61
|
},
|
|
40
62
|
// Depends on — broad dependency across all node types
|
|
41
63
|
depends_on: {
|
|
@@ -53,6 +75,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
53
75
|
"role",
|
|
54
76
|
"gate",
|
|
55
77
|
"mode",
|
|
78
|
+
"milestone",
|
|
56
79
|
"artefact",
|
|
57
80
|
"decision",
|
|
58
81
|
"change",
|
|
@@ -88,12 +111,14 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
88
111
|
"decision",
|
|
89
112
|
"change",
|
|
90
113
|
"invariant",
|
|
114
|
+
"role",
|
|
115
|
+
"milestone",
|
|
91
116
|
],
|
|
92
117
|
to: ["invariant", "principle", "policy", "protocol", "concept"],
|
|
93
118
|
},
|
|
94
119
|
// Affects — broad impact relationships
|
|
95
120
|
affects: {
|
|
96
|
-
from: ["decision", "change", "artefact", "stage"],
|
|
121
|
+
from: ["decision", "change", "artefact", "stage", "milestone"],
|
|
97
122
|
to: [
|
|
98
123
|
"intent",
|
|
99
124
|
"concept",
|
|
@@ -161,6 +186,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
161
186
|
"role",
|
|
162
187
|
"gate",
|
|
163
188
|
"mode",
|
|
189
|
+
"milestone",
|
|
164
190
|
],
|
|
165
191
|
to: [
|
|
166
192
|
"intent",
|
|
@@ -176,6 +202,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
176
202
|
"role",
|
|
177
203
|
"gate",
|
|
178
204
|
"mode",
|
|
205
|
+
"milestone",
|
|
179
206
|
],
|
|
180
207
|
},
|
|
181
208
|
// Governed by — governance relationships
|
|
@@ -191,12 +218,14 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
191
218
|
"change",
|
|
192
219
|
"policy",
|
|
193
220
|
"artefact",
|
|
221
|
+
"role",
|
|
222
|
+
"milestone",
|
|
194
223
|
],
|
|
195
224
|
to: ["policy", "protocol", "role", "principle", "invariant", "concept"],
|
|
196
225
|
},
|
|
197
226
|
// Modifies — mutation and change
|
|
198
227
|
modifies: {
|
|
199
|
-
from: ["change", "stage"],
|
|
228
|
+
from: ["change", "stage", "milestone"],
|
|
200
229
|
to: [
|
|
201
230
|
"intent",
|
|
202
231
|
"concept",
|
|
@@ -208,7 +237,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
208
237
|
},
|
|
209
238
|
// Produces — generation
|
|
210
239
|
produces: {
|
|
211
|
-
from: ["stage", "realisation", "concept", "capability"],
|
|
240
|
+
from: ["stage", "realisation", "concept", "capability", "milestone"],
|
|
212
241
|
to: ["artefact", "concept"],
|
|
213
242
|
},
|
|
214
243
|
};
|