@rudderhq/cli 0.2.0-canary.27 → 0.2.0-canary.29

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
@@ -1476,7 +1476,7 @@ var init_project = __esm({
1476
1476
 
1477
1477
  // ../packages/shared/src/validators/issue.ts
1478
1478
  import { z as z13 } from "zod";
1479
- var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
1479
+ var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, reportIssueCommitSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
1480
1480
  var init_issue = __esm({
1481
1481
  "../packages/shared/src/validators/issue.ts"() {
1482
1482
  "use strict";
@@ -1563,6 +1563,14 @@ var init_issue = __esm({
1563
1563
  reopen: z13.boolean().optional(),
1564
1564
  interrupt: z13.boolean().optional()
1565
1565
  });
1566
+ reportIssueCommitSchema = z13.object({
1567
+ sha: z13.string().trim().regex(/^[0-9a-f]{7,64}$/i, "Commit SHA must be 7 to 64 hexadecimal characters"),
1568
+ message: z13.string().trim().min(1).max(500),
1569
+ branch: z13.string().trim().min(1).max(255).optional().nullable(),
1570
+ repoPath: z13.string().trim().min(1).max(2048).optional().nullable(),
1571
+ workspacePath: z13.string().trim().min(1).max(2048).optional().nullable(),
1572
+ commitCount: z13.number().int().positive().max(1e3).optional()
1573
+ });
1566
1574
  linkIssueApprovalSchema = z13.object({
1567
1575
  approvalId: z13.string().uuid()
1568
1576
  });
@@ -7270,11 +7278,13 @@ var ApiRequestError = class extends Error {
7270
7278
  var RudderApiClient = class {
7271
7279
  apiBase;
7272
7280
  apiKey;
7281
+ agentId;
7273
7282
  runId;
7274
7283
  recoverAuth;
7275
7284
  constructor(opts) {
7276
7285
  this.apiBase = opts.apiBase.replace(/\/+$/, "");
7277
7286
  this.apiKey = opts.apiKey?.trim() || void 0;
7287
+ this.agentId = opts.agentId?.trim() || void 0;
7278
7288
  this.runId = opts.runId?.trim() || void 0;
7279
7289
  this.recoverAuth = opts.recoverAuth;
7280
7290
  }
@@ -7323,8 +7333,13 @@ var RudderApiClient = class {
7323
7333
  if (this.apiKey) {
7324
7334
  headers.authorization = `Bearer ${this.apiKey}`;
7325
7335
  }
7326
- if (this.runId && shouldAttachRunId(init.method)) {
7327
- headers["x-rudder-run-id"] = this.runId;
7336
+ if (shouldAttachAgentContext(init.method)) {
7337
+ if (this.agentId) {
7338
+ headers["x-rudder-agent-id"] = this.agentId;
7339
+ }
7340
+ if (this.runId) {
7341
+ headers["x-rudder-run-id"] = this.runId;
7342
+ }
7328
7343
  }
7329
7344
  const response = await fetch(url, {
7330
7345
  ...init,
@@ -7358,7 +7373,7 @@ var RudderApiClient = class {
7358
7373
  return safeParseJson(text6);
7359
7374
  }
7360
7375
  };
7361
- function shouldAttachRunId(method) {
7376
+ function shouldAttachAgentContext(method) {
7362
7377
  const normalized = String(method ?? "GET").toUpperCase();
7363
7378
  return normalized !== "GET" && normalized !== "HEAD";
7364
7379
  }
@@ -7433,6 +7448,7 @@ function resolveCommandContext(options, opts) {
7433
7448
  const api = new RudderApiClient({
7434
7449
  apiBase,
7435
7450
  apiKey,
7451
+ agentId,
7436
7452
  runId,
7437
7453
  recoverAuth: explicitApiKey || !canAttemptInteractiveBoardAuth() ? void 0 : async ({ error }) => {
7438
7454
  const requestedAccess = error.message.includes("Instance admin required") ? "instance_admin_required" : "board";
@@ -9396,6 +9412,18 @@ var AGENT_CLI_CAPABILITIES = [
9396
9412
  requiresRunId: false,
9397
9413
  attachesRunIdWhenAvailable: true
9398
9414
  },
9415
+ {
9416
+ id: "issue.commit",
9417
+ command: "rudder issue commit <issue> --sha <sha> --message <subject>",
9418
+ category: "issue",
9419
+ description: "Report a code commit created during issue work as structured issue activity.",
9420
+ mutating: true,
9421
+ contract: "agent-v1",
9422
+ requiresOrgId: false,
9423
+ requiresAgentId: false,
9424
+ requiresRunId: false,
9425
+ attachesRunIdWhenAvailable: true
9426
+ },
9399
9427
  {
9400
9428
  id: "issue.done",
9401
9429
  command: "rudder issue done <issue> --comment <text> [--image <path>]",
@@ -9818,6 +9846,25 @@ function registerIssueCommands(program) {
9818
9846
  }
9819
9847
  })
9820
9848
  );
9849
+ addCommonClientOptions(
9850
+ issue.command("commit").description(getAgentCliCapabilityById("issue.commit").description).argument("<issueId>", "Issue ID").requiredOption("--sha <sha>", "Commit SHA").requiredOption("--message <subject>", "Commit subject or message").option("--branch <name>", "Branch name").option("--repo-path <path>", "Repository path").option("--workspace-path <path>", "Workspace path").option("--count <n>", "Number of commits represented by this report").action(async (issueId, opts) => {
9851
+ try {
9852
+ const ctx = resolveCommandContext(opts);
9853
+ const payload = reportIssueCommitSchema.parse({
9854
+ sha: opts.sha,
9855
+ message: opts.message,
9856
+ branch: opts.branch,
9857
+ repoPath: opts.repoPath,
9858
+ workspacePath: opts.workspacePath,
9859
+ commitCount: parseOptionalInt(opts.count)
9860
+ });
9861
+ const reported = await ctx.api.post(`/api/issues/${issueId}/commit`, payload);
9862
+ printOutput(reported, { json: ctx.json });
9863
+ } catch (err) {
9864
+ handleCommandError(err);
9865
+ }
9866
+ })
9867
+ );
9821
9868
  addCommonClientOptions(
9822
9869
  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) => {
9823
9870
  try {
@@ -10144,12 +10191,18 @@ var RUDDER_AGENT_OPERATING_CONTRACT = [
10144
10191
  "- Shared organization workspace root lives under `$RUDDER_ORG_WORKSPACE_ROOT`.",
10145
10192
  "- Shared organization skills live under `$RUDDER_ORG_SKILLS_DIR`.",
10146
10193
  "- Shared organization plans live under `$RUDDER_ORG_PLANS_DIR`.",
10194
+ "- Shared organization artifacts live under `$RUDDER_ORG_ARTIFACTS_DIR`.",
10195
+ "- Durable generated outputs such as screenshots, images, mockups, reports, CSVs, handoff logs, and other user-visible files should be written under `$RUDDER_ORG_ARTIFACTS_DIR` when available.",
10196
+ "- Use `/tmp` only for transient scratch files and temporary verification artifacts; do not put durable work product there.",
10197
+ "- Local trusted runtimes may expose the host operator home as `$RUDDER_OPERATOR_HOME`; use it only when a local skill or script intentionally needs operator-owned desktop app or CLI state. Do not replace `$HOME` with it.",
10147
10198
  "- Durable shared work output should prefer these managed workspace paths instead of ad-hoc top-level `projects/` folders.",
10148
10199
  "",
10149
10200
  "When you create or copy a skill under `$AGENT_HOME/skills/<slug>/`, check the agent's Skills snapshot before claiming it will load in future runs. If it is installed but not enabled, say exactly that future runs will not load it until enabled, and offer to enable it with `rudder agent skills enable <agent-id> <selection-ref>` when you have permission.",
10150
10201
  "",
10151
10202
  "When you write issue comments or chat replies, match the language of the user's or board's most recent substantive message unless they explicitly ask for a different language.",
10152
10203
  "",
10204
+ "When an issue comment, done comment, or blocker comment cites visual evidence from a local screenshot/image path, attach the image with the Rudder CLI `--image <path>` option instead of leaving only the filesystem path in the text.",
10205
+ "",
10153
10206
  "## Memory and Planning",
10154
10207
  "",
10155
10208
  "You MUST use the `para-memory-files` skill for all memory operations: storing facts, writing daily notes, creating entities, running weekly synthesis, recalling past context, and managing plans. The skill defines your three-layer memory system (knowledge graph, daily notes, tacit knowledge), the PARA folder structure, atomic fact schemas, memory decay rules, and recall/planning conventions.",