From 21a0ae09e2380e6a0728c9b8cb1e8d62b1a84e76 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Mar 2026 02:28:13 +0000 Subject: [PATCH] feat: page command defaults to TOC-only, adds --complete flag --- scripts/rsw/internal/cmd/page.go | 15 ++++++++++++--- skills/wiki/SKILL.md | 14 ++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/scripts/rsw/internal/cmd/page.go b/scripts/rsw/internal/cmd/page.go index 8681fb5..1cdc2fa 100644 --- a/scripts/rsw/internal/cmd/page.go +++ b/scripts/rsw/internal/cmd/page.go @@ -12,15 +12,18 @@ import ( func newPageCmd() *cobra.Command { var pageSection string + var complete bool cmd := &cobra.Command{ Use: "page ", Short: "Fetch and display a wiki page", - Long: `Fetches a wiki page and renders it as markdown. Optionally filter -to a specific section. + Long: `Fetches a wiki page and renders its table of contents by default. +Use --section to get a specific section, or --complete for the full page. Examples: rsw osrs page "Dragon scimitar" + rsw osrs page "Dragon scimitar" --section "Combat styles" + rsw osrs page "Mining" --complete rsw rs3 page "Mining" --section "Training"`, Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -74,13 +77,19 @@ Examples: md.HR() } - md.Line(htmlconv.Convert(page.HTML)) + if complete { + md.Line(htmlconv.Convert(page.HTML)) + } else { + md.Line("Use --section <name> to fetch a specific section, or --complete for the full page.") + } + fmt.Print(md.String()) return nil }, } cmd.Flags().StringVar(&pageSection, "section", "", "Fetch only the named section") + cmd.Flags().BoolVar(&complete, "complete", false, "Fetch the complete page content (default shows TOC only)") return cmd } diff --git a/skills/wiki/SKILL.md b/skills/wiki/SKILL.md index 5150dab..8a85ac9 100644 --- a/skills/wiki/SKILL.md +++ b/skills/wiki/SKILL.md @@ -37,9 +37,14 @@ The first argument is always the game: `osrs` or `rs3`. Full-text search across wiki pages. Returns ranked titles with snippets. Use this to find the right page name before fetching details. -### rsw <game> page <title> [--section <name>] -Fetch a wiki page as cleaned markdown. Use `--section` to get just one section -(e.g., "Drops", "Strategy", "Requirements"). Use `--raw` for raw wikitext. +### rsw <game> page <title> [--section <name>] [--complete] +Fetch a wiki page. By default, returns only the table of contents (section list) +to conserve context. Use `--section` to fetch a specific section (e.g., "Drops", +"Strategy", "Requirements"). Use `--complete` for the full page content. +Use `--raw` for raw wikitext. + +**Recommended workflow:** First call `page` (no flags) to see available sections, +then call `page --section <name>` to fetch only what you need. ### rsw <game> item <name> [--ironman] The workhorse for "where do I find X" questions. Returns: @@ -87,7 +92,8 @@ When a user asks a RuneScape question, think about which command(s) to combine: → `rsw osrs price "abyssal whip"` **"What's a good money maker at 80 combat?"** -→ `rsw osrs search "money making"` → then `rsw osrs page "Money making guide"` +→ `rsw osrs search "money making"` → then `rsw osrs page "Money making guide"` (TOC) +→ then `rsw osrs page "Money making guide" --section "Combat"` for relevant section ### Inferring the game