replicas-cli 0.2.42 → 0.2.43

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.
@@ -8238,6 +8238,214 @@ var ENTERPRISE_PLAN = PLANS.enterprise;
8238
8238
  var WORKSPACE_FILE_UPLOAD_MAX_SIZE_BYTES = 20 * 1024 * 1024;
8239
8239
  var WORKSPACE_FILE_CONTENT_MAX_SIZE_BYTES = 1 * 1024 * 1024;
8240
8240
 
8241
+ // ../shared/src/user-message-parser/parsers.ts
8242
+ function parseCIFailure(content) {
8243
+ if (!content.startsWith("# CI/CD Workflow Failed")) return null;
8244
+ const prMatch = content.match(/Pull Request #(\d+)/);
8245
+ const workflowNameMatch = content.match(/\*\*Workflow Name:\*\*\s*(.+)/);
8246
+ const workflowFileMatch = content.match(/\*\*Workflow File:\*\*\s*(.+)/);
8247
+ const conclusionMatch = content.match(/\*\*Conclusion:\*\*\s*(.+)/);
8248
+ const runUrlMatch = content.match(/\*\*Run URL:\*\*\s*(.+)/);
8249
+ const conclusionTextMatch = content.match(
8250
+ /has (failed|timed out|requires action|was cancelled|failed to start)/
8251
+ );
8252
+ if (!prMatch) return null;
8253
+ return {
8254
+ source: "ci_failure",
8255
+ prNumber: parseInt(prMatch[1], 10),
8256
+ workflowName: workflowNameMatch?.[1]?.trim() ?? "Unknown",
8257
+ workflowFile: workflowFileMatch?.[1]?.trim() ?? "",
8258
+ conclusion: conclusionMatch?.[1]?.trim() ?? "failure",
8259
+ runUrl: runUrlMatch?.[1]?.trim() ?? "",
8260
+ conclusionText: conclusionTextMatch?.[1] ?? "failed"
8261
+ };
8262
+ }
8263
+ function parseGitHubIssueNew(content) {
8264
+ const headerMatch = content.match(/^# Task: GitHub Issue #(\d+) - (.+)$/m);
8265
+ if (!headerMatch) return null;
8266
+ const issueNumber = parseInt(headerMatch[1], 10);
8267
+ const issueTitle = headerMatch[2].trim();
8268
+ const descMatch = content.match(/## Issue Description\n([\s\S]*?)(?=\n## |$)/);
8269
+ const triggerMatch = content.match(
8270
+ /## Triggering Comment from @(\S+)\n([\s\S]*?)(?=\n## |$)/
8271
+ );
8272
+ return {
8273
+ source: "github_issue_new",
8274
+ issueNumber,
8275
+ issueTitle,
8276
+ issueDescription: descMatch?.[1]?.trim() ?? "",
8277
+ triggeringUser: triggerMatch?.[1] ?? "",
8278
+ triggeringComment: triggerMatch?.[2]?.trim() ?? ""
8279
+ };
8280
+ }
8281
+ function parseGitHubIssueExisting(content) {
8282
+ const headerMatch = content.match(
8283
+ /^You received a new comment on GitHub Issue #(\d+)\./
8284
+ );
8285
+ if (!headerMatch) return null;
8286
+ const issueNumber = parseInt(headerMatch[1], 10);
8287
+ const commentMatch = content.match(
8288
+ /Comment from @(\S+):\n([\s\S]*?)(?=\nIMPORTANT INSTRUCTIONS:)/
8289
+ );
8290
+ return {
8291
+ source: "github_issue_existing",
8292
+ issueNumber,
8293
+ commentUser: commentMatch?.[1] ?? "",
8294
+ commentBody: commentMatch?.[2]?.trim() ?? ""
8295
+ };
8296
+ }
8297
+ function parseGitHubPRNew(content) {
8298
+ const headerMatch = content.match(
8299
+ /^# Task: Review and work on Pull Request #(\d+)/m
8300
+ );
8301
+ if (!headerMatch) return null;
8302
+ const prNumber = parseInt(headerMatch[1], 10);
8303
+ const contextMatch = content.match(
8304
+ /@(\S+) mentioned @tryreplicas.*?\n\n>([\s\S]*?)(?=\n## Your Assignment)/
8305
+ );
8306
+ let contextMessage = "";
8307
+ if (contextMatch) {
8308
+ contextMessage = contextMatch[2].split("\n").map((line) => line.replace(/^>\s?/, "")).join("\n").trim();
8309
+ }
8310
+ return {
8311
+ source: "github_pr_new",
8312
+ prNumber,
8313
+ mentioningUser: contextMatch?.[1] ?? "",
8314
+ contextMessage
8315
+ };
8316
+ }
8317
+ function parseGitHubPRExistingPRReview(content) {
8318
+ const headerMatch = content.match(
8319
+ /^You received a pull request review on PR #(\d+)\./m
8320
+ );
8321
+ if (!headerMatch) return null;
8322
+ const prNumber = parseInt(headerMatch[1], 10);
8323
+ const actionMatch = content.match(
8324
+ /@(\S+)\s+(APPROVED the pull request|REQUESTED CHANGES on the pull request|left a review comment on the pull request|had their review dismissed)/
8325
+ );
8326
+ const commentMatch = content.match(
8327
+ /Comment from @\S+:\n([\s\S]*?)(?=\nIMPORTANT INSTRUCTIONS:)/
8328
+ );
8329
+ let commentBody = commentMatch?.[1]?.trim() ?? "";
8330
+ if (!commentBody) {
8331
+ const bodyMatch = content.match(
8332
+ /reviewed the pull request\.\n([\s\S]*?)(?=\nIMPORTANT INSTRUCTIONS:)/
8333
+ );
8334
+ commentBody = bodyMatch?.[1]?.trim() ?? "";
8335
+ }
8336
+ return {
8337
+ source: "github_pr_existing_pr_review",
8338
+ prNumber,
8339
+ reviewUser: actionMatch?.[1] ?? "",
8340
+ reviewAction: actionMatch?.[2] ?? "reviewed the pull request",
8341
+ commentBody
8342
+ };
8343
+ }
8344
+ function parseGitHubPRExistingReview(content) {
8345
+ const headerMatch = content.match(
8346
+ /^You received a comment on Pull Request #(\d+)\./m
8347
+ );
8348
+ if (!headerMatch) return null;
8349
+ const fileMatch = content.match(/\nFile: (.+)/);
8350
+ const diffMatch = content.match(/\nDiff context:\n```diff\n([\s\S]*?)```/);
8351
+ if (!fileMatch || !diffMatch) return null;
8352
+ const prNumber = parseInt(headerMatch[1], 10);
8353
+ const commentMatch = content.match(
8354
+ /Comment from @(\S+):\n([\s\S]*?)(?=\nIMPORTANT INSTRUCTIONS:)/
8355
+ );
8356
+ return {
8357
+ source: "github_pr_existing_review",
8358
+ prNumber,
8359
+ commentUser: commentMatch?.[1] ?? "",
8360
+ commentBody: commentMatch?.[2]?.trim() ?? "",
8361
+ filePath: fileMatch[1].trim(),
8362
+ diffHunk: diffMatch[1].trim()
8363
+ };
8364
+ }
8365
+ function parseGitHubPRExistingGeneral(content) {
8366
+ const headerMatch = content.match(
8367
+ /^You received a comment on Pull Request #(\d+)\./m
8368
+ );
8369
+ if (!headerMatch) return null;
8370
+ const prNumber = parseInt(headerMatch[1], 10);
8371
+ const commentMatch = content.match(
8372
+ /Comment from @(\S+):\n([\s\S]*?)(?=\nIMPORTANT INSTRUCTIONS:)/
8373
+ );
8374
+ return {
8375
+ source: "github_pr_existing_general",
8376
+ prNumber,
8377
+ commentUser: commentMatch?.[1] ?? "",
8378
+ commentBody: commentMatch?.[2]?.trim() ?? ""
8379
+ };
8380
+ }
8381
+ function parseSlackTask(content) {
8382
+ if (!content.startsWith("# Task from Slack")) return null;
8383
+ const targetMatch = content.match(/## Workspace Target\nWorking in: (.+)/);
8384
+ const threadMatch = content.match(
8385
+ /## Thread Context\n([\s\S]*?)(?=\n## Latest Message)/
8386
+ );
8387
+ const latestMatch = content.match(
8388
+ /## Latest Message \(mentions you\)\n@(.+?): ([\s\S]*?)(?=\n## Response Instructions)/
8389
+ );
8390
+ return {
8391
+ source: "slack_task",
8392
+ workspaceTarget: targetMatch?.[1]?.trim() ?? "",
8393
+ threadContext: threadMatch?.[1]?.trim() ?? "",
8394
+ latestMessageUser: latestMatch?.[1]?.trim() ?? "",
8395
+ latestMessageText: latestMatch?.[2]?.trim() ?? ""
8396
+ };
8397
+ }
8398
+ function parseLinearIssue(content) {
8399
+ const headerMatch = content.match(/^# Task: ([A-Z]+-\d+) - (.+)$/m);
8400
+ if (!headerMatch) return null;
8401
+ if (content.includes("GitHub Issue #")) return null;
8402
+ if (content.includes("Pull Request #")) return null;
8403
+ const identifier = headerMatch[1];
8404
+ const title = headerMatch[2].trim();
8405
+ let parentIssue;
8406
+ const parentMatch = content.match(
8407
+ /## Parent Issue\n\*\*([A-Z]+-\d+)\*\*: (.+)\n\n([\s\S]*?)(?=\n## |$)/
8408
+ );
8409
+ if (parentMatch) {
8410
+ parentIssue = {
8411
+ identifier: parentMatch[1],
8412
+ title: parentMatch[2].trim(),
8413
+ description: parentMatch[3].trim()
8414
+ };
8415
+ }
8416
+ const descMatch = content.match(/## Description\n([\s\S]*?)(?=\n## |$)/);
8417
+ const description = descMatch?.[1]?.trim() ?? "";
8418
+ const contextMatch = content.match(
8419
+ /## Additional Context\n([\s\S]*?)(?=\n## |$)/
8420
+ );
8421
+ const additionalContext = contextMatch?.[1]?.trim() ?? "";
8422
+ return {
8423
+ source: "linear_issue",
8424
+ identifier,
8425
+ title,
8426
+ parentIssue,
8427
+ description,
8428
+ additionalContext
8429
+ };
8430
+ }
8431
+ function parseUserMessage(rawContent) {
8432
+ const content = removeReplicasInstructions(rawContent).trim();
8433
+ return parseCIFailure(content) ?? parseGitHubIssueNew(content) ?? parseGitHubIssueExisting(content) ?? parseGitHubPRNew(content) ?? parseGitHubPRExistingPRReview(content) ?? parseGitHubPRExistingReview(content) ?? parseGitHubPRExistingGeneral(content) ?? parseSlackTask(content) ?? parseLinearIssue(content) ?? { source: "raw", content };
8434
+ }
8435
+
8436
+ // ../shared/src/user-message-parser/source-config.ts
8437
+ var SOURCE_CONFIG = {
8438
+ ci_failure: { label: "CI Failure", color: "#ff4444" },
8439
+ linear_issue: { label: "Linear", color: "#5E6AD2" },
8440
+ github_issue_new: { label: "GitHub Issue", color: "#8b949e" },
8441
+ github_issue_existing: { label: "GitHub Issue", color: "#8b949e" },
8442
+ github_pr_new: { label: "GitHub PR", color: "#8b949e" },
8443
+ github_pr_existing_review: { label: "Code Review", color: "#8b949e" },
8444
+ github_pr_existing_pr_review: { label: "PR Review", color: "#8b949e" },
8445
+ github_pr_existing_general: { label: "GitHub PR", color: "#8b949e" },
8446
+ slack_task: { label: "Slack", color: "#BF6CC2" }
8447
+ };
8448
+
8241
8449
  export {
8242
8450
  readConfig,
8243
8451
  writeConfig,
@@ -8258,6 +8466,8 @@ export {
8258
8466
  createUserMessage,
8259
8467
  isAgentBackendEvent,
8260
8468
  filterDisplayMessages,
8469
+ parseUserMessage,
8470
+ SOURCE_CONFIG,
8261
8471
  buildGroups,
8262
8472
  createMockWorkspaceRecord
8263
8473
  };
package/dist/index.mjs CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  setIdeCommand,
16
16
  setOrganizationId,
17
17
  writeConfig
18
- } from "./chunk-IO4QHXPW.mjs";
18
+ } from "./chunk-D6VVVHKH.mjs";
19
19
 
20
20
  // src/index.ts
21
21
  import "dotenv/config";
@@ -1855,12 +1855,12 @@ async function interactiveCommand() {
1855
1855
  );
1856
1856
  }
1857
1857
  console.log(chalk17.gray("Starting interactive mode..."));
1858
- const { launchInteractive } = await import("./interactive-M3UR4H6X.mjs");
1858
+ const { launchInteractive } = await import("./interactive-OMBUCSHJ.mjs");
1859
1859
  await launchInteractive();
1860
1860
  }
1861
1861
 
1862
1862
  // src/index.ts
1863
- var CLI_VERSION = "0.2.42";
1863
+ var CLI_VERSION = "0.2.43";
1864
1864
  var program = new Command();
1865
1865
  program.name("replicas").description("CLI for managing Replicas workspaces").version(CLI_VERSION);
1866
1866
  program.command("login").description("Authenticate with your Replicas account").action(async () => {