From 1c0099a147801e692c4e5f3500ead3c109686072 Mon Sep 17 00:00:00 2001 From: Quratulain-bilal Date: Tue, 16 Jun 2026 16:48:42 +0500 Subject: [PATCH 1/4] fix(taskstoissues): skip tasks that already have a GitHub issue Re-running /speckit-taskstoissues created a duplicate issue for every task because the command never checked for existing ones. Add a deduplication step before issue creation: list the repo's issues (state all) via the GitHub MCP server, collect the task IDs already present in issue titles, and skip any task that already has a matching issue. Issue titles are now prefixed with the task ID (e.g. T001:) so they can be matched on later runs, and list_issues is added to the command's MCP tools. Fixes #2968 --- templates/commands/taskstoissues.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/commands/taskstoissues.md b/templates/commands/taskstoissues.md index b24e84ee14..79e7658c49 100644 --- a/templates/commands/taskstoissues.md +++ b/templates/commands/taskstoissues.md @@ -1,6 +1,6 @@ --- description: Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts. -tools: ['github/github-mcp-server/issue_write'] +tools: ['github/github-mcp-server/list_issues', 'github/github-mcp-server/issue_write'] scripts: sh: scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks ps: scripts/powershell/check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks @@ -62,7 +62,10 @@ git config --get remote.origin.url > [!CAUTION] > ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL -1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. +1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues with state `all`, so both open and closed issues are covered. Build a set of task IDs that already have an issue by extracting the leading task ID (e.g. `T001`) from each issue title. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. +1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Prefix the issue title with the task ID so it can be matched on later runs (for example, `T001: Create project structure`). + - **Skip** any task whose ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has issue #42 — skipping`). + - Only create issues for tasks that do not yet have a matching issue. > [!CAUTION] > UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL From f66c7e4c37aead1a605c87b7b28b19dfaeb6a519 Mon Sep 17 00:00:00 2001 From: Quratulain-bilal Date: Wed, 17 Jun 2026 11:22:51 +0500 Subject: [PATCH 2/4] fix(taskstoissues): correct list_issues usage and issue title format Address Copilot review: - list_issues has no 'all' state; omitting state returns both open and closed issues. Use cursor-based pagination (after/endCursor) to fetch every page before building the dedup set. - task lines already start with their ID, so reuse the task text as the issue title instead of prefixing the ID again (which produced 'T001: T001 ...'). --- templates/commands/taskstoissues.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/commands/taskstoissues.md b/templates/commands/taskstoissues.md index 79e7658c49..2ac997d679 100644 --- a/templates/commands/taskstoissues.md +++ b/templates/commands/taskstoissues.md @@ -62,9 +62,9 @@ git config --get remote.origin.url > [!CAUTION] > ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL -1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues with state `all`, so both open and closed issues are covered. Build a set of task IDs that already have an issue by extracting the leading task ID (e.g. `T001`) from each issue title. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. -1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Prefix the issue title with the task ID so it can be matched on later runs (for example, `T001: Create project structure`). - - **Skip** any task whose ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has issue #42 — skipping`). +1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues. Do not pass a `state` value — when it is omitted the tool returns both open and closed issues. The tool uses cursor-based pagination, so keep requesting pages with the `after` parameter (using the `endCursor` from the previous response) until all issues have been fetched. Build a set of task IDs that already have an issue by extracting the leading task ID (e.g. `T001`) from the start of each issue title. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. +1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Task lines already begin with their ID, so use the task text itself as the issue title (for example, a task `T001 Create project structure` becomes the issue title `T001 Create project structure`). Do not add a second copy of the ID. + - **Skip** any task whose leading ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has an issue, skipping`). - Only create issues for tasks that do not yet have a matching issue. > [!CAUTION] From 40238b34d14f0809d9993b1f8357a4e1b6ea76b7 Mon Sep 17 00:00:00 2001 From: Quratulain-bilal Date: Wed, 17 Jun 2026 21:01:29 +0500 Subject: [PATCH 3/4] fix(taskstoissues): match task IDs anywhere in titles and define one canonical title Address follow-up Copilot review: - task lines start with a markdown checkbox (- [ ] T001 ...), so the creation step now strips the checkbox and [P]/[US#] markers and writes a single canonical title 'T001: '. - dedup now scans each issue title for a T token anywhere in the title, so existing issues titled 'T001 ...', 'T001: ...' or '[T001] ...' are all matched. --- templates/commands/taskstoissues.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/commands/taskstoissues.md b/templates/commands/taskstoissues.md index 2ac997d679..0c4e46b14a 100644 --- a/templates/commands/taskstoissues.md +++ b/templates/commands/taskstoissues.md @@ -62,9 +62,9 @@ git config --get remote.origin.url > [!CAUTION] > ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL -1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues. Do not pass a `state` value — when it is omitted the tool returns both open and closed issues. The tool uses cursor-based pagination, so keep requesting pages with the `after` parameter (using the `endCursor` from the previous response) until all issues have been fetched. Build a set of task IDs that already have an issue by extracting the leading task ID (e.g. `T001`) from the start of each issue title. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. -1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Task lines already begin with their ID, so use the task text itself as the issue title (for example, a task `T001 Create project structure` becomes the issue title `T001 Create project structure`). Do not add a second copy of the ID. - - **Skip** any task whose leading ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has an issue, skipping`). +1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues. Do not pass a `state` value, since omitting it makes the tool return both open and closed issues. The tool uses cursor-based pagination, so keep requesting pages with the `after` parameter (using the `endCursor` from the previous response) until all issues have been fetched. Build a set of task IDs that already have an issue by scanning each issue title for a task ID token (the pattern `T` followed by digits, e.g. `T001`) anywhere in the title, so titles written as `T001 ...`, `T001: ...` or `[T001] ...` are all matched. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. +1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Task lines in `tasks.md` start with a markdown checkbox, so first strip the leading `- [ ]` (and any `[P]` / `[US#]` markers) to recover the task ID and its description. Create the issue with a single canonical title of the form `T001: `, with the ID written once followed by the task description (for example, the line `- [ ] T001 Create project structure` becomes the title `T001: Create project structure`). + - **Skip** any task whose ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has an issue, skipping`). - Only create issues for tasks that do not yet have a matching issue. > [!CAUTION] From a920e7873079caa36f456d32c1eb996681e55f8a Mon Sep 17 00:00:00 2001 From: Quratulain-bilal Date: Thu, 18 Jun 2026 03:29:13 +0500 Subject: [PATCH 4/4] fix(taskstoissues): use word-boundary task ID match and request perPage 100 Address Copilot review: - match issue titles against \bT\d{3}\b so tokens like ST001 or T0010 are not matched by mistake (task IDs are T + 3 digits). - request perPage: 100 on list_issues to reduce pagination calls. --- templates/commands/taskstoissues.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/commands/taskstoissues.md b/templates/commands/taskstoissues.md index 0c4e46b14a..459c559302 100644 --- a/templates/commands/taskstoissues.md +++ b/templates/commands/taskstoissues.md @@ -62,7 +62,7 @@ git config --get remote.origin.url > [!CAUTION] > ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL -1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues. Do not pass a `state` value, since omitting it makes the tool return both open and closed issues. The tool uses cursor-based pagination, so keep requesting pages with the `after` parameter (using the `endCursor` from the previous response) until all issues have been fetched. Build a set of task IDs that already have an issue by scanning each issue title for a task ID token (the pattern `T` followed by digits, e.g. `T001`) anywhere in the title, so titles written as `T001 ...`, `T001: ...` or `[T001] ...` are all matched. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. +1. **Fetch existing issues for deduplication**: Before creating anything, use the GitHub MCP server's `list_issues` tool to list the repository's issues. Do not pass a `state` value, since omitting it makes the tool return both open and closed issues. Request `perPage: 100` to keep the number of calls down, and since the tool uses cursor-based pagination, keep requesting pages with the `after` parameter (using the `endCursor` from the previous response) until all issues have been fetched. Build a set of task IDs that already have an issue by matching each issue title against the task ID pattern `\bT\d{3}\b` (a `T` followed by three digits, on word boundaries so tokens like `ST001` or `T0010` are not matched by mistake). Using a boundary-aware match means titles written as `T001 ...`, `T001: ...` or `[T001] ...` are all recognised. This prevents duplicate issues when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. 1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Task lines in `tasks.md` start with a markdown checkbox, so first strip the leading `- [ ]` (and any `[P]` / `[US#]` markers) to recover the task ID and its description. Create the issue with a single canonical title of the form `T001: `, with the ID written once followed by the task description (for example, the line `- [ ] T001 Create project structure` becomes the title `T001: Create project structure`). - **Skip** any task whose ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has an issue, skipping`). - Only create issues for tasks that do not yet have a matching issue.