-
Notifications
You must be signed in to change notification settings - Fork 12.3k
feat(extensions): add bundled github extension for taskstoissues
#4488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Yash-Chindam
wants to merge
6
commits into
github:main
Choose a base branch
from
Yash-Chindam:feat/4421-github-extension
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e4ccdf1
feat(extensions): add bundled github extension for taskstoissues (#4421)
Yash-Chindam 676b2b9
test(github): cover every integration and pin behaviour parity with core
Yash-Chindam 7e6b67b
fix(github): correct JSON escaping and cp1252 text output in vendored…
Yash-Chindam d397c96
fix(github): repair the json_escape test harness and re-sync with core
Yash-Chindam 0d91825
test(github): add PowerShell resolver parity tests; move core-command…
Yash-Chindam d1559e2
fix(github): address Copilot review on tools, JSON encoding, uninstal…
Yash-Chindam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # GitHub Integration Extension | ||
|
|
||
| This bundled, **opt-in** extension is the home for Spec Kit's GitHub *platform* functionality. Today it provides one command, `speckit.github.taskstoissues`, which turns a feature's `tasks.md` into dependency-ordered GitHub issues. | ||
|
|
||
| > NOTE: `git` and `github` are deliberately separate domains. The [`git` extension](../git/README.md) owns local version-control workflow (feature branches, commits, remote detection); this extension owns interactions with the GitHub platform itself. | ||
|
|
||
| ## Why an extension? | ||
|
|
||
| Creating GitHub issues is provider-specific project management, not part of the provider-neutral Spec-Driven Development lifecycle. Keeping it in a dedicated, opt-in extension lets users: | ||
|
|
||
| - **Choose whether to install it at all** — `specify init` does **not** install it. | ||
| - **Use a different issue tracker** without having to work around a GitHub-specific core command. | ||
| - **Depend on a stable, namespaced command** from other extensions. | ||
|
|
||
| ## Installation | ||
|
|
||
| From the root of an initialized Spec Kit project: | ||
|
|
||
| ```bash | ||
| specify extension add github | ||
| ``` | ||
|
|
||
| ## Removal | ||
|
|
||
| ```bash | ||
| specify extension remove github | ||
|
|
||
| # Or keep it installed but inert | ||
| specify extension disable github | ||
| specify extension enable github | ||
| ``` | ||
|
|
||
| ## Commands | ||
|
|
||
| | Command | Description | | ||
| | ------------------------------ | -------------------------------------------------------------------- | | ||
| | `speckit.github.taskstoissues` | Convert tasks from `tasks.md` into dependency-ordered GitHub issues. | | ||
|
|
||
| > NOTE: The command ID above is canonical. Invoke it using the syntax for your integration: `/speckit.github.taskstoissues` for dot-command integrations; `/speckit-github-taskstoissues` for hyphen/skills integrations (including Forge and Cline); `$speckit-github-taskstoissues` for Codex, ZCode, or Command Code in skills mode; or `/skill:speckit-github-taskstoissues` for Kimi. | ||
|
|
||
| ### What the command does | ||
|
|
||
| 1. Resolves the active feature and loads its `tasks.md` (via this extension's own `resolve-tasks` script — see [Scripts](#scripts)). | ||
| 2. Reads the Git remote and **stops unless it points at GitHub**. | ||
| 3. Lists existing repository issues — open *and* closed — and matches their titles against the task IDs in `tasks.md` (`\bT\d{3,}\b`, so four-digit and longer IDs are handled). | ||
| 4. Creates issues titled `T001: <description>` only for task IDs that do not already have one, in the repository identified by the remote. | ||
|
|
||
| ## Hooks | ||
|
|
||
| This extension consumes the existing `before_taskstoissues` and `after_taskstoissues` hook points, which are read from `.specify/extensions.yml` at run time. The hook keys are unchanged from the core command, so hooks registered by other extensions — for example the `git` extension's auto-commit hooks — keep firing exactly as before. | ||
|
|
||
| ## Requirements | ||
|
|
||
| - A Git remote pointing at GitHub. | ||
| - The **GitHub MCP server** available to your coding agent, providing the `list_issues` and `issue_write` tools. | ||
|
|
||
| > NOTE: Agents without MCP support (for example the Pi Coding Agent out of the box) cannot run this command as intended. | ||
|
|
||
| ## Scripts | ||
|
|
||
| The extension ships its own feature-resolution script in all three supported runtimes, so it is self-contained and does not reach into core: | ||
|
|
||
| | Runtime | Script | | ||
| | ---------- | ---------------------------------------- | | ||
| | Bash | `scripts/bash/resolve-tasks.sh` | | ||
| | PowerShell | `scripts/powershell/resolve-tasks.ps1` | | ||
| | Python | `scripts/python/resolve_tasks.py` | | ||
|
|
||
| Once installed they live under `.specify/extensions/github/scripts/`. The script is a trimmed twin of core's `check-prerequisites`: it resolves the project root and active feature directory, requires `tasks.md`, and reports the design docs alongside it. It performs none of core's `plan.md`/`spec.md` gating, and it never writes `.specify/feature.json`. | ||
|
|
||
| ## Migrating from the core `taskstoissues` command | ||
|
|
||
| Spec Kit is moving GitHub issue tracking out of core in three stages: | ||
|
|
||
| 1. **Now** — this extension is available, and the core `/speckit.taskstoissues` command remains available and unchanged. Nothing breaks if you do nothing. | ||
| 2. **Next** — the core command is deprecated once the replacement has been available for a release. | ||
| 3. **Later** — the core command is removed in a minor release. | ||
|
|
||
| To migrate, install the extension and use the namespaced command instead: | ||
|
|
||
| ```bash | ||
| specify extension add github | ||
| ``` | ||
|
|
||
| | Before | After | | ||
| | ------------------------- | --------------------------------- | | ||
| | `/speckit.taskstoissues` | `/speckit.github.taskstoissues` | | ||
|
|
||
| Issue creation is unchanged: the same remote validation, the same deduplication across open and closed issues, the same issue titles, and the same hook contract. Feature resolution differs in one way: this extension does not require `plan.md` (see [Scripts](#scripts)), so it can run on a feature where the core command would stop. This extension does **not** register `speckit.taskstoissues` as an alias, so the two commands coexist without shadowing each other while the core command still exists. |
106 changes: 106 additions & 0 deletions
106
extensions/github/commands/speckit.github.taskstoissues.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| --- | ||
| description: Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts. | ||
| tools: ['github/github-mcp-server/list_issues', 'github/github-mcp-server/issue_write'] | ||
| scripts: | ||
| sh: scripts/bash/resolve-tasks.sh --json | ||
| ps: scripts/powershell/resolve-tasks.ps1 -Json | ||
| py: scripts/python/resolve_tasks.py --json | ||
| --- | ||
|
|
||
| ## User Input | ||
|
|
||
| ```text | ||
| $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.yml` exists in the project root. | ||
| - If it exists, read it and look for entries under the `hooks.before_taskstoissues` key | ||
| - If the YAML cannot be parsed or is invalid, do not skip silently: tell the user that `.specify/extensions.yml` could not be read (include the parser error) and that no hooks were checked, including any mandatory (`optional: false`) hooks registered there, then continue normally | ||
| - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default. | ||
| - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions: | ||
| - If the hook has no `condition` field, 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 | ||
| - For each executable hook, output the following based on its `optional` flag: | ||
| - **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. | ||
| ``` | ||
| After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook. | ||
| - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently | ||
|
|
||
| ## Outline | ||
|
|
||
| 1. Run `{SCRIPT}` from repo root and parse FEATURE_DIR, TASKS and the 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"). | ||
| 1. **IF EXISTS**: Load `/memory/constitution.md` for project principles and governance constraints. | ||
| 1. From the executed script, extract the path to **tasks** (the `TASKS` value). | ||
| 1. Get the Git remote by running: | ||
|
|
||
| ```bash | ||
| 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, build the set of task IDs you are about to process from `tasks.md` (each is a `T` followed by **at least** three digits, e.g. `T001` — `__SPECKIT_COMMAND_CONVERGE__` assigns new IDs with `T{M+1:03d}`, which is a floor rather than a cap, so once a file has more than 999 tasks the IDs are four digits or longer). Then use the GitHub MCP server's `list_issues` tool to look for issues that already cover those IDs. 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, request pages with the `after` parameter (using the `endCursor` from the previous response). For each issue title, match it against the task ID pattern `\bT\d{3,}\b` (the `{3,}` accepts four-digit and longer IDs — with `\d{3}` a title containing `T1000` would not match at all, because the trailing `\b` cannot fall between two digits, so that task would be silently neither deduplicated nor created; word boundaries still stop a token like `ST001` from matching, and force the whole digit run to be consumed so `T100` can never match inside `T1000`; this also recognises titles written as `T001 ...`, `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 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: <description>`, 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] | ||
| > 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_taskstoissues` key | ||
| - If the YAML cannot be parsed or is invalid, do not skip silently: tell the user that `.specify/extensions.yml` could not be read (include the parser error) and that no hooks were checked, including any mandatory (`optional: false`) hooks registered there, then continue normally | ||
| - Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default. | ||
| - For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions: | ||
| - If the hook has no `condition` field, 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 | ||
| - For each executable hook, output the following based on its `optional` flag: | ||
| - **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} | ||
| ``` | ||
| After emitting the block above you MUST actually invoke the hook and wait for it to finish before continuing. Run it the same way you would run the command yourself in this agent/session (the invocation may differ from the literal `{command}` id shown above, e.g. a skills-mode agent runs it as `/skill:speckit-...` or `$speckit-...`). Emitting the block alone does not run the hook. | ||
| - If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| schema_version: "1.0" | ||
|
|
||
| extension: | ||
| id: github | ||
| name: "GitHub Integration" | ||
| version: "1.0.0" | ||
| description: "GitHub platform integration for Spec Kit - create GitHub issues from a feature's task list" | ||
| author: spec-kit-core | ||
| repository: https://github.com/github/spec-kit | ||
| license: MIT | ||
|
|
||
| requires: | ||
| speckit_version: ">=0.2.0" | ||
| tools: | ||
| - name: git | ||
| required: true | ||
| description: "Reads the origin remote to find the target GitHub repository" | ||
| - name: github-mcp-server | ||
| required: true | ||
| description: "Provides the list_issues and issue_write tools" | ||
| install_url: "https://github.com/github/github-mcp-server" | ||
|
|
||
| provides: | ||
| commands: | ||
| - name: speckit.github.taskstoissues | ||
| file: commands/speckit.github.taskstoissues.md | ||
| description: "Convert tasks from tasks.md into dependency-ordered GitHub issues" | ||
|
|
||
| tags: | ||
| - "github" | ||
| - "issues" | ||
| - "integration" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.