feat(cli): Add btw docs topics to list topics#194
Merged
Conversation
- Add `btw docs topics <pkg> [--only help|vignettes]` as a dedicated
discovery command that lists help topics and vignettes for a package
in two clearly-labelled sections
- Remove the ambiguous `{pkg}` brace syntax from `btw docs help`;
topic listing is now handled exclusively by `btw docs topics`
- Update `btw docs help <TOPIC>` description to drop the `{package}`
reference and clarify `pkg::topic` scoping
- Add `btw_docs_topics()` implementation with input validation on
`--only` (accepts "", "help", or "vignettes")
- Update SKILL.md to document the new command and drop the brace syntax
- Add tests for all three `--only` modes and `--help` snapshot
- Add `## Help topics` and `## Vignettes` section headings - Replace JSON output with YAML-style key: value pairs, one entry per topic/vignette, blank line between entries - Rewrite `btw_docs_topics()` to call `_impl` functions directly and pull structured data from `extra$data` rather than consuming the JSON `@value` strings - Add `format_as_yaml_rows()` helper in exec/btw.R
Replace YAML-style key/value rows with compact markdown list items: * `topic_id` - Title Simpler, more readable, and consistent with how markdown lists are used elsewhere in btw output. Replaces format_as_yaml_rows() with a one-liner format_as_md_list() helper.
- Show aliases parenthetically after the topic ID when they differ:
* `mutate` *(also: mutate_all, mutate_at, mutate_if)* - Create, modify, and delete columns
- Drop the format_as_md_list() helper; write the formatting logic
inline in btw_docs_topics() where it's used
- Use full df (with aliases column) for help topics instead of
pre-subsetting to topic_id + title
When a package has no vignettes, the abort from `btw_tool_docs_available_vignettes_impl()` was propagating before the `## Vignettes` heading was printed, causing the error message to appear without its heading. Now the heading is printed first and the error is caught locally so it renders as body text beneath it.
Outputs structured JSON with top-level keys "help" (array of
{topic_id, title, aliases[]}) and "vignettes" (array of {vignette,
title}), compatible with --only to limit which sections are included.
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.
Uh oh!
There was an error while loading. Please reload this page.