cn commands: use omarchy-cmd helpers per bin style rule

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
2026-08-24 21:16:54 -04:00
co-authored by Claude Fable 5
parent 0aaa770561
commit 9f78e1530f
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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