- 專案骨架:Elixir + Mix escript(單檔可執行 bear),HTTP 一律 Req - 設定/憑證檔讀寫:0600、原子寫入(rename)、O_CREAT|O_EXCL 防 symlink - PAT Bearer 呼叫 /userinfo;--json 輸出;規格化退出碼 - 補齊 main 規格承諾的 BEAR_TOKEN 環境變數(優先於憑證檔、不寫入) - login 無效 PAT 退出碼 3(依 docs/commands.md §3.1);token --refresh 用法錯誤 2(§3.3) - 35 個單元測試;mix precommit(compile --warnings-as-errors + format + test)全綠 - 沿用已關閉 PR #3 的實作(feat/pat-mode-mvp 分支),文件改依 main 現行版本更新 apps 管理指令待 #5 規格與 alterminal/bear#28 API 就緒後實作。
50 lines
830 B
Elixir
50 lines
830 B
Elixir
defmodule BearCli.MixProject do
|
|
use Mix.Project
|
|
|
|
def project do
|
|
[
|
|
app: :bear_cli,
|
|
version: "0.1.0",
|
|
elixir: "~> 1.17",
|
|
start_permanent: Mix.env() == :prod,
|
|
deps: deps(),
|
|
escript: escript(),
|
|
aliases: aliases()
|
|
]
|
|
end
|
|
|
|
def application do
|
|
[
|
|
extra_applications: [:logger]
|
|
]
|
|
end
|
|
|
|
def cli do
|
|
[
|
|
preferred_envs: [precommit: :test]
|
|
]
|
|
end
|
|
|
|
# escript 打包:單檔可執行,主模組為 BearCli.CLI。
|
|
defp escript do
|
|
[
|
|
main_module: BearCli.CLI,
|
|
name: "bear"
|
|
]
|
|
end
|
|
|
|
defp deps do
|
|
[
|
|
# HTTP 一律使用 Req(與 bear 主專案一致)。
|
|
{:req, "~> 0.5"},
|
|
{:jason, "~> 1.2"}
|
|
]
|
|
end
|
|
|
|
defp aliases do
|
|
[
|
|
precommit: ["compile --warnings-as-errors", "format", "test"]
|
|
]
|
|
end
|
|
end
|