implement-canonical-wg

Implement: canonical wg config — built-in defaults, 'wg config init', migration for stale configs

Metadata

Statusdone
Assignedagent-822
Agent identityf51439356729d112a6c404803d88015d5b44832c6c584c62b96732b63c2b0c7e
Created2026-04-27T17:38:47.858020631+00:00
Started2026-04-27T18:47:06.964132416+00:00
Completed2026-04-27T19:34:23.099043654+00:00
Tagseval-scheduled
Tokens0 in / 0 out

Description

Description

Implement the canonical-config UX designed in design-canonical-wg. Specifically:

  1. Bake canonical defaults into the binary — so a user with no ~/.wg/config.toml gets a working setup. Update src/config/ default constructors with the values the design picked (no more openrouter:anthropic/claude-sonnet-4 ghosts).

  2. Ship wg config init [--global|--local] — writes the minimal-form config files from the design.

  3. Improve wg setup — implement the interactive wizard changes from the design (or note if no changes are needed).

  4. Migration command — implement the chosen migration path (probably wg migrate config per design). It should:

    • Detect deprecated keys (agent.executor, dispatcher.executor, coordinator.* instead of dispatcher.*, etc.)
    • Detect stale model strings (anything matching old model patterns)
    • Detect duplicated defaults (key set in user config but matching the built-in default — can be removed)
    • Print a diff of what will change, prompt for confirmation, write the new file (back up old as .bak)
  5. Update docs — README / setup guide / quickstart mentions of config to reference the new commands.

Files to touch

  • src/config/ — defaults, schema, validation
  • src/commands/setup.rs — interactive wizard
  • src/commands/config/ (or wherever wg config lives) — add init subcommand
  • src/commands/migrate/ — add config subcommand (or extend existing)
  • docs/quickstart.md / README.md — mention new commands
  • CLAUDE.md — update template if any wg add examples reference config

Validation

  • Failing tests first (TDD):
    • test_defaults_no_user_config — boot wg with no ~/.wg/config.toml → assert claude executor + opus model active
    • test_config_init_global_writes_minimal — wg config init --global writes the expected file with only the keys the design picked as 'always-set'
    • test_migrate_strips_deprecated — fixture config with agent.executor = "claude"wg migrate config produces a clean output without that key
    • test_migrate_stale_model — fixture config with model = "openrouter:anthropic/claude-sonnet-4" → migrate produces current model
  • cargo build + cargo test pass with no regressions
  • Manual smoke: rm ~/.wg/config.toml, run wg quickstart → no errors, sensible behavior; wg config init --global recreates it cleanly
  • Manual smoke: wg migrate config on a fixture with the historical keys (agent.executor, coordinator.*, old model) → produces canonical form
  • No deprecation warnings on a fresh-install + freshly-init'd config

Depends on

Required by

Log