Skip to content

Commit 55f8dc5

Browse files
committed
feat(cli): add --selected flag to update node command
Fixes issue #16: Decision nodes can now have their selected option set via the CLI using \`sysprom update node <id> --selected <option-id>\`. Previously, users had to edit the JSON file directly to set the selected field on decision nodes. This adds the --selected flag to the update command, consistent with other node fields. Closes #16
1 parent dfe3ad0 commit 55f8dc5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/cli/commands/update.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ const updateNodeOpts = mutationOpts.extend({
6767
status: NodeStatus.optional().describe("set lifecycle state to true"),
6868
context: z.string().optional().describe("update node context"),
6969
rationale: z.string().optional().describe("update node rationale"),
70+
selected: z
71+
.string()
72+
.optional()
73+
.describe("set selected option on decision nodes"),
7074
lifecycle: z
7175
.array(z.string())
7276
.optional()
@@ -117,6 +121,7 @@ const nodeSubcommand: CommandDef = {
117121
if (opts.description !== undefined) fields.description = opts.description;
118122
if (opts.context !== undefined) fields.context = opts.context;
119123
if (opts.rationale !== undefined) fields.rationale = opts.rationale;
124+
if (opts.selected !== undefined) fields.selected = opts.selected;
120125

121126
const lifecycleArgs = [...(opts.lifecycle ?? [])];
122127
if (opts.status !== undefined) {
@@ -130,7 +135,7 @@ const nodeSubcommand: CommandDef = {
130135
if (Object.keys(fields).length === 0) {
131136
console.error("No fields specified to update.");
132137
console.error(
133-
"Use --description, --status, --context, --rationale, or --lifecycle.",
138+
"Use --description, --status, --context, --rationale, --selected, or --lifecycle.",
134139
);
135140
process.exit(1);
136141
}

0 commit comments

Comments
 (0)