Repository navigation
refactor(docs): fix blank-line cmd-stream corruption; share AUTO-GENERATED marker constants - #2417
Merged
Merged
Conversation
…; consolidate AUTO-GENERATED markers
`convert_dollar_console_to_terminal` was promoting blank lines inside
mixed `$ cmd + output` blocks to extra cmd= entries (`wt list|||`),
which both dropped the blank from the rendered body and emitted a stray
`$ ` prompt. Distinguish command-only blocks (where blanks are visual
spacing) from mixed blocks (where blanks belong to the body), and fold
the two filter passes into a single classification loop. Removes the
matching `trim_end_matches('|')` bandage in `expand_command_placeholders`.
Within `tests/integration_tests/readme_sync.rs`, factor the four copies
of the `<!-- ⚠️ AUTO-GENERATED ... -->` literal into shared
`MARKER_OPEN_PREFIX` / `MARKER_OPEN_HTML_PREFIX` / `MARKER_CLOSE`
constants plus a `wrap_in_marker()` helper, and feed those constants
into the consuming regexes.
Co-Authored-By: Claude <[email protected]>
…CLOSE__
The `2` suffix was meant to distinguish "double brace" placeholders from
hypothetical single-brace ones, but Tera only treats `{{`/`}}` (not single
braces) as template delimiters, so there's no second variant to disambiguate
from. Drop the noise.
Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Apr 25, 2026
Merged
6 tasks done
max-sixty
added a commit
that referenced
this pull request
Apr 25, 2026
…oss crate boundary (#2418) ## Summary Follow-ups from #2417 review, plus adjacent simplifications. - **Cross-crate share of marker constants.** `MARKER_OPEN_PREFIX` and `MARKER_CLOSE` now live in `src/docs.rs`. `src/help.rs` (the `--help-page` producer of help-region markers) and `tests/integration_tests/readme_sync.rs` (the consumer + producer of snapshot/section markers) both reference them — drift becomes a build error rather than a silent mismatch. - **Drop `MARKER_OPEN_HTML_PREFIX`.** The `-HTML` variant emitted visually identical wrapping; the suffix only signalled "in-place refreshable" but the `.snap` ID + terminal-shortcode body in `DOCS_SNAPSHOT_MARKER_PATTERN` already discriminate that. Standardised on a single open prefix and stripped the `-HTML` literals from `README.md`, the four standalone docs files, and the test file. - **Help-page marker uses the shared prefix.** The mirrored close (`<!-- END AUTO-GENERATED from \`wt <cmd> --help-page\` -->`) stays as-is because adjacent regions need unambiguous pairing, but the open prefix now goes through `MARKER_OPEN_PREFIX`. - **Drop `MarkerType::output_format()` / `extract_inner()`.** Both had a single trivial non-panic branch that existed only to enforce "no Snapshot markers in README" via `unreachable!()`. Replaced with one explicit assertion in `sync_readme_markers` — surfaces the invariant as an actionable error message instead of a panic. - **Collapse `format_replacement`.** `wrap_in_marker` is invoked once for both output formats; only body construction varies. - **`__WT_QUOT__` rename in `tests/integration_tests/user_hooks.rs`.** Inlined the single quotes — the `.replace('__WT_QUOT__', \"'\")` was unnecessary indirection (the outer raw-string literal already tolerates `'`, and TOML / Tera don't care about embedded `'`). Removes a name-conflation footgun with the unrelated `__WT_QUOT__` placeholder in `src/docs.rs`. Net diff: -7 lines. ## Test plan - [x] `cargo test --test integration` — full integration suite (1559 tests) pass - [x] `cargo test --test integration readme_sync` — all 13 sync tests pass; `test_readme_examples_are_in_sync` now produces a stable README on a clean run (verified by re-running multiple times — no further updates after the initial regeneration) - [x] `cargo test --test integration test_args_indexing_and_length_in_hook_template` — confirms the user_hooks single-quote inlining works through TOML and Tera - [x] Visual check via local Zola dev server: \`/worktrunk/\`, \`/llm-commits/\`, \`/claude-code/\`, \`/tips-patterns/\`, \`/merge/\`, \`/step/\`, \`/remove/\`, \`/hook/\`, \`/list/\` all render terminal blocks cleanly with no leaked marker strings (`AUTO-GENERATED-HTML`, `__WT_OPEN2__`, trailing `|||`) - [x] `cargo clippy --all-targets --all-features` — clean - [x] `cargo fmt --check` — clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three small follow-ups + a placeholder rename, all from #2405 review feedback.
|||corruption.convert_dollar_console_to_terminalwas promoting blank lines inside mixed\$ cmd + outputblocks to extracmd=entries, dropping the blank from the rendered body and emitting a stray\$prompt (e.g.cmd=\"wt list|||\"). Now distinguishes command-only blocks (blanks are visual spacing incmd=) from mixed blocks (blanks belong to body). Removes the matchingtrim_end_matches('|')bandage inexpand_command_placeholders. New unit test insrc/docs.rscovers the mixed-block case.block_linesinto one loop with one match — fewer branches, no duplicated predicates.tests/integration_tests/readme_sync.rs, the<!-- ⚠️ AUTO-GENERATED ... -->literal appeared in four producer / regex sites with subtly different shapes (HTML vs plain, ID format). Factored intoMARKER_OPEN_PREFIX/MARKER_OPEN_HTML_PREFIX/MARKER_CLOSEconstants plus awrap_in_marker()helper, and threaded those constants into the regexes viaregex::escape. Pure refactor — no docs/skill files regenerated.__WT_OPEN2__/__WT_CLOSE2__→__WT_OPEN__/__WT_CLOSE__. The2was meant to distinguish doubled-brace placeholders from hypothetical single-brace ones, but Tera only treats{{/}}(not single braces) as template delimiters — there's no second variant to disambiguate from. Updated the producer (src/docs.rs), the test-side decoder (tests/integration_tests/readme_sync.rs), the Zola template (docs/templates/shortcodes/terminal.html), the docs-siteCLAUDE.md, and the regenerateddocs/content/{step,hook}.md.Test plan
cargo test --lib docs::tests::test_convert_dollar_console_to_terminal— exercises new mixed-block case + existing command-only / multi-cmd / comment casescargo test --test integration readme_sync— 13 sync tests still pass after the refactor and bandage removalcargo test --test integration— full integration suite (1558 tests) pass/merge/,/step/,/remove/,/hook/,/llm-commits/, and/list/all render terminal blocks cleanly with no|||artifacts and no leaked placeholder strings (__WT_OPEN__etc. don't appear in served HTML). The multi-command jq recipes block on/list/continues to render comments as bash-styled section headers.cargo clippy --all-targets --all-features— cleancargo fmt --check— clean🤖 Generated with Claude Code