diff --git a/.claude/marketplace/CHANGELOG.md b/.claude/marketplace/CHANGELOG.md new file mode 100644 index 00000000..e08740dd --- /dev/null +++ b/.claude/marketplace/CHANGELOG.md @@ -0,0 +1,11 @@ +# 変更履歴 + +Nabledgeマーケットプレイス全体のバージョン対応表です。 + +詳細な変更内容は各プラグインのCHANGELOGを参照してください。 + +## バージョン対応表 + +| マーケットプレイスバージョン | nabledge-6 | nabledge-5 | リリース日 | +|---------------------------|-----------|-----------|----------| +| 0.1 | [0.1](plugins/nabledge-6/CHANGELOG.md#01---2026-02-13) | - | 2026-02-13 | diff --git a/.claude/marketplace/README.md b/.claude/marketplace/README.md index 2fa87e03..e22ae72a 100644 --- a/.claude/marketplace/README.md +++ b/.claude/marketplace/README.md @@ -13,12 +13,9 @@ Nabledgeは、NablarchによるAI支援開発スキルです。Claude CodeやGit インストール方法や使い方は各プラグインのREADMEを参照してください。 -## バージョニング +## 変更履歴 -各プラグインは独立したバージョン管理を行っています。 - -- nabledge-6: `minor.patch` 形式を使用(例: 0.1, 1.0, 2.0) -- プラグイン名がすでにNablarchのメジャーバージョンを示しています +全体およびプラグイン別の変更履歴は [CHANGELOG.md](CHANGELOG.md) を参照してください。 ## ライセンス diff --git a/.claude/rules/issues.md b/.claude/rules/issues.md new file mode 100644 index 00000000..7e020eea --- /dev/null +++ b/.claude/rules/issues.md @@ -0,0 +1,118 @@ +# Issue Format + +All issues should follow a consistent structure that clearly articulates the problem, who is affected, and what success looks like. + +## Title Format + +Use the user story format: + +``` +As a [role], I want [goal] so that [benefit] +``` + +**Examples:** +- As a developer, I want standardized issue formats so that I can create consistent documentation +- As a user, I want keyboard shortcuts so that I can navigate more efficiently +- As a maintainer, I want automated tests so that I can catch regressions early + +## Body Format + +Issues should include four sections: + +### 1. Situation + +Concrete facts and observed circumstances. What is the current state? + +- Describe what exists today +- Include relevant technical details +- State observable facts, not opinions +- Reference specific files, systems, or behaviors + +### 2. Pain + +Who is affected and what problem do they face? + +- Identify the affected stakeholders (developers, users, maintainers, etc.) +- Describe the specific problem or friction they experience +- Explain why the current situation is problematic +- Include impact or severity if relevant + +### 3. Benefit + +Who benefits and how? Use the form "[who] can [what]". + +- State clear benefits for each stakeholder +- Use active voice with "can" statements +- Be specific about capabilities gained +- Avoid vague improvements like "better" or "easier" + +**Examples:** +- Developers can create branches with consistent naming +- Users can understand feature status at a glance +- Maintainers can onboard new contributors faster + +### 4. Success Criteria + +Checkboxes that verify benefit achievement. Each criterion should be: + +- Measurable or verifiable +- Directly related to stated benefits +- Written as observable outcomes +- Formatted as GitHub checkboxes `- [ ]` + +**Example:** +```markdown +- [ ] `.claude/rules/issues.md` exists and documents the format +- [ ] New issues follow the Situation/Pain/Benefit/Success Criteria structure +- [ ] Success criteria are written as verifiable checkboxes +``` + +## Complete Example + +```markdown +**Title:** As a developer, I want standardized PR formats so that I can review changes efficiently + +**Body:** + +### Situation + +Currently, PRs are created with an ad-hoc format. Some include detailed context, others provide minimal information. There is no standard structure for documenting the approach, testing, or linking to related issues. + +### Pain + +Reviewers waste time reconstructing context from commit messages and code changes. Developers don't know what information to include in PR descriptions. The lack of consistency makes it harder to maintain quality standards across the project. + +### Benefit + +- Reviewers can understand changes quickly without extensive code archaeology +- Developers can follow a clear template for documenting their work +- Maintainers can enforce quality standards through structured PR requirements + +### Success Criteria + +- [ ] `.claude/skills/pr/workflows/create.md` includes comprehensive PR template +- [ ] Template includes sections for Approach, Tasks, Expert Review, and Success Criteria +- [ ] All new PRs reference the related issue number +- [ ] PRs include verification of issue success criteria +``` + +## Usage Guidelines + +When creating issues: + +1. **Start with the title** - Frame it as a user story +2. **Describe the situation** - State facts about current state +3. **Identify the pain** - Who hurts and why +4. **Articulate benefits** - Use "[who] can [what]" format +5. **Define success criteria** - Write verifiable checkboxes +6. **Review for clarity** - Ensure someone unfamiliar with the context can understand + +## Rationale + +This format ensures: + +- **Shared understanding** - Everyone knows why work matters +- **Clear scope** - Success criteria prevent scope creep +- **Stakeholder focus** - Benefits are explicit and measurable +- **Verification** - Checkboxes provide clear completion signal +- **Traceability** - Format supports issue-driven development workflow diff --git a/.claude/skills/git/workflows/branch-create.md b/.claude/skills/git/workflows/branch-create.md index 6ba25664..cb88d8a2 100644 --- a/.claude/skills/git/workflows/branch-create.md +++ b/.claude/skills/git/workflows/branch-create.md @@ -1,6 +1,6 @@ # Branch Creation Workflow -This workflow creates a working branch from the main branch. +This workflow creates a working branch from the development branch (typically `develop`). ## Required Tools @@ -11,21 +11,48 @@ This workflow creates a working branch from the main branch. ### 1. Pre-flight Checks -**1.1 Verify Current Branch** +**1.1 Get Development Branch and Verify Current Branch** ```bash -git branch --show-current -``` +# Get repository default branch (should be develop per branch strategy) +default_branch=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name) +echo "Repository default branch: ${default_branch}" -If not on `main`, exit with error: -``` -Error: Working branches must be created from the main branch. -Current branch: {current_branch} +# Verify develop branch exists +if ! git rev-parse --verify develop &>/dev/null; then + echo "Error: Branch 'develop' does not exist in this repository." + echo "" + echo "Please create 'develop' branch first:" + echo " git checkout -b develop main" + echo " git push -u origin develop" + echo "" + echo "Or update the workflow if using different branch names." + exit 1 +fi -To switch to main: -git checkout main +# For branch creation, always use develop as base +if [[ "$default_branch" == "develop" ]]; then + base_branch="develop" +else + echo "WARNING: Repository default is ${default_branch}, but using 'develop' per branch strategy" + base_branch="develop" +fi + +# Get current branch +current_branch=$(git branch --show-current) +echo "Current branch: ${current_branch}" ``` +If not on the base branch, exit with error: + +Error: Working branches must be created from the development branch. + +Current branch: ${current_branch} +Base branch: ${base_branch} + +To switch to ${base_branch}: +git checkout ${base_branch} + **1.2 Verify Clean Working Tree** ```bash @@ -33,7 +60,7 @@ git status --porcelain ``` If uncommitted changes exist, exit with error: -``` + Error: You have uncommitted changes. Please commit or stash changes before proceeding. @@ -42,107 +69,107 @@ git status Stash changes: git stash -``` **1.3 Update Remote** ```bash -git fetch origin main -git pull origin main +echo "Updating ${base_branch} from remote..." +git fetch origin "${base_branch}" +git pull origin "${base_branch}" +echo "Base branch updated successfully" ``` If pull fails (conflicts): -``` -Error: Failed to update main branch. -Please resolve conflicts before proceeding. -``` -### 2. Propose Branch Names +Error: Failed to update ${base_branch} branch. +Please resolve conflicts before proceeding. -**2.1 Ask Work Purpose** +### 2. Get Issue Number and Create Branch Name -Use AskUserQuestion to understand work purpose: +**2.1 Ask for Issue Number** -``` -Question: What will you implement or fix in this branch? -Header: "Work Type" -Options: - - Label: "New Feature" - Description: "Implement a new feature" - - Label: "Bug Fix" - Description: "Fix an existing bug" - - Label: "Refactoring" - Description: "Improve code structure" - - Label: "Documentation" - Description: "Update documentation" -``` +Use the AskUserQuestion tool to prompt the user: +- Question: "What is the issue number for this work?" +- Provide two options: "I have an issue number" and "No issue yet" +- If user selects "I have an issue number", they will provide the number via text input +- If user selects "No issue yet", exit with guidance -**2.2 Ask for Details** +If user selects "No issue yet", exit with guidance: -Based on selected work type, ask for details (free text): -``` -Please provide details about "{work_type}". -Examples: user authentication, login page bug, API layer refactoring, etc. -``` - -**2.3 Generate Branch Names** +Please create an issue first using GitHub issues. +This ensures work is tracked and follows issue-driven development. -Generate 3 branch name candidates from the details: +I can help create the issue. Please provide: +- Role: Who is affected? +- Goal: What do you want? +- Benefit: Why is this important? -**Generation Rules**: -- Prefix: `add-` (feature), `fix-` (bug), `refactor-` (refactor), `docs-` (docs) -- Body: Keywords from details joined with `-` -- All lowercase, alphanumeric and hyphens only +Or you can create it manually on GitHub following .claude/rules/issues.md format. +Once created, return here with the issue number. -**Examples**: -- Details: "Add user authentication feature" - - Candidate 1: `add-user-auth` - - Candidate 2: `add-authentication` - - Candidate 3: `user-auth-feature` +If user provides an issue number, validate it is numeric: -- Details: "Fix login page bug" - - Candidate 1: `fix-login-page` - - Candidate 2: `fix-login-bug` - - Candidate 3: `login-page-fix` +```bash +if ! [[ "$issue_number" =~ ^[0-9]+$ ]]; then + echo "Error: Issue number must be a positive integer" + exit 1 +fi +echo "Issue number validated: ${issue_number}" +``` -**2.4 Select Branch Name** +**2.2 Validate Issue Exists** -Use AskUserQuestion to select from candidates: +Verify the issue exists using gh CLI: -``` -Question: Select branch name. -Header: "Branch Name" -Options: - - Label: "{candidate1}" - Description: "Recommended" - - Label: "{candidate2}" - Description: "" - - Label: "{candidate3}" - Description: "" +```bash +echo "Validating issue #${issue_number}..." +if ! gh issue view "$issue_number" &>/dev/null; then + echo "Error: Issue #${issue_number} not found." + echo "" + echo "Please verify the issue number or create the issue first:" + echo "gh issue create" + exit 1 +fi +echo "Issue #${issue_number} confirmed" ``` -If user selects "Other", accept free text input. +**2.3 Generate Branch Name** -**2.5 Check for Duplicates** +Branch name is always: `issue-${issue_number}` + +Example: +- Issue #42 → Branch: `issue-42` +- Issue #123 → Branch: `issue-123` ```bash -git branch --list "{branch_name}" +branch_name="issue-${issue_number}" +echo "Branch name will be: ${branch_name}" ``` -If exists, exit with error: -``` -Error: Branch "{branch_name}" already exists. +**2.4 Check for Duplicates** -Use a different name or delete the existing branch: -git branch -d {branch_name} +```bash +if git branch --list "${branch_name}" | grep -q .; then + echo "Error: Branch '${branch_name}' already exists." + echo "" + echo "To work on existing branch:" + echo "git checkout ${branch_name}" + echo "" + echo "To delete and recreate:" + echo "git branch -D ${branch_name}" + exit 1 +fi +echo "Branch name is available" ``` ### 3. Create Branch -Create branch with selected name: +Create branch with issue-based name: ```bash -git checkout -b {branch_name} +echo "Creating branch ${branch_name} from ${base_branch}..." +git checkout -b "${branch_name}" +echo "Branch created successfully" ``` ### 4. Display Result @@ -150,10 +177,11 @@ git checkout -b {branch_name} ``` ## Branch Creation Complete -**Branch Name**: {branch_name} -**Base Branch**: main +**Branch Name**: ${branch_name} +**Issue**: #${issue_number} +**Base Branch**: ${base_branch} -You can now start working. +You can now start working on this issue. Use `/git commit` to commit changes. ``` @@ -161,13 +189,19 @@ Use `/git commit` to commit changes. | Error | Response | |-------|----------| -| Not on main branch | Guide to switch to main | +| Not on develop branch | Guide to switch to develop | | Uncommitted changes | Guide to commit or stash | -| Failed to update main | Guide to resolve conflicts | -| Branch name exists | Guide to use different name or delete existing | +| Failed to update develop | Guide to resolve conflicts | +| Branch name exists | Guide to use existing or delete | +| Issue not found | Guide to create issue first | +| Invalid issue number | Reject non-numeric input | ## Important Notes 1. **No emojis**: Never use emojis unless explicitly requested by user -2. **Branch name quality**: Generate appropriate names from user input -3. **Safety**: Protect main branch, check duplicates, verify clean working tree +2. **Issue-driven development**: All branches must be linked to a GitHub issue +3. **Branch naming**: Always use `issue-` format for consistency +4. **Safety**: Protect main/develop branches, check duplicates, verify clean working tree +5. **Issue validation**: Always verify issue exists before creating branch +6. **Branch strategy**: Branches are created from `develop`, not `main` +7. **Variable syntax**: Always use `${variable}` or `"$variable"` in bash commands for safety diff --git a/.claude/skills/git/workflows/worktree-create.md b/.claude/skills/git/workflows/worktree-create.md index cceba5d7..946c5dbc 100644 --- a/.claude/skills/git/workflows/worktree-create.md +++ b/.claude/skills/git/workflows/worktree-create.md @@ -1,6 +1,6 @@ # Worktree Creation Workflow -This workflow creates a new worktree for parallel work. +This workflow creates a new worktree for parallel work from the development branch (typically `develop`). ## Required Tools @@ -14,190 +14,278 @@ This workflow creates a new worktree for parallel work. **1.1 Get Current Directory and Repository Name** ```bash -pwd -basename $(pwd) -``` +current_dir=$(pwd) +repo_name=$(basename "$current_dir") +parent_dir=$(dirname "$current_dir") -- Current directory: `/nab-agents` -- Repository name: `nab-agents` +echo "Current directory: ${current_dir}" +echo "Repository name: ${repo_name}" +echo "Parent directory: ${parent_dir}" +``` -**1.2 Get Parent Directory** +**1.2 Get Development Branch** ```bash -dirname $(pwd) +# Get repository default branch (should be develop per branch strategy) +default_branch=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name) +echo "Repository default branch: ${default_branch}" + +# Verify develop branch exists +if ! git rev-parse --verify develop &>/dev/null; then + echo "Error: Branch 'develop' does not exist in this repository." + echo "" + echo "Please create 'develop' branch first:" + echo " git checkout -b develop main" + echo " git push -u origin develop" + echo "" + echo "Or update the workflow if using different branch names." + exit 1 +fi + +# For worktree creation, always use develop as base +if [[ "$default_branch" == "develop" ]]; then + base_branch="develop" +else + echo "WARNING: Repository default is ${default_branch}, but using 'develop' per branch strategy" + base_branch="develop" +fi + +echo "Worktree will be created from: ${base_branch}" ``` -- Parent directory: `` +### 2. Get Issue Number and Create Branch Name -### 2. Propose Branch Names +**2.1 Ask for Issue Number** -**2.1 Ask Work Purpose** +Use the AskUserQuestion tool to prompt the user: +- Question: "What is the issue number for this work?" +- Provide two options: "I have an issue number" and "No issue yet" +- If user selects "I have an issue number", they will provide the number via text input +- If user selects "No issue yet", exit with guidance -Use AskUserQuestion to understand work purpose: - -``` -Question: What will you implement or fix in this worktree? -Header: "Work Type" -Options: - - Label: "New Feature" - Description: "Implement a new feature" - - Label: "Bug Fix" - Description: "Fix an existing bug" - - Label: "Refactoring" - Description: "Improve code structure" - - Label: "Documentation" - Description: "Update documentation" -``` +If user selects "No issue yet", exit with guidance: -**2.2 Ask for Details** +Please create an issue first using GitHub issues. +This ensures work is tracked and follows issue-driven development. -Based on selected work type, ask for details (free text): -``` -Please provide details about "{work_type}". -Examples: user authentication, login page bug, API layer refactoring, etc. -``` +I can help create the issue. Please provide: +- Role: Who is affected? +- Goal: What do you want? +- Benefit: Why is this important? -**2.3 Generate Branch Names** +Or you can create it manually on GitHub following .claude/rules/issues.md format. +Once created, return here with the issue number. -Generate 3 branch name candidates from the details: +If user provides an issue number, validate it is numeric: -**Generation Rules**: -- Prefix: `add-` (feature), `fix-` (bug), `refactor-` (refactor), `docs-` (docs) -- Body: Keywords from details joined with `-` -- All lowercase, alphanumeric and hyphens only +```bash +if ! [[ "$issue_number" =~ ^[0-9]+$ ]]; then + echo "Error: Issue number must be a positive integer" + exit 1 +fi +echo "Issue number validated: ${issue_number}" +``` -**2.4 Select Branch Name** +**2.2 Validate Issue Exists** -Use AskUserQuestion to select from candidates: +Verify the issue exists using gh CLI: +```bash +echo "Validating issue #${issue_number}..." +if ! gh issue view "$issue_number" &>/dev/null; then + echo "Error: Issue #${issue_number} not found." + echo "" + echo "Please verify the issue number or create the issue first:" + echo "gh issue create" + exit 1 +fi +echo "Issue #${issue_number} confirmed" ``` -Question: Select branch name. -Header: "Branch Name" -Options: - - Label: "{candidate1}" - Description: "Recommended" - - Label: "{candidate2}" - Description: "" - - Label: "{candidate3}" - Description: "" -``` -If user selects "Other", accept free text input. +**2.3 Generate Branch Name** + +Branch name is always: `issue-${issue_number}` -**2.5 Check for Duplicates** +Example: +- Issue #42 → Branch: `issue-42` +- Issue #123 → Branch: `issue-123` ```bash -git branch --list "{branch_name}" +branch_name="issue-${issue_number}" +echo "Branch name will be: ${branch_name}" ``` -If exists, exit with error: -``` -Error: Branch "{branch_name}" already exists. +**2.4 Check for Branch Duplicates** -Use a different name or delete the existing branch: -git branch -d {branch_name} +```bash +if git branch --list "${branch_name}" | grep -q .; then + echo "Error: Branch '${branch_name}' already exists." + echo "" + echo "To work on existing branch in a new worktree:" + echo "git worktree add ${branch_name}" + echo "" + echo "To delete and recreate:" + echo "git branch -D ${branch_name}" + exit 1 +fi +echo "Branch name is available" ``` ### 3. Determine Worktree Path -**3.1 Generate Path** +**3.1 Generate and Validate Worktree Path** + +Generate path using consistent naming: ```bash -parent_dir=$(dirname $(pwd)) -repo_name=$(basename $(pwd)) -worktree_path="${parent_dir}/${repo_name}-${branch_name}" +worktree_path="${parent_dir}/issue-${issue_number}" +echo "Generated worktree path: ${worktree_path}" ``` Example: -- Current: `/nab-agents` -- Worktree: `/nab-agents-` +- Current: `/home/user/work/nabledge-dev` +- Issue #42 → Worktree: `/home/user/work/issue-42` +- Issue #123 → Worktree: `/home/user/work/issue-123` -**3.2 Check Path Existence** +Validate parent directory is writable: ```bash -test -e {worktree_path} +if [[ ! -w "$parent_dir" ]]; then + echo "Error: Cannot write to parent directory: ${parent_dir}" + echo "Check permissions or choose different location" + exit 1 +fi +echo "Parent directory is writable" ``` -If exists, exit with error: +Check if path contains special characters: + +```bash +if [[ "$worktree_path" =~ [^a-zA-Z0-9/_-] ]]; then + echo "WARNING: Path contains special characters: ${worktree_path}" + echo "This may cause issues on some systems" +fi ``` -Error: Path "{worktree_path}" already exists. -Use a different branch name or delete the existing directory. +**3.2 Check Path Existence** + +```bash +if [[ -e "$worktree_path" ]]; then + echo "Error: Path already exists: ${worktree_path}" + echo "" + echo "Options:" + echo "1. Remove existing: rm -rf '${worktree_path}'" + echo "2. Use different issue number" + echo "3. Cancel operation" + exit 1 +fi +echo "Path is available" ``` -**3.3 Confirm Path** +**3.3 Check for Existing Worktree** -Use AskUserQuestion to confirm path: +Check if a worktree already exists for this branch: +```bash +existing_worktree=$(git worktree list --porcelain | grep -A 2 "branch refs/heads/${branch_name}" | grep "worktree" | awk '{print $2}') +if [[ -n "$existing_worktree" ]]; then + echo "Error: Worktree already exists for ${branch_name} at: ${existing_worktree}" + echo "" + echo "Options:" + echo "1. Use existing worktree: cd '${existing_worktree}'" + echo "2. Remove existing: git worktree remove '${existing_worktree}'" + echo "3. Cancel operation" + exit 1 +fi +echo "No existing worktree for this branch" ``` -Question: Create worktree at the following path. OK? -Header: "Confirm Path" -Options: - - Label: "Yes, create it" - Description: "{worktree_path}" - - Label: "No, cancel" - Description: "" -Display info: -Path: {worktree_path} -Branch: {branch_name} -Base: main +**3.4 Confirm Path** + +Use the AskUserQuestion tool to confirm: +- Question: "Create worktree at the following path. OK?" +- Display the full path in the question +- Provide options: "Yes, create it" and "No, cancel" + +Display information: +``` +Path: ${worktree_path} +Branch: ${branch_name} +Issue: #${issue_number} +Base: ${base_branch} ``` +If user selects "No, cancel", exit gracefully. + ### 4. Create Worktree -**4.1 Update Main Branch** +**4.1 Update Development Branch** ```bash -git fetch origin main -git pull origin main +echo "Updating ${base_branch} from remote..." +git fetch origin "${base_branch}" +git pull origin "${base_branch}" +echo "Base branch updated successfully" ``` **4.2 Create Worktree** ```bash -git worktree add -b {branch_name} {worktree_path} main +echo "Creating worktree at ${worktree_path}..." +git worktree add -b "${branch_name}" "${worktree_path}" "${base_branch}" +echo "Worktree created successfully" ``` If creation fails: -``` + Error: Failed to create worktree. Please verify: - Sufficient disk space - Write permissions to the path - Valid branch name -``` ### 5. Display Result ``` ## Worktree Creation Complete -**Path**: {worktree_path} -**Branch**: {branch_name} -**Base Branch**: main +**Path**: ${worktree_path} +**Branch**: ${branch_name} +**Issue**: #${issue_number} +**Base Branch**: ${base_branch} ### Move to Worktree -cd {worktree_path} +cd ${worktree_path} -You can now start working. +You can now start working on this issue. Use `/git commit` to commit changes. + +### Open in Editor (optional) +code ${worktree_path} ``` ## Error Handling | Error | Response | |-------|----------| -| Branch name exists | Guide to use different name or delete existing | -| Path exists | Guide to use different name or delete existing directory | -| Failed to update main | Guide to resolve conflicts | +| Branch name exists | Guide to use different issue or delete existing | +| Path exists | Guide to remove existing or use different issue | +| Failed to update develop | Guide to resolve conflicts | | Insufficient permissions | Guide to check write permissions | | Insufficient disk space | Guide to check disk space | +| Issue not found | Guide to create issue first | +| Invalid issue number | Reject non-numeric input | +| Existing worktree | Guide to use existing or remove | ## Important Notes 1. **No emojis**: Never use emojis unless explicitly requested by user -2. **Path naming convention**: `{parent_dir}/{repo_name}-{branch_name}` -3. **Branch name quality**: Generate appropriate names from user input -4. **Base branch**: Always branch from main +2. **Path naming convention**: `${parent_dir}/issue-${issue_number}` +3. **Branch naming convention**: `issue-${issue_number}` +4. **Issue-driven development**: All worktrees must be linked to a GitHub issue +5. **Issue validation**: Always verify issue exists before creating worktree +6. **Base branch**: Always branch from `develop`, not `main` +7. **Variable syntax**: Always use `${variable}` or `"$variable"` in bash commands for safety +8. **Path safety**: Validate parent directory permissions and path availability +9. **Worktree cleanup**: Use `git worktree remove` instead of `rm -rf` for proper cleanup diff --git a/.claude/skills/nabledge-6/plugin/CHANGELOG.md b/.claude/skills/nabledge-6/plugin/CHANGELOG.md index ecb1a682..5fd7884e 100644 --- a/.claude/skills/nabledge-6/plugin/CHANGELOG.md +++ b/.claude/skills/nabledge-6/plugin/CHANGELOG.md @@ -1,17 +1,33 @@ -# Changelog +# 変更履歴 -All notable changes to the nabledge-6 plugin will be documented in this file. +nabledge-6プラグインの主な変更内容を記録しています。 -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +フォーマットは [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) に基づいています。 + +## [Unreleased] + +### 追加 +- セットアップスクリプトの環境変数サポート(`NABLEDGE_REPO`, `NABLEDGE_BRANCH`)により、テストやカスタムリポジトリの使用が可能に +- 利用ガイドの分離:Claude Code向け `GUIDE-CC.md` と GitHub Copilot向け `GUIDE-GHC.md` +- GitHub Copilotセットアップスクリプトによる `.vscode/settings.json` の自動設定(`chat.useAgentSkills`)により、チーム全体でスキル機能を共有可能に + +### 変更 +- コード分析ワークフローの説明を修正(ドキュメント生成機能であり、改善提案は行わない) +- ドキュメントを目的別に分離(README.mdは概要、GUIDE-CC.mdとGUIDE-GHC.mdは詳細手順) +- 評価版の目的を明確化:知識の有無による違いの体感、ワークフローの理解、現場からの要望収集 +- GitHub Copilot利用ガイドのインストール前提条件と手順を明確化(WSL/GitBash必須、VS Code設定、スキル使用形式) +- PowerShell/Command Promptが動作しない理由を説明(jqコマンド要件) +- GitHub Copilotの使用方法を更新:自然言語での質問で自動的にスキルが適用される(スラッシュコマンド不要) +- Claude Codeの利用方法を更新:自然言語での対話を主要な使用方法として強調 +- 利用ガイドから環境変数カスタマイズを削除(開発者向け情報のため) +- macOS固有の注意事項を削除(WSL/GitBash前提のためスコープ外) +- バージョン管理の説明を簡素化:READMEから複雑なバージョンセクションを削除、ユーザーは常に最新版をインストール +- 利用ガイドにバージョンアップセクションを追加:タグ指定による特定バージョンのインストール例を記載 +- マーケットプレイス全体のCHANGELOGを作成:バージョン対応表とプラグインCHANGELOGへのリンク ## [0.1] - 2026-02-13 -### Added -- Nablarch 6u3の知識検索機能 -- コード分析機能(構造化テンプレート) -- バッチ処理の基礎知識 -- データベースアクセスライブラリ -- テスティングフレームワークの基礎 -- セキュリティチェックリスト +### 追加 +- 評価版として、Nablarch 6のバッチ処理に関する基礎知識とコード分析ワークフローを提供 [0.1]: https://github.com/nablarch/nabledge/releases/tag/0.1 diff --git a/.claude/skills/nabledge-6/plugin/GUIDE-CC.md b/.claude/skills/nabledge-6/plugin/GUIDE-CC.md new file mode 100644 index 00000000..2fad05e0 --- /dev/null +++ b/.claude/skills/nabledge-6/plugin/GUIDE-CC.md @@ -0,0 +1,83 @@ +# Claude Code 利用ガイド + +Nabledge-6を Claude Code で使用するためのガイドです。 + +## 前提条件 + +- Claude Code がインストール済みであること +- プロジェクトディレクトリで作業していること + +## インストール + +プロジェクトルートで以下のコマンドを実行: + +```bash +curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-cc.sh | bash +``` + +実行後、`.claude/settings.json` が自動的に作成または更新されます。 + +### チーム共有 + +`.claude/settings.json` をGitにコミット・プッシュしてください。チームメンバーがリポジトリをクローンしてClaude Codeを起動すると、自動的にプラグインのインストールが促されます。 + +## 使い方 + +### 基本的な使い方 + +自然言語でNablarchに関する質問や依頼をするだけで、Claude Codeが自動的にnabledge-6スキルを使用します。 + +**例**: +``` +Nablarchのバッチ処理の実装方法を教えて +``` + +``` +このプロジェクトのコードをNablarchの観点から分析して +``` + +``` +UniversalDaoの使い方を教えて +``` + +### 手動実行(オプション) + +明示的にスキルを指定したい場合は、以下のコマンドで手動実行できます: + +```bash +/nabledge-6 +``` + +対話的にNablarchに関する質問や、コード分析を行うことができます。 + +コード分析を直接実行する場合: + +```bash +/nabledge-6 code-analysis +``` + +## バージョンアップ + +### 最新版へのアップデート(推奨) + +セットアップスクリプトを再実行すると、常に最新版がインストールされます: + +```bash +curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-cc.sh | bash +``` + +実行後、更新された `.claude/settings.json` をGitにコミット・プッシュしてください。 + +### 特定バージョンの指定(オプション) + +特定のバージョンにしたい場合は、タグを指定できます: + +```bash +# バージョン 0.2 にする場合 +curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-cc.sh -o setup.sh +NABLEDGE_BRANCH=0.2 bash setup.sh +``` + +実行後、`.claude/settings.json` をGitにコミット・プッシュしてください。 + +**注**: 通常は最新版の使用を推奨します。特定バージョンの指定は、動作検証やトラブルシューティングが必要な場合のみ使用してください。 diff --git a/.claude/skills/nabledge-6/plugin/GUIDE-GHC.md b/.claude/skills/nabledge-6/plugin/GUIDE-GHC.md new file mode 100644 index 00000000..5cd7983b --- /dev/null +++ b/.claude/skills/nabledge-6/plugin/GUIDE-GHC.md @@ -0,0 +1,78 @@ +# GitHub Copilot 利用ガイド + +Nabledge-6を GitHub Copilot で使用するためのガイドです。 + +## 前提条件 + +- **WSL または GitBash 環境** + - VS Code のターミナルを使用する場合は、ターミナルを WSL または GitBash に設定してください + - PowerShell や Command Prompt では動作しません(セットアップスクリプトが `jq` コマンドを使用するため) +- プロジェクトディレクトリで作業していること +- VS Code の GitHub Copilot 拡張機能がインストール済みであること + +## インストール + +### 1. スキルをプロジェクトに追加 + +プロジェクトルートで以下のコマンドを実行: + +```bash +curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-ghc.sh | bash +``` + +実行後、以下のファイルが自動的に作成されます: +- `.claude/skills/nabledge-6/` - スキル定義(GitHub Copilot が自動認識) +- `.vscode/settings.json` - VS Code 設定(GitHub Copilot スキル機能を有効化) + +### 2. チーム共有 + +`.claude` ディレクトリと `.vscode/settings.json` をGitにコミット・プッシュしてください。チームメンバーがリポジトリをクローンすると、自動的に以下が有効になります: +- nabledge-6 スキルの利用 +- GitHub Copilot スキル機能の有効化 + +**注**: チームメンバーは VS Code を再起動する必要があります。 + +## 使い方 + +### 基本的な使い方 + +自然言語でNablarchに関する質問や依頼をするだけで、GitHub Copilotが自動的にnabledge-6スキルを使用します。 + +**例**: +``` +Nablarchのバッチ処理の実装方法を教えて +``` + +``` +このプロジェクトのコードをNablarchの観点から分析して +``` + +``` +UniversalDaoの使い方を教えて +``` + +## バージョンアップ + +### 最新版へのアップデート(推奨) + +セットアップスクリプトを再実行すると、常に最新版がインストールされます: + +```bash +curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-ghc.sh | bash +``` + +更新後、`.claude` ディレクトリの変更をGitにコミット・プッシュしてください。 + +### 特定バージョンの指定(オプション) + +特定のバージョンにしたい場合は、タグを指定できます: + +```bash +# バージョン 0.2 にする場合 +curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-ghc.sh -o setup.sh +NABLEDGE_BRANCH=0.2 bash setup.sh +``` + +更新後、`.claude` ディレクトリの変更をGitにコミット・プッシュしてください。 + +**注**: 通常は最新版の使用を推奨します。特定バージョンの指定は、動作検証やトラブルシューティングが必要な場合のみ使用してください。 diff --git a/.claude/skills/nabledge-6/plugin/README.md b/.claude/skills/nabledge-6/plugin/README.md index 9acb3252..55aeefe3 100644 --- a/.claude/skills/nabledge-6/plugin/README.md +++ b/.claude/skills/nabledge-6/plugin/README.md @@ -1,6 +1,14 @@ # Nabledge-6 -Nablarch 6のAI支援開発スキルです。 +> **⚠️ 評価版について** +> +> 現在、評価版として公開しています。本スキルの目的は以下の通りです: +> +> - **知識あり/なしの違いを体感する**: AIエージェント(Claude Code、GitHub Copilot)は、Nablarchのような企業フレームワークの知識を十分に持っていません。本スキルを導入することで、Nablarch固有の知識を活用した開発支援が可能になります +> - **ワークフローの実行イメージを掴む**: コード分析などのワークフローを実際に試すことで、AIエージェントによる開発支援の可能性を理解できます +> - **現場からの要望を集める**: 実際に使用していただき、どのような機能や知識が必要か、フィードバックをお寄せください +> +> 知識・ワークフローともにカバー範囲は限定的ですが、フィードバックをもとに継続的に拡充していきます。 ## 機能 @@ -28,85 +36,16 @@ Nablarchの知識を活用した開発支援ワークフローを提供します 現在提供しているワークフロー: -- **コード分析**: Nablarchの観点からプロジェクトコードを分析し、改善提案を行う +- **コード分析**: Nablarchの観点からプロジェクトコードを分析し、構造や依存関係を可視化したドキュメントを生成する 今後追加予定のワークフロー: - **影響調査**: 変更による影響範囲をNablarchの構造を踏まえて調査 - **コードレビュー**: Nablarchの規約やベストプラクティスに基づくレビュー -注:評価版のため、知識・ワークフローともにカバー範囲は限定的です。フィードバックをもとに拡充していきます。 +## 利用ガイド -## インストール +使用するAIツールに応じて、以下のガイドを参照してください。 -### Claude Code - -プロジェクトルートで以下のコマンドを実行: - -```bash -curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-cc.sh | bash -``` - -実行後、`.claude/settings.json`が自動的に作成または更新されます。このファイルをGitにコミット・プッシュしてください。チームメンバーがリポジトリをクローンしてClaude Codeを起動すると、自動的にプラグインのインストールが促されます。 - -**注**: セットアップスクリプトは必要に応じて `jq` コマンドを自動インストールします(Linux/WSL/GitBash環境)。macOSでは手動インストールが必要です(`brew install jq`)。 - -### GitHub Copilot (WSL / GitBash) - -プロジェクトルートで以下のコマンドを実行: - -```bash -curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-ghc.sh | bash -``` - -実行後、`.claude` ディレクトリがプロジェクトに作成されます。このディレクトリをGitにコミット・プッシュしてください。チームメンバーも同じスキルを利用できるようになります。 - -**注**: セットアップスクリプトは必要に応じて `jq` コマンドを自動インストールします(Linux/WSL/GitBash環境)。macOSでは手動インストールが必要です(`brew install jq`)。 - -## 使い方 - -### 基本的な使い方 - -```bash -/nabledge-6 -``` - -スキルを起動し、対話的にNablarchに関する質問や、コード分析を行うことができます。 - -### 知識検索 - -```bash -/nabledge-6 "バッチ処理の実装方法を教えて" -``` - -Nablarch 6のドキュメントやベストプラクティスから知識を検索し、回答を得ることができます。質問は日本語でも英語でも可能です。 - -### コード分析 - -```bash -/nabledge-6 code-analysis -``` - -現在のプロジェクトのコードをNablarchの観点から分析します。Actionクラス、ハンドラ構成、データベースアクセスパターンなどを評価し、改善提案を提供します。 - -## バージョンアップ - -### Claude Code - -セットアップスクリプトを再実行: - -```bash -curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-cc.sh | bash -``` - -実行後、更新された`.claude/settings.json`をGitにコミット・プッシュしてください。 - -### GitHub Copilot (WSL / GitBash) - -セットアップスクリプトを再実行: - -```bash -curl -sSL https://raw.githubusercontent.com/nablarch/nabledge/main/setup-6-ghc.sh | bash -``` - -更新後、`.claude` ディレクトリの変更をGitにコミット・プッシュしてください。 +- **[Claude Code利用ガイド](GUIDE-CC.md)** - Claude Codeでの利用方法 +- **[GitHub Copilot利用ガイド](GUIDE-GHC.md)** - GitHub Copilotでの利用方法 diff --git a/.claude/skills/pr/templates/pr-template.md b/.claude/skills/pr/templates/pr-template.md new file mode 100644 index 00000000..1163bbd8 --- /dev/null +++ b/.claude/skills/pr/templates/pr-template.md @@ -0,0 +1,92 @@ +# PR Template + +This is the standard template for all pull requests. All PRs must reference a GitHub issue following issue-driven development. + +## Template Structure + +```markdown +Closes #[ISSUE_NUMBER] + +## Approach +[Describe the solution strategy and key design decisions. Explain WHY this approach was chosen, any alternatives considered, and trade-offs made.] + +## Tasks +[List implementation tasks completed as checkboxes] +- [x] Task 1 +- [x] Task 2 +- [x] Task 3 + +## Expert Review + +> **Instructions for Expert**: Please review the approach and implementation, then fill in this table with your feedback. + +| Aspect | Status | Comments | +|--------|--------|----------| +| Architecture | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Code Quality | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Testing | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Documentation | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | + +## Success Criteria Check + +[Read the issue body and extract success criteria section, then create verification table] + +| Criterion | Status | Evidence | +|-----------|--------|----------| +| [Criterion 1 from issue] | ✅ Met / ❌ Not Met | [How this was verified] | +| [Criterion 2 from issue] | ✅ Met / ❌ Not Met | [How this was verified] | + +🤖 Generated with [Claude Code](https://claude.com/claude-code) +``` + +## Usage in Workflows + +This template is used for all PRs following issue-driven development: +- All PRs must close a GitHub issue +- Branch name follows `issue-` convention +- Success criteria are verified against the issue + +## Placeholder Replacement + +When generating PR body from this template: +- `[ISSUE_NUMBER]` → Actual issue number +- `[Describe the solution...]` → Generated approach description +- `[List implementation...]` → Generated task list +- `[Criterion X from issue]` → Extracted from issue body +- `[How this was verified]` → Evidence from implementation + +## Example + +```markdown +Closes #42 + +## Approach +Implemented session-based authentication using JWT tokens. Chose this approach for stateless authentication and better scalability compared to server-side sessions. + +## Tasks +- [x] Create login form component +- [x] Implement JWT token generation +- [x] Add authentication middleware +- [x] Write integration tests + +## Expert Review + +> **Instructions for Expert**: Please review the approach and implementation, then fill in this table with your feedback. + +| Aspect | Status | Comments | +|--------|--------|----------| +| Architecture | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Code Quality | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Testing | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Documentation | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | + +## Success Criteria Check + +| Criterion | Status | Evidence | +|-----------|--------|----------| +| Users can log in with username and password | ✅ Met | Login form implemented and tested in auth.test.js:45 | +| Session persists across page reloads | ✅ Met | JWT stored in localStorage, verified in session.test.js:78 | +| Invalid credentials show error message | ✅ Met | Error handling tested in auth.test.js:92 | + +🤖 Generated with [Claude Code](https://claude.com/claude-code) +``` diff --git a/.claude/skills/pr/workflows/create.md b/.claude/skills/pr/workflows/create.md index 1effdaa3..81b5e402 100644 --- a/.claude/skills/pr/workflows/create.md +++ b/.claude/skills/pr/workflows/create.md @@ -1,11 +1,12 @@ # PR Creation Workflow -This workflow creates a PR from the current branch to main. +This workflow creates a PR from the current branch to the development branch (typically `develop`). ## Required Tools - Bash - Read +- AskUserQuestion ## Execution Steps @@ -14,32 +15,55 @@ This workflow creates a PR from the current branch to main. **1.1 Verify Current Branch** ```bash -git branch --show-current +current_branch=$(git branch --show-current) +echo "Current branch: ${current_branch}" ``` -If current branch is `main` or `master`, exit with error: -``` -Error: Cannot create PR from main branch. +If current branch is `main`, `master`, or `develop`, exit with error: + +Error: Cannot create PR from the main/develop branch. Please create a feature/issue branch first. -``` -**1.2 Get Default Branch** +**1.2 Get Development Branch** ```bash +# Get repository default branch (should be develop) default_branch=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name) +echo "Repository default branch: ${default_branch}" + +# Verify develop branch exists +if ! git rev-parse --verify develop &>/dev/null; then + echo "Error: Branch 'develop' does not exist in this repository." + echo "" + echo "Please create 'develop' branch first:" + echo " git checkout -b develop main" + echo " git push -u origin develop" + echo "" + echo "Or update the workflow if using different branch names." + exit 1 +fi + +# For PR creation, always target develop +if [[ "$default_branch" == "develop" ]]; then + target_branch="develop" +else + echo "WARNING: Repository default is ${default_branch}, but using 'develop' per branch strategy" + target_branch="develop" +fi + +echo "PR will target: ${target_branch}" ``` **1.3 Check Commit History** ```bash -git log "$default_branch"..HEAD --oneline +git log "${target_branch}"..HEAD --oneline ``` If no commits exist, exit with error: -``` -Error: No new commits from {default_branch}. + +Error: No new commits from ${target_branch}. Please commit your changes first. -``` **1.4 Verify Remote Push** @@ -48,104 +72,308 @@ git status ``` If "Your branch is ahead of" or "have diverged" appears, push is needed: + ```bash -git push -u origin "$(git branch --show-current)" +git push -u origin "${current_branch}" ``` If push fails (rejected): + ```bash -git pull --rebase origin "$(git branch --show-current)" +git pull --rebase origin "${current_branch}" git push ``` ### 2. Generate PR Title and Description -**2.1 Get Commit History and Diff** +**2.1 Get Issue Number** + +Check if branch follows `issue-` naming convention: ```bash -git log "$default_branch"..HEAD --format="%s" -git diff "$default_branch"...HEAD --stat +if [[ "$current_branch" =~ ^issue-([0-9]+)$ ]]; then + issue_number="${BASH_REMATCH[1]}" + echo "Detected issue number from branch: #${issue_number}" +else + issue_number="" +fi ``` -**2.2 Generate Title and Description** +If no issue number detected from branch name, use the AskUserQuestion tool to prompt the user: +- Question: "What is the issue number this PR addresses?" +- User must provide the issue number via text input +- Issue number is required (issue-driven development standard) + +If user provides an issue number, validate it is numeric: + +```bash +if ! [[ "$issue_number" =~ ^[0-9]+$ ]]; then + echo "Error: Issue number must be a positive integer" + exit 1 +fi +``` + +Then validate the issue exists: + +```bash +if ! gh issue view "$issue_number" &>/dev/null; then + echo "Error: Issue #${issue_number} not found." + echo "Please create an issue first or verify the issue number." + exit 1 +fi +echo "Validated issue #${issue_number} exists" +``` + +**2.2 Gather Information** + +Collect all necessary information for PR generation: + +```bash +# Get commit history +echo "Analyzing commits..." +commits=$(git log "${target_branch}"..HEAD --format="%s%n%b") + +# Get diff statistics +echo "Analyzing changes..." +diff_stat=$(git diff "${target_branch}"...HEAD --stat) + +# Get issue body +echo "Fetching issue details..." +issue_body=$(gh issue view "$issue_number" --json body -q .body) +``` -Analyze commit history and diff, generate in the following format: +**2.3 Load PR Template** -**Title**: Summarize main changes (within 70 characters) -- Example: "feat: Add user authentication feature" -- Example: "fix: Fix session timeout on login" +Use the Read tool to load `.claude/skills/pr/templates/pr-template.md`. -**Description**: +The template contains the following structure with placeholders: ```markdown -## Summary -{Describe purpose and content of changes in 1-3 sentences} +Closes #[ISSUE_NUMBER] -## Changes -{List main changes as bullet points} +## Approach +[Describe the solution...] -## Testing -- [ ] Manual testing completed -- [ ] Tests added/updated (if needed) +## Tasks +[List implementation...] + +## Expert Review +[Review table] + +## Success Criteria Check +[Criterion X from issue] | Status | Evidence + +🤖 Generated with [Claude Code](https://claude.com/claude-code) +``` + +**2.4 Generate Title** + +Analyze commits to generate appropriate PR title: + +**Title Generation Rules**: +1. If only 1 commit: Use the commit message subject line +2. If multiple commits: Identify common theme across commit messages +3. If commit messages unclear (e.g., "fix", "update"): Analyze diff to determine primary change type +4. Format: `: ` where type is one of: feat, fix, refactor, docs, test, chore +5. MUST be under 70 characters + +**Examples**: +- "feat: Add JWT authentication middleware" +- "fix: Resolve session timeout on login" +- "refactor: Extract validation logic to separate module" + +**2.5 Generate Description with Placeholder Replacement** + +Replace each placeholder in the loaded template: + +**Step 1: Replace [ISSUE_NUMBER]** +``` +Closes #[ISSUE_NUMBER] +↓ +Closes #42 +``` + +**Step 2: Replace [Describe the solution...]** +- Summarize the approach from commit message bodies +- Identify key design decisions from changed files (using diff_stat) +- Explain WHY this approach was chosen +- Example output: + ``` + Implemented session-based authentication using JWT tokens. Chose this + approach for stateless authentication and better scalability compared + to server-side sessions. + ``` + +**Step 3: Replace [List implementation...]** +- Extract task list from commit messages (subjects) +- Format as checkbox list with all items checked +- Example output: + ``` + - [x] Create login form component + - [x] Implement JWT token generation + - [x] Add authentication middleware + - [x] Write integration tests + ``` + +**Step 4: Keep Expert Review Table as-is** +- Do not modify the Expert Review table +- Leave all status fields as "⚪ Not Reviewed" + +**Step 5: Replace Success Criteria Section** +- Parse issue_body to extract success criteria +- Look for lines starting with `- [ ]` or `- [x]` under "Success Criteria" heading +- For each criterion, create a table row: + - Criterion: The criterion text + - Status: "✅ Met" (if implemented) or "❌ Not Met" + - Evidence: Specific file paths, line numbers, or test names +- Example output: + ``` + | Criterion | Status | Evidence | + |-----------|--------|----------| + | Users can log in with username and password | ✅ Met | Login form implemented in auth.component.tsx:45 | + | Session persists across page reloads | ✅ Met | JWT stored in localStorage, verified in session.test.js:78 | + ``` + +**Step 6: Add Attribution** +- Keep the attribution line at the end: + ``` + 🤖 Generated with [Claude Code](https://claude.com/claude-code) + ``` + +**Example Complete Output**: +```markdown +Closes #42 + +## Approach +Implemented session-based authentication using JWT tokens. Chose this approach +for stateless authentication and better scalability compared to server-side sessions. + +## Tasks +- [x] Create login form component +- [x] Implement JWT token generation +- [x] Add authentication middleware +- [x] Write integration tests + +## Expert Review + +> **Instructions for Expert**: Please review the approach and implementation, then fill in this table with your feedback. + +| Aspect | Status | Comments | +|--------|--------|----------| +| Architecture | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Code Quality | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Testing | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Documentation | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | + +## Success Criteria Check + +| Criterion | Status | Evidence | +|-----------|--------|----------| +| Users can log in with username and password | ✅ Met | Login form implemented in auth.component.tsx:45 | +| Session persists across page reloads | ✅ Met | JWT stored in localStorage, verified in session.test.js:78 | +| Invalid credentials show error message | ✅ Met | Error handling tested in auth.test.js:92 | 🤖 Generated with [Claude Code](https://claude.com/claude-code) ``` ### 3. Create PR +**IMPORTANT**: Use HEREDOC syntax for multi-line PR body to ensure correct formatting. + +**HEREDOC Syntax Example**: + +```bash +gh pr create \ + --title "feat: Add user authentication" \ + --body "$(cat <<'EOF' +Closes #42 + +## Approach +Implemented session-based authentication using JWT tokens. Chose this approach for stateless authentication and better scalability compared to server-side sessions. + +## Tasks +- [x] Create login form component +- [x] Implement JWT token generation +- [x] Add authentication middleware +- [x] Write integration tests + +## Expert Review + +> **Instructions for Expert**: Please review the approach and implementation, then fill in this table with your feedback. + +| Aspect | Status | Comments | +|--------|--------|----------| +| Architecture | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Code Quality | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Testing | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | +| Documentation | ⚪ Not Reviewed / ✅ Approved / ⚠️ Needs Changes | | + +## Success Criteria Check + +| Criterion | Status | Evidence | +|-----------|--------|----------| +| Users can log in with username and password | ✅ Met | Login form implemented and tested in auth.test.js:45 | +| Session persists across page reloads | ✅ Met | JWT stored in localStorage, verified in session.test.js:78 | +| Invalid credentials show error message | ✅ Met | Error handling tested in auth.test.js:92 | + +🤖 Generated with [Claude Code](https://claude.com/claude-code) +EOF +)" \ + --base develop \ + --head issue-42 +``` + +**Execute PR Creation**: + Create PR with generated title and description: ```bash gh pr create \ - --title "{generated_title}" \ - --body "{generated_description}" \ - --base "$default_branch" \ - --head "$current_branch" + --title "${generated_title}" \ + --body "${generated_description}" \ + --base "${target_branch}" \ + --head "${current_branch}" +``` + +Capture the PR URL: +```bash +pr_url=$(gh pr view --json url -q .url) +echo "PR created: ${pr_url}" ``` ### 4. Display Result +Display the PR URL and guide user to review on GitHub: + ``` ## PR Creation Complete -**PR**: {pr_url} -**Branch**: {source_branch} → {target_branch} -**Title**: {title} +**PR**: ${pr_url} +**Branch**: ${current_branch} → ${target_branch} +**Title**: ${generated_title} -Please request review from reviewers. +📝 Please review the PR description on GitHub. + If any changes are needed, let me know and I will update it. ``` ## Error Handling | Error | Response | |-------|----------| -| Execute from main branch | Guide to execute from feature/issue branch | +| Execute from main/develop branch | Guide to execute from feature/issue branch | | No commits | Guide to commit changes first | | Push failure | `git pull --rebase` and retry push | | Authentication error | Authenticate with `gh auth login` | +| Issue not found | Create issue first (required for issue-driven development) | +| No issue number provided | Prompt user for issue number (required) | ## Notes 1. **Emoji Usage**: Do not use emojis unless user explicitly requests them 2. **GitHub Permissions**: Requires Write or higher permissions 3. **Title Quality**: Generate appropriate title if commit messages are inadequate -4. **HEREDOC Usage**: Use HEREDOC for multi-line PR body to ensure correct formatting - -### HEREDOC Usage Example - -```bash -gh pr create \ - --title "feat: Add user authentication" \ - --body "$(cat <<'EOF' -## Summary -Added user authentication feature. - -## Changes -- Implemented login form -- Added session management - -🤖 Generated with [Claude Code](https://claude.com/claude-code) -EOF -)" \ - --base main \ - --head feature/auth -``` +4. **HEREDOC Usage**: ALWAYS use HEREDOC for multi-line PR body to ensure correct formatting +5. **Branch Strategy**: PRs should target `develop` by default +6. **Variable Syntax**: Always use `${variable}` or `"$variable"` in bash commands for safety +7. **PR Template**: Use `.claude/skills/pr/templates/pr-template.md` for consistent formatting +8. **Review Flow**: After PR creation, user reviews on GitHub and can request changes from the AI agent +9. **Issue Required**: All PRs must reference a GitHub issue (issue-driven development standard) diff --git a/.github/scripts/clean-repository.sh b/.github/scripts/clean-repository.sh new file mode 100755 index 00000000..e43ed2fc --- /dev/null +++ b/.github/scripts/clean-repository.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e +set -u +set -o pipefail + +# Remove all files except .git/ from target repository +# Usage: ./clean-repository.sh + +# Validate required parameters +TARGET_DIR="${1:-}" +if [ -z "$TARGET_DIR" ]; then + echo "Error: Target directory required" + echo "Usage: $0 " + exit 1 +fi + +# Validate target directory exists +if [ ! -d "$TARGET_DIR" ]; then + echo "Error: Target directory does not exist: $TARGET_DIR" + exit 1 +fi + +echo "Cleaning repository: $TARGET_DIR" + +# Change to target directory +cd "$TARGET_DIR" + +# Remove all files except .git/ +find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} + + +echo "Repository cleaned successfully" diff --git a/.github/scripts/commit-and-push.sh b/.github/scripts/commit-and-push.sh new file mode 100755 index 00000000..0059d35a --- /dev/null +++ b/.github/scripts/commit-and-push.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -e +set -u +set -o pipefail + +# Commit and push changes to repository +# Usage: ./commit-and-push.sh [commit-body] [branch] +# Environment: Working directory should be the target repository + +# Validate required parameters +COMMIT_MESSAGE="${1:-}" +COMMIT_BODY="${2:-}" +BRANCH="${3:-main}" + +if [ -z "$COMMIT_MESSAGE" ]; then + echo "Error: Commit message required" + echo "Usage: $0 [commit-body] [branch]" + exit 1 +fi + +echo "Preparing to commit changes..." + +# Configure git user +git config user.name "github-actions[bot]" +git config user.email "github-actions[bot]@users.noreply.github.com" + +# Stage all changes +git add . + +# Check if there are changes to commit +if git diff --staged --quiet; then + echo "No changes to commit" + exit 0 +fi + +# Create commit with message and optional body +if [ -n "$COMMIT_BODY" ]; then + git commit -m "$COMMIT_MESSAGE" -m "$COMMIT_BODY" +else + git commit -m "$COMMIT_MESSAGE" +fi + +# Push to origin +echo "Pushing to origin ${BRANCH}..." +git push origin "${BRANCH}" + +echo "Changes committed and pushed successfully to ${BRANCH}" diff --git a/.github/scripts/create-version-tag.sh b/.github/scripts/create-version-tag.sh new file mode 100755 index 00000000..57e4fdd9 --- /dev/null +++ b/.github/scripts/create-version-tag.sh @@ -0,0 +1,34 @@ +#!/bin/bash +set -e +set -u +set -o pipefail + +# Create and push version tag if it doesn't exist +# Usage: ./create-version-tag.sh +# Environment: Working directory should be the target repository + +# Validate required parameters +VERSION="${1:-}" + +if [ -z "$VERSION" ]; then + echo "Error: Version required" + echo "Usage: $0 " + exit 1 +fi + +TAG_NAME="${VERSION}" + +echo "Processing version tag: ${TAG_NAME}" + +# Check if tag already exists on remote +if git ls-remote --tags origin | grep -q "refs/tags/${TAG_NAME}"; then + echo "Tag ${TAG_NAME} already exists on remote, skipping tag creation" + exit 0 +fi + +# Create and push tag +echo "Creating tag: ${TAG_NAME}" +git tag -a "${TAG_NAME}" -m "Release version ${VERSION}" +git push origin "${TAG_NAME}" + +echo "Successfully created and pushed tag: ${TAG_NAME}" diff --git a/.github/scripts/transform-to-plugin.sh b/.github/scripts/transform-to-plugin.sh index d9124c42..c52ce8f3 100755 --- a/.github/scripts/transform-to-plugin.sh +++ b/.github/scripts/transform-to-plugin.sh @@ -32,9 +32,10 @@ mkdir -p "$DEST_DIR/plugins/nabledge-6/skills/nabledge-6" echo "Copying marketplace.json..." cp "$SOURCE_DIR/.claude/marketplace/.claude-plugin/marketplace.json" "$DEST_DIR/.claude-plugin/" -# Copy marketplace README and LICENSE to root -echo "Copying marketplace README and LICENSE..." +# Copy marketplace README, CHANGELOG, and LICENSE to root +echo "Copying marketplace README, CHANGELOG, and LICENSE..." cp "$SOURCE_DIR/.claude/marketplace/README.md" "$DEST_DIR/README.md" +cp "$SOURCE_DIR/.claude/marketplace/CHANGELOG.md" "$DEST_DIR/CHANGELOG.md" cp "$SOURCE_DIR/.claude/marketplace/LICENSE" "$DEST_DIR/" # Copy nabledge-6 plugin files @@ -53,6 +54,8 @@ cp -r "$SOURCE_DIR/.claude/skills/nabledge-6/docs" "$DEST_DIR/plugins/nabledge-6 # Plugin-specific files cp "$SOURCE_DIR/.claude/skills/nabledge-6/plugin/README.md" "$DEST_DIR/plugins/nabledge-6/" cp "$SOURCE_DIR/.claude/skills/nabledge-6/plugin/CHANGELOG.md" "$DEST_DIR/plugins/nabledge-6/" +cp "$SOURCE_DIR/.claude/skills/nabledge-6/plugin/GUIDE-CC.md" "$DEST_DIR/plugins/nabledge-6/" +cp "$SOURCE_DIR/.claude/skills/nabledge-6/plugin/GUIDE-GHC.md" "$DEST_DIR/plugins/nabledge-6/" # Copy setup scripts to root echo "Copying setup scripts to root..." diff --git a/.github/scripts/validate-marketplace.sh b/.github/scripts/validate-marketplace.sh new file mode 100755 index 00000000..d5b5dd35 --- /dev/null +++ b/.github/scripts/validate-marketplace.sh @@ -0,0 +1,65 @@ +#!/bin/bash +set -e +set -u +set -o pipefail + +# Validate marketplace directory structure and JSON formats +# Usage: ./validate-marketplace.sh + +# Validate required parameters +MARKETPLACE_ROOT="${1:-}" +if [ -z "$MARKETPLACE_ROOT" ]; then + echo "Error: Marketplace root directory required" + echo "Usage: $0 " + exit 1 +fi + +# Validate directory exists +if [ ! -d "$MARKETPLACE_ROOT" ]; then + echo "Error: Marketplace root directory does not exist: $MARKETPLACE_ROOT" + exit 1 +fi + +echo "Validating marketplace structure in: $MARKETPLACE_ROOT" + +# Check marketplace files exist +echo "Checking marketplace files..." +test -f "$MARKETPLACE_ROOT/.claude-plugin/marketplace.json" || { echo "Error: marketplace.json not found"; exit 1; } +test -f "$MARKETPLACE_ROOT/README.md" || { echo "Error: Root README.md not found"; exit 1; } +test -f "$MARKETPLACE_ROOT/LICENSE" || { echo "Error: Root LICENSE not found"; exit 1; } + +# Check nabledge-6 plugin structure +echo "Checking nabledge-6 plugin structure..." +test -f "$MARKETPLACE_ROOT/plugins/nabledge-6/.claude-plugin/plugin.json" || { echo "Error: nabledge-6/plugin.json not found"; exit 1; } +test -f "$MARKETPLACE_ROOT/plugins/nabledge-6/skills/nabledge-6/SKILL.md" || { echo "Error: nabledge-6/SKILL.md not found"; exit 1; } +test -f "$MARKETPLACE_ROOT/plugins/nabledge-6/README.md" || { echo "Error: nabledge-6/README.md not found"; exit 1; } +test -f "$MARKETPLACE_ROOT/plugins/nabledge-6/CHANGELOG.md" || { echo "Error: nabledge-6/CHANGELOG.md not found"; exit 1; } + +# Check nabledge-6 supporting directories (inside skills/nabledge-6/) +echo "Checking nabledge-6 supporting directories..." +test -d "$MARKETPLACE_ROOT/plugins/nabledge-6/skills/nabledge-6/workflows" || { echo "Error: nabledge-6/skills/nabledge-6/workflows not found"; exit 1; } +test -d "$MARKETPLACE_ROOT/plugins/nabledge-6/skills/nabledge-6/assets" || { echo "Error: nabledge-6/skills/nabledge-6/assets not found"; exit 1; } +test -d "$MARKETPLACE_ROOT/plugins/nabledge-6/skills/nabledge-6/knowledge" || { echo "Error: nabledge-6/skills/nabledge-6/knowledge not found"; exit 1; } +test -d "$MARKETPLACE_ROOT/plugins/nabledge-6/skills/nabledge-6/docs" || { echo "Error: nabledge-6/skills/nabledge-6/docs not found"; exit 1; } + +# Check setup scripts exist at root +echo "Checking setup scripts..." +test -f "$MARKETPLACE_ROOT/setup-6-cc.sh" || { echo "Error: setup-6-cc.sh not found at root"; exit 1; } +test -f "$MARKETPLACE_ROOT/setup-6-ghc.sh" || { echo "Error: setup-6-ghc.sh not found at root"; exit 1; } + +# Validate JSON formats +echo "Validating JSON formats..." +jq empty "$MARKETPLACE_ROOT/.claude-plugin/marketplace.json" || { echo "Error: Invalid marketplace.json"; exit 1; } +jq empty "$MARKETPLACE_ROOT/plugins/nabledge-6/.claude-plugin/plugin.json" || { echo "Error: Invalid plugin.json"; exit 1; } + +# Validate marketplace.json structure +echo "Validating marketplace.json structure..." +jq -e '.name' "$MARKETPLACE_ROOT/.claude-plugin/marketplace.json" > /dev/null || { echo "Error: marketplace.json missing 'name' field"; exit 1; } +jq -e '.plugins' "$MARKETPLACE_ROOT/.claude-plugin/marketplace.json" > /dev/null || { echo "Error: marketplace.json missing 'plugins' array"; exit 1; } + +# Validate plugin.json structure +echo "Validating plugin.json structure..." +jq -e '.name' "$MARKETPLACE_ROOT/plugins/nabledge-6/.claude-plugin/plugin.json" > /dev/null || { echo "Error: plugin.json missing 'name' field"; exit 1; } +jq -e '.version' "$MARKETPLACE_ROOT/plugins/nabledge-6/.claude-plugin/plugin.json" > /dev/null || { echo "Error: plugin.json missing 'version' field"; exit 1; } + +echo "Marketplace structure validation passed!" diff --git a/.github/scripts/validate-version-updates.sh b/.github/scripts/validate-version-updates.sh new file mode 100755 index 00000000..5f0ac02c --- /dev/null +++ b/.github/scripts/validate-version-updates.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -e +set -u +set -o pipefail + +# Validate that version files are updated when non-infrastructure files change +# Usage: ./validate-version-updates.sh + +echo "Validating version updates..." + +# Get list of changed files +CHANGED_FILES=$(git diff HEAD~1 HEAD --name-only) + +# Check if only infrastructure files were changed +INFRA_ONLY=true +while IFS= read -r file; do + if [[ ! "$file" =~ ^\.github/ ]] && \ + [[ ! "$file" =~ ^\.claude/marketplace ]] && \ + [[ ! "$file" =~ ^\.claude/rules/ ]] && \ + [[ "$file" != *"transform-to-plugin.sh"* ]]; then + INFRA_ONLY=false + break + fi +done <<< "$CHANGED_FILES" + +# If non-infrastructure files changed, require version update +if [ "$INFRA_ONLY" = false ]; then + if ! echo "$CHANGED_FILES" | grep -q "plugin/plugin.json\|plugin/CHANGELOG.md\|marketplace/.claude-plugin/marketplace.json"; then + echo "Error: plugin.json, CHANGELOG.md, or marketplace.json must be updated before sync" + exit 1 + fi + echo "Version files updated - validation passed" +else + echo "Infrastructure-only changes detected, skipping version validation" +fi + +echo "Version validation completed successfully" diff --git a/.github/workflows/sync-to-nabledge.yml b/.github/workflows/sync-to-nabledge.yml index bb8dd7e9..2505ecde 100644 --- a/.github/workflows/sync-to-nabledge.yml +++ b/.github/workflows/sync-to-nabledge.yml @@ -3,7 +3,7 @@ name: Sync to nabledge repository on: push: branches: - - main + - refactor-extract-workflow-scripts jobs: sync: @@ -16,155 +16,38 @@ jobs: fetch-depth: 0 - name: Validate version updates - run: | - # Get list of changed files - CHANGED_FILES=$(git diff HEAD~1 HEAD --name-only) - - # Check if only infrastructure files were changed - INFRA_ONLY=true - while IFS= read -r file; do - if [[ ! "$file" =~ ^\.github/ ]] && \ - [[ ! "$file" =~ ^\.claude/marketplace ]] && \ - [[ ! "$file" =~ ^\.claude/rules/ ]] && \ - [[ "$file" != *"transform-to-plugin.sh"* ]]; then - INFRA_ONLY=false - break - fi - done <<< "$CHANGED_FILES" - - # If non-infrastructure files changed, require version update - if [ "$INFRA_ONLY" = false ]; then - if ! echo "$CHANGED_FILES" | grep -q "plugin/plugin.json\|plugin/CHANGELOG.md\|marketplace/.claude-plugin/marketplace.json"; then - echo "Error: plugin.json, CHANGELOG.md, or marketplace.json must be updated before sync" - exit 1 - fi - else - echo "Infrastructure-only changes detected, skipping version validation" - fi + run: .github/scripts/validate-version-updates.sh - name: Checkout nabledge repository uses: actions/checkout@v4 with: repository: nablarch/nabledge - ref: main + ref: test-to token: ${{ secrets.NABLEDGE_SYNC_TOKEN }} path: nabledge-repo - name: Clean nabledge repository - run: | - cd nabledge-repo - # Remove all files except .git/ - find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} + + run: .github/scripts/clean-repository.sh nabledge-repo - name: Transform to plugin structure run: | # Use transform script .github/scripts/transform-to-plugin.sh . nabledge-repo - - name: Update CHANGELOG.md - run: | - TRIGGER_COMMIT_SHA="${{ github.sha }}" - TRIGGER_COMMIT_URL="https://github.com/${{ github.repository }}/commit/${TRIGGER_COMMIT_SHA}" - DATE=$(date +%Y-%m-%d) - - # Append sync entry to nabledge-6 plugin CHANGELOG - CHANGELOG_FILE="nabledge-repo/plugins/nabledge-6/CHANGELOG.md" - TEMP_FILE=$(mktemp) - - # Read first line (# Changelog) - head -n 1 "$CHANGELOG_FILE" > "$TEMP_FILE" - - # Add new unreleased section using printf - printf "\n## [Unreleased] - %s\n\n### Changed\n- Synced from: %s\n\n" "$DATE" "$TRIGGER_COMMIT_URL" >> "$TEMP_FILE" - - # Append rest of original file - tail -n +2 "$CHANGELOG_FILE" >> "$TEMP_FILE" - - # Replace original file - mv "$TEMP_FILE" "$CHANGELOG_FILE" - - name: Validate marketplace structure - run: | - echo "Validating marketplace structure..." - - # Check marketplace files exist - test -f nabledge-repo/.claude-plugin/marketplace.json || { echo "Error: marketplace.json not found"; exit 1; } - test -f nabledge-repo/README.md || { echo "Error: Root README.md not found"; exit 1; } - test -f nabledge-repo/LICENSE || { echo "Error: Root LICENSE not found"; exit 1; } - - # Check nabledge-6 plugin structure - test -f nabledge-repo/plugins/nabledge-6/.claude-plugin/plugin.json || { echo "Error: nabledge-6/plugin.json not found"; exit 1; } - test -f nabledge-repo/plugins/nabledge-6/skills/nabledge-6/SKILL.md || { echo "Error: nabledge-6/SKILL.md not found"; exit 1; } - test -f nabledge-repo/plugins/nabledge-6/README.md || { echo "Error: nabledge-6/README.md not found"; exit 1; } - test -f nabledge-repo/plugins/nabledge-6/CHANGELOG.md || { echo "Error: nabledge-6/CHANGELOG.md not found"; exit 1; } - - # Check nabledge-6 supporting directories (inside skills/nabledge-6/) - test -d nabledge-repo/plugins/nabledge-6/skills/nabledge-6/workflows || { echo "Error: nabledge-6/skills/nabledge-6/workflows not found"; exit 1; } - test -d nabledge-repo/plugins/nabledge-6/skills/nabledge-6/assets || { echo "Error: nabledge-6/skills/nabledge-6/assets not found"; exit 1; } - test -d nabledge-repo/plugins/nabledge-6/skills/nabledge-6/knowledge || { echo "Error: nabledge-6/skills/nabledge-6/knowledge not found"; exit 1; } - test -d nabledge-repo/plugins/nabledge-6/skills/nabledge-6/docs || { echo "Error: nabledge-6/skills/nabledge-6/docs not found"; exit 1; } - - # Check setup scripts exist at root - test -f nabledge-repo/setup-6-cc.sh || { echo "Error: setup-6-cc.sh not found at root"; exit 1; } - test -f nabledge-repo/setup-6-ghc.sh || { echo "Error: setup-6-ghc.sh not found at root"; exit 1; } - - # Validate JSON formats - echo "Validating JSON formats..." - jq empty nabledge-repo/.claude-plugin/marketplace.json || { echo "Error: Invalid marketplace.json"; exit 1; } - jq empty nabledge-repo/plugins/nabledge-6/.claude-plugin/plugin.json || { echo "Error: Invalid plugin.json"; exit 1; } - - # Validate marketplace.json structure - echo "Validating marketplace.json structure..." - jq -e '.name' nabledge-repo/.claude-plugin/marketplace.json > /dev/null || { echo "Error: marketplace.json missing 'name' field"; exit 1; } - jq -e '.plugins' nabledge-repo/.claude-plugin/marketplace.json > /dev/null || { echo "Error: marketplace.json missing 'plugins' array"; exit 1; } - - # Validate plugin.json structure - echo "Validating plugin.json structure..." - jq -e '.name' nabledge-repo/plugins/nabledge-6/.claude-plugin/plugin.json > /dev/null || { echo "Error: plugin.json missing 'name' field"; exit 1; } - jq -e '.version' nabledge-repo/plugins/nabledge-6/.claude-plugin/plugin.json > /dev/null || { echo "Error: plugin.json missing 'version' field"; exit 1; } - - echo "Marketplace structure validation passed!" - - - name: Configure Git - working-directory: nabledge-repo - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + run: .github/scripts/validate-marketplace.sh nabledge-repo - name: Commit and Push to nabledge working-directory: nabledge-repo run: | - git add . - - if git diff --staged --quiet; then - echo "No changes to commit" - exit 0 - fi - - TRIGGER_COMMIT_SHA="${{ github.sha }}" - TRIGGER_COMMIT_URL="https://github.com/${{ github.repository }}/commit/${TRIGGER_COMMIT_SHA}" - - git commit -m "Sync nabledge marketplace from nabledge-dev" -m "Triggered by: ${TRIGGER_COMMIT_URL}" - - git push origin main + TRIGGER_COMMIT_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }}" + ../.github/scripts/commit-and-push.sh \ + "Sync nabledge marketplace from nabledge-dev" \ + "Triggered by: ${TRIGGER_COMMIT_URL}" \ + "test-to" - name: Create and push version tag working-directory: nabledge-repo run: | - # Extract version from marketplace.json VERSION=$(jq -r '.metadata.version' .claude-plugin/marketplace.json) - TAG_NAME="${VERSION}" - - echo "Creating tag: ${TAG_NAME}" - - # Check if tag already exists on remote - if git ls-remote --tags origin | grep -q "refs/tags/${TAG_NAME}"; then - echo "Tag ${TAG_NAME} already exists on remote, skipping tag creation" - exit 0 - fi - - # Create and push tag - git tag -a "${TAG_NAME}" -m "Release version ${VERSION}" - git push origin "${TAG_NAME}" - - echo "Successfully created and pushed tag: ${TAG_NAME}" + ../.github/scripts/create-version-tag.sh "$VERSION" diff --git a/scripts/setup-6-cc.sh b/scripts/setup-6-cc.sh index 00beeea0..66c97252 100755 --- a/scripts/setup-6-cc.sh +++ b/scripts/setup-6-cc.sh @@ -11,13 +11,20 @@ fi echo "Setting up Nabledge-6 plugin for Claude Code..." echo "Project root: $PROJECT_ROOT" -# Configuration -REPO_OWNER="nablarch" -REPO_NAME="nabledge" -BRANCH="main" +# Configuration (can be overridden with environment variables) +NABLEDGE_REPO="${NABLEDGE_REPO:-nablarch/nabledge}" +NABLEDGE_BRANCH="${NABLEDGE_BRANCH:-main}" + +# Parse repository owner and name from NABLEDGE_REPO +REPO_OWNER="${NABLEDGE_REPO%/*}" +REPO_NAME="${NABLEDGE_REPO#*/}" +BRANCH="$NABLEDGE_BRANCH" MARKETPLACE_NAME="nabledge" PLUGIN_NAME="nabledge-6" +echo "Repository: $NABLEDGE_REPO" +echo "Branch: $BRANCH" + # Create .claude directory if it doesn't exist mkdir -p "$PROJECT_ROOT/.claude" diff --git a/scripts/setup-6-ghc.sh b/scripts/setup-6-ghc.sh index 9fc25b33..7799cbcf 100755 --- a/scripts/setup-6-ghc.sh +++ b/scripts/setup-6-ghc.sh @@ -11,15 +11,22 @@ fi echo "Setting up Nabledge-6 skill for GitHub Copilot..." echo "Project root: $PROJECT_ROOT" -# Download nabledge-6 plugin from nablarch/nabledge repository -REPO_URL="https://github.com/nablarch/nabledge" -BRANCH="main" +# Configuration (can be overridden with environment variables) +NABLEDGE_REPO="${NABLEDGE_REPO:-nablarch/nabledge}" +NABLEDGE_BRANCH="${NABLEDGE_BRANCH:-main}" + +# Build repository URL +REPO_URL="https://github.com/${NABLEDGE_REPO}" +REPO_NAME="${NABLEDGE_REPO##*/}" +BRANCH="$NABLEDGE_BRANCH" TEMP_DIR=$(mktemp -d) +echo "Repository: $NABLEDGE_REPO" +echo "Branch: $BRANCH" echo "Downloading nabledge-6 plugin from $REPO_URL (branch: $BRANCH)..." cd "$TEMP_DIR" git clone --depth 1 --filter=blob:none --sparse --branch "$BRANCH" "$REPO_URL" -cd nabledge +cd "$REPO_NAME" git sparse-checkout set plugins/nabledge-6 # Create .claude/skills directory @@ -28,7 +35,7 @@ mkdir -p "$PROJECT_ROOT/.claude/skills" # Copy skills/nabledge-6 directory as-is echo "Copying nabledge-6 skill to project..." -cp -r "$TEMP_DIR/nabledge/plugins/nabledge-6/skills/nabledge-6" "$PROJECT_ROOT/.claude/skills/" +cp -r "$TEMP_DIR/$REPO_NAME/plugins/nabledge-6/skills/nabledge-6" "$PROJECT_ROOT/.claude/skills/" # Clean up rm -rf "$TEMP_DIR" @@ -93,8 +100,31 @@ if ! command -v jq &> /dev/null; then echo "jq installed successfully!" fi +# Configure VS Code settings for GitHub Copilot skills +echo "Configuring VS Code settings for GitHub Copilot skills..." +mkdir -p "$PROJECT_ROOT/.vscode" + +if [ -f "$PROJECT_ROOT/.vscode/settings.json" ]; then + # Existing file - check if chat.useAgentSkills already exists + if jq -e '.["chat.useAgentSkills"]' "$PROJECT_ROOT/.vscode/settings.json" > /dev/null 2>&1; then + echo "chat.useAgentSkills setting already exists in .vscode/settings.json" + else + # Add setting to existing file + jq '. + {"chat.useAgentSkills": true}' "$PROJECT_ROOT/.vscode/settings.json" > "$PROJECT_ROOT/.vscode/settings.json.tmp" + mv "$PROJECT_ROOT/.vscode/settings.json.tmp" "$PROJECT_ROOT/.vscode/settings.json" + echo "Added chat.useAgentSkills to existing .vscode/settings.json" + fi +else + # Create new file + echo '{"chat.useAgentSkills": true}' | jq '.' > "$PROJECT_ROOT/.vscode/settings.json" + echo "Created .vscode/settings.json with chat.useAgentSkills setting" +fi + echo "" echo "Setup complete! The nabledge-6 skill is now available in your project." echo "Location: $PROJECT_ROOT/.claude/skills/nabledge-6" echo "" -echo "You can use it with GitHub Copilot by typing '/nabledge-6' in your editor." +echo "GitHub Copilot skills have been enabled in .vscode/settings.json" +echo "Commit .vscode/settings.json to share this configuration with your team." +echo "" +echo "You can now use nabledge-6 with GitHub Copilot by asking questions in natural language."