@rudderhq/cli 0.2.9-canary.1 → 0.2.9-canary.10
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 +157 -48
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -246,6 +246,7 @@ var init_constants = __esm({
|
|
|
246
246
|
JOIN_REQUEST_STATUSES = ["pending_approval", "approved", "rejected"];
|
|
247
247
|
PERMISSION_KEYS = [
|
|
248
248
|
"agents:create",
|
|
249
|
+
"skills:manage",
|
|
249
250
|
"users:invite",
|
|
250
251
|
"users:manage_permissions",
|
|
251
252
|
"tasks:assign",
|
|
@@ -882,9 +883,27 @@ var init_chat = __esm({
|
|
|
882
883
|
parentId: z8.string().uuid().optional().nullable(),
|
|
883
884
|
assigneeAgentId: z8.string().uuid().optional().nullable(),
|
|
884
885
|
assigneeUserId: z8.string().trim().optional().nullable(),
|
|
886
|
+
assigneeUnassignedReason: z8.string().trim().min(1).max(500).optional().nullable(),
|
|
885
887
|
reviewerAgentId: z8.string().uuid().optional().nullable(),
|
|
886
888
|
reviewerUserId: z8.string().trim().optional().nullable(),
|
|
887
889
|
labelIds: z8.array(z8.string().uuid()).optional()
|
|
890
|
+
}).superRefine((proposal, ctx) => {
|
|
891
|
+
const hasAssignee = Boolean(proposal.assigneeAgentId || proposal.assigneeUserId);
|
|
892
|
+
const hasUnassignedReason = Boolean(proposal.assigneeUnassignedReason?.trim());
|
|
893
|
+
if (hasAssignee && hasUnassignedReason) {
|
|
894
|
+
ctx.addIssue({
|
|
895
|
+
code: z8.ZodIssueCode.custom,
|
|
896
|
+
message: "Issue proposals with an assignee must not also declare an unassigned reason",
|
|
897
|
+
path: ["assigneeUnassignedReason"]
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
if (!hasAssignee && !hasUnassignedReason) {
|
|
901
|
+
ctx.addIssue({
|
|
902
|
+
code: z8.ZodIssueCode.custom,
|
|
903
|
+
message: "Issue proposals without an owner must include assigneeUnassignedReason",
|
|
904
|
+
path: ["assigneeUnassignedReason"]
|
|
905
|
+
});
|
|
906
|
+
}
|
|
888
907
|
});
|
|
889
908
|
convertChatToIssueSchema = z8.object({
|
|
890
909
|
messageId: z8.string().uuid().optional().nullable(),
|
|
@@ -1365,7 +1384,8 @@ var init_agent = __esm({
|
|
|
1365
1384
|
init_secret();
|
|
1366
1385
|
init_model_fallbacks();
|
|
1367
1386
|
agentPermissionsSchema = z12.object({
|
|
1368
|
-
canCreateAgents: z12.boolean().optional().default(false)
|
|
1387
|
+
canCreateAgents: z12.boolean().optional().default(false),
|
|
1388
|
+
canManageSkills: z12.boolean().optional().default(true)
|
|
1369
1389
|
});
|
|
1370
1390
|
agentInstructionsBundleModeSchema = z12.enum(["managed", "external"]);
|
|
1371
1391
|
updateAgentInstructionsBundleSchema = z12.object({
|
|
@@ -1459,6 +1479,7 @@ var init_agent = __esm({
|
|
|
1459
1479
|
});
|
|
1460
1480
|
updateAgentPermissionsSchema = z12.object({
|
|
1461
1481
|
canCreateAgents: z12.boolean(),
|
|
1482
|
+
canManageSkills: z12.boolean().optional(),
|
|
1462
1483
|
canAssignTasks: z12.boolean()
|
|
1463
1484
|
});
|
|
1464
1485
|
}
|
|
@@ -8122,41 +8143,41 @@ var RudderApiClient = class {
|
|
|
8122
8143
|
this.runId = opts.runId?.trim() || void 0;
|
|
8123
8144
|
this.recoverAuth = opts.recoverAuth;
|
|
8124
8145
|
}
|
|
8125
|
-
get(
|
|
8126
|
-
return this.request(
|
|
8146
|
+
get(path22, opts) {
|
|
8147
|
+
return this.request(path22, { method: "GET" }, opts);
|
|
8127
8148
|
}
|
|
8128
|
-
post(
|
|
8129
|
-
return this.request(
|
|
8149
|
+
post(path22, body, opts) {
|
|
8150
|
+
return this.request(path22, {
|
|
8130
8151
|
method: "POST",
|
|
8131
8152
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8132
8153
|
}, opts);
|
|
8133
8154
|
}
|
|
8134
|
-
postForm(
|
|
8135
|
-
return this.request(
|
|
8155
|
+
postForm(path22, form, opts) {
|
|
8156
|
+
return this.request(path22, {
|
|
8136
8157
|
method: "POST",
|
|
8137
8158
|
body: form
|
|
8138
8159
|
}, opts);
|
|
8139
8160
|
}
|
|
8140
|
-
patch(
|
|
8141
|
-
return this.request(
|
|
8161
|
+
patch(path22, body, opts) {
|
|
8162
|
+
return this.request(path22, {
|
|
8142
8163
|
method: "PATCH",
|
|
8143
8164
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8144
8165
|
}, opts);
|
|
8145
8166
|
}
|
|
8146
|
-
put(
|
|
8147
|
-
return this.request(
|
|
8167
|
+
put(path22, body, opts) {
|
|
8168
|
+
return this.request(path22, {
|
|
8148
8169
|
method: "PUT",
|
|
8149
8170
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8150
8171
|
}, opts);
|
|
8151
8172
|
}
|
|
8152
|
-
delete(
|
|
8153
|
-
return this.request(
|
|
8173
|
+
delete(path22, opts) {
|
|
8174
|
+
return this.request(path22, { method: "DELETE" }, opts);
|
|
8154
8175
|
}
|
|
8155
8176
|
setApiKey(apiKey) {
|
|
8156
8177
|
this.apiKey = apiKey?.trim() || void 0;
|
|
8157
8178
|
}
|
|
8158
|
-
async request(
|
|
8159
|
-
const url = buildUrl(this.apiBase,
|
|
8179
|
+
async request(path22, init, opts, hasRetriedAuth = false) {
|
|
8180
|
+
const url = buildUrl(this.apiBase, path22);
|
|
8160
8181
|
const headers = {
|
|
8161
8182
|
accept: "application/json",
|
|
8162
8183
|
...toStringRecord(init.headers)
|
|
@@ -8186,13 +8207,13 @@ var RudderApiClient = class {
|
|
|
8186
8207
|
const apiError = await toApiError(response);
|
|
8187
8208
|
if (!hasRetriedAuth && this.recoverAuth) {
|
|
8188
8209
|
const recoveredToken = await this.recoverAuth({
|
|
8189
|
-
path:
|
|
8210
|
+
path: path22,
|
|
8190
8211
|
method: String(init.method ?? "GET").toUpperCase(),
|
|
8191
8212
|
error: apiError
|
|
8192
8213
|
});
|
|
8193
8214
|
if (recoveredToken) {
|
|
8194
8215
|
this.setApiKey(recoveredToken);
|
|
8195
|
-
return this.request(
|
|
8216
|
+
return this.request(path22, init, opts, true);
|
|
8196
8217
|
}
|
|
8197
8218
|
}
|
|
8198
8219
|
throw apiError;
|
|
@@ -8211,8 +8232,8 @@ function shouldAttachAgentContext(method) {
|
|
|
8211
8232
|
const normalized = String(method ?? "GET").toUpperCase();
|
|
8212
8233
|
return normalized !== "GET" && normalized !== "HEAD";
|
|
8213
8234
|
}
|
|
8214
|
-
function buildUrl(apiBase,
|
|
8215
|
-
const normalizedPath =
|
|
8235
|
+
function buildUrl(apiBase, path22) {
|
|
8236
|
+
const normalizedPath = path22.startsWith("/") ? path22 : `/${path22}`;
|
|
8216
8237
|
const [pathname, query] = normalizedPath.split("?");
|
|
8217
8238
|
const url = new URL2(apiBase);
|
|
8218
8239
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
|
@@ -10200,7 +10221,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10200
10221
|
},
|
|
10201
10222
|
{
|
|
10202
10223
|
id: "issue.comment",
|
|
10203
|
-
command: "rudder issue comment <issue> --body <
|
|
10224
|
+
command: "rudder issue comment <issue> --body-file <path> [--image <path>]",
|
|
10204
10225
|
category: "issue",
|
|
10205
10226
|
description: "Add a comment to an issue, optionally uploading images and appending Markdown image links.",
|
|
10206
10227
|
mutating: true,
|
|
@@ -10236,7 +10257,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10236
10257
|
},
|
|
10237
10258
|
{
|
|
10238
10259
|
id: "issue.update",
|
|
10239
|
-
command: "rudder issue update <issue> ... [--image <path>]",
|
|
10260
|
+
command: "rudder issue update <issue> ... [--comment-file <path>] [--image <path>]",
|
|
10240
10261
|
category: "issue",
|
|
10241
10262
|
description: "Apply generic issue updates when workflow commands are not enough, optionally uploading images for the update comment.",
|
|
10242
10263
|
mutating: true,
|
|
@@ -10248,7 +10269,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10248
10269
|
},
|
|
10249
10270
|
{
|
|
10250
10271
|
id: "issue.review",
|
|
10251
|
-
command: "rudder issue review <issue> --decision <decision> --comment <
|
|
10272
|
+
command: "rudder issue review <issue> --decision <decision> --comment-file <path>",
|
|
10252
10273
|
category: "issue",
|
|
10253
10274
|
description: "Record a structured reviewer decision with a required comment.",
|
|
10254
10275
|
mutating: true,
|
|
@@ -10272,7 +10293,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10272
10293
|
},
|
|
10273
10294
|
{
|
|
10274
10295
|
id: "issue.done",
|
|
10275
|
-
command: "rudder issue done <issue> --comment <
|
|
10296
|
+
command: "rudder issue done <issue> --comment-file <path> [--image <path>]",
|
|
10276
10297
|
category: "issue",
|
|
10277
10298
|
description: "Mark an issue done with a required completion comment, optionally uploading images.",
|
|
10278
10299
|
mutating: true,
|
|
@@ -10284,7 +10305,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10284
10305
|
},
|
|
10285
10306
|
{
|
|
10286
10307
|
id: "issue.block",
|
|
10287
|
-
command: "rudder issue block <issue> --comment <
|
|
10308
|
+
command: "rudder issue block <issue> --comment-file <path> [--image <path>]",
|
|
10288
10309
|
category: "issue",
|
|
10289
10310
|
description: "Mark an issue blocked with a required blocker comment, optionally uploading images.",
|
|
10290
10311
|
mutating: true,
|
|
@@ -10332,7 +10353,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10332
10353
|
},
|
|
10333
10354
|
{
|
|
10334
10355
|
id: "issue.documents.put",
|
|
10335
|
-
command: "rudder issue documents put <issue> <key> --body <
|
|
10356
|
+
command: "rudder issue documents put <issue> <key> --body-file <path>",
|
|
10336
10357
|
category: "issue",
|
|
10337
10358
|
description: "Create or update an issue document.",
|
|
10338
10359
|
mutating: true,
|
|
@@ -10416,7 +10437,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10416
10437
|
},
|
|
10417
10438
|
{
|
|
10418
10439
|
id: "approval.comment",
|
|
10419
|
-
command: "rudder approval comment <approval-id> --body <
|
|
10440
|
+
command: "rudder approval comment <approval-id> --body-file <path>",
|
|
10420
10441
|
category: "approval",
|
|
10421
10442
|
description: "Add a comment to an approval.",
|
|
10422
10443
|
mutating: true,
|
|
@@ -10659,10 +10680,16 @@ function registerIssueCommands(program) {
|
|
|
10659
10680
|
{ includeCompany: false }
|
|
10660
10681
|
);
|
|
10661
10682
|
addCommonClientOptions(
|
|
10662
|
-
issue.command("update").description(getAgentCliCapabilityById("issue.update").description).argument("<issueId>", "Issue ID").option("--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("--comment <
|
|
10683
|
+
issue.command("update").description(getAgentCliCapabilityById("issue.update").description).argument("<issueId>", "Issue ID").option("--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("--comment-file <path>", "Read optional update comment from a file, or '-' for stdin").option("--image <path>", "Image file to upload and append to the update comment; may be repeated", collectImagePath, []).option("--hidden-at <iso8601|null>", "Set hiddenAt timestamp or literal 'null'").action(async (issueId, opts) => {
|
|
10663
10684
|
try {
|
|
10664
10685
|
const ctx = resolveCommandContext(opts);
|
|
10665
|
-
const
|
|
10686
|
+
const commentText = await resolveFileTextInput({
|
|
10687
|
+
file: opts.commentFile,
|
|
10688
|
+
fileOption: "--comment-file",
|
|
10689
|
+
removedTextOption: "--comment",
|
|
10690
|
+
required: false
|
|
10691
|
+
});
|
|
10692
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, commentText, opts.image);
|
|
10666
10693
|
const payload = updateIssueSchema.parse({
|
|
10667
10694
|
title: opts.title,
|
|
10668
10695
|
description: opts.description,
|
|
@@ -10685,10 +10712,16 @@ function registerIssueCommands(program) {
|
|
|
10685
10712
|
})
|
|
10686
10713
|
);
|
|
10687
10714
|
addCommonClientOptions(
|
|
10688
|
-
issue.command("comment").description(getAgentCliCapabilityById("issue.comment").description).argument("<issueId>", "Issue ID").
|
|
10715
|
+
issue.command("comment").description(getAgentCliCapabilityById("issue.comment").description).argument("<issueId>", "Issue ID").option("--body-file <path>", "Read comment body from a file, or '-' for stdin").option("--image <path>", "Image file to upload and append to the comment; may be repeated", collectImagePath, []).option("--reopen", "Reopen if issue is done/cancelled").action(async (issueId, opts) => {
|
|
10689
10716
|
try {
|
|
10690
10717
|
const ctx = resolveCommandContext(opts);
|
|
10691
|
-
const
|
|
10718
|
+
const bodyText = await resolveFileTextInput({
|
|
10719
|
+
file: opts.bodyFile,
|
|
10720
|
+
fileOption: "--body-file",
|
|
10721
|
+
removedTextOption: "--body",
|
|
10722
|
+
required: true
|
|
10723
|
+
});
|
|
10724
|
+
const body = await appendUploadedIssueImages(ctx, issueId, bodyText, opts.image);
|
|
10692
10725
|
const payload = addIssueCommentSchema.parse({
|
|
10693
10726
|
body,
|
|
10694
10727
|
reopen: opts.reopen
|
|
@@ -10707,13 +10740,19 @@ function registerIssueCommands(program) {
|
|
|
10707
10740
|
issue.command("review").description(getAgentCliCapabilityById("issue.review").description).argument("<issueId>", "Issue ID").requiredOption(
|
|
10708
10741
|
"--decision <decision>",
|
|
10709
10742
|
"Review decision: approve, request_changes, needs_followup, or blocked"
|
|
10710
|
-
).
|
|
10743
|
+
).option("--comment-file <path>", "Read required review comment from a file, or '-' for stdin").action(async (issueId, opts) => {
|
|
10711
10744
|
try {
|
|
10712
10745
|
const ctx = resolveCommandContext(opts);
|
|
10713
10746
|
const decision = parseReviewDecision(opts.decision);
|
|
10747
|
+
const comment = await resolveFileTextInput({
|
|
10748
|
+
file: opts.commentFile,
|
|
10749
|
+
fileOption: "--comment-file",
|
|
10750
|
+
removedTextOption: "--comment",
|
|
10751
|
+
required: true
|
|
10752
|
+
});
|
|
10714
10753
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
10715
10754
|
reviewDecision: decision,
|
|
10716
|
-
comment
|
|
10755
|
+
comment
|
|
10717
10756
|
});
|
|
10718
10757
|
printOutput(updated, { json: ctx.json });
|
|
10719
10758
|
} catch (err) {
|
|
@@ -10741,10 +10780,16 @@ function registerIssueCommands(program) {
|
|
|
10741
10780
|
})
|
|
10742
10781
|
);
|
|
10743
10782
|
addCommonClientOptions(
|
|
10744
|
-
issue.command("done").description(getAgentCliCapabilityById("issue.done").description).argument("<issueId>", "Issue ID").
|
|
10783
|
+
issue.command("done").description(getAgentCliCapabilityById("issue.done").description).argument("<issueId>", "Issue ID").option("--comment-file <path>", "Read required completion comment from a file, or '-' for stdin").option("--image <path>", "Image file to upload and append to the completion comment; may be repeated", collectImagePath, []).action(async (issueId, opts) => {
|
|
10745
10784
|
try {
|
|
10746
10785
|
const ctx = resolveCommandContext(opts);
|
|
10747
|
-
const
|
|
10786
|
+
const commentText = await resolveFileTextInput({
|
|
10787
|
+
file: opts.commentFile,
|
|
10788
|
+
fileOption: "--comment-file",
|
|
10789
|
+
removedTextOption: "--comment",
|
|
10790
|
+
required: true
|
|
10791
|
+
});
|
|
10792
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, commentText, opts.image);
|
|
10748
10793
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
10749
10794
|
status: "done",
|
|
10750
10795
|
comment
|
|
@@ -10756,10 +10801,16 @@ function registerIssueCommands(program) {
|
|
|
10756
10801
|
})
|
|
10757
10802
|
);
|
|
10758
10803
|
addCommonClientOptions(
|
|
10759
|
-
issue.command("block").description(getAgentCliCapabilityById("issue.block").description).argument("<issueId>", "Issue ID").
|
|
10804
|
+
issue.command("block").description(getAgentCliCapabilityById("issue.block").description).argument("<issueId>", "Issue ID").option("--comment-file <path>", "Read required blocker comment from a file, or '-' for stdin").option("--image <path>", "Image file to upload and append to the blocker comment; may be repeated", collectImagePath, []).action(async (issueId, opts) => {
|
|
10760
10805
|
try {
|
|
10761
10806
|
const ctx = resolveCommandContext(opts);
|
|
10762
|
-
const
|
|
10807
|
+
const commentText = await resolveFileTextInput({
|
|
10808
|
+
file: opts.commentFile,
|
|
10809
|
+
fileOption: "--comment-file",
|
|
10810
|
+
removedTextOption: "--comment",
|
|
10811
|
+
required: true
|
|
10812
|
+
});
|
|
10813
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, commentText, opts.image);
|
|
10763
10814
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
10764
10815
|
status: "blocked",
|
|
10765
10816
|
comment
|
|
@@ -10823,13 +10874,19 @@ function registerIssueCommands(program) {
|
|
|
10823
10874
|
})
|
|
10824
10875
|
);
|
|
10825
10876
|
addCommonClientOptions(
|
|
10826
|
-
documents.command("put").description(getAgentCliCapabilityById("issue.documents.put").description).argument("<issueId>", "Issue ID").argument("<key>", "Document key").
|
|
10877
|
+
documents.command("put").description(getAgentCliCapabilityById("issue.documents.put").description).argument("<issueId>", "Issue ID").argument("<key>", "Document key").option("--body-file <path>", "Read document body from a file, or '-' for stdin").option("--title <text>", "Document title").option("--format <format>", "Document format", "markdown").option("--change-summary <text>", "Optional change summary").option("--base-revision-id <id>", "Latest revision id for optimistic concurrency").action(async (issueId, key, opts) => {
|
|
10827
10878
|
try {
|
|
10828
10879
|
const ctx = resolveCommandContext(opts);
|
|
10880
|
+
const body = await resolveFileTextInput({
|
|
10881
|
+
file: opts.bodyFile,
|
|
10882
|
+
fileOption: "--body-file",
|
|
10883
|
+
removedTextOption: "--body",
|
|
10884
|
+
required: true
|
|
10885
|
+
});
|
|
10829
10886
|
const payload = upsertIssueDocumentSchema.parse({
|
|
10830
10887
|
title: opts.title,
|
|
10831
10888
|
format: opts.format,
|
|
10832
|
-
body
|
|
10889
|
+
body,
|
|
10833
10890
|
changeSummary: opts.changeSummary,
|
|
10834
10891
|
baseRevisionId: opts.baseRevisionId
|
|
10835
10892
|
});
|
|
@@ -10902,6 +10959,33 @@ function collectNonEmptyOption(optionName) {
|
|
|
10902
10959
|
return [...previous, trimmed];
|
|
10903
10960
|
};
|
|
10904
10961
|
}
|
|
10962
|
+
async function resolveFileTextInput(opts) {
|
|
10963
|
+
if (opts.removedTextOption && process.argv.includes(opts.removedTextOption)) {
|
|
10964
|
+
throw new Error(`${opts.removedTextOption} was removed; write the body to a file and use ${opts.fileOption} <path> or ${opts.fileOption} - for stdin`);
|
|
10965
|
+
}
|
|
10966
|
+
const hasFile = opts.file !== void 0;
|
|
10967
|
+
if (hasFile) return readTextInputFile(opts.file, opts.fileOption);
|
|
10968
|
+
if (opts.required) {
|
|
10969
|
+
throw new Error(`Provide ${opts.fileOption} <path>; use ${opts.fileOption} - for stdin`);
|
|
10970
|
+
}
|
|
10971
|
+
return void 0;
|
|
10972
|
+
}
|
|
10973
|
+
async function readTextInputFile(inputPath, optionName) {
|
|
10974
|
+
if (inputPath === "-") {
|
|
10975
|
+
return readStdinText();
|
|
10976
|
+
}
|
|
10977
|
+
const resolvedPath = path16.resolve(process.cwd(), inputPath);
|
|
10978
|
+
return readFile4(resolvedPath, "utf8").catch((err) => {
|
|
10979
|
+
throw new Error(`Unable to read ${optionName} ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
10980
|
+
});
|
|
10981
|
+
}
|
|
10982
|
+
async function readStdinText() {
|
|
10983
|
+
const chunks = [];
|
|
10984
|
+
for await (const chunk of process.stdin) {
|
|
10985
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
10986
|
+
}
|
|
10987
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
10988
|
+
}
|
|
10905
10989
|
async function resolveIssueLabelIds(ctx, opts) {
|
|
10906
10990
|
const explicitIds = opts.labelId ?? [];
|
|
10907
10991
|
const names = opts.label ?? [];
|
|
@@ -11659,6 +11743,8 @@ function parseJsonObject(value, name) {
|
|
|
11659
11743
|
|
|
11660
11744
|
// src/commands/client/approval.ts
|
|
11661
11745
|
init_dist();
|
|
11746
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
11747
|
+
import path19 from "node:path";
|
|
11662
11748
|
function registerApprovalCommands(program) {
|
|
11663
11749
|
const approval = program.command("approval").description("Approval operations");
|
|
11664
11750
|
addCommonClientOptions(
|
|
@@ -11795,11 +11881,12 @@ function registerApprovalCommands(program) {
|
|
|
11795
11881
|
})
|
|
11796
11882
|
);
|
|
11797
11883
|
addCommonClientOptions(
|
|
11798
|
-
approval.command("comment").description(getAgentCliCapabilityById("approval.comment").description).argument("<approvalId>", "Approval ID").
|
|
11884
|
+
approval.command("comment").description(getAgentCliCapabilityById("approval.comment").description).argument("<approvalId>", "Approval ID").option("--body-file <path>", "Read comment body from a file, or '-' for stdin").action(async (approvalId, opts) => {
|
|
11799
11885
|
try {
|
|
11800
11886
|
const ctx = resolveCommandContext(opts);
|
|
11887
|
+
const body = await resolveBodyFile(opts.bodyFile);
|
|
11801
11888
|
const created = await ctx.api.post(`/api/approvals/${approvalId}/comments`, {
|
|
11802
|
-
body
|
|
11889
|
+
body
|
|
11803
11890
|
});
|
|
11804
11891
|
printOutput(created, { json: ctx.json });
|
|
11805
11892
|
} catch (err) {
|
|
@@ -11808,6 +11895,28 @@ function registerApprovalCommands(program) {
|
|
|
11808
11895
|
})
|
|
11809
11896
|
);
|
|
11810
11897
|
}
|
|
11898
|
+
async function resolveBodyFile(inputPath) {
|
|
11899
|
+
if (!inputPath) {
|
|
11900
|
+
throw new Error("Provide --body-file <path>; use --body-file - for stdin");
|
|
11901
|
+
}
|
|
11902
|
+
return readTextInputFile2(inputPath, "--body-file");
|
|
11903
|
+
}
|
|
11904
|
+
async function readTextInputFile2(inputPath, optionName) {
|
|
11905
|
+
if (inputPath === "-") {
|
|
11906
|
+
return readStdinText2();
|
|
11907
|
+
}
|
|
11908
|
+
const resolvedPath = path19.resolve(process.cwd(), inputPath);
|
|
11909
|
+
return readFile5(resolvedPath, "utf8").catch((err) => {
|
|
11910
|
+
throw new Error(`Unable to read ${optionName} ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
11911
|
+
});
|
|
11912
|
+
}
|
|
11913
|
+
async function readStdinText2() {
|
|
11914
|
+
const chunks = [];
|
|
11915
|
+
for await (const chunk of process.stdin) {
|
|
11916
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
11917
|
+
}
|
|
11918
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
11919
|
+
}
|
|
11811
11920
|
function parseCsv3(value) {
|
|
11812
11921
|
if (!value) return void 0;
|
|
11813
11922
|
const rows = value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
@@ -11837,8 +11946,8 @@ function registerActivityCommands(program) {
|
|
|
11837
11946
|
if (opts.entityType) params.set("entityType", opts.entityType);
|
|
11838
11947
|
if (opts.entityId) params.set("entityId", opts.entityId);
|
|
11839
11948
|
const query = params.toString();
|
|
11840
|
-
const
|
|
11841
|
-
const rows = await ctx.api.get(
|
|
11949
|
+
const path22 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
|
|
11950
|
+
const rows = await ctx.api.get(path22) ?? [];
|
|
11842
11951
|
if (ctx.json) {
|
|
11843
11952
|
printOutput(rows, { json: true });
|
|
11844
11953
|
return;
|
|
@@ -12007,11 +12116,11 @@ function parseCsv4(value) {
|
|
|
12007
12116
|
|
|
12008
12117
|
// src/config/data-dir.ts
|
|
12009
12118
|
init_home();
|
|
12010
|
-
import
|
|
12119
|
+
import path20 from "node:path";
|
|
12011
12120
|
function applyDataDirOverride(options, support = {}) {
|
|
12012
12121
|
const rawDataDir = options.dataDir?.trim();
|
|
12013
12122
|
if (!rawDataDir) return null;
|
|
12014
|
-
const resolvedDataDir =
|
|
12123
|
+
const resolvedDataDir = path20.resolve(expandHomePrefix(rawDataDir));
|
|
12015
12124
|
process.env.RUDDER_HOME = resolvedDataDir;
|
|
12016
12125
|
if (support.hasConfigOption) {
|
|
12017
12126
|
const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
|
|
@@ -12035,16 +12144,16 @@ init_env();
|
|
|
12035
12144
|
init_local_env();
|
|
12036
12145
|
|
|
12037
12146
|
// src/commands/client/plugin.ts
|
|
12038
|
-
import
|
|
12147
|
+
import path21 from "node:path";
|
|
12039
12148
|
import pc15 from "picocolors";
|
|
12040
12149
|
function resolvePackageArg(packageArg, isLocal) {
|
|
12041
12150
|
if (!isLocal) return packageArg;
|
|
12042
|
-
if (
|
|
12151
|
+
if (path21.isAbsolute(packageArg)) return packageArg;
|
|
12043
12152
|
if (packageArg.startsWith("~")) {
|
|
12044
12153
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
12045
|
-
return
|
|
12154
|
+
return path21.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
|
|
12046
12155
|
}
|
|
12047
|
-
return
|
|
12156
|
+
return path21.resolve(process.cwd(), packageArg);
|
|
12048
12157
|
}
|
|
12049
12158
|
function formatPlugin(p16) {
|
|
12050
12159
|
const statusColor = p16.status === "ready" ? pc15.green(p16.status) : p16.status === "error" ? pc15.red(p16.status) : p16.status === "disabled" ? pc15.dim(p16.status) : pc15.yellow(p16.status);
|