sysprom 1.25.1 → 1.27.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/dist/src/cli/commands/query.js +22 -1
- package/dist/src/cli/commands/update.js +82 -2
- package/dist/src/endpoint-types.js +3 -0
- 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 +3 -0
- package/dist/src/operations/index.js +3 -0
- package/dist/src/operations/query-relationship-types.d.ts +145 -0
- package/dist/src/operations/query-relationship-types.js +29 -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
|
@@ -2,7 +2,7 @@ import pc from "picocolors";
|
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { textToString } from "../../text.js";
|
|
4
4
|
import { readOpts, loadDoc } from "../shared.js";
|
|
5
|
-
import { queryNodesOp, queryNodeOp, queryRelationshipsOp, traceFromNodeOp, timelineOp, nodeHistoryOp, stateAtOp, } from "../../operations/index.js";
|
|
5
|
+
import { queryNodesOp, queryNodeOp, queryRelationshipsOp, queryRelationshipTypesOp, traceFromNodeOp, timelineOp, nodeHistoryOp, stateAtOp, } from "../../operations/index.js";
|
|
6
6
|
import { NodeType, NodeStatus } from "../../schema.js";
|
|
7
7
|
import { primaryLifecycleState } from "../../lifecycle-state.js";
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
@@ -211,6 +211,26 @@ const timelineSubcommand = {
|
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
213
|
};
|
|
214
|
+
const relationshipTypesSubcommand = {
|
|
215
|
+
name: "relationship-types",
|
|
216
|
+
description: queryRelationshipTypesOp.def.description,
|
|
217
|
+
apiLink: queryRelationshipTypesOp.def.name,
|
|
218
|
+
opts: readOpts,
|
|
219
|
+
action(_rawArgs, rawOpts) {
|
|
220
|
+
const opts = readOpts.parse(rawOpts);
|
|
221
|
+
const relTypes = queryRelationshipTypesOp({});
|
|
222
|
+
if (opts.json) {
|
|
223
|
+
console.log(JSON.stringify(relTypes, null, 2));
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
for (const relType of relTypes) {
|
|
227
|
+
console.log(pc.bold(relType.type));
|
|
228
|
+
console.log(` ${pc.dim("from")}: ${relType.from.map((t) => pc.cyan(t)).join(", ")}`);
|
|
229
|
+
console.log(` ${pc.dim("to")}: ${relType.to.map((t) => pc.cyan(t)).join(", ")}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
};
|
|
214
234
|
const stateAtSubcommand = {
|
|
215
235
|
name: "state-at",
|
|
216
236
|
description: stateAtOp.def.description,
|
|
@@ -247,6 +267,7 @@ export const queryCommand = {
|
|
|
247
267
|
nodesSubcommand,
|
|
248
268
|
nodeSubcommand,
|
|
249
269
|
relsSubcommand,
|
|
270
|
+
relationshipTypesSubcommand,
|
|
250
271
|
traceSubcommand,
|
|
251
272
|
timelineSubcommand,
|
|
252
273
|
stateAtSubcommand,
|
|
@@ -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
|
};
|
|
@@ -53,6 +53,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
53
53
|
"role",
|
|
54
54
|
"gate",
|
|
55
55
|
"mode",
|
|
56
|
+
"milestone",
|
|
56
57
|
"artefact",
|
|
57
58
|
"decision",
|
|
58
59
|
"change",
|
|
@@ -88,6 +89,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
88
89
|
"decision",
|
|
89
90
|
"change",
|
|
90
91
|
"invariant",
|
|
92
|
+
"role",
|
|
91
93
|
],
|
|
92
94
|
to: ["invariant", "principle", "policy", "protocol", "concept"],
|
|
93
95
|
},
|
|
@@ -191,6 +193,7 @@ export const RELATIONSHIP_ENDPOINT_TYPES = {
|
|
|
191
193
|
"change",
|
|
192
194
|
"policy",
|
|
193
195
|
"artefact",
|
|
196
|
+
"role",
|
|
194
197
|
],
|
|
195
198
|
to: ["policy", "protocol", "role", "principle", "invariant", "concept"],
|
|
196
199
|
},
|