Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                

macros

package
v0.0.0-...-e6c4605 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package macros provides the macros catalog feature for the UI.

Package macros provides the macros catalog feature for the UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRoutes

func SetupRoutes(
	router chi.Router,
	eng *engine.Engine,
	store core.Store,
	sessionStore sessions.Store,
	notify *notifier.Notifier,
	isDev bool,
) error

SetupRoutes registers the macros catalog feature routes.

Types

type ArgDetail

type ArgDetail struct {
	Name     string // Argument name
	Default  string // Default value (empty if required)
	Required bool   // True if no default value
}

ArgDetail represents a function argument.

type FunctionDetail

type FunctionDetail struct {
	Namespace  string      // Parent namespace name
	Name       string      // Function name
	Signature  string      // Full signature with args
	Args       []ArgDetail // Parsed arguments
	Docstring  string      // Function docstring (may be empty)
	SourceCode string      // Extracted function source code
	FilePath   string      // Path to .star file
	Line       int         // Line number where function is defined
}

FunctionDetail holds full function information for the detail panel.

type FunctionSummary

type FunctionSummary struct {
	Name      string // Function name
	Signature string // "name(arg1, arg2=default)"
	HasDoc    bool   // True if function has docstring
}

FunctionSummary is a compact function representation for the tree view.

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers provides HTTP handlers for the macros feature.

func NewHandlers

func NewHandlers(
	eng *engine.Engine,
	store core.Store,
	sessionStore sessions.Store,
	notify *notifier.Notifier,
	isDev bool,
) *Handlers

NewHandlers creates a new Handlers instance.

func (*Handlers) HandleMacrosPage

func (h *Handlers) HandleMacrosPage(w http.ResponseWriter, r *http.Request)

HandleMacrosPage renders the macros catalog page with full content. Handles both /macros (no selection) and /macros/{namespace}/{function} (with selection).

func (*Handlers) MacrosPageUpdates

func (h *Handlers) MacrosPageUpdates(w http.ResponseWriter, r *http.Request)

MacrosPageUpdates is the long-lived SSE endpoint for the macros page. Handles both /macros/updates (no selection) and /macros/{ns}/{fn}/updates (with selection). Pushes full AppShell on every update so both tree and detail stay in sync.

type NamespaceData

type NamespaceData struct {
	Name      string            // Namespace name (filename without .star)
	FilePath  string            // Absolute path to .star file
	Functions []FunctionSummary // Exported functions
}

NamespaceData represents a macro namespace (one .star file).

type ViewData

type ViewData struct {
	Namespaces       []NamespaceData
	SelectedFunction *FunctionDetail
}

ViewData holds data for the macros catalog page.

Jump to

Keyboard shortcuts

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