tmux-python / tmux-python/tmuxp
docs: Per-parameter configuration reference, generated from a config schema
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 248
- Avg merge
- 2h 13m
- Merged PRs (30d)
- 1
Description
Problem
Workspace configuration keys are documented as narrative sections in docs/configuration/top-level.md and docs/configuration/examples.md. That shape has three costs:
- No linkable per-parameter target. Issues, PRs, CHANGES entries, and warnings can't point at "the
synchronizereference" — only at a whole page. - No canonical inventory. The set of valid keys lives implicitly across
loader.expand(),loader.trickle(),validation.validate_schema(), and the builder. Discovering "what can I put in a workspace file, at which level, with what default?" requires reading source. - Drift risk. Prose and code are updated separately; the parity work (#1016, #1047–#1049) is adding many new keys (pane titles,
synchronize,shell_command_after,clear, lifecycle hooks), which multiplies both the value of a reference and the surface for drift.
Proposal
1. Per-parameter reference pages
One page (or one anchored section) per config parameter, each carrying:
- Name, level (session / window / pane), type, default
- Version introduced
- 1–3 prose paragraphs of behavior
- At least one copy-paste workspace example
- Related keys / interactions (e.g.
synchronize: aftervsshell_command_afterordering)
Plus an index table grouped by level, so the full vocabulary is scannable on one screen.
2. Bonus: make them autodocumentable
The drift problem disappears if docs and validation share one source of truth. Sketch:
- Declarative schema registry in code — a dataclass (or table of records) describing every key: name, level, type, default, since-version, help text, example.
loader/validationconsume it instead of hardcoding key knowledge;validate_schema()becomes data-driven. - Sphinx directive that renders the registry — prior art is exactly this pattern:
- myst-parser documents
MdParserConfigby introspecting its dataclass fields andfield.metadata["help"]via a customMystConfigDirective, invoked in docs as a{myst-config}fenced directive (myst_parser/_docs.py). tmuxp can do the same with a{tmuxp-config}directive filterable by level. - Sphinx core documents its own options with the
confvaldirective, which yields stable cross-referenceable targets ({confval}role) — adoptingconfval-style object types gives every parameter a permalink usable from CHANGES and warnings.
- myst-parser documents
- The generic directive could live in tmuxp's docs
conf.pyinitially; if it proves reusable, graduating it to the shared docs platform (gp-sphinx) is a natural follow-up.
Phasing
- Inventory + anchors — enumerate every key from loader/validation/builder, restructure existing prose under per-key anchors, add the index table. Docs-only, no code changes.
- Schema registry — introduce the declarative registry; port
validate_schema()and loader key-handling onto it; doctest the registry. - Directive — render per-key reference docs from the registry; delete the now-duplicated hand-written tables; CI ensures a key without registry metadata fails the build.
Acceptance criteria
- Every workspace config key has a linkable reference target with level, type, default, and a working example
- The key inventory in docs is generated from (or validated against) the same structure the loader/validator uses
- Adding a new config key without docs metadata fails loudly (build or test)
Refs #1016 (the parity effort expanding the config surface this would document).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inventorying the configuration behavior in loader.expand(), loader.trickle(), validation.validate_schema(), and the builder, then compare it with docs/configuration/top-level.md and docs/configuration/examples.md. Begin with the docs-only inventory and anchors phase; done means every workspace key has a linkable target, metadata, and a copy-paste example, with the documented inventory matching the implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100