cli

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *kong.Context

New initializes and returns a new kong.Context with a parsed configuration from command line arguments, default values, and environment variables. The returned context is used to run the JotBot application, which generates documentation for uncommented code using OpenAI models.

Types

type Config added in v0.0.4

type Config struct {
	Generate struct {
		Root            string      `arg:"" default:"." help:"Root directory of the repository."`
		Include         []string    `name:"include" short:"i" env:"JOTBOT_INCLUDE" help:"Glob pattern(s) to include files"`
		IncludeTests    bool        `name:"include-tests" short:"T" default:"false" env:"JOTBOT_INCLUDE_TESTS" help:"Include TestXXX() functions. (Go-specific)"`
		Exclude         []string    `name:"exclude" short:"e" env:"JOTBOT_EXCLUDE" help:"Glob pattern(s) to exclude files"`
		ExcludeInternal bool        `` /* 130-byte string literal not displayed */
		Match           []string    `name:"match" env:"JOTBOT_MATCH" help:"Regular expression(s) to match identifiers"`
		Symbols         []ts.Symbol `name:"symbol" short:"s" env:"JOTBOT_SYMBOLS" help:"Symbol(s) to search for in code (TS/JS-specific)"`
		Clear           bool        `name:"clear" short:"c" default:"false" env:"JOTBOT_CLEAR" help:"Force-clear comments in generation prompt (Go-specific)"`
		Branch          string      `name:"branch" env:"JOTBOT_BRANCH" help:"Branch name to commit changes to. Leave empty to not commit changes"`
		Limit           int         `name:"limit" default:"0" env:"JOTBOT_LIMIT" help:"Limit the number of files to generate documentation for"`
		DryRun          bool        `name:"dry" default:"false" env:"JOTBOT_DRY_RUN" help:"Print the changes without applying them"`
		Model           string      `name:"model" short:"m" default:"gpt-3.5-turbo" env:"JOTBOT_MODEL" help:"OpenAI model used to generate documentation"`
		MaxTokens       int         `` /* 138-byte string literal not displayed */
		Parallel        int         `name:"parallel" short:"p" default:"${parallel=4}" env:"JOTBOT_PARALLEL" help:"Number of files to handle concurrently"`
		Workers         int         `name:"workers" default:"${workers=2}" env:"JOTBOT_WORKERS" help:"Number of workers to use per file"`
		Override        bool        `name:"override" short:"o" env:"JOTBOT_OVERRIDE" help:"Override existing documentation (Go-specific)"`
	} `cmd:"" help:"Generate missing documentation."`

	APIKey  string `name:"key" env:"OPENAI_API_KEY" help:"OpenAI API key."`
	Verbose bool   `name:"verbose" short:"v" env:"JOTBOT_VERBOSE" help:"Enable verbose logging."`
}

Config is a struct that holds configuration options for generating missing documentation in a codebase. It provides various options, such as specifying the root directory, include and exclude patterns, match identifiers, branch name for committing changes, and more. It also supports configuring OpenAI API key and logging verbosity.

func (*Config) Run added in v0.0.4

func (cfg *Config) Run(kctx *kong.Context) error

Run generates missing documentation for a codebase, based on the provided configuration. It finds undocumented code, generates documentation using OpenAI, and applies the generated documentation as a patch. It can also commit the changes to a specified branch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL