forge

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package forge implements configured, guarded issue imports and upstream drift checks for local UI workflows.

Index

Constants

View Source
const ImportFetchTimeout = importFetchTimeout

ImportFetchTimeout bounds one forge selection independently of an AI run.

View Source
const (
	// SkillRunDeadline bounds an assistant run shared by local interfaces.
	SkillRunDeadline = 4 * time.Minute
)

Variables

View Source
var ErrUpstreamChanged = errors.New("upstream changed; check again")

ErrUpstreamChanged is returned when a baseline revision no longer names the current upstream snapshot.

Functions

func BaselineRevision

func BaselineRevision(baseline store.ImportBaseline) string

BaselineRevision identifies one accepted upstream snapshot for compare-and-swap.

func IssueADR

func IssueADR(issue Issue) string

IssueADR renders one bounded forge issue for ADR splitting.

func NewHTTPClient

func NewHTTPClient() *http.Client

NewHTTPClient returns the guarded forge client shared by every caller.

func StripLinkTags

func StripLinkTags(tags []string) []string

StripLinkTags removes model-proposed forge identity tags before the local import path appends authorized provenance.

func ValidRevision

func ValidRevision(revision string) bool

ValidRevision reports whether a drift revision is a canonical digest.

func ValidSourceName

func ValidSourceName(name string) bool

ValidSourceName reports whether a source name is safe for persisted lookup.

Types

type Draft

type Draft struct {
	ai.Draft
	Link        string
	ExternalKey string
	URL         string
	SourceName  string
	Baseline    store.ImportBaseline
	Duplicate   *Duplicate
}

Draft is one import proposal with its forge provenance and duplicate hint.

type Drift

type Drift struct {
	State         string
	Link          string
	URL           string
	TitleChanged  *bool
	UpstreamTitle string
	BaselineTitle string
	BaselineAt    string
	CheckedAt     string
	Summary       string
	Revision      string
}

type Duplicate

type Duplicate struct {
	ID    string
	Title string
	Via   string
}

type Error

type Error struct {
	Code    int
	Message string
	Cause   error
}

Error is a caller-safe failure category for local UI workflows. Cause is retained for errors.Is/As and logs, never display.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ForgeProbeConfig

type ForgeProbeConfig struct {
	Name    string
	Kind    string
	BaseURL string
	Project string
	Token   string
	Saved   bool
}

ForgeProbeConfig is one connection test candidate. Saved selects whether blank endpoint credentials may fall back to the named stored integration; drafts set it false and are tested entirely from these unsaved values. Project is probe-only and is never persisted with the integration.

type ForgeProber

type ForgeProber struct {
	// contains filtered or unexported fields
}

ForgeProber tests stored or draft forge integration values. Local UI flows share its guarded client, credential-origin rule, endpoint derivation, and response handling.

func NewForgeProber

func NewForgeProber(st *store.Store) *ForgeProber

NewForgeProber constructs a direct-store forge connection prober.

func NewForgeProberWithClient

func NewForgeProberWithClient(st *store.Store, client *http.Client) *ForgeProber

func (*ForgeProber) Probe

func (p *ForgeProber) Probe(ctx context.Context, user string, config ForgeProbeConfig) error

Probe tests one unsaved candidate. Persisted rows may retain blank stored endpoint values; drafts never touch the store. A stored token is never sent to a supplied origin that differs from the saved one.

type Issue

type Issue = forgeIssue

Issue is one bounded upstream forge issue.

type LinkInput

type LinkInput struct {
	ExternalKey string               `json:"external_key"`
	Link        string               `json:"link"`
	URL         string               `json:"url"`
	Title       string               `json:"title"`
	Baseline    store.ImportBaseline `json:"baseline"`
}

type Preview

type Preview struct {
	Kind      string
	TotalHint int
	Fetched   int
	Truncated bool
	Note      string
	Drafts    []Draft
}

type PreviewRequest

type PreviewRequest struct {
	Source string
	Ref    string
	Max    int
}

type Ref

type Ref struct {
	Source    store.ForgeSource
	Kind      string
	Project   string
	Issue     int
	Milestone int
	// contains filtered or unexported fields
}

Ref is a parsed configured forge selection. Its credential remains private.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service owns the guarded forge path used by the TUI.

func New

func New(st *store.Store, runner *ai.Runner, client *http.Client) *Service

New constructs the direct-store forge service. Nil collaborators select the guarded production clients.

func (*Service) AcceptDrift

func (s *Service) AcceptDrift(ctx context.Context, user, source, externalKey, revision string) (string, error)

func (*Service) CheckDrift

func (s *Service) CheckDrift(ctx context.Context, user, source, externalKey string) (Drift, error)

func (*Service) CreateTask

func (s *Service) CreateTask(user, sourceName string, task board.Task, item LinkInput) (board.Task, error)

CreateTask atomically creates one selected card, its provenance, and the upstream baseline captured by the preview.

func (*Service) DeleteSource

func (s *Service) DeleteSource(user, name string) error

func (*Service) Preview

func (s *Service) Preview(ctx context.Context, user string, request PreviewRequest) (Preview, error)

Preview fetches, classifies and transforms one configured selection. It is read-only: third-party forge text cannot receive write or fetch tools.

func (*Service) Probe

func (s *Service) Probe(ctx context.Context, user string, config ForgeProbeConfig) error

func (*Service) Provenance

func (s *Service) Provenance(user, link string) ([]store.ImportLink, error)
func (s *Service) RecordLinks(user, sourceName string, items []LinkInput) error

RecordLinks journals provenance for compatibility clients that already created their cards. The TUI uses CreateTask for an atomic write.

func (*Service) ResolveIssueDocument

func (s *Service) ResolveIssueDocument(ctx context.Context, user, source, raw string) (Issue, string, string, error)

ResolveIssueDocument authorizes and fetches one configured issue for a local ADR split flow.

func (*Service) SaveSource

func (s *Service) SaveSource(user, name, kind string, baseURL, token *string) (bool, error)

SaveSource validates and persists one configured forge source.

func (*Service) Sources

func (s *Service) Sources(user string) ([]store.ForgeSource, error)

Jump to

Keyboard shortcuts

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