claude-profile: remove provider-yaml system, embed model config in profiles
Provider selection phase removed; Anthropic driver→model_id is now hardcoded in the script and non-Anthropic profiles supply provider.env (MODEL_ID, ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY_FILE). Test suite baseline changes 58 → 41 assertions: the 17 dropped assertions covered the removed provider-yaml selection phase, not retained behaviour. Includes refactor-derived memory: decisions (provider architecture, driver enforcement via --model), bash gotchas (read -rp under set -e, never eval user config), process lessons.
This commit is contained in:
@@ -73,34 +73,29 @@ assert_exit_code "--help exits 0" 0 "$rc"
|
||||
assert_contains "--help shows usage" "claude-profile" "$out"
|
||||
assert_contains "--help shows --mode" "--mode" "$out"
|
||||
assert_contains "--help shows --preset" "--preset" "$out"
|
||||
assert_contains "--help shows --provider" "--provider" "$out"
|
||||
|
||||
# === Test 2: chat dryrun ===
|
||||
echo
|
||||
echo "Test 2: chat mode dryrun"
|
||||
out=$(run --dryrun oreillyit --mode chat --provider anthropic-haiku)
|
||||
out=$(run --dryrun oreillyit-anthropic --mode chat)
|
||||
rc=$?
|
||||
assert_exit_code "chat dryrun exits 0" 0 "$rc"
|
||||
assert_contains "chat shows haiku driver" "Driver: haiku" "$out"
|
||||
assert_contains "chat shows provider" "Provider: anthropic-haiku" "$out"
|
||||
assert_contains "chat shows model ID" "Model ID: claude-haiku-4-5-20251001" "$out"
|
||||
assert_contains "chat shows mode tag" "Mode: chat" "$out"
|
||||
assert_contains "chat says no changes" "No changes made" "$out"
|
||||
assert_contains "chat does not ask time horizon" "<not asked in this mode>" "$out"
|
||||
assert_contains "chat shows model in exec command" "claude --model claude-haiku-4-5-20251001" "$out"
|
||||
|
||||
# === Test 3: deep dryrun with project flag ===
|
||||
echo
|
||||
echo "Test 3: deep mode dryrun"
|
||||
out=$(run --dryrun oreillyit --mode deep --project cluster-bootstrap --provider anthropic-sonnet)
|
||||
out=$(run --dryrun oreillyit-anthropic --mode deep --project cluster-bootstrap)
|
||||
rc=$?
|
||||
assert_exit_code "deep dryrun exits 0" 0 "$rc"
|
||||
assert_contains "deep shows sonnet driver" "Driver: sonnet" "$out"
|
||||
assert_contains "deep shows provider" "Provider: anthropic-sonnet" "$out"
|
||||
assert_contains "deep shows model ID" "Model ID: claude-sonnet-4-6" "$out"
|
||||
assert_contains "deep shows --model in command" "claude --model claude-sonnet-4-6" "$out"
|
||||
assert_contains "deep records the project" "Project: cluster-bootstrap" "$out"
|
||||
assert_contains "deep defaults time horizon to hours" "Time horizon: hours" "$out"
|
||||
assert_contains "deep says async OK" "Async OK: yes" "$out"
|
||||
assert_contains "deep says plan_mode_auto yes" "Plan mode auto: yes" "$out"
|
||||
assert_contains "deep says spec_driven yes" "Spec driven: yes" "$out"
|
||||
@@ -108,38 +103,34 @@ assert_contains "deep says spec_driven yes" "Spec driven: yes" "$out"
|
||||
# === Test 4: orch dryrun preserves autoloop ===
|
||||
echo
|
||||
echo "Test 4: orch mode dryrun (autoloop preserved)"
|
||||
out=$(run --dryrun oreillyit --mode orch --project ai-image-gen --provider anthropic-sonnet)
|
||||
out=$(run --dryrun oreillyit-anthropic --mode orch --project ai-image-gen)
|
||||
rc=$?
|
||||
assert_exit_code "orch dryrun exits 0" 0 "$rc"
|
||||
assert_contains "orch preserves the slash command in autoloop" "/loop 2m /orchestrate" "$out"
|
||||
assert_contains "orch driver is sonnet" "Driver: sonnet" "$out"
|
||||
assert_contains "orch provider is anthropic-sonnet" "Provider: anthropic-sonnet" "$out"
|
||||
|
||||
# === Test 5: hybrid dryrun ===
|
||||
echo
|
||||
echo "Test 5: hybrid mode dryrun"
|
||||
out=$(run --dryrun oreillyit --mode hybrid --provider anthropic-haiku)
|
||||
out=$(run --dryrun oreillyit-anthropic --mode hybrid)
|
||||
rc=$?
|
||||
assert_exit_code "hybrid dryrun exits 0" 0 "$rc"
|
||||
assert_contains "hybrid uses haiku driver" "Driver: haiku" "$out"
|
||||
assert_contains "hybrid allows async" "Async OK: yes" "$out"
|
||||
assert_contains "hybrid shows provider" "Provider: anthropic-haiku" "$out"
|
||||
|
||||
# === Test 6: quick dryrun (no time horizon question) ===
|
||||
# === Test 6: quick dryrun ===
|
||||
echo
|
||||
echo "Test 6: quick mode dryrun"
|
||||
out=$(run --dryrun oreillyit --mode quick --provider anthropic-sonnet)
|
||||
out=$(run --dryrun oreillyit-anthropic --mode quick)
|
||||
rc=$?
|
||||
assert_exit_code "quick dryrun exits 0" 0 "$rc"
|
||||
assert_contains "quick uses sonnet driver" "Driver: sonnet" "$out"
|
||||
assert_contains "quick disables async" "Async OK: no" "$out"
|
||||
assert_contains "quick does not ask time horizon" "<not asked in this mode>" "$out"
|
||||
assert_contains "quick shows provider" "Provider: anthropic-sonnet" "$out"
|
||||
|
||||
# === Test 7: error — unknown mode ===
|
||||
echo
|
||||
echo "Test 7: error path — unknown mode"
|
||||
out=$(run --dryrun oreillyit --mode bogus)
|
||||
out=$(run --dryrun oreillyit-anthropic --mode bogus)
|
||||
rc=$?
|
||||
assert_exit_code "unknown mode exits 1" 1 "$rc"
|
||||
assert_contains "unknown mode error message" "Mode file not found" "$out"
|
||||
@@ -163,66 +154,28 @@ assert_contains "missing preset error message" "not found" "$out"
|
||||
# === Test 10: pass-through args via -- ===
|
||||
echo
|
||||
echo "Test 10: pass-through args"
|
||||
out=$(run --dryrun oreillyit --mode chat --provider anthropic-haiku -- --resume some-session)
|
||||
out=$(run --dryrun oreillyit-anthropic --mode chat -- --resume some-session)
|
||||
rc=$?
|
||||
assert_exit_code "pass-through exits 0" 0 "$rc"
|
||||
assert_contains "pass-through preserves --resume" "--resume some-session" "$out"
|
||||
|
||||
# === Test 11: minimax provider dryrun ===
|
||||
# === Test 11: minimax profile picks up provider.env ===
|
||||
echo
|
||||
echo "Test 11: minimax provider dryrun"
|
||||
out=$(run --dryrun oreillyit --mode quick --provider minimax-sonnet)
|
||||
echo "Test 11: minimax profile uses provider.env"
|
||||
out=$(run --dryrun oreillyit-minimax --mode quick)
|
||||
rc=$?
|
||||
assert_exit_code "minimax dryrun exits 0" 0 "$rc"
|
||||
assert_contains "minimax shows provider" "Provider: minimax-sonnet" "$out"
|
||||
assert_contains "minimax shows model ID" "Model ID: MiniMax-M2.7" "$out"
|
||||
assert_contains "minimax shows base URL" "Base URL: https://api.minimax.io/anthropic" "$out"
|
||||
assert_contains "minimax shows API key env" "API key env: ANTHROPIC_API_KEY" "$out"
|
||||
assert_contains "minimax references key file" "minimax-auth-token" "$out"
|
||||
assert_contains "minimax shows MiniMax model ID" "Model ID: MiniMax-M2.7" "$out"
|
||||
assert_contains "minimax shows provider env file" "Provider env:" "$out"
|
||||
assert_contains "minimax shows model in exec command" "claude --model MiniMax-M2.7" "$out"
|
||||
|
||||
# === Test 12: error — unknown provider ===
|
||||
# === Test 12: error — unknown flag (--provider no longer valid) ===
|
||||
echo
|
||||
echo "Test 12: error path — unknown provider"
|
||||
out=$(run --dryrun oreillyit --mode quick --provider bogus-provider)
|
||||
echo "Test 12: error path — unknown flag"
|
||||
out=$(run --dryrun oreillyit-anthropic --mode quick --provider anthropic-sonnet)
|
||||
rc=$?
|
||||
assert_exit_code "unknown provider exits 1" 1 "$rc"
|
||||
assert_contains "unknown provider error message" "Provider not found" "$out"
|
||||
|
||||
# === Test 13: default provider from driver (no --provider flag) ===
|
||||
echo
|
||||
echo "Test 13: default provider selected from driver"
|
||||
out=$(run --dryrun oreillyit --mode chat)
|
||||
rc=$?
|
||||
assert_exit_code "default provider dryrun exits 0" 0 "$rc"
|
||||
assert_contains "chat default provider is anthropic-haiku" "Provider: anthropic-haiku" "$out"
|
||||
assert_contains "chat default model ID is haiku" "Model ID: claude-haiku-4-5-20251001" "$out"
|
||||
|
||||
# === Test 14: --preset + --provider mutual exclusion ===
|
||||
|
||||
echo
|
||||
echo "Test 14: error path — --preset + --provider mutual exclusion"
|
||||
out=$(run --dryrun --preset whatever --provider minimax-sonnet)
|
||||
rc=$?
|
||||
assert_exit_code "preset+provider exits 1" 1 "$rc"
|
||||
assert_contains "preset+provider error message" "mutually exclusive" "$out"
|
||||
|
||||
# === Test 15: OAuth credentials warning fires for non-Anthropic provider ===
|
||||
echo
|
||||
echo "Test 15: OAuth credentials warning"
|
||||
out=$(run --dryrun oreillyit --mode quick --provider minimax-sonnet)
|
||||
rc=$?
|
||||
assert_exit_code "credentials warning dryrun exits 0" 0 "$rc"
|
||||
assert_contains "warning mentions stored credentials" ".credentials.json" "$out"
|
||||
assert_contains "warning names the provider" "minimax-sonnet" "$out"
|
||||
|
||||
# === Test 16: No warning when profile has no OAuth credentials ===
|
||||
echo
|
||||
echo "Test 16: no warning for credentials-free profile"
|
||||
out=$(run --dryrun minimax --mode quick --provider minimax-sonnet)
|
||||
rc=$?
|
||||
assert_exit_code "no-credentials dryrun exits 0" 0 "$rc"
|
||||
assert_not_contains "no credentials warning" ".credentials.json" "$out"
|
||||
assert_exit_code "unknown flag exits 1" 1 "$rc"
|
||||
assert_contains "unknown flag error message" "Unknown flag" "$out"
|
||||
|
||||
# === Summary ===
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user