This ticket covers the implementation of the "pull" half of the synchronization process. The SyncService will be enhanced to fetch all issues and their comments from GitHub, compare them against the local metadata, and write the content to local Markdown files.
This includes the intelligent archiving logic to keep the issue directories organized.
Acceptance Criteria
- The
SyncService.runFullSync() method is implemented to orchestrate the pull process.
- A private method,
#pullFromGitHub(), is created to contain the core logic.
- The service uses
gh issue list --state all to fetch all issues.
- For each issue, it compares the
updated_at timestamp with the one stored in .sync-metadata.json.
- If the remote issue is newer (or not present locally), the service uses
gh issue view <N> --comments to get the full conversation.
- A
#formatIssueMarkdown() method is created, using the gray-matter library to generate a .md file with YAML frontmatter and inlined comments.
- A
#getIssuePath() method is implemented to determine the correct local path for an issue (.github/ISSUES/ for open, .github/ISSUE_ARCHIVE/<version>/ for closed).
- The service correctly writes the generated Markdown to the appropriate path, creating directories as needed.
- After a successful pull, the
.sync-metadata.json file is updated with the new last_sync time and the latest state for each issue.
Benefits
- Populates the local repository with a complete, queryable history of all GitHub issues.
- Automates the organization and archiving of closed issues.
- Creates the foundation for the AI Knowledge Base to consume issue data.
This ticket covers the implementation of the "pull" half of the synchronization process. The
SyncServicewill be enhanced to fetch all issues and their comments from GitHub, compare them against the local metadata, and write the content to local Markdown files.This includes the intelligent archiving logic to keep the issue directories organized.
Acceptance Criteria
SyncService.runFullSync()method is implemented to orchestrate the pull process.#pullFromGitHub(), is created to contain the core logic.gh issue list --state allto fetch all issues.updated_attimestamp with the one stored in.sync-metadata.json.gh issue view <N> --commentsto get the full conversation.#formatIssueMarkdown()method is created, using thegray-matterlibrary to generate a.mdfile with YAML frontmatter and inlined comments.#getIssuePath()method is implemented to determine the correct local path for an issue (.github/ISSUES/for open,.github/ISSUE_ARCHIVE/<version>/for closed)..sync-metadata.jsonfile is updated with the newlast_synctime and the latest state for each issue.Benefits