visualization

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package visualization manages sandboxed, assistant-authored HTML visualizations for interactive Codog sessions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidFile reports a visualization name outside the managed source directory.
	ErrInvalidFile = errors.New("invalid visualization file")
	// ErrUnsafeSource reports a visualization source that resolves through a symbolic link.
	ErrUnsafeSource = errors.New("unsafe visualization source")
	// ErrSourceTooLarge reports a visualization source larger than the supported limit.
	ErrSourceTooLarge = errors.New("visualization source is too large")
)

Functions

This section is empty.

Types

type Item

type Item struct {
	File       string `json:"file"`
	Title      string `json:"title"`
	SourcePath string `json:"source_path"`
	ViewerPath string `json:"viewer_path"`
	URL        string `json:"url"`
}

Item describes a source visualization and its generated sandbox viewer.

type Manager

type Manager struct {
	Workspace  string
	ConfigHome string
}

Manager owns visualization sources for one workspace and sandboxed viewers under one Codog config home.

func (Manager) List

func (m Manager) List() ([]Item, error)

List materializes every valid HTML source in deterministic name order.

func (Manager) Materialize

func (m Manager) Materialize(file string, title string) (Item, error)

Materialize validates one source file and writes a sandboxed viewer outside the workspace so assistant tools cannot replace the security wrapper.

func (Manager) RewriteMarkdown

func (m Manager) RewriteMarkdown(markdown string) (string, bool)

RewriteMarkdown replaces visualization directives outside fenced code blocks with links to generated sandbox viewers.

func (Manager) SourceDir

func (m Manager) SourceDir() string

SourceDir returns the workspace directory in which assistant-authored visualization files are allowed.

Jump to

Keyboard shortcuts

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