[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78DEE9D566DSTRQCYCFE47N":3,"skill-same:01M78DEE9D566DSTRQCYCFE47N":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M78DEE9D566DSTRQCYCFE47N","codesync-github-integration",null,"Deep guide on GitHub Git Trees REST API, batched GraphQL sync queries, authentic ISO 8601 timestamps, rate limiting, and zero-client-secret OAuth.","pardeep1916P\u002FcodeSync","pardeep1916P","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F168327487?v=4","01M78DE87WVVWDH8M849ATQ25Y","Devanaboyina Charan Chaitanya","01M78DE890X74HPFK91EMX91W5",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fcodesync-github-integration\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: codesync-github-integration\ndescription: Deep guide on GitHub Git Trees REST API, batched GraphQL sync queries, authentic ISO 8601 timestamps, rate limiting, and zero-client-secret OAuth.\n---\n\n# CodeSync GitHub API & Git Trees Integration Guide\n\nUse this skill when modifying GitHub API communication, commit generation, branch updating, or OAuth authentication in `src\u002Fgithub\u002F`.\n\n---\n\n## 1. Atomic Multi-File Commits via Git Trees API\n\nCodeSync never uses the single-file Contents API (`PUT \u002Frepos\u002Fcontents`). Instead, it uses the low-level **Git Data API** to execute atomic multi-file commits:\n\n```mermaid\nsequenceDiagram\n    participant Queue as CommitQueue\n    participant GH as GitHubClient\n    participant API as GitHub REST API\n\n    Queue->>GH: commitTree(repo, payload, options)\n    GH->>API: POST \u002Frepos\u002F{owner}\u002F{repo}\u002Fgit\u002Ftrees\u003Cbr\u002F>(base_tree + files array)\n    API-->>GH: tree_sha\n    GH->>API: POST \u002Frepos\u002F{owner}\u002F{repo}\u002Fgit\u002Fcommits\u003Cbr\u002F>(tree_sha, parents, explicit author\u002Fcommitter dates)\n    API-->>GH: new_commit_sha\n    GH->>API: PATCH \u002Frepos\u002F{owner}\u002F{repo}\u002Fgit\u002Frefs\u002Fheads\u002F{branch}\u003Cbr\u002F>(sha: new_commit_sha)\n    API-->>GH: 200 OK (ref updated)\n    GH-->>Queue: success\n```\n\n### Git Tree Payload Construction\n```typescript\nconst tree = files.map((file) => ({\n  path: file.path,\n  mode: '100644', \u002F\u002F Standard file mode\n  type: 'blob',\n  content: file.content, \u002F\u002F Inline content (\u003C 100 KB) avoids creating separate blobs\n}));\n\nconst treeRes = await this.request\u003C{ sha: string }>(\n  `\u002Frepos\u002F${owner}\u002F${repo}\u002Fgit\u002Ftrees`,\n  {\n    method: 'POST',\n    body: JSON.stringify({ base_tree: baseTreeSha, tree }),\n  }\n);\n```\n\n---\n\n## 2. Authentic Historical Timestamps Invariant\n\nTo accurately populate the user's GitHub contribution graph for historical solves, **BOTH** `author.date` and `committer.date` must be explicitly defined using the original solve timestamp:\n\n```typescript\nconst isoDate = new Date(submission.timestamp).toISOString();\n\nconst commitPayload = {\n  message: `[CodeSync] Solved: ${submission.problem.title} (${submission.language})`,\n  tree: treeSha,\n  parents: [parentCommitSha],\n  author: {\n    name: user.name || user.login,\n    email: user.email || `${user.login}@users.noreply.github.com`,\n    date: isoDate, \u002F\u002F Explicit ISO 8601\n  },\n  committer: {\n    name: user.name || user.login,\n    email: user.email || `${user.login}@users.noreply.github.com`,\n    date: isoDate, \u002F\u002F Must match author.date\n  },\n};\n```\n\n---\n\n## 3. High-Performance Batched GraphQL Sync Context\n\nRather than making 5 separate REST calls to retrieve the branch reference, parent commit SHA, base tree SHA, `README.md`, and `stats.json`, `GitHubClient.fetchSyncContext()` combines everything into a single GraphQL query:\n\n```graphql\nquery getSyncContext($owner: String!, $name: String!, $branch: String!) {\n  repository(owner: $owner, name: $name) {\n    ref(qualifiedName: $branch) {\n      target {\n        oid\n        ... on Commit {\n          tree {\n            oid\n          }\n        }\n      }\n    }\n    readme: object(expression: \"HEAD:README.md\") {\n      ... on Blob { text }\n    }\n    stats: object(expression: \"HEAD:stats.json\") {\n      ... on Blob { text }\n    }\n  }\n}\n```\n\n*Note: If the GraphQL endpoint returns errors (e.g. empty repository or missing scopes), the client transparently falls back to individual REST requests.*\n\n---\n\n## 4. Chained Commit SHAs & Race Condition Mitigation\n\nWhen syncing multiple queued submissions sequentially, GitHub's internal database replicas experience brief propagation delays. Reading the head ref immediately after a commit often returns the *old* SHA, leading to HTTP 409 fast-forward conflicts.\n\n**The Solution:**\nCodeSync keeps the returned `commit_sha` in memory and passes it directly as the `parentCommitSha` for the next commit in the batch, completely bypassing ref polling during batch commits.\n\n---\n\n## 5. Zero-Client-Secret Universal OAuth Architecture\n\nExtensions must **never** bundle the GitHub OAuth App Client Secret. CodeSync uses a serverless OAuth proxy (`codesync-oauth` deployed on Cloudflare Workers):\n\n```\n[Browser Extension]             [GitHub OAuth]             [Cloudflare OAuth Proxy]\n       │                               │                              │\n       │─── 1. chrome.identity ────────>                              │\n       │    (launchWebAuthFlow)        │                              │\n       │                               │                              │\n       │─── 2. User Authorizes ────────>                              │\n       │                               │                              │\n       │\u003C── 3. Redirect with ?code ────┘                              │\n       │                                                              │\n       │─── 4. POST \u002Ftoken { code, state } ───────────────────────────>\n       │                                                              │─── 5. POST \u002Flogin\u002Foauth\u002Faccess_token\n       │                                                              │    (Injects Client Secret safely)\n       │\u003C── 6. Returns encrypted access_token ────────────────────────┘\n```\n\n---\n\n## 6. Rate Limiting & Backoff Strategy\n\n`GitHubClient` intercepts HTTP 429 and 403 rate-limit responses:\n```typescript\nif (response.status === 429 || response.status >= 500) {\n  const retryAfter = response.headers.get('Retry-After');\n  const delayMs = retryAfter ? parseInt(retryAfter, 10) * 1000 : (attempt + 1) * 1000;\n  await this.sleep(delayMs);\n  continue; \u002F\u002F Retry with exponential delay\n}\n```\nIf primary rate limits are exhausted, `x-ratelimit-reset` is parsed to provide the user with the exact reset time.\n","# CodeSync GitHub API & Git Trees Integration Guide\n\nUse this skill when modifying GitHub API communication, commit generation, branch updating, or OAuth authentication in `src\u002Fgithub\u002F`.\n\n---\n\n## 1. Atomic Multi-File Commits via Git Trees API\n\nCodeSync never uses the single-file Contents API (`PUT \u002Frepos\u002Fcontents`). Instead, it uses the low-level **Git Data API** to execute atomic multi-file commits:\n\n```mermaid\nsequenceDiagram\n    participant Queue as CommitQueue\n    participant GH as GitHubClient\n    participant API as GitHub REST API\n\n    Queue->>GH: commitTree(repo, payload, options)\n    GH->>API: POST \u002Frepos\u002F{owner}\u002F{repo}\u002Fgit\u002Ftrees\u003Cbr\u002F>(base_tree + files array)\n    API-->>GH: tree_sha\n    GH->>API: POST \u002Frepos\u002F{owner}\u002F{repo}\u002Fgit\u002Fcommits\u003Cbr\u002F>(tree_sha, parents, explicit author\u002Fcommitter dates)\n    API-->>GH: new_commit_sha\n    GH->>API: PATCH \u002Frepos\u002F{owner}\u002F{repo}\u002Fgit\u002Frefs\u002Fheads\u002F{branch}\u003Cbr\u002F>(sha: new_commit_sha)\n    API-->>GH: 200 OK (ref updated)\n    GH-->>Queue: success\n```\n\n### Git Tree Payload Construction\n```typescript\nconst tree = files.map((file) => ({\n  path: file.path,\n  mode: '100644', \u002F\u002F Standard file mode\n  type: 'blob',\n  content: file.content, \u002F\u002F Inline content (\u003C 100 KB) avoids creating separate blobs\n}));\n\nconst treeRes = await this.request\u003C{ sha: string }>(\n  `\u002Frepos\u002F${owner}\u002F${repo}\u002Fgit\u002Ftrees`,\n  {\n    method: 'POST',\n    body: JSON.stringify({ base_tree: baseTreeSha, tree }),\n  }\n);\n```\n\n---\n\n## 2. Authentic Historical Timestamps Invariant\n\nTo accurately populate the user's GitHub contribution graph for historical solves, **BOTH** `author.date` and `committer.date` must be explicitly defined using the original solve timestamp:\n\n```typescript\nconst isoDate = new Date(submission.timestamp).toISOString();\n\nconst commitPayload = {\n  message: `[CodeSync] Solved: ${submission.problem.title} (${submission.language})`,\n  tree: treeSha,\n  parents: [parentCommitSha],\n  author: {\n    name: user.name || user.login,\n    email: user.email || `${user.login}@users.noreply.github.com`,\n    date: isoDate, \u002F\u002F Explicit ISO 8601\n  },\n  committer: {\n    name: user.name || user.login,\n    email: user.email || `${user.login}@users.noreply.github.com`,\n    date: isoDate, \u002F\u002F Must match author.date\n  },\n};\n```\n\n---\n\n## 3. High-Performance Batched GraphQL Sync Context\n\nRather than making 5 separate REST calls to retrieve the branch reference, parent commit SHA, base tree SHA, `README.md`, and `stats.json`, `GitHubClient.fetchSyncContext()` combines everything into a single GraphQL query:\n\n```graphql\nquery getSyncContext($owner: String!, $name: String!, $branch: String!) {\n  repository(owner: $owner, name: $name) {\n    ref(qualifiedName: $branch) {\n      target {\n        oid\n        ... on Commit {\n          tree {\n            oid\n          }\n        }\n      }\n    }\n    readme: object(expression: \"HEAD:README.md\") {\n      ... on Blob { text }\n    }\n    stats: object(expression: \"HEAD:stats.json\") {\n      ... on Blob { text }\n    }\n  }\n}\n```\n\n*Note: If the GraphQL endpoint returns errors (e.g. empty repository or missing scopes), the client transparently falls back to individual REST requests.*\n\n---\n\n## 4. Chained Commit SHAs & Race Condition Mitigation\n\nWhen syncing multiple queued submissions sequentially, GitHub's internal database replicas experience brief propagation delays. Reading the head ref immediately after a commit often returns the *old* SHA, leading to HTTP 409 fast-forward conflicts.\n\n**The Solution:**\nCodeSync keeps the returned `commit_sha` in memory and passes it directly as the `parentCommitSha` for the next commit in the batch, completely bypassing ref polling during batch commits.\n\n---\n\n## 5. Zero-Client-Secret Universal OAuth Architecture\n\nExtensions must **never** bundle the GitHub OAuth App Client Secret. CodeSync uses a serverless OAuth proxy (`codesync-oauth` deployed on Cloudflare Workers):\n\n```\n[Browser Extension]             [GitHub OAuth]             [Cloudflare OAuth Proxy]\n       │                               │                              │\n       │─── 1. chrome.identity ────────>                              │\n       │    (launchWebAuthFlow)        │                              │\n       │                               │                              │\n       │─── 2. User Authorizes ────────>                              │\n       │                               │                              │\n       │\u003C── 3. Redirect with ?code ────┘                              │\n       │                                                              │\n       │─── 4. POST \u002Ftoken { code, state } ───────────────────────────>\n       │                                                              │─── 5. POST \u002Flogin\u002Foauth\u002Faccess_token\n       │                                                              │    (Injects Client Secret safely)\n       │\u003C── 6. Returns encrypted access_token ────────────────────────┘\n```\n\n---\n\n## 6. Rate Limiting & Backoff Strategy\n\n`GitHubClient` intercepts HTTP 429 and 403 rate-limit responses:\n```typescript\nif (response.status === 429 || response.status >= 500) {\n  const retryAfter = response.headers.get('Retry-After');\n  const delayMs = retryAfter ? parseInt(retryAfter, 10) * 1000 : (attempt + 1) * 1000;\n  await this.sleep(delayMs);\n  continue; \u002F\u002F Retry with exponential delay\n}\n```\nIf primary rate limits are exhausted, `x-ratelimit-reset` is parsed to provide the user with the exact reset time.\n",{"name":5,"description":7},"main","f2a54fba6f9faab5c8991fc4a98973e74303f925",".agent\u002Fskills\u002Fcodesync-github-integration","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync","https:\u002F\u002Fpardeep1916p.github.io\u002FcodeSync\u002F","https:\u002F\u002Fgithub.com\u002Fpardeep1916P","https:\u002F\u002Fcharan-chaitanya-devanaboyina.vercel.app\u002F","2026-11-10 02:31:26",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add pardeep1916P\u002FcodeSync --skill codesync-github-integration",{"tool":38,"command":39},"bunx","bunx skills add pardeep1916P\u002FcodeSync --skill codesync-github-integration",{"tool":41,"command":42},"pnpm","pnpm dlx skills add pardeep1916P\u002FcodeSync --skill codesync-github-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fcodesync-github-integration\u002FSKILL.md",true,[],[47,55,62,69,76,83],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M78DFT64JJNAQR5TETTT7S5A","openspec-update-change","Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.","MIT","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fopenspec-update-change\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M78DFQNNEY55FD44WZAC85MS","openspec-sync-specs","Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fopenspec-sync-specs\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M78DFMM7Q03FQ00QRDB9KY53","openspec-propose","Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fopenspec-propose\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M78DFHBCWK1VE0GCKJ9FZC9T","openspec-explore","Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fopenspec-explore\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M78DFEZR53TXK69N8X00MBH3","openspec-archive-change","Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fopenspec-archive-change\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M78DFB8AXAA18VTCV22PYGG4","openspec-apply-change","Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.","https:\u002F\u002Fgithub.com\u002Fpardeep1916P\u002FcodeSync\u002Fblob\u002Fmain\u002F.agent\u002Fskills\u002Fopenspec-apply-change\u002FSKILL.md",[],[]]