@rudderhq/cli 0.2.5-canary.6 → 0.2.5-canary.8
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/index.js +68 -5
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -706,7 +706,8 @@ var init_chat = __esm({
|
|
|
706
706
|
assigneeAgentId: z5.string().uuid().optional().nullable(),
|
|
707
707
|
assigneeUserId: z5.string().trim().optional().nullable(),
|
|
708
708
|
reviewerAgentId: z5.string().uuid().optional().nullable(),
|
|
709
|
-
reviewerUserId: z5.string().trim().optional().nullable()
|
|
709
|
+
reviewerUserId: z5.string().trim().optional().nullable(),
|
|
710
|
+
labelIds: z5.array(z5.string().uuid()).optional()
|
|
710
711
|
});
|
|
711
712
|
convertChatToIssueSchema = z5.object({
|
|
712
713
|
messageId: z5.string().uuid().optional().nullable(),
|
|
@@ -1777,7 +1778,8 @@ var init_approval = __esm({
|
|
|
1777
1778
|
});
|
|
1778
1779
|
resolveApprovalSchema = z18.object({
|
|
1779
1780
|
decisionNote: z18.string().optional().nullable(),
|
|
1780
|
-
decidedByUserId: z18.string().optional().default("board")
|
|
1781
|
+
decidedByUserId: z18.string().optional().default("board"),
|
|
1782
|
+
payload: z18.record(z18.unknown()).optional()
|
|
1781
1783
|
});
|
|
1782
1784
|
requestApprovalRevisionSchema = z18.object({
|
|
1783
1785
|
decisionNote: z18.string().optional().nullable(),
|
|
@@ -10139,7 +10141,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10139
10141
|
},
|
|
10140
10142
|
{
|
|
10141
10143
|
id: "issue.create",
|
|
10142
|
-
command: "rudder issue create --org-id <id> ...",
|
|
10144
|
+
command: "rudder issue create --org-id <id> ... [--label-id <id> ...] [--label <name> ...]",
|
|
10143
10145
|
category: "issue",
|
|
10144
10146
|
description: "Create a new issue or subtask with the generic issue surface; agent-created issues default to the creating agent when no assignee is supplied.",
|
|
10145
10147
|
mutating: true,
|
|
@@ -10149,6 +10151,18 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10149
10151
|
requiresRunId: false,
|
|
10150
10152
|
attachesRunIdWhenAvailable: true
|
|
10151
10153
|
},
|
|
10154
|
+
{
|
|
10155
|
+
id: "issue.labels.list",
|
|
10156
|
+
command: "rudder issue labels list --org-id <id>",
|
|
10157
|
+
category: "issue",
|
|
10158
|
+
description: "List organization issue labels available for issue creation.",
|
|
10159
|
+
mutating: false,
|
|
10160
|
+
contract: "compat",
|
|
10161
|
+
requiresOrgId: true,
|
|
10162
|
+
requiresAgentId: false,
|
|
10163
|
+
requiresRunId: false,
|
|
10164
|
+
attachesRunIdWhenAvailable: false
|
|
10165
|
+
},
|
|
10152
10166
|
{
|
|
10153
10167
|
id: "approval.get",
|
|
10154
10168
|
command: "rudder approval get <approval-id>",
|
|
@@ -10392,9 +10406,22 @@ function registerIssueCommands(program) {
|
|
|
10392
10406
|
})
|
|
10393
10407
|
);
|
|
10394
10408
|
addCommonClientOptions(
|
|
10395
|
-
issue.command("
|
|
10409
|
+
issue.command("labels").description("Issue label operations").command("list").description("List issue labels for an organization").option("-O, --org-id <id>", "Organization ID").action(async (opts) => {
|
|
10410
|
+
try {
|
|
10411
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
10412
|
+
const rows = await ctx.api.get(`/api/orgs/${ctx.orgId}/labels`) ?? [];
|
|
10413
|
+
printOutput(rows, { json: ctx.json });
|
|
10414
|
+
} catch (err) {
|
|
10415
|
+
handleCommandError(err);
|
|
10416
|
+
}
|
|
10417
|
+
}),
|
|
10418
|
+
{ includeCompany: false }
|
|
10419
|
+
);
|
|
10420
|
+
addCommonClientOptions(
|
|
10421
|
+
issue.command("create").description(getAgentCliCapabilityById("issue.create").description).option("-O, --org-id <id>", "Organization ID").requiredOption("--title <title>", "Issue title").option("--description <text>", "Issue description").option("--status <status>", "Issue status").option("--priority <priority>", "Issue priority").option("--assignee-agent-id <id>", "Assignee agent ID").option("--project-id <id>", "Project ID").option("--goal-id <id>", "Goal ID").option("--parent-id <id>", "Parent issue ID").option("--request-depth <n>", "Request depth integer").option("--billing-code <code>", "Billing code").option("--label-id <id>", "Issue label ID; may be repeated", collectNonEmptyOption("--label-id"), []).option("--label <name>", "Issue label name to resolve exactly; may be repeated", collectNonEmptyOption("--label"), []).action(async (opts) => {
|
|
10396
10422
|
try {
|
|
10397
10423
|
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
10424
|
+
const labelIds = await resolveIssueLabelIds(ctx, opts);
|
|
10398
10425
|
const payload = createIssueSchema.parse({
|
|
10399
10426
|
title: opts.title,
|
|
10400
10427
|
description: opts.description,
|
|
@@ -10405,7 +10432,8 @@ function registerIssueCommands(program) {
|
|
|
10405
10432
|
goalId: opts.goalId,
|
|
10406
10433
|
parentId: opts.parentId,
|
|
10407
10434
|
requestDepth: parseOptionalInt(opts.requestDepth),
|
|
10408
|
-
billingCode: opts.billingCode
|
|
10435
|
+
billingCode: opts.billingCode,
|
|
10436
|
+
labelIds: labelIds.length > 0 ? labelIds : void 0
|
|
10409
10437
|
});
|
|
10410
10438
|
const created = await ctx.api.post(`/api/orgs/${ctx.orgId}/issues`, payload);
|
|
10411
10439
|
printOutput(created, { json: ctx.json });
|
|
@@ -10650,6 +10678,41 @@ function collectImagePath(value, previous) {
|
|
|
10650
10678
|
}
|
|
10651
10679
|
return [...previous, trimmed];
|
|
10652
10680
|
}
|
|
10681
|
+
function collectNonEmptyOption(optionName) {
|
|
10682
|
+
return (value, previous) => {
|
|
10683
|
+
const trimmed = value.trim();
|
|
10684
|
+
if (!trimmed) {
|
|
10685
|
+
throw new Error(`${optionName} cannot be empty`);
|
|
10686
|
+
}
|
|
10687
|
+
return [...previous, trimmed];
|
|
10688
|
+
};
|
|
10689
|
+
}
|
|
10690
|
+
async function resolveIssueLabelIds(ctx, opts) {
|
|
10691
|
+
const explicitIds = opts.labelId ?? [];
|
|
10692
|
+
const names = opts.label ?? [];
|
|
10693
|
+
if (names.length === 0 && explicitIds.length > 0) return [...new Set(explicitIds)];
|
|
10694
|
+
if (names.length === 0 && opts.parentId) return [];
|
|
10695
|
+
const labels = await ctx.api.get(`/api/orgs/${ctx.orgId}/labels`) ?? [];
|
|
10696
|
+
if (names.length === 0) {
|
|
10697
|
+
if (ctx.agentId && labels.length >= 5) {
|
|
10698
|
+
throw new Error(
|
|
10699
|
+
`Organization has ${labels.length} issue labels. Choose at least one with --label-id <id> or --label <name>. Available labels: ${formatAvailableLabelNames(labels)}`
|
|
10700
|
+
);
|
|
10701
|
+
}
|
|
10702
|
+
return [];
|
|
10703
|
+
}
|
|
10704
|
+
const resolvedIds = names.map((name) => {
|
|
10705
|
+
const exact = labels.find((label) => label.name === name) ?? labels.find((label) => label.name.toLowerCase() === name.toLowerCase());
|
|
10706
|
+
if (!exact) {
|
|
10707
|
+
throw new Error(`Unknown issue label "${name}". Available labels: ${formatAvailableLabelNames(labels)}`);
|
|
10708
|
+
}
|
|
10709
|
+
return exact.id;
|
|
10710
|
+
});
|
|
10711
|
+
return [.../* @__PURE__ */ new Set([...explicitIds, ...resolvedIds])];
|
|
10712
|
+
}
|
|
10713
|
+
function formatAvailableLabelNames(labels) {
|
|
10714
|
+
return labels.map((label) => label.name).join(", ") || "(none)";
|
|
10715
|
+
}
|
|
10653
10716
|
async function appendUploadedIssueImages(ctx, issueId, body, imagePaths) {
|
|
10654
10717
|
const paths = imagePaths ?? [];
|
|
10655
10718
|
if (paths.length === 0) return body;
|