cmd

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 55 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmd implements all td CLI commands using cobra.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFeatureGatedCommand added in v0.30.0

func AddFeatureGatedCommand(featureName string, command *cobra.Command)

AddFeatureGatedCommand registers a command only when its feature is enabled for the current process (env overrides + defaults).

func AutoSyncEnabled added in v0.30.0

func AutoSyncEnabled() bool

AutoSyncEnabled returns true if auto-sync is enabled via config.

func Execute

func Execute()

func RegisterSyncFeatureHooks added in v0.30.0

func RegisterSyncFeatureHooks(hooks SyncFeatureHooks)

RegisterSyncFeatureHooks registers sync-related hooks.

func SetVersion

func SetVersion(v string)

SetVersion sets the version string and enables --version flag

func ValidateIssueID added in v0.4.21

func ValidateIssueID(id string, cmdUsage string) error

ValidateIssueID checks if an issue ID is valid (non-empty, non-whitespace) Returns an error with helpful usage info if invalid

func ValidateIssueIDs added in v0.4.21

func ValidateIssueIDs(ids []string, cmdUsage string) error

ValidateIssueIDs validates multiple issue IDs

Types

type RuntimeStats added in v0.30.0

type RuntimeStats struct {
	AllocMB      float64 `json:"alloc_mb"`
	SysMB        float64 `json:"sys_mb"`
	NumGC        uint32  `json:"num_gc"`
	NumGoroutine int     `json:"num_goroutine"`
	HeapObjects  uint64  `json:"heap_objects"`
	HeapInuseMB  float64 `json:"heap_inuse_mb"`
}

RuntimeStats contains runtime metrics for soak testing

type SubmitReviewResult added in v0.13.0

type SubmitReviewResult struct {
	Success bool
	Message string
}

SubmitReviewResult holds the result of a review submission

type SyncFeatureHooks added in v0.30.0

type SyncFeatureHooks struct {
	OnStartup         func(commandName string)
	OnAfterMutation   func()
	IsMutatingCommand func(commandName string) bool
}

SyncFeatureHooks exposes optional sync hooks that can be registered by sync-specific command files. These hooks are gated by feature flags.

type SyncStatusReport added in v0.52.0

type SyncStatusReport struct {
	// Gate is the resolved autosync gate state: "ON", "OFF", or "KILLED".
	// It mirrors the real decision (autosyncGateOpen + globalKillSwitchOff) so
	// this never diverges from what autosync actually does.
	Gate string `json:"gate"`
	// GateSource explains WHERE the gate decision came from:
	//   "global-kill-switch"   — global autosync override resolved to false
	//   "explicit-env"         — sync_autosync set explicitly via env var
	//   "explicit-config"      — sync_autosync set explicitly via project config
	//   "derived-per-project"  — no explicit override; per-project config decides
	GateSource string `json:"gate_source"`

	// Configured reports whether the project has a usable sync_state row
	// (present, non-empty ProjectID, not disabled).
	Configured bool   `json:"configured"`
	ProjectID  string `json:"project_id,omitempty"`

	Authenticated bool   `json:"authenticated"`
	ServerURL     string `json:"server_url"`

	// PendingEvents is the count of unsynced action_log rows. -1 means the
	// count could not be determined (e.g. no DB), distinct from a real 0.
	PendingEvents int64  `json:"pending_events"`
	LastSyncAt    string `json:"last_sync_at,omitempty"`

	// Notes carries non-fatal degradation messages (e.g. DB could not be opened)
	// so the diagnostic never hard-errors but still surfaces the problem.
	Notes []string `json:"notes,omitempty"`
}

SyncStatusReport is the machine-readable result of `td sync status`. It is a pure data struct so the gather logic can be unit-tested without a cobra command or terminal. The thin printer (printSyncStatusText / output.JSON) renders it.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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