Repository navigation
Publish JSON Schemas for user and project config - #4726
Conversation
|
|
||
| Organizations can deploy a system-wide config file for shared defaults — run `wt config show` for the platform-specific location. | ||
|
|
||
| For validation and completion in editors that support TOML schemas (such as Taplo or Tombi), start the file with `#:schema https://worktrunk.dev/schema/user-config.json` (user config) or `#:schema https://worktrunk.dev/schema/project-config.json` (project config). |
There was a problem hiding this comment.
@worktrunk-bot can you find a less prominent place? this is way too high (I would have expected you to catch this fwiw)
There was a problem hiding this comment.
Moved it in 4b19eb8 to its own ## Editor schemas section at the end of the config page, after Precedence, so it no longer sits between the files table and the examples.
| /// `HooksConfig`, which schemars can't see. Shared by | ||
| /// [`schema_top_level_keys`] and the published config schemas. | ||
| pub(crate) const HOOK_ALIASES: &[(&str, &str)] = | ||
| &[("pre-start", "pre-create"), ("post-start", "post-create")]; |
There was a problem hiding this comment.
let's not support deprecated commands?
There was a problem hiding this comment.
Done in 4b19eb8. The schemas now list only pre-start/post-start, so an editor flags pre-create/post-create as unknown, and a test pins that. The loader still accepts the aliases with its deprecation warning; this change only affects the schemas. HOOK_ALIASES is gone and schema_top_level_keys is back to how it was on main.
|
thanks @FlavioAmurrioCS ! |
worktrunk-bot
left a comment
There was a problem hiding this comment.
check-docs fails on 4b19eb8 (build preserves the public route contract, 37 !== 36). The new ## Editor schemas heading adds a 37th entry to the config page's table of contents, and docs/tests/built-site.test.mjs pins that count at 36 (the configToc assertion, message "config table of contents should expose overview and structural section headings only"). There are two ways to fix it. One is to bump the pinned count to 37, and optionally add ['editor-schemas', 'Editor schemas'] to the id/title list that follows. The other is to drop the heading and keep the sentence as a plain paragraph. That's a one-line edit outside this PR's diff. I can push it if you'd like.
Superseded by the review on a later commit.
…viewing PRs (#4733) The PR-review overlay already asks whether an added doc sentence is worth having. It doesn't ask where the sentence goes, or whether a new enumerating surface should list deprecated names. This adds both checks to `.claude/skills/running-tend/references/review-pr.md`: - **Placement.** A capability few readers need belongs in its own section late on the page, not in the overview every reader passes through. The review should name a better spot instead of approving past it. - **Current names only.** A newly published schema, completion set or docs table lists only current keys and commands. The loader keeps accepting deprecated aliases, but new surfaces don't advertise them. These are the two points `max-sixty` raised on #4726 after the bot's review had approved it. The first came with "I would have expected you to catch this". Both are this repo's documentation and deprecation policy, applied from AGENTS.md ("detail proportional to how many readers need it"; deprecated config is migrated, not carried forward), so they go in the overlay rather than upstream. <details><summary>Evidence</summary> - Review run [42444279886](https://github.com/max-sixty/worktrunk/actions/runs/42444279886) approved #4726 at `bbeecd3`. Its second pass was scoped as "peripheral-to-moderate (… one doc sentence)". The session ran `grep "pre-create\|post-create" src/config/deprecation.rs`, so it saw that the schemas included the deprecated `pre-create`/`post-create` hook aliases, and it raised neither point. The only finding it posted was a stale code comment. - The schema sentence had been added between the config-files table and the first example on the config page. It was later moved to its own `## Editor schemas` section at the end of the page. - Notifications run [42456122638](https://github.com/max-sixty/worktrunk/actions/runs/42456122638) applied both corrections in `4b19eb8`, then fixed the docs TOC count test that the new heading broke in `333adb2`. - Tracking: #4657. </details> --------- Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude <[email protected]>
Generate docs/public/schema/user-config.json and project-config.json from the config types' schemars derives, under the deserialize contract so defaulted fields stay optional. Object schemas are closed to unknown keys so editors flag typos, and the pre-create/post-create hook aliases serde accepts are added as deprecated properties from a shared HOOK_ALIASES table that schema_top_level_keys also uses. test_docs_are_in_sync regenerates both files alongside list-v2.json. Unit tests check that representative TOML configs, which the real loader also accepts, validate, and that misspelled keys are rejected. The wt config help notes the #:schema directive for Taplo/Tombi. Closes max-sixty#4639 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…chemas The published schemas now list only canonical hook names, so editors flag pre-create/post-create for migration. The #:schema pointer moves from the top of the config docs to its own section at the end.
333adb2 to
3bcf7a1
Compare
worktrunk v0.83.0 publishes user-config.json and project-config.json at worktrunk.dev/schema/, generated from UserConfig and ProjectConfig (max-sixty/worktrunk#4726). The #:schema lines in the user config and in .config/wt.toml now point there, in place of the schemas in my gist. The key sets match, except that the published schemas leave out the deprecated pre-create and post-create hooks, so editors flag them. docs/config-locations.md describes the new schemas. It also says that .config/wt.toml contains only its #:schema line, not the commented starter.
Closes #4639. This is the files-and-tests scope agreed in the issue: no
wt config schemacommand and no SchemaStore submission.What's in it
docs/public/schema/user-config.jsonandproject-config.jsonare generated from theUserConfig/ProjectConfigschemars derives, and published athttps://worktrunk.dev/schema/{user,project}-config.json.additionalProperties: false, so editors flag misspelled keys. Map-valued tables (projects,aliases,custom-columns, named hook commands) keep their ownadditionalProperties.pre-create/post-createhook aliases are left out, so editors flag them as unknown keys. The loader still accepts them with its deprecation warning.test_docs_are_in_syncregenerates both files next tolist-v2.json. The config types live in the library crate, so the test calls the generator directly instead of shelling out.src/config/schema.rs:[projects."…"], and the project schema rejects user-only keys.## Editor schemassection at the end of thewt confighelp explains the#:schemadirective 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
wt hook pre-merge --yeson macOS: all pre-commit hooks pass. 5,471 of 5,494 tests pass. The 23 failures are local-environment only: 22 needfish, which isn't installed here, andin_process_git_reads_only_the_hermetic_configpicks up the system git config. CI on the fork is green apart from the jobs that need repo secrets (Codecov upload, review bot).#:schemadirective. Both accept a valid.config/wt.tomland flag misspelled keys (pre-starts,[forge] platfrom).🤖 Generated with Claude Code