docpost

package
v0.3.0-beta.22 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(ctx context.Context, srcDir, dstDir string, opts Options) error

Process reads all compozy*.md files from srcDir, transforms them into Fumadocs-compatible MDX, and writes them to dstDir using a nested directory layout: `compozy` → compozy.mdx, `compozy_agent` → agent/index.mdx, `compozy_agent_list` → agent/list.mdx, and so on.

The root-level index.mdx and meta.json of dstDir are hand-maintained and never touched by Process. Subdirectory meta.json files are regenerated on each run. Stale files from prior runs are removed before writing.

func TransformMarkdown

func TransformMarkdown(raw, cmdName string) string

TransformMarkdown converts raw Cobra markdown to Fumadocs MDX format. It strips boilerplate, extracts metadata, and prepends YAML frontmatter.

Types

type Options

type Options struct {
	OutputProfiles map[string]OutputProfile
}

Options supplies command-tree facts that Cobra's Markdown generator does not retain in the generated files.

type OutputProfile

type OutputProfile string

OutputProfile describes the output behavior of one Cobra command. Cobra propagates root flags to every command, including help-only groups, so the generated markdown alone cannot distinguish inherited flag acceptance from a command's renderer.

const (
	// OutputProfileResult identifies a command that renders a command result.
	OutputProfileResult OutputProfile = "result"
	// OutputProfileHelp identifies a command that only renders Cobra help.
	OutputProfileHelp OutputProfile = "help"
	// OutputProfileNoOutput identifies a command with no result renderer.
	OutputProfileNoOutput OutputProfile = "none"
	// OutputProfileProtocol identifies a command whose standard output is a protocol stream.
	OutputProfileProtocol OutputProfile = "protocol"
	// OutputProfileRaw identifies a command that writes a command-specific text stream.
	OutputProfileRaw OutputProfile = "raw"
	// OutputProfileHumanJSONL identifies a stream that supports human and JSONL output only.
	OutputProfileHumanJSONL OutputProfile = "human-jsonl"
)

Jump to

Keyboard shortcuts

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