@velaro/cli 1.4.67 → 1.4.68
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/lib/commands/focus.js +27 -7
- package/package.json +1 -1
package/lib/commands/focus.js
CHANGED
|
@@ -220,19 +220,39 @@ const triageRulesCommand = {
|
|
|
220
220
|
};
|
|
221
221
|
|
|
222
222
|
const setTriageRuleCommand = {
|
|
223
|
-
command: 'set-triage-rule
|
|
224
|
-
describe: `Enable
|
|
223
|
+
command: 'set-triage-rule [label] [enabled]',
|
|
224
|
+
describe: `Enable/disable one fixed AI triage label (${VALID_LABELS.join(', ')}) and/or set --triage-mode`,
|
|
225
225
|
builder: (y) => y
|
|
226
226
|
.positional('label', { type: 'string', describe: `Label: ${VALID_LABELS.join(', ')}` })
|
|
227
|
-
.positional('enabled', { type: 'string', describe: 'true or false', choices: ['true', 'false'] })
|
|
227
|
+
.positional('enabled', { type: 'string', describe: 'true or false', choices: ['true', 'false'] })
|
|
228
|
+
.option('triage-mode', { type: 'string', choices: ['off', 'economy'], describe: 'off (default) or economy (skip AI call for obvious messages)' }),
|
|
228
229
|
handler: async (argv) => {
|
|
229
230
|
const { label, enabled } = argv;
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
const mode = argv['triage-mode'];
|
|
232
|
+
if (!label && !mode) {
|
|
233
|
+
console.error('Provide <label> <enabled> and/or --triage-mode <off|economy>.');
|
|
232
234
|
process.exit(1);
|
|
233
235
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
let labels;
|
|
237
|
+
if (label) {
|
|
238
|
+
if (!VALID_LABELS.includes(label)) {
|
|
239
|
+
console.error(`Invalid label "${label}". Valid values: ${VALID_LABELS.join(', ')}`);
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
if (enabled !== 'true' && enabled !== 'false') {
|
|
243
|
+
console.error('<enabled> must be true or false.');
|
|
244
|
+
process.exit(1);
|
|
245
|
+
}
|
|
246
|
+
labels = [{ Label: label, Enabled: enabled === 'true' }];
|
|
247
|
+
}
|
|
248
|
+
const body = mode ? { ...(labels ? { labels } : {}), triageMode: mode } : labels;
|
|
249
|
+
const result = await messagingPut('/Focus/triage-rules', body);
|
|
250
|
+
if (label) console.log(`
|
|
251
|
+
${GRN}✓${RESET} Label "${label}" ${enabled === 'true' ? 'enabled' : 'disabled'}.`);
|
|
252
|
+
if (mode) console.log(`
|
|
253
|
+
${GRN}✓${RESET} Triage mode set to ${mode}.`);
|
|
254
|
+
console.log(` Effective labels: ${(result?.effectiveLabels ?? []).join(', ')}
|
|
255
|
+
`);
|
|
236
256
|
},
|
|
237
257
|
};
|
|
238
258
|
|
package/package.json
CHANGED