From 9f78e1530f0a5e2548abfc51d76503de9f54d68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Mon, 24 Aug 2026 21:16:54 -0400 Subject: [PATCH] cn commands: use omarchy-cmd helpers per bin style rule Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp --- bin/omarchy-cn-ai-default | 2 +- bin/omarchy-cn-ai-doctor | 2 +- bin/omarchy-cn-ai-launch | 2 +- bin/omarchy-cn-ai-secret | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/omarchy-cn-ai-default b/bin/omarchy-cn-ai-default index 9553fc83..c2927ab8 100755 --- a/bin/omarchy-cn-ai-default +++ b/bin/omarchy-cn-ai-default @@ -30,7 +30,7 @@ codex) agent="codex" ;; esac command=$(cn_ai_harness_field "$harness" command) -if ! command -v "$command" > /dev/null 2>&1; then +if omarchy-cmd-missing "$command"; then install=$(cn_ai_harness_field "$harness" install) echo "Installing $harness: $install" $install diff --git a/bin/omarchy-cn-ai-doctor b/bin/omarchy-cn-ai-doctor index 29fe27ab..d8533a83 100755 --- a/bin/omarchy-cn-ai-doctor +++ b/bin/omarchy-cn-ai-doctor @@ -25,7 +25,7 @@ provider=$(cn_ai_profile_field "$profile" provider) command=$(cn_ai_harness_field "$harness" command) proto=$(cn_ai_harness_field "$harness" protocol) -if command -v "$command" > /dev/null 2>&1; then +if omarchy-cmd-present "$command"; then echo "PASS ai: harness $harness installed ($command)" else install=$(cn_ai_harness_field "$harness" install) diff --git a/bin/omarchy-cn-ai-launch b/bin/omarchy-cn-ai-launch index 114a688a..4ce827b4 100755 --- a/bin/omarchy-cn-ai-launch +++ b/bin/omarchy-cn-ai-launch @@ -20,7 +20,7 @@ model=$(cn_ai_profile_field "$profile" model) command=$(cn_ai_harness_field "$harness" command) config_method=$(cn_ai_harness_field "$harness" config_method) -if ! command -v "$command" > /dev/null 2>&1; then +if omarchy-cmd-missing "$command"; then install=$(cn_ai_harness_field "$harness" install) if [[ $install == doc:* ]]; then echo "$harness 未安装,安装方法见官方文档: ${install#doc:}" >&2 diff --git a/bin/omarchy-cn-ai-secret b/bin/omarchy-cn-ai-secret index e151eeb7..43bb21ca 100755 --- a/bin/omarchy-cn-ai-secret +++ b/bin/omarchy-cn-ai-secret @@ -17,11 +17,11 @@ FILE_DIR="$HOME/.local/state/omarchycn/secrets" FILE_PATH="$FILE_DIR/$provider" secret_service_ok() { - command -v secret-tool > /dev/null 2>&1 && secret-tool search service omarchycn > /dev/null 2>&1 + omarchy-cmd-present secret-tool && secret-tool search service omarchycn > /dev/null 2>&1 } pass_ok() { - command -v pass > /dev/null 2>&1 && pass ls > /dev/null 2>&1 + omarchy-cmd-present pass && pass ls > /dev/null 2>&1 } case "$action" in @@ -87,7 +87,7 @@ rm) rm -f "$FILE_PATH" removed=1 fi - if command -v secret-tool > /dev/null 2>&1 && ! secret_service_ok; then + if omarchy-cmd-present secret-tool && ! secret_service_ok; then echo "Secret Service 不可达,无法确认其中的副本已清除;服务恢复后重新执行 rm" >&2 exit 1 fi