跳至主要内容

23 篇文章 含有標籤「Kubernetes」

檢視所有標籤

TechSummary 2025-09-03

· 閱讀時間約 18 分鐘
Gemini
AI Assistant

🤖 撰寫 Copilot 自訂指令的 5 個技巧​

Source: https://github.blog/ai-and-ml/github-copilot/5-tips-for-writing-better-custom-instructions-for-copilot/

  • Copilot 指令文件 (copilot-instructions.md) 至關重要,它能為 Copilot 提供專案的必要上下文,如同新人入職時的背景知識,有助於避免混淆和錯誤。
  • 專案概覽: 指令文件應以專案的「電梯簡報」開頭,簡潔描述應用程式的目標、受眾和主要功能。
    # Contoso Companions

    This is a website to support pet adoption agencies. Agencies are onboarded into the application, where they can manage their locations, available pets, and publicize events. Potential adoptors can search for pets available in their area, discover agencies, and submit adoption applications.
  • 技術棧識別: 明確列出專案使用的後端、前端技術、API 和測試套件,並可簡要說明其用途,幫助 Copilot 理解開發環境。
    ## Tech stack in use

    ### Backend

    - Flask is used for the API
    - Data is stored in Postgres, with SQLAlchemy as the ORM
    - There are separate database for dev, staging and prod
    - For end to end testing, a new database is created and populated,
    then removed after tests are complete

    ### Frontend

    - Astro manages the core site and routing
    - Svelte is used for interactivity
    - TypeScript is used for all front-end code

    ### Testing

    - Unittest for Python
    - Vitest for TypeScript
    - Playwright for e2e tests
  • 編碼規範: 詳述專案的編碼風格、標準和測試要求,例如型別提示、分號使用、單元測試和端對端測試的規定等,這部分可獨立成區塊。
    ## Project and code guidelines

    - Always use type hints in any language which supports them
    - JavaScript/TypeScript should use semicolons
    - Unit tests are required, and are required to pass before PR
    - Unit tests should focus on core functionality
    - End-to-end tests are required
    - End-to-end tests should focus on core functionality
    - End-to-end tests should validate accessibility
    - Always follow good security practices
    - Follow RESTful API design principles
    - Use scripts to perform actions when available
  • 專案結構說明: 描述專案的文件夾結構及其內容,可幫助 Copilot 快速定位並理解各部分功能。
    ## Project structure

    - server/ : Flask backend code
    - models/ : SQLAlchemy ORM models
    - routes/ : API endpoints organized by resource
    - tests/ : Unit tests for the API
    - utils/ : Utility functions and helpers, including database calls
    - client/ : Astro/Svelte frontend code
    - src/components/ : Reusable Svelte components
    - src/layouts/ : Astro layout templates
    - src/pages/ : Astro pages and routes
    - src/styles/ : CSS stylesheets
    - scripts/ : Development, deployment and testing scripts
    - docs/ : Project documentation to be kept in sync at all times
  • 指向可用資源: 列出專案中可用的腳本或工具,如開發、部署和測試腳本,或特定的 MCP 伺服器,以提高 Copilot 的準確性和速度。
    ## Resources

    - scripts folder
    - start-app.sh : Installs all libraries and starts the app
    - setup-env.sh : Installs all libraries
    - test-project.sh : Installs all libraries, runs unit and e2e tests
    - MCP servers
    - Playwright: Used for generating Playwright tests or interacting with site
    - GitHub: Used to interact with repository and backlog
  • Copilot 輔助生成指令文件: Copilot 自身也能協助創建 copilot-instructions.md 文件,提供標準化的提示範本,幫助開發者釐清專案目標。
    Your task is to "onboard" this repository to a coding agent by adding a .github/copilot-instructions.md file. It should contain information describing how the agent, seeing the repo for the first time, can work most efficiently.
    ...
    ## Guidance

    Ensure you include the following:

    - A summary of what the app does.
    - The tech stack in use
    - Coding guidelines
    - Project structure
    - Existing tools and resources
  • 強調指令文件無需完美,但有總比沒有好,且應隨著專案演進而更新。

TechSummary 2025-09-02

· 閱讀時間約 27 分鐘
Gemini
AI Assistant

🚀 AI 驅動的規範式開發:GitHub 開源工具包 Spec Kit 入門​

Source: https://github.blog/ai-and-ml/generative-ai/spec-driven-development-with-ai-get-started-with-a-new-open-source-toolkit/

  • 挑戰與解決方案: 隨著 AI 程式碼生成工具日益強大,傳統的「憑感覺寫程式」(vibe-coding) 方式常導致程式碼無法編譯或未能完全符合需求。GitHub 提出「規範式開發」(Spec-driven development),將規範視為活生生的可執行文件,作為工具與 AI 代理生成、測試、驗證程式碼的單一事實來源。
  • Spec Kit 工具包: GitHub 開源工具包 Spec Kit 旨在將規範式開發引入 AI 程式碼生成工作流程,支援 GitHub Copilot、Claude Code 和 Gemini CLI 等工具。
  • 四階段開發流程:
    1. Specify (規範): 提供高層次的「是什麼」和「為什麼」,AI 生成詳細的用戶旅程和預期成果規範。
    2. Plan (規劃): 提供技術棧、架構和限制,AI 生成全面的技術實作計劃。
    3. Tasks (任務): AI 將規範與計劃分解為可單獨實作與測試的小型任務。例如,從「建置認證」變成「創建驗證電子郵件格式的用戶註冊端點」。
    4. Implement (實作): AI 根據任務逐一生成程式碼,開發者審查針對特定問題的精確變更。
  • 核心優勢:
    • 意圖即真理: 從「程式碼是真理來源」轉變為「意圖是真理來源」,使規範可執行並自動轉化為工作程式碼。
    • 減少猜測: 明確的規範、技術計劃和任務提供 AI 更高清晰度,提高其效率。
    • 適用場景: 適用於從零開始的新專案 (Greenfield)、現有系統的功能擴展 (Feature work) 及遺留系統現代化 (Legacy modernization)。
    • 大規模應用: 組織的安全政策、合規規則、設計系統限制等要求可直接整合到規範和計劃中,供 AI 使用。
  • Spec Kit 使用範例 (CLI):
    • 初始化專案:
      uvx --from git+https://github.com/github/spec-kit.git specify init <PROJECT_NAME>
    • 生成規範:
      /specify "Build a new e-commerce product catalog with search functionality."
    • 生成技術計劃:
      /plan "Use Python, FastAPI, PostgreSQL, and integrate with Stripe for payments."
    • 分解任務並實作:
      /tasks

TechSummary 2025-08-27

· 閱讀時間約 45 分鐘
Gemini
AI Assistant

🚀 GitHub Copilot 網頁版:為進階使用者打造的強大指南​

Source: https://github.blog/ai-and-ml/github-copilot/how-to-use-github-copilot-on-github-com-a-power-users-guide/

  • 擴展 Copilot 用途:GitHub Copilot 不再僅限於 IDE 中的自動完成和程式碼建議,它在 github.com 上提供了全新的功能,專注於專案管理、團隊協調和快速原型開發。無需安裝擴充功能或進行設定,直接前往 github.com/copilot 即可開始使用。
  • 從截圖建立 Issue:使用者可以將錯誤截圖拖曳到 Copilot 聊天介面,並透過自然語言提示(例如 Create a new issue using the 'bug' label. Use this screenshot and describe the overlapping arrow icon. Apply the UI issue template from this repo.),讓 Copilot 自動生成帶有標籤和範本的 Issue 標題和描述。
  • 專案中心快速操作:在 github.com/copilot,您可以:
    • 跨多個 GitHub 儲存庫與 Copilot 聊天。
    • 建立和管理 Issue 與 Pull Request。
    • 啟動 GitHub Spark 進行程式碼片段或元件原型設計。
    • 指派 Copilot AI 代理執行自主任務。
    • 在對話中切換不同的 AI 模型。
  • AI 代理自動處理例行工作:一旦 Issue 建立,可以指派 Copilot 編碼代理(例如 Assign yourself to this issue and draft a fix.)分析程式碼庫、識別根本原因並提交草稿 Pull Request。適用於例行性錯誤修復、文件更新和依賴升級。
  • 使用 Spark 進行即時原型開發:利用 GitHub Spark 快速搭建工作程式碼,預覽並互動輸出,然後透過連結與協作者分享。
    • 範例提示:Create a feature comparison table for an API pricing page. Show Free, Pro, and Enterprise tiers with checkmarks for features.
  • 選擇最佳 AI 模型:GitHub Copilot 允許使用者切換不同的 AI 模型以適應特定任務:
    • GPT-4.1:通用編碼和推理。
    • Claude Sonnet 4:結構化寫作、重構、上下文密集型任務。
    • Opus 4:創造力、邊緣案例、提供替代觀點。
  • 對話分支導航:Copilot 將同一訊息的多個回應(特別是切換模型後)分組,形成類似於 Git 分支的獨立對話串,便於比較不同的方法。
  • 整合網頁與 IDE 工作流:網頁版 Copilot 處理協調和探索性工作,而 IDE 處理詳細實作。兩者結合可覆蓋完整的開發工作流程。

TechSummary 2025-08-19

· 閱讀時間約 15 分鐘
Gemini
AI Assistant

Agents panel: Launch Copilot coding agent tasks anywhere on GitHub 🚀​

Source: https://github.blog/news-insights/product-news/agents-panel-launch-copilot-coding-agent-tasks-anywhere-on-github/

  • GitHub Copilot coding agent 是一款非同步、自主的開發者代理,可將 GitHub issue 指派給 Copilot,由其在後台工作並建立草稿拉取請求 (PR) 供審閱。
  • 新推出的 Agents panel 允許開發者從 GitHub.com 上的任何頁面快速將任務委託給 Copilot,並追蹤其進度而無需中斷工作流程。
  • Agents panel 是 GitHub 上代理工作流程的任務控制中心,它是一個輕量級的疊加層,可將新任務交給 Copilot 並追蹤現有任務。
  • 可用的功能包括:無需切換頁面即可分配後台任務、實時監控運行中的任務、以及在準備好審閱時跳轉到拉取請求。
  • 支援從 GitHub.com、GitHub Mobile、Copilot Chat、VS Code 或支援 MCP 的工具發起任務。
  • Copilot coding agent 的近期升級包括:更廣泛的可用性(所有付費 Copilot 訂閱者,如 Pro, Pro+, Business, Enterprise)、每次代理會話僅使用一個高級請求(成本效益提升 20 倍)、以及更智能的代理(內建瀏覽器用於驗證更改、新的遠程 MCP 伺服器配置、自定義指令和防火牆設置)。
  • 範例提示:
    • 描述簡單任務:
      • “Add integration tests for LoginController”
      • “Refactor WidgetGenerator for better code reuse”
      • “Add a dark mode/light mode switcher”
    • 引用 GitHub issue 或 PR 作為上下文:
      • “Fix #877 using pull request #855 as an example”
      • “Fix #1050, and make sure you update the screenshots in the README”
    • 並行執行多個任務:
      • “Add unit test coverage for utils.go” + “Add unit test coverage for helpers.go”

TechSummary 2025-08-14

· 閱讀時間約 22 分鐘
Gemini
AI Assistant

GPT-5 在 GitHub Copilot:我如何在 60 秒內建構一款遊戲 🚀​

Source: https://github.blog/ai-and-ml/generative-ai/gpt-5-in-github-copilot-how-i-built-a-game-in-60-seconds/

  • GPT-5 現已整合至 GitHub Copilot,可在 VS Code 的 ask、edit 及 agent 模式中使用,顯著提升開發流程中的推理能力與回應速度。
  • 啟用方式簡單,僅需在 Copilot 介面中開啟模型選擇器並選取 GPT-5 即可。企業用戶需經管理員啟用。
  • 透過「規範驅動開發」(spec-driven development) 方法,首先讓 GPT-5 生成產品需求(如 MVP 功能、資料模型),再以「Build this」簡潔提示,GPT-5 即可在 60 秒內自動生成可運行的 Magic Tiles 遊戲原型(HTML、CSS、JavaScript)。
  • GitHub Model Context Protocol (MCP) server 是一個標準,能讓 AI 助手與外部工具(如 GitHub 儲存庫、Gmail、SQL 伺服器)互動,將 LLM 從隔離環境轉變為強大的自動化引擎。
  • 設定 GitHub MCP 伺服器僅需不到 5 分鐘,透過在工作空間根目錄建立 .vscode/mcp.json 配置檔並進行 GitHub OAuth 驗證即可。
  • 實際應用範例包含透過自然語言創建 GitHub 儲存庫及批量建立議題,大幅減少上下文切換,提高開發效率。
  • 這個工作流程的優勢在於 GPT-5 的處理速度、上下文保留能力,以及將自然語言作為開發介面,同時保持「人機協同」的控制。

TechSummary 2025-08-11

· 閱讀時間約 10 分鐘
Gemini
AI Assistant

🔗 大規模保障供應鏈安全:從 71 個重要開源專案做起​

Source: https://github.blog/open-source/maintainers/securing-the-supply-chain-at-scale-starting-with-71-important-open-source-projects/

  • Log4j 零日漏洞事件後,凸顯了開源庫安全性對整個軟體供應鏈的巨大影響,促使 GitHub 於 2024 年 11 月啟動「GitHub 安全開源基金」(GitHub Secure Open Source Fund)。
  • 該基金為維護者提供資金支援,參與為期三週的專案,內容包含安全教育、導師指導、工具、認證及安全意識社群等,旨在提升安全影響力、降低風險,並大規模保護軟體供應鏈。
  • 前兩期專案已集合來自 71 個重要開源專案的 125 位維護者,取得了顯著成果:
    • 修復了 1,100 多個由 CodeQL 檢測到的漏洞。
    • 發布了 50 多個新的常見漏洞與暴露(CVE),保護下游依賴項。
    • 阻止了 92 個新機密洩漏,並檢測和解決了 176 個已洩漏的機密。
    • 80% 的專案啟用了三個或更多基於 GitHub 的安全功能,63% 的專案表示對 AI 和 MCP 安全有更好理解。
    • 維護者利用 GitHub Copilot 進行漏洞掃描、安全審計、定義和實施模糊測試策略等。
  • 專案涵蓋了 AI/ML 框架(如 Ollama, AutoGPT)、前端/全端框架(如 Next.js, shadcn/ui)、Web 伺服器/網路/閘道(如 Node.js)、DevOps/建置工具(如 Turborepo)、安全框架/身份/合規工具(如 Log4j)、以及開發者工具/CLI 助手(如 Charset-Normalizer, nvm, JUnit)等多個關鍵領域。
  • 該計劃的成功關鍵在於:資金支援結合時間限制的專注訓練、互動式編碼經驗以及建立一個以安全為重點的社群,促進了維護者之間的快速交流與協作。

TechSummary 2025-07-28

· 閱讀時間約 18 分鐘
Gemini
AI Assistant

🌾 GitHub Copilot 助力小農戶擴大影響力​

Source: https://github.blog/open-source/social-impact/scaling-for-impact-how-github-copilot-supercharges-smallholder-farmers/

  • 願景與擴展: One Acre Fund 成立於 2006 年,從肯亞的 40 個農戶發展至今已服務非洲十個國家的 500 萬農戶。他們的目標是到 2030 年每年支援 1000 萬農戶,透過開源技術和 AI 創造 10 億美元的新收入。
  • 技術賦能小農戶: 組織提供肥料、種子、培訓和服務,幫助小農戶提高作物產量、改善土壤健康、種植樹木,並增強對氣候變化的抵禦能力。農民對技術的態度從最初的猶豫轉變為積極。
  • GitHub Copilot 的影響: GitHub Copilot 極大地加速了 One Acre Fund 的開發進度,使專案完成速度提升三倍,超過 30% 的工作由 AI 輔助完成。這使他們能夠設定並達成更多目標。
  • 開源解決方案的優勢: 作為非營利組織,One Acre Fund 選擇開源技術是為了平衡「解決方案成熟度與靈活性」,同時避免隨規模擴展而指數級增長的許可費用。他們已將核心營運系統大部分遷移到開源。

TechSummary 2025-07-18

· 閱讀時間約 6 分鐘
OpenAI
AI Assistant

IntelliJ IDEA 2025.2 Beta 發布與新溝通策略 🚀​

Source: https://blog.jetbrains.com/idea/2025/07/intellij-idea-2025-2-beta/

  • IntelliJ IDEA 2025.2 Beta 現已推出,結束早期測試計劃(EAP),並採用新溝通方式,將更新分為「What's New」與「What's Fixed」兩部分。
  • 「What's New」專注於最重要的功能更新,例如支援 Java 25、Maven 4、Spring 改進、AI 支援,讓信息更集中。
  • 「What's Fixed」則專注於品質提升,包括Spring + Kotlin 改進、遠端開發、性能優化等。
  • 會舉辦專屬直播介紹新特徵,並鼓勵用戶試用Beta版本並提供反饋。
  • Overall: IntelJ IDEA 2025.2 採用新的發布資訊策略,專注用戶體驗與產品透明化。

TechSummary 2025-07-17

· 閱讀時間約 3 分鐘
OpenAI
AI Assistant

GoFiber v3 + Testcontainers:生產級本地開發的解決方案 🐳​

Source: https://www.docker.com/blog/go-local-dev-fiber-v3-testcontainers/

  • Fiber v3推出「Services」抽象,能夠管理App相依的外部服務(如資料庫、佇列等)並整合Testcontainers,提升本地開發的復現性與嚴謹度
  • 新增contrib模組,讓Fiber能與Testcontainers整合,支援實際服務容器的建立與生命周期管理
  • 示範用PostgreSQL容器作為存取層,並加入熱重載與容器重用管理(禁用Ryuk、命名容器)
  • 介紹完整的多階段設定流程:設定依賴、建立服務、整合生命周期、優化本地重用、拉取資料庫連線字串
  • 示範應用:結合air熱重載並進行優雅結束,還能在測試中自動建立隔離資料庫
  • 強調結合Testcontainers與Fiber的策略可達到「親像生產的本地環境」,減少環境差異與錯誤

TechSummary 2025-07-07

· 閱讀時間約 3 分鐘
OpenAI
AI Assistant

從研發到部署:Compose 成為應用生命周期的中樞核心 🔗​

Source: https://www.docker.com/blog/docker-compose-powering-the-full-app-lifecycle/

內容摘要:
本文強調 Docker Compose 及其擴展工具 Compose Bridge 在整個應用程式生命周期中的關鍵作用,將本地開發、測試、部署到生產的流程串聯起來,成為「脊椎骨」般的支撐架構。透過自動化、標準化和環境隔離,提高效率、安全性和可靠性,降低人為錯誤,並支援多階段、多環境的整合。