From c1c3e09a8e94490904e5d5fcaa0d4a730d3ae57a Mon Sep 17 00:00:00 2001 From: Lauren ten Hoor Date: Tue, 10 Feb 2026 21:11:37 +0800 Subject: [PATCH] feat: update issue creation to return issue object instead of raw output --- lib/task-managers/gitlab.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/task-managers/gitlab.ts b/lib/task-managers/gitlab.ts index 93e6ab6..b25de8a 100644 --- a/lib/task-managers/gitlab.ts +++ b/lib/task-managers/gitlab.ts @@ -73,7 +73,7 @@ export class GitLabProvider implements TaskManager { const { promisify } = await import("node:util"); const execAsync = promisify(exec); - let cmd = `glab issue create --title "${title.replace(/"/g, '\\"')}" --description "$(cat ${tempFile})" --label "${label}" --output json`; + let cmd = `glab issue create --title "${title.replace(/"/g, '\\"')}" --description "$(cat ${tempFile})" --label "${label}"`; if (assignees && assignees.length > 0) { cmd += ` --assignee "${assignees.join(",")}"`; } @@ -82,7 +82,13 @@ export class GitLabProvider implements TaskManager { cwd: this.repoPath, timeout: 30_000, }); - return JSON.parse(stdout.trim()) as Issue; + // glab issue create returns the issue URL (e.g. https://gitlab.com/owner/repo/-/issues/42) + const match = stdout.trim().match(/\/issues\/(\d+)/); + if (!match) { + throw new Error(`Failed to parse issue number from created issue URL: ${stdout.trim()}`); + } + const issueId = parseInt(match[1], 10); + return this.getIssue(issueId); } finally { // Clean up temp file try {