Sync .github files and ci-templates from shared-claude-code repository - detect language, present diffs, and copy files
Sync shared assets under .github/ (ISSUE_TEMPLATE, PULL_REQUEST_TEMPLATE, workflows) from the shared-claude-code repository to the current project using file copies. File copies are used because GitHub does not recognize symlinks.
Search for symlinks under .claude/rules/shared/ and .claude/skills/
Resolve the shared-claude-code repository path from the readlink result of found symlinks
../../../shared-claude-code/rules/conventions.md → extract shared-claude-code path../../shared-claude-code/skills/git-pr-create → extract shared-claude-code pathIf no symlinks are found → display error and exit:
エラー: shared-claude-codeへのシンボリックリンクが見つかりません。
最初のセットアップはREADMEの手順に従って手動で行ってください。
Verify that the .github/ directory exists at the resolved path
.github/ISSUE_TEMPLATE/, .github/PULL_REQUEST_TEMPLATE.md, and .github/workflows/ on the shared sidediff -q)If all files are identical → display the following and exit:
.github/ 配下のファイルはすべて同期済みです。
If differences exist, display status by category:
## .github 同期チェック
### ISSUE_TEMPLATE
- bug.yml — 同一 ✓
- chore.yml — ローカルに存在しない(新規追加)
- enhancement.yml — 差分あり
### PULL_REQUEST_TEMPLATE
- PULL_REQUEST_TEMPLATE.md — 差分あり
### workflows
- ci.yml — 差分あり
同期する項目を選択してください(例: 全て / ISSUE_TEMPLATEのみ)。
差分の詳細を確認したい場合はお知らせください。
If the user requests diff details → show the diff output
Determine sync targets based on the user's response:
.github/ISSUE_TEMPLATE/ and .github/workflows/ directories with mkdir -p if they do not exist. For PULL_REQUEST_TEMPLATE.md, ensure .github/ exists.cpdiff -q
Check whether the ci-templates/ directory exists in the shared repository. If it does not exist, skip this step.
Detect the project language/framework from the local project root:
package.json present → Node.js family. If dependencies.next or devDependencies.next is found → Next.jspyproject.toml or setup.py present → Pythongo.mod present → Goci-templates/ as additional candidatesPresent candidates and confirm with the user:
## CI テンプレート同期
推定フレームワーク: Next.js(package.json の dependencies.next を検出)
利用可能なテンプレート:
- nextjs(推奨)
同期するテンプレートを選択してください(スキップする場合は「スキップ」と入力)。
Detect differences for the selected template:
ci-templates/<lang>/.github/workflows/ci.yml vs local .github/workflows/ci.ymlci-templates/<lang>/ (non-.github/ items) vs the same filename at the local project rootPresent differences and confirm with the user:
If all files are identical → display "CI テンプレートのファイルはすべて同期済みです。" and skip copying
If differences exist, display by category:
### CI テンプレート(nextjs)
#### .github/workflows
- ci.yml — 差分あり
#### プロジェクトルート
- package.json — ローカルに存在しない(新規追加)
- tsconfig.json — 差分あり
- jest.config.mjs — 同一 ✓
同期する項目を選択してください(例: 全て / ci.ymlのみ)。
差分の詳細を確認したい場合はお知らせください。
If the user requests diff details → show diff output
Determine sync targets based on the user's response
Standard label colors are defined as follows (source of truth: shared-claude-code repository):
| Label name | Color code |
|---|---|
bug | d73a4a |
feature | 0e8a16 |
enhancement | a2eeef |
documentation | 0075ca |
chore | ededed |
priority: high | b60205 |
priority: medium | fbca04 |
priority: low | 0e8a16 |
Get the target repository's current labels with gh label list --json name,color
For each label in the standard table above, check if it exists in the target repository:
✓If all found labels match → display the following and skip to Step 7:
All label colors match the standard.
If differences exist, display and ask for confirmation:
## Label Color Check
- `bug`: d73a4a → e11d48 (differs)
- `feature`: 0e8a16 ✓
- `priority: high`: b60205 ✓
Apply color corrections? (yes / skip)
If the user approves → run gh label edit <name> --color <hex> for each differing label
If the user skips → proceed to Step 7 without changes
Display sync results in the following format:
## 同期完了
- 同期したISSUE_TEMPLATE: X件
- <ファイル名1>(新規追加)
- <ファイル名2>(更新)
- 同期したPULL_REQUEST_TEMPLATE: (新規追加 or 更新)
- 同期したワークフロー: X件
- <ファイル名1>(更新)
- 同期したCIテンプレート(<lang>): X件
- .github/workflows/ci.yml(更新)
- tsconfig.json(新規追加)
- Label colors corrected: X
- `bug`: e11d48 → d73a4a
Omit the CI template line if CI templates were not synced. Omit the label color line if no label colors were corrected.
Copy files:
mkdir -p if they do not existcpdiff -q