Documentation
¶
Index ¶
- func AddJSONFlags(cmd *cobra.Command, flags *JSONFlags)
- func CreateSpaceTag(client *api.Client, spaceID, tagName string) error
- func CustomIDQueryParam(cfg *config.Config, isCustomID bool) string
- func CustomIDTaskQuery(cfg *config.Config, isCustomID bool) string
- func CustomIDTaskQueryMD(cfg *config.Config, isCustomID bool) string
- func CustomIDTaskQueryWithSubtasks(cfg *config.Config, isCustomID bool) string
- func EnsureTagsExist(client *api.Client, spaceID string, tags []string, w io.Writer) []string
- func FetchListStatuses(client *api.Client, listID string) ([]string, error)
- func FetchSpaceStatuses(client *api.Client, spaceID string) ([]string, error)
- func FetchSpaceTags(client *api.Client, spaceID string) ([]string, error)
- func FormatRecentTaskOption(t RecentTask) string
- func GetCurrentUserID(client *api.Client) (int, error)
- func IsAuthError(err error) bool
- func IsSilentError(err error) bool
- func LocationSummary(tasks []RecentTask) []string
- func MatchSprintListID(lists []clickup.List, now time.Time) string
- func MatchStatus(target string, available []string) (string, error)
- func NeedsAuth(f *Factory) func(cmd *cobra.Command, args []string) error
- func ParseMSTimestamp(ms string) time.Time
- func ResolveCurrentSprintListID(ctx context.Context, client *api.Client, folderID string) (string, error)
- func ValidateStatus(client *api.Client, spaceID, status string, w io.Writer) (string, error)
- func ValidateStatusFromLists(client *api.Client, spaceID string, listStatuses []string, status string, ...) (string, error)
- func ValidateStatusWithList(client *api.Client, spaceID, listID, status string, w io.Writer) (string, error)
- func ValidateTags(client *api.Client, spaceID string, tags []string, w io.Writer) []string
- type AuthError
- type Factory
- func (f *Factory) ApiClient() (*api.Client, error)
- func (f *Factory) Config() (*config.Config, error)
- func (f *Factory) GitClient() *gitpkg.Client
- func (f *Factory) GitContext() (*gitpkg.RepoContext, error)
- func (f *Factory) SetAPIClient(c *api.Client)
- func (f *Factory) SetConfig(c *config.Config)
- func (f *Factory) SetGitContext(c *gitpkg.RepoContext)
- type JSONFlags
- type RecentTask
- type SilentError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddJSONFlags ¶
AddJSONFlags adds --json, --jq, --raw, and --template flags to a command.
func CreateSpaceTag ¶ added in v0.16.0
CreateSpaceTag creates a new tag in a ClickUp space. POST /api/v2/space/{space_id}/tag with body {"tag":{"name":"tag-name"}}
func CustomIDQueryParam ¶ added in v0.18.0
CustomIDQueryParam returns the URL query string fragment for custom task ID resolution. Used by commands that build raw HTTP requests (e.g. comments).
Returns "" when isCustomID is false, or "?custom_task_ids=true&team_id=..." when true.
func CustomIDTaskQuery ¶ added in v0.29.0
CustomIDTaskQuery returns a query string for task endpoints supporting custom task IDs. Returns "" when isCustomID is false.
func CustomIDTaskQueryMD ¶ added in v0.29.0
CustomIDTaskQueryMD returns a query string for task endpoints supporting custom task IDs with markdown description and subtask inclusion.
func CustomIDTaskQueryWithSubtasks ¶ added in v0.29.0
CustomIDTaskQueryWithSubtasks returns a query string for task endpoints supporting custom task IDs with subtask inclusion enabled.
func EnsureTagsExist ¶ added in v0.16.0
EnsureTagsExist checks which tags already exist in the space and auto-creates any missing ones. Returns the full list of tag names (all guaranteed to exist). If the space tags cannot be fetched, tags are returned as-is (graceful fallback).
func FetchListStatuses ¶ added in v0.17.0
FetchListStatuses fetches the available status names for a ClickUp list. Returns nil if the list doesn't have custom status overrides.
func FetchSpaceStatuses ¶ added in v0.9.0
FetchSpaceStatuses fetches the available status names for a ClickUp space.
func FetchSpaceTags ¶ added in v0.10.0
FetchSpaceTags fetches the available tag names for a ClickUp space.
func FormatRecentTaskOption ¶ added in v0.5.0
func FormatRecentTaskOption(t RecentTask) string
FormatRecentTaskOption formats a RecentTask for display in a selection prompt.
func IsAuthError ¶
IsAuthError checks if the error is an AuthError.
func IsSilentError ¶
IsSilentError checks if the error is a SilentError.
func LocationSummary ¶ added in v0.5.0
func LocationSummary(tasks []RecentTask) []string
LocationSummary returns a deduplicated summary of locations from recent tasks, e.g. "Folder > List" pairs. Useful for suggesting where to search.
func MatchSprintListID ¶ added in v0.15.0
MatchSprintListID finds the list whose start/due date range contains the given time. Returns "" if no list matches.
func MatchStatus ¶ added in v0.9.0
MatchStatus finds the best matching status from available statuses using a tiered strategy: 1. Exact match (case-insensitive) 2. Contains match (case-insensitive) 3. Fuzzy match using normalized fold ranking
func NeedsAuth ¶
NeedsAuth returns a pre-run function that validates authentication before command execution. If the Factory has an API client override (test mode), authentication is skipped.
func ParseMSTimestamp ¶ added in v0.11.0
ParseMSTimestamp parses a millisecond Unix timestamp string into a time.Time.
func ResolveCurrentSprintListID ¶ added in v0.11.0
func ResolveCurrentSprintListID(ctx context.Context, client *api.Client, folderID string) (string, error)
ResolveCurrentSprintListID finds the current sprint's list ID in the given folder. Returns ("", nil) if no sprint matches today's date.
func ValidateStatus ¶ added in v0.9.0
ValidateStatus validates a status string against the available statuses for a task's list, falling back to space-level statuses if the list has no custom overrides. If the status fuzzy-matches, it returns the matched value and prints a warning to w. If no match, it returns an error with available statuses. If validation cannot be performed (e.g. network error), the original status is returned unchanged.
func ValidateStatusFromLists ¶ added in v0.17.0
func ValidateStatusFromLists(client *api.Client, spaceID string, listStatuses []string, status string, w io.Writer) (string, error)
ValidateStatusFromLists validates a status string against pre-fetched list statuses, falling back to space-level statuses if no list statuses are provided.
func ValidateStatusWithList ¶ added in v0.17.0
func ValidateStatusWithList(client *api.Client, spaceID, listID, status string, w io.Writer) (string, error)
ValidateStatusWithList validates a status string against the available statuses for a list, falling back to space-level statuses if the list has no custom status overrides.
func ValidateTags ¶ added in v0.10.0
ValidateTags validates tag names against the available tags for a space. Unknown tags are warned about and filtered out. Only valid tags are returned. If validation cannot be performed (e.g. network error), all tags are returned unchanged.
Types ¶
type AuthError ¶
type AuthError struct {
Message string
}
AuthError indicates an authentication failure.
type Factory ¶
Factory provides lazy-initialized dependencies to commands.
func NewFactory ¶
NewFactory creates a new Factory with the given IOStreams.
func (*Factory) ApiClient ¶
ApiClient returns an authenticated API client (cached after first call).
func (*Factory) GitContext ¶
func (f *Factory) GitContext() (*gitpkg.RepoContext, error)
GitContext returns the detected git context (cached after first call).
func (*Factory) SetAPIClient ¶ added in v0.21.0
SetAPIClient sets a test override for the API client.
func (*Factory) SetGitContext ¶ added in v0.21.0
func (f *Factory) SetGitContext(c *gitpkg.RepoContext)
SetGitContext sets a test override for the git context.
type JSONFlags ¶
JSONFlags holds the --json, --jq, --raw, and --template flags.
func (*JSONFlags) OutputJSON ¶
OutputJSON writes data as JSON, optionally filtered by jq or formatted by a template.
type RecentTask ¶ added in v0.5.0
type RecentTask struct {
ID string `json:"id"`
CustomID string `json:"custom_id,omitempty"`
Name string `json:"name"`
Status string `json:"status"`
ListName string `json:"list_name"`
FolderName string `json:"folder_name"`
}
RecentTask represents a recently updated task with location context.
func FetchRecentTasks ¶ added in v0.5.0
func FetchRecentTasks(f *Factory, limit int) ([]RecentTask, error)
FetchRecentTasks fetches the current user's recently updated tasks. Uses 2 API calls: one for user identity, one for filtered tasks. Returns up to `limit` tasks ordered by most recently updated.
func FetchRecentTeamTasks ¶ added in v0.5.0
func FetchRecentTeamTasks(f *Factory, limit int) ([]RecentTask, error)
FetchRecentTeamTasks fetches recently updated tasks for the whole team (no assignee filter). Uses 1 API call.
type SilentError ¶
type SilentError struct {
Err error
}
SilentError is an error that should not be printed (the command already handled output).
func (*SilentError) Error ¶
func (e *SilentError) Error() string
func (*SilentError) Unwrap ¶
func (e *SilentError) Unwrap() error