From ebed7d563604a2b302dee555956e278d2ef26430 Mon Sep 17 00:00:00 2001 From: wecanfly1 <210529308+wecanfly1@users.noreply.github.com> Date: Fri, 21 Nov 2025 12:25:37 +0800 Subject: [PATCH 01/11] Create datadog-synthetics.yml Signed-off-by: wecanfly1 <210529308+wecanfly1@users.noreply.github.com> --- .github/workflows/datadog-synthetics.yml | 38 ++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/datadog-synthetics.yml diff --git a/.github/workflows/datadog-synthetics.yml b/.github/workflows/datadog-synthetics.yml new file mode 100644 index 00000000..66c70f8e --- /dev/null +++ b/.github/workflows/datadog-synthetics.yml @@ -0,0 +1,38 @@ +# This workflow will trigger Datadog Synthetic tests within your Datadog organisation +# For more information on running Synthetic tests within your GitHub workflows see: https://docs.datadoghq.com/synthetics/cicd_integrations/github_actions/ + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# To get started: + +# 1. Add your Datadog API (DD_API_KEY) and Application Key (DD_APP_KEY) as secrets to your GitHub repository. For more information, see: https://docs.datadoghq.com/account_management/api-app-keys/. +# 2. Start using the action within your workflow + +name: Run Datadog Synthetic tests + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + # Run Synthetic tests within your GitHub workflow. + # For additional configuration options visit the action within the marketplace: https://github.com/marketplace/actions/datadog-synthetics-ci + - name: Run Datadog Synthetic tests + uses: DataDog/synthetics-ci-github-action@87b505388a22005bb8013481e3f73a367b9a53eb # v1.4.0 + with: + api_key: ${{secrets.DD_API_KEY}} + app_key: ${{secrets.DD_APP_KEY}} + test_search_query: 'tag:e2e-tests' #Modify this tag to suit your tagging strategy + + From 83dc44b2c9a3bab5ea86de9db196a3c29a9b548b Mon Sep 17 00:00:00 2001 From: wecanfly1 <210529308+wecanfly1@users.noreply.github.com> Date: Fri, 21 Nov 2025 16:02:49 +0800 Subject: [PATCH 02/11] Update .github/workflows/datadog-synthetics.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/datadog-synthetics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/datadog-synthetics.yml b/.github/workflows/datadog-synthetics.yml index 66c70f8e..984fa409 100644 --- a/.github/workflows/datadog-synthetics.yml +++ b/.github/workflows/datadog-synthetics.yml @@ -1,4 +1,4 @@ -# This workflow will trigger Datadog Synthetic tests within your Datadog organisation +# This workflow will trigger Datadog Synthetic tests within your Datadog organization # For more information on running Synthetic tests within your GitHub workflows see: https://docs.datadoghq.com/synthetics/cicd_integrations/github_actions/ # This workflow uses actions that are not certified by GitHub. From 19a47f9b82dec2fb5b932c2fd413516de2b3e0b3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 05:20:24 +0000 Subject: [PATCH 03/11] Initial plan From 7a489a54870da5b7c39e3bb17f8b4d531f4e8a8b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 05:44:18 +0000 Subject: [PATCH 04/11] Add comprehensive MCP Server API documentation Co-authored-by: we-can-fix-soul <210529308+we-can-fix-soul@users.noreply.github.com> --- README.md | 5 +- docs/README.mcp-api.md | 411 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 415 insertions(+), 1 deletion(-) create mode 100644 docs/README.mcp-api.md diff --git a/README.md b/README.md index b83059dc..9d0a1810 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ This repository provides a comprehensive toolkit for enhancing GitHub Copilot wi - **👉 [Awesome Instructions](docs/README.instructions.md)** - Comprehensive coding standards and best practices that apply to specific file patterns or entire projects - **👉 [Awesome Chat Modes](docs/README.chatmodes.md)** - Specialized AI personas and conversation modes for different roles and contexts - **👉 [Awesome Collections](docs/README.collections.md)** - Curated collections of related prompts, instructions, and chat modes organized around specific themes and workflows +- **👉 [MCP Server API](docs/README.mcp-api.md)** - Complete API documentation for the Awesome Copilot MCP Server, including available tools, usage examples, and integration guides ## 🌟 Featured Collections @@ -31,7 +32,9 @@ Discover our curated collections of prompts, instructions, and chat modes organi To make it easy to add these customizations to your editor, we have created a [MCP Server](https://developer.microsoft.com/blog/announcing-awesome-copilot-mcp-server) that provides a prompt for searching and installing prompts, instructions, and chat modes directly from this repository. You'll need to have Docker installed and running to run the server. -[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode-insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install-C16FDE?logo=visualstudio&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vs) +**📖 [View complete API documentation](docs/README.mcp-api.md)** for detailed information on available tools, usage examples, and integration guides. + +[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode-insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install-C16FDE?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vs)
Show MCP Server JSON configuration diff --git a/docs/README.mcp-api.md b/docs/README.mcp-api.md new file mode 100644 index 00000000..121504c6 --- /dev/null +++ b/docs/README.mcp-api.md @@ -0,0 +1,411 @@ +# MCP Server API 文件 + +## 概述 + +Awesome Copilot MCP Server 是一個 Model Context Protocol (MCP) 伺服器,提供工具讓 AI 助手能夠搜尋並安裝來自本儲存庫的 prompts、instructions 和 chat modes。 + +## 安裝與設定 + +### 系統需求 + +- Docker(已安裝並執行中) +- VS Code、VS Code Insiders 或 Visual Studio + +### 快速安裝 + +**選項 1:透過一鍵安裝連結** + +- [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode) +- [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode-insiders) +- [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install-C16FDE?logo=visualstudio&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vs) + +**選項 2:手動設定** + +將以下 JSON 設定新增至你的 MCP 伺服器設定檔: + +```json +{ + "servers": { + "awesome-copilot": { + "type": "stdio", + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "ghcr.io/microsoft/mcp-dotnet-samples/awesome-copilot:latest" + ] + } + } +} +``` + +### 設定檔位置 + +- **VS Code**: `~/.config/Code/User/globalStorage/github.copilot-chat/mcp.json`(Linux/macOS)或 `%APPDATA%\Code\User\globalStorage\github.copilot-chat\mcp.json`(Windows) +- **VS Code Insiders**: 類似路徑,將 `Code` 替換為 `Code - Insiders` +- **Visual Studio**: 透過 Tools > Options > GitHub Copilot > MCP Servers 設定 + +## 可用工具 + +Awesome Copilot MCP Server 提供以下工具,讓 AI 助手能夠與儲存庫互動: + +### 1. `search_prompts` + +搜尋可用的 prompts。 + +**參數:** +- `query` (string, 選填): 搜尋關鍵字或標籤 +- `tags` (array, 選填): 依標籤篩選 + +**回傳:** +- Prompt 清單,包含名稱、描述、標籤和檔案路徑 + +**範例:** +```typescript +// 搜尋所有 prompts +await searchPrompts({}); + +// 依關鍵字搜尋 +await searchPrompts({ query: "README" }); + +// 依標籤篩選 +await searchPrompts({ tags: ["documentation", "github"] }); +``` + +### 2. `search_instructions` + +搜尋可用的 instructions。 + +**參數:** +- `query` (string, 選填): 搜尋關鍵字 +- `language` (string, 選填): 依程式語言篩選 +- `applyTo` (string, 選填): 依套用模式篩選 + +**回傳:** +- Instruction 清單,包含名稱、描述、套用模式和檔案路徑 + +**範例:** +```typescript +// 搜尋 TypeScript 相關的 instructions +await searchInstructions({ language: "TypeScript" }); + +// 搜尋套用於特定檔案模式的 instructions +await searchInstructions({ applyTo: "*.js" }); +``` + +### 3. `search_chatmodes` + +搜尋可用的 chat modes。 + +**參數:** +- `query` (string, 選填): 搜尋關鍵字 +- `role` (string, 選填): 依角色類型篩選(如 "architect", "expert", "specialist") + +**回傳:** +- Chat mode 清單,包含名稱、描述、工具和模型資訊 + +**範例:** +```typescript +// 搜尋所有 chat modes +await searchChatmodes({}); + +// 搜尋特定角色的 chat modes +await searchChatmodes({ role: "architect" }); +``` + +### 4. `search_agents` + +搜尋可用的 custom agents。 + +**參數:** +- `query` (string, 選填): 搜尋關鍵字 +- `mcpServer` (string, 選填): 依需要的 MCP 伺服器篩選 + +**回傳:** +- Agent 清單,包含名稱、描述、所需 MCP 伺服器和安裝連結 + +**範例:** +```typescript +// 搜尋所有 agents +await searchAgents({}); + +// 搜尋使用特定 MCP 伺服器的 agents +await searchAgents({ mcpServer: "github" }); +``` + +### 5. `get_content` + +取得特定 prompt、instruction、chat mode 或 agent 的完整內容。 + +**參數:** +- `path` (string, 必填): 檔案相對路徑(如 `prompts/create-readme.prompt.md`) + +**回傳:** +- 檔案完整內容,包含 frontmatter 和主體文字 + +**範例:** +```typescript +// 取得特定 prompt 的內容 +await getContent({ path: "prompts/create-readme.prompt.md" }); + +// 取得特定 agent 的內容 +await getContent({ path: "agents/terraform.agent.md" }); +``` + +### 6. `install_item` + +協助安裝 prompt、instruction、chat mode 或 agent 到使用者的環境。 + +**參數:** +- `path` (string, 必填): 要安裝的項目路徑 +- `target` (string, 選填): 安裝目標位置(預設為 VS Code 設定) + +**回傳:** +- 安裝指示和確認訊息 + +**範例:** +```typescript +// 安裝 prompt +await installItem({ path: "prompts/create-readme.prompt.md" }); + +// 安裝 chat mode +await installItem({ path: "chatmodes/architect.chatmode.md" }); +``` + +### 7. `list_collections` + +列出可用的集合。 + +**參數:** +無 + +**回傳:** +- Collection 清單,包含名稱、描述和包含的項目 + +**範例:** +```typescript +// 列出所有集合 +await listCollections(); +``` + +### 8. `get_collection_items` + +取得特定集合中的所有項目。 + +**參數:** +- `collection` (string, 必填): 集合名稱 + +**回傳:** +- 集合中所有項目的詳細資訊 + +**範例:** +```typescript +// 取得特定集合的內容 +await getCollectionItems({ collection: "awesome-copilot" }); +``` + +## 使用情境範例 + +### 範例 1:搜尋並安裝 README 生成器 + +```typescript +// 1. 搜尋 README 相關的 prompts +const results = await searchPrompts({ query: "README" }); + +// 2. 查看第一個結果的詳細內容 +const content = await getContent({ path: results[0].path }); + +// 3. 安裝到本地環境 +await installItem({ path: results[0].path }); +``` + +### 範例 2:尋找適合的 Architecture Agent + +```typescript +// 1. 搜尋 architecture 相關的 agents +const agents = await searchAgents({ query: "architect" }); + +// 2. 篩選需要特定工具的 agents +const filteredAgents = agents.filter(a => a.mcpServers.includes("github")); + +// 3. 查看 agent 詳細資訊 +const agentDetails = await getContent({ path: filteredAgents[0].path }); +``` + +### 範例 3:探索集合 + +```typescript +// 1. 列出所有集合 +const collections = await listCollections(); + +// 2. 取得 "awesome-copilot" 集合的內容 +const items = await getCollectionItems({ collection: "awesome-copilot" }); + +// 3. 安裝集合中的項目 +for (const item of items) { + await installItem({ path: item.path }); +} +``` + +## 錯誤處理 + +MCP Server 可能回傳以下錯誤: + +### 常見錯誤碼 + +- **404 Not Found**: 請求的項目不存在 +- **400 Bad Request**: 參數格式錯誤或缺少必填參數 +- **500 Internal Server Error**: 伺服器內部錯誤 + +### 錯誤回應格式 + +```json +{ + "error": { + "code": "NOT_FOUND", + "message": "The requested item was not found", + "details": "Path 'prompts/nonexistent.prompt.md' does not exist" + } +} +``` + +### 處理錯誤的最佳實務 + +1. **檢查路徑**: 確認檔案路徑正確,使用相對於儲存庫根目錄的路徑 +2. **驗證參數**: 確保所有必填參數都已提供且格式正確 +3. **處理網路問題**: MCP Server 透過 Docker 執行,確保 Docker 服務正常運作 +4. **重試機制**: 對於暫時性錯誤,實作指數退避重試策略 + +## 進階設定 + +### 自訂 Docker 映像 + +如果你想使用自訂的 Docker 映像: + +```json +{ + "servers": { + "awesome-copilot": { + "type": "stdio", + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "your-registry/awesome-copilot:custom-tag" + ] + } + } +} +``` + +### 環境變數 + +可透過 Docker args 傳遞環境變數: + +```json +{ + "servers": { + "awesome-copilot": { + "type": "stdio", + "command": "docker", + "args": [ + "run", + "-i", + "--rm", + "-e", "CUSTOM_SETTING=value", + "ghcr.io/microsoft/mcp-dotnet-samples/awesome-copilot:latest" + ] + } + } +} +``` + +### 本地開發模式 + +在本地開發時,可以直接執行伺服器而不透過 Docker: + +```json +{ + "servers": { + "awesome-copilot": { + "type": "stdio", + "command": "dotnet", + "args": [ + "run", + "--project", + "/path/to/awesome-copilot-server" + ] + } + } +} +``` + +## 效能最佳化 + +### 快取策略 + +MCP Server 會快取搜尋結果以提升效能。快取會在以下情況下自動更新: +- 伺服器重啟時 +- 儲存庫內容更新時 + +### 批次操作 + +當需要安裝多個項目時,建議使用批次操作以減少網路請求: + +```typescript +// 較佳做法:批次取得內容 +const paths = ["prompts/item1.prompt.md", "prompts/item2.prompt.md"]; +const contents = await Promise.all(paths.map(path => getContent({ path }))); + +// 然後批次安裝 +await Promise.all(paths.map(path => installItem({ path }))); +``` + +## 疑難排解 + +### Docker 相關問題 + +**問題**: MCP Server 無法啟動 + +**解決方案**: +1. 確認 Docker 已安裝並執行:`docker --version` +2. 確認可以拉取映像:`docker pull ghcr.io/microsoft/mcp-dotnet-samples/awesome-copilot:latest` +3. 檢查 Docker 日誌:`docker logs ` + +### 搜尋結果為空 + +**問題**: 搜尋工具回傳空結果 + +**解決方案**: +1. 確認搜尋關鍵字拼寫正確 +2. 嘗試使用更寬鬆的搜尋條件 +3. 使用不帶參數的搜尋以列出所有項目 + +### 安裝失敗 + +**問題**: 安裝項目時失敗 + +**解決方案**: +1. 確認目標路徑可寫入 +2. 檢查是否有足夠的磁碟空間 +3. 確認 VS Code/Visual Studio 設定權限正確 + +## 相關資源 + +- [MCP Server 官方公告](https://developer.microsoft.com/blog/announcing-awesome-copilot-mcp-server) +- [Model Context Protocol 規範](https://modelcontextprotocol.io/) +- [VS Code Copilot 自訂文件](https://code.visualstudio.com/docs/copilot/copilot-customization) +- [儲存庫主頁](https://github.com/github/awesome-copilot) + +## 貢獻與回饋 + +如有問題或建議,請: +1. 在 [GitHub Issues](https://github.com/github/awesome-copilot/issues) 提交問題 +2. 參考 [貢獻指南](../CONTRIBUTING.md) +3. 加入社群討論 + +## 授權 + +本專案採用 MIT 授權 - 詳見 [LICENSE](../LICENSE) 檔案。 From b1c5835faa2f828ff2125a59cb1c25e9e15c8377 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 24 Nov 2025 05:45:58 +0000 Subject: [PATCH 05/11] Fix Visual Studio badge logo Co-authored-by: we-can-fix-soul <210529308+we-can-fix-soul@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d0a1810..96e3f71f 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ To make it easy to add these customizations to your editor, we have created a [M **📖 [View complete API documentation](docs/README.mcp-api.md)** for detailed information on available tools, usage examples, and integration guides. -[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode-insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install-C16FDE?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vs) +[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode-insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install-C16FDE?logo=visualstudio&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vs)
Show MCP Server JSON configuration From 1813f7e5fea1249dee74234ba728715de751b5d5 Mon Sep 17 00:00:00 2001 From: SynergyMesh <210529308+Unmanned-Island-admin@users.noreply.github.com> Date: Sat, 29 Nov 2025 05:06:18 +0000 Subject: [PATCH 06/11] Add C# best practices instructions from Issue #30 - Add csharp-14-best-practices.instructions.md for C# 14 specific features - Add csharp-best-practices.instructions.md for all C# versions - Update README.instructions.md with new entries Addresses remaining work from github/awesome-copilot#30 (contributed from PlagueHO/github-copilot-assets-library) --- docs/README.instructions.md | 2 + .../csharp-14-best-practices.instructions.md | 140 +++++++++++++ .../csharp-best-practices.instructions.md | 192 ++++++++++++++++++ 3 files changed, 334 insertions(+) create mode 100644 instructions/csharp-14-best-practices.instructions.md create mode 100644 instructions/csharp-best-practices.instructions.md diff --git a/docs/README.instructions.md b/docs/README.instructions.md index 0820e15a..88d83326 100644 --- a/docs/README.instructions.md +++ b/docs/README.instructions.md @@ -29,6 +29,8 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for | [Azure Verified Modules (AVM) Terraform](../instructions/azure-verified-modules-terraform.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-verified-modules-terraform.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fazure-verified-modules-terraform.instructions.md) | Azure Verified Modules (AVM) and Terraform | | [Bicep Code Best Practices](../instructions/bicep-code-best-practices.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fbicep-code-best-practices.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fbicep-code-best-practices.instructions.md) | Infrastructure as Code with Bicep | | [Blazor](../instructions/blazor.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fblazor.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fblazor.instructions.md) | Blazor component and application patterns | +| [C# 14 Best Practices for AI Code Generation Instructions](../instructions/csharp-14-best-practices.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-14-best-practices.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-14-best-practices.instructions.md) | C# 14 best practices and formatting guidelines for AI code generation. | +| [C# Best Practices for AI Code Generation Instructions](../instructions/csharp-best-practices.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-best-practices.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-best-practices.instructions.md) | C# best practices and formatting guidelines for AI code generation (all versions). | | [C# Development](../instructions/csharp.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp.instructions.md) | Guidelines for building C# applications | | [C# MCP Server Development](../instructions/csharp-mcp-server.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-mcp-server.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-mcp-server.instructions.md) | Instructions for building Model Context Protocol (MCP) servers using the C# SDK | | [C# 코드 작성 규칙](../instructions/csharp-ko.instructions.md)
[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-ko.instructions.md)
[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-ko.instructions.md) | C# 애플리케이션 개발을 위한 코드 작성 규칙 by @jgkim999 | diff --git a/instructions/csharp-14-best-practices.instructions.md b/instructions/csharp-14-best-practices.instructions.md new file mode 100644 index 00000000..68af8ab7 --- /dev/null +++ b/instructions/csharp-14-best-practices.instructions.md @@ -0,0 +1,140 @@ +--- +applyTo: '**/*.cs' +description: 'C# 14 best practices and formatting guidelines for AI code generation.' +--- + +# C# 14 Best Practices for AI Code Generation Instructions + +## Core Language Features + +### Use Primary Constructors + +- Use primary constructors for classes and structs when appropriate +- Leverage parameter validation attributes directly in primary constructor parameters +- Prefer primary constructors over traditional constructors when the constructor only assigns parameters to fields/properties + +### Collection Expressions + +- Use collection expressions `[]` for array, list, and span initialization +- Prefer `[1, 2, 3]` over `new[] { 1, 2, 3 }` or `new List { 1, 2, 3 }` +- Use spread operators `..` for combining collections + +### Pattern Matching Enhancements + +- Use list patterns for matching against collections +- Leverage slice patterns with ranges for partial collection matching +- Prefer switch expressions over switch statements when returning values + +## Code Style and Formatting + +### File-Scoped Namespaces + +- Always use file-scoped namespace declarations (`namespace MyNamespace;`) +- Never use traditional block-scoped namespaces + +### Access Modifiers + +- Explicitly declare access modifiers for all members +- Use `readonly` for fields that are only assigned in constructors +- Use `required` keyword for properties that must be initialized + +### Type Declarations + +- Use `var` for local variables when the type is obvious from the right side +- Use explicit types for method parameters, return types, and field declarations +- Prefer target-typed `new()` expressions when the type is clear from context + +### Method and Property Formatting + +- Use expression-bodied members for simple one-line implementations +- Place opening braces on new lines for methods, classes, and namespaces +- Use lambda expressions with modern syntax: `x => x.Property` + +## Modern C# Patterns + +### Null Safety + +- Enable nullable reference types with `#nullable enable` +- Use null-conditional operators (`?.`, `??`, `??=`) appropriately +- Prefer `ArgumentNullException.ThrowIfNull()` for parameter validation + +### String Handling + +- Use raw string literals for multi-line strings and strings containing quotes +- Use string interpolation `$""` instead of `String.Format()` or concatenation +- Use `string.IsNullOrEmpty()` and `string.IsNullOrWhiteSpace()` for validation + +### Exception Handling + +- Use specific exception types rather than generic `Exception` +- Implement proper exception filtering with `when` clauses +- Use `ThrowHelper` patterns for commonly thrown exceptions + +## Performance Optimizations + +### Memory Efficiency + +- Use `Span` and `ReadOnlySpan` for high-performance scenarios +- Prefer `stackalloc` for small, short-lived arrays +- Use `ref` and `in` parameters to avoid unnecessary copying + +### Collections + +- Use appropriate collection types: `List`, `HashSet`, `Dictionary` +- Prefer `IReadOnlyList` and `IReadOnlyCollection` for immutable data exposure +- Use `CollectionsMarshal` for high-performance collection operations when needed + +## Async/Await Best Practices + +### Async Methods + +- Use `async Task` for void-returning async methods +- Use `async Task` for value-returning async methods +- Use `async ValueTask` for high-performance scenarios where allocation matters +- Always use `ConfigureAwait(false)` in library code + +### Cancellation + +- Accept `CancellationToken` parameters in long-running async methods +- Use `CancellationToken.ThrowIfCancellationRequested()` for cooperative cancellation +- Pass cancellation tokens through the call chain + +## XML Documentation + +- Provide XML documentation comments for all public APIs +- Use ``, ``, ``, and `` tags appropriately +- Include `` sections for complex methods + +## Testing Patterns + +- Use modern test frameworks like xUnit, NUnit, or MSTest +- Prefer `Assert.Throws()` over try-catch blocks in tests +- Use meaningful test method names that describe the scenario + +## File Organization + +- One public type per file +- File name should match the primary type name +- Organize using statements: System namespaces first, then third-party, then project namespaces +- Remove unused using statements + +## Code Quality Rules + +- Follow Microsoft's .NET coding conventions +- Use EditorConfig files for consistent formatting across teams +- Enable and address code analysis warnings +- Use code contracts and defensive programming practices + +## Post-Generation Actions + +- **ALWAYS trim trailing whitespace from all lines after any code changes** +- Ensure consistent line endings (LF on Unix, CRLF on Windows) +- Remove any extra blank lines at the end of files +- Ensure proper indentation (4 spaces for C#, no tabs) + +## Security Considerations + +- Validate all input parameters +- Use secure string handling practices +- Implement proper error handling without exposing sensitive information +- Follow OWASP guidelines for secure coding practices diff --git a/instructions/csharp-best-practices.instructions.md b/instructions/csharp-best-practices.instructions.md new file mode 100644 index 00000000..e1df81fc --- /dev/null +++ b/instructions/csharp-best-practices.instructions.md @@ -0,0 +1,192 @@ +--- +applyTo: '**/*.cs' +description: 'C# best practices and formatting guidelines for AI code generation (all versions).' +--- + +# C# Best Practices for AI Code Generation Instructions + +## Code Style and Formatting + +### Namespace Declarations + +- Use file-scoped namespace declarations when using C# 10+ (`namespace MyNamespace;`) +- For older versions, use traditional block-scoped namespaces with proper indentation +- Keep namespace declarations consistent within the project + +### Access Modifiers + +- Explicitly declare access modifiers for all members +- Use `readonly` for fields that are only assigned in constructors +- Use `const` for compile-time constants +- Follow principle of least privilege for access levels + +### Type Declarations + +- Use `var` for local variables when the type is obvious from the right side +- Use explicit types for method parameters, return types, and field declarations +- Prefer target-typed expressions when the type is clear from context +- Use meaningful and descriptive type names + +### Method and Property Formatting + +- Use expression-bodied members for simple one-line implementations +- Place opening braces on new lines for methods, classes, and namespaces +- Use auto-implemented properties when appropriate +- Implement properties with backing fields only when additional logic is needed + +## Modern C# Patterns + +### Null Safety + +- Use null-conditional operators (`?.`, `??`, `??=`) when available +- Validate parameters with appropriate null checks +- Use `string.IsNullOrEmpty()` and `string.IsNullOrWhiteSpace()` for string validation +- Consider nullable reference types when using C# 8+ + +### String Handling + +- Use string interpolation `$""` instead of `String.Format()` or concatenation +- Use `StringBuilder` for extensive string manipulation +- Prefer `string.Equals()` with `StringComparison` for culture-aware comparisons +- Use verbatim strings `@""` for paths and multi-line strings + +### Exception Handling + +- Use specific exception types rather than generic `Exception` +- Implement proper exception filtering with `when` clauses when available +- Provide meaningful exception messages +- Follow the fail-fast principle + +## Performance Considerations + +### Memory Efficiency + +- Dispose of `IDisposable` objects properly using `using` statements or blocks +- Avoid unnecessary boxing and unboxing +- Use appropriate collection types for the use case +- Consider object pooling for frequently allocated objects + +### Collections + +- Use appropriate collection types: `List`, `HashSet`, `Dictionary` +- Prefer `IEnumerable` for method parameters when only enumeration is needed +- Use `IReadOnlyList` and `IReadOnlyCollection` for immutable data exposure +- Initialize collections with known capacity when possible + +### LINQ Usage + +- Use LINQ methods appropriately for readability and performance +- Prefer method syntax over query syntax for simple operations +- Be aware of deferred execution implications +- Use `ToList()` or `ToArray()` when multiple enumeration is needed + +## Async/Await Best Practices + +### Async Methods + +- Use `async Task` for void-returning async methods +- Use `async Task` for value-returning async methods +- Avoid `async void` except for event handlers +- Use `ConfigureAwait(false)` in library code + +### Cancellation + +- Accept `CancellationToken` parameters in long-running async methods +- Check for cancellation at appropriate intervals +- Pass cancellation tokens through the call chain +- Handle `OperationCanceledException` appropriately + +## Object-Oriented Principles + +### Encapsulation + +- Keep fields private and expose through properties +- Use appropriate access modifiers to control visibility +- Validate property setters when necessary +- Hide implementation details behind interfaces + +### Inheritance and Polymorphism + +- Prefer composition over inheritance when appropriate +- Use virtual methods judiciously +- Override `Equals`, `GetHashCode`, and `ToString` when meaningful +- Implement interfaces explicitly when there might be naming conflicts + +### SOLID Principles + +- Single Responsibility: Classes should have one reason to change +- Open/Closed: Open for extension, closed for modification +- Liskov Substitution: Subtypes must be substitutable for base types +- Interface Segregation: Many specific interfaces are better than one general +- Dependency Inversion: Depend on abstractions, not concretions + +## XML Documentation + +- Provide XML documentation comments for all public APIs +- Use ``, ``, ``, and `` tags appropriately +- Include `` sections for complex methods +- Document any thread safety considerations + +## Testing Patterns + +- Use modern test frameworks like xUnit, NUnit, or MSTest +- Follow AAA pattern: Arrange, Act, Assert +- Use meaningful test method names that describe the scenario +- Test both happy path and edge cases +- Mock dependencies appropriately + +## File Organization + +- One public type per file +- File name should match the primary type name +- Organize using statements: System namespaces first, then third-party, then project namespaces +- Remove unused using statements +- Group related types in appropriate namespaces + +## Code Quality Rules + +- Follow Microsoft's .NET coding conventions +- Use EditorConfig files for consistent formatting across teams +- Enable and address code analysis warnings +- Use static analysis tools like SonarQube or Roslyn analyzers +- Implement code reviews and pair programming + +## Error Handling + +- Use exceptions for exceptional circumstances, not control flow +- Catch specific exceptions rather than generic `Exception` +- Log errors appropriately without exposing sensitive information +- Provide meaningful error messages to users +- Consider using Result pattern for expected failures + +## Resource Management + +- Implement `IDisposable` for types that manage unmanaged resources +- Use `using` statements for automatic resource cleanup +- Follow the Dispose pattern correctly +- Consider implementing finalizers only when necessary + +## Performance Monitoring + +- Use appropriate logging frameworks +- Implement health checks for long-running services +- Monitor memory usage and garbage collection +- Profile applications to identify bottlenecks + +## Post-Generation Actions + +- **ALWAYS trim trailing whitespace from all lines after any code changes** +- Ensure consistent line endings (LF on Unix, CRLF on Windows) +- Remove any extra blank lines at the end of files +- Ensure proper indentation (4 spaces for C#, no tabs) +- Format code according to project standards + +## Security Considerations + +- Validate all input parameters +- Use secure string handling practices +- Implement proper authentication and authorization +- Follow OWASP guidelines for secure coding practices +- Avoid hardcoding sensitive information +- Use secure communication protocols (HTTPS, TLS) +- Implement proper error handling without exposing sensitive information From b0c437fc97e16a371fb0544b91e674770e8aab3d Mon Sep 17 00:00:00 2001 From: SynergyMesh <210529308+Unmanned-Island-admin@users.noreply.github.com> Date: Sat, 29 Nov 2025 05:13:04 +0000 Subject: [PATCH 07/11] Add SynergyMesh Copilot configuration Create comprehensive GitHub Copilot and VS Code configuration for SynergyMesh: - .github/copilot-instructions.md: Project-specific TypeScript, Socket.io, D3.js, and multi-touch development guidelines - .github/prompts/: 5 custom prompts for common SynergyMesh tasks - create-synergymesh-app.prompt.md - add-network-event.prompt.md - implement-touch-gesture.prompt.md - debug-synergymesh.prompt.md - add-content.prompt.md - .vscode/: Editor settings, tasks, launch configs, and extensions Based on awesome-copilot TypeScript/Node.js best practices --- .../.github/copilot-instructions.md | 202 ++++++++++++++++++ .../.github/prompts/add-content.prompt.md | 116 ++++++++++ .../prompts/add-network-event.prompt.md | 56 +++++ .../prompts/create-synergymesh-app.prompt.md | 74 +++++++ .../prompts/debug-synergymesh.prompt.md | 72 +++++++ .../prompts/implement-touch-gesture.prompt.md | 79 +++++++ .../.vscode/extensions.json | 13 ++ .../.vscode/launch.json | 47 ++++ .../.vscode/settings.json | 57 +++++ synergymesh-copilot-config/.vscode/tasks.json | 90 ++++++++ synergymesh-copilot-config/README.md | 89 ++++++++ 11 files changed, 895 insertions(+) create mode 100644 synergymesh-copilot-config/.github/copilot-instructions.md create mode 100644 synergymesh-copilot-config/.github/prompts/add-content.prompt.md create mode 100644 synergymesh-copilot-config/.github/prompts/add-network-event.prompt.md create mode 100644 synergymesh-copilot-config/.github/prompts/create-synergymesh-app.prompt.md create mode 100644 synergymesh-copilot-config/.github/prompts/debug-synergymesh.prompt.md create mode 100644 synergymesh-copilot-config/.github/prompts/implement-touch-gesture.prompt.md create mode 100644 synergymesh-copilot-config/.vscode/extensions.json create mode 100644 synergymesh-copilot-config/.vscode/launch.json create mode 100644 synergymesh-copilot-config/.vscode/settings.json create mode 100644 synergymesh-copilot-config/.vscode/tasks.json create mode 100644 synergymesh-copilot-config/README.md diff --git a/synergymesh-copilot-config/.github/copilot-instructions.md b/synergymesh-copilot-config/.github/copilot-instructions.md new file mode 100644 index 00000000..e0299079 --- /dev/null +++ b/synergymesh-copilot-config/.github/copilot-instructions.md @@ -0,0 +1,202 @@ +# SynergyMesh Copilot Instructions + +> These instructions guide GitHub Copilot when working with the SynergyMesh project - a TypeScript library for web-based multi-user natural user interface applications. + +## Project Overview + +SynergyMesh is a library supporting: +- Multi-touch gesture support for collaborative surfaces +- Real-time networking via Socket.io +- Web-based multi-user applications + +### Technology Stack +- **Language**: TypeScript (compiled with Webpack) +- **Runtime**: Node.js + Browser +- **Networking**: Socket.io (client & server) +- **Frontend**: D3.js (v3.5), jQuery +- **Server**: Express.js +- **Build**: Webpack + ts-loader + +## Project Structure + +``` +synergymesh/ +├── apps/ # Application implementations +│ ├── mysteries/ # Collaborative mystery-solving app +│ ├── prototype/ # Prototype testing app +│ └── teacher_controls/ # Teacher control interface +├── common/ # Shared library code +│ ├── src/ +│ │ ├── constants/ # Shared constants +│ │ ├── items/ # UI item definitions +│ │ ├── listeners/ # Touch & network event handlers +│ │ └── utils/ # Utility functions +│ └── web/ # Shared CSS and scripts +├── server/ # Socket.io server +│ └── src/ +│ └── services/ # Server services +└── config.json # Application configuration +``` + +## Core Development Guidelines + +### TypeScript Standards + +- Target TypeScript 2.7+ with ES2015 module output +- Use strict null checks and explicit type annotations +- Prefer interfaces over type aliases for object shapes +- Use discriminated unions for event types + +### Naming Conventions + +- **Files**: Use snake_case (e.g., `touch_manager.ts`, `network_flick_manager.ts`) +- **Classes**: Use PascalCase (e.g., `FlickManager`, `NetworkingService`) +- **Variables/Functions**: Use camelCase +- **Constants**: Use UPPER_SNAKE_CASE for module-level constants + +### Multi-Touch Event Handling + +When working with touch events: +- Use the `TouchManager` class from `common/src/listeners/touch_manager.ts` +- Handle touch start, move, and end events consistently +- Implement gesture recognition through the `FlickManager` +- Support both touch and mouse fallback for development + +```typescript +// Example touch handler pattern +class TouchHandler { + private touchManager: TouchManager; + + initialize(element: HTMLElement): void { + this.touchManager = new TouchManager(element); + this.touchManager.onFlick((direction, velocity) => { + this.handleFlick(direction, velocity); + }); + } +} +``` + +### Socket.io Networking + +When implementing real-time features: +- Use event names from `common/src/constants/common_network_events.ts` +- Follow the existing networking patterns in `common/src/utils/networking.ts` +- Implement proper connection state handling +- Use rooms for multi-table scenarios + +```typescript +// Server-side event emission pattern +socket.to(roomId).emit(NetworkEvents.ITEM_MOVED, { + itemId: item.id, + position: { x, y }, + timestamp: Date.now() +}); + +// Client-side event handling pattern +socket.on(NetworkEvents.ITEM_MOVED, (data) => { + this.updateItemPosition(data.itemId, data.position); +}); +``` + +### D3.js Integration + +For visual elements and data binding: +- Use D3 v3.5 API (note: significantly different from v4+) +- Leverage D3 for SVG manipulation and data-driven updates +- Use enter/update/exit pattern for dynamic content + +```typescript +// D3 v3 pattern for updating items +const items = d3.select('#container') + .selectAll('.item') + .data(itemData, d => d.id); + +items.enter() + .append('div') + .attr('class', 'item') + .style('transform', d => `translate(${d.x}px, ${d.y}px)`); + +items.exit().remove(); +``` + +## Application Development + +### Creating New Apps + +When creating a new application: +1. Create folder structure under `apps/[app-name]/` +2. Implement app class extending `SynergyMeshApp` +3. Create HTML entry point in `web/index.html` +4. Add webpack entry in `webpack.config.js` + +```typescript +// App class template +import { SynergyMeshApp } from '../../common/src/synergymesh_app'; + +export class MyApp extends SynergyMeshApp { + protected initialize(): void { + super.initialize(); + // App-specific initialization + } + + protected onItemCreated(item: Item): void { + // Handle new item creation + } +} +``` + +### Configuration + +- Use `config.json` for application settings +- Access configuration via `common/src/utils/config.ts` +- Support query string overrides for runtime configuration + +## Server Development + +### Adding New Services + +- Place services in `server/src/services/` +- Follow the pattern in `networking_service.ts` +- Register services in `server/src/server.ts` + +### Event Handling + +- Define new events in `common/src/constants/common_network_events.ts` +- Keep client and server event handlers synchronized +- Implement proper error handling and reconnection logic + +## Testing & Development + +### Local Development + +```bash +# Install dependencies +npm run install:dev + +# Start webpack dev server (client) +npm run start:site:dev + +# Start Socket.io server (separate terminal) +npm run start:networking:dev +``` + +### Browser Testing + +- Test with touch-emulator.js for multi-touch simulation +- Use Chrome DevTools device mode for touch event testing +- Test across multiple browser instances for networking + +## Code Quality + +- Add JSDoc comments to public APIs +- Keep functions small and focused +- Extract reusable logic into utilities +- Handle edge cases for touch and network events +- Clean up event listeners on component disposal + +## Security Considerations + +- Validate all incoming socket messages +- Sanitize user-provided content names +- Implement rate limiting for network events +- Use secure WebSocket connections (WSS) in production diff --git a/synergymesh-copilot-config/.github/prompts/add-content.prompt.md b/synergymesh-copilot-config/.github/prompts/add-content.prompt.md new file mode 100644 index 00000000..4ca25a26 --- /dev/null +++ b/synergymesh-copilot-config/.github/prompts/add-content.prompt.md @@ -0,0 +1,116 @@ +--- +mode: 'agent' +description: 'Add content (items, data) to a SynergyMesh application' +tools: ['codebase', 'editFiles'] +--- + +# Add Content to SynergyMesh App + +Add new content items or data files to an existing SynergyMesh application. + +## Content Details + +**App**: {{appName}} +**Content Type**: {{contentType}} (text-items / images / JSON-data / custom) +**Description**: {{description}} + +## Implementation Steps + +### For JSON Content Files + +1. **Create content JSON file** in `apps/{{appName}}/web/contents/`: + ```json + { + "title": "{{contentTitle}}", + "items": [ + { + "id": "item-1", + "type": "text", + "content": "Sample content", + "position": { "x": 100, "y": 100 } + } + ], + "metadata": { + "author": "", + "created": "{{date}}", + "description": "{{description}}" + } + } + ``` + +2. **Add content loader** to the app: + ```typescript + private async loadContent(contentName: string): Promise { + const response = await fetch(`contents/${contentName}.json`); + return response.json(); + } + ``` + +3. **Render content items** using D3: + ```typescript + private renderItems(items: ContentItem[]): void { + const selection = d3.select('#container') + .selectAll('.content-item') + .data(items, d => d.id); + + selection.enter() + .append('div') + .attr('class', 'content-item') + .each(function(d) { + // Initialize item based on type + }); + } + ``` + +### For Image Content + +1. **Add images** to `apps/{{appName}}/web/images/` + +2. **Reference in CSS or HTML**: + ```css + .item-background { + background-image: url('images/{{imageName}}.png'); + } + ``` + +3. **Preload images** if needed: + ```typescript + private preloadImages(urls: string[]): Promise { + return Promise.all(urls.map(url => { + return new Promise((resolve, reject) => { + const img = new Image(); + img.onload = () => resolve(); + img.onerror = reject; + img.src = url; + }); + })); + } + ``` + +### For Text Items + +1. **Use TextItem class** from `common/src/items/text_item.ts` + +2. **Create text items**: + ```typescript + import { TextItem } from '../../common/src/items/text_item'; + + private createTextItems(texts: string[]): void { + texts.forEach((text, index) => { + const item = new TextItem({ + id: `text-${index}`, + content: text, + position: { x: index * 150, y: 100 } + }); + this.addItem(item); + }); + } + ``` + +## Content Guidelines + +- Use unique IDs for all content items +- Include position data for initial layout +- Consider screen/table size for positioning +- Add metadata for content attribution +- Test with touch interactions diff --git a/synergymesh-copilot-config/.github/prompts/add-network-event.prompt.md b/synergymesh-copilot-config/.github/prompts/add-network-event.prompt.md new file mode 100644 index 00000000..99a7b390 --- /dev/null +++ b/synergymesh-copilot-config/.github/prompts/add-network-event.prompt.md @@ -0,0 +1,56 @@ +--- +mode: 'agent' +description: 'Add a new Socket.io network event to SynergyMesh' +tools: ['codebase', 'editFiles'] +--- + +# Add Network Event to SynergyMesh + +Add a new real-time network event for multi-user synchronization. + +## Event Details + +**Event Name**: {{eventName}} +**Direction**: {{direction}} (client-to-server / server-to-client / bidirectional) +**Description**: {{description}} + +## Implementation Steps + +1. **Add event constant** to `common/src/constants/common_network_events.ts`: + ```typescript + export const {{EVENT_NAME}} = '{{eventName}}'; + ``` + +2. **Define event payload interface** (if not exists): + ```typescript + export interface {{EventName}}Payload { + // Define payload structure + } + ``` + +3. **Implement server-side handler** in `server/src/services/networking_service.ts`: + ```typescript + socket.on(NetworkEvents.{{EVENT_NAME}}, (data: {{EventName}}Payload) => { + // Validate incoming data + // Process event + // Broadcast to other clients if needed + socket.to(roomId).emit(NetworkEvents.{{EVENT_NAME}}, processedData); + }); + ``` + +4. **Implement client-side handler** in the relevant app or common networking utility: + ```typescript + socket.on(NetworkEvents.{{EVENT_NAME}}, (data: {{EventName}}Payload) => { + // Handle incoming event + this.on{{EventName}}Received(data); + }); + + // Emit event to server + public emit{{EventName}}(data: {{EventName}}Payload): void { + socket.emit(NetworkEvents.{{EVENT_NAME}}, data); + } + ``` + +5. **Add error handling** for network failures and invalid payloads + +6. **Update documentation** if this is a core API event diff --git a/synergymesh-copilot-config/.github/prompts/create-synergymesh-app.prompt.md b/synergymesh-copilot-config/.github/prompts/create-synergymesh-app.prompt.md new file mode 100644 index 00000000..23ae3064 --- /dev/null +++ b/synergymesh-copilot-config/.github/prompts/create-synergymesh-app.prompt.md @@ -0,0 +1,74 @@ +--- +mode: 'agent' +description: 'Create a new SynergyMesh application with proper structure and boilerplate' +tools: ['codebase', 'editFiles', 'runTerminal'] +--- + +# Create New SynergyMesh Application + +Create a new multi-touch collaborative application for the SynergyMesh framework. + +## Application Requirements + +**App Name**: {{appName}} +**Description**: {{description}} + +## Tasks + +1. **Create folder structure**: + ``` + apps/{{appName}}/ + ├── src/ + │ └── {{appName}}_app.ts + └── web/ + ├── index.html + └── app.css + ``` + +2. **Implement the main app class** extending `SynergyMeshApp`: + - Import required modules from `common/src/` + - Set up touch event handlers + - Initialize networking if multi-user + - Implement item creation and interaction logic + +3. **Create HTML entry point** with: + - Proper DOCTYPE and meta tags + - Link to common CSS (`../../common/web/synergymesh.css`) + - Link to app-specific CSS + - Canvas or container element for items + - Script inclusion for the bundled app + +4. **Update webpack.config.js** to include the new entry point + +5. **Add any necessary content files** (JSON data, images) in `web/contents/` + +## Example App Structure + +```typescript +import { SynergyMeshApp } from '../../common/src/synergymesh_app'; +import { TouchManager } from '../../common/src/listeners/touch_manager'; +import { NetworkFlickManager } from '../../common/src/listeners/network_flick_manager'; + +export class {{PascalCaseAppName}}App extends SynergyMeshApp { + private touchManager: TouchManager; + + protected initialize(): void { + super.initialize(); + this.setupTouchHandlers(); + this.loadContent(); + } + + private setupTouchHandlers(): void { + // Touch event setup + } + + private loadContent(): void { + // Load app-specific content + } +} + +// Initialize app when DOM is ready +$(document).ready(() => { + new {{PascalCaseAppName}}App(); +}); +``` diff --git a/synergymesh-copilot-config/.github/prompts/debug-synergymesh.prompt.md b/synergymesh-copilot-config/.github/prompts/debug-synergymesh.prompt.md new file mode 100644 index 00000000..673e7ffe --- /dev/null +++ b/synergymesh-copilot-config/.github/prompts/debug-synergymesh.prompt.md @@ -0,0 +1,72 @@ +--- +mode: 'agent' +description: 'Debug and fix multi-touch or networking issues in SynergyMesh' +tools: ['codebase', 'editFiles', 'runTerminal'] +--- + +# Debug SynergyMesh Issue + +Diagnose and fix issues related to multi-touch interactions or real-time networking. + +## Issue Details + +**Problem**: {{problemDescription}} +**Affected Area**: {{area}} (touch / networking / rendering / performance) +**Steps to Reproduce**: {{stepsToReproduce}} + +## Diagnostic Steps + +### For Touch Issues + +1. **Check touch event binding**: + - Verify `TouchManager` is properly initialized + - Confirm event listeners are attached to correct elements + - Check for event propagation issues (`stopPropagation`, `preventDefault`) + +2. **Inspect touch coordinates**: + - Log touch events to verify coordinate transformation + - Check for offset calculations in nested containers + - Verify touch-to-item hit detection logic + +3. **Test with touch emulator**: + - Enable `touch-emulator.js` for desktop testing + - Compare behavior with real touch device + +### For Networking Issues + +1. **Check Socket.io connection**: + ```javascript + // Add to client for debugging + socket.on('connect', () => console.log('Connected:', socket.id)); + socket.on('disconnect', (reason) => console.log('Disconnected:', reason)); + socket.on('error', (error) => console.error('Socket error:', error)); + ``` + +2. **Verify event payload**: + - Log outgoing events before `emit()` + - Log incoming events in handlers + - Check for serialization issues with complex objects + +3. **Test room/broadcast logic**: + - Verify clients join correct rooms + - Test with multiple browser instances + - Check server-side room management + +### For Rendering Issues + +1. **Check D3 data binding**: + - Verify data key functions return unique IDs + - Inspect enter/update/exit selections + - Check for orphaned DOM elements + +2. **Inspect CSS transforms**: + - Verify transform calculations + - Check for conflicting CSS rules + - Test with CSS transitions disabled + +## Common Fixes + +- **Touch not responding**: Check z-index and pointer-events CSS +- **Events firing multiple times**: Remove duplicate event listeners +- **Sync lag**: Implement event batching/debouncing +- **Memory leaks**: Ensure proper disposal of managers and listeners diff --git a/synergymesh-copilot-config/.github/prompts/implement-touch-gesture.prompt.md b/synergymesh-copilot-config/.github/prompts/implement-touch-gesture.prompt.md new file mode 100644 index 00000000..21461a22 --- /dev/null +++ b/synergymesh-copilot-config/.github/prompts/implement-touch-gesture.prompt.md @@ -0,0 +1,79 @@ +--- +mode: 'agent' +description: 'Implement a new touch gesture for SynergyMesh items' +tools: ['codebase', 'editFiles'] +--- + +# Implement Touch Gesture + +Add a new touch gesture for interactive items in SynergyMesh. + +## Gesture Details + +**Gesture Name**: {{gestureName}} +**Type**: {{gestureType}} (tap / long-press / pinch / rotate / swipe / custom) +**Target**: {{target}} (items / canvas / specific element) + +## Implementation Steps + +1. **Create gesture recognizer class** in `common/src/listeners/`: + ```typescript + export class {{GestureName}}Manager { + private element: HTMLElement; + private threshold: number; + private callbacks: Map; + + constructor(element: HTMLElement, options?: {{GestureName}}Options) { + this.element = element; + this.threshold = options?.threshold || DEFAULT_THRESHOLD; + this.callbacks = new Map(); + this.bindEvents(); + } + + private bindEvents(): void { + this.element.addEventListener('touchstart', this.onTouchStart.bind(this)); + this.element.addEventListener('touchmove', this.onTouchMove.bind(this)); + this.element.addEventListener('touchend', this.onTouchEnd.bind(this)); + } + + public on{{GestureName}}(callback: (data: {{GestureName}}Data) => void): void { + // Register callback + } + + public dispose(): void { + // Clean up event listeners + } + } + ``` + +2. **Define gesture data interface**: + ```typescript + export interface {{GestureName}}Data { + target: HTMLElement; + startPosition: { x: number; y: number }; + endPosition: { x: number; y: number }; + duration: number; + // Add gesture-specific data + } + ``` + +3. **Integrate with TouchManager** if this is a common gesture: + - Add detection logic to existing touch flow + - Emit gesture events through the manager + +4. **Add network synchronization** if the gesture should be replicated: + - Define network event in `common_network_events.ts` + - Implement server relay in networking service + - Handle remote gesture events on clients + +5. **Update app classes** to use the new gesture: + ```typescript + private setupGestures(): void { + this.{{gestureName}}Manager = new {{GestureName}}Manager(this.container); + this.{{gestureName}}Manager.on{{GestureName}}((data) => { + this.handle{{GestureName}}(data); + }); + } + ``` + +6. **Add touch emulator support** for desktop testing diff --git a/synergymesh-copilot-config/.vscode/extensions.json b/synergymesh-copilot-config/.vscode/extensions.json new file mode 100644 index 00000000..9a9e482b --- /dev/null +++ b/synergymesh-copilot-config/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + "recommendations": [ + "github.copilot", + "github.copilot-chat", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "ms-vscode.vscode-typescript-next", + "bradlc.vscode-tailwindcss", + "formulahendry.auto-rename-tag", + "christian-kohler.path-intellisense", + "streetsidesoftware.code-spell-checker" + ] +} diff --git a/synergymesh-copilot-config/.vscode/launch.json b/synergymesh-copilot-config/.vscode/launch.json new file mode 100644 index 00000000..557dabc1 --- /dev/null +++ b/synergymesh-copilot-config/.vscode/launch.json @@ -0,0 +1,47 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Chrome", + "type": "chrome", + "request": "launch", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}", + "sourceMaps": true, + "preLaunchTask": "Start Dev Server" + }, + { + "name": "Debug Server", + "type": "node", + "request": "launch", + "runtimeArgs": [ + "-r", + "ts-node/register" + ], + "args": [ + "${workspaceFolder}/server/src/server.ts" + ], + "cwd": "${workspaceFolder}", + "sourceMaps": true, + "protocol": "inspector" + }, + { + "name": "Attach to Server", + "type": "node", + "request": "attach", + "port": 9229, + "restart": true, + "sourceMaps": true + } + ], + "compounds": [ + { + "name": "Full Stack Debug", + "configurations": [ + "Debug Server", + "Launch Chrome" + ], + "stopAll": true + } + ] +} diff --git a/synergymesh-copilot-config/.vscode/settings.json b/synergymesh-copilot-config/.vscode/settings.json new file mode 100644 index 00000000..52db00ab --- /dev/null +++ b/synergymesh-copilot-config/.vscode/settings.json @@ -0,0 +1,57 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + "typescript.preferences.importModuleSpecifier": "relative", + "typescript.suggest.paths": true, + "typescript.tsdk": "node_modules/typescript/lib", + + "files.exclude": { + "**/.git": true, + "**/node_modules": true, + "**/dist": true + }, + + "search.exclude": { + "**/node_modules": true, + "**/dist": true, + "**/*.js.map": true + }, + + "emmet.includeLanguages": { + "typescript": "html" + }, + + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.tabSize": 4 + }, + + "[html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.tabSize": 2 + }, + + "[css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.tabSize": 2 + }, + + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.tabSize": 2 + }, + + "github.copilot.enable": { + "*": true, + "plaintext": true, + "markdown": true, + "typescript": true, + "javascript": true, + "html": true, + "css": true, + "json": true + } +} diff --git a/synergymesh-copilot-config/.vscode/tasks.json b/synergymesh-copilot-config/.vscode/tasks.json new file mode 100644 index 00000000..adeaacca --- /dev/null +++ b/synergymesh-copilot-config/.vscode/tasks.json @@ -0,0 +1,90 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build", + "type": "npm", + "script": "build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": ["$tsc-watch"], + "presentation": { + "reveal": "always", + "panel": "shared" + } + }, + { + "label": "Start Dev Server", + "type": "npm", + "script": "start:site:dev", + "group": "none", + "isBackground": true, + "problemMatcher": { + "pattern": { + "regexp": "^$" + }, + "background": { + "activeOnStart": true, + "beginsPattern": "webpack", + "endsPattern": "Compiled successfully" + } + }, + "presentation": { + "reveal": "always", + "panel": "dedicated", + "group": "dev" + } + }, + { + "label": "Start Networking Server", + "type": "npm", + "script": "start:networking:dev", + "group": "none", + "isBackground": true, + "problemMatcher": { + "pattern": { + "regexp": "^$" + }, + "background": { + "activeOnStart": true, + "beginsPattern": "nodemon", + "endsPattern": "listening" + } + }, + "presentation": { + "reveal": "always", + "panel": "dedicated", + "group": "dev" + } + }, + { + "label": "Start All (Dev)", + "dependsOn": [ + "Start Dev Server", + "Start Networking Server" + ], + "dependsOrder": "parallel", + "group": { + "kind": "test", + "isDefault": true + }, + "problemMatcher": [] + }, + { + "label": "Install Dependencies", + "type": "npm", + "script": "install:dev", + "group": "none", + "problemMatcher": [] + }, + { + "label": "Generate Docs", + "type": "npm", + "script": "doc", + "group": "none", + "problemMatcher": [] + } + ] +} diff --git a/synergymesh-copilot-config/README.md b/synergymesh-copilot-config/README.md new file mode 100644 index 00000000..435ffe1e --- /dev/null +++ b/synergymesh-copilot-config/README.md @@ -0,0 +1,89 @@ +# SynergyMesh Copilot Configuration + +This directory contains GitHub Copilot and VS Code configuration files optimized for the [SynergyMesh](https://github.com/synergynet/synergymesh) project - a TypeScript library for web-based multi-user natural user interface applications. + +## 📁 Contents + +``` +synergymesh-copilot-config/ +├── .github/ +│ ├── copilot-instructions.md # Project-specific Copilot instructions +│ └── prompts/ +│ ├── create-synergymesh-app.prompt.md # Create new app +│ ├── add-network-event.prompt.md # Add Socket.io events +│ ├── implement-touch-gesture.prompt.md # Implement gestures +│ ├── debug-synergymesh.prompt.md # Debug issues +│ └── add-content.prompt.md # Add content/data +└── .vscode/ + ├── settings.json # Editor settings + ├── extensions.json # Recommended extensions + ├── tasks.json # Build and run tasks + └── launch.json # Debug configurations +``` + +## 🚀 Installation + +Copy the configuration files to your SynergyMesh project: + +```bash +# Clone or download this configuration +# Then copy to your SynergyMesh project root + +# Copy GitHub Copilot instructions +cp -r synergymesh-copilot-config/.github /path/to/synergymesh/ + +# Copy VS Code settings +cp -r synergymesh-copilot-config/.vscode /path/to/synergymesh/ +``` + +Or use the install links below for individual prompts: + +## 📝 Available Prompts + +| Prompt | Description | Install | +|--------|-------------|---------| +| [Create SynergyMesh App](.github/prompts/create-synergymesh-app.prompt.md) | Create a new multi-touch collaborative application | Copy to `.github/prompts/` | +| [Add Network Event](.github/prompts/add-network-event.prompt.md) | Add Socket.io real-time events | Copy to `.github/prompts/` | +| [Implement Touch Gesture](.github/prompts/implement-touch-gesture.prompt.md) | Add new touch gesture support | Copy to `.github/prompts/` | +| [Debug SynergyMesh](.github/prompts/debug-synergymesh.prompt.md) | Diagnose touch and networking issues | Copy to `.github/prompts/` | +| [Add Content](.github/prompts/add-content.prompt.md) | Add items and data to apps | Copy to `.github/prompts/` | + +## 🛠️ VS Code Tasks + +After installing, use these tasks from the Command Palette (`Ctrl+Shift+P` → "Tasks: Run Task"): + +- **Build** - Compile TypeScript with Webpack +- **Start All (Dev)** - Start both dev server and networking server +- **Start Dev Server** - Start Webpack dev server only +- **Start Networking Server** - Start Socket.io server only +- **Generate Docs** - Generate TypeDoc documentation + +## 🐛 Debug Configurations + +Available in the Debug panel (`F5`): + +- **Launch Chrome** - Start app in Chrome with debugger +- **Debug Server** - Debug the Node.js server +- **Full Stack Debug** - Debug both client and server + +## 📚 Copilot Instructions Coverage + +The `copilot-instructions.md` includes guidance for: + +- ✅ TypeScript development standards +- ✅ Multi-touch event handling patterns +- ✅ Socket.io networking conventions +- ✅ D3.js v3 integration +- ✅ Application structure and organization +- ✅ Content management +- ✅ Testing and debugging + +## 🔗 Related Resources + +- [SynergyMesh Repository](https://github.com/synergynet/synergymesh) +- [SynergyMesh Wiki](https://github.com/jamcnaughton/synergymesh/wiki) +- [awesome-copilot](https://github.com/github/awesome-copilot) - Source of base configurations + +## 📄 License + +MIT License - Same as SynergyMesh project From ae247c08faed8ea224dd3d00987fd949c5714052 Mon Sep 17 00:00:00 2001 From: SynergyMesh <210529308+Unmanned-Island-admin@users.noreply.github.com> Date: Sat, 29 Nov 2025 05:17:52 +0000 Subject: [PATCH 08/11] Fix VS Code settings.json - use built-in formatters Replace esbenp.prettier-vscode with VS Code built-in formatters to avoid extension dependency errors in environments without Prettier installed --- .../.vscode/settings.json | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/synergymesh-copilot-config/.vscode/settings.json b/synergymesh-copilot-config/.vscode/settings.json index 52db00ab..0d37ae08 100644 --- a/synergymesh-copilot-config/.vscode/settings.json +++ b/synergymesh-copilot-config/.vscode/settings.json @@ -1,9 +1,9 @@ { "editor.formatOnSave": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, + "editor.tabSize": 4, "typescript.preferences.importModuleSpecifier": "relative", "typescript.suggest.paths": true, "typescript.tsdk": "node_modules/typescript/lib", @@ -25,33 +25,21 @@ }, "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.tabSize": 4 + "editor.defaultFormatter": "vscode.typescript-language-features" }, "[html]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "vscode.html-language-features", "editor.tabSize": 2 }, "[css]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "vscode.css-language-features", "editor.tabSize": 2 }, "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "vscode.json-language-features", "editor.tabSize": 2 - }, - - "github.copilot.enable": { - "*": true, - "plaintext": true, - "markdown": true, - "typescript": true, - "javascript": true, - "html": true, - "css": true, - "json": true } } From 7532d2306cee160476dc038c984cb6bf9d883486 Mon Sep 17 00:00:00 2001 From: SynergyMesh <210529308+Unmanned-Island-admin@users.noreply.github.com> Date: Sat, 29 Nov 2025 14:35:51 +0800 Subject: [PATCH 09/11] Update docs/README.mcp-api.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/README.mcp-api.md | 61 +----------------------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/docs/README.mcp-api.md b/docs/README.mcp-api.md index 121504c6..afd1f172 100644 --- a/docs/README.mcp-api.md +++ b/docs/README.mcp-api.md @@ -1,63 +1,4 @@ -# MCP Server API 文件 - -## 概述 - -Awesome Copilot MCP Server 是一個 Model Context Protocol (MCP) 伺服器,提供工具讓 AI 助手能夠搜尋並安裝來自本儲存庫的 prompts、instructions 和 chat modes。 - -## 安裝與設定 - -### 系統需求 - -- Docker(已安裝並執行中) -- VS Code、VS Code Insiders 或 Visual Studio - -### 快速安裝 - -**選項 1:透過一鍵安裝連結** - -- [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode) -- [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode-insiders) -- [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install-C16FDE?logo=visualstudio&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vs) - -**選項 2:手動設定** - -將以下 JSON 設定新增至你的 MCP 伺服器設定檔: - -```json -{ - "servers": { - "awesome-copilot": { - "type": "stdio", - "command": "docker", - "args": [ - "run", - "-i", - "--rm", - "ghcr.io/microsoft/mcp-dotnet-samples/awesome-copilot:latest" - ] - } - } -} -``` - -### 設定檔位置 - -- **VS Code**: `~/.config/Code/User/globalStorage/github.copilot-chat/mcp.json`(Linux/macOS)或 `%APPDATA%\Code\User\globalStorage\github.copilot-chat\mcp.json`(Windows) -- **VS Code Insiders**: 類似路徑,將 `Code` 替換為 `Code - Insiders` -- **Visual Studio**: 透過 Tools > Options > GitHub Copilot > MCP Servers 設定 - -## 可用工具 - -Awesome Copilot MCP Server 提供以下工具,讓 AI 助手能夠與儲存庫互動: - -### 1. `search_prompts` - -搜尋可用的 prompts。 - -**參數:** -- `query` (string, 選填): 搜尋關鍵字或標籤 -- `tags` (array, 選填): 依標籤篩選 - +# (This file should be removed from the current PR and moved to a separate PR focused on MCP Server documentation.) **回傳:** - Prompt 清單,包含名稱、描述、標籤和檔案路徑 From a9a0688ec47e335033816639084d0c9fcec7570a Mon Sep 17 00:00:00 2001 From: SynergyMesh <210529308+Unmanned-Island-admin@users.noreply.github.com> Date: Sat, 29 Nov 2025 14:36:06 +0800 Subject: [PATCH 10/11] Update .github/workflows/datadog-synthetics.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/datadog-synthetics.yml | 39 +----------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/.github/workflows/datadog-synthetics.yml b/.github/workflows/datadog-synthetics.yml index 984fa409..a1fbb73a 100644 --- a/.github/workflows/datadog-synthetics.yml +++ b/.github/workflows/datadog-synthetics.yml @@ -1,38 +1 @@ -# This workflow will trigger Datadog Synthetic tests within your Datadog organization -# For more information on running Synthetic tests within your GitHub workflows see: https://docs.datadoghq.com/synthetics/cicd_integrations/github_actions/ - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# To get started: - -# 1. Add your Datadog API (DD_API_KEY) and Application Key (DD_APP_KEY) as secrets to your GitHub repository. For more information, see: https://docs.datadoghq.com/account_management/api-app-keys/. -# 2. Start using the action within your workflow - -name: Run Datadog Synthetic tests - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - # Run Synthetic tests within your GitHub workflow. - # For additional configuration options visit the action within the marketplace: https://github.com/marketplace/actions/datadog-synthetics-ci - - name: Run Datadog Synthetic tests - uses: DataDog/synthetics-ci-github-action@87b505388a22005bb8013481e3f73a367b9a53eb # v1.4.0 - with: - api_key: ${{secrets.DD_API_KEY}} - app_key: ${{secrets.DD_APP_KEY}} - test_search_query: 'tag:e2e-tests' #Modify this tag to suit your tagging strategy - - +# (File deleted: Remove .github/workflows/datadog-synthetics.yml from the PR) From 39b4f982c4e71f3081f7d0c1e62bfd5dec195cb9 Mon Sep 17 00:00:00 2001 From: SynergyMesh <210529308+Unmanned-Island-admin@users.noreply.github.com> Date: Sat, 29 Nov 2025 14:36:20 +0800 Subject: [PATCH 11/11] Update instructions/csharp-best-practices.instructions.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../csharp-best-practices.instructions.md | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/instructions/csharp-best-practices.instructions.md b/instructions/csharp-best-practices.instructions.md index e1df81fc..eda6ec91 100644 --- a/instructions/csharp-best-practices.instructions.md +++ b/instructions/csharp-best-practices.instructions.md @@ -1,50 +1,4 @@ ---- -applyTo: '**/*.cs' -description: 'C# best practices and formatting guidelines for AI code generation (all versions).' ---- - -# C# Best Practices for AI Code Generation Instructions - -## Code Style and Formatting - -### Namespace Declarations - -- Use file-scoped namespace declarations when using C# 10+ (`namespace MyNamespace;`) -- For older versions, use traditional block-scoped namespaces with proper indentation -- Keep namespace declarations consistent within the project - -### Access Modifiers - -- Explicitly declare access modifiers for all members -- Use `readonly` for fields that are only assigned in constructors -- Use `const` for compile-time constants -- Follow principle of least privilege for access levels - -### Type Declarations - -- Use `var` for local variables when the type is obvious from the right side -- Use explicit types for method parameters, return types, and field declarations -- Prefer target-typed expressions when the type is clear from context -- Use meaningful and descriptive type names - -### Method and Property Formatting - -- Use expression-bodied members for simple one-line implementations -- Place opening braces on new lines for methods, classes, and namespaces -- Use auto-implemented properties when appropriate -- Implement properties with backing fields only when additional logic is needed - -## Modern C# Patterns - -### Null Safety - -- Use null-conditional operators (`?.`, `??`, `??=`) when available -- Validate parameters with appropriate null checks -- Use `string.IsNullOrEmpty()` and `string.IsNullOrWhiteSpace()` for string validation -- Consider nullable reference types when using C# 8+ - -### String Handling - +# (File removed) - Use string interpolation `$""` instead of `String.Format()` or concatenation - Use `StringBuilder` for extensive string manipulation - Prefer `string.Equals()` with `StringComparison` for culture-aware comparisons