feat(cli): M6 settings/db/cloud sync + freeze openproxy.v1.* schemas#15
Merged
Merged
Conversation
Adds the M6 milestone from PLAN v3: 18 runtime CLI commands across two new
top-level groups (settings + db), plus the v1 schema-stability contract
and a small batch of low-risk warning cleanups.
New commands
* settings get [--key <dot.path>] / set --key --value[-json] /
apply --from-file <path|-> / proxy-test --proxy-url / locale set <lang> /
version / update [--check|--apply]
* db init / export [--out <path>] / import <path> [--merge|--replace] /
dump --resource <r> / migrate (noop) / cloud auth / cloud sync /
cloud resolve --alias / cloud alias list / cloud alias set --alias --model
All commands talk to existing /api/* routes through the M4/M5 Runtime,
emit openproxy.v1.* envelopes under --robot, and exit code 6 if the
server is unreachable. No new HTTP helpers were needed.
Schema stability
* openproxy schema stability prints the new v1 contract envelope.
* openproxy schema list now includes namespace + stability fields so
agents can detect the v1 promise without a separate call.
* SCHEMA_NAMESPACE / SCHEMA_STABILITY constants in src/cli/schema.rs
encode the policy in code: additive-only changes inside openproxy.v1.*,
any break opens a new openproxy.v2.* namespace.
Cleanup (interleaved per todo-openproxy.md)
* whoami::hostname -> whoami::fallible::hostname() (2 sites).
* Drop 2 unused imports (futures_util::TryStreamExt, http_body_util::BodyExt)
in src/cli/mod.rs.
* Fix 2 irrefutable_let_patterns in openai_to_claude.rs.
Tests
* 18 new wiremock integration tests in tests/cli_m6_robot_envelopes.rs
covering one happy path per settings/db/cloud/schema command.
* 4 new unit tests inside src/cli/{settings,db}.rs for the helpers.
* Existing 386 lib tests + 15 M5 integration tests still pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes out M6 of
todo-openproxy.md(Settings/DB/Cloud Sync + Polish). Adds 18 runtime CLI commands across two new top-level groups (settings,db), declares theopenproxy.v1.*envelope namespace stable, and clears a handful of low-risk warnings flagged for cleanup.New commands
settings(7)get [--key <dot>],set --key --value[-json],apply --from-file <path|->,proxy-test --proxy-url --test-url --timeout-ms,locale set <lang>,version,update [--check|--apply]/api/settingsGET/PATCH,/api/settings/proxy-test,/api/locale,/api/version,/api/version/updatedb(10)init,export [--out],import <path> [--merge|--replace],dump --resource <r>,migrate,cloud auth,cloud sync --provider --access-token …,cloud resolve --alias,cloud alias list,cloud alias set --alias --model/api/init,/api/db/export,/api/settings/database,/api/cloud/{auth,credentials/update,model/resolve,models/alias}schemaschema stabilityenvelope;schema listnow embedsnamespace/stabilityso agents can detect the v1 promise in one call.All commands talk to existing
/api/*routes through the M4/M5Runtime, emitopenproxy.v1.*envelopes under--robot, and exit code 6 if the server is unreachable. No new HTTP helpers required.Notable decisions:
db cloud synccallsPUT /api/cloud/credentials/update(the closest existing route — there is no/api/cloud/sync). Documented in the command's clap help.db migrateis a deliberate no-op envelope today. The server normalizes on load, and no CLI-owned migrations exist yet; the command is here so future scripts can call it unconditionally.db import --replaceis reserved and errors out until the server learns a destructive-overwrite mode. Default behavior is--merge, matching the BE.settings locale getis intentionally not exposed yet — the BE has no GET endpoint for it.Schema-stability contract (M6 polish)
The
openproxy.v1.*namespace is now declared stable:Encoded in two places so it can't drift:
SCHEMA_NAMESPACE = "openproxy.v1"andSCHEMA_STABILITY = "stable"constants insrc/cli/schema.rs.openproxy schema stabilityemitsopenproxy.v1.schema.stabilitycarrying the policy text.openproxy schema listnow includesnamespace+stabilityin its envelope so agents can read the contract in one call.Cleanup (interleaved per
todo-openproxy.md)whoami::hostname()→whoami::fallible::hostname()in both call sites (src/cli/provider_ext.rs:427,src/server/api/providers.rs:1072).irrefutable_let_patternsinsrc/core/translator/request/openai_to_claude.rs:782,790rewritten as direct destructuring (ClaudeSystemBlockhas only theTextvariant).src/cli/mod.rs(futures_util::TryStreamExt,http_body_util::BodyExt).The remaining warning cleanup batch (server-side unused imports,
unused_variablesinvertex.rs,unused_mutinchat/mod.rs) is intentionally not in this PR — those touch the server hot-path and want their own focused review.Tests
tests/cli_m6_robot_envelopes.rs— one happy path persettings/db/db cloud/schema stabilitycommand. Same pattern as the M5 suite.src/cli/{settings,db}.rs(coerce_value_str, dotted-path walker,DumpResourceslug/key invariants).cargo clippy --all-targets --no-depsclean on every new file; only pre-existing warnings remain elsewhere.cargo fmt --allran clean.Review & Testing Checklist for Human
src/cli/settings.rsandsrc/cli/db.rsfor any commands whose BE shape you want renamed/dropped before this freezes — last cheap window beforeopenproxy.v1.*is declared stable.db import --replacebeing reserved-but-errored (vs. silently merging) — this is the most user-visible behavior change.src/cli/schema.rsmatches your intended public-facing policy. Bumping these constants later is a contract change.cargo run --bin openproxy -- server init && cargo run --bin openproxy -- server start --detach, then exercise one command per group with--robotand confirm the schema fields above. Stop the server and re-run one command to confirm exit code 6.Notes
git-managerproxy 403 from PR feat(cli): M5 tooling integration — mitm/tunnel/tool/translator/media (30 cmds) #14 (GIT_CONFIG_GLOBAL=/dev/null+ theghtokensecret). Once the proxy is fixed the workaround can be dropped — no code-side change needed.mainat the post-M5-merge commit. No conflicts.todo-openproxy.mdare (a) the deferred server-side warning batch, (b) docs auto-gen + acargo docCI step, and (c) the skills/golden-snapshot infra — each suited to its own focused PR.