Skip to content

mcpx(plugin): generate the README options table from the settings registry (#2516) - #2844

Merged
dezren39 merged 2 commits into
mainfrom
queue/3756-2516-flag-single-source
Oct 30, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/3756-2516-flag-single-source

Conversation

@dezren39

@dezren39 dezren39 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Item 9 of #2516 (the remainder of #1883 item 9): the opencode plugin's options table in pkgs/mcpx/plugin/opencode/README.md was a second hand-written list that nothing read. It is now generated from the settings registry and guarded by a drift test, in the same marker/-update style as docs/configuration.md.

What is generated

The region between the markers renders, in registry declaration order:

  • one row per plugin.* setting (all 12): option = path minus plugin., variable = EnvName() plus EnvAliases, default = the registry Default (— when empty), effect = the registry Short;
  • two rows kept at the top of the table, endpoint and socket, whose option names come from daemon.endpoint / daemon.socket and whose variables (MCPX_DAEMON_ENDPOINT, MCPX_ENDPOINT, MCPX_SOCKET) are asserted to exist in settings.ScriptEnv() rather than hardcoded.

Regenerate with:

go test ./internal/settings -run TestThePluginReadmeListsEveryOption -update

Wording that changed, because the registry is now the source of truth

  • discoveryRetry default now reads 1m0s (what defaults.PluginDiscoveryRetry renders, and what docs/configuration.md already said) rather than 60s.
  • Bool defaults render as true/false rather than off/on; headless/daemonTools render auto rather than detected/when unclear.
  • Effects are the registry Short lines. The longer per-row explanations they replaced are kept as hand-written paragraphs immediately below the generated region (bin: "", binArgs whitespace/JSON, the three backend behaviours, and the meanings of headless, daemonTools, env, remember), so nothing the old table said was dropped.

Guards

  • TestThePluginReadmeListsEveryOption regenerates the marked region and fails when the README differs; -update rewrites it.
  • TestThePluginOptionTableCoversTheRegistry independently asserts every plugin.* setting has exactly one row plus both daemon rows, so a generator that silently rendered nothing would still fail.
  • TestThePluginOptionTableDriftBites proves the comparison actually bites: it mutates a default, a variable, a row name and adds an invented row, and asserts each is caught. It first checks the committed file is not already stale, so it cannot pass vacuously.
  • treefmt.toml gains an exclude for the README, for the same reason docs/configuration.md has one: prettier's table padding would break the byte-for-byte comparison. treefmt --fail-on-change plugin/opencode/README.md is clean.

Verification

command result
gofmt -l internal/settings/pluginreadme_test.go clean
go vet ./internal/settings/ pass
go test ./internal/settings/ -run TestThePlugin -count=1 pass (4 tests)
go test ./internal/settings/ -run TestThePluginReadmeListsEveryOption -update, twice pass, md5sum identical (idempotent)
treefmt --fail-on-change plugin/opencode/README.md 0 files changed
go test ./internal/settings/ -count=1 5 pre-existing failures, identical on clean main at dc9b1179 and 497c820f (see below)

The five failures — TestEveryDocumentHasAChapter, TestNoUndeclaredEnvRead, TestEverySettingHasAnEffectProbeOrAnExemption, TestTheScriptEnvironmentIsWhatTheCodeSets, TestTheEnvironmentDocIsCurrent — reproduce unchanged on origin/main in a clean worktree with no changes from this branch (MCPX_ADAPTER_DECLARATION_SHA256 undeclared, missing effect probes for model.*/proto.*/script.*, stale docs/environment.md, an untracked TESTING.md compendium gap). They are not caused by this change and are left alone here.

Not in this PR

Item 8 — per-command flag single-sourcing in internal/cli (~175 hand fs.* declarations across 21 non-test files) — is untouched. No flag name, default or meaning changes here.

Refs #2516, #1883.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 30, 2026 22:04
@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 10421ade-592b-4260-a99b-cc0bd3824cc5
Commits

Reviewing files that changed from the base of the PR and between 497c820 and 357bf01.

Files selected for processing: 3
  • pkgs/mcpx/internal/settings/pluginreadme_test.go
  • pkgs/mcpx/plugin/opencode/README.md
  • treefmt.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T22:06:30.336192Z 357bf01 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant