Skip to content

refactor(cli): split config command implementation - #113248

Merged
steipete merged 3 commits into
mainfrom
codex/z-config-cli-split
Jul 24, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/z-config-cli-split

Conversation

@steipete

@steipete steipete commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

src/cli/config-cli.ts had grown to 2,913 lines and was the largest production TypeScript file in the repository. Path parsing, config mutation, SecretRef/provider input handling, validation, write execution, and Commander registration all lived in one module behind a grandfathered max-lines suppression.

Why This Change Was Made

Split the implementation along existing responsibility boundaries while retaining src/cli/config-cli.ts as the public command/export surface:

  • path parsing and object mutation helpers
  • config mutation input and SecretRef/provider builders
  • model-reference normalization
  • dry-run and provider validation
  • mutation execution and reload hints

Every production module is now below 700 lines. The obsolete src/cli/config-cli.ts max-lines baseline entry is removed. No config, environment, protocol, schema, or CLI contract changed.

User Impact

None. This is a behavior-neutral internal refactor; command names, options, outputs, exports, validation, and config writes remain unchanged.

Evidence

LOC (git diff --numstat origin/main...HEAD):

  • production TypeScript: +2,359 / -2,502 (net -143)
  • tests: +0 / -0
  • ratchet baseline: +0 / -1
  • total: +2,359 / -2,503 (net -144)

Proof:

  • node scripts/check-changed.mjs -- src/cli/config-cli.ts src/cli/config-cli-input.ts src/cli/config-cli-model-normalization.ts src/cli/config-cli-path.ts src/cli/config-cli-runner.ts src/cli/config-cli-validation.ts config/max-lines-baseline.txt — passed on Blacksmith Testbox (tbx_01ky99jexevzce78ach8nhw2q9), including production/test typecheck, formatting, core lint, max-lines ratchet, dependency guards, and zero runtime import cycles.
  • node scripts/run-vitest.mjs src/cli/config-cli.test.ts src/cli/config-cli.integration.test.ts src/cli/program.smoke.test.ts — passed, 3 files / 158 tests.
  • node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --timing-json --shell -- "corepack pnpm build" — passed on Blacksmith Testbox (tbx_01ky9an2m5m082vb2ys9yrgn8b).
  • pnpm deadcode:dependencies and pnpm deadcode:exports — passed on Blacksmith Testbox (tbx_01ky9byy2vtkd8m34zf0c3p8vs) with zero unused exports after keeping split-only helpers private.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted — clean after fixing the accepted segment-comparison finding; no accepted/actionable findings remain.
  • git diff --check — passed.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XL maintainer Maintainer-authored PR labels Jul 24, 2026
@steipete
steipete marked this pull request as ready for review July 24, 2026 05:58
@steipete
steipete force-pushed the codex/z-config-cli-split branch from 1d6f5f1 to ee8868a Compare July 24, 2026 06:37
@steipete

Copy link
Copy Markdown
Contributor Author

Final-head real CLI proof on ee8868abd953f5c8e7e1fdbbb538e9f462785e00 using an isolated temporary OPENCLAW_CONFIG_PATH on Blacksmith Testbox tbx_01ky9dwk159s854sp7xctfy6k6 (run 30073181305). No operator config or secrets were used.

$ openclaw config set gateway.port 19001 --strict-json
Updated gateway.port. Restart the gateway to apply.

$ openclaw config validate
Config valid: <temp>/openclaw.json

$ openclaw config get gateway.port
19001

$ openclaw config set gateway.port 19002 --strict-json --dry-run
Dry run successful: 1 update(s) validated against <temp>/openclaw.json.

$ openclaw config get gateway.port
19001

This exercises a real non-destructive write, validation/readback, and a dry-run whose proposed value is not persisted. The branch was also rebased cleanly onto current main; exact-head CI is attached to the rebased head.

@steipete
steipete merged commit eac10a0 into main Jul 24, 2026
118 checks passed
@steipete
steipete deleted the codex/z-config-cli-split branch July 24, 2026 07:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 25, 2026
* refactor(cli): split config command implementation

* refactor(cli): keep split helpers private

* style(cli): format private unset result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant