commands

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddCmd = &cobra.Command{
	Use:   "add <repo-url>",
	Short: "Add a new repository and clone it locally.",
	Args:  cobra.ExactArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		repoURL := args[0]
		token, _ := cmd.Flags().GetString("githubToken")
		user, _ := cmd.Flags().GetString("githubUser")
		return CMD_addRepository(repoURL, token, user)
	},
}
View Source
var AskCmd = &cobra.Command{
	Use:   "ask <question>",
	Short: "Generate a TypeScript script from an OpenAI query.",
	Args:  cobra.ArbitraryArgs,
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) == 0 {
			return errors.New("please provide a question after 'query'")
		}
		question := strings.Join(args, " ")
		return CMD_ask(question)
	},
}
View Source
var InfoCmd = &cobra.Command{
	Use:   "info",
	Short: "Displays information about projects and available scripts",
	RunE: func(cmd *cobra.Command, args []string) error {
		debug, _ := cmd.Flags().GetBool("debug")
		return CMD_info(debug)
	},
}
View Source
var LoadCmd = &cobra.Command{
	Use:   "load [flags] <csv1> <csv2> …",
	Short: "Load one or more CSV files into an SQLite database",
	Args:  cobra.MinimumNArgs(0),
	RunE: withMetrics(func(cmd *cobra.Command, args []string) error {
		dbPath, _ := cmd.Flags().GetString("db")
		return CMD_loadCSVs(dbPath, args)
	}),
}
View Source
var PlanCmd = &cobra.Command{
	Use:   "plan [script]",
	Short: "Plan changes across projects",
	Args:  cobra.MaximumNArgs(1),
	RunE: withMetrics(func(cmd *cobra.Command, args []string) error {
		topics, _ := cmd.Flags().GetStringSlice("topics")
		var script string
		if len(args) > 0 {
			script = args[0]
		}
		return CMD_plan(topics, script)
	}),
}
View Source
var PullCmd = &cobra.Command{
	Use:   "pull",
	Short: "Pull the latest changes for all repositories in projects.json",
	RunE: withMetrics(func(cmd *cobra.Command, args []string) error {
		topics, _ := cmd.Flags().GetStringSlice("topics")
		githubToken, _ := cmd.Flags().GetString("githubToken")
		githubUser, _ := cmd.Flags().GetString("githubUser")
		githubUpdateToken, _ := cmd.Flags().GetBool("githubUpdateToken")

		return CMD_pullRepos(topics, githubToken, githubUser, githubUpdateToken)
	}),
}
View Source
var RunCmd = &cobra.Command{
	Use:   "run [scriptName]",
	Short: "Run scripts across all projects in your configuration.",
	RunE: withMetrics(func(cmd *cobra.Command, args []string) error {

		topics, _ := cmd.Flags().GetStringSlice("topics")
		count, _ := cmd.Flags().GetBool("count")
		all, _ := cmd.Flags().GetBool("all")
		outputFormats, _ := cmd.Flags().GetStringSlice("output")
		scriptName, _ := cmd.Flags().GetString("script")
		return CMD_runScript(scriptName, topics, all, count, outputFormats, args)
	}),
}
View Source
var SyncCmd = &cobra.Command{
	Use:   "sync",
	Short: "Sync project metadata from all configured code repositories.",
	RunE: func(cmd *cobra.Command, args []string) error {
		return CMD_syncRepos()
	},
}

SyncCmd is a Cobra command that synchronizes project metadata from a specified code repository. Currently, it supports syncing from GitHub. The command requires a single argument specifying the repository type (e.g., "github"). It uses the GITHUB_TOKEN environment variable for authentication.

Functions

func AddCmdInit added in v0.5.2

func AddCmdInit(cmd *cobra.Command)

func CMD_addRepository

func CMD_addRepository(repoURL string, token string, user string) error

CMD_addRepository clones the repo (if not present) and stores it in projects.json.

func CMD_ask

func CMD_ask(question string) error

CMD_ask calls the OpenAI API with the question, extracts the TypeScript code, and saves it to ./scripts/<question>.ts.

func CMD_info

func CMD_info(debug bool) error

CMD_info lists the number of projects and available scripts

func CMD_loadCSVs added in v0.5.0

func CMD_loadCSVs(dbPath string, files []string) error

CMD_loadCSVs loads each CSV in files into the SQLite DB.

func CMD_plan added in v0.3.29

func CMD_plan(topics []string, script string) error

func CMD_pullRepos

func CMD_pullRepos(topics []string, githubToken string, githubUser string, githubUpdateToken bool) error

CMD_pullRepos pulls or clones every repo whose topic matches. It keeps going even if some repos fail and returns a joined error list.

func CMD_runScript

func CMD_runScript(scriptName string, topics []string, all bool, count bool, outputFormats []string, args []string) error

func CMD_syncRepos

func CMD_syncRepos() error

func LoadCmdInit added in v0.5.0

func LoadCmdInit(cmd *cobra.Command)

func PullCmdInit added in v0.5.2

func PullCmdInit(cmd *cobra.Command)

func RunCmdInit

func RunCmdInit(cmd *cobra.Command)

Types

This section is empty.

Jump to

Keyboard shortcuts

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