mirror of
https://github.com/max-sixty/worktrunk.git
synced 2026-11-23 01:51:13 +08:00
Closes #4639. This is the files-and-tests scope agreed in the issue: no `wt config schema` command and no SchemaStore submission. ## What's in it - `docs/public/schema/user-config.json` and `project-config.json` are generated from the `UserConfig` / `ProjectConfig` schemars derives, and published at `https://worktrunk.dev/schema/{user,project}-config.json`. - They use the **deserialize** contract, so fields with a serde default stay optional. - Object schemas get `additionalProperties: false`, so editors flag misspelled keys. Map-valued tables (`projects`, `aliases`, `custom-columns`, named hook commands) keep their own `additionalProperties`. - The deprecated `pre-create` / `post-create` hook aliases are left out, so editors flag them as unknown keys. The loader still accepts them with its deprecation warning. - `test_docs_are_in_sync` regenerates both files next to `list-v2.json`. The config types live in the library crate, so the test calls the generator directly instead of shelling out. - Unit tests in `src/config/schema.rs`: - representative user and project TOML configs validate. Each fixture also has to deserialize into the real config type, so the tests can't drift from what the loader reads. - misspelled keys are rejected at the root, in nested tables, and inside `[projects."…"]`, and the project schema rejects user-only keys. - A short `## Editor schemas` section at the end of the `wt config` help explains the `#:schema` directive for Taplo / Tombi. The docs site test that pins the config page's table-of-contents count moves from 36 to 37 for the new heading. ## Testing - Local `wt hook pre-merge --yes` on macOS: all pre-commit hooks pass. 5,471 of 5,494 tests pass. The 23 failures are local-environment only: 22 need `fish`, which isn't installed here, and `in_process_git_reads_only_the_hermetic_config` picks up the system git config. CI on the fork is green apart from the jobs that need repo secrets (Codecov upload, review bot). - I checked the generated schema against Taplo and Tombi using a `#:schema` directive. Both accept a valid `.config/wt.toml` and flag misspelled keys (`pre-starts`, `[forge] platfrom`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>