Skip to content

Add LLM tool commands to example config as single source of truth - #1531

Merged
max-sixty merged 3 commits into
mainfrom
default-config-commit
Mar 14, 2026
Merged

max-sixty merged 3 commits into
mainfrom
default-config-commit

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The Claude/Codex recommended commands were duplicated across 4 locations (Rust code, llm-commits.md, config.md, Taskfile) with no automated sync — they were already drifting (missing CLAUDECODE= prefix, missing -c system_prompt='').

Now the double-commented entries in config.example.toml are the single source of truth. recommended_config() parses them at runtime via include_str! + LazyLock, and a new sync test verifies llm-commits.md matches. Also fixes the existing drift in all copies.

This was written by Claude Code on behalf of @max-sixty

…e of truth

The Claude/Codex recommended commands were duplicated across 4 locations
(Rust code, llm-commits.md, config.md, Taskfile) with no sync — they
were already drifting (missing CLAUDECODE= prefix, missing
-c system_prompt=''). Now `recommended_config()` parses from the
double-commented entries in config.example.toml via include_str! +
LazyLock, and a sync test verifies llm-commits.md matches.

Co-Authored-By: Claude <[email protected]>
Exercises the parser with custom config snippets to cover TOML
unescaping, heading matching, and non-command line skipping.

Co-Authored-By: Claude <[email protected]>

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

Clean consolidation — the "single source of truth" approach via include_str! + LazyLock is a good fit here, and the sync test catches future drift between config.example.toml and llm-commits.md.

One observation on the sync test's error message (non-blocking): the assertion in test_llm_docs_commands_match_config_example says "source of truth: dev/config.example.toml, generated from src/cli/mod.rs" — the phrasing "generated from" could be read as "config.example.toml is generated from cli/mod.rs", when actually the relationship is the reverse for the command strings (config.example.toml is the source, and cli/mod.rs embeds the same commented blocks for the help page). Minor, since someone hitting this failure would figure it out quickly.

The config data is compile-time include_str!, so detailed panic messages
on parse failure add no value — replace with simple unwrap/indexing.

Co-Authored-By: Claude <[email protected]>

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

Clean consolidation. The include_str! + LazyLock approach is well-suited for eliminating the drift between four copies of these commands, and the sync test will catch future divergence.

Observations (all non-blocking)

Parser scoping caveat is well-documented. The doc comment on parse_recommended_commands notes that if other config sections gain # # command = lines, the scan should be scoped to the LLM section. Good forward-looking note.

HashMap index panic at runtime. recommended_config() uses &RECOMMENDED_COMMANDS[self.config_heading()], which panics if the heading is absent. The test_llm_tool_recommended_config test catches this, but if a new LlmTool variant is added without a matching config entry, the failure surface is a runtime panic rather than a compile error. Acceptable given the test coverage — just worth knowing.

Sync test error message phrasing (same observation as the prior review): the assertion says "generated from src/cli/mod.rs" which could be read as config.example.toml being generated from cli/mod.rs, when the relationship is the reverse for command strings. Minor — anyone hitting this would sort it out quickly.

@max-sixty
max-sixty merged commit 5a2895c into main Mar 14, 2026
23 checks passed
@max-sixty
max-sixty deleted the default-config-commit branch March 14, 2026 23:08
worktrunk-bot added a commit that referenced this pull request Mar 15, 2026
Two behavioral issues observed in the past hour's CI runs:

1. Triple approval on PR #1531 — each of 3 commits triggered a new review
   run, and each re-approved despite the prior approval covering the same
   PR. The trivial-change exit path said "skip steps 2-3" but didn't
   explicitly block step 4 (approval), so the bot re-approved on trivial
   incremental changes.

2. Self-approval attempts on PRs #1521 and #1529 — the bot attempted
   `gh pr review --approve` on its own PRs before discovering GitHub
   rejects self-approvals. The authorship check was buried in step 4
   instead of being caught in pre-flight.

Fixes:
- Add IS_SELF_AUTHORED check to pre-flight (step 1) so the bot knows
  before reaching step 4
- Make trivial-change exit path explicitly skip steps 2, 3, AND 4
- Update step 4 self-authored guidance to reference the pre-flight flag

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty added a commit that referenced this pull request Mar 15, 2026
Follow-up to #1531. These three tools were only documented in
`llm-commits.md` — adding them as double-commented entries in the config
example makes them discoverable via `wt config create` and keeps all
tool commands in one place, verified by the existing sync test.

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude <[email protected]>
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.

2 participants