Documentation
¶
Overview ¶
cmd/factory/init/init.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InitCmd = &cobra.Command{ Use: "init", RunE: func(cmd *cobra.Command, args []string) error { presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr()) ctx := cmd.Context() presenter.Summary("Initializing ContextVibes configuration...") stdout, stderr, err := globals.ExecClient.CaptureOutput( ctx, ".", "git", "rev-parse", "--show-toplevel", ) if err != nil { presenter.Error("Failed to determine project root. Are you inside a Git repository?") presenter.Detail("Stderr: %s", stderr) return errors.New("not a git repository") } projectRoot := strings.TrimSpace(stdout) configPath := filepath.Join(projectRoot, config.DefaultConfigFileName) if _, err := os.Stat(configPath); err == nil { presenter.Info("Configuration file already exists: %s", presenter.Highlight(configPath)) return nil } defaultConfig := config.GetDefaultConfig() if err := config.UpdateAndSaveConfig(defaultConfig, configPath); err != nil { return err } presenter.Success("Successfully created .contextvibes.yaml.") return nil }, }
InitCmd represents the init command.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.