sysprom 1.24.0 → 1.25.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.
@@ -51,10 +51,15 @@ const updateNodeArgs = z.object({
51
51
  id: z.string().describe("node ID to update"),
52
52
  });
53
53
  const updateNodeOpts = mutationOpts.extend({
54
+ name: z.string().optional().describe("update node name"),
54
55
  description: z.string().optional().describe("update node description"),
55
56
  status: NodeStatus.optional().describe("set lifecycle state to true"),
56
57
  context: z.string().optional().describe("update node context"),
57
58
  rationale: z.string().optional().describe("update node rationale"),
59
+ selected: z
60
+ .string()
61
+ .optional()
62
+ .describe("set selected option on decision nodes"),
58
63
  lifecycle: z
59
64
  .array(z.string())
60
65
  .optional()
@@ -95,12 +100,16 @@ const nodeSubcommand = {
95
100
  process.exit(1);
96
101
  }
97
102
  const fields = {};
103
+ if (opts.name !== undefined)
104
+ fields.name = opts.name;
98
105
  if (opts.description !== undefined)
99
106
  fields.description = opts.description;
100
107
  if (opts.context !== undefined)
101
108
  fields.context = opts.context;
102
109
  if (opts.rationale !== undefined)
103
110
  fields.rationale = opts.rationale;
111
+ if (opts.selected !== undefined)
112
+ fields.selected = opts.selected;
104
113
  const lifecycleArgs = [...(opts.lifecycle ?? [])];
105
114
  if (opts.status !== undefined) {
106
115
  lifecycleArgs.push(`${opts.status}=true`);
@@ -111,7 +120,7 @@ const nodeSubcommand = {
111
120
  }
112
121
  if (Object.keys(fields).length === 0) {
113
122
  console.error("No fields specified to update.");
114
- console.error("Use --description, --status, --context, --rationale, or --lifecycle.");
123
+ console.error("Use --name, --description, --status, --context, --rationale, --selected, or --lifecycle.");
115
124
  process.exit(1);
116
125
  }
117
126
  const newDoc = updateNodeOp({ doc, id: args.id, fields });
@@ -160,11 +160,11 @@ function registerOption(cmd, flagName, field, desc) {
160
160
  opt.makeOptionMandatory(true);
161
161
  cmd.addOption(opt);
162
162
  }
163
- else if (optional) {
164
- cmd.addOption(new Option(`--${flagName} <value>`).hideHelp());
165
- }
166
163
  else {
167
- cmd.addOption(new Option(`--${flagName} <value>`).makeOptionMandatory(true).hideHelp());
164
+ const opt = new Option(`--${flagName} <value>`, desc);
165
+ if (!optional)
166
+ opt.makeOptionMandatory(true);
167
+ cmd.addOption(opt);
168
168
  }
169
169
  }
170
170
  function registerOptions(cmd, optsSchema) {
@@ -118,12 +118,18 @@ export const validateOp = defineOperation({
118
118
  issues.push(`${n.id} (${n.name}): affects domain nodes but has no must_preserve relationship`);
119
119
  }
120
120
  }
121
- // INV13: Decisions must have options and selected
121
+ // INV13: Decisions must have options and selected (if decided)
122
122
  for (const n of input.doc.nodes.filter((n) => n.type === "decision")) {
123
123
  if (!n.options || n.options.length === 0) {
124
124
  issues.push(`${n.id} (${n.name}): decision has no options`);
125
125
  }
126
- if (!n.selected) {
126
+ // Only require selected option if the decision is in a "decided" state
127
+ // Decided states: accepted, implemented, adopted
128
+ // Undecided states allowed: proposed, experimental, deferred
129
+ const isDecided = hasLifecycleState(n, "accepted") ||
130
+ hasLifecycleState(n, "implemented") ||
131
+ hasLifecycleState(n, "adopted");
132
+ if (isDecided && !n.selected) {
127
133
  issues.push(`${n.id} (${n.name}): decision has no selected option`);
128
134
  }
129
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sysprom",
3
- "version": "1.24.0",
3
+ "version": "1.25.1",
4
4
  "description": "SysProM — System Provenance Model CLI and library",
5
5
  "author": "ExaDev",
6
6
  "homepage": "https://exadev.github.io/SysProM",