message

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package message provides the command to generate commit message prompts.

Index

Constants

This section is empty.

Variables

View Source
var MessageCmd = &cobra.Command{
	Use:     "message",
	Aliases: []string{"commit", "msg"},
	Short:   "Generates a prompt for an AI to write your commit message.",
	RunE: func(cmd *cobra.Command, _ []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		ctx := cmd.Context()

		gitCfg := git.GitClientConfig{
			Logger:                globals.AppLogger,
			DefaultRemoteName:     globals.LoadedAppConfig.Git.DefaultRemote,
			DefaultMainBranchName: globals.LoadedAppConfig.Git.DefaultMainBranch,
			Executor:              globals.ExecClient.UnderlyingExecutor(),
		}
		client, err := git.NewClient(ctx, ".", gitCfg)
		if err != nil {
			return fmt.Errorf("failed to initialize git client: %w", err)
		}

		runner := workflow.NewRunner(presenter, globals.AssumeYes)

		return runner.Run(
			ctx,
			"Crafting Commit Message Prompt",
			&workflow.EnsureNotMainBranchStep{
				GitClient: client,
				Presenter: presenter,
			},
			&workflow.EnsureStagedStep{
				GitClient: client,
				Presenter: presenter,
				AssumeYes: globals.AssumeYes,
			},
			&workflow.GenerateCommitPromptStep{
				GitClient: client,
				Presenter: presenter,
			},
		)
	},
}

MessageCmd represents the craft message command.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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