Documentation
¶
Overview ¶
Package agenttrace manages AI coding agent trace checkpoints, events, and developer takeover briefs.
Index ¶
- Constants
- func DetectHandoff(projectDir string) bool
- func DetectTrace(projectDir string) bool
- func EnsureTraceDir(projectDir string) (string, error)
- func GenerateTakeoverBrief(projectDir string) (string, error)
- func GetGitBranch(projectDir string) (string, error)
- func GetGitModifiedFiles(projectDir string) ([]string, error)
- func GetTraceDir(projectDir string) string
- func OpenTakeoverInEditor(projectDir string, editorOverride string) error
- func RecordEvent(projectDir string, event HandoffEvent) error
- func SaveCheckpoint(projectDir string, cp HandoffCheckpoint) error
- func StartTraceUI(projectDir string, port int) error
- func UpdateTakeoverBrief(projectDir string, target, environment, status, liveURL string, ...) error
- type DeploymentProvenance
- type HandoffCheckpoint
- type HandoffEvent
Constants ¶
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 ¶
DetectHandoff checks if either .nextdeploy/trace or .handoff exists.
func DetectTrace ¶
DetectTrace returns true if an active trace directory exists in the workspace.
func EnsureTraceDir ¶
EnsureTraceDir ensures the trace directory exists, preferring .nextdeploy/trace.
func GenerateTakeoverBrief ¶
GenerateTakeoverBrief returns the scannable takeover brief markdown.
func GetGitBranch ¶
GetGitBranch returns the current active git branch.
func GetGitModifiedFiles ¶
GetGitModifiedFiles parses `git status --porcelain` to return changed file paths.
func GetTraceDir ¶
GetTraceDir resolves the active trace directory (.nextdeploy/trace or .handoff).
func OpenTakeoverInEditor ¶
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 ¶
StartTraceUI launches the embedded local dashboard on the specified port.
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.