Documentation
¶
Index ¶
- func DetectCandidateKinds(key string) []string
- func DetectKind(key string) string
- func ExtractProject(key string) string
- func ValidateURL(rawURL string) error
- type Assigner
- type AuditEntry
- type AuditProvider
- func (a *AuditProvider) AddComment(ctx context.Context, issueKey string, body string) (*Comment, error)
- func (a *AuditProvider) AssignIssue(ctx context.Context, key string, userID string) error
- func (a *AuditProvider) Close() error
- func (a *AuditProvider) CreateIssue(ctx context.Context, issue *Issue) (*Issue, error)
- func (a *AuditProvider) DeleteIssue(ctx context.Context, key string) error
- func (a *AuditProvider) EditIssue(ctx context.Context, key string, opts EditOptions) (*Issue, error)
- func (a *AuditProvider) GetCurrentUser(ctx context.Context) (string, error)
- func (a *AuditProvider) GetIssue(ctx context.Context, key string) (*Issue, error)
- func (a *AuditProvider) ListComments(ctx context.Context, issueKey string) ([]Comment, error)
- func (a *AuditProvider) ListIssues(ctx context.Context, opts ListOptions) ([]Issue, error)
- func (a *AuditProvider) ListStatuses(ctx context.Context, key string) ([]Status, error)
- func (a *AuditProvider) TransitionIssue(ctx context.Context, key string, targetStatus string) error
- type Comment
- type Commenter
- type Creator
- type CurrentUserGetter
- type Deleter
- type EditOptions
- type Editor
- type FindResult
- type Getter
- type HTTPDoer
- type Instance
- type Issue
- type ListOptions
- type Lister
- type Provider
- type SafeProvider
- func (s *SafeProvider) AddComment(ctx context.Context, issueKey string, body string) (*Comment, error)
- func (s *SafeProvider) AssignIssue(ctx context.Context, key string, userID string) error
- func (s *SafeProvider) CreateIssue(ctx context.Context, issue *Issue) (*Issue, error)
- func (s *SafeProvider) DeleteIssue(_ context.Context, _ string) error
- func (s *SafeProvider) EditIssue(ctx context.Context, key string, opts EditOptions) (*Issue, error)
- func (s *SafeProvider) GetCurrentUser(ctx context.Context) (string, error)
- func (s *SafeProvider) GetIssue(ctx context.Context, key string) (*Issue, error)
- func (s *SafeProvider) ListComments(ctx context.Context, issueKey string) ([]Comment, error)
- func (s *SafeProvider) ListIssues(ctx context.Context, opts ListOptions) ([]Issue, error)
- func (s *SafeProvider) ListStatuses(ctx context.Context, key string) ([]Status, error)
- func (s *SafeProvider) TransitionIssue(ctx context.Context, key string, targetStatus string) error
- type Status
- type StatusLister
- type Transitioner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectCandidateKinds ¶
DetectCandidateKinds returns all tracker kinds whose key format matches the given key. The order is deterministic: azuredevops is checked before github/gitlab repo format since "Word/N" is a subset of "owner/repo".
func DetectKind ¶
DetectKind returns the tracker kind that can be unambiguously inferred from the key format. Currently only "github" is detectable (owner/repo#N or owner/repo). Returns "" when the kind cannot be determined.
func ExtractProject ¶
ExtractProject extracts the project identifier from a key.
"KAN-42" → "KAN" "octocat/repo#42" → "octocat/repo" "octocat/repo" → "octocat/repo" "Project/42" → "Project" "123" → ""
func ValidateURL ¶
ValidateURL checks that rawURL is a valid HTTP(S) URL. This guards against SSRF by rejecting non-HTTP schemes.
Types ¶
type AuditEntry ¶
type AuditEntry struct {
Timestamp string `json:"timestamp"`
Operation string `json:"operation"`
Tracker string `json:"tracker"`
Kind string `json:"kind"`
Key string `json:"key"`
DurationMs int64 `json:"duration_ms"`
Error string `json:"error,omitempty"`
}
AuditEntry represents a single audit log record written as a JSON line.
type AuditProvider ¶
type AuditProvider struct {
// contains filtered or unexported fields
}
AuditProvider wraps a Provider and logs every method call to a JSON Lines file.
func NewAuditProvider ¶
func NewAuditProvider(inner Provider, name, kind, logPath string) (*AuditProvider, error)
NewAuditProvider creates an AuditProvider that delegates to inner and appends audit entries to the file at logPath. The file is created if it does not exist.
func (*AuditProvider) AddComment ¶
func (*AuditProvider) AssignIssue ¶
func (*AuditProvider) Close ¶
func (a *AuditProvider) Close() error
Close closes the underlying log file.
func (*AuditProvider) CreateIssue ¶
func (*AuditProvider) DeleteIssue ¶
func (a *AuditProvider) DeleteIssue(ctx context.Context, key string) error
func (*AuditProvider) EditIssue ¶
func (a *AuditProvider) EditIssue(ctx context.Context, key string, opts EditOptions) (*Issue, error)
func (*AuditProvider) GetCurrentUser ¶
func (a *AuditProvider) GetCurrentUser(ctx context.Context) (string, error)
func (*AuditProvider) ListComments ¶
func (*AuditProvider) ListIssues ¶
func (a *AuditProvider) ListIssues(ctx context.Context, opts ListOptions) ([]Issue, error)
func (*AuditProvider) ListStatuses ¶
func (*AuditProvider) TransitionIssue ¶
type Commenter ¶
type Commenter interface {
ListComments(ctx context.Context, issueKey string) ([]Comment, error)
AddComment(ctx context.Context, issueKey string, body string) (*Comment, error)
}
Commenter manages issue comments.
type CurrentUserGetter ¶
CurrentUserGetter retrieves the authenticated user's identifier.
type EditOptions ¶
EditOptions specifies which fields to update on an issue. Nil pointer fields are left unchanged; non-nil fields are set (even if empty).
type Editor ¶
type Editor interface {
EditIssue(ctx context.Context, key string, opts EditOptions) (*Issue, error)
}
Editor updates an existing issue's title and/or description.
type FindResult ¶
type FindResult struct {
Provider string `json:"provider"`
Project string `json:"project"`
Key string `json:"key"`
}
FindResult holds the outcome of FindTracker.
func FindTracker ¶
FindTracker determines which configured tracker owns the given key.
Resolution strategy:
- Match key format against regexes → candidate kinds
- Filter candidates against configured instances
- If one kind remains → return it (no API call)
- If ambiguous → probe each instance with GetIssue until one succeeds
type HTTPDoer ¶
HTTPDoer abstracts HTTP request execution for testability and to decouple from the concrete *http.Client type.
type Instance ¶
type Instance struct {
Name string // config entry name ("work", "personal"), empty for CLI-flag instances
Kind string // "jira", "github", "linear"
URL string // display URL
User string // display user (Jira only)
Description string // optional human-readable description of what this tracker is for
Safe bool // when true, destructive operations (deletes) are blocked
Provider Provider
}
Instance represents a configured tracker backend ready for use.
func Resolve ¶
Resolve determines which tracker instance to use.
When name is provided it finds the single instance whose Name matches. When name is empty it auto-detects: if keyHint allows inferring the tracker kind it filters to that kind; otherwise if all instances share one Kind it returns the first; if multiple kinds exist it returns an error.
type Issue ¶
type Issue struct {
Key string `json:"key"`
Project string `json:"project"` // project key, e.g. "KAN"
Type string `json:"type"` // issue type, e.g. "Task", "Bug"
Title string `json:"title"`
Status string `json:"status"`
Priority string `json:"priority"`
Assignee string `json:"assignee"`
Reporter string `json:"reporter"`
Description string `json:"description"` // markdown
}
Issue is a provider-agnostic issue representation.
type ListOptions ¶
type ListOptions struct {
Project string
MaxResults int
IncludeAll bool // when false, only open/active issues are returned
}
ListOptions controls issue listing behaviour.
type Lister ¶
type Lister interface {
ListIssues(ctx context.Context, opts ListOptions) ([]Issue, error)
}
Lister lists issues for a project.
type Provider ¶
type Provider interface {
Lister
Getter
Creator
Commenter
Deleter
Transitioner
Assigner
CurrentUserGetter
Editor
StatusLister
}
Provider combines all tracker operations into a single interface.
type SafeProvider ¶ added in v0.7.0
type SafeProvider struct {
// contains filtered or unexported fields
}
SafeProvider wraps a Provider and blocks destructive operations. Only DeleteIssue is blocked; all other methods delegate to the inner provider.
func NewSafeProvider ¶ added in v0.7.0
func NewSafeProvider(inner Provider, instanceName string) *SafeProvider
NewSafeProvider creates a SafeProvider that delegates to inner and blocks DeleteIssue with a descriptive error.
func (*SafeProvider) AddComment ¶ added in v0.7.0
func (*SafeProvider) AssignIssue ¶ added in v0.7.0
func (*SafeProvider) CreateIssue ¶ added in v0.7.0
func (*SafeProvider) DeleteIssue ¶ added in v0.7.0
func (s *SafeProvider) DeleteIssue(_ context.Context, _ string) error
func (*SafeProvider) EditIssue ¶ added in v0.7.0
func (s *SafeProvider) EditIssue(ctx context.Context, key string, opts EditOptions) (*Issue, error)
func (*SafeProvider) GetCurrentUser ¶ added in v0.7.0
func (s *SafeProvider) GetCurrentUser(ctx context.Context) (string, error)
func (*SafeProvider) ListComments ¶ added in v0.7.0
func (*SafeProvider) ListIssues ¶ added in v0.7.0
func (s *SafeProvider) ListIssues(ctx context.Context, opts ListOptions) ([]Issue, error)
func (*SafeProvider) ListStatuses ¶ added in v0.7.0
func (*SafeProvider) TransitionIssue ¶ added in v0.7.0
type Status ¶
type Status struct {
Name string `json:"name"`
Type string `json:"type,omitempty"` // "unstarted", "started", "done", "closed", or ""
}
Status represents a workflow state that an issue can be in.
type StatusLister ¶
StatusLister lists available statuses for an issue. For Jira, only valid transitions from the current state are returned. For other trackers, all statuses for the project/workflow are returned.