systemprompt

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: 9 Imported by: 1 module, 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

Overview

Package systemprompt provides the command to generate system prompts.

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, _ []string) error {
		presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr())
		loadedAppConfig := globals.LoadedAppConfig

		basePath := "docs/prompts/system"

		content, err := os.ReadFile(filepath.Join(basePath, "core.md"))
		if err != nil {

			return err
		}

		var finalPrompt strings.Builder
		finalPrompt.Write(content)

		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