Skip to content

feat: add bl config agent command for one-click coding agent configuration#107

Merged
XXPermanentXX merged 1 commit into
mainfrom
feat/config-agent
Jul 19, 2026
Merged

feat: add bl config agent command for one-click coding agent configuration#107
XXPermanentXX merged 1 commit into
mainfrom
feat/config-agent

Conversation

@lishengzxc

Copy link
Copy Markdown
Contributor

Summary

Add bl config agent to configure a coding agent (Claude Code, Qwen Code, OpenCode, OpenClaw, Hermes, Codex) to use a DashScope/ModelStudio endpoint with a single command. Each writer non-destructively merges into the agent's local config file(s) with a timestamped backup and atomic (tmp + rename, mode 0o600) writes.

Re-implemented from the earlier PR #69 into the current layered monorepo architecture (packages/commands command + packages/cli product map), with config field structures verified against actively-maintained upstreams.

Design decisions

  • Field structures aligned to farion1231/cc-switch current Bailian presets (Codex uses requires_openai_auth + model_reasoning_effort/disable_response_storage; Hermes uses custom_providers rather than stuffing creds into model).
  • qwen-code aligned to QwenLM/qwen-code source: modelProviders key and security.auth.selectedType use the protocol name (openai/anthropic, chosen by endpoint) because the runtime resolver indexes by protocol. The bailian-cli brand lives in the model-entry name and BAILIAN_CLI_API_KEY.
  • provider id unified as bailian-cli across codex/opencode/openclaw/hermes.
  • Codex config.toml is merged via smol-toml (parse + upsert only bailian-cli fields) so unrelated settings (mcp_servers, approval_policy, other providers) are preserved.
  • Validation is parser-level (choices + required → exit code 2); --dry-run emits masked JSON without writing.
  • Standalone curl/irm scripts from PR feat: add bl config agent command for one-click coding agent configuration #69 are intentionally out of scope.

Test plan

  • bl config agent --help / missing --api-key / invalid --agent / --dry-run (masked, no write) — e2e.
  • Codex & Hermes real-write structure — e2e.
  • Writer unit tests (9): all 6 agents, endpoint→protocol/npm/api branches, qwen upsert, merge-preservation (incl. Codex TOML), backup.
  • npx vp check: 377 files, no format/lint/type errors.

Note: committed with --no-verify because the pre-commit vp check --fix is OOM-killed in the constrained dev sandbox; vp check was verified passing out-of-band.

…uration

Add `bl config agent` to configure a coding agent (Claude Code, Qwen Code,
OpenCode, OpenClaw, Hermes, Codex) to use a DashScope/ModelStudio endpoint
with a single command. Writers non-destructively merge into each agent's
local config with a timestamped backup and atomic writes.

- Field structures aligned to farion1231/cc-switch; qwen-code aligned to
  QwenLM/qwen-code source (modelProviders/security.auth keyed by protocol).
- provider id unified as `bailian-cli` (qwen-code brands via model entry
  name + BAILIAN_CLI_API_KEY, since it keys by protocol).
- Codex config.toml merged via smol-toml to preserve unrelated settings.
- Add writer unit tests + config e2e cases; regenerate skill reference.
@XXPermanentXX
XXPermanentXX merged commit 12ecac4 into main Jul 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants