github

package
v0.79.4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ObjectiveLabelCritical = "critical"
	ObjectiveLabelP0       = "p0"
	ObjectiveValueCritical = 100
	ObjectiveValueP0       = 100
)

Objective label/value constants used by the objective-mapping feature.

Note: keep these values in sync with DefaultObjectiveMapping (pkg/github/label_objective_mapping.go) and/or the repository-level .github/objective-mapping.json to avoid divergent scoring semantics. These mappings reflect the actual work domains and priorities:

  • Safety/Reliability: Safe outputs, testing, reliability = critical
  • Core engine: Compilation, parsing, workflow execution = critical
  • Integration: MCP tools, GitHub Actions, CLI = important
  • Quality: Bug fixes, performance, linting = important
  • Enhancement: New features, documentation = valuable but lower impact

To customize these mappings:

  1. Create .github/objective-mapping.json in your repository root
  2. Set OBJECTIVE_MAPPING_JSON environment variable (JSON string or file path)
  3. See specs/objective-mapping-portfolio-reporting.md for configuration details

Critical Priority Labels

View Source
const (
	ObjectiveLabelTesting     = "testing"
	ObjectiveLabelReliability = "reliability"
	ObjectiveValueTesting     = 50
	ObjectiveValueReliability = 50
)

Safety-Critical Work (safe outputs, test failures)

View Source
const (
	ObjectiveLabelWorkflow = "workflow"
	ObjectiveLabelEngine   = "engine"
	ObjectiveValueWorkflow = 45
	ObjectiveValueEngine   = 40
)

Core Engine & Compilation

View Source
const (
	ObjectiveLabelMCP     = "mcp"
	ObjectiveLabelActions = "actions"
	ObjectiveLabelCLI     = "cli"
	ObjectiveValueMCP     = 45
	ObjectiveValueActions = 40
	ObjectiveValueCLI     = 40
)

Integration Points

View Source
const (
	ObjectiveLabelBug = "bug"
	ObjectiveValueBug = 60
)

Bug Fixes (especially core path)

View Source
const (
	ObjectiveLabelSecurityFix = "security-fix"
	ObjectiveValueSecurityFix = 70
)

Security

View Source
const (
	ObjectiveLabelCopilotOpt = "copilot-opt"
	ObjectiveValueCopilotOpt = 75
)

Copilot-Specific Optimizations

View Source
const (
	ObjectiveLabelHighPriority = "high-priority"
	ObjectiveLabelP1           = "p1"
	ObjectiveValueHighPriority = 35
	ObjectiveValueP1           = 35
)

High Priority Work

View Source
const (
	ObjectiveLabelLintMonster = "lint-monster"
	ObjectiveValueLintMonster = 25
	ObjectiveLabelPerformance = "performance"
	ObjectiveValuePerformance = 30
)

Code Quality

View Source
const (
	ObjectiveLabelMediumPriority = "medium-priority"
	ObjectiveLabelP2             = "p2"
	ObjectiveValueMediumPriority = 20
	ObjectiveValueP2             = 20
)

Medium Priority Work

View Source
const (
	ObjectiveLabelDependencies = "dependencies"
	ObjectiveValueDependencies = 10
)

Dependency Management

View Source
const (
	ObjectiveLabelLowPriority = "low-priority"
	ObjectiveLabelP3          = "p3"
	ObjectiveValueLowPriority = 10
	ObjectiveValueP3          = 10
)

Low Priority Work

View Source
const (
	ObjectiveLabelEnhancement   = "enhancement"
	ObjectiveValueEnhancement   = 15
	ObjectiveLabelDocumentation = "documentation"
	ObjectiveValueDocumentation = 5
)

Enhancement & Documentation

View Source
const (
	ObjectiveLabelAIGenerated  = "ai-generated"
	ObjectiveValueAIGenerated  = 0
	ObjectiveLabelAIInspected  = "ai-inspected"
	ObjectiveValueAIInspected  = 0
	ObjectiveLabelSmokeCopilot = "smoke-copilot"
	ObjectiveValueSmokeCopilot = 0
)

Workflow/Automation Labels (no objective value)

View Source
const (
	ObjectiveLabelQuestion       = "question"
	ObjectiveValueQuestion       = 0
	ObjectiveLabelGoodFirstIssue = "good first issue"
	ObjectiveValueGoodFirstIssue = 0
)

Question & Community Labels (no objective value)

View Source
const (
	MultiLabelLogicMax   = "max"   // Use highest value (default)
	MultiLabelLogicSum   = "sum"   // Add all values
	MultiLabelLogicFirst = "first" // Use first in priority order
)

Combination logic options

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectiveMapping

type ObjectiveMapping struct {
	// LabelToValue maps label names (case-insensitive) to numeric values.
	// Example: {"high-priority": 50, "copilot-opt": 50, "critical": 100, "p0": 100, "p1": 50}
	LabelToValue map[string]int `json:"label_to_value"`

	// MultiLabelLogic determines how multiple matching labels are combined:
	// "sum" = add all matching label values
	// "max" = take the highest value (default)
	// "first" = use the first match in priority order
	MultiLabelLogic string `json:"multi_label_logic"`

	// PriorityLabels defines evaluation order when logic is "first"
	// Used to establish precedence when multiple labels match
	PriorityLabels []string `json:"priority_labels,omitempty"`
}

ObjectiveMapping defines how GitHub labels map to numeric objective values. This enables any label to be assigned a configurable numeric value, with one central definition place.

func DefaultObjectiveMapping

func DefaultObjectiveMapping() *ObjectiveMapping

DefaultObjectiveMapping returns the built-in default label-to-value mapping.

func LoadObjectiveMappingFromConfig

func LoadObjectiveMappingFromConfig() *ObjectiveMapping

LoadObjectiveMappingFromConfig loads the mapping from environment, config file, or defaults. Precedence: 1. OBJECTIVE_MAPPING_JSON environment variable 2. .github/objective-mapping.json file 3. Built-in defaults

func (*ObjectiveMapping) ComputeObjectiveValue

func (om *ObjectiveMapping) ComputeObjectiveValue(issueLabels []string) int

ComputeObjectiveValue calculates the numeric value for an issue based on its labels. Returns 0 if no labels match or if mapping is nil.

func (*ObjectiveMapping) GetAllLabels

func (om *ObjectiveMapping) GetAllLabels() []string

GetAllLabels returns all labels defined in the mapping (sorted).

func (*ObjectiveMapping) GetObjectiveLabels

func (om *ObjectiveMapping) GetObjectiveLabels(issueLabels []string) []string

GetObjectiveLabels returns the subset of issue labels that have objective values. Also returns the labels in the order they appear in the issue's label list.

func (*ObjectiveMapping) MarshalJSON

func (om *ObjectiveMapping) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler to ensure consistent output.

func (*ObjectiveMapping) String

func (om *ObjectiveMapping) String() string

String returns a human-readable summary of the mapping.

func (*ObjectiveMapping) ValidateLabelExists

func (om *ObjectiveMapping) ValidateLabelExists(label string) bool

ValidateLabelExists checks if a given label has a defined objective value.

Jump to

Keyboard shortcuts

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