glance

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSince

func GetSince(ledgerPath string) time.Time

GetSince returns the last checkpoint for the given ledger path, or falls back to 4 hours ago.

func IsEscalating

func IsEscalating(points []VelocityPoint, minPoints int) bool

IsEscalating returns true if the last N velocity points show increasing conflict density. Requires at least minPoints consecutive increases.

func MarkRead

func MarkRead(ledgerPath string) error

MarkRead saves the current time as the checkpoint for the given ledger.

func ParseTimeFlag

func ParseTimeFlag(s string) (time.Time, error)

ParseTimeFlag parses a --since or --until flag value into a time.Time. Accepts: "3d", "7d", "24h", "1w", or RFC3339/date strings.

Types

type Action

type Action struct {
	Text   string   `json:"text"`   // what to do
	Risk   string   `json:"risk"`   // high, medium, low
	Files  []string `json:"files"`  // affected files
	People []string `json:"people"` // people to coordinate with
}

Action is a concrete recommendation the user should act on.

type ActivityData

type ActivityData struct {
	Actions   []Action        `json:"actions,omitempty"`
	Headline  string          `json:"headline"`
	Guidance  string          `json:"guidance,omitempty"`
	Since     time.Time       `json:"since"`
	Until     time.Time       `json:"until"`
	Repo      string          `json:"repo"`
	Authors   []AuthorSummary `json:"authors"`
	Conflicts []FileOverlap   `json:"conflicts"`
	Overlap   []OverlapPair   `json:"overlap_matrix"`
	Stats     Stats           `json:"stats"`
	Patterns  []Pattern       `json:"patterns,omitempty"`
	Velocity  []VelocityPoint `json:"velocity,omitempty"`
}

ActivityData is the full JSON output.

func (*ActivityData) Enrich

func (d *ActivityData) Enrich()

Enrich populates computed presentation fields: actions, headline, guidance, time_ago.

type AuthorSummary

type AuthorSummary struct {
	Name         string          `json:"name"`
	MurmurCount  int             `json:"murmur_count"`
	SessionCount int             `json:"session_count,omitempty"`
	FilesTouched int             `json:"files_touched"`
	WIPStatus    string          `json:"wip_status,omitempty"` // latest WIP murmur content
	Murmurs      []MurmurRecord  `json:"murmurs"`
	Sessions     []SessionRecord `json:"sessions,omitempty"`
}

AuthorSummary groups murmurs and sessions by author.

func GroupByAuthor

func GroupByAuthor(murmurs []MurmurRecord, sessions ...[]SessionRecord) []AuthorSummary

GroupByAuthor groups murmurs and sessions by author, sorted by most recent activity. WIPStatus is set to the latest WIP murmur's content for each author. FilesTouched counts unique files from file-change murmurs and session tool calls.

type ConflictReport

type ConflictReport struct {
	Overlaps     []FileOverlap
	ByAuthorPair map[string]int // "alice|bob" → overlap count
	TotalFiles   int
}

ConflictReport is the internal result of conflict detection.

func DetectConflicts

func DetectConflicts(sessions []MurmurRecord) *ConflictReport

DetectConflicts builds a file-level overlap report from murmurs. A conflict is any file touched by 2+ distinct authors.

func (*ConflictReport) OverlapPairs

func (r *ConflictReport) OverlapPairs() []OverlapPair

OverlapPairs converts the internal author-pair map to a sorted slice.

type FileOverlap

type FileOverlap struct {
	FilePath string              `json:"file"`
	Authors  map[string][]string `json:"authors"` // author → []murmur IDs
}

FileOverlap represents a file touched by multiple authors.

type HarvestResult

type HarvestResult struct {
	Murmurs []MurmurRecord
}

HarvestResult contains the harvested murmurs.

func HarvestMurmurs added in v0.6.1

func HarvestMurmurs(ledgerPath string, since, until time.Time) (*HarvestResult, error)

HarvestMurmurs reads murmurs from the ledger between since and until, extracts file paths from Metadata["files"], and converts to MurmurRecords.

type HarvestSessionResult added in v0.6.1

type HarvestSessionResult struct {
	Sessions          []SessionRecord
	SkippedDehydrated int
}

HarvestSessionResult contains the harvested sessions plus metadata.

func HarvestSessions

func HarvestSessions(ledgerPath string, since, until time.Time) (*HarvestSessionResult, error)

HarvestSessions reads sessions from the ledger and extracts files touched from summary.json and raw.jsonl tool calls.

type MurmurRecord added in v0.6.1

type MurmurRecord struct {
	ID         string    `json:"id"`
	User       string    `json:"user"` // PrincipalID
	AgentID    string    `json:"agent_id"`
	Topic      string    `json:"topic"`
	Time       time.Time `json:"time"`
	TimeAgo    string    `json:"time_ago,omitempty"`
	Content    string    `json:"content"`
	Files      []string  `json:"files,omitempty"`  // from Metadata["files"] (file-changes only)
	Branch     string    `json:"branch,omitempty"` // from Metadata["branch"] (file-changes only)
	Importance string    `json:"importance"`
}

MurmurRecord represents a single murmur with its associated file paths. Two flavors exist:

  • topic="wip": AI coworker intent signal, free-text content, no Files
  • topic="file-changes": daemon filesystem observation, structured content, has Files+Branch+Worktree

func SessionFilesToMurmurRecords added in v0.6.1

func SessionFilesToMurmurRecords(sessions []SessionRecord) []MurmurRecord

SessionFilesToMurmurRecords converts session file touches into synthetic MurmurRecords so they can be fed into DetectConflicts alongside real murmurs.

type OverlapPair

type OverlapPair struct {
	Pair        [2]string `json:"pair"`
	SharedFiles int       `json:"shared_files"`
}

OverlapPair is a serializable author-pair overlap entry.

type Pattern

type Pattern struct {
	Type    string   `json:"type"`    // cluster_bridge, hot_file, solo_silo
	Authors []string `json:"authors"` // involved developers
	Files   []string `json:"files"`   // involved files
	Detail  string   `json:"detail"`  // human-readable explanation
	Risk    string   `json:"risk"`    // low, medium, high
}

Pattern represents a detected collaboration pattern.

func DetectPatterns

func DetectPatterns(sessions []MurmurRecord) []Pattern

DetectPatterns identifies collaboration patterns from murmur data. Uses file paths and usernames from murmur metadata.

type SessionRecord

type SessionRecord struct {
	Name      string    `json:"name"`
	User      string    `json:"user"`
	Time      time.Time `json:"time"`
	TimeAgo   string    `json:"time_ago,omitempty"`
	Title     string    `json:"title"`
	Summary   string    `json:"summary,omitempty"`
	Files     []string  `json:"files,omitempty"`
	Recording bool      `json:"recording,omitempty"`
}

SessionRecord represents a session with its associated file paths. Extracted from raw.jsonl tool calls (Edit/Write/MultiEdit) and/or summary.json.

type Stats

type Stats struct {
	TotalMurmurs    int `json:"total_murmurs"`
	TotalSessions   int `json:"total_sessions,omitempty"`
	TotalAuthors    int `json:"total_authors"`
	TotalConflicts  int `json:"total_conflicts"`
	WIPCount        int `json:"wip_count"`
	FileChangeCount int `json:"file_change_count"`
}

Stats contains summary statistics.

type VelocityPoint

type VelocityPoint struct {
	Window    time.Time `json:"window"`    // start of time slice
	Conflicts int       `json:"conflicts"` // number of file conflicts in this slice
	Murmurs   int       `json:"murmurs"`   // number of murmurs in this slice
	Density   float64   `json:"density"`   // conflicts per murmur (0 if none)
}

VelocityPoint represents conflict density at a single time slice.

func ConflictVelocity

func ConflictVelocity(sessions []MurmurRecord, since, until time.Time, sliceWidth, step time.Duration) []VelocityPoint

ConflictVelocity computes conflict density over sliding time windows. sliceWidth is the duration of each window; step is how far to advance between windows. For example, sliceWidth=24h step=24h gives daily non-overlapping buckets.

Jump to

Keyboard shortcuts

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