Documentation
¶
Overview ¶
Package codemod provides helpers for codemods and project automation.
Package codemod provides helpers for codemods and project automation. This file contains the copilot command and related functionality.
Package codemod provides helpers for codemods and project automation. This file contains the lint-setup command and related functionality.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CodemodCmd = &cobra.Command{
Use: "codemod",
Short: "Helpers for codemods and project automation",
Long: `Run codemods or setup helpers for various project types.`,
}
CodemodCmd is the root command for codemod-related helpers and automation.
View Source
var CopilotSetupCmd = &cobra.Command{ Use: "copilot", Short: "Setup custom Copilot instructions file", Long: `Create a base custom Copilot instructions file at .github/copilot-instructions.md. By default, this command assumes you are in the root of a Git repository. Use --force to bypass this check.`, Run: func(cmd *cobra.Command, args []string) { force, _ := cmd.Flags().GetBool("force") if !force { if !isGitRepository() { log.Error("Not in a Git repository. Use --force to bypass this check.") return } } if err := createCopilotInstructions(); err != nil { log.Error("Failed to create Copilot instructions: %v", err) return } log.Success("Copilot instructions file created at .github/copilot-instructions.md") }, }
CopilotSetupCmd creates a base custom Copilot instructions file in .github/copilot-instructions.md.
View Source
var LintSetupCmd = &cobra.Command{ Use: "lint-setup", Short: "Setup linting and formatting for a Node.js project", Long: `Install and configure linting, formatting, and pre-commit hooks for a Node.js project (eslint, prettier, husky, etc).`, Run: func(cmd *cobra.Command, args []string) { if _, err := os.Stat("package.json"); errors.Is(err, os.ErrNotExist) { log.Error("package.json not found in current directory") return } if err := installLintDependencies(); err != nil { log.Error("npm install failed: %v", err) return } if err := writeESLintConfig(); err != nil { log.Error("Failed to write eslint.config.mjs: %v", err) return } if err := updatePackageJSON(); err != nil { log.Error("Failed to update package.json: %v", err) return } if err := setupHusky(); err != nil { log.Error("Failed to set up Husky: %v", err) return } log.Success("Linting, formatting, and pre-commit hooks are set up!") }, }
LintSetupCmd sets up linting, formatting, and pre-commit hooks for a Node.js project.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.