@orchagent/cli 0.3.73 → 0.3.74
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/commands/schedule.js +19 -2
- package/package.json +1 -1
|
@@ -43,6 +43,21 @@ function statusColor(status) {
|
|
|
43
43
|
default: return status;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
async function resolveScheduleId(config, partialId, workspaceId) {
|
|
47
|
+
// If it looks like a full UUID already, return as-is
|
|
48
|
+
if (partialId.length >= 32)
|
|
49
|
+
return partialId;
|
|
50
|
+
// Fetch schedules and match by prefix
|
|
51
|
+
const response = await (0, api_1.request)(config, 'GET', `/workspaces/${workspaceId}/schedules?limit=200`);
|
|
52
|
+
const matches = response.schedules.filter((s) => s.id.startsWith(partialId));
|
|
53
|
+
if (matches.length === 0) {
|
|
54
|
+
throw new errors_1.CliError(`No schedule found matching '${partialId}'`);
|
|
55
|
+
}
|
|
56
|
+
if (matches.length > 1) {
|
|
57
|
+
throw new errors_1.CliError(`Ambiguous schedule ID '${partialId}' matches ${matches.length} schedules. Use a longer prefix.`);
|
|
58
|
+
}
|
|
59
|
+
return matches[0].id;
|
|
60
|
+
}
|
|
46
61
|
// ============================================
|
|
47
62
|
// COMMAND REGISTRATION
|
|
48
63
|
// ============================================
|
|
@@ -283,12 +298,13 @@ function registerScheduleCommand(program) {
|
|
|
283
298
|
.description('Manually trigger a schedule execution')
|
|
284
299
|
.option('--input <json>', 'Override input data as JSON')
|
|
285
300
|
.option('--workspace <slug>', 'Workspace slug (default: current workspace)')
|
|
286
|
-
.action(async (
|
|
301
|
+
.action(async (partialScheduleId, options) => {
|
|
287
302
|
const config = await (0, config_1.getResolvedConfig)();
|
|
288
303
|
if (!config.apiKey) {
|
|
289
304
|
throw new errors_1.CliError('Missing API key. Run `orch login` first.');
|
|
290
305
|
}
|
|
291
306
|
const workspaceId = await resolveWorkspaceId(config, options.workspace);
|
|
307
|
+
const scheduleId = await resolveScheduleId(config, partialScheduleId, workspaceId);
|
|
292
308
|
let body;
|
|
293
309
|
if (options.input) {
|
|
294
310
|
try {
|
|
@@ -323,12 +339,13 @@ function registerScheduleCommand(program) {
|
|
|
323
339
|
.description('Show detailed schedule information with recent runs and events')
|
|
324
340
|
.option('--workspace <slug>', 'Workspace slug (default: current workspace)')
|
|
325
341
|
.option('--json', 'Output as JSON')
|
|
326
|
-
.action(async (
|
|
342
|
+
.action(async (partialScheduleId, options) => {
|
|
327
343
|
const config = await (0, config_1.getResolvedConfig)();
|
|
328
344
|
if (!config.apiKey) {
|
|
329
345
|
throw new errors_1.CliError('Missing API key. Run `orch login` first.');
|
|
330
346
|
}
|
|
331
347
|
const workspaceId = await resolveWorkspaceId(config, options.workspace);
|
|
348
|
+
const scheduleId = await resolveScheduleId(config, partialScheduleId, workspaceId);
|
|
332
349
|
const [scheduleRes, runsRes, eventsRes] = await Promise.all([
|
|
333
350
|
(0, api_1.request)(config, 'GET', `/workspaces/${workspaceId}/schedules/${scheduleId}`),
|
|
334
351
|
(0, api_1.request)(config, 'GET', `/workspaces/${workspaceId}/schedules/${scheduleId}/runs?limit=5`),
|
package/package.json
CHANGED