Skip to content

feat: make GitHub Issues a first-class task source#28

Merged
SiyuQian merged 3 commits intoSiyuQian:mainfrom
wzai-1:feat/github-issues-first-class
Mar 12, 2026
Merged

feat: make GitHub Issues a first-class task source#28
SiyuQian merged 3 commits intoSiyuQian:mainfrom
wzai-1:feat/github-issues-first-class

Conversation

@wzai-1
Copy link
Contributor

@wzai-1 wzai-1 commented Mar 12, 2026

Summary

The GitHub Issues backend was already fully implemented in the taskrunner package (GitHubSource, TaskSource interface, --source flag on devpilot run), but it was essentially invisible to users:

  • The README didn't document --source for devpilot run at all (only devpilot sync showed it)
  • Trello was listed as a hard prerequisite, even though GitHub Issues requires no extra accounts
  • devpilot init had no awareness of the GitHub source — it always walked users through Trello setup and flagged missing Trello credentials even if they had chosen GitHub
  • GitHub Issues have no native ordering — the original implementation returned issues in an unspecified order within each priority tier, making execution non-deterministic

This PR closes all four gaps.

Changes

1. Documentation (README)

  • Rewrite tagline and How It Works to present GitHub Issues alongside Trello
  • Move Trello to an optional prerequisite (only needed for the Trello source)
  • Add a GitHub Issues Quick Start section (placed first — lower friction path)
  • Fix devpilot run flags table--source was completely absent; now the first row
  • Document the two-key execution order for GitHub Issues (priority → creation time)
  • Update Task Runner Workflow and Architecture to reflect the TaskSource abstraction

2. Deterministic GitHub Issues ordering (taskrunner)

GitHub Issues have no native queue order, which makes automated scheduling unpredictable. Fixed with a two-key sort:

Key Rule
Priority P0 → P1 → P2 (default P2 when no priority label)
Creation time Older issue runs first within the same priority (FIFO)

Implementation:

  • source.go: add CreatedAt int64 to Task
  • github_source.go: fetch createdAt from GitHub API; pass --search 'sort:created-asc' so the API returns issues oldest-first before client-side sorting
  • priority.go: SortByPriority now uses CreatedAt as a tiebreaker; when CreatedAt is zero (Trello tasks), stable-sort order is preserved — no behaviour change for existing Trello users
  • New tests: TestSortByPriority_CreatedAtTiebreaker, TestSortByPriority_CreatedAtWithPriority, TestSortByPriority_ZeroCreatedAtPreservesOrder, TestGitHubSource_CreatedAtPropagated

3. devpilot init GitHub Issues support (initcmd)

  • Ask "Task source (trello/github)" before the board/credentials step
  • New ConfigureGitHubSource(): writes source: github to .devpilot.yaml and runs gh label create --force for all required labels (devpilot, in-progress, failed, P0-critical, P1-high, P2-normal)
  • formatStatus(): shows "Task source: GitHub Issues" instead of Trello warnings when source is github
  • allConfigured(): a GitHub-configured project is fully set up without Trello credentials
  • New tests: TestFormatStatusGitHub, expanded TestAllConfigured

Test results

go test ./...   # all packages pass

No logic changes to the runner itself — GitHubSource, the TaskSource interface, and the --source routing in commands.go are untouched beyond the ordering fix.


Happy to adjust anything — thanks for building DevPilot! 🙏

wzai-1 added 3 commits March 12, 2026 04:30
The GitHub Issues backend was already fully implemented in the
taskrunner package (GitHubSource, TaskSource interface, --source flag),
but it was essentially invisible: the README didn't document it for
'devpilot run', Trello was listed as a hard prerequisite, and
'devpilot init' had no awareness of it.

This commit closes that gap so developers who already use GitHub can
start using DevPilot without signing up for Trello.

Changes:
- README: rewrite tagline, How It Works, and Prerequisites to present
  GitHub Issues alongside Trello; add a GitHub Issues Quick Start
  section; fix 'devpilot run' flags table which was missing --source
  entirely; update Task Runner Workflow and Architecture sections to
  reflect the TaskSource abstraction.

- initcmd/detect.go: populate Status.Source from .devpilot.yaml so
  the rest of the wizard can be source-aware.

- initcmd/generate.go: add ConfigureGitHubSource() which writes
  source=github to .devpilot.yaml and runs 'gh label create --force'
  for all required labels (devpilot, in-progress, failed, P0-critical,
  P1-high, P2-normal).

- initcmd/commands.go: update the init wizard to ask "Task source
  (trello/github)" before the board step; update formatStatus() and
  allConfigured() to be source-aware so GitHub-configured projects
  don't show spurious Trello warnings.

- initcmd/commands_test.go: add TestFormatStatusGitHub and expand
  TestAllConfigured to cover the github source path; all existing
  tests continue to pass.
GitHub Issues have no native queue order, which makes automated
scheduling non-deterministic. Fix with a two-key sort:

  1. Priority  (P0 > P1 > P2; default P2)
  2. CreatedAt (older issue runs first — FIFO within same priority)

Changes:
- taskrunner/source.go: add CreatedAt int64 field to Task
- taskrunner/github_source.go: fetch createdAt from GitHub API;
  pass --search 'sort:created-asc' so the API returns issues
  oldest-first before client-side sorting applies
- taskrunner/priority.go: upgrade SortByPriority to use CreatedAt
  as a secondary sort key; zero value (Trello tasks) falls back to
  stable-sort-preserved original order — no behaviour change for
  existing Trello users
- taskrunner/priority_test.go: add four new test cases covering the
  tiebreaker, priority-beats-age, and zero-CreatedAt cases
- taskrunner/github_source_test.go: verify CreatedAt is propagated
  from ghIssue to Task
- README: document the two-key sort under the GitHub Issues workflow
- README: use 'gh issue create --body-file' instead of '--body "$(cat ...)"'
  to avoid shell quoting issues with special characters in plan files

- initcmd/commands.go: tighten source-selection logic — only ask
  'Task source?' when source is truly unset in config; if source is
  already set to 'trello' respect it and go straight to board setup;
  'github' branch unchanged (still skipped via early guard)

- initcmd/detect_test.go: add TestDetectSource covering the new
  Status.Source field for empty config, github, and trello cases
@wzai-1
Copy link
Contributor Author

wzai-1 commented Mar 12, 2026

Hey @SiyuQian 👋 — would love your review on this when you have a moment!

This PR makes GitHub Issues a proper first-class citizen alongside Trello. The backend was already there (GitHubSource, TaskSource interface, --source flag) — the main gaps were that devpilot run's flags table was missing --source entirely, devpilot init had no GitHub awareness, and GitHub Issues' lack of native ordering made execution non-deterministic. This PR addresses all three.

No changes to the runner core or any existing Trello behaviour — should be safe to merge. Happy to iterate on anything you'd like to change! 🙏

@SiyuQian
Copy link
Owner

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@SiyuQian SiyuQian merged commit e2d3395 into SiyuQian:main Mar 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants