2025年10月24日 星期五

今天是[程式設計師節]!!

  ___ ___                               ___________   ________    _____ ._.
 /   |   \_____  ______ ______ ___.__. /_   \   _  \  \_____  \  /  |  || |
/    ~    \__  \ \____ \\____ <   |  |  |   /  /_\  \  /  ____/ /   |  || |
\    Y    // __ \|  |_> >  |_> >___  |  |   \  \_/   \/       \/    ^   /\|
 \___|_  /(____  /   __/|   __// ____|  |___|\_____  /\_______ \____   | __
       \/      \/|__|   |__|   \/                  \/         \/    |__| \/

2025年10月23日 星期四

GitHub Copilot CLI工作完成發送桌面通知

目前v0.0349無hook可設定在執行事件前後觸發,
但可以用系統層級的提示詞達到相同目的。

1.安裝PowerShell模組 `Install-Module -Name BurntToast -Scope CurrentUser`
2.在系統層級提示詞%USERPROFILE%\.copilot\copilot-instructions.md新增
- The PowerShell module `BurntToast` has been installed on this machine. You must send me a notification after each work. Execute the PowerShell command `New-BurntToastNotification -Text "{title}", "{content}" -Sound Alarm2`



GitHub Copilot CLI在Windows Terminal按Shift+Enter換行

目前v0.0349仍無法直接設定,但可修改Windows Terminal設定檔以達成相同目的。

{

    "actions":

    [

        //#region 新增這段

        {

            "command":

            {

                "action": "sendInput",

                "input": "\n"

            },

            "id": "linefeed"

        }

        //#endregion

    ],

    "keybindings":

    [

        //#region 新增這段

        {

            "id": "linefeed",

            "keys": "shift+enter"

        }

        //#endregion

    ]

}


參考來源:CLI should support multi-line mode in input box

2025年10月13日 星期一

安裝GitHub Copilot CLI

 1.在[命令提示字元]執行以下指令以安裝Node.js
winget install OpenJS.NodeJS.LTS

2.在[命令提示字元]執行以下指令以安裝Git
winget install --id Git.Git -e --source winget

3.在[命令提示字元]執行GitHub Copilot CLI
npm install -g @github/copilot@latest

4.(選用)在[命令提示字元]執行
setx COPILOT_ALLOW_ALL true
(會直接信任GitHub Copilot CLI,允許任何工具執行並不提出確認要求,有安全性問題,所以需評估便利與安全性的取捨。)

5.(選用)可在%USERPROFILE%\.copilot\copilot-instructions.md預寫入系統層級的提示詞,如
PowerShell執行檔位置、檔案處理需以UTF-8(無BOM)行之等。

6.在[命令提示字元]執行
copilot
(會要求登入)


2025年10月8日 星期三

在git worktree add後使用TortoiseGit查看log的錯誤(Windows)

 










原因

在Repo1使用git worktree add建立的資料夾Repo2,
其擁有者是繼承上位資料夾Workspace,
但上位資料夾擁有者和目前使用者並不是同一個人。

示意如下:
Workspace(擁有者:Administrators)
└Repo1(擁有者:User1)
└Repo2(擁有者:Administrators)


解法

執行以下指令將Repo2擁有者改為目前使用者即可。

takeown /f  Workspace\Repo1\.git\worktrees\Repo2 /r /d y
takeown /f  Workspace\Repo2 /r /d y

2025年9月30日 星期二

2025年9月20日 星期六

OpenAI Codex CLI另一種編寫提示詞的方式

其實在終端機編寫提示詞並不太方便,

大量文字新增修改貼上及移動鼠標位置等操作還是在文字編輯器最方便,

因為Codex有支援自訂提示詞功能,

我們可以在$CODEX_HOME/prompts/

(Windows是%USERPROFILE%/.codex/prompts

Linux/WSL 2是~/.codex/prompts/)

新增自訂提示詞檔案,副檔名必須是.md,如my-prompt.md

甚至可以直接用IDE編輯該提示詞檔案,

編輯時Visual Studio 2202可以使用右鍵選單[Copy Full  Path]複製檔案路徑;

Visual Studio Code則能用[Copy Path]或[Copy Relative Path]複製檔案路徑。

重啟Codex(codex resume session_id)並在Codex CLI輸入/<自訂提示詞檔名>,如/my-prompt

就能將檔案內容作為提示詞送給Codex。


參考來源:Custom Prompts