@opencode-linear-agent/server 0.1.3-master.13 → 0.1.3-master.14

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3876,7 +3876,10 @@ class WorktreeManager {
3876
3876
  });
3877
3877
  }
3878
3878
  buildWorktreeName(issue, linearSessionId) {
3879
- const safeIssue = issue.toLowerCase().replace(/[^a-z0-9-]/g, "-");
3879
+ if (issue.branchName) {
3880
+ return `${linearSessionId}/${issue.branchName}`;
3881
+ }
3882
+ const safeIssue = issue.identifier.toLowerCase().replace(/[^a-z0-9-]/g, "-");
3880
3883
  const sessionSuffix = linearSessionId.slice(0, 8).toLowerCase();
3881
3884
  return `${safeIssue}-${sessionSuffix}`;
3882
3885
  }
@@ -4229,8 +4232,21 @@ class LinearEventProcessor {
4229
4232
  async process(event) {
4230
4233
  const linearSessionId = event.agentSession.id;
4231
4234
  const issueId = event.agentSession.issue?.id ?? event.agentSession.issueId;
4232
- const issueIdentifier = event.agentSession.issue?.identifier ?? issueId ?? "unknown";
4233
- const log = Log.create({ service: "processor" }).tag("issue", issueIdentifier).tag("sessionId", linearSessionId);
4235
+ const fallbackIssueIdentifier = event.agentSession.issue?.identifier ?? issueId ?? "unknown";
4236
+ let issue = {
4237
+ identifier: fallbackIssueIdentifier,
4238
+ branchName: readStringField(event.agentSession.issue, "branchName") ?? undefined
4239
+ };
4240
+ if (issueId && !issue.branchName) {
4241
+ const issueResult = await this.linear.getIssue(issueId);
4242
+ if (Result.isOk(issueResult)) {
4243
+ issue = {
4244
+ identifier: issueResult.value.identifier,
4245
+ branchName: issueResult.value.branchName
4246
+ };
4247
+ }
4248
+ }
4249
+ const log = Log.create({ service: "processor" }).tag("issue", issue.identifier).tag("sessionId", linearSessionId);
4234
4250
  log.info("Processing event", { action: event.action });
4235
4251
  const action = this.toSessionWorktreeAction(event.action);
4236
4252
  if (!action) {
@@ -4239,7 +4255,7 @@ class LinearEventProcessor {
4239
4255
  });
4240
4256
  return;
4241
4257
  }
4242
- const worktreeResult = await this.worktreeManager.resolveWorktree(linearSessionId, issueIdentifier, action, log);
4258
+ const worktreeResult = await this.worktreeManager.resolveWorktree(linearSessionId, issue, action, log);
4243
4259
  if (Result.isError(worktreeResult)) {
4244
4260
  await this.linear.postError(linearSessionId, worktreeResult.error);
4245
4261
  return;
@@ -67053,6 +67069,7 @@ ${truncatedStack}
67053
67069
  return {
67054
67070
  id: issue.id,
67055
67071
  identifier: issue.identifier,
67072
+ branchName: issue.branchName ?? undefined,
67056
67073
  title: issue.title,
67057
67074
  description: issue.description ?? undefined,
67058
67075
  url: issue.url
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode-linear-agent/server",
3
- "version": "0.1.3-master.13",
3
+ "version": "0.1.3-master.14",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {