Documentation
¶
Index ¶
- Variables
- func AutoUpdateCheck()
- func Run(args []string) error
- type CLI
- type CompletionCmd
- type ConstantsCmd
- type DoctorCmd
- type EditCmd
- type EditsBySlugCmd
- type EditsCmd
- type Globals
- type Link
- type LinksCmd
- type ListCmd
- type PageCmd
- type PreviewCmd
- type RandomCmd
- type SearchCmd
- type StatsCmd
- type SuggestCmd
- type TTSCmd
- type TypeaheadCmd
- type UpdateCheckCmd
- type UpdateInfo
- type VersionCmd
Constants ¶
This section is empty.
Variables ¶
var ( // Version is the current version of the CLI Version = version.Version // BinaryName is the name of the binary BinaryName = version.BinaryName // GitHubRepo is the GitHub repository name GitHubRepo = "cli" // GitCommit is the git commit hash GitCommit = version.GitCommit // BuildTime is the build timestamp BuildTime = version.BuildTime )
Build-time variables (re-exported from cli-tools/version for backward compatibility)
Functions ¶
func AutoUpdateCheck ¶
func AutoUpdateCheck()
AutoUpdateCheck performs a background update check for use at startup. Notifications go to stderr so machine-readable command output remains valid.
Types ¶
type CLI ¶
type CLI struct {
Globals
Search SearchCmd `cmd:"" help:"Search for pages in Grokipedia"`
Page PageCmd `cmd:"" help:"Retrieve a page by slug"`
Links LinksCmd `cmd:"" help:"List links from a page"`
Edits EditsCmd `cmd:"" help:"List edit requests"`
EditsBySlug EditsBySlugCmd `cmd:"" name:"edits-by-slug" help:"List edit requests for a page"`
Typeahead TypeaheadCmd `cmd:"" help:"Typeahead search for page titles"`
Constants ConstantsCmd `cmd:"" help:"List API constants and enums"`
Suggest SuggestCmd `cmd:"" help:"Suggest a new article"`
Edit EditCmd `cmd:"" help:"Suggest an edit to an existing article"`
List ListCmd `cmd:"" help:"List pages (browse / discover)"`
Stats StatsCmd `cmd:"" help:"Show global Grokipedia statistics"`
Preview PreviewCmd `cmd:"" help:"Lightweight page preview"`
TTS TTSCmd `cmd:"" help:"List text-to-speech sections for an article"`
Random RandomCmd `cmd:"" help:"Show a random page"`
Doctor DoctorCmd `cmd:"" help:"Run diagnostics (API, cache, config). Try 'grokipedia doctor -v' for details"`
Completion CompletionCmd `cmd:"" help:"Generate shell completion script"`
Version VersionCmd `cmd:"" help:"Show version information"`
CheckUpdates UpdateCheckCmd `cmd:"" name:"check-updates" help:"Check for available updates"`
}
CLI is the main command-line interface structure using Kong
type CompletionCmd ¶
type CompletionCmd struct {
Shell string `arg:"" help:"Shell: bash, zsh, fish, powershell"`
}
CompletionCmd handles shell completion generation
func (*CompletionCmd) Run ¶
func (c *CompletionCmd) Run() error
type ConstantsCmd ¶
type ConstantsCmd struct {
Format string `help:"Output format: table, json" default:"table"`
}
ConstantsCmd handles the constants command
func (*ConstantsCmd) Run ¶
func (c *ConstantsCmd) Run(globals *Globals) error
type DoctorCmd ¶
type DoctorCmd struct{}
DoctorCmd runs basic diagnostics on the CLI environment. Detail level is controlled by the global --verbose flag.
type EditCmd ¶
type EditCmd struct {
Slug string `arg:"" help:"Slug of the article to edit"`
Summary string `help:"Short summary of the proposed change (REQUIRED)"`
ProposedContent string `help:"Proposed replacement content"`
OriginalContent string `help:"The original text being corrected (recommended for precision)"`
SectionTitle string `help:"Section containing the proposed change"`
Evidence []string `help:"Supporting source URL (repeatable)"`
Content string `help:"Deprecated alias for --proposed-content"`
OriginalText string `help:"Deprecated alias for --original-content"`
Sources string `help:"Deprecated comma/space-separated source URLs"`
Format string `help:"Output format: text, json" default:"text"`
}
EditCmd submits an edit suggestion for an existing article.
type EditsBySlugCmd ¶
type EditsBySlugCmd struct {
Slug string `arg:"" help:"Page slug"`
Limit int `help:"Maximum number of results (1-100)" default:"10"`
Offset int `help:"Offset for pagination" default:"0"`
Format string `help:"Output format: table, json" default:"table"`
}
EditsBySlugCmd lists edit history for one article.
func (*EditsBySlugCmd) Run ¶
func (c *EditsBySlugCmd) Run(globals *Globals) error
type EditsCmd ¶
type EditsCmd struct {
Limit int `help:"Maximum number of results (1-100)" default:"20"`
Status string `help:"Filter by status (comma-separated: approved,implemented,pending)"`
ExcludeUser []string `help:"Exclude edits by username (repeatable)"`
Counts bool `help:"Include count metadata" default:"true"`
Format string `help:"Output format: table, json" default:"table"`
}
EditsCmd handles the edits command
type Globals ¶
type Globals struct {
ConfigFile string `help:"Config file (default is ~/.grokipedia/config.yml)" short:"c" env:"GROKIPEDIA_CONFIG"`
APIURL string `help:"API base URL" env:"GROKIPEDIA_API_URL"`
Timeout int `help:"Request timeout in seconds" env:"GROKIPEDIA_TIMEOUT"`
NoCache bool `help:"Disable caching" env:"GROKIPEDIA_NO_CACHE"`
CacheDir string `help:"Cache directory" env:"GROKIPEDIA_CACHE_DIR"`
CacheTTL int `help:"Cache TTL in seconds" env:"GROKIPEDIA_CACHE_TTL"`
Verbose bool `help:"Enable verbose output" short:"v" env:"GROKIPEDIA_VERBOSE"`
Debug bool `help:"Enable debug output" env:"GROKIPEDIA_DEBUG"`
Color string `help:"Color mode: auto, always, never" default:"auto" env:"GROKIPEDIA_COLOR"`
// contains filtered or unexported fields
}
Globals contains global flags available to all commands
func (*Globals) AfterApply ¶
type Link ¶
type Link struct {
Type string `json:"type"`
Slug string `json:"slug,omitempty"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
Source string `json:"source"`
}
Link represents a single link extracted from a page
type LinksCmd ¶
type LinksCmd struct {
Slug string `arg:"" help:"Page slug to extract links from"`
Internal bool `help:"Show only internal page links"`
External bool `help:"Show only external links (citations)"`
Tree bool `help:"Display links in a tree structure"`
Format string `help:"Output format: table, json, markdown, tree" default:"table"`
}
LinksCmd handles the links command
type ListCmd ¶
type ListCmd struct {
Limit int `help:"Maximum results (1-100)" default:"20"`
Offset int `help:"Pagination offset" default:"0"`
Category string `help:"Filter by category"`
Format string `help:"Output format: table, json" default:"table"`
Count bool `help:"Show total count" default:"true"`
}
ListCmd lists pages with pagination (discovery / browsing)
type PageCmd ¶
type PageCmd struct {
Slug string `arg:"" help:"Page slug"`
Content bool `help:"Show page content"`
NoLinks bool `help:"Skip link validation"`
Format string `help:"Output format: markdown, plain, json" default:"markdown"`
}
PageCmd handles the page command
type PreviewCmd ¶
type PreviewCmd struct {
Slug string `arg:"" help:"Page slug"`
Format string `help:"Output format: markdown, json, plain" default:"markdown"`
}
PreviewCmd shows lightweight page information
func (*PreviewCmd) Run ¶
func (c *PreviewCmd) Run(globals *Globals) error
type RandomCmd ¶
type RandomCmd struct {
Content bool `help:"Include full page content (uses /api/page)"`
Category string `help:"Limit random selection to a category (e.g. 'Physics', 'History')"`
Format string `help:"Output format: markdown, json, plain" default:"markdown"`
}
RandomCmd shows a random page
type SearchCmd ¶
type SearchCmd struct {
Query string `arg:"" help:"Search query"`
Limit int `help:"Maximum number of results (1-100)" default:"12"`
Offset int `help:"Offset for pagination" default:"0"`
Format string `help:"Output format: table, json, markdown" default:"table"`
}
SearchCmd handles the search command
type StatsCmd ¶
type StatsCmd struct {
Format string `help:"Output format: table, json" default:"table"`
}
StatsCmd shows global statistics
type SuggestCmd ¶
type SuggestCmd struct {
Title string `arg:"" help:"Title of the article to suggest"`
Description string `help:"Optional details/description for the article suggestion"`
Content string `help:"Deprecated alias for --description"`
Sources string `help:"Optional legacy sources or references"`
Format string `help:"Output format: text, json" default:"text"`
}
SuggestCmd handles the suggest command.
func (*SuggestCmd) Run ¶
func (c *SuggestCmd) Run(globals *Globals) error
type TTSCmd ¶
type TTSCmd struct {
Slug string `arg:"" help:"Page slug"`
Format string `help:"Output format: table, json, list" default:"table"`
}
TTSCmd lists text-to-speech sections for an article
type TypeaheadCmd ¶
type TypeaheadCmd struct {
Query string `arg:"" help:"Search query prefix"`
Limit int `help:"Maximum number of results" default:"10"`
Format string `help:"Output format: list, json" default:"list"`
}
TypeaheadCmd handles the typeahead command.
func (*TypeaheadCmd) Run ¶
func (c *TypeaheadCmd) Run(globals *Globals) error
type UpdateCheckCmd ¶
type UpdateCheckCmd struct {
Force bool `help:"Force check, bypassing cache" flag:"force"`
}
UpdateCheckCmd wraps cli-tools update functionality
func (*UpdateCheckCmd) Run ¶
func (c *UpdateCheckCmd) Run(globals *Globals) error
Run executes the update check
type UpdateInfo ¶
UpdateInfo is re-exported from cli-tools for backward compatibility
type VersionCmd ¶
type VersionCmd struct{}
VersionCmd is kept as a command so the version is available without making network calls or requiring a configuration file.