Documentation
¶
Index ¶
- Constants
- Variables
- func Execute(args []string) error
- func NewRootCmd() *cobra.Command
- func OutputList[T any](app *App, ctx context.Context, items []T, emptyMessage string, ...) error
- func WithApp(ctx context.Context, app *App) context.Context
- type App
- func (a *App) AccountIDList() []string
- func (a *App) AccountParams() url.Values
- func (a *App) AddAccountIDs(params url.Values)
- func (a *App) AgentHandlesEnabled(ctx context.Context) bool
- func (a *App) Backend() string
- func (a *App) BaseURL() string
- func (a *App) Client(ctx context.Context) (*api.Client, error)
- func (a *App) ColorEnabled(ctx context.Context) bool
- func (a *App) Confirm(prompt string) (bool, error)
- func (a *App) IsAgentOutput(ctx context.Context) bool
- func (a *App) IsTextLikeOutput(ctx context.Context) bool
- func (a *App) IsTextOutput(ctx context.Context) bool
- func (a *App) Output(ctx context.Context, data any, textFn func(io.Writer)) error
- func (a *App) OutputEvent(ctx context.Context, data any, textFn func(io.Writer)) error
- func (a *App) OutputFormat(ctx context.Context) string
- func (a *App) OutputTextf(ctx context.Context, data any, format string, args ...any) error
- func (a *App) ProgressWriter(ctx context.Context) io.Writer
- func (a *App) ReadBackend() string
- func (a *App) RecordChatHandles(ctx context.Context, chats []api.Chat)
- func (a *App) RecordContactHandles(ctx context.Context, chats []api.Chat)
- func (a *App) RecordInboxHandles(ctx context.Context, items []domain.InboxItem)
- func (a *App) RecordMessageHandles(ctx context.Context, messages []api.Message)
- func (a *App) ResolveAlias(ctx context.Context, client *api.Client, input string) (string, error)
- func (a *App) ResolveChatByName(ctx context.Context, client *api.Client, name string, ...) (string, error)
- func (a *App) ResolveChatHandle(ctx context.Context, ref cli.HandleRef) (string, error)
- func (a *App) ResolveChatIDFromArgOrFlag(ctx context.Context, client *api.Client, args []string, name, label string, ...) (string, error)
- func (a *App) ResolveChatIDFromFlags(ctx context.Context, client *api.Client, name, chatID, nameFlag, idFlag string, ...) (string, error)
- func (a *App) ResolveMessageHandle(ctx context.Context, ref cli.HandleRef) (string, string, error)
- func (a *App) Table(ctx context.Context, w io.Writer, headers []string) *outfmt.TableWriter
- type ChatLight
- type Config
- type InboxItem
- type InboxItemLight
- type MessageLight
Constants ¶
const ( BackendAPI = backend.BackendAPI BackendDB = backend.BackendDB BackendAuto = backend.BackendAuto )
Backend mode constants define how commands fetch data.
BackendAPI: Commands fetch data exclusively from the Beeper Desktop API. If the API is unavailable, commands fail with an error.
BackendDB: Commands fetch data exclusively from the local SQLite database. This mode works offline but data may be stale (last synced when Beeper Desktop was running). Some features are not available in DB mode (pagination, muted/pinned filters, etc.).
BackendAuto (default): Commands try the API first, then automatically fall back to the local database if:
- The API client cannot be created (network issues, API unavailable)
- The API call returns an error
- The API returns empty results
Fallback only occurs when the query can be satisfied by the DB. Commands with API-only features (pagination cursor, direction, inbox filter, etc.) disable fallback automatically.
When fallback occurs, a message is printed to stderr indicating the reason and that DB data is being used. If WarnStale is enabled on the FallbackOptions, an additional warning notes that data may be stale.
Variables ¶
var ( Version = "dev" Commit = "unknown" BuildDate = "unknown" )
These are set via ldflags during build
Functions ¶
func NewRootCmd ¶
func OutputList ¶ added in v0.1.7
Types ¶
type App ¶ added in v0.1.7
type App struct {
Config Config
In io.Reader
Out io.Writer
Err io.Writer
// contains filtered or unexported fields
}
func AppFromContext ¶ added in v0.1.7
func (*App) AccountIDList ¶ added in v0.2.5
func (*App) AccountParams ¶ added in v0.1.7
func (*App) AddAccountIDs ¶ added in v0.1.7
func (*App) AgentHandlesEnabled ¶ added in v0.2.5
func (*App) IsTextLikeOutput ¶ added in v0.2.3
func (*App) OutputEvent ¶ added in v0.1.7
func (*App) OutputTextf ¶ added in v0.1.7
func (*App) ProgressWriter ¶ added in v0.1.7
ProgressWriter returns stderr when JSON output is requested to keep stdout clean.
func (*App) ReadBackend ¶ added in v0.2.8
ReadBackend returns the preferred backend for read-only operations. Defaults to Auto (tries DB first for speed, falls back to API when needed). Respects --source flag when explicitly set.
func (*App) RecordChatHandles ¶ added in v0.2.5
func (*App) RecordContactHandles ¶ added in v0.2.5
func (*App) RecordInboxHandles ¶ added in v0.2.5
func (*App) RecordMessageHandles ¶ added in v0.2.5
func (*App) ResolveAlias ¶ added in v0.2.1
func (*App) ResolveChatByName ¶ added in v0.1.7
func (*App) ResolveChatHandle ¶ added in v0.2.5
func (*App) ResolveChatIDFromArgOrFlag ¶ added in v0.1.7
func (*App) ResolveChatIDFromFlags ¶ added in v0.1.7
func (*App) ResolveMessageHandle ¶ added in v0.2.5
type ChatLight ¶ added in v0.2.13
type ChatLight struct {
ID string `json:"id"` // chat id
Title string `json:"ti"` // title
Network string `json:"nw"` // network
Type string `json:"ty"` // dm|group
UnreadCount int `json:"ur"` // unread count
LastActivity time.Time `json:"ts"` // last activity timestamp
Preview string `json:"pv,omitempty"` // preview text
}
ChatLight is a minimal chat payload for list/search commands.
func ToChatLight ¶ added in v0.2.13
ToChatLight converts a full Chat to a light representation.
func ToChatLightSlice ¶ added in v0.2.13
ToChatLightSlice converts a slice of full chats to light representations.
type InboxItemLight ¶ added in v0.2.13
type InboxItemLight struct {
ChatID string `json:"ch"` // chat id
ChatTitle string `json:"ti"` // chat title
Sender string `json:"sn"` // sender
Message string `json:"tx"` // message text
Timestamp time.Time `json:"ts"` // timestamp
}
InboxItemLight is a minimal inbox item payload.
func ToInboxItemLight ¶ added in v0.2.13
func ToInboxItemLight(item domain.InboxItem) InboxItemLight
ToInboxItemLight converts a full InboxItem to a light representation.
func ToInboxItemLightSlice ¶ added in v0.2.13
func ToInboxItemLightSlice(items []domain.InboxItem) []InboxItemLight
ToInboxItemLightSlice converts a slice of full inbox items to light representations.
type MessageLight ¶ added in v0.2.13
type MessageLight struct {
ID string `json:"id"` // message id
ChatID string `json:"ch"` // chat id
Sender string `json:"sn"` // sender
Text string `json:"tx"` // text
Timestamp time.Time `json:"ts"` // timestamp
IsMe bool `json:"me"` // sent by me
}
MessageLight is a minimal message payload for list/search commands.
func ToMessageLight ¶ added in v0.2.13
func ToMessageLight(m api.Message) MessageLight
ToMessageLight converts a full Message to a light representation.
func ToMessageLightSlice ¶ added in v0.2.13
func ToMessageLightSlice(msgs []api.Message) []MessageLight
ToMessageLightSlice converts a slice of full messages to light representations.
Source Files
¶
- accounts.go
- agent.go
- agent_smoke.go
- agent_state.go
- agent_state_cmd.go
- agent_tools.go
- agent_tools_schema.go
- alias.go
- app.go
- assets.go
- auth.go
- backend.go
- chats.go
- client.go
- clock.go
- completion.go
- completions.go
- config.go
- contacts.go
- db_helpers.go
- doctor.go
- examples.go
- filters.go
- focus.go
- handles_cmd.go
- ids.go
- inbox.go
- inbox_db.go
- light.go
- light_policy.go
- limits.go
- messages.go
- messages_db.go
- messages_edit.go
- output.go
- output_messages.go
- profiles.go
- reminders.go
- root.go
- schema.go
- shortcuts.go
- time_parse.go
- trace.go
- validate.go
- version.go