@cargo-ai/cli 1.0.11 → 1.0.12

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.
@@ -1 +1 @@
1
- {"version":3,"file":"play.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/play.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA6J7E"}
1
+ {"version":3,"file":"play.d.ts","sourceRoot":"","sources":["../../../src/commands/orchestration/play.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGxC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,IAAI,CA0R7E"}
@@ -1,4 +1,4 @@
1
- import { handleApiCall, outputJson } from "../runHandler.js";
1
+ import { handleApiCall, outputJson, parseJson } from "../runHandler.js";
2
2
  export function registerPlayCommands(parent, getApi) {
3
3
  const play = parent
4
4
  .command("play")
@@ -90,9 +90,79 @@ Examples:
90
90
  .description("Update a play")
91
91
  .option("--name <name>", "Play name")
92
92
  .option("--description <description>", "Description")
93
+ .option("--is-enabled", "Enable the play")
94
+ .option("--is-disabled", "Disable the play")
95
+ .option("--change-kinds <kinds>", "Change kinds to trigger on (comma-separated strings)")
96
+ .option("--run-creation-rule <rule>", "Run creation rule. Allowed values: always, once, noConcurrency")
97
+ .option("--folder-uuid <uuid>", "Folder UUID")
98
+ .option("--filter <json>", "Filter definition (JSON object, same format as segmentation segment update)")
99
+ .option("--sort <json>", 'Sort definition (JSON object). Shape: {"slug": string, "order": "asc" | "desc"}')
100
+ .option("--limit <n>", "Maximum number of records (integer)")
101
+ .option("--tracking-column-slugs <slugs>", "Column slugs to track changes on (comma-separated strings)")
102
+ .option("--schedule <json>", "Schedule definition (JSON object matching the play update API payload)")
103
+ .option("--health-threshold <n>", "Health threshold (number)")
104
+ .option("--health-alert-actions <json>", "Health alert actions (JSON array matching the play update API payload)")
105
+ .option("--template <json>", 'Template settings (JSON object, e.g. {"isAvailable":true,"scope":"private"})')
93
106
  .action(async (uuid, opts) => {
94
107
  const api = getApi();
95
- const result = await handleApiCall(() => api.orchestration.play.update({ uuid, ...opts }));
108
+ if (opts.isEnabled === true && opts.isDisabled === true) {
109
+ throw new Error("Use only one of --is-enabled or --is-disabled");
110
+ }
111
+ let isEnabled;
112
+ if (opts.isEnabled === true) {
113
+ isEnabled = true;
114
+ }
115
+ if (opts.isDisabled === true) {
116
+ isEnabled = false;
117
+ }
118
+ let runCreationRule;
119
+ if (opts.runCreationRule !== undefined) {
120
+ const validRules = [
121
+ "always",
122
+ "once",
123
+ "noConcurrency",
124
+ ];
125
+ const parsedRule = opts.runCreationRule;
126
+ if (validRules.includes(parsedRule) === false) {
127
+ throw new Error(`--run-creation-rule must be one of: ${validRules.join(", ")}`);
128
+ }
129
+ runCreationRule = parsedRule;
130
+ }
131
+ const result = await handleApiCall(() => api.orchestration.play.update({
132
+ uuid,
133
+ name: opts.name,
134
+ description: opts.description,
135
+ isEnabled,
136
+ changeKinds: opts.changeKinds !== undefined
137
+ ? opts.changeKinds
138
+ .split(",")
139
+ .map((s) => s.trim())
140
+ : undefined,
141
+ runCreationRule,
142
+ folderUuid: opts.folderUuid,
143
+ filter: opts.filter !== undefined
144
+ ? parseJson(opts.filter, "--filter")
145
+ : undefined,
146
+ sort: opts.sort !== undefined
147
+ ? parseJson(opts.sort, "--sort")
148
+ : undefined,
149
+ limit: opts.limit !== undefined ? parseInt(opts.limit, 10) : undefined,
150
+ trackingColumnSlugs: opts.trackingColumnSlugs !== undefined
151
+ ? opts.trackingColumnSlugs.split(",").map((s) => s.trim())
152
+ : undefined,
153
+ schedule: opts.schedule !== undefined
154
+ ? parseJson(opts.schedule, "--schedule")
155
+ : undefined,
156
+ healthThreshold: opts.healthThreshold !== undefined
157
+ ? parseInt(opts.healthThreshold, 10)
158
+ : undefined,
159
+ healthAlertActions: opts.healthAlertActions !== undefined
160
+ ? parseJson(opts.healthAlertActions, "--health-alert-actions")
161
+ : undefined,
162
+ template: opts.template !== undefined
163
+ ? parseJson(opts.template, "--template")
164
+ : undefined,
165
+ }));
96
166
  outputJson(result);
97
167
  });
98
168
  play
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/cli",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "private": false,
5
5
  "description": "Command-line interface for the Cargo API",
6
6
  "engines": {