contextpack

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package contextpack defines the user-editable markers and helpers for the repository context pack. The generated pack is Markdown; the block between the BEGIN/END markers is owned by the user and is preserved across regenerations.

Index

Constants

View Source
const (
	// BeginMarker and EndMarker delimit the user-editable section.
	BeginMarker = "<!-- USER-CONTEXT:BEGIN -->"
	EndMarker   = "<!-- USER-CONTEXT:END -->"

	// UserHeading is the heading displayed above the user-editable section.
	UserHeading = "## 7. Additional Context — user-editable"

	// DefaultUserBlock is inserted when a pack has no user section yet.
	DefaultUserBlock = BeginMarker + "\n" +
		"<!-- Add free-form text, design notes, constraints, URLs, examples, etc.\n" +
		"     This block is preserved when the context pack is regenerated. -->\n" +
		EndMarker
)

Variables

This section is empty.

Functions

func EnsureUserBlock

func EnsureUserBlock(doc string) string

EnsureUserBlock appends the user-editable section when doc does not contain the markers. Existing blocks are left untouched apart from adding the section heading when the model omitted it.

func ExtractUserBlock

func ExtractUserBlock(doc string) (string, bool)

ExtractUserBlock returns the full user block (including markers) and true when both markers are present. The returned text is verbatim.

func ReplaceUserBlock

func ReplaceUserBlock(doc, block string) (string, bool)

ReplaceUserBlock replaces the existing user block with block. When the document has no user block, the block is appended under UserHeading. The bool reports whether an existing block was replaced.

func StripOuterCodeFence

func StripOuterCodeFence(doc string) string

StripOuterCodeFence removes a Markdown fence that wraps the entire document. Models sometimes return the whole pack inside ```markdown ... ``` even when asked not to. Inner fences are left intact.

Types

This section is empty.

Jump to

Keyboard shortcuts

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