agenttrace

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agenttrace manages AI coding agent trace checkpoints, events, and developer takeover briefs.

Index

Constants

View Source
const (
	NextDeployTraceDir = ".nextdeploy/trace"
	LegacyHandoffDir   = ".handoff"
	CheckpointFile     = "checkpoint.json"
	EventsFile         = "events.json"
	TakeoverFile       = "takeover.md"
	LatestBriefFile    = "latest.md"
)

Variables

This section is empty.

Functions

func DetectHandoff

func DetectHandoff(projectDir string) bool

DetectHandoff checks if either .nextdeploy/trace or .handoff exists.

func DetectTrace

func DetectTrace(projectDir string) bool

DetectTrace returns true if an active trace directory exists in the workspace.

func EnsureTraceDir

func EnsureTraceDir(projectDir string) (string, error)

EnsureTraceDir ensures the trace directory exists, preferring .nextdeploy/trace.

func GenerateTakeoverBrief

func GenerateTakeoverBrief(projectDir string) (string, error)

GenerateTakeoverBrief returns the scannable takeover brief markdown.

func GetGitBranch

func GetGitBranch(projectDir string) (string, error)

GetGitBranch returns the current active git branch.

func GetGitModifiedFiles

func GetGitModifiedFiles(projectDir string) ([]string, error)

GetGitModifiedFiles parses `git status --porcelain` to return changed file paths.

func GetTraceDir

func GetTraceDir(projectDir string) string

GetTraceDir resolves the active trace directory (.nextdeploy/trace or .handoff).

func OpenTakeoverInEditor

func OpenTakeoverInEditor(projectDir string, editorOverride string) error

OpenTakeoverInEditor launches $EDITOR with all modified files.

func RecordEvent

func RecordEvent(projectDir string, event HandoffEvent) error

RecordEvent appends an infrastructure event to events.json.

func SaveCheckpoint

func SaveCheckpoint(projectDir string, cp HandoffCheckpoint) error

SaveCheckpoint snapshots current agent intent, model, and git modified files.

func StartTraceUI

func StartTraceUI(projectDir string, port int) error

StartTraceUI launches the embedded local dashboard on the specified port.

func UpdateTakeoverBrief

func UpdateTakeoverBrief(projectDir string, target, environment, status, liveURL string, deployErr error) error

UpdateTakeoverBrief appends or updates deployment status section in takeover.md and latest.md.

Types

type DeploymentProvenance

type DeploymentProvenance struct {
	SessionID string `json:"session_id,omitempty"`
	Agent     string `json:"agent,omitempty"`
	Model     string `json:"model,omitempty"`
	Objective string `json:"objective,omitempty"`
}

DeploymentProvenance is embedded into release metadata or logs to track which agent session built it.

type HandoffCheckpoint

type HandoffCheckpoint struct {
	SessionID      string    `json:"session_id"`
	Agent          string    `json:"agent"`
	Model          string    `json:"model"`
	Objective      string    `json:"objective"`
	Timestamp      time.Time `json:"timestamp"`
	ModifiedFiles  []string  `json:"modified_files,omitempty"`
	LastCommand    string    `json:"last_command,omitempty"`
	LastExitCode   int       `json:"last_exit_code,omitempty"`
	UnfinishedWork string    `json:"unfinished_work,omitempty"`
}

HandoffCheckpoint mirrors the schema generated by Handoff (.handoff/checkpoint.json).

func ReadLatestCheckpoint

func ReadLatestCheckpoint(projectDir string) (*HandoffCheckpoint, error)

ReadLatestCheckpoint reads and parses checkpoint.json from the active trace directory.

type HandoffEvent

type HandoffEvent struct {
	Type        string    `json:"type"` // e.g. "nextdeploy_ship_start", "nextdeploy_build_error", "nextdeploy_ship_success", "nextdeploy_probe_failure"
	Timestamp   time.Time `json:"timestamp"`
	Source      string    `json:"source"`                // "nextdeploy"
	Target      string    `json:"target,omitempty"`      // "vps", "cloudflare", "aws"
	Environment string    `json:"environment,omitempty"` // "production", "preview"
	Details     string    `json:"details,omitempty"`
	LiveURL     string    `json:"live_url,omitempty"`
	ErrorCode   string    `json:"error_code,omitempty"`
	ErrorMsg    string    `json:"error_msg,omitempty"`
	Route       string    `json:"route,omitempty"`
	FixHint     string    `json:"fix_hint,omitempty"`
}

HandoffEvent represents an event record appended to .handoff/events.json.

func ReadEvents

func ReadEvents(projectDir string) ([]HandoffEvent, error)

ReadEvents reads all events from events.json in the trace directory.

Jump to

Keyboard shortcuts

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