cmd

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Functions

func Execute

func Execute() error

func LaunchInNewTerminal

func LaunchInNewTerminal(worktree, sessionID string) error

LaunchInNewTerminal launches claude in a new terminal window/tab

Types

type ClaudeSettings

type ClaudeSettings struct {
	Hooks map[string][]HookConfig `json:"hooks"`
}

type DiscoveredSession

type DiscoveredSession struct {
	SessionID      string
	SessionName    string // Claude Code's auto-generated name (slug)
	TranscriptPath string
	ProjectPath    string // The actual project directory
	ProjectHash    string // The hash used in ~/.claude/projects/
	LastModified   time.Time
	MessageCount   int
	IsRegistered   bool
}

type Hook

type Hook struct {
	Type    string `json:"type"`
	Command string `json:"command"`
}

type HookConfig

type HookConfig struct {
	Matcher string `json:"matcher,omitempty"`
	Hooks   []Hook `json:"hooks"`
}

type LiveStatus

type LiveStatus struct {
	Context       *model.Context
	SessionStatus SessionStatus
	LastActivity  time.Time
	LastRole      string
}

type MatchedLine

type MatchedLine struct {
	LineNum int
	Role    string
	Content string
}

type SearchResult

type SearchResult struct {
	SessionID      string
	TranscriptPath string
	ProjectPath    string
	Matches        []MatchedLine
	LastModified   time.Time
}

type SessionEndInput

type SessionEndInput struct {
	SessionID      string `json:"session_id"`
	TranscriptPath string `json:"transcript_path"`
	Cwd            string `json:"cwd"`
	Reason         string `json:"reason"` // "exit", "timeout", etc.
}

type SessionStartInput

type SessionStartInput struct {
	SessionID      string `json:"session_id"`
	TranscriptPath string `json:"transcript_path"`
	Cwd            string `json:"cwd"`
	Source         string `json:"source"` // "startup", "resume", "clear"
}

type SessionStatus

type SessionStatus string
const (
	SessionStatusActive  SessionStatus = "active"  // Recently updated (< 30s)
	SessionStatusIdle    SessionStatus = "idle"    // Not recently updated (> 30s)
	SessionStatusWaiting SessionStatus = "waiting" // Last message was from assistant
	SessionStatusOffline SessionStatus = "offline" // No transcript or very old
)

type TranscriptMessage

type TranscriptMessage struct {
	Type      string    `json:"type"`
	Role      string    `json:"role,omitempty"`
	Content   string    `json:"content,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty"`
	SessionID string    `json:"sessionId,omitempty"`
}

type UpdateCache added in v0.2.1

type UpdateCache struct {
	LastCheckedAt   time.Time `yaml:"last_checked_at"`
	LatestVersion   string    `yaml:"latest_version"`
	CheckedOK       bool      `yaml:"checked_ok"`       // API成功ならtrue
	NotifiedVersion string    `yaml:"notified_version"` // 最後に通知したバージョン
}

UpdateCache はアップデート確認結果のキャッシュ。

type UpdateChecker added in v0.2.1

type UpdateChecker struct {
	CurrentVersion string        // 現在のバージョン(例: "v0.2.0")
	CachePath      string        // キャッシュファイルパス
	APIURL         string        // GitHub API URL(テスト用に差し替え可能)
	SuccessTTL     time.Duration // 成功時キャッシュ TTL(デフォルト 24h)
	FailureTTL     time.Duration // 失敗時キャッシュ TTL(デフォルト 1h)
}

UpdateChecker はアップデートの確認とキャッシュ管理を行う。

func (*UpdateChecker) CheckAndCache added in v0.2.1

func (uc *UpdateChecker) CheckAndCache() (*UpdateCache, error)

CheckAndCache は最新バージョンを取得してキャッシュに保存する。 失敗時も既知の LatestVersion を保持する。

func (*UpdateChecker) FetchLatestVersion added in v0.2.1

func (uc *UpdateChecker) FetchLatestVersion() (string, error)

FetchLatestVersion は APIURL から最新バージョンを取得する。

func (*UpdateChecker) IsNewer added in v0.2.1

func (uc *UpdateChecker) IsNewer(latest, current string) bool

IsNewer は latest が current より新しいかどうかを判定する。 current が "dev" の場合は false を返す(開発ビルドでは通知しない)。

func (*UpdateChecker) IsStale added in v0.2.1

func (uc *UpdateChecker) IsStale(cache *UpdateCache) bool

IsStale はキャッシュが期限切れかどうかを判定する。 成功時は SuccessTTL、失敗時は FailureTTL で判定する。

func (*UpdateChecker) LoadCache added in v0.2.1

func (uc *UpdateChecker) LoadCache() (*UpdateCache, error)

LoadCache はキャッシュファイルを読み込む。ファイルが存在しない場合は空のキャッシュを返す。

func (*UpdateChecker) NotifyMessage added in v0.2.1

func (uc *UpdateChecker) NotifyMessage(latest string) string

NotifyMessage はアップデート通知メッセージを返す。

func (*UpdateChecker) SaveCache added in v0.2.1

func (uc *UpdateChecker) SaveCache(cache *UpdateCache) error

SaveCache はキャッシュをファイルに保存する。

func (*UpdateChecker) ShouldNotify added in v0.2.1

func (uc *UpdateChecker) ShouldNotify(cache *UpdateCache) bool

ShouldNotify はキャッシュの内容に基づいて通知すべきかを判定する。 新しいバージョンが存在し、かつそのバージョンについてまだ通知していない場合に true。

Jump to

Keyboard shortcuts

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