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