feedback

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package feedback implements local journaling and opt-in upstream POST for the `vers feedback` command (F18 Phase A).

Storage is an append-only JSONL file at ~/.vers/feedback.jsonl by default. Upstream delivery is opt-in via the VERS_FEEDBACK_ENDPOINT env var; when set, each new entry is POSTed best-effort with a 5s timeout.

Index

Constants

View Source
const EndpointEnvVar = "VERS_FEEDBACK_ENDPOINT"

EndpointEnvVar is the env var used to enable upstream POST.

View Source
const PathEnvVar = "VERS_FEEDBACK_PATH"

PathEnvVar overrides the default journal path. Primarily for tests.

Variables

This section is empty.

Functions

func Append

func Append(path string, e Entry) error

Append writes an entry as a single JSON line to path, creating parent directories as needed.

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the default journal path (~/.vers/feedback.jsonl), honoring VERS_FEEDBACK_PATH when set.

func NewID

func NewID() (string, error)

NewID returns a short random base32 identifier (10 chars, lowercase, no padding). Used as the entry id.

func Now

func Now() string

Now returns the current time as an RFC3339 string in UTC.

func PostUpstream

func PostUpstream(ctx context.Context, endpoint string, e Entry) (int, error)

PostUpstream POSTs the entry payload to endpoint as application/json with a 5s timeout. It returns the HTTP status code on success. On any failure (transport, non-2xx) it returns a non-nil error along with the status code (0 if the request never completed).

Types

type Entry

type Entry struct {
	ID           string `json:"id"`
	Timestamp    string `json:"timestamp"`
	VersVersion  string `json:"vers_version"`
	Message      string `json:"message"`
	SentUpstream bool   `json:"sent_upstream"`
}

Entry is one record in the local JSONL journal.

func ReadAll

func ReadAll(path string) ([]Entry, error)

ReadAll loads every entry from the journal, oldest first. A missing file returns an empty slice and no error.

Jump to

Keyboard shortcuts

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