diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 6a43716..5e6a995 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -13,7 +13,7 @@ "name": "wiki", "source": "./plugins/rsw", "description": "RuneScape Wiki CLI", - "version": "1.0.1", + "version": "1.0.2", "author": { "name": "Sam Myers" } diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 8f017dc..f95e18c 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,9 +1,9 @@ { "name": "runescape-wiki", "description": "Query the RuneScape Wiki (RS3 and OSRS) for items, quests, skills, and Grand Exchange prices", - "version": "1.0.0", + "version": "1.0.2", "author": { - "name": "sam" + "name": "Sam Myers" }, "keywords": ["runescape", "osrs", "rs3", "wiki", "grand-exchange", "gaming"] } diff --git a/scripts/rsw/internal/cmd/page.go b/scripts/rsw/internal/cmd/page.go index 1cdc2fa..efe1d82 100644 --- a/scripts/rsw/internal/cmd/page.go +++ b/scripts/rsw/internal/cmd/page.go @@ -2,7 +2,6 @@ package cmd import ( "fmt" - "strings" "github.com/runescape-wiki/rsw/internal/htmlconv" "github.com/runescape-wiki/rsw/internal/render" @@ -11,20 +10,15 @@ 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 its table of contents by default. -Use --section to get a specific section, or --complete for the full page. + Long: `Fetches a wiki page and renders it as markdown. 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"`, + rsw osrs page "Mining" + rsw rs3 page "Archaeology"`, Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { title := args[0] @@ -44,63 +38,17 @@ Examples: return fmt.Errorf("failed to fetch page: %w", err) } - if pageSection != "" { - body := htmlconv.ExtractSection(page.HTML, pageSection) - if body == "" { - sections := htmlconv.ListSections(page.HTML) - return fmt.Errorf("section %q not found. Available sections: %s", - pageSection, formatSectionNames(sections)) - } - md := render.New() - md.H1(page.Title) - md.Line(body) - fmt.Print(md.String()) - return nil - } - md := render.New() md.H1(page.Title) - - sections := htmlconv.ListSections(page.HTML) - if len(sections) > 0 { - md.H2("Sections") - for _, s := range sections { - indent := "" - if s.Level == 3 { - indent = " " - } else if s.Level >= 4 { - indent = " " - } - md.Line(fmt.Sprintf("%s- %s", indent, s.Name)) - } - md.Newline() - md.HR() - } - - 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.") - } - + md.Line(htmlconv.Convert(page.HTML)) 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 } -func formatSectionNames(sections []htmlconv.SectionInfo) string { - names := make([]string, len(sections)) - for i, s := range sections { - names[i] = s.Name - } - return strings.Join(names, ", ") -} - func init() { RegisterCommand(newPageCmd) } diff --git a/skills/wiki/SKILL.md b/skills/wiki/SKILL.md index 8a85ac9..c95cd37 100644 --- a/skills/wiki/SKILL.md +++ b/skills/wiki/SKILL.md @@ -37,14 +37,9 @@ 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>] [--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> page <title> +Fetch a wiki page and return its full content as markdown. +Use `--raw` for raw wikitext instead. ### rsw <game> item <name> [--ironman] The workhorse for "where do I find X" questions. Returns: @@ -92,8 +87,7 @@ 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"` (TOC) -→ then `rsw osrs page "Money making guide" --section "Combat"` for relevant section +→ `rsw osrs search "money making"` → then `rsw osrs page "Money making guide"` ### Inferring the game