commands

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaudeDir

func ClaudeDir() string

ClaudeDir returns the configured claude directory path.

func Execute

func Execute(v, c, d string) error

Execute runs the root command with injected build info.

Types

type AmputateOutput added in v0.5.1

type AmputateOutput struct {
	SessionID      string `json:"session_id"`
	Slug           string `json:"slug,omitempty"`
	From           int    `json:"from"`
	To             int    `json:"to"`
	EntriesRemoved int    `json:"entries_removed"`
	TokensSaved    int    `json:"tokens_saved"`
	ChainRepairs   int    `json:"chain_repairs"`
	DryRun         bool   `json:"dry_run"`
}

AmputateOutput is the JSON output for the amputate command.

type ArchaeologyJSON added in v0.4.0

type ArchaeologyJSON struct {
	Events []CompactionArchJSON `json:"events"`
}

ArchaeologyJSON holds compaction archaeology for JSON output.

type CleanOpJSON added in v0.3.0

type CleanOpJSON struct {
	Type            string `json:"type"`
	EntriesAffected int    `json:"entries_affected"`
	TokensSaved     int    `json:"tokens_saved,omitempty"`
	BytesSaved      int64  `json:"bytes_saved,omitempty"`
}

CleanOpJSON describes a single cleanup operation.

type CleanOutput added in v0.3.0

type CleanOutput struct {
	SessionID  string           `json:"session_id"`
	Slug       string           `json:"slug,omitempty"`
	Mode       string           `json:"mode,omitempty"`
	Operations []CleanOpJSON    `json:"operations"`
	Summary    CleanSummaryJSON `json:"summary"`
}

CleanOutput is the JSON output for the clean command.

type CleanSummaryJSON added in v0.3.0

type CleanSummaryJSON struct {
	EntriesRemoved  int   `json:"entries_removed"`
	EntriesModified int   `json:"entries_modified"`
	TokensSaved     int   `json:"tokens_saved"`
	BytesSaved      int64 `json:"bytes_saved"`
}

CleanSummaryJSON holds the combined cleanup results.

type CleanupItemJSON added in v0.4.0

type CleanupItemJSON struct {
	Category    string `json:"category"`
	Label       string `json:"label"`
	Count       int    `json:"count"`
	TokensSaved int    `json:"tokens_saved"`
	TurnsGained int    `json:"turns_gained"`
}

CleanupItemJSON is a single cleanup recommendation item.

type CollapseOutput added in v0.4.6

type CollapseOutput struct {
	SessionID       string `json:"session_id"`
	CommitPointUUID string `json:"commit_point_uuid"`
	EntriesRemoved  int    `json:"entries_removed"`
	ChainRepairs    int    `json:"chain_repairs"`
	BytesSaved      int64  `json:"bytes_saved"`
	DryRun          bool   `json:"dry_run,omitempty"`
}

CollapseOutput is the JSON output for the collapse command.

type CompSummaryJSON added in v0.4.0

type CompSummaryJSON struct {
	SummaryText      string  `json:"summary_text"`
	SummaryCharCount int     `json:"summary_char_count"`
	CompressionRatio float64 `json:"compression_ratio"`
}

CompSummaryJSON holds post-compaction summary.

type CompactionArchJSON added in v0.4.0

type CompactionArchJSON struct {
	CompactionIndex int              `json:"compaction_index"`
	LineIndex       int              `json:"line_index"`
	Before          EpochSummaryJSON `json:"before"`
	After           CompSummaryJSON  `json:"after"`
}

CompactionArchJSON is a single compaction's archaeology data.

type CompactionJSON added in v0.3.0

type CompactionJSON struct {
	LineIndex  int `json:"line_index"`
	FromTokens int `json:"from_tokens"`
	ToTokens   int `json:"to_tokens"`
	TokensDrop int `json:"tokens_drop"`
}

CompactionJSON is a single compaction event.

type CompactionsJSON added in v0.3.0

type CompactionsJSON struct {
	Count  int              `json:"count"`
	Events []CompactionJSON `json:"events,omitempty"`
}

CompactionsJSON holds compaction info.

type CompanionCheck added in v0.3.0

type CompanionCheck struct {
	Name      string `json:"name"`
	Available bool   `json:"available"`
	Path      string `json:"path,omitempty"`
}

CompanionCheck holds info about a companion tool.

type ContextJSON added in v0.3.0

type ContextJSON struct {
	Tokens         int     `json:"tokens"`
	Percent        float64 `json:"percent"`
	Window         int     `json:"window"`
	TurnsRemaining int     `json:"turns_remaining"`
}

ContextJSON holds context usage info.

type CostJSON added in v0.4.0

type CostJSON struct {
	Model            string  `json:"model,omitempty"`
	TotalCost        float64 `json:"total_cost"`
	CostPerTurn      float64 `json:"cost_per_turn"`
	InputCost        float64 `json:"input_cost"`
	OutputCost       float64 `json:"output_cost"`
	CacheWriteCost   float64 `json:"cache_write_cost"`
	CacheReadCost    float64 `json:"cache_read_cost"`
	InputTokens      int     `json:"input_tokens"`
	OutputTokens     int     `json:"output_tokens"`
	CacheWriteTokens int     `json:"cache_write_tokens"`
	CacheReadTokens  int     `json:"cache_read_tokens"`
	TurnCount        int     `json:"turn_count"`
}

CostJSON holds session cost attribution.

type DoctorCheck added in v0.3.0

type DoctorCheck struct {
	Status  string `json:"status"` // "ok", "warn", "error"
	Message string `json:"message"`
	Detail  string `json:"detail,omitempty"`
}

DoctorCheck holds a single health check result.

type DoctorOutput added in v0.3.0

type DoctorOutput struct {
	Version    string           `json:"version"`
	Platform   string           `json:"platform"`
	ClaudeDir  DoctorCheck      `json:"claude_dir"`
	Sessions   DoctorCheck      `json:"sessions"`
	Companions []CompanionCheck `json:"companions"`
}

DoctorOutput is the JSON output for the doctor command.

type EpochCostJSON added in v0.4.0

type EpochCostJSON struct {
	EpochIndex int     `json:"epoch_index"`
	TurnCount  int     `json:"turn_count"`
	PeakTokens int     `json:"peak_tokens"`
	TotalCost  float64 `json:"total_cost"`
}

EpochCostJSON holds cost for a single compaction epoch.

type EpochScopeJSON added in v0.4.1

type EpochScopeJSON struct {
	EpochIndex     int            `json:"epoch_index"`
	InScope        int            `json:"in_scope"`
	OutScope       int            `json:"out_scope"`
	OutScopeByRepo map[string]int `json:"out_scope_by_repo,omitempty"`
	DriftRatio     float64        `json:"drift_ratio"`
	DriftCost      float64        `json:"drift_cost"`
}

EpochScopeJSON holds per-epoch scope distribution.

type EpochSummaryJSON added in v0.4.0

type EpochSummaryJSON struct {
	TurnCount       int            `json:"turn_count"`
	TokensPeak      int            `json:"tokens_peak"`
	FilesReferenced []string       `json:"files_referenced"`
	ToolCallCounts  map[string]int `json:"tool_call_counts"`
	UserQuestions   []string       `json:"user_questions,omitempty"`
	DecisionHints   []string       `json:"decision_hints,omitempty"`
}

EpochSummaryJSON holds pre-compaction epoch metadata.

type EpochTimelineJSON added in v0.4.0

type EpochTimelineJSON struct {
	Index         int     `json:"index"`
	TurnCount     int     `json:"turn_count"`
	PeakTokens    int     `json:"peak_tokens"`
	Cost          float64 `json:"cost"`
	Topic         string  `json:"topic"`
	SurvivedChars int     `json:"survived_chars"`
	IsActive      bool    `json:"is_active,omitempty"`
}

EpochTimelineJSON is a unified epoch view for JSON output.

type ExportOutput added in v0.4.7

type ExportOutput struct {
	SessionID        string          `json:"session_id"`
	BranchesExported int             `json:"branches_exported"`
	EntriesExtracted int             `json:"entries_extracted"`
	TokenCost        int             `json:"token_cost"`
	DollarCost       float64         `json:"dollar_cost"`
	OutputPath       string          `json:"output_path"`
	Wiped            bool            `json:"wiped,omitempty"`
	WipeResult       *SplitCleanJSON `json:"wipe_result,omitempty"`
}

ExportOutput is the JSON output for the export command.

type GrowthRateJSON added in v0.3.0

type GrowthRateJSON struct {
	TokensPerTurn       float64 `json:"tokens_per_turn"`
	SinceLastCompaction bool    `json:"since_last_compaction"`
}

GrowthRateJSON holds token growth rate info.

type HealthScoreJSON added in v0.4.4

type HealthScoreJSON struct {
	SignalTokens    int     `json:"signal_tokens"`
	NoiseTokens     int     `json:"noise_tokens"`
	TotalTokens     int     `json:"total_tokens"`
	SignalPercent   float64 `json:"signal_percent"`
	NoisePercent    float64 `json:"noise_percent"`
	Grade           string  `json:"grade"`
	BiggestOffender string  `json:"biggest_offender,omitempty"`
	OffenderTokens  int     `json:"offender_tokens,omitempty"`
}

HealthScoreJSON holds signal/noise health metrics for JSON output.

type ImagesJSON added in v0.3.0

type ImagesJSON struct {
	Count           int   `json:"count"`
	BytesTotal      int64 `json:"bytes_total"`
	EstimatedTokens int   `json:"estimated_tokens"`
}

ImagesJSON holds image stats.

type MarkListOutput added in v0.4.5

type MarkListOutput struct {
	Markers map[string]string `json:"markers"`
	Phases  map[string]string `json:"phases,omitempty"`
	Total   int               `json:"total"`
}

MarkListOutput is the JSON output for listing markers.

type MarkOutput added in v0.4.5

type MarkOutput struct {
	UUID   string `json:"uuid"`
	Marker string `json:"marker,omitempty"`
	Phase  string `json:"phase,omitempty"`
	Action string `json:"action"`
}

MarkOutput is the JSON output for a single mark operation.

type MessagesJSON added in v0.3.0

type MessagesJSON struct {
	Total     int `json:"total"`
	User      int `json:"user"`
	Assistant int `json:"assistant"`
	Progress  int `json:"progress"`
	Snapshots int `json:"snapshots"`
	System    int `json:"system"`
}

MessagesJSON holds message type counts.

type OrphanJSON added in v0.3.0

type OrphanJSON struct {
	DirName      string `json:"dir_name"`
	DecodedPath  string `json:"decoded_path"`
	SessionCount int    `json:"session_count"`
}

OrphanJSON is a single orphaned project.

type RecommendationJSON added in v0.4.0

type RecommendationJSON struct {
	Items            []CleanupItemJSON `json:"items"`
	TotalTokens      int               `json:"total_tokens"`
	TotalTurnsGained int               `json:"total_turns_gained"`
	CurrentPercent   float64           `json:"current_percent"`
	ProjectedPercent float64           `json:"projected_percent"`
}

RecommendationJSON holds cleanup recommendations for JSON output.

type RelocateJSON added in v0.3.0

type RelocateJSON struct {
	Plan    *RelocatePlanJSON   `json:"plan,omitempty"`
	Result  *RelocateResultJSON `json:"result,omitempty"`
	Orphans []OrphanJSON        `json:"orphans,omitempty"`
}

RelocateJSON is the JSON output for the relocate command.

type RelocatePlanJSON added in v0.3.0

type RelocatePlanJSON struct {
	OldPath      string `json:"old_path"`
	NewPath      string `json:"new_path"`
	OldDirName   string `json:"old_dir_name"`
	NewDirName   string `json:"new_dir_name"`
	SessionCount int    `json:"session_count"`
	IndexEntries int    `json:"index_entries"`
	OldDirExists bool   `json:"old_dir_exists"`
	NewDirExists bool   `json:"new_dir_exists"`
}

RelocatePlanJSON is the dry-run plan.

type RelocateResultJSON added in v0.3.0

type RelocateResultJSON struct {
	OldDirName    string `json:"old_dir_name"`
	NewDirName    string `json:"new_dir_name"`
	SessionsFound int    `json:"sessions_found"`
	IndexUpdated  bool   `json:"index_updated"`
	CWDUpdated    int    `json:"cwd_updated"`
}

RelocateResultJSON is the result of an applied relocation.

type ScopeDriftJSON added in v0.4.1

type ScopeDriftJSON struct {
	SessionProject string           `json:"session_project"`
	EpochScopes    []EpochScopeJSON `json:"epoch_scopes"`
	TangentSeqs    []TangentSeqJSON `json:"tangent_sequences,omitempty"`
	TotalInScope   int              `json:"total_in_scope"`
	TotalOutScope  int              `json:"total_out_scope"`
	OverallDrift   float64          `json:"overall_drift"`
}

ScopeDriftJSON holds scope drift analysis for JSON output.

type SessionJSON added in v0.3.0

type SessionJSON struct {
	ID             string    `json:"id"`
	Slug           string    `json:"slug,omitempty"`
	Project        string    `json:"project"`
	Branch         string    `json:"branch,omitempty"`
	Messages       int       `json:"messages"`
	Tokens         int       `json:"tokens"`
	ContextPercent float64   `json:"context_percent"`
	Compactions    int       `json:"compactions"`
	FileSizeBytes  int64     `json:"file_size_bytes"`
	LastModified   time.Time `json:"last_modified"`
	Active         bool      `json:"active"`
	Images         int       `json:"images"`
	EstimatedCost  float64   `json:"estimated_cost,omitempty"`
	Model          string    `json:"model,omitempty"`
	SignalPercent  *int      `json:"signal_percent,omitempty"`
}

SessionJSON is the JSON output for a single session.

type SessionsOutput added in v0.3.0

type SessionsOutput struct {
	Sessions []SessionJSON `json:"sessions"`
	Total    int           `json:"total"`
}

SessionsOutput is the JSON output for the sessions command.

type SplitCleanJSON added in v0.4.3

type SplitCleanJSON struct {
	EntriesRemoved int `json:"entries_removed"`
	ChainRepairs   int `json:"chain_repairs"`
}

SplitCleanJSON holds the result of the --clean operation.

type SplitOutput added in v0.4.3

type SplitOutput struct {
	SessionID        string          `json:"session_id"`
	From             int             `json:"from"`
	To               int             `json:"to"`
	EntriesExtracted int             `json:"entries_extracted"`
	TargetRepo       string          `json:"target_repo,omitempty"`
	TokenCost        int             `json:"token_cost"`
	DollarCost       float64         `json:"dollar_cost"`
	ReExplFiles      []string        `json:"re_explanation_files,omitempty"`
	OutputPath       string          `json:"output_path"`
	Cleaned          bool            `json:"cleaned"`
	CleanResult      *SplitCleanJSON `json:"clean_result,omitempty"`
}

SplitOutput is the JSON output for the split command.

type StatsOutput added in v0.3.0

type StatsOutput struct {
	SessionID      string              `json:"session_id"`
	Project        string              `json:"project,omitempty"`
	Context        ContextJSON         `json:"context"`
	Health         *HealthScoreJSON    `json:"health,omitempty"`
	Cost           *CostJSON           `json:"cost,omitempty"`
	EpochCosts     []EpochCostJSON     `json:"epoch_costs,omitempty"`
	Archaeology    *ArchaeologyJSON    `json:"archaeology,omitempty"`
	Compactions    CompactionsJSON     `json:"compactions"`
	Messages       MessagesJSON        `json:"messages"`
	Images         ImagesJSON          `json:"images"`
	GrowthRate     GrowthRateJSON      `json:"growth_rate"`
	Recommendation *RecommendationJSON `json:"recommendation,omitempty"`
	EpochTimeline  []EpochTimelineJSON `json:"epoch_timeline,omitempty"`
	ScopeDrift     *ScopeDriftJSON     `json:"scope_drift,omitempty"`
}

StatsOutput is the JSON output for the stats command.

type TangentSeqJSON added in v0.4.1

type TangentSeqJSON struct {
	StartIdx           int      `json:"start_idx"`
	EndIdx             int      `json:"end_idx"`
	TargetRepo         string   `json:"target_repo"`
	TokenCost          int      `json:"token_cost"`
	DollarCost         float64  `json:"dollar_cost"`
	ReExplanationFiles []string `json:"re_explanation_files,omitempty"`
}

TangentSeqJSON holds a contiguous out-of-scope tangent sequence.

Jump to

Keyboard shortcuts

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