Some checks are pending
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / preflight (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / vps-smoke (push) Waiting to run
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:frustration-matrix,kei-frustration-loop,kei-skill-importer,kei-projects-index,kei-projects-watcher,kei-gdrive-import,kei-leak-matrix,kei-skills,kei-gateway,kei-cron-scheduler,kei-export-trajectories,kei-backend-daytona,kei-d… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-compute-baremetal,kei-compute-vultr,kei-compute-linode,kei-compute-digitalocean,kei-svc-systemd,kei-llm-bridge-mlx name:hosted-sleep-compute]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-diff,kei-scheduler,kei-watch,kei-prune,kei-discover,kei-brain-view,kei-hibernate,kei-ledger-sign,kei-fork name:wave13-15]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-git-gitea,kei-git-forgejo,kei-git-gitlab,kei-git-bitbucket,kei-memory-sled,kei-memory-redis,kei-memory-postgres,kei-memory-sqlite,kei-auth-google,kei-auth-apple,kei-auth-magiclink,kei-auth-webauthn,kei-notify-slack,kei-n… (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-ledger,kei-migrate,kei-changelog,kei-memory,kei-store,kei-conflict-scan,kei-refactor-engine,kei-graph-check,kei-shared,kei-dna-index,kei-pet name:core]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-machine-probe,kei-llm-ollama,kei-llm-llamacpp,kei-llm-mlx,kei-llm-router,kei-model name:llm-stack]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:kei-router,kei-sage,kei-task,kei-chat-store,kei-crossdomain,kei-search-core,kei-content-store,kei-social-store,kei-curator,kei-auth,kei-artifact name:mcp-lbm]) (push) Blocked by required conditions
CI (Forgejo Actions — self-hosted runner on Mac, host mode) / rust-primitives (map[crates:keisei,kei-forge,kei-runtime,kei-runtime-core,kei-atom-discovery,kei-agent-runtime,kei-capability,kei-provision,kei-entity-store,kei-pipe,kei-cache,kei-spawn,kei-replay name:atom-substrate]) (push) Blocked by required conditions
Three issues a real curl|bash user hit: 1. CRASH: typing a word (e.g. "claude") at any menu → $((ans-1)) treats it as a variable in bash arithmetic → "unbound variable" under set -u → install dies. Added _onb_read_choice (numeric+range validation, re-prompt) for all 4 menus. 2. No Claude under subscription: the kit installs into Claude Code yet the wizard offered only OpenAI Codex under subscription. Added claude-code provider (bumped kei-registries submodule c559065→b904993) + made subscription the default transport and claude-code the default provider — Enter,Enter,Enter lands on Claude Code (no API key). 3. install died at line 178 for any no-key provider (claude-code/codex/local): onboarding_run ended on a `&&` that is false when there are no auth keys → returned 1 → set -e aborted. Added explicit `return 0`. Plus per-step explanations (en+ru) and auto-select when a step has one option. Verified piped-under-pty: Enter-defaults → Claude Code, junk input → re-prompt (0 crashes), full install completes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
87 lines
4.8 KiB
Bash
87 lines
4.8 KiB
Bash
# shellcheck shell=bash
|
||
# lib-onboarding-registry.sh — парсеры реестров providers.toml + models.toml.
|
||
#
|
||
# Constructor Pattern: 1 файл = парсинг реестров. UI и state — в соседних кубах.
|
||
#
|
||
# Источник: $KIT_DIR/_blocks/registries/{providers,models}.toml (submodule
|
||
# kei-registries). Если файла нет — fallback на захардкоженный набор
|
||
# покрывающий все 7 транспортов.
|
||
#
|
||
# Глобалы (общие с lib-onboarding-*):
|
||
# REGISTRY_PROVIDERS — путь к providers.toml
|
||
# REGISTRY_MODELS — путь к models.toml
|
||
|
||
REGISTRY_PROVIDERS="${REGISTRY_PROVIDERS:-$KIT_DIR/_blocks/registries/providers.toml}"
|
||
REGISTRY_MODELS="${REGISTRY_MODELS:-$KIT_DIR/_blocks/registries/models.toml}"
|
||
|
||
# Парсер providers.toml. Простой awk-граббер по [[provider]] секциям.
|
||
# Печатает: <id>\t<transport>\t<display_name>\t<auth_env>
|
||
onboarding_list_providers() {
|
||
[ -f "$REGISTRY_PROVIDERS" ] || { onboarding_fallback_providers; return; }
|
||
awk '
|
||
/^\[\[provider\]\]/ { id=""; tr=""; dn=""; ae=""; next }
|
||
/^id[[:space:]]*=/ { gsub(/^id[[:space:]]*=[[:space:]]*"/, ""); gsub(/".*$/, ""); id=$0 }
|
||
/^transport[[:space:]]*=/ { gsub(/^transport[[:space:]]*=[[:space:]]*"/, ""); gsub(/".*$/, ""); tr=$0 }
|
||
/^display_name[[:space:]]*=/ { gsub(/^display_name[[:space:]]*=[[:space:]]*"/, ""); gsub(/".*$/, ""); dn=$0 }
|
||
/^auth_env[[:space:]]*=/ { gsub(/^auth_env[[:space:]]*=[[:space:]]*"/, ""); gsub(/".*$/, ""); ae=$0;
|
||
if (id && tr) print id "\t" tr "\t" dn "\t" ae }
|
||
' "$REGISTRY_PROVIDERS"
|
||
}
|
||
|
||
# Fallback если submodule не подтянут.
|
||
# Покрывает 7 транспортов минимальными представителями. Синхронизировать
|
||
# вручную если в реестре появится новый транспорт-тип.
|
||
onboarding_fallback_providers() {
|
||
printf "anthropic\tdirect-api\tAnthropic (Direct API)\tANTHROPIC_API_KEY\n"
|
||
printf "anthropic-bedrock\taws-bedrock\tAnthropic (AWS Bedrock)\tAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION\n"
|
||
printf "openai\tdirect-api\tOpenAI (Direct API)\tOPENAI_API_KEY\n"
|
||
printf "openai-azure\tazure-openai\tOpenAI (Azure)\tAZURE_OPENAI_API_KEY,AZURE_OPENAI_ENDPOINT,AZURE_OPENAI_DEPLOYMENT\n"
|
||
printf "xai\tdirect-api\txAI\tXAI_API_KEY\n"
|
||
printf "deepseek\tdirect-api\tDeepSeek\tDEEPSEEK_API_KEY\n"
|
||
printf "google\tdirect-api\tGoogle Gemini (Direct API)\tGEMINI_API_KEY\n"
|
||
printf "google-vertex\tgoogle-vertex\tGoogle Gemini (Vertex AI)\tGOOGLE_APPLICATION_CREDENTIALS,GCP_PROJECT_ID,GCP_REGION\n"
|
||
printf "ollama-local\tlocal\tOllama (local)\t_\n"
|
||
printf "mlx-local\tlocal\tMLX (Apple silicon local)\t_\n"
|
||
printf "lmstudio-local\tlocal\tLM Studio (local)\t_\n"
|
||
printf "litellm-proxy\tproxy\tLiteLLM proxy (keisei.app)\tKEI_LITELLM_KEY\n"
|
||
printf "openrouter\tproxy\tOpenRouter\tOPENROUTER_API_KEY\n"
|
||
printf "claude-code\tsubscription\tClaude Code (subscription — your claude CLI, no API key)\t_\n"
|
||
printf "codex\tsubscription\tOpenAI Codex (ChatGPT OAuth)\t_\n"
|
||
}
|
||
|
||
# Уникальные транспорты — для первого экрана выбора.
|
||
# Claude-Code-native kit → выводим subscription + direct-api ПЕРВЫМИ, чтобы
|
||
# рекомендованный путь (Claude Code, опция 1) был дефолтом. Остальные следом.
|
||
onboarding_list_transports() {
|
||
local all; all="$(onboarding_list_providers | awk -F'\t' '{print $2}' | sort -u)"
|
||
local t
|
||
for t in subscription direct-api; do
|
||
printf '%s\n' "$all" | grep -qx "$t" && echo "$t"
|
||
done
|
||
printf '%s\n' "$all" | grep -vxE 'subscription|direct-api' || true
|
||
}
|
||
|
||
# Провайдеры внутри транспорта.
|
||
onboarding_providers_in_transport() {
|
||
local tr="$1"
|
||
onboarding_list_providers | awk -F'\t' -v t="$tr" '$2==t {print $1 "\t" $3 "\t" $4}'
|
||
}
|
||
|
||
# Модели по provider_ref.
|
||
onboarding_models_for_provider() {
|
||
local pr="$1"
|
||
[ -f "$REGISTRY_MODELS" ] || { printf "claude-sonnet-4-6\tClaude Sonnet 4.6\n"; return; }
|
||
awk -v pr="$pr" '
|
||
/^\[\[model\]\]/ { id=""; pref=""; dn=""; next }
|
||
/^id[[:space:]]*=/ { gsub(/^id[[:space:]]*=[[:space:]]*"/, ""); gsub(/".*$/, ""); id=$0 }
|
||
/^provider_ref[[:space:]]*=/ { gsub(/^provider_ref[[:space:]]*=[[:space:]]*"/, ""); gsub(/".*$/, ""); pref=$0 }
|
||
/^display_name[[:space:]]*=/ { gsub(/^display_name[[:space:]]*=[[:space:]]*"/, ""); gsub(/".*$/, ""); dn=$0;
|
||
if (pref==pr) print id "\t" dn }
|
||
' "$REGISTRY_MODELS"
|
||
}
|
||
|
||
# auth_env для одного провайдера (для onboarding_collect_auth).
|
||
onboarding_auth_env_for_provider() {
|
||
local p="$1"
|
||
onboarding_list_providers | awk -F'\t' -v p="$p" '$1==p {print $4}'
|
||
}
|