systemprompt

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

cmd/library/systemprompt/systemprompt.go

Index

Constants

This section is empty.

Variables

View Source
var SystemPromptCmd = &cobra.Command{
	Use:     "system-prompt",
	Aliases: []string{"prompt"},
	Example: `  contextvibes library system-prompt --target idx`,
	RunE: func(cmd *cobra.Command, args []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		loadedAppConfig := globals.LoadedAppConfig

		basePath := "docs/prompts/system"
		coreContent, err := os.ReadFile(filepath.Join(basePath, "core.md"))
		if err != nil {
			return err
		}

		var finalPrompt strings.Builder
		finalPrompt.Write(coreContent)

		if systemPromptTarget != "" {

			targetContent, err := os.ReadFile(filepath.Join(basePath, systemPromptTarget+".md"))
			if err != nil {
				return err
			}
			finalPrompt.WriteString("\n\n")
			finalPrompt.Write(targetContent)
		}

		outputPath := systemPromptOutput
		if outputPath == "" {
			if defaultPath, ok := loadedAppConfig.SystemPrompt.DefaultOutputFiles[systemPromptTarget]; ok {
				outputPath = defaultPath
			} else {
				outputPath = fmt.Sprintf("contextvibes_%s_prompt.md", systemPromptTarget)
			}
		}

		if outputPath == "-" {
			_, _ = fmt.Fprint(presenter.Out(), finalPrompt.String())
		} else {
			err := os.WriteFile(outputPath, []byte(finalPrompt.String()), 0o600)
			if err != nil {
				return err
			}
			presenter.Success("Successfully generated system prompt at %s.", outputPath)
		}

		return nil
	},
}

SystemPromptCmd represents the system-prompt 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