mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 12:28:06 +08:00
* 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 * 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 ...'). * 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: <description>'. - dedup now scans each issue title for a T<digits> token anywhere in the title, so existing issues titled 'T001 ...', 'T001: ...' or '[T001] ...' are all matched. * 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. * fix(taskstoissues): bound issue pagination to the tasks being processed Address Copilot review: extract the task IDs from tasks.md first, then paginate list_issues only until every task ID has been matched (or pages run out), instead of fetching the repo's entire issue history. Keeps the call count bounded on repos with large issue backlogs.
5.9 KiB
5.9 KiB
description, tools, scripts
| description | tools | scripts | ||||||
|---|---|---|---|---|---|---|---|---|
| Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts. |
|
|
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Pre-Execution Checks
Check for extension hooks (before tasks-to-issues conversion):
- Check if
.specify/extensions.ymlexists in the project root. - If it exists, read it and look for entries under the
hooks.before_taskstoissueskey - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
- Filter out hooks where
enabledis explicitlyfalse. Treat hooks without anenabledfield as enabled by default. - For each remaining hook, do not attempt to interpret or evaluate hook
conditionexpressions:- If the hook has no
conditionfield, or it is null/empty, treat the hook as executable - If the hook defines a non-empty
condition, skip the hook and leave condition evaluation to the HookExecutor implementation
- If the hook has no
- For each executable hook, output the following based on its
optionalflag:- Optional hook (
optional: true):## Extension Hooks **Optional Pre-Hook**: {extension} Command: `/{command}` Description: {description} Prompt: {prompt} To execute: `/{command}` - Mandatory hook (
optional: false):## Extension Hooks **Automatic Pre-Hook**: {extension} Executing: `/{command}` EXECUTE_COMMAND: {command} Wait for the result of the hook command before proceeding to the Outline.
- Optional hook (
- If no hooks are registered or
.specify/extensions.ymldoes not exist, skip silently
Outline
- Run
{SCRIPT}from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'''m Groot' (or double-quote if possible: "I'm Groot"). - IF EXISTS: Load
/memory/constitution.mdfor project principles and governance constraints. - From the executed script, extract the path to tasks.
- Get the Git remote by running:
git config --get remote.origin.url
Caution
ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
- Fetch existing issues for deduplication: Before creating anything, build the set of task IDs you are about to process from
tasks.md(each is aTfollowed by three digits, e.g.T001). Then use the GitHub MCP server'slist_issuestool to look for issues that already cover those IDs. Do not pass astatevalue, since omitting it makes the tool return both open and closed issues. RequestperPage: 100to keep the number of calls down, and since the tool uses cursor-based pagination, request pages with theafterparameter (using theendCursorfrom the previous response). For each issue title, match it against the task ID pattern\bT\d{3}\b(word boundaries so tokens likeST001orT0010are not matched by mistake; this also recognises titles written asT001 ...,T001: ...or[T001] ...) and, when it matches one of your task IDs, mark that ID as already having an issue. Stop paginating as soon as every task ID has been matched, or when there are no more pages, so you do not keep fetching the whole repository's issue history once all task IDs are accounted for. This bounds the number of calls on repos with large issue histories and still prevents duplicates when the command is re-run aftertasks.mdis regenerated or the skill is re-invoked. - 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.mdstart 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 formT001: <description>, with the ID written once followed by the task description (for example, the line- [ ] T001 Create project structurebecomes the titleT001: 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.
- Skip any task whose ID is already present in the set of existing issues from the previous step, and report it (for example,
Caution
UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
Post-Execution Checks
Check for extension hooks (after tasks-to-issues conversion):
Check if .specify/extensions.yml exists in the project root.
- If it exists, read it and look for entries under the
hooks.after_taskstoissueskey - If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
- Filter out hooks where
enabledis explicitlyfalse. Treat hooks without anenabledfield as enabled by default. - For each remaining hook, do not attempt to interpret or evaluate hook
conditionexpressions:- If the hook has no
conditionfield, or it is null/empty, treat the hook as executable - If the hook defines a non-empty
condition, skip the hook and leave condition evaluation to the HookExecutor implementation
- If the hook has no
- For each executable hook, output the following based on its
optionalflag:- Optional hook (
optional: true):## Extension Hooks **Optional Hook**: {extension} Command: `/{command}` Description: {description} Prompt: {prompt} To execute: `/{command}` - Mandatory hook (
optional: false):## Extension Hooks **Automatic Hook**: {extension} Executing: `/{command}` EXECUTE_COMMAND: {command}
- Optional hook (
- If no hooks are registered or
.specify/extensions.ymldoes not exist, skip silently