- lib/bear_cli/self_service.ex:六個子群組(profile show/set、password change、 email change、sessions list/revoke/revoke-others、tokens list/create/revoke、 mfa status/setup/disable/recovery-codes),對接 alterminal/bear#38 的 /api/v1/profile* JSON API(PAT Bearer、任何有效帳號) - 敏感輸入(密碼/驗證碼)互動提示讀取,非 TTY → 退出碼 2; 一次性明文(PAT 明文、recovery codes)僅於成功當下輸出 - mfa setup:otpauth URI 本地生成 ASCII QR(新增 eqrcode 依賴), 確認走 /mfa/setup/confirm(依 #38 實作) - Api 模組新增 profile 系列端點與 429 分流;CLI 分派接上六個指令群組 - docs/commands.md §3.7 對齊 #38 實際 API(sessions 欄位、tokens create 無 --scope、mfa setup/confirm、email 需重帶 new_email);§7/§8/§9 與 README 同步更新 - 測試 50 例(fake API 注入):解析、輸出、退出碼、互動輸入、錯誤分流; mix precommit 全綠(114 passed)
52 lines
924 B
Elixir
52 lines
924 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"},
|
|
# MFA setup 的 otpauth URI 本地 ASCII QR(§3.7.7)。
|
|
{:eqrcode, "~> 0.2"}
|
|
]
|
|
end
|
|
|
|
defp aliases do
|
|
[
|
|
precommit: ["compile --warnings-as-errors", "format", "test"]
|
|
]
|
|
end
|
|
end
|