Skip to content

Publish JSON Schemas for user and project config - #4726

Merged
max-sixty merged 4 commits into
max-sixty:mainfrom
FlavioAmurrioCS:config-json-schema
Nov 21, 2026
Merged

max-sixty merged 4 commits into
max-sixty:mainfrom
FlavioAmurrioCS:config-json-schema

Conversation

@FlavioAmurrioCS

@FlavioAmurrioCS FlavioAmurrioCS commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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

Comment thread tests/integration_tests/readme_sync.rs Resolved
worktrunk-bot
worktrunk-bot previously approved these changes Nov 8, 2026
Comment thread docs/src/content/docs/config.md Outdated

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).

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@worktrunk-bot can you find a less prominent place? this is way too high (I would have expected you to catch this fwiw)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/config/mod.rs Outdated
/// `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")];

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not support deprecated commands?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@max-sixty

Copy link
Copy Markdown
Owner

thanks @FlavioAmurrioCS !

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@worktrunk-bot
worktrunk-bot dismissed their stale review November 8, 2026 06:57

Superseded by the review on a later commit.

max-sixty pushed a commit that referenced this pull request Nov 8, 2026
…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]>
FlavioAmurrioCS and others added 4 commits November 16, 2026 21:58
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]>
…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.
@max-sixty
max-sixty merged commit bf7fa82 into max-sixty:main Nov 21, 2026
37 checks passed
FlavioAmurrioCS added a commit to FlavioAmurrioCS/.dotfiles that referenced this pull request Nov 27, 2026
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.
@FlavioAmurrioCS
FlavioAmurrioCS deleted the config-json-schema branch November 27, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish JSON Schemas for user and project config

3 participants