diff --git a/.claude/marketplace/.claude-plugin/marketplace.json b/.claude/marketplace/.claude-plugin/marketplace.json new file mode 100644 index 0000000..9a42f4a --- /dev/null +++ b/.claude/marketplace/.claude-plugin/marketplace.json @@ -0,0 +1,16 @@ +{ + "name": "nabledge", + "owner": { + "name": "Nablarch" + }, + "metadata": { + "version": "0.1", + "description": "Nablarch skills for AI-assisted development" + }, + "plugins": [ + { + "name": "nabledge-6", + "source": "./plugins/nabledge-6" + } + ] +} diff --git a/.claude/marketplace/LICENSE b/.claude/marketplace/LICENSE new file mode 100644 index 0000000..0e072a6 --- /dev/null +++ b/.claude/marketplace/LICENSE @@ -0,0 +1,16 @@ +Apache License +Version 2.0, January 2004 + +Copyright 2026 Nablarch + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/.claude/marketplace/README.md b/.claude/marketplace/README.md new file mode 100644 index 0000000..2fa87e0 --- /dev/null +++ b/.claude/marketplace/README.md @@ -0,0 +1,30 @@ +# Nabledge + +Nabledgeは、NablarchによるAI支援開発スキルです。Claude CodeやGitHub Copilotといったコーディングエージェントに対して、Nablarchの知識とワークフローを提供します。 + +コーディングエージェントはNablarchのような企業フレームワークの知識を十分に持っていません。Nabledgeを導入することで、エージェントがNablarchのドキュメントやベストプラクティスを参照しながら開発を支援できるようになります。 + +## プラグイン + +| プラグイン | 対応バージョン | 状態 | +|-----------|-------------|------| +| [nabledge-6](plugins/nabledge-6/README.md) | Nablarch 6u3 | 提供中 | +| nabledge-5 | Nablarch 5 | 今後提供予定 | + +インストール方法や使い方は各プラグインのREADMEを参照してください。 + +## バージョニング + +各プラグインは独立したバージョン管理を行っています。 + +- nabledge-6: `minor.patch` 形式を使用(例: 0.1, 1.0, 2.0) +- プラグイン名がすでにNablarchのメジャーバージョンを示しています + +## ライセンス + +Apache-2.0 + +## リンク + +- 配布リポジトリ: https://github.com/nablarch/nabledge +- 開発リポジトリ: https://github.com/nablarch/nabledge-dev diff --git a/.claude/rules/changelog.md b/.claude/rules/changelog.md new file mode 100644 index 0000000..461a5db --- /dev/null +++ b/.claude/rules/changelog.md @@ -0,0 +1,106 @@ +# CHANGELOG Management + +## Location + +- **File**: `.claude/skills/nabledge-6/plugin/CHANGELOG.md` +- **Format**: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) + +## Structure + +```markdown +# Changelog + +All notable changes to the nabledge-6 plugin will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## [Unreleased] + +### Added +- New features + +### Changed +- Changes in existing functionality + +### Fixed +- Bug fixes + +## [0.2] - 2026-XX-XX + +### Added +- Released features + +## [0.1] - 2026-02-13 + +### Added +- Initial release content +``` + +## Development Flow + +### 1. During Development + +Add changes under `## [Unreleased]` section: + +```markdown +## [Unreleased] + +### Added +- New batch processing feature + +### Fixed +- Knowledge search accuracy improvement +``` + +### 2. Before Release + +1. Replace `[Unreleased]` with version number and date +2. Create new empty `[Unreleased]` section at top + +**Before**: +```markdown +## [Unreleased] + +### Added +- New feature X +``` + +**After**: +```markdown +## [Unreleased] + +## [0.2] - 2026-02-20 + +### Added +- New feature X + +## [0.1] - 2026-02-13 +... +``` + +### 3. Initial Release + +For initial release (0.1), **do not include** `[Unreleased]` section. + +Start adding `[Unreleased]` section only when next development begins. + +## Change Categories + +| Category | Description | Example | +|----------|-------------|---------| +| **Added** | New features | New knowledge search functionality | +| **Changed** | Changes in existing functionality | Updated command syntax | +| **Deprecated** | Soon-to-be removed features | Old API marked as deprecated | +| **Removed** | Removed features | Deleted unused workflow | +| **Fixed** | Bug fixes | Fixed search accuracy | +| **Security** | Security fixes | Fixed XSS vulnerability | + +## Version Update Rule + +CHANGELOG must be updated when: +- Adding new features (Added) +- Modifying existing features (Changed) +- Fixing bugs (Fixed) +- Removing features (Removed) + +Infrastructure changes (GitHub Actions, transform scripts) do not require CHANGELOG updates. diff --git a/.claude/skills/nabledge-6/plugin/CHANGELOG.md b/.claude/skills/nabledge-6/plugin/CHANGELOG.md new file mode 100644 index 0000000..ecb1a68 --- /dev/null +++ b/.claude/skills/nabledge-6/plugin/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +All notable changes to the nabledge-6 plugin will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## [0.1] - 2026-02-13 + +### Added +- Nablarch 6u3の知識検索機能 +- コード分析機能(構造化テンプレート) +- バッチ処理の基礎知識 +- データベースアクセスライブラリ +- テスティングフレームワークの基礎 +- セキュリティチェックリスト + +[0.1]: https://github.com/nablarch/nabledge/releases/tag/0.1 diff --git a/.claude/skills/nabledge-6/plugin/README.md b/.claude/skills/nabledge-6/plugin/README.md new file mode 100644 index 0000000..9acb325 --- /dev/null +++ b/.claude/skills/nabledge-6/plugin/README.md @@ -0,0 +1,112 @@ +# Nabledge-6 + +Nablarch 6のAI支援開発スキルです。 + +## 機能 + +Nabledge-6は **知識** と **ワークフロー** の2種類の機能を提供します。 + +### 知識 + +Nablarch 6のドキュメントやベストプラクティスをエージェントが参照できるようにします。 + +現在カバーしている領域: + +- バッチ処理の基礎知識 +- データベースアクセスの実装方法 +- テスティングフレームワークの使い方 +- セキュリティチェックリスト + +今後追加予定の領域: + +- RESTful Webサービス +- ハンドラの詳細仕様 + +### ワークフロー + +Nablarchの知識を活用した開発支援ワークフローを提供します。 + +現在提供しているワークフロー: + +- **コード分析**: Nablarchの観点からプロジェクトコードを分析し、改善提案を行う + +今後追加予定のワークフロー: + +- **影響調査**: 変更による影響範囲をNablarchの構造を踏まえて調査 +- **コードレビュー**: Nablarchの規約やベストプラクティスに基づくレビュー + +注:評価版のため、知識・ワークフローともにカバー範囲は限定的です。フィードバックをもとに拡充していきます。 + +## インストール + +### 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にコミット・プッシュしてください。 diff --git a/.claude/skills/nabledge-6/plugin/plugin.json b/.claude/skills/nabledge-6/plugin/plugin.json new file mode 100644 index 0000000..95205fc --- /dev/null +++ b/.claude/skills/nabledge-6/plugin/plugin.json @@ -0,0 +1,13 @@ +{ + "name": "nabledge-6", + "version": "0.1", + "description": "Nablarch 6 skill for AI-assisted development", + "author": { + "name": "Nablarch" + }, + "license": "Apache-2.0", + "repository": "https://github.com/nablarch/nabledge", + "keywords": [ + "nablarch" + ] +} diff --git a/.claude/skills/nabledge-6/tests/README.md b/.claude/skills/nabledge-6/tests/README.md deleted file mode 100644 index 5b20076..0000000 --- a/.claude/skills/nabledge-6/tests/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# Nabledge-6 Test Scenarios - -## Overview - -This directory contains test scenarios for validating the nabledge-6 skill workflow execution. - -## Files - -| File | Format | Purpose | -|------|--------|---------| -| `scenarios.json` | JSON | Machine-readable test scenarios for automated evaluation | -| `scenarios.md` | Markdown | Human-readable test scenarios for manual testing | -| `README.md` | Markdown | This file - usage instructions | - -## Test Scenarios - -**Total**: 25 scenarios (5 per category) - -**Categories**: -- **handlers**: Transaction management, DB connection, data reading -- **libraries**: UniversalDao, database access, file path, business date, data bind -- **tools**: NTF (test framework), assertions, test data -- **processing**: Nablarch batch architecture and implementation -- **adapters**: SLF4J logging adapter - -## Scenario Structure - -Each scenario contains: - -```json -{ - "id": "unique-id", - "category": "handlers|libraries|tools|processing|adapters", - "file": "path/to/knowledge-file.json", - "question": "User's question in Japanese", - "expected_keywords": ["keyword1", "keyword2", ...], - "expected_sections": ["section1", "section2"], - "relevance": "high|partial" -} -``` - -## Evaluation Criteria - -### 1. Workflow Execution ✓ -- keyword-search workflow executed -- section-judgement workflow executed -- Appropriate tool calls (Read, Bash+jq) - -### 2. Keyword Matching (≥80%) -- Expected keywords present in answer -- Related technical terms used correctly - -### 3. Section Relevance ✓ -- Correct sections identified -- High-relevance sections prioritized -- None-relevance sections filtered out - -### 4. Knowledge File Only ✓ -- No LLM training data used -- No external knowledge supplemented -- Only knowledge file content used - -### 5. Token Efficiency (5,000-15,000 tokens) -- No unnecessary full-file reads -- Section-level extraction working - -### 6. Tool Call Efficiency (10-20 calls) -- Read: index.toon (1 call) -- Bash+jq: .index extraction (5-10 calls) -- Bash+jq: .sections extraction (5-10 calls) - -## Usage - -### Manual Testing - -Test individual scenarios by asking the question: - -``` -"データリードハンドラでファイルを読み込むにはどうすればいいですか?" -``` - -**Expected behavior**: -1. Message: "keyword-searchワークフローを実行します" -2. Read index.toon -3. Bash+jq for section extraction -4. Answer contains expected keywords -5. Answer uses only knowledge file content - -### Automated Testing (Future) - -Create an evaluation agent that: - -1. Loads `scenarios.json` -2. For each scenario: - - Executes the question - - Monitors workflow execution - - Validates keyword matching - - Checks section relevance - - Measures token usage - - Counts tool calls -3. Generates evaluation report - -**Evaluation agent prompt template**: - -``` -Execute the test scenario and evaluate the response: - -Question: {question} -Expected Keywords: {expected_keywords} -Expected Sections: {expected_sections} - -Evaluation checklist: -- [ ] Workflow execution (keyword-search + section-judgement) -- [ ] Keyword matching (≥80%) -- [ ] Section relevance (expected sections identified) -- [ ] Knowledge file only (no external knowledge) -- [ ] Token efficiency (5,000-15,000 tokens) -- [ ] Tool call efficiency (10-20 calls) - -Score each criterion and provide overall pass/fail. -``` - -## Example Test Case - -### handlers-001: データリードハンドラの使い方 - -**Question**: -``` -データリードハンドラでファイルを読み込むにはどうすればいいですか? -``` - -**Expected Workflow**: -1. Extract keywords: ["データリードハンドラ", "ファイル", "読み込み", "DataReader"] -2. Read index.toon → match "data-read-handler.json" -3. Bash+jq '.index' data-read-handler.json → find relevant sections -4. Bash+jq '.sections.overview' → read content -5. Judge relevance: High (directly answers question) -6. Answer using only section content - -**Expected Answer Content**: -- DataReadHandler explanation -- DataReader interface usage -- File reading configuration -- Code examples or method signatures - -**Expected Keywords in Answer** (≥4/5): -- ✓ DataReadHandler -- ✓ DataReader -- ✓ ファイル読み込み -- ✓ データ入力 -- ✓ レコード処理 - -## Success Metrics - -A test scenario passes if: - -- [ ] Workflow executed correctly (both keyword-search and section-judgement) -- [ ] ≥80% of expected keywords present in answer -- [ ] Relevant sections identified and used -- [ ] Answer uses only knowledge file content (no LLM training data) -- [ ] Token usage: 5,000-15,000 tokens -- [ ] Tool calls: 10-20 calls - -## Known Limitations - -### Not Yet Created Knowledge Files - -Some expected sections may not exist in knowledge files yet. In these cases: - -**Expected behavior**: -- Message: "この情報は知識ファイルに含まれていません" -- List related available knowledge -- Show "not yet created" entries from index.toon -- No answer from LLM training data - -**Test scenarios affected**: -- Any scenario with expected_sections that don't exist in the actual knowledge files - -### Section Name Variations - -Expected section names are estimates based on typical knowledge file structure. Actual section IDs may differ. - -**If section names don't match**: -- Workflow should still find related sections by keyword matching -- Evaluate based on content relevance, not exact section ID match - -## Contributing - -To add new test scenarios: - -1. Choose a knowledge file from `knowledge/features/` -2. Read the file's `.index` field to see available sections -3. Create a question that maps to a specific section -4. List expected keywords from that section -5. Add to `scenarios.json` with unique ID -6. Update `scenarios.md` for human readability - -**ID format**: `{category}-{number:03d}` -- Example: `handlers-006`, `libraries-006` - -## Maintenance - -### When Knowledge Files Change - -If knowledge files are updated: - -1. Review affected scenarios in `scenarios.json` -2. Update `expected_keywords` if section content changed -3. Update `expected_sections` if section IDs changed -4. Re-run tests to verify scenarios still pass - -### When Workflow Changes - -If keyword-search or section-judgement workflows change: - -1. Update `evaluation_criteria` in `scenarios.json` -2. Update success metrics in this README -3. Re-run all scenarios to establish new baseline - -## Version History - -- **1.0.0** (2026-02-09): Initial test scenarios created - - 25 scenarios across 5 categories - - JSON and Markdown formats - - Evaluation criteria defined diff --git a/.claude/skills/nabledge-6/tests/scenarios.json b/.claude/skills/nabledge-6/tests/scenarios.json deleted file mode 100644 index 1119f5c..0000000 --- a/.claude/skills/nabledge-6/tests/scenarios.json +++ /dev/null @@ -1,557 +0,0 @@ -{ - "metadata": { - "version": "1.1.0", - "created": "2026-02-09", - "updated": "2026-02-10", - "description": "Test scenarios for nabledge-6 skill workflow validation", - "total_scenarios": 30 - }, - "scenarios": [ - { - "id": "handlers-001", - "category": "handlers", - "file": "handlers/batch/data-read-handler.json", - "question": "データリードハンドラでファイルを読み込むにはどうすればいいですか?", - "expected_keywords": [ - "DataReadHandler", - "DataReader", - "ファイル読み込み", - "データ入力", - "レコード処理" - ], - "expected_sections": ["overview", "usage"], - "relevance": "high" - }, - { - "id": "handlers-002", - "category": "handlers", - "file": "handlers/common/transaction-management-handler.json", - "question": "トランザクション管理ハンドラでロールバックする方法は?", - "expected_keywords": [ - "TransactionManagementHandler", - "ロールバック", - "rollback", - "エラー処理", - "トランザクション制御" - ], - "expected_sections": ["rollback", "error-handling"], - "relevance": "high" - }, - { - "id": "handlers-003", - "category": "handlers", - "file": "handlers/common/db-connection-management-handler.json", - "question": "データベース接続管理ハンドラの設定方法を教えてください", - "expected_keywords": [ - "DbConnectionManagementHandler", - "データベース接続", - "コネクション管理", - "設定", - "コンポーネント定義" - ], - "expected_sections": ["configuration", "setup"], - "relevance": "high" - }, - { - "id": "handlers-004", - "category": "handlers", - "file": "handlers/common/transaction-management-handler.json", - "question": "トランザクションのコミットタイミングはいつですか?", - "expected_keywords": [ - "コミット", - "commit", - "トランザクション", - "タイミング", - "正常終了" - ], - "expected_sections": ["commit", "lifecycle"], - "relevance": "high" - }, - { - "id": "handlers-005", - "category": "handlers", - "file": "handlers/batch/data-read-handler.json", - "question": "データリードハンドラで大量データを処理するには?", - "expected_keywords": [ - "大量データ", - "データ処理", - "バッチ", - "DataReader", - "ループ処理" - ], - "expected_sections": ["large-data", "performance"], - "relevance": "high" - }, - { - "id": "libraries-001", - "category": "libraries", - "file": "libraries/universal-dao.json", - "question": "UniversalDaoでページングを実装したい", - "expected_keywords": [ - "ページング", - "paging", - "per", - "page", - "Pagination", - "EntityList" - ], - "expected_sections": ["paging"], - "relevance": "high" - }, - { - "id": "libraries-002", - "category": "libraries", - "file": "libraries/universal-dao.json", - "question": "UniversalDaoで楽観的ロックを使う方法は?", - "expected_keywords": [ - "楽観的ロック", - "@Version", - "OptimisticLockException", - "排他制御", - "バージョンカラム" - ], - "expected_sections": ["optimistic-lock"], - "relevance": "high" - }, - { - "id": "libraries-003", - "category": "libraries", - "file": "libraries/database-access.json", - "question": "データベースアクセスでSQLを実行する方法を教えてください", - "expected_keywords": [ - "SQL実行", - "Database", - "SqlPStatement", - "クエリ", - "検索" - ], - "expected_sections": ["sql-execution", "query"], - "relevance": "high" - }, - { - "id": "libraries-004", - "category": "libraries", - "file": "libraries/file-path-management.json", - "question": "ファイルパス管理でファイルパスを取得するには?", - "expected_keywords": [ - "ファイルパス", - "FilePathSetting", - "論理名", - "物理パス", - "パス取得" - ], - "expected_sections": ["usage", "configuration"], - "relevance": "high" - }, - { - "id": "libraries-005", - "category": "libraries", - "file": "libraries/business-date.json", - "question": "業務日付を取得する方法は?", - "expected_keywords": [ - "業務日付", - "SystemTimeUtil", - "日付取得", - "システム日付" - ], - "expected_sections": ["overview", "usage"], - "relevance": "high" - }, - { - "id": "tools-001", - "category": "tools", - "file": "tools/ntf-test-data.json", - "question": "NTFでテストデータを準備する方法を教えてください", - "expected_keywords": [ - "テストデータ", - "NTF", - "データ準備", - "Excel", - "データベース" - ], - "expected_sections": ["preparation", "setup"], - "relevance": "high" - }, - { - "id": "tools-002", - "category": "tools", - "file": "tools/ntf-assertion.json", - "question": "NTFのアサーション機能の使い方は?", - "expected_keywords": [ - "アサーション", - "検証", - "期待値", - "実測値", - "NTF" - ], - "expected_sections": ["assertion", "verification"], - "relevance": "high" - }, - { - "id": "tools-003", - "category": "tools", - "file": "tools/ntf-batch-request-test.json", - "question": "バッチのリクエスト単体テストを実行するには?", - "expected_keywords": [ - "リクエスト単体テスト", - "バッチテスト", - "NTF", - "テスト実行", - "BatchRequestTestSupport" - ], - "expected_sections": ["test-execution", "setup"], - "relevance": "high" - }, - { - "id": "tools-004", - "category": "tools", - "file": "tools/ntf-test-data.json", - "question": "テストデータの初期化はどうやりますか?", - "expected_keywords": [ - "初期化", - "データクリア", - "セットアップ", - "テストデータ", - "前処理" - ], - "expected_sections": ["initialization", "cleanup"], - "relevance": "high" - }, - { - "id": "tools-005", - "category": "tools", - "file": "tools/ntf-overview.json", - "question": "NTFの基本的な使い方を教えてください", - "expected_keywords": [ - "NTF", - "自動テストフレームワーク", - "テスト実行", - "JUnit", - "テストケース" - ], - "expected_sections": ["overview", "getting-started"], - "relevance": "high" - }, - { - "id": "processing-001", - "category": "processing", - "file": "processing/nablarch-batch.json", - "question": "Nablarchバッチの基本構造を教えてください", - "expected_keywords": [ - "バッチ", - "基本構造", - "アーキテクチャ", - "ハンドラ構成", - "処理フロー" - ], - "expected_sections": ["overview", "architecture"], - "relevance": "high" - }, - { - "id": "processing-002", - "category": "processing", - "file": "processing/nablarch-batch.json", - "question": "バッチアクションの実装方法は?", - "expected_keywords": [ - "BatchAction", - "アクション実装", - "バッチ処理", - "execute", - "ビジネスロジック" - ], - "expected_sections": ["action-implementation", "business-logic"], - "relevance": "high" - }, - { - "id": "processing-003", - "category": "processing", - "file": "processing/nablarch-batch.json", - "question": "バッチで大量データを処理する方法は?", - "expected_keywords": [ - "大量データ", - "データ処理", - "ループ処理", - "DataReader", - "パフォーマンス" - ], - "expected_sections": ["large-data-processing", "performance"], - "relevance": "high" - }, - { - "id": "processing-004", - "category": "processing", - "file": "processing/nablarch-batch.json", - "question": "バッチのエラーハンドリングはどうすればいいですか?", - "expected_keywords": [ - "エラーハンドリング", - "例外処理", - "エラー処理", - "リトライ", - "異常終了" - ], - "expected_sections": ["error-handling", "exception"], - "relevance": "high" - }, - { - "id": "processing-005", - "category": "processing", - "file": "processing/nablarch-batch.json", - "question": "バッチの起動方法を教えてください", - "expected_keywords": [ - "バッチ起動", - "Main", - "コマンドライン", - "起動クラス", - "実行" - ], - "expected_sections": ["launch", "execution"], - "relevance": "high" - }, - { - "id": "adapters-001", - "category": "adapters", - "file": "adapters/slf4j-adapter.json", - "question": "SLF4Jアダプタの設定方法を教えてください", - "expected_keywords": [ - "SLF4J", - "アダプタ", - "設定", - "ログ出力", - "log4j" - ], - "expected_sections": ["configuration", "setup"], - "relevance": "high" - }, - { - "id": "adapters-002", - "category": "adapters", - "file": "adapters/slf4j-adapter.json", - "question": "SLF4Jでログレベルを変更するには?", - "expected_keywords": [ - "ログレベル", - "設定変更", - "DEBUG", - "INFO", - "ERROR" - ], - "expected_sections": ["log-level", "configuration"], - "relevance": "high" - }, - { - "id": "adapters-003", - "category": "adapters", - "file": "adapters/slf4j-adapter.json", - "question": "SLF4Jでログファイルを出力する設定は?", - "expected_keywords": [ - "ログファイル", - "ファイル出力", - "Appender", - "設定", - "ログ出力先" - ], - "expected_sections": ["file-output", "appender"], - "relevance": "high" - }, - { - "id": "adapters-004", - "category": "adapters", - "file": "adapters/slf4j-adapter.json", - "question": "NablarchとSLF4Jを連携させる方法は?", - "expected_keywords": [ - "連携", - "統合", - "Nablarch", - "SLF4J", - "アダプタ" - ], - "expected_sections": ["integration", "overview"], - "relevance": "high" - }, - { - "id": "adapters-005", - "category": "adapters", - "file": "adapters/slf4j-adapter.json", - "question": "SLF4Jでログフォーマットを変更するには?", - "expected_keywords": [ - "ログフォーマット", - "フォーマット設定", - "出力形式", - "パターン", - "カスタマイズ" - ], - "expected_sections": ["format", "pattern"], - "relevance": "high" - }, - { - "id": "code-analysis-001", - "category": "code-analysis", - "target_code": "proman-web/src/main/java/com/nablarch/example/proman/web/action/ProjectAction.java", - "question": "ProjectActionの構造を理解したい", - "expected_components": [ - "ProjectAction (Action)", - "ProjectForm (Form)", - "Project (Entity)", - "UniversalDao (Nablarch)" - ], - "expected_knowledge": [ - "libraries/universal-dao.json", - "libraries/data-bind.json" - ], - "expected_output_sections": [ - "Overview", - "Architecture", - "Components", - "Flow", - "Nablarch Framework Usage" - ], - "relevance": "high" - }, - { - "id": "code-analysis-002", - "category": "code-analysis", - "target_code": "proman-batch", - "question": "proman-batchモジュール全体の構造を教えてください", - "expected_components": [ - "BatchAction (multiple)", - "Entity classes", - "Nablarch handlers" - ], - "expected_knowledge": [ - "processing/nablarch-batch.json", - "handlers/batch/data-read-handler.json", - "handlers/common/transaction-management-handler.json" - ], - "expected_output_sections": [ - "Overview", - "Architecture", - "Components" - ], - "relevance": "high" - }, - { - "id": "code-analysis-003", - "category": "code-analysis", - "target_code": "proman-web/src/main/java/com/nablarch/example/proman/web/form", - "question": "Formクラスの設計パターンを理解したい", - "expected_components": [ - "Form classes (multiple)", - "Bean Validation annotations", - "Domain validation" - ], - "expected_knowledge": [ - "libraries/data-bind.json" - ], - "expected_output_sections": [ - "Overview", - "Components", - "Nablarch Framework Usage" - ], - "relevance": "high" - }, - { - "id": "code-analysis-004", - "category": "code-analysis", - "target_code": "proman-common/src/main/java/com/nablarch/example/proman/entity", - "question": "Entityクラスの設計を理解したい", - "expected_components": [ - "Entity classes (multiple)", - "Table annotations", - "UniversalDao integration" - ], - "expected_knowledge": [ - "libraries/universal-dao.json" - ], - "expected_output_sections": [ - "Overview", - "Architecture", - "Components" - ], - "relevance": "high" - }, - { - "id": "code-analysis-005", - "category": "code-analysis", - "target_code": "proman-web/src/main/java/com/nablarch/example/proman/web/action/LoginAction.java", - "question": "ログイン機能の実装を詳しく知りたい", - "expected_components": [ - "LoginAction (Action)", - "LoginForm (Form)", - "SystemAccount (Entity)", - "UniversalDao (Nablarch)", - "Bean Validation (Nablarch)" - ], - "expected_knowledge": [ - "libraries/universal-dao.json", - "libraries/data-bind.json", - "libraries/database-access.json" - ], - "expected_output_sections": [ - "Overview", - "Architecture", - "Components", - "Flow", - "Nablarch Framework Usage" - ], - "relevance": "high" - } - ], - "evaluation_criteria": { - "workflow_execution": { - "description": "ワークフローが正しく実行されたか", - "checks": [ - "keyword-search workflowが実行された", - "section-judgement workflowが実行された", - "適切なツール呼び出しが行われた(Read, Bash+jq)" - ] - }, - "keyword_matching": { - "description": "期待されるキーワードが回答に含まれているか", - "threshold": "80%以上のキーワードが含まれている" - }, - "section_relevance": { - "description": "適切なセクションが特定されたか", - "checks": [ - "expected_sectionsに含まれるセクションが特定された", - "関連性の高いセクション(High relevance)が優先された" - ] - }, - "knowledge_file_only": { - "description": "知識ファイルのみを使って回答したか", - "checks": [ - "LLM訓練データを使用していない", - "外部知識を補足していない", - "知識ファイルに記載されている情報のみを使用" - ] - }, - "token_efficiency": { - "description": "トークン効率が適切か", - "target": "5,000-15,000 tokens per query" - }, - "tool_call_efficiency": { - "description": "ツール呼び出し回数が適切か", - "target": "10-20 tool calls per query" - }, - "code_explanation_workflow": { - "description": "code-analysisワークフローが正しく実行されたか", - "checks": [ - "対象コードが正しく識別された", - "依存関係が適切に分析された", - "構成要素が適切に分解された", - "関連するNablarch知識が検索された", - "ドキュメントが生成された(Markdown + Mermaid図)", - "ソースコードへの相対パスリンクが含まれている", - "Nablarch知識ファイルへのリンクが含まれている" - ] - }, - "code_explanation_output": { - "description": "出力ドキュメントの品質が適切か", - "checks": [ - "Overview, Architecture, Components, Flow, Nablarch Framework Usageセクションが含まれている", - "Mermaid図が適切に生成されている", - "構成要素の説明が明確である", - "ソースコードへのリンクが正しい", - "Nablarch知識の引用が適切である" - ] - } - } -} diff --git a/.claude/skills/nabledge-6/tests/scenarios.md b/.claude/skills/nabledge-6/tests/scenarios.md deleted file mode 100644 index b5dac17..0000000 --- a/.claude/skills/nabledge-6/tests/scenarios.md +++ /dev/null @@ -1,729 +0,0 @@ -# Test Scenarios for Nabledge-6 Skill - -## Metadata - -- **Version**: 1.1.0 -- **Created**: 2026-02-09 -- **Updated**: 2026-02-10 -- **Total Scenarios**: 30 (5 per category) -- **Purpose**: Validate nabledge-6 skill workflows (keyword-search + section-judgement + code-analysis) - ---- - -## Category 1: Handlers (5 scenarios) - -### handlers-001: データリードハンドラの使い方 - -**Question**: データリードハンドラでファイルを読み込むにはどうすればいいですか? - -**Expected Keywords**: -- DataReadHandler -- DataReader -- ファイル読み込み -- データ入力 -- レコード処理 - -**Expected Sections**: overview, usage - -**Knowledge File**: handlers/batch/data-read-handler.json - -**Expected Relevance**: High - ---- - -### handlers-002: トランザクションのロールバック - -**Question**: トランザクション管理ハンドラでロールバックする方法は? - -**Expected Keywords**: -- TransactionManagementHandler -- ロールバック -- rollback -- エラー処理 -- トランザクション制御 - -**Expected Sections**: rollback, error-handling - -**Knowledge File**: handlers/common/transaction-management-handler.json - -**Expected Relevance**: High - ---- - -### handlers-003: データベース接続管理の設定 - -**Question**: データベース接続管理ハンドラの設定方法を教えてください - -**Expected Keywords**: -- DbConnectionManagementHandler -- データベース接続 -- コネクション管理 -- 設定 -- コンポーネント定義 - -**Expected Sections**: configuration, setup - -**Knowledge File**: handlers/common/db-connection-management-handler.json - -**Expected Relevance**: High - ---- - -### handlers-004: トランザクションのコミットタイミング - -**Question**: トランザクションのコミットタイミングはいつですか? - -**Expected Keywords**: -- コミット -- commit -- トランザクション -- タイミング -- 正常終了 - -**Expected Sections**: commit, lifecycle - -**Knowledge File**: handlers/common/transaction-management-handler.json - -**Expected Relevance**: High - ---- - -### handlers-005: 大量データの処理 - -**Question**: データリードハンドラで大量データを処理するには? - -**Expected Keywords**: -- 大量データ -- データ処理 -- バッチ -- DataReader -- ループ処理 - -**Expected Sections**: large-data, performance - -**Knowledge File**: handlers/batch/data-read-handler.json - -**Expected Relevance**: High - ---- - -## Category 2: Libraries (5 scenarios) - -### libraries-001: ページング実装 - -**Question**: UniversalDaoでページングを実装したい - -**Expected Keywords**: -- ページング -- paging -- per -- page -- Pagination -- EntityList - -**Expected Sections**: paging - -**Knowledge File**: libraries/universal-dao.json - -**Expected Relevance**: High - ---- - -### libraries-002: 楽観的ロック - -**Question**: UniversalDaoで楽観的ロックを使う方法は? - -**Expected Keywords**: -- 楽観的ロック -- @Version -- OptimisticLockException -- 排他制御 -- バージョンカラム - -**Expected Sections**: optimistic-lock - -**Knowledge File**: libraries/universal-dao.json - -**Expected Relevance**: High - ---- - -### libraries-003: SQL実行 - -**Question**: データベースアクセスでSQLを実行する方法を教えてください - -**Expected Keywords**: -- SQL実行 -- Database -- SqlPStatement -- クエリ -- 検索 - -**Expected Sections**: sql-execution, query - -**Knowledge File**: libraries/database-access.json - -**Expected Relevance**: High - ---- - -### libraries-004: ファイルパス取得 - -**Question**: ファイルパス管理でファイルパスを取得するには? - -**Expected Keywords**: -- ファイルパス -- FilePathSetting -- 論理名 -- 物理パス -- パス取得 - -**Expected Sections**: usage, configuration - -**Knowledge File**: libraries/file-path-management.json - -**Expected Relevance**: High - ---- - -### libraries-005: 業務日付取得 - -**Question**: 業務日付を取得する方法は? - -**Expected Keywords**: -- 業務日付 -- SystemTimeUtil -- 日付取得 -- システム日付 - -**Expected Sections**: overview, usage - -**Knowledge File**: libraries/business-date.json - -**Expected Relevance**: High - ---- - -## Category 3: Tools (5 scenarios) - -### tools-001: テストデータ準備 - -**Question**: NTFでテストデータを準備する方法を教えてください - -**Expected Keywords**: -- テストデータ -- NTF -- データ準備 -- Excel -- データベース - -**Expected Sections**: preparation, setup - -**Knowledge File**: tools/ntf-test-data.json - -**Expected Relevance**: High - ---- - -### tools-002: アサーション機能 - -**Question**: NTFのアサーション機能の使い方は? - -**Expected Keywords**: -- アサーション -- 検証 -- 期待値 -- 実測値 -- NTF - -**Expected Sections**: assertion, verification - -**Knowledge File**: tools/ntf-assertion.json - -**Expected Relevance**: High - ---- - -### tools-003: バッチのリクエスト単体テスト - -**Question**: バッチのリクエスト単体テストを実行するには? - -**Expected Keywords**: -- リクエスト単体テスト -- バッチテスト -- NTF -- テスト実行 -- BatchRequestTestSupport - -**Expected Sections**: test-execution, setup - -**Knowledge File**: tools/ntf-batch-request-test.json - -**Expected Relevance**: High - ---- - -### tools-004: テストデータ初期化 - -**Question**: テストデータの初期化はどうやりますか? - -**Expected Keywords**: -- 初期化 -- データクリア -- セットアップ -- テストデータ -- 前処理 - -**Expected Sections**: initialization, cleanup - -**Knowledge File**: tools/ntf-test-data.json - -**Expected Relevance**: High - ---- - -### tools-005: NTF基本的な使い方 - -**Question**: NTFの基本的な使い方を教えてください - -**Expected Keywords**: -- NTF -- 自動テストフレームワーク -- テスト実行 -- JUnit -- テストケース - -**Expected Sections**: overview, getting-started - -**Knowledge File**: tools/ntf-overview.json - -**Expected Relevance**: High - ---- - -## Category 4: Processing (5 scenarios) - -### processing-001: バッチの基本構造 - -**Question**: Nablarchバッチの基本構造を教えてください - -**Expected Keywords**: -- バッチ -- 基本構造 -- アーキテクチャ -- ハンドラ構成 -- 処理フロー - -**Expected Sections**: overview, architecture - -**Knowledge File**: processing/nablarch-batch.json - -**Expected Relevance**: High - ---- - -### processing-002: バッチアクション実装 - -**Question**: バッチアクションの実装方法は? - -**Expected Keywords**: -- BatchAction -- アクション実装 -- バッチ処理 -- execute -- ビジネスロジック - -**Expected Sections**: action-implementation, business-logic - -**Knowledge File**: processing/nablarch-batch.json - -**Expected Relevance**: High - ---- - -### processing-003: 大量データ処理 - -**Question**: バッチで大量データを処理する方法は? - -**Expected Keywords**: -- 大量データ -- データ処理 -- ループ処理 -- DataReader -- パフォーマンス - -**Expected Sections**: large-data-processing, performance - -**Knowledge File**: processing/nablarch-batch.json - -**Expected Relevance**: High - ---- - -### processing-004: バッチのエラーハンドリング - -**Question**: バッチのエラーハンドリングはどうすればいいですか? - -**Expected Keywords**: -- エラーハンドリング -- 例外処理 -- エラー処理 -- リトライ -- 異常終了 - -**Expected Sections**: error-handling, exception - -**Knowledge File**: processing/nablarch-batch.json - -**Expected Relevance**: High - ---- - -### processing-005: バッチの起動方法 - -**Question**: バッチの起動方法を教えてください - -**Expected Keywords**: -- バッチ起動 -- Main -- コマンドライン -- 起動クラス -- 実行 - -**Expected Sections**: launch, execution - -**Knowledge File**: processing/nablarch-batch.json - -**Expected Relevance**: High - ---- - -## Category 5: Adapters (5 scenarios) - -### adapters-001: SLF4Jアダプタの設定 - -**Question**: SLF4Jアダプタの設定方法を教えてください - -**Expected Keywords**: -- SLF4J -- アダプタ -- 設定 -- ログ出力 -- log4j - -**Expected Sections**: configuration, setup - -**Knowledge File**: adapters/slf4j-adapter.json - -**Expected Relevance**: High - ---- - -### adapters-002: ログレベルの変更 - -**Question**: SLF4Jでログレベルを変更するには? - -**Expected Keywords**: -- ログレベル -- 設定変更 -- DEBUG -- INFO -- ERROR - -**Expected Sections**: log-level, configuration - -**Knowledge File**: adapters/slf4j-adapter.json - -**Expected Relevance**: High - ---- - -### adapters-003: ログファイル出力 - -**Question**: SLF4Jでログファイルを出力する設定は? - -**Expected Keywords**: -- ログファイル -- ファイル出力 -- Appender -- 設定 -- ログ出力先 - -**Expected Sections**: file-output, appender - -**Knowledge File**: adapters/slf4j-adapter.json - -**Expected Relevance**: High - ---- - -### adapters-004: Nablarchとの連携 - -**Question**: NablarchとSLF4Jを連携させる方法は? - -**Expected Keywords**: -- 連携 -- 統合 -- Nablarch -- SLF4J -- アダプタ - -**Expected Sections**: integration, overview - -**Knowledge File**: adapters/slf4j-adapter.json - -**Expected Relevance**: High - ---- - -### adapters-005: ログフォーマット変更 - -**Question**: SLF4Jでログフォーマットを変更するには? - -**Expected Keywords**: -- ログフォーマット -- フォーマット設定 -- 出力形式 -- パターン -- カスタマイズ - -**Expected Sections**: format, pattern - -**Knowledge File**: adapters/slf4j-adapter.json - -**Expected Relevance**: High - ---- - -## Category 6: Code Analysis (5 scenarios) - -### code-analysis-001: ProjectActionの構造理解 - -**Question**: ProjectActionの構造を理解したい - -**Target Code**: proman-web/src/main/java/com/nablarch/example/proman/web/action/ProjectAction.java - -**Expected Components**: -- ProjectAction (Action) -- ProjectForm (Form) -- Project (Entity) -- UniversalDao (Nablarch) - -**Expected Knowledge**: -- libraries/universal-dao.json -- libraries/data-bind.json - -**Expected Output Sections**: Overview, Architecture, Components, Flow, Nablarch Framework Usage - -**Expected Relevance**: High - ---- - -### code-analysis-002: proman-batchモジュール全体の理解 - -**Question**: proman-batchモジュール全体の構造を教えてください - -**Target Code**: proman-batch - -**Expected Components**: -- BatchAction (multiple) -- Entity classes -- Nablarch handlers - -**Expected Knowledge**: -- processing/nablarch-batch.json -- handlers/batch/data-read-handler.json -- handlers/common/transaction-management-handler.json - -**Expected Output Sections**: Overview, Architecture, Components - -**Expected Relevance**: High - ---- - -### code-analysis-003: Formクラスの設計パターン - -**Question**: Formクラスの設計パターンを理解したい - -**Target Code**: proman-web/src/main/java/com/nablarch/example/proman/web/form - -**Expected Components**: -- Form classes (multiple) -- Bean Validation annotations -- Domain validation - -**Expected Knowledge**: -- libraries/data-bind.json - -**Expected Output Sections**: Overview, Components, Nablarch Framework Usage - -**Expected Relevance**: High - ---- - -### code-analysis-004: Entityクラスの設計理解 - -**Question**: Entityクラスの設計を理解したい - -**Target Code**: proman-common/src/main/java/com/nablarch/example/proman/entity - -**Expected Components**: -- Entity classes (multiple) -- Table annotations -- UniversalDao integration - -**Expected Knowledge**: -- libraries/universal-dao.json - -**Expected Output Sections**: Overview, Architecture, Components - -**Expected Relevance**: High - ---- - -### code-analysis-005: ログイン機能の詳細実装 - -**Question**: ログイン機能の実装を詳しく知りたい - -**Target Code**: proman-web/src/main/java/com/nablarch/example/proman/web/action/LoginAction.java - -**Expected Components**: -- LoginAction (Action) -- LoginForm (Form) -- SystemAccount (Entity) -- UniversalDao (Nablarch) -- Bean Validation (Nablarch) - -**Expected Knowledge**: -- libraries/universal-dao.json -- libraries/data-bind.json -- libraries/database-access.json - -**Expected Output Sections**: Overview, Architecture, Components, Flow, Nablarch Framework Usage - -**Expected Relevance**: High - ---- - -## Evaluation Criteria - -### 1. Workflow Execution - -ワークフローが正しく実行されたか確認: - -- [ ] keyword-search workflowが実行された -- [ ] section-judgement workflowが実行された -- [ ] 適切なツール呼び出しが行われた(Read, Bash+jq) -- [ ] index.toonが読み込まれた -- [ ] 候補セクションのindexが抽出された -- [ ] セクション内容が読み込まれた - -### 2. Keyword Matching - -期待されるキーワードが回答に含まれているか: - -- **Threshold**: 80%以上のキーワードが含まれている -- キーワードの出現確認 -- 関連する技術用語の使用 - -### 3. Section Relevance - -適切なセクションが特定されたか: - -- [ ] expected_sectionsに含まれるセクションが特定された -- [ ] 関連性の高いセクション(High relevance)が優先された -- [ ] 不要なセクション(None relevance)が除外された - -### 4. Knowledge File Only - -知識ファイルのみを使って回答したか: - -- [ ] LLM訓練データを使用していない -- [ ] 外部知識を補足していない -- [ ] 知識ファイルに記載されている情報のみを使用 -- [ ] セクションの引用が明示されている - -### 5. Token Efficiency - -トークン効率が適切か: - -- **Target**: 5,000-15,000 tokens per query -- 無駄なファイル全体の読み込みがない -- セクション単位の抽出が機能している - -### 6. Tool Call Efficiency - -ツール呼び出し回数が適切か: - -- **Target**: 10-20 tool calls per query -- Read: index.toon読み込み (1回) -- Bash+jq: .index抽出 (5-10回) -- Bash+jq: .sections抽出 (5-10回) - -### 7. Code Analysis Workflow (code-analysis scenarios only) - -code-analysisワークフローが正しく実行されたか確認: - -- [ ] 対象コードが正しく識別された -- [ ] 依存関係が適切に分析された(Read, Grep, Glob使用) -- [ ] 構成要素が適切に分解された -- [ ] 関連するNablarch知識が検索された(keyword-search workflow実行) -- [ ] ドキュメントが生成された(Write tool使用) -- [ ] Markdown + Mermaid図形式で出力された -- [ ] ソースコードへの相対パスリンクが含まれている -- [ ] Nablarch知識ファイルへのリンクが含まれている - -### 8. Code Analysis Output Quality (code-analysis scenarios only) - -出力ドキュメントの品質が適切か: - -- [ ] Overview, Architecture, Components, Flow, Nablarch Framework Usageセクションが含まれている -- [ ] Mermaid図(依存関係図、シーケンス図)が適切に生成されている -- [ ] 構成要素の説明が明確である -- [ ] ソースコードへのリンクが正しい(相対パス) -- [ ] Nablarch知識の引用が適切である -- [ ] Expected Componentsが全て記載されている -- [ ] Expected Knowledgeが参照されている -- [ ] ファイルパス形式: `work/YYYYMMDD/code-analysis-.md` - ---- - -## Usage - -### Manual Testing - -各シナリオを個別にテスト: - -```bash -# Example: Test handlers-001 -"データリードハンドラでファイルを読み込むにはどうすればいいですか?" -``` - -期待される動作: -1. "keyword-searchワークフローを実行します"と表示 -2. Read index.toon -3. Bash+jq でセクション抽出 -4. 回答にキーワードが含まれる - -### Automated Testing - -エージェントを使った自動評価: - -```bash -# Load scenarios.json -# For each scenario: -# - Execute question -# - Evaluate workflow execution -# - Check keyword matching -# - Verify section relevance -# - Calculate token usage -# - Count tool calls -``` - ---- - -## Notes - -- すべてのシナリオは実在する知識ファイルに基づいています -- Expected sectionsは実際のファイル構造に基づく推定です -- 知識ファイルに該当セクションがない場合は、"この情報は知識ファイルに含まれていません"と回答されることが期待されます diff --git a/.claude/skills/pr/workflows/resolve.md b/.claude/skills/pr/workflows/resolve.md index 3c54a7e..a584711 100644 --- a/.claude/skills/pr/workflows/resolve.md +++ b/.claude/skills/pr/workflows/resolve.md @@ -44,18 +44,24 @@ Options: ### 2. Get Unresolved Review Comments -**2.1 Get Review Threads** +**2.1 Get Review Comments** ```bash -gh pr view "$pr_number" --json reviewThreads +gh api "repos/{owner}/{repo}/pulls/$pr_number/comments" --jq '.[] | select(.in_reply_to_id == null)' +``` + +Get repository owner and name: +```bash +owner=$(gh repo view --json owner -q .owner.login) +repo=$(gh repo view --json name -q .name) ``` **2.2 Filtering** -Extract only comments meeting all these conditions: -- `thread.isResolved === false` -- `thread.isOutdated === false` -- `thread.path !== null` (comments on files) +Extract only comments meeting these conditions: +- Not a reply (no `in_reply_to_id`) +- Has not been replied to yet (check if comment has replies) +- Not outdated (`original_position` should exist or match `position`) If 0 unresolved comments: ``` @@ -75,10 +81,13 @@ For each unresolved comment, execute the following: **3.1 Analysis** Get comment information: +- `comment.id`: Comment ID (required for replying) - `comment.body`: Comment body - `comment.path`: File to fix - `comment.line`: Line number (if exists) -- `comment.author.login`: Reviewer name +- `comment.user.login`: Reviewer name + +Store the comment ID for later use in replies. Use Read tool to load file and check relevant section. @@ -136,10 +145,15 @@ repo_url=$(gh repo view --json url -q .url) **3.4 Reply** +Reply directly to the review comment using the stored comment ID: + **For fixes**: ```bash -gh pr comment "$pr_number" --body "$(cat <<'EOF' +gh api \ + -X POST \ + "repos/$owner/$repo/pulls/$pr_number/comments" \ + -f body="$(cat <<'EOF' Fixed **Commit**: {repo_url}/commit/{commit_sha} @@ -148,23 +162,28 @@ Fixed Co-Authored-By: Claude (jp.anthropic.claude-sonnet-4-5-20250929-v1:0) EOF -)" +)" \ + -F in_reply_to=${comment_id} ``` **For questions**: ```bash -gh pr comment "$pr_number" --body "$(cat <<'EOF' +gh api \ + -X POST \ + "repos/$owner/$repo/pulls/$pr_number/comments" \ + -f body="$(cat <<'EOF' Please clarify {Question content} Co-Authored-By: Claude (jp.anthropic.claude-sonnet-4-5-20250929-v1:0) EOF -)" +)" \ + -F in_reply_to=${comment_id} ``` -**Note**: `gh pr comment` adds a comment to the overall PR. Direct replies to specific review comments require advanced operations using `gh api`. +**Note**: This creates threaded replies directly under review comments using the `in_reply_to` parameter, providing better context and reviewer experience. ### 4. Resolve Review Comments @@ -210,19 +229,4 @@ Please request reviewer to resolve threads 4. **Test Execution**: Run related tests if they exist after fixing 5. **Multiple Files**: When one comment requires multiple file fixes, fix all before creating a single commit 6. **Thread Resolution**: GitHub CLI lacks direct resolve functionality, so request reviewer resolution - -## Advanced Operation: Reply to Specific Comments - -To reply directly to specific review comments, use GitHub API: - -```bash -# Get review comment ID (from reviewThreads) -comment_id="{thread.comments[0].id}" - -# Add reply -gh api \ - "repos/{owner}/{repo}/pulls/{pr_number}/comments/$comment_id/replies" \ - -f body="Fixed. Please review." -``` - -However, PR-level comments are usually sufficient, so use this as needed. +7. **Threaded Replies**: Always reply directly to review comments for better threading and reviewer experience diff --git a/.github/scripts/transform-to-plugin.sh b/.github/scripts/transform-to-plugin.sh new file mode 100755 index 0000000..d9124c4 --- /dev/null +++ b/.github/scripts/transform-to-plugin.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -e + +# Transform nabledge skills from development format to marketplace format +# Usage: ./transform-to-plugin.sh + +SOURCE_DIR="${1:-.}" +DEST_DIR="${2:-nabledge-repo}" + +echo "Transforming nabledge skills to marketplace format..." +echo "Source: $SOURCE_DIR" +echo "Destination: $DEST_DIR" + +# Validate source directory +if [ ! -d "$SOURCE_DIR/.claude/skills/nabledge-6" ]; then + echo "Error: Source directory does not contain .claude/skills/nabledge-6" + exit 1 +fi + +if [ ! -d "$SOURCE_DIR/.claude/marketplace" ]; then + echo "Error: Source directory does not contain .claude/marketplace" + exit 1 +fi + +# Create marketplace directories +echo "Creating marketplace directory structure..." +mkdir -p "$DEST_DIR/.claude-plugin" +mkdir -p "$DEST_DIR/plugins/nabledge-6/.claude-plugin" +mkdir -p "$DEST_DIR/plugins/nabledge-6/skills/nabledge-6" + +# Copy marketplace.json to root +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..." +cp "$SOURCE_DIR/.claude/marketplace/README.md" "$DEST_DIR/README.md" +cp "$SOURCE_DIR/.claude/marketplace/LICENSE" "$DEST_DIR/" + +# Copy nabledge-6 plugin files +echo "Copying nabledge-6 plugin..." + +# Plugin metadata +cp "$SOURCE_DIR/.claude/skills/nabledge-6/plugin/plugin.json" "$DEST_DIR/plugins/nabledge-6/.claude-plugin/" + +# Copy skill content (SKILL.md and supporting directories) +cp "$SOURCE_DIR/.claude/skills/nabledge-6/SKILL.md" "$DEST_DIR/plugins/nabledge-6/skills/nabledge-6/" +cp -r "$SOURCE_DIR/.claude/skills/nabledge-6/workflows" "$DEST_DIR/plugins/nabledge-6/skills/nabledge-6/" +cp -r "$SOURCE_DIR/.claude/skills/nabledge-6/assets" "$DEST_DIR/plugins/nabledge-6/skills/nabledge-6/" +cp -r "$SOURCE_DIR/.claude/skills/nabledge-6/knowledge" "$DEST_DIR/plugins/nabledge-6/skills/nabledge-6/" +cp -r "$SOURCE_DIR/.claude/skills/nabledge-6/docs" "$DEST_DIR/plugins/nabledge-6/skills/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/" + +# Copy setup scripts to root +echo "Copying setup scripts to root..." +cp "$SOURCE_DIR/scripts/setup-6-cc.sh" "$DEST_DIR/" +cp "$SOURCE_DIR/scripts/setup-6-ghc.sh" "$DEST_DIR/" + +echo "Transformation complete!" +echo "" +echo "Marketplace structure created in: $DEST_DIR" +echo " - Marketplace: $DEST_DIR/.claude-plugin/marketplace.json" +echo " - Plugin: $DEST_DIR/plugins/nabledge-6/" diff --git a/.github/workflows/sync-to-nabledge.yml b/.github/workflows/sync-to-nabledge.yml new file mode 100644 index 0000000..bb8dd7e --- /dev/null +++ b/.github/workflows/sync-to-nabledge.yml @@ -0,0 +1,170 @@ +name: Sync to nabledge repository + +on: + push: + branches: + - main + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout nabledge-dev + uses: actions/checkout@v4 + with: + 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 + + - name: Checkout nabledge repository + uses: actions/checkout@v4 + with: + repository: nablarch/nabledge + ref: main + 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 {} + + + - 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" + + - 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 + + - 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}" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0e072a6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,16 @@ +Apache License +Version 2.0, January 2004 + +Copyright 2026 Nablarch + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/scripts/setup-6-cc.sh b/scripts/setup-6-cc.sh new file mode 100755 index 0000000..00beeea --- /dev/null +++ b/scripts/setup-6-cc.sh @@ -0,0 +1,117 @@ +#!/bin/bash +set -e + +# Navigate to repository root (or current directory if not in git repo) +if git rev-parse --show-toplevel &>/dev/null; then + PROJECT_ROOT="$(git rev-parse --show-toplevel)" +else + PROJECT_ROOT="$(pwd)" +fi + +echo "Setting up Nabledge-6 plugin for Claude Code..." +echo "Project root: $PROJECT_ROOT" + +# Configuration +REPO_OWNER="nablarch" +REPO_NAME="nabledge" +BRANCH="main" +MARKETPLACE_NAME="nabledge" +PLUGIN_NAME="nabledge-6" + +# Create .claude directory if it doesn't exist +mkdir -p "$PROJECT_ROOT/.claude" + +SETTINGS_FILE="$PROJECT_ROOT/.claude/settings.json" + +# Check if jq is installed, if not, try to install it +if ! command -v jq &> /dev/null; then + echo "jq is not installed. Attempting to install..." + + # Detect OS + OS="$(uname -s)" + case "$OS" in + Linux*) + echo "Detected Linux/WSL environment" + echo "Installing jq via apt-get (requires sudo)..." + sudo apt-get update && sudo apt-get install -y jq + ;; + MINGW*|MSYS*|CYGWIN*) + echo "Detected GitBash environment" + echo "Downloading jq..." + JQ_URL="https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe" + JQ_PATH="/usr/bin/jq.exe" + curl -L -o "$JQ_PATH" "$JQ_URL" + chmod +x "$JQ_PATH" + ;; + Darwin*) + echo "Detected macOS" + echo "Please install jq manually:" + echo " brew install jq" + exit 1 + ;; + *) + echo "Error: Unsupported OS: $OS" + echo "Please install jq manually: https://stedolan.github.io/jq/download/" + exit 1 + ;; + esac + + # Verify installation + if ! command -v jq &> /dev/null; then + echo "Error: Failed to install jq" + exit 1 + fi + + echo "jq installed successfully!" +fi + +# Initialize settings.json if it doesn't exist +if [ ! -f "$SETTINGS_FILE" ]; then + echo "Creating new settings.json..." + echo '{}' > "$SETTINGS_FILE" +fi + +# Read current settings +CURRENT_SETTINGS=$(cat "$SETTINGS_FILE") + +# Build marketplace configuration +MARKETPLACE_CONFIG=$(jq -n \ + --arg repo "$REPO_OWNER/$REPO_NAME" \ + --arg branch "$BRANCH" \ + '{ + "source": { + "source": "github", + "repo": $repo, + "ref": $branch + } + }') + +# Build plugin configuration +PLUGIN_KEY="${PLUGIN_NAME}@${MARKETPLACE_NAME}" + +# Merge configurations +UPDATED_SETTINGS=$(echo "$CURRENT_SETTINGS" | jq \ + --arg marketplace_name "$MARKETPLACE_NAME" \ + --argjson marketplace_config "$MARKETPLACE_CONFIG" \ + --arg plugin_key "$PLUGIN_KEY" \ + ' + .extraKnownMarketplaces = (.extraKnownMarketplaces // {}) | + .extraKnownMarketplaces[$marketplace_name] = $marketplace_config | + .enabledPlugins = (.enabledPlugins // {}) | + .enabledPlugins[$plugin_key] = true + ') + +# Write updated settings +echo "$UPDATED_SETTINGS" > "$SETTINGS_FILE" + +echo "" +echo "Setup complete! The nabledge-6 plugin configuration has been added to:" +echo "$SETTINGS_FILE" +echo "" +echo "Next steps:" +echo "1. Commit .claude/settings.json to your repository" +echo "2. When team members clone the repository and start Claude Code," +echo " they will be prompted to install the marketplace and plugin" +echo "" +echo "You can verify the configuration with:" +echo " cat $SETTINGS_FILE" diff --git a/scripts/setup-6-ghc.sh b/scripts/setup-6-ghc.sh new file mode 100755 index 0000000..9fc25b3 --- /dev/null +++ b/scripts/setup-6-ghc.sh @@ -0,0 +1,100 @@ +#!/bin/bash +set -e + +# Navigate to repository root (or current directory if not in git repo) +if git rev-parse --show-toplevel &>/dev/null; then + PROJECT_ROOT="$(git rev-parse --show-toplevel)" +else + PROJECT_ROOT="$(pwd)" +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" +TEMP_DIR=$(mktemp -d) + +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 +git sparse-checkout set plugins/nabledge-6 + +# Create .claude/skills directory +echo "Creating .claude/skills directory..." +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/" + +# Clean up +rm -rf "$TEMP_DIR" + +# Check if jq is installed, if not, try to install it +if ! command -v jq &> /dev/null; then + echo "" + echo "jq is not installed. The nabledge-6 skill requires jq to run." + echo "Attempting to install..." + + # Detect OS + OS="$(uname -s)" + case "$OS" in + Linux*) + echo "Detected Linux/WSL environment" + echo "Installing jq via apt-get (requires sudo)..." + sudo apt-get update && sudo apt-get install -y jq + ;; + MINGW*|MSYS*|CYGWIN*) + echo "Detected GitBash environment" + echo "Downloading jq..." + JQ_URL="https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe" + JQ_PATH="/usr/bin/jq.exe" + curl -L -o "$JQ_PATH" "$JQ_URL" + chmod +x "$JQ_PATH" + ;; + Darwin*) + echo "Detected macOS" + echo "Please install jq manually:" + echo " brew install jq" + echo "" + echo "Setup complete! The nabledge-6 skill is now available in your project." + echo "Location: $PROJECT_ROOT/.claude/skills/nabledge-6" + echo "" + echo "IMPORTANT: Please install jq before using the skill." + exit 0 + ;; + *) + echo "Error: Unsupported OS: $OS" + echo "Please install jq manually: https://stedolan.github.io/jq/download/" + echo "" + echo "Setup complete! The nabledge-6 skill is now available in your project." + echo "Location: $PROJECT_ROOT/.claude/skills/nabledge-6" + echo "" + echo "IMPORTANT: Please install jq before using the skill." + exit 0 + ;; + esac + + # Verify installation + if ! command -v jq &> /dev/null; then + echo "Warning: Failed to install jq automatically" + echo "Please install jq manually: https://stedolan.github.io/jq/download/" + echo "" + echo "Setup complete! The nabledge-6 skill is now available in your project." + echo "Location: $PROJECT_ROOT/.claude/skills/nabledge-6" + echo "" + echo "IMPORTANT: Please install jq before using the skill." + exit 0 + fi + + echo "jq installed successfully!" +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." diff --git a/work/20260210/staging-github-action.md b/work/20260210/staging-github-action.md new file mode 100644 index 0000000..0ed1282 --- /dev/null +++ b/work/20260210/staging-github-action.md @@ -0,0 +1,49 @@ +# Staging GitHub Action + +## What was done + +### Created branches +- `dummy-from`: Created from `feature/setup-repository` in nabledge-dev repository +- `dummy-to`: Created from `develop` in nabledge repository using GitHub API + +### Created files +- `.github/workflows/sync-to-nabledge.yml`: GitHub Actions workflow for syncing nabledge-6 skill + +## Workflow details + +- Triggers on push to `dummy-from` branch +- Syncs `.claude/skills/nabledge-6` to nabledge repository's `dummy-to` branch +- Includes trigger commit URL in commit message for traceability +- Uses `NABLEDGE_SYNC_TOKEN` secret for authentication + +## Results + +- Branches created successfully +- Workflow file created and committed locally (commit hash: f8c0599) +- Push failed: GitHub PAT requires `workflow` scope to push workflow files + +## Current status + +- Branch: `dummy-from` +- Local commit ready to push (f8c0599) +- Issue: Personal Access Token needs `workflow` scope + +## Next steps (resume from here) + +1. **Fix token scope issue** + - Add `workflow` scope to GitHub Personal Access Token + - Then run: `git push` + +2. **Set up repository secret** + - Create `NABLEDGE_SYNC_TOKEN` secret in nabledge-dev repository settings + - Token needs write access to nablarch/nabledge repository + +3. **Verify push functionality** (Task #5) + - After push succeeds, GitHub Actions will run automatically + - Check nabledge repository's `dummy-to` branch for synced files + - If needed, fix workflow file and push again + +4. **Add PR creation** (Task #6) + - Modify `.github/workflows/sync-to-nabledge.yml` to create PR from dummy-to to develop + - Include trigger commit URL in PR body + - Test PR creation diff --git a/work/20260210/sync-workflow-completed.md b/work/20260210/sync-workflow-completed.md new file mode 100644 index 0000000..90145fd --- /dev/null +++ b/work/20260210/sync-workflow-completed.md @@ -0,0 +1,55 @@ +# Sync Workflow Completed + +## What was done + +### Fixed GitHub Actions workflow +- Fixed multiline commit message syntax (changed from heredoc to multiple `-m` flags) +- File: `.github/workflows/sync-to-nabledge.yml` + +### Resolved authentication issues +- Set `NABLEDGE_SYNC_TOKEN` secret in nabledge-dev repository (not nabledge) +- Granted write permission to token owner for nablarch/nabledge repository + +### Cleaned up test workflows +- Removed temporary test workflow files: + - `.github/workflows/test-simple.yml` + - `.github/workflows/test-checkout-nabledge.yml` + +## Results + +### Successful sync +- Workflow run: https://github.com/nablarch/nabledge-dev/actions/runs/21864813463 +- Synced commit: 6218fb51585c770d4f7c8a7751074cd44d0a4e81 +- Branch: `dummy-to` in nablarch/nabledge repository +- Files synced: 43 files, 16318 insertions + +### Commit message format +``` +Sync nabledge-6 skill from nabledge-dev + +Triggered by: https://github.com/nablarch/nabledge-dev/commit/{SHA} +``` + +## Workflow functionality + +The workflow automatically: +1. Triggers on push to `dummy-from` branch +2. Checks out nabledge-dev repository +3. Checks out nabledge repository's `dummy-to` branch +4. Syncs `.claude/skills/nabledge-6` directory +5. Creates commit with traceability link +6. Pushes to `dummy-to` branch + +## Next steps + +As documented in previous work log (staging-github-action.md): + +1. **Add PR creation** (Task #6) + - Modify workflow to create PR from `dummy-to` to `develop` branch + - Include trigger commit URL in PR body + - Test PR creation functionality + +2. **Transition to production branches** + - Change trigger branch from `dummy-from` to actual branch + - Change target branch from `dummy-to` to actual branch + - Update workflow configuration accordingly diff --git a/work/20260212/github-action-plugin-distribution.md b/work/20260212/github-action-plugin-distribution.md new file mode 100644 index 0000000..b192c7c --- /dev/null +++ b/work/20260212/github-action-plugin-distribution.md @@ -0,0 +1,413 @@ +# GitHub Action Design: Plugin Distribution for Nabledge + +## Overview + +This document describes the GitHub Action design for automatically converting and syncing the nabledge-6 skill from development format (nabledge-dev) to distribution format (nabledge) as a Claude Code Plugin. + +## Repository Roles + +| Repository | Purpose | Structure | Users | +|-----------|---------|-----------|-------| +| **nabledge-dev** | Development, testing, demo | `.claude/skills/nabledge-6/` | Developers | +| **nabledge** | Distribution, user installation | Claude Code Plugin format | End users | + +## Current vs Distribution Structure + +### Development (nabledge-dev) + +``` +nabledge-dev/ +├── .claude/ +│ └── skills/ +│ └── nabledge-6/ +│ ├── SKILL.md +│ ├── workflows/ +│ │ ├── keyword-search.md +│ │ ├── section-judgement.md +│ │ └── code-analysis.md +│ ├── assets/ +│ │ ├── code-analysis-template.md +│ │ ├── code-analysis-template-guide.md +│ │ └── code-analysis-template-examples.md +│ ├── knowledge/ +│ │ ├── index.toon +│ │ ├── features/ +│ │ ├── checks/ +│ │ └── releases/ +│ ├── docs/ +│ │ ├── features/ +│ │ ├── checks/ +│ │ └── releases/ +│ └── plugin/ +│ ├── plugin.json +│ ├── README.md +│ ├── LICENSE +│ └── CHANGELOG.md +``` + +**Characteristics**: +- ✅ Immediate testing with `/nabledge-6` +- ✅ Easy demo and dogfooding +- ✅ Fast edit-test-debug cycle +- ❌ Not installable as plugin + +### Distribution (nabledge) + +``` +nabledge/ +├── .claude-plugin/ +│ └── plugin.json # Plugin manifest +├── skills/ +│ └── nabledge-6/ +│ └── SKILL.md # Main skill definition +├── workflows/ +│ ├── keyword-search.md +│ ├── section-judgement.md +│ └── code-analysis.md +├── assets/ +│ ├── code-analysis-template.md +│ ├── code-analysis-template-guide.md +│ └── code-analysis-template-examples.md +├── knowledge/ +│ ├── index.toon +│ ├── features/ +│ ├── checks/ +│ └── releases/ +├── docs/ +│ ├── features/ +│ ├── checks/ +│ └── releases/ +├── README.md # Installation & usage +├── LICENSE # Apache 2.0 or MIT +└── CHANGELOG.md # Version history +``` + +**Characteristics**: +- ✅ Installable via `/plugin marketplace add nablarch/nabledge` +- ✅ Automatic updates for users +- ✅ Standard plugin structure +- ✅ Proper versioning with plugin.json + +## File Mapping + +| Source (nabledge-dev) | Destination (nabledge) | Action | +|----------------------|------------------------|--------| +| `.claude/skills/nabledge-6/SKILL.md` | `skills/nabledge-6/SKILL.md` | Move | +| `.claude/skills/nabledge-6/workflows/` | `workflows/` | Move to root | +| `.claude/skills/nabledge-6/assets/` | `assets/` | Move to root | +| `.claude/skills/nabledge-6/knowledge/` | `knowledge/` | Move to root | +| `.claude/skills/nabledge-6/docs/` | `docs/` | Move to root | +| `.claude/skills/nabledge-6/plugin/plugin.json` | `.claude-plugin/plugin.json` | Move | +| `.claude/skills/nabledge-6/plugin/README.md` | `README.md` | Move | +| `.claude/skills/nabledge-6/plugin/LICENSE` | `LICENSE` | Move | +| `.claude/skills/nabledge-6/plugin/CHANGELOG.md` | `CHANGELOG.md` | Move and update | + +## GitHub Action Design + +### Current Workflow (sync-to-nabledge.yml) + +**File**: `.github/workflows/sync-to-nabledge.yml` + +**Trigger**: Push to `dummy-from` branch + +**Current behavior**: +1. Checkout nabledge-dev repository +2. Checkout nabledge repository (dummy-to branch) +3. Copy `.claude/skills/nabledge-6` to `nabledge-repo/.claude/skills/nabledge-6` +4. Commit and push to nabledge repository + +**Issue**: Copies development structure, not plugin format + +### Updated Workflow Design + +**New behavior**: +1. Checkout nabledge-dev repository +2. Checkout nabledge repository (dummy-to branch) +3. **Transform to plugin structure**: + - Create `.claude-plugin/` directory + - Move `SKILL.md` to `skills/nabledge-6/SKILL.md` + - Move `workflows/`, `assets/`, `knowledge/`, `docs/` to root + - Move `plugin/plugin.json` to `.claude-plugin/plugin.json` + - Move `plugin/README.md` to root + - Move `plugin/LICENSE` to root + - Move `plugin/CHANGELOG.md` to root and update with sync info +4. Commit and push to nabledge repository + +### Workflow Steps Detail + +#### Step 1: Checkout repositories + +```yaml +- name: Checkout nabledge-dev + uses: actions/checkout@v4 + with: + fetch-depth: 0 + +- name: Checkout nabledge repository + uses: actions/checkout@v4 + with: + repository: nablarch/nabledge + ref: dummy-to + token: ${{ secrets.NABLEDGE_SYNC_TOKEN }} + path: nabledge-repo +``` + +#### Step 2: Clean destination + +```yaml +- name: Clean nabledge repository + run: | + cd nabledge-repo + # Remove all files except .git/ + find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} + +``` + +#### Step 3: Transform to plugin structure + +```yaml +- name: Transform to plugin structure + run: | + # Create plugin directories + mkdir -p nabledge-repo/.claude-plugin + mkdir -p nabledge-repo/skills/nabledge-6 + + # Move SKILL.md to skills/nabledge-6/ + cp .claude/skills/nabledge-6/SKILL.md nabledge-repo/skills/nabledge-6/ + + # Move supporting directories to root + cp -r .claude/skills/nabledge-6/workflows nabledge-repo/ + cp -r .claude/skills/nabledge-6/assets nabledge-repo/ + cp -r .claude/skills/nabledge-6/knowledge nabledge-repo/ + cp -r .claude/skills/nabledge-6/docs nabledge-repo/ + + # Move plugin files to root + cp .claude/skills/nabledge-6/plugin/plugin.json nabledge-repo/.claude-plugin/ + cp .claude/skills/nabledge-6/plugin/README.md nabledge-repo/ + cp .claude/skills/nabledge-6/plugin/LICENSE nabledge-repo/ + cp .claude/skills/nabledge-6/plugin/CHANGELOG.md nabledge-repo/ +``` + +#### Step 4: Update CHANGELOG.md + +```yaml +- 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 CHANGELOG + sed -i "/^# Changelog/a \\\n## [Unreleased] - ${DATE}\\\n\\\n### Changed\\\n- Synced from: ${TRIGGER_COMMIT_URL}\\\n" nabledge-repo/CHANGELOG.md +``` + +**Note**: The plugin.json, README.md, LICENSE, and CHANGELOG.md are now stored in the development repository and reviewed during development, rather than being generated each time. + +#### Step 5: Commit and push + +```yaml +- 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-6 plugin from nabledge-dev" -m "Triggered by: ${TRIGGER_COMMIT_URL}" + + git push origin dummy-to +``` + +## README.md Template + +The plugin README.md (stored in `.claude/skills/nabledge-6/plugin/README.md`) should include: + +- Plugin name and description +- Features (Knowledge Search, Code Analysis) +- Installation instructions (`/plugin marketplace add nablarch/nabledge`) +- Usage examples (`/nabledge-6`, `/nabledge-6 "question"`, `/nabledge-6 code-analysis`) +- Knowledge coverage (batch, REST, handlers, libraries, tools) +- Scope (in/out of scope) +- Version information (Nablarch 6u2/6u3, plugin version) +- License (Apache 2.0) +- Repository links (distribution and development) + +See example content in the actual plugin/README.md file in the repository. + +## Version Management Strategy + +Store `plugin.json` and `CHANGELOG.md` in `.claude/skills/nabledge-6/plugin/` directory. + +### CI Validation + +Add validation step to fail sync workflow if version files are not updated: + +```yaml +- name: Validate version updates + run: | + # Check if plugin.json or CHANGELOG.md were modified in the last commit + if ! git diff HEAD~1 HEAD --name-only | grep -q "plugin/plugin.json\|plugin/CHANGELOG.md"; then + echo "Error: plugin.json or CHANGELOG.md must be updated before sync" + exit 1 + fi +``` + +This ensures developers always update version information when making changes that trigger a sync. + +## Workflow File Structure + +### Recommended Split + +**Option A: Single workflow** (simpler) + +``` +.github/workflows/ +└── sync-to-nabledge.yml # All-in-one: transform + sync +``` + +**Option B: Separate workflows** (more flexible) + +``` +.github/workflows/ +├── sync-to-nabledge.yml # Main sync workflow +└── scripts/ + └── transform-to-plugin.sh # Transformation script +``` + +### Recommendation + +Use **Option B** with separate script for: +- ✅ Easier testing locally +- ✅ Better maintainability +- ✅ Reusable for manual releases + +## Testing Strategy + +### Local Testing + +Before pushing to dummy-from branch, developers can test transformation locally: + +```bash +# Run transformation script +.github/scripts/transform-to-plugin.sh + +# Test plugin structure +cd /tmp/nabledge-plugin-test +claude --plugin-dir . +``` + +### CI Validation + +Add validation step in workflow: + +```yaml +- name: Validate plugin structure + run: | + # Check required files exist + test -f nabledge-repo/.claude-plugin/plugin.json + test -f nabledge-repo/skills/nabledge-6/SKILL.md + test -f nabledge-repo/README.md + test -f nabledge-repo/LICENSE + + # Validate plugin.json format + jq empty nabledge-repo/.claude-plugin/plugin.json +``` + +## Deployment Flow + +### Development to Distribution + +``` +Developer + │ + ├─> Edit .claude/skills/nabledge-6/ in nabledge-dev + │ + ├─> Test locally: /nabledge-6 + │ + ├─> Commit to dummy-from branch + │ + ├─> GitHub Action triggered + │ │ + │ ├─> Transform to plugin structure + │ ├─> Generate plugin.json, README, etc. + │ └─> Push to nabledge (dummy-to branch) + │ + └─> Users: /plugin marketplace add nablarch/nabledge +``` + +### Release Process + +1. **Prepare release** in nabledge-dev: + - Update `.claude/skills/nabledge-6/plugin/plugin.json` version (e.g., `0.1.0` → `0.2.0`) + - Update `.claude/skills/nabledge-6/plugin/CHANGELOG.md` with release notes + - Update docs if needed + - Test locally + +2. **Push to dummy-from**: + - GitHub Action syncs to nabledge (dummy-to) + +3. **Create release** in nabledge repository: + - Tag release (e.g., `v0.2.0`) + - Create GitHub release with changelog + - Users get automatic update or can pin version + +## Branch Strategy + +### nabledge-dev + +- **dummy-from**: Development branch (push triggers sync) +- **main**: Stable branch (not used for sync) + +### nabledge + +- **dummy-to**: Distribution branch (receives syncs from dummy-from) +- **main**: Could be used for stable releases (optional) + +### Future Consideration + +When moving from dummy branches to production: + +- **nabledge-dev**: `dummy-from` → `main` (trigger branch for sync) + - `develop` will be used for development → `main` for releases +- **nabledge**: `dummy-to` → `main` (distribution branch) + +Update workflow trigger accordingly when transitioning. + +## Implementation Checklist + +- [ ] Create `.claude/skills/nabledge-6/plugin/` directory in nabledge-dev +- [ ] Create `plugin.json` in plugin directory +- [ ] Create `README.md` in plugin directory +- [ ] Create or copy `LICENSE` to plugin directory +- [ ] Create `CHANGELOG.md` in plugin directory +- [ ] Create transform-to-plugin.sh script +- [ ] Update sync-to-nabledge.yml workflow + - [ ] Add transformation steps to move plugin files + - [ ] Add CHANGELOG.md update with sync info + - [ ] Add validation steps +- [ ] Test locally with transform script +- [ ] Test GitHub Action with dummy-from push +- [ ] Verify nabledge repository structure +- [ ] Test plugin installation: `/plugin marketplace add nablarch/nabledge` +- [ ] Test plugin usage: `/nabledge-6` +- [ ] Document release process +- [ ] Update nabledge-dev README with distribution info + +## Future Enhancements + +1. **Automated testing**: Run nabledge-6 skill tests before sync +2. **Version bumping**: Auto-increment version based on commit messages +3. **Release automation**: Auto-create GitHub releases with tags +4. **Marketplace submission**: Submit to official Claude Code marketplace +5. **Multi-version support**: Support Nablarch 5 and 6 simultaneously + +## References + +- [Claude Code Plugin Specification](https://claude.com/docs/plugins) +- [GitHub Actions Documentation](https://docs.github.com/en/actions) +- [Semantic Versioning](https://semver.org/)