@rudderhq/cli 0.2.9-canary.3 → 0.2.9-canary.5

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 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",
@@ -1365,7 +1366,8 @@ var init_agent = __esm({
1365
1366
  init_secret();
1366
1367
  init_model_fallbacks();
1367
1368
  agentPermissionsSchema = z12.object({
1368
- canCreateAgents: z12.boolean().optional().default(false)
1369
+ canCreateAgents: z12.boolean().optional().default(false),
1370
+ canManageSkills: z12.boolean().optional().default(true)
1369
1371
  });
1370
1372
  agentInstructionsBundleModeSchema = z12.enum(["managed", "external"]);
1371
1373
  updateAgentInstructionsBundleSchema = z12.object({
@@ -1459,6 +1461,7 @@ var init_agent = __esm({
1459
1461
  });
1460
1462
  updateAgentPermissionsSchema = z12.object({
1461
1463
  canCreateAgents: z12.boolean(),
1464
+ canManageSkills: z12.boolean().optional(),
1462
1465
  canAssignTasks: z12.boolean()
1463
1466
  });
1464
1467
  }
@@ -10200,7 +10203,7 @@ var AGENT_CLI_CAPABILITIES = [
10200
10203
  },
10201
10204
  {
10202
10205
  id: "issue.comment",
10203
- command: "rudder issue comment <issue> --body <text> [--image <path>]",
10206
+ command: "rudder issue comment <issue> --body-file <path> [--image <path>]",
10204
10207
  category: "issue",
10205
10208
  description: "Add a comment to an issue, optionally uploading images and appending Markdown image links.",
10206
10209
  mutating: true,
@@ -10236,7 +10239,7 @@ var AGENT_CLI_CAPABILITIES = [
10236
10239
  },
10237
10240
  {
10238
10241
  id: "issue.update",
10239
- command: "rudder issue update <issue> ... [--image <path>]",
10242
+ command: "rudder issue update <issue> ... [--comment-file <path>] [--image <path>]",
10240
10243
  category: "issue",
10241
10244
  description: "Apply generic issue updates when workflow commands are not enough, optionally uploading images for the update comment.",
10242
10245
  mutating: true,
@@ -10248,7 +10251,7 @@ var AGENT_CLI_CAPABILITIES = [
10248
10251
  },
10249
10252
  {
10250
10253
  id: "issue.review",
10251
- command: "rudder issue review <issue> --decision <decision> --comment <text>",
10254
+ command: "rudder issue review <issue> --decision <decision> --comment-file <path>",
10252
10255
  category: "issue",
10253
10256
  description: "Record a structured reviewer decision with a required comment.",
10254
10257
  mutating: true,
@@ -10272,7 +10275,7 @@ var AGENT_CLI_CAPABILITIES = [
10272
10275
  },
10273
10276
  {
10274
10277
  id: "issue.done",
10275
- command: "rudder issue done <issue> --comment <text> [--image <path>]",
10278
+ command: "rudder issue done <issue> --comment-file <path> [--image <path>]",
10276
10279
  category: "issue",
10277
10280
  description: "Mark an issue done with a required completion comment, optionally uploading images.",
10278
10281
  mutating: true,
@@ -10284,7 +10287,7 @@ var AGENT_CLI_CAPABILITIES = [
10284
10287
  },
10285
10288
  {
10286
10289
  id: "issue.block",
10287
- command: "rudder issue block <issue> --comment <text> [--image <path>]",
10290
+ command: "rudder issue block <issue> --comment-file <path> [--image <path>]",
10288
10291
  category: "issue",
10289
10292
  description: "Mark an issue blocked with a required blocker comment, optionally uploading images.",
10290
10293
  mutating: true,
@@ -10659,10 +10662,17 @@ function registerIssueCommands(program) {
10659
10662
  { includeCompany: false }
10660
10663
  );
10661
10664
  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 <text>", "Optional comment to add with update").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) => {
10665
+ 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 <text>", "Optional comment to add with update").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
10666
  try {
10664
10667
  const ctx = resolveCommandContext(opts);
10665
- const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
10668
+ const commentText = await resolveTextInput({
10669
+ text: opts.comment,
10670
+ file: opts.commentFile,
10671
+ textOption: "--comment",
10672
+ fileOption: "--comment-file",
10673
+ required: false
10674
+ });
10675
+ const comment = await appendUploadedIssueImages(ctx, issueId, commentText, opts.image);
10666
10676
  const payload = updateIssueSchema.parse({
10667
10677
  title: opts.title,
10668
10678
  description: opts.description,
@@ -10685,10 +10695,17 @@ function registerIssueCommands(program) {
10685
10695
  })
10686
10696
  );
10687
10697
  addCommonClientOptions(
10688
- issue.command("comment").description(getAgentCliCapabilityById("issue.comment").description).argument("<issueId>", "Issue ID").requiredOption("--body <text>", "Comment body").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) => {
10698
+ issue.command("comment").description(getAgentCliCapabilityById("issue.comment").description).argument("<issueId>", "Issue ID").option("--body <text>", "Comment body").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
10699
  try {
10690
10700
  const ctx = resolveCommandContext(opts);
10691
- const body = await appendUploadedIssueImages(ctx, issueId, opts.body, opts.image);
10701
+ const bodyText = await resolveTextInput({
10702
+ text: opts.body,
10703
+ file: opts.bodyFile,
10704
+ textOption: "--body",
10705
+ fileOption: "--body-file",
10706
+ required: true
10707
+ });
10708
+ const body = await appendUploadedIssueImages(ctx, issueId, bodyText, opts.image);
10692
10709
  const payload = addIssueCommentSchema.parse({
10693
10710
  body,
10694
10711
  reopen: opts.reopen
@@ -10707,13 +10724,20 @@ function registerIssueCommands(program) {
10707
10724
  issue.command("review").description(getAgentCliCapabilityById("issue.review").description).argument("<issueId>", "Issue ID").requiredOption(
10708
10725
  "--decision <decision>",
10709
10726
  "Review decision: approve, request_changes, needs_followup, or blocked"
10710
- ).requiredOption("--comment <text>", "Required review comment").action(async (issueId, opts) => {
10727
+ ).option("--comment <text>", "Required review comment").option("--comment-file <path>", "Read required review comment from a file, or '-' for stdin").action(async (issueId, opts) => {
10711
10728
  try {
10712
10729
  const ctx = resolveCommandContext(opts);
10713
10730
  const decision = parseReviewDecision(opts.decision);
10731
+ const comment = await resolveTextInput({
10732
+ text: opts.comment,
10733
+ file: opts.commentFile,
10734
+ textOption: "--comment",
10735
+ fileOption: "--comment-file",
10736
+ required: true
10737
+ });
10714
10738
  const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
10715
10739
  reviewDecision: decision,
10716
- comment: opts.comment
10740
+ comment
10717
10741
  });
10718
10742
  printOutput(updated, { json: ctx.json });
10719
10743
  } catch (err) {
@@ -10741,10 +10765,17 @@ function registerIssueCommands(program) {
10741
10765
  })
10742
10766
  );
10743
10767
  addCommonClientOptions(
10744
- issue.command("done").description(getAgentCliCapabilityById("issue.done").description).argument("<issueId>", "Issue ID").requiredOption("--comment <text>", "Required completion comment").option("--image <path>", "Image file to upload and append to the completion comment; may be repeated", collectImagePath, []).action(async (issueId, opts) => {
10768
+ issue.command("done").description(getAgentCliCapabilityById("issue.done").description).argument("<issueId>", "Issue ID").option("--comment <text>", "Required completion comment").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
10769
  try {
10746
10770
  const ctx = resolveCommandContext(opts);
10747
- const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
10771
+ const commentText = await resolveTextInput({
10772
+ text: opts.comment,
10773
+ file: opts.commentFile,
10774
+ textOption: "--comment",
10775
+ fileOption: "--comment-file",
10776
+ required: true
10777
+ });
10778
+ const comment = await appendUploadedIssueImages(ctx, issueId, commentText, opts.image);
10748
10779
  const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
10749
10780
  status: "done",
10750
10781
  comment
@@ -10756,10 +10787,17 @@ function registerIssueCommands(program) {
10756
10787
  })
10757
10788
  );
10758
10789
  addCommonClientOptions(
10759
- issue.command("block").description(getAgentCliCapabilityById("issue.block").description).argument("<issueId>", "Issue ID").requiredOption("--comment <text>", "Required blocker comment").option("--image <path>", "Image file to upload and append to the blocker comment; may be repeated", collectImagePath, []).action(async (issueId, opts) => {
10790
+ issue.command("block").description(getAgentCliCapabilityById("issue.block").description).argument("<issueId>", "Issue ID").option("--comment <text>", "Required blocker comment").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
10791
  try {
10761
10792
  const ctx = resolveCommandContext(opts);
10762
- const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
10793
+ const commentText = await resolveTextInput({
10794
+ text: opts.comment,
10795
+ file: opts.commentFile,
10796
+ textOption: "--comment",
10797
+ fileOption: "--comment-file",
10798
+ required: true
10799
+ });
10800
+ const comment = await appendUploadedIssueImages(ctx, issueId, commentText, opts.image);
10763
10801
  const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
10764
10802
  status: "blocked",
10765
10803
  comment
@@ -10902,6 +10940,35 @@ function collectNonEmptyOption(optionName) {
10902
10940
  return [...previous, trimmed];
10903
10941
  };
10904
10942
  }
10943
+ async function resolveTextInput(opts) {
10944
+ const hasText = opts.text !== void 0;
10945
+ const hasFile = opts.file !== void 0;
10946
+ if (hasText && hasFile) {
10947
+ throw new Error(`Use either ${opts.textOption} or ${opts.fileOption}, not both`);
10948
+ }
10949
+ if (hasText) return opts.text;
10950
+ if (hasFile) return readTextInputFile(opts.file, opts.fileOption);
10951
+ if (opts.required) {
10952
+ throw new Error(`Provide ${opts.textOption} <text> or ${opts.fileOption} <path>; use ${opts.fileOption} - for stdin`);
10953
+ }
10954
+ return void 0;
10955
+ }
10956
+ async function readTextInputFile(inputPath, optionName) {
10957
+ if (inputPath === "-") {
10958
+ return readStdinText();
10959
+ }
10960
+ const resolvedPath = path16.resolve(process.cwd(), inputPath);
10961
+ return readFile4(resolvedPath, "utf8").catch((err) => {
10962
+ throw new Error(`Unable to read ${optionName} ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
10963
+ });
10964
+ }
10965
+ async function readStdinText() {
10966
+ const chunks = [];
10967
+ for await (const chunk of process.stdin) {
10968
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
10969
+ }
10970
+ return Buffer.concat(chunks).toString("utf8");
10971
+ }
10905
10972
  async function resolveIssueLabelIds(ctx, opts) {
10906
10973
  const explicitIds = opts.labelId ?? [];
10907
10974
  const names = opts.label ?? [];