Add gh-ext-issue-sync: GitHub CLI extension for syncing issues#1
Merged
Add gh-ext-issue-sync: GitHub CLI extension for syncing issues#1
Conversation
Set up the complete project skeleton for gh-ext-issue-sync: - Go module with cobra CLI (pull, push, status subcommands) - Internal packages for issue sync logic and frontmatter handling - Mise tasks for build, test, lint, check, setup - CI workflow (build + test + lint) and release workflow - Prettier config, editorconfig, gitignore matching nsheaps org patterns https://claude.ai/code/session_01QbMEyYmqunBE6ABt28GDka
- Pull fetches issues via gh API and writes markdown files with YAML frontmatter - Push reads local files and updates GitHub issues via PATCH - Status compares local files against remote and reports diffs - Frontmatter package handles marshal/unmarshal with round-trip tests - Supports --all flag for batch operations, --state filter, --dir for output https://claude.ai/code/session_01QbMEyYmqunBE6ABt28GDka
…ensive tests - Extract sync.Client interface to decouple commands from gh CLI, enabling testability - Fix order-dependent label/assignee comparison in status (now sorted) - Add milestone comparison to status command - Add milestone resolution in push (title -> number lookup) - Filter pull requests from issue listing (GitHub API returns PRs as issues) - Fix pagination: use --jq '.[]' with streaming JSON decoder for gh api --paginate - Add input validation (positive issue numbers, non-empty titles) - Add partial-failure handling in push --all (continues on errors, reports summary) - Add comprehensive tests: 18 test cases covering pull/push/status/validation - Test coverage: cmd 78.6%, frontmatter 82.6%, sync 18% (GH API calls untestable) https://claude.ai/code/session_01QbMEyYmqunBE6ABt28GDka
- README: why section, quick start, full command reference with flags table - README: file format spec with editable-field documentation - README: practical examples (bulk-close, add labels, git tracking) - README: development guide with project structure and architecture overview - CLAUDE.md: updated with architecture decisions and new file layout - LICENSE: MIT - CI: add coverage reporting to test step - mise/tasks/test: add -cover flag https://claude.ai/code/session_01QbMEyYmqunBE6ABt28GDka
Review iteration targeting categories below 85%:
Security (84 → 88):
- Add context timeouts (2min default, 5min for paginated) to all exec.Command calls
- Add state validation (must be "open" or "closed") on push
Usability (85 → 90):
- Make --all and issue number mutually exclusive (clear error instead of silent ignore)
- Add --dry-run flag to push command for safe preview
- Add status summary line ("All N issues in sync" or "N synced, N modified, N errors")
- Improve milestone resolution errors with list of available milestones
Test quality (80 → 85):
- Add push validation tests (invalid number, empty title, invalid state)
- Add dry-run test (verifies no API calls made)
- Add mutual exclusion tests for pull and push
Flexibility (82 → 86):
- Add milestone caching to avoid N API calls for batch pushes with same milestone
Documentation:
- Add Troubleshooting section to README (auth errors, milestone resolution, batch failures)
- Add Known Limitations section (no comments sync, no conflict detection, PR filtering)
- Add package-level doc comments to sync and frontmatter packages
https://claude.ai/code/session_01QbMEyYmqunBE6ABt28GDka
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces
gh-ext-issue-sync, a complete GitHub CLI extension that enables syncing GitHub issues to local markdown files with YAML frontmatter, and pushing local changes back to GitHub.Summary
The extension provides three main commands:
Issues are stored as markdown files with YAML frontmatter containing metadata (title, state, labels, assignees, milestone, etc.), allowing users to edit issues offline in their favorite editor, track changes in git, and perform bulk operations.
Key Changes
Core Architecture:
internal/sync/client.go: Client interface abstraction for testabilityinternal/sync/github.go: GHClient implementation usingghCLI for all GitHub operationsinternal/sync/issue.go: Issue and IssueFrontmatter typesinternal/sync/push.go: Push logic with milestone title-to-number resolution and cachingCommands:
cmd/root.go: Root command setup with injectable client for testingcmd/pull.go: Pull single or all issues with state filteringcmd/push.go: Push single or all issues with dry-run supportcmd/status.go: Compare local files against remote, showing modified/synced/missing issuesFile Format:
internal/frontmatter/frontmatter.go: Generic YAML frontmatter marshal/unmarshal for markdown filesTesting:
cmd/cmd_test.go: Comprehensive command tests using mock client (532 lines)internal/sync/github_test.go: API conversion testsinternal/sync/push_test.go: Push validation testsinternal/frontmatter/frontmatter_test.go: Frontmatter serialization testsBuild & CI:
mise.toml: Tool versions (Go 1.24, gh CLI, prettier)mise/tasks/: Build, test, lint, check tasks.github/workflows/ci.yaml: CI pipeline (build, test, coverage, lint).github/workflows/release.yaml: Release workflow with precompiled binariesDocumentation:
README.md: Comprehensive user guide with examples, file format spec, and development setupCLAUDE.md: Developer context and architecture notesNotable Implementation Details
--dry-runflag to preview changes without applying themhttps://claude.ai/code/session_01QbMEyYmqunBE6ABt28GDka