lyrasoft/cli
Larablocks Analysis
lyrasoft/cli works with any PHP project: the latest release (1.1.1, Apr 4, 2026) doesn't depend on Laravel.
Recommendation checks
PromisingPromising: maintained and up to date, meets 1 of 3 checks; not yet widely used.
- Released in the last 12 months (Apr 4, 2026)
- 10 downloads a month (needs 10,000)
- 0 GitHub stars (needs 100)
State
Maintained- Last stable release: Apr 4, 2026.
- 2 releases in the last 12 months.
- First released: Jun 7, 2018.
- Monthly downloads: 10.
- 6 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.
| Install | |
|---|---|
composer require lyrasoft/cli |
|
| Latest Version: | 1.1.1 |
| PHP: | >=8.2 |
| License: | MIT |
| Last Updated: | Dec 1, 2026 |
| Links: | GitHub · Packagist |
LYRASOFT CLI 工具
這是為了 LYRASOFT 日常工作與建立設定檔所開發的方便工具。
快速安裝
php -r "copy('https://raw.githubusercontent.com/lyrasoft/lyra-cli/master/resources/installer/lyra-cli-installer.php', 'lyra-cli-installer.php');"
php lyra-cli-installer.php
php -r "unlink('lyra-cli-installer.php');"
一般安裝方式
快速安裝無法正確執行時,請依照以下步驟進行:
composer global require lyrasoft/cli
安裝完成後,可在任何地方直接輸入:
lyra <command>
來執行相關指令。
Mac / Linux 無法執行時
Mac 必須先將 ~/.composer/vendor/bin 加入到 PATH 環境變數
請參考 https://stackoverflow.com/a/25373254
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile
source ~/.bash_profile
Linux 的路徑比較不一樣
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc
source ~/.bashrc
自動完成
只要輸入一次
lyra autocomplete
註冊好自動完成的指令後,之後就可以用 Tab 自動完成指令了
只支援 zsh
常用功能說明
安裝 Agents Instructions 與 Skills
在專案目錄執行以下指令,會從 lyrasoft/skills 安裝繁體中文 instructions 與 skills 到 .agents,並建立 GitHub Copilot instructions 連結:
lyra agents:install
如果專案根目錄沒有 AGENTS.md,也會建立此檔案,預設內容只有 @.agents/main.instructions.md。
使用 --target 時,連結會指向指定的安裝目錄;既有的 AGENTS.md 不會修改。
使用 --no-link 可略過兩種指引連結的寫入。
可指定 repo、分支、語言、安裝路徑或只安裝 skills:
lyra agents:install owner/repo --ref staging --lang zh-TW --target .agents
lyra agents:install --skills
lyra agents:install --path instructions
lyra agents:install --force
遇到 GitHub API rate limit 時,互動模式可輸入 token 重試,並選擇是否快取。
指令會優先透過已登入的 GitHub CLI (gh) 讀取檔案,無法使用時再以 HTTP 下載。
快取會以明文儲存在 lyra-cli 的 tmp/agents-github-token,未加密;Windows 上的存取權限取決於該目錄的 ACL。
可刪除該檔案清除快取,重新安裝或更新 CLI 時也可能被移除。HTTP 下載時,--token 與 GITHUB_TOKEN 的優先順序高於快取。
初始化 Windwalker 團隊開發環境
在 Windwalker 專案根目錄執行:
lyra dev:init
指令會依 composer.lock 中的 windwalker/core 或 windwalker/framework 版本選擇設定流程。Windwalker 4.2 以上可安裝 PhpStorm PHP CS Fixer、註冊 pre-commit hook、安裝 agents 設定及 Windwalker 文件 MCP;4.1 以下略過前兩項。互動提示均使用方向鍵選單,預設選擇「否」。
各安裝步驟可用 --cs-fixer=ask|yes|no、--git-hook=ask|yes|no、--agents=ask|yes|no、--mcp=ask|yes|no、--auto-complete=ask|yes|no 指定(auto-complete 會依 $SHELL 偵測 zsh / bash,呼叫專案的 windwalker auto-complete,不支援的 shell 會略過);--lang=ask|zh-TW|en 選擇 agents 語言。非互動模式下,ask 預設略過安裝,語言預設 zh-TW。MCP 委派給 Windwalker 時仍使用 Copilot 目標(.github/mcp.json);由 Lyra 自行安裝時則合併至專案根目錄的 .mcp.json(mcpServers.windwalker-docs)。已有衝突項目時需明確加上 --force 才會覆寫。所有啟動的子指令都使用 --no-interaction。
更新 PhpStorm 設定檔
我們的常用設定檔有三組,分別是 CodeStyle, FileTemplate 與 LiveTemplate
可以用:
lyra pstorm:pull-config -a -g
來更新 PhpStorm 的全域設定檔。也可以用:
lyra pstorm:pull-config -a
單純只更新到現在的專案
如果你要把自己設定好的設定檔更新到我們得 repository 給其他人分享,可以用:
lyra pstorm:push-config -a
注意這個動作不要隨便進行
Get PR
現在可以透過 lyra cli 快速取用 PR 來測試,取代以前的 get-pr 指令
lyra pr {number}
預設會拉下來成 pr-xxx 的 branch,也可以指定特定的 branch:
lyra pr {number} branch_name
拉下後直接切換
lyra pr {number} -c
預設是從 lyra 的 remote 取用 PR,請按照命名原則設定你的 git remote,也可以自定 remote
lyra pr {number} -r=upstream
PHP CS Fixer
先用 PhpStorm 開啟專案以建立 .idea,再從專案根目錄執行:
lyra pstorm:cs-fixer
指令會設定 PhpStorm 的 PHP CS Fixer Quality Tool 與外部格式化工具,並在專案的 inspection profile 啟用 PHP CS Fixer、停用原有的 PHP Code Sniffer 檢查。若專案未安裝 PHP CS Fixer,會透過 Composer 安裝;套件尚未宣告時,會加入 require-dev。
已有的 .php-cs-fixer.php 或 .php-cs-fixer.dist.php 會原樣沿用。若兩者都沒有,會建立 .php-cs-fixer.dist.php,使用專案已安裝的 Windwalker 規則,否則使用 PER-CS。
舊指令 lyra pstorm:sniffer 僅顯示停用提示並正常結束,不會安裝套件或修改專案設定。為了相容舊專案的自動化腳本,仍接受 -p/--path 和 --ww3,但不會套用這些選項。
註冊 GitHub SSH Key
lyra-cli 提供了方便的指令直接幫你註冊 GitHub SSH Key.
執行
lyra github:add-ssh
第一次會需要產生 SSH Key
Your identification has been saved in C:\Users\Xxx/.ssh/id_rsa.
Your public key has been saved in C:\Users\Xxx/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:cT7l5fe4kzlKsxQle1jC6/0p4je**********
The key's randomart image is:
+---[RSA 4096]----+
| |
| . |
| . . = + |
| + o @ o |
| S o * B .|
| o *.=.|
| o E.=+.|
| . @.O==+|
| .+oB.*=+|
+----[SHA256]-----+
SSH Key 產生之後,會問你 GitHub 的登入帳密,輸入後便可自動註冊完成。
完整指令說明
請直接用 -h 觀看說明
開發方式
若要增加或修改功能,可以用 composer global require lyrasoft/cli --prefer-source ,這樣就會下載 github 上的版本,就可以直接
編輯,然後用 git commit 修改內容。 記得可以先 fork 一份,然後加上你自己的 remote。
編輯位置在 Composer 的 global 目錄:
- Windows:
C:\Users\<user_name>\AppData\Roaming\Composer - Mac:
~/.composer
lyra-cli 的目錄在 {COMPOSER_HOME}/vendor/lyrasoft/cli 內。
執行測試
在 repository 根目錄使用 PHP 8.2 以上與 Composer,安裝開發依賴後即可執行:
composer install
composer test
composer test 會依 phpunit.dist.xml 執行 tests/ 下的 PHPUnit 測試。
可用 composer test -- --filter CliSmokeTest 篩選測試類別或方法。測試使用暫存目錄及 HTTP/process 替身,
不需要 GitHub 帳號、token、gh 或 PhpStorm。GitHub Actions 會在 Linux 與 Windows 執行同一套測試。
Command 的編寫方式
最上層 Command 請寫好 class 之後,註冊在 /lyra 檔案內。
See: https://github.com/lyrasoft/lyra-cli/blob/6c76cacd4a62393337e6c37f49f80dd263bd920d/lyra#L34
之後的寫法請參考: Windwalker Console
需要從選單選一項時,可用 $io->askSelect('Select a mode', ['local' => 'Local', 'team' => 'Team'], 'local')。
它會回傳選項的原始鍵。在支援的互動終端可用方向鍵選擇;Windows 或不支援方向鍵選單的輸入/輸出環境
會顯示編號選單。--no-interaction 不會提問,會直接回傳預設鍵;未提供預設值時回傳 null。
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 1.1.1 | >=8.2 | MIT | |
| 1.1.0 | >=8.2 | MIT | |
| 1.0.10 | >=8.0 | MIT | |
| 1.0.9 | >=8.0 | MIT | |
| 1.0.8 | >=8.0 | MIT | |
| 1.0.7 | >=8.0 | MIT | |
| 1.0.6 | >=8.0 | MIT | |
| 1.0.5 | >=8.0 | MIT | |
| 1.0.4 | >=8.0 | MIT | |
| 1.0.3 | >=8.0 | MIT | |
| 1.0.2 | >=8.0 | MIT | |
| 1.0.1 | >=8.0 | MIT | |
| 1.0.0 | >=8.0 | MIT | |
| 0.2.4 | >=7.1.3 | MIT | |
| 0.2.3 | >=7.1.3 | MIT | |
| 0.2.2 | >=7.1.3 | MIT | |
| 0.2.1 | >=7.1.3 | MIT | |
| 0.2 | >=7.1.3 | MIT | |
| 0.1.18 | >=7.1.3 | MIT | |
| 0.1.17 | >=7.1.3 | MIT | |
| 0.1.16 | >=7.1.3 | MIT | |
| 0.1.15 | >=7.1.3 | MIT | |
| 0.1.14 | >=7.1.3 | MIT | |
| 0.1.13 | >=7.1.3 | MIT | |
| 0.1.12 | >=7.1.3 | MIT | |
| 0.1.11 | >=7.1.3 | MIT | |
| 0.1.10 | >=7.1.3 | MIT | |
| 0.1.9 | >=7.0 | MIT | |
| 0.1.8 | >=7.0 | MIT | |
| 0.1.7 | >=7.0 | MIT |
Showing the latest 30 of 37. See every release on Packagist