narrative

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArgs

func BuildArgs(cli, prompt string) (string, []string)

BuildArgs returns the command name and argument slice for a non-interactive invocation of the given CLI with the provided prompt. For codex, the prompt is not passed as an argument — it is piped via stdin (using "-" to read from stdin) because codex exec ignores stdin when a prompt argument is present.

func DefaultPrompt

func DefaultPrompt(reportType, extra string) string

DefaultPrompt returns the built-in prompt for the given report type. reportType should be "standard" or "trends". If extra is non-empty it is appended as additional instructions.

func DetectCLI

func DetectCLI() (string, error)

DetectCLI finds the first supported AI CLI available on the system PATH.

func DetectCLIWith

func DetectCLIWith(lookup LookupFunc) (string, error)

DetectCLIWith finds the first supported AI CLI using the provided lookup function. It iterates the supported CLIs in order and returns the first one the lookup finds. Returns an error if none of the supported CLIs are found.

func Generate

func Generate(ctx context.Context, cli string, jsonData []byte, extraInstructions string) (string, error)

Generate pre-processes the JSON data into a complete markdown document with tables and computed metrics, then runs the AI CLI to generate narrative paragraphs which are inserted into the document at the {{NARRATIVE}} placeholder.

func PrepareDocument

func PrepareDocument(jsonData []byte) (string, string, error)

PrepareDocument parses JSON report data and generates a complete markdown document with all tables and computed metrics. The document contains a {{NARRATIVE}} placeholder where AI-generated analysis should be inserted. Returns the document, the report type ("standard" or "trends"), and any error.

func SupportedCLIs

func SupportedCLIs() []string

SupportedCLIs returns the list of supported AI CLI tool names.

Types

type LookupFunc

type LookupFunc func(name string) (string, error)

LookupFunc resolves a command name to its path. Compatible with exec.LookPath.

Jump to

Keyboard shortcuts

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