Documentation
¶
Overview ¶
Package issue provides domain types and logic for the auto issue reporter.
Index ¶
- func FormatMarkdown(report IssueReport) (string, error)
- func Sanitize(s string) string
- func SanitizeGitURL(s string) string
- func SanitizePath(s string) string
- func SanitizeSecrets(s string) string
- type CommandRunner
- type Config
- type IssueContext
- type IssueReport
- type SubmitResult
- type Submitter
- func (s *Submitter) AddComment(repo string, issueNum int, body string) error
- func (s *Submitter) CheckGH() error
- func (s *Submitter) ComputeHash(errMsg, cmd string) string
- func (s *Submitter) CreateIssue(repo, title, body string, labels []string) (SubmitResult, error)
- func (s *Submitter) FindDuplicate(repo, hash string) (string, error)
- func (s *Submitter) Submit(report IssueReport, body string) (SubmitResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMarkdown ¶
func FormatMarkdown(report IssueReport) (string, error)
FormatMarkdown renders the issue report as a markdown string using the embedded issue-report.md.tmpl template.
func SanitizeGitURL ¶
SanitizeGitURL strips embedded credentials from HTTP/HTTPS git URLs.
func SanitizePath ¶
SanitizePath replaces the user's home directory prefix with $HOME.
func SanitizeSecrets ¶
SanitizeSecrets redacts API keys, tokens, and secret environment variables.
Types ¶
type CommandRunner ¶
type CommandRunner interface {
Run(name string, args ...string) ([]byte, error)
LookPath(name string) (string, error)
}
CommandRunner abstracts os/exec for testability.
type Config ¶
type Config struct {
Repo string `yaml:"repo"`
Labels []string `yaml:"labels"`
AutoSubmit bool `yaml:"auto_submit"`
RateLimitMinutes int `yaml:"rate_limit_minutes"`
}
Config holds issue reporter configuration from autopus.yaml.
type IssueContext ¶
type IssueContext struct {
ErrorMessage string
Command string
ExitCode int
OS string
GoVersion string
AutoVersion string
Platform string
ConfigYAML string // sanitized autopus.yaml content
Telemetry string // recent pipeline run summary
}
IssueContext holds environment and error context for a report.
func CollectContext ¶
func CollectContext(errMsg, cmd string, exitCode int) IssueContext
CollectContext gathers environment and error context for an issue report. It reads autopus.yaml and recent telemetry from the current working directory.
type IssueReport ¶
type IssueReport struct {
Title string
Context IssueContext
Hash string // xxhash hex string for dedup
Labels []string
Repo string // target GitHub repo (owner/repo)
}
IssueReport is a complete issue report ready for formatting.
type SubmitResult ¶
type SubmitResult struct {
IssueURL string
IssueNumber int
WasDuplicate bool
Action string // "created", "commented", "skipped"
}
SubmitResult holds the outcome of a GitHub issue submission.
type Submitter ¶
type Submitter struct {
// contains filtered or unexported fields
}
Submitter orchestrates GitHub issue creation via the gh CLI.
func NewSubmitter ¶
func NewSubmitter(runner CommandRunner) *Submitter
NewSubmitter creates a Submitter with the given CommandRunner. Pass nil to use the real os/exec runner.
func (*Submitter) AddComment ¶
AddComment adds a comment to an existing issue.
func (*Submitter) ComputeHash ¶
ComputeHash returns the xxhash hex digest of (errMsg + command).
func (*Submitter) CreateIssue ¶
func (s *Submitter) CreateIssue(repo, title, body string, labels []string) (SubmitResult, error)
CreateIssue creates a new GitHub issue and returns the result.
func (*Submitter) FindDuplicate ¶
FindDuplicate searches for an existing issue with the given hash label. Returns the issue URL if found, or empty string if not found.
func (*Submitter) Submit ¶
func (s *Submitter) Submit(report IssueReport, body string) (SubmitResult, error)
Submit orchestrates CheckGH → hash → FindDuplicate → CreateIssue or AddComment.