Documentation
¶
Overview ¶
Package cli parses command-line input and renders stable human and JSON output for GitContribute application services.
The package defines adapter-facing request and result contracts but does not own persistence, network, or contribution-workflow decisions. Commands make side effects visible through their names and flags.
Index ¶
- Constants
- Variables
- func NewCLIError(code int, err error) error
- type AcquisitionResult
- type AcquisitionService
- type ArchiveService
- type ArchiveSyncOptions
- type ArchiveThreadService
- type CLI
- type CLIError
- type ClusterListResult
- type ClusterMember
- type ClusterResult
- type ClusteringService
- type CollectionListResult
- type CollectionMember
- type CollectionResult
- type CollectionService
- type ConfigResult
- type ConfigureOptions
- type ConfigureResult
- type ContributionListResult
- type ContributionOutcomeListResult
- type ContributionOutcomeResult
- type ContributionResult
- type ContributionService
- type ControlCounts
- type ControlService
- type ControlStatusResult
- type CoverageFacet
- type CoverageResult
- type CrawlOptions
- type CrawlResult
- type DefineValidationOptions
- type DiscoveryService
- type DoctorCheck
- type DoctorResult
- type DossierExtensionService
- type DossierResult
- type DraftResult
- type EvidenceItem
- type EvidenceResult
- type EvidenceService
- type EvidenceSourceRevisionResult
- type EvidenceSourceSubjectResult
- type ExportResult
- type ExportService
- type HealthService
- type HydrateOptions
- type HydrateResult
- type HydratedFacet
- type HypothesisListResult
- type HypothesisResult
- type HypothesisUpdateOptions
- type IndexResult
- type InitResult
- type InvestigationListResult
- type InvestigationResult
- type InvestigationService
- type JobListResult
- type JobResult
- type JobService
- type LensExplainCandidate
- type LensExplainOptions
- type LensExplainResult
- type LensExplainSignal
- type LensListResult
- type LensResult
- type LensService
- type ListContributionsOptions
- type ListTriageEventsOptions
- type LocalQueryService
- type MCPOptions
- type MCPRunner
- type MetadataExportOptions
- type MetadataExportResult
- type MetadataImportOptions
- type MetadataImportResult
- type MetadataResult
- type NeighborListResult
- type NeighborResult
- type OpportunityListResult
- type OpportunityResult
- type PrepareIssueOptions
- type PreparePROptions
- type RadarOptions
- type RadarService
- type RateLimitState
- type ReadinessCheck
- type ReadinessResult
- type ReadinessService
- type RecordContributionOptions
- type RecordContributionOutcomeOptions
- type RecordEvidenceOptions
- type RecordTriageEventOptions
- type RepoRef
- type ResearchService
- type RunListResult
- type RunResult
- type RunValidationOptions
- type SearchMatch
- type SearchOptions
- type SearchResult
- type Service
- type SetupAuthentication
- type SetupClientDiscovery
- type SetupDiscovery
- type SetupObserver
- type SetupOptions
- type SetupPhase
- type SetupPromptQuestion
- type SetupPromptRequest
- type SetupPrompter
- type SetupReport
- type SetupSelection
- type SetupService
- type SetupStep
- type SourceListResult
- type SourceResult
- type StatusResult
- type SyncResult
- type TUIOptions
- type TUIRunner
- type TailOptions
- type TailResult
- type TailService
- type ThreadBaselineResult
- type ThreadInvestigationResult
- type ThreadInvestigationService
- type ThreadListItem
- type ThreadListResult
- type TrackingService
- type TriageEventListResult
- type TriageEventResult
- type UpgradeOptions
- type UpgradeReport
- type UpgradeService
- type ValidationComparisonResult
- type ValidationResult
- type ValidationRunResult
- type ValidationService
- type WorkflowAuditResult
- type WorkflowExtensionService
- type WorkflowLinkResult
- type WorkflowSourceRefResult
- type WorkspaceCreateOptions
- type WorkspaceResult
- type WorkspaceService
Constants ¶
const ( ExitOK = 0 ExitGeneral = 1 ExitUsage = 2 ExitNotFound = 3 ExitNotWired = 4 ExitCancelled = 130 )
Exit codes returned by the CLI.
Variables ¶
var ErrNotWired = errors.New("not wired: integration not yet implemented")
ErrNotWired is returned by the bootstrap placeholder until a real service or runner is integrated.
var ErrSetupCancelled = errors.New("setup cancelled")
ErrSetupCancelled reports a deliberate interactive cancellation.
Functions ¶
func NewCLIError ¶
NewCLIError returns an error with a specific exit code.
Types ¶
type AcquisitionResult ¶
type AcquisitionResult struct {
Repo RepoRef `json:"repo"`
Remote string `json:"remote"`
DefaultBranch string `json:"default_branch"`
CommitSHA string `json:"commit_sha"`
Files int `json:"files"`
Bytes int `json:"bytes"`
Indexed bool `json:"indexed"`
Inserted bool `json:"inserted"`
AcquiredAt string `json:"acquired_at"`
Message string `json:"message"`
}
type AcquisitionService ¶
type AcquisitionService interface {
Acquire(ctx context.Context, repo RepoRef, remote string) (*AcquisitionResult, error)
}
AcquisitionService exposes explicit managed clone/fetch and indexing.
type ArchiveService ¶
type ArchiveService interface {
ArchiveSync(ctx context.Context, repo RepoRef, opts ArchiveSyncOptions) (*SyncResult, error)
Hydrate(ctx context.Context, repo RepoRef, number int, opts HydrateOptions) (*HydrateResult, error)
}
ArchiveService exposes explicit network-reading archive operations.
type ArchiveSyncOptions ¶
type ArchiveThreadService ¶
type ArchiveThreadService interface {
ArchiveThreads(ctx context.Context, repo RepoRef, kind, state string, limit int) (*ThreadListResult, error)
}
ArchiveThreadService exposes the bounded offline archive listing separately from the stable local-query interface.
type CLI ¶
type CLI struct {
// contains filtered or unexported fields
}
CLI is a Kong-based adapter that parses arguments and dispatches to product- owned application services. It owns no domain logic.
func (*CLI) Run ¶
Run parses arguments and dispatches to the appropriate Service or MCPRunner method. It respects context cancellation.
func (*CLI) SetSetupPrompter ¶ added in v0.3.0
func (c *CLI) SetSetupPrompter(prompter SetupPrompter)
SetSetupPrompter replaces the interactive setup adapter. It is intended for tests and alternate accessible frontends.
func (*CLI) SetTUIRunner ¶
SetTUIRunner wires the optional terminal UI adapter.
type ClusterListResult ¶
type ClusterListResult struct {
Repo RepoRef `json:"repo"`
Total int `json:"total"`
Clusters []ClusterResult `json:"clusters"`
}
ClusterListResult is the result of listing clusters for a repository.
type ClusterMember ¶
type ClusterMember struct {
Kind string `json:"kind"`
Owner string `json:"owner"`
Repo string `json:"repo"`
Number int `json:"number"`
Title string `json:"title,omitempty"`
State string `json:"state,omitempty"`
Score float64 `json:"score"`
Reason string `json:"reason"`
Included bool `json:"included"`
}
ClusterMember is one thread inside a cluster.
type ClusterResult ¶
type ClusterResult struct {
StableID string `json:"stable_id"`
State string `json:"state"`
Canonical ClusterMember `json:"canonical"`
MemberCount int `json:"member_count"`
Members []ClusterMember `json:"members,omitempty"`
}
ClusterResult is a single duplicate-candidate cluster.
type ClusteringService ¶
type ClusteringService interface {
Clusters(ctx context.Context, repo RepoRef, limit int) (*ClusterListResult, error)
Cluster(ctx context.Context, id string, limit int) (*ClusterResult, error)
}
ClusteringService is the optional duplicate-candidate clustering capability used by the CLI.
type CollectionListResult ¶
type CollectionListResult struct {
Collections []CollectionResult `json:"collections"`
}
CollectionListResult is a list of collections.
type CollectionMember ¶
CollectionMember is one typed reference added to a collection.
type CollectionResult ¶
type CollectionResult struct {
Name string `json:"name"`
MemberCount int `json:"member_count"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
CollectionResult is a single named collection.
type CollectionService ¶
type CollectionService interface {
CreateCollection(ctx context.Context, name string) (*CollectionResult, error)
AddCollectionMembers(ctx context.Context, name string, members []CollectionMember) (*CollectionResult, error)
ListCollections(ctx context.Context) (*CollectionListResult, error)
}
CollectionService is the optional collection management capability used by the CLI.
type ConfigResult ¶
type ConfigResult struct {
Database string `json:"database"`
TokenSource string `json:"token_source"`
TokenSourceKey string `json:"token_source_key,omitempty"`
CrawlBudget int `json:"crawl_budget"`
CrawlConcurrency int `json:"crawl_concurrency"`
CrawlRetryLimit int `json:"crawl_retry_limit"`
CrawlTimeout string `json:"crawl_timeout"`
OutputFormat string `json:"output_format"`
OutputMaxResults int `json:"output_max_results"`
}
type ConfigureOptions ¶
type ConfigureOptions struct {
Database *string
TokenSource *string
TokenSourceKey *string
CrawlBudget *int
CrawlConcurrency *int
CrawlRetryLimit *int
CrawlTimeout *string
OutputFormat *string
OutputMaxResults *int
DryRun bool
}
ConfigureOptions uses pointers so callers can distinguish an omitted value from a deliberate zero value. Tokens themselves are never accepted here.
type ConfigureResult ¶
type ConfigureResult struct {
Path string `json:"path"`
DryRun bool `json:"dry_run"`
Changed bool `json:"changed"`
Config ConfigResult `json:"config"`
}
type ContributionListResult ¶
type ContributionListResult struct {
Contributions []ContributionResult `json:"contributions"`
Limit int `json:"limit"`
Total int `json:"total"`
}
type ContributionOutcomeListResult ¶
type ContributionOutcomeListResult struct {
ContributionID string `json:"contribution_id"`
Outcomes []ContributionOutcomeResult `json:"outcomes"`
}
type ContributionResult ¶
type ContributionResult struct {
ID string `json:"id"`
OpportunityID string `json:"opportunity_id"`
Kind string `json:"kind"`
Title string `json:"title"`
Body string `json:"body,omitempty"`
Reference string `json:"reference,omitempty"`
ReferenceURL string `json:"reference_url,omitempty"`
PreparedAt string `json:"prepared_at"`
SubmittedAt string `json:"submitted_at,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Metadata map[string]any `json:"metadata,omitempty"`
}
type ContributionService ¶
type ContributionService interface {
PrepareIssue(ctx context.Context, opportunityID string, opts PrepareIssueOptions) (*DraftResult, error)
PreparePullRequest(ctx context.Context, opportunityID string, opts PreparePROptions) (*DraftResult, error)
}
ContributionService is the optional contribution drafting capability used by the CLI.
type ControlCounts ¶
type ControlService ¶
type ControlService interface {
Metadata(ctx context.Context) (*MetadataResult, error)
Configure(ctx context.Context, opts ConfigureOptions) (*ConfigureResult, error)
ControlStatus(ctx context.Context) (*ControlStatusResult, error)
Doctor(ctx context.Context) (*DoctorResult, error)
}
ControlService exposes local configuration and diagnostic capabilities. Implementations must not perform network access for Metadata or ControlStatus.
type ControlStatusResult ¶
type ControlStatusResult struct {
Healthy bool `json:"healthy"`
Corpus string `json:"corpus"`
Version string `json:"version"`
SchemaVersion int64 `json:"schema_version"`
Counts ControlCounts `json:"counts"`
FreshestSource string `json:"freshest_source,omitempty"`
RateLimits []RateLimitState `json:"rate_limits,omitempty"`
Warnings []string `json:"warnings"`
}
type CoverageFacet ¶
type CoverageResult ¶
type CoverageResult struct {
Repo RepoRef `json:"repo"`
Facets []CoverageFacet `json:"facets"`
}
type CrawlOptions ¶
type CrawlResult ¶
type CrawlResult struct {
Source string `json:"source"`
Windows int `json:"windows"`
Repositories int `json:"repositories"`
Threads int `json:"threads,omitempty"`
Events int `json:"events,omitempty"`
Requests int `json:"requests"`
Imported int `json:"imported,omitempty"`
Skipped int `json:"skipped,omitempty"`
Failures int `json:"failures,omitempty"`
Checkpoint string `json:"checkpoint"`
}
type DefineValidationOptions ¶
type DefineValidationOptions struct {
Kind string
Command string
WorkingDir string
BaseWorkingDir string
CandidateDir string
Env []string
Timeout time.Duration
MaxOutputBytes int64
}
DefineValidationOptions carries an explicit validation definition.
type DiscoveryService ¶
type DiscoveryService interface {
AddSearchSource(ctx context.Context, name, query string) (*SourceResult, error)
AddRepoSource(ctx context.Context, name string, refs []RepoRef) (*SourceResult, error)
AddGHArchiveSource(ctx context.Context, name string, events []string) (*SourceResult, error)
ShowSource(ctx context.Context, name string) (*SourceResult, error)
ListSources(ctx context.Context) (*SourceListResult, error)
Crawl(ctx context.Context, name string, opts CrawlOptions) (*CrawlResult, error)
}
DiscoveryService is the optional source and crawl capability used by the CLI without enlarging the core local archive contract.
type DoctorCheck ¶
type DoctorResult ¶
type DoctorResult struct {
Healthy bool `json:"healthy"`
Checks []DoctorCheck `json:"checks"`
}
type DossierExtensionService ¶
type DossierResult ¶
type DossierResult struct {
Repo RepoRef `json:"repo"`
Summary string `json:"summary"`
Language string `json:"language"`
Stars int `json:"stars"`
OpenIssues int `json:"open_issues"`
Coverage []string `json:"coverage"`
Freshness string `json:"freshness"`
}
DossierResult is a summary view of a repository.
type DraftResult ¶
type DraftResult struct {
OpportunityID string `json:"opportunity_id"`
Kind string `json:"kind"`
Title string `json:"title"`
Body string `json:"body"`
RenderedAt string `json:"rendered_at"`
}
DraftResult is a rendered, locally-stored contribution draft.
type EvidenceItem ¶
type EvidenceItem struct {
ID string `json:"id"`
Type string `json:"type"`
Relation string `json:"relation"`
Description string `json:"description"`
ValidationRunID string `json:"validation_run_id,omitempty"`
OpportunityID string `json:"opportunity_id,omitempty"`
SourceRefs []WorkflowSourceRefResult `json:"source_refs,omitempty"`
SourceProvenance []EvidenceSourceRevisionResult `json:"source_provenance,omitempty"`
Freshness string `json:"freshness"`
FreshnessReason string `json:"freshness_reason,omitempty"`
CreatedAt string `json:"created_at"`
}
EvidenceItem is a single piece of evidence with derived corpus freshness.
type EvidenceResult ¶
type EvidenceResult struct {
InvestigationID string `json:"investigation_id"`
Evidence []EvidenceItem `json:"evidence"`
}
EvidenceResult is the evidence packet for an investigation.
type EvidenceService ¶
type EvidenceService interface {
ShowEvidence(ctx context.Context, investigationID string) (*EvidenceResult, error)
}
EvidenceService is the optional evidence reading capability used by the CLI.
type EvidenceSourceRevisionResult ¶
type EvidenceSourceRevisionResult struct {
Subject EvidenceSourceSubjectResult `json:"subject"`
SourceUpdatedAt string `json:"source_updated_at,omitempty"`
ObservationSequence int64 `json:"observation_sequence"`
ObservedAt string `json:"observed_at"`
}
EvidenceSourceRevisionResult is the portable recorded source order.
type EvidenceSourceSubjectResult ¶
type EvidenceSourceSubjectResult struct {
Kind string `json:"kind"`
Owner string `json:"owner"`
Repo string `json:"repo"`
ThreadKind string `json:"thread_kind,omitempty"`
Number int `json:"number,omitempty"`
Facet string `json:"facet,omitempty"`
}
EvidenceSourceSubjectResult identifies the independently refreshed corpus projection used by an evidence item.
type ExportResult ¶
type ExportService ¶
type ExportService interface {
ExportDossier(ctx context.Context, repo RepoRef, format string) (*ExportResult, error)
ExportEvidence(ctx context.Context, investigationID, format string) (*ExportResult, error)
}
ExportService renders redacted, deterministic local bundles.
type HealthService ¶
type HealthService interface {
RepositoryHealthWithOptions(ctx context.Context, repo RepoRef, opts health.Options) (*health.Report, error)
}
HealthService exposes deterministic offline repository health metrics.
type HydrateOptions ¶
type HydrateResult ¶
type HydratedFacet ¶
type HypothesisListResult ¶
type HypothesisListResult struct {
Hypotheses []HypothesisResult `json:"hypotheses"`
}
HypothesisListResult is a collection of hypotheses.
type HypothesisResult ¶
type HypothesisResult struct {
ID string `json:"id"`
InvestigationID string `json:"investigation_id"`
Title string `json:"title"`
Description string `json:"description"`
Category string `json:"category"`
Status string `json:"status"`
SourceRefs []WorkflowSourceRefResult `json:"source_refs,omitempty"`
Links []WorkflowLinkResult `json:"links,omitempty"`
AuditTrail []WorkflowAuditResult `json:"audit_trail,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
HypothesisResult is a single hypothesis view.
type HypothesisUpdateOptions ¶
type IndexResult ¶
type IndexResult struct {
Repo RepoRef `json:"repo"`
Path string `json:"path"`
Commit string `json:"commit"`
Files int `json:"files"`
Bytes int `json:"bytes"`
Inserted bool `json:"inserted"`
Message string `json:"message"`
}
IndexResult reports one immutable local code snapshot.
type InitResult ¶
InitResult is the result of initializing a local corpus.
type InvestigationListResult ¶
type InvestigationListResult struct {
Investigations []InvestigationResult `json:"investigations"`
}
InvestigationListResult is a collection of investigations.
type InvestigationResult ¶
type InvestigationResult struct {
ID string `json:"id"`
Repo RepoRef `json:"repo"`
CommitSHA string `json:"commit_sha,omitempty"`
Lens string `json:"lens,omitempty"`
Status string `json:"status"`
ThreadBaseline *ThreadBaselineResult `json:"thread_baseline,omitempty"`
SeedHypothesisID string `json:"seed_hypothesis_id,omitempty"`
AuditTrail []WorkflowAuditResult `json:"audit_trail,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
InvestigationResult is a single investigation view.
type InvestigationService ¶
type InvestigationService interface {
StartInvestigation(ctx context.Context, repo RepoRef, commit, lens string) (*InvestigationResult, error)
ShowInvestigation(ctx context.Context, id string) (*InvestigationResult, error)
ListInvestigations(ctx context.Context) (*InvestigationListResult, error)
AddHypothesis(ctx context.Context, investigationID, title, description, category string) (*HypothesisResult, error)
ListHypotheses(ctx context.Context, investigationID string) (*HypothesisListResult, error)
PromoteOpportunity(ctx context.Context, hypothesisID, problem, scope, impact, effort string, confidence float64) (*OpportunityResult, error)
ShowOpportunity(ctx context.Context, id string) (*OpportunityResult, error)
ListOpportunities(ctx context.Context, investigationID string) (*OpportunityListResult, error)
SetOpportunityStatus(ctx context.Context, id, status, rationale string) (*OpportunityResult, error)
}
InvestigationService is the optional investigation and opportunity management capability used by the CLI.
type JobListResult ¶
type JobListResult struct {
Jobs []JobResult `json:"jobs"`
}
type JobResult ¶
type JobResult struct {
ID string `json:"id"`
Kind string `json:"kind"`
Status string `json:"status"`
Request string `json:"request,omitempty"`
Result string `json:"result,omitempty"`
Error string `json:"error,omitempty"`
Progress string `json:"progress,omitempty"`
Statistics string `json:"statistics,omitempty"`
CreatedAt string `json:"created_at"`
StartedAt string `json:"started_at,omitempty"`
CompletedAt string `json:"completed_at,omitempty"`
CancelledAt string `json:"cancelled_at,omitempty"`
Cancellation bool `json:"cancellation_requested"`
}
type JobService ¶
type JobService interface {
ListJobs(ctx context.Context, status string, limit int) (*JobListResult, error)
GetJob(ctx context.Context, id string) (*JobResult, error)
CancelJob(ctx context.Context, id string) (*JobResult, error)
}
JobService exposes durable background job state and cancellation.
type LensExplainCandidate ¶
type LensExplainCandidate struct {
Kind string `json:"kind"`
Repo RepoRef `json:"repo"`
Number int `json:"number,omitempty"`
Title string `json:"title"`
State string `json:"state,omitempty"`
URL string `json:"url,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
LensExplainCandidate identifies the explained result.
type LensExplainOptions ¶
type LensExplainResult ¶
type LensExplainResult struct {
Lens LensResult `json:"lens"`
Candidate LensExplainCandidate `json:"candidate"`
Query string `json:"query,omitempty"`
PopulationSize int `json:"population_size"`
PopulationScope string `json:"population_scope"`
EvaluatedAt string `json:"evaluated_at"`
Score float64 `json:"score"`
Signals []LensExplainSignal `json:"signals"`
MissingSignals []string `json:"missing_signals,omitempty"`
}
LensExplainResult explains a saved lens score for one candidate.
type LensExplainSignal ¶
type LensExplainSignal struct {
Name string `json:"name"`
Value float64 `json:"value,omitempty"`
Normalized float64 `json:"normalized,omitempty"`
Weight float64 `json:"weight"`
Contribution float64 `json:"contribution"`
Missing bool `json:"missing"`
}
LensExplainSignal exposes one signal value, normalization, and contribution.
type LensListResult ¶
type LensListResult struct {
Lenses []LensResult `json:"lenses"`
}
LensListResult is a list of saved lenses.
type LensResult ¶
type LensResult struct {
Name string `json:"name"`
Definition lens.Definition `json:"definition"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
LensResult is a saved lens definition.
type LensService ¶
type LensService interface {
AddLens(ctx context.Context, name string, def lens.Definition) (*LensResult, error)
ListLenses(ctx context.Context) (*LensListResult, error)
ShowLens(ctx context.Context, name string) (*LensResult, error)
ExplainLens(ctx context.Context, name, ref string, opts LensExplainOptions) (*LensExplainResult, error)
}
LensService is the optional saved-lens management capability used by the CLI.
type ListTriageEventsOptions ¶
type LocalQueryService ¶
type LocalQueryService interface {
Coverage(ctx context.Context, repo RepoRef) (*CoverageResult, error)
RunHistory(ctx context.Context, limit int) (*RunListResult, error)
NeighborQuery(ctx context.Context, repo RepoRef, kind string, number, limit int) (*NeighborListResult, error)
}
LocalQueryService exposes bounded offline corpus queries.
type MCPOptions ¶
type MCPOptions struct {
Transport string
}
MCPOptions carries MCP server startup options.
type MCPRunner ¶
type MCPRunner interface {
Run(ctx context.Context, opts MCPOptions) error
}
MCPRunner is the product-owned boundary for running an MCP server. The CLI adapter dispatches to it and does not own MCP protocol details.
func NewBootstrapMCPRunner ¶
func NewBootstrapMCPRunner() MCPRunner
NewBootstrapMCPRunner returns an MCPRunner that reports ErrNotWired.
type MetadataExportOptions ¶
type MetadataExportOptions struct {
Limit int
}
MetadataExportOptions bounds a local tracking metadata export.
type MetadataExportResult ¶
type MetadataExportResult struct {
SchemaVersion int `json:"schema_version"`
Data json.RawMessage `json:"data"`
TriageEvents int `json:"triage_events"`
Contributions int `json:"contributions"`
ContributionOutcomes int `json:"contribution_outcomes"`
Evidence int `json:"evidence"`
}
MetadataExportResult contains the exported tracking bundle and record counts.
type MetadataImportOptions ¶
type MetadataImportOptions struct {
Data []byte
}
MetadataImportOptions carries a serialized local tracking bundle.
type MetadataImportResult ¶
type MetadataImportResult struct {
SchemaVersion int `json:"schema_version"`
TriageEvents int `json:"triage_events"`
Contributions int `json:"contributions"`
ContributionOutcomes int `json:"contribution_outcomes"`
Evidence int `json:"evidence"`
}
MetadataImportResult reports the imported bundle version and record counts.
type MetadataResult ¶
type MetadataResult struct {
Name string `json:"name"`
Version string `json:"version"`
GoVersion string `json:"go_version"`
OS string `json:"os"`
Architecture string `json:"architecture"`
SchemaVersion int64 `json:"schema_version"`
ConfigPath string `json:"config_path"`
CorpusPath string `json:"corpus_path"`
Capabilities []string `json:"capabilities"`
Features map[string]bool `json:"features"`
}
type NeighborListResult ¶
type NeighborListResult struct {
Repo RepoRef `json:"repo"`
Kind string `json:"kind"`
Number int `json:"number"`
SourceRevision string `json:"source_revision"`
Neighbors []NeighborResult `json:"neighbors"`
}
type NeighborResult ¶
type OpportunityListResult ¶
type OpportunityListResult struct {
Opportunities []OpportunityResult `json:"opportunities"`
Filter string `json:"filter,omitempty"`
}
OpportunityListResult is a collection of opportunities.
type OpportunityResult ¶
type OpportunityResult struct {
ID string `json:"id"`
InvestigationID string `json:"investigation_id"`
HypothesisID string `json:"hypothesis_id"`
Title string `json:"title"`
ProblemStatement string `json:"problem_statement"`
Category string `json:"category"`
Scope string `json:"scope"`
Impact string `json:"impact"`
ExpectedEffort string `json:"expected_effort"`
Confidence float64 `json:"confidence"`
CollisionStatus string `json:"collision_status"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
OpportunityResult is a single opportunity view.
type PrepareIssueOptions ¶
PrepareIssueOptions carries optional fields for issue preparation.
type PreparePROptions ¶
type PreparePROptions struct {
WorkspaceID string
Approach string
Changes string
Compatibility string
Limitations string
LinkedIssue string
Guidance string
}
PreparePROptions carries explicit and optional fields for PR preparation.
type RadarOptions ¶
RadarOptions scopes one bounded, offline contribution ranking.
type RadarService ¶
type RadarService interface {
ContributionRadar(ctx context.Context, opts RadarOptions) (*radar.Report, error)
}
RadarService exposes explainable contribution ranking as a separate, optional offline-read capability.
type RateLimitState ¶
type ReadinessCheck ¶
type ReadinessCheck struct {
CheckID string `json:"check_id"`
RuleID string `json:"rule_id"`
RuleVersion string `json:"rule_version"`
Status string `json:"status"`
Summary string `json:"summary"`
EvidenceRefs []string `json:"evidence_refs,omitempty"`
Remediation string `json:"remediation,omitempty"`
EvaluatedAt string `json:"evaluated_at"`
}
ReadinessCheck is one explainable readiness rule result.
type ReadinessResult ¶
type ReadinessResult struct {
OpportunityID string `json:"opportunity_id"`
RuleSetVersion string `json:"rule_set_version"`
Status string `json:"status"`
EvaluatedAt string `json:"evaluated_at"`
Checks []ReadinessCheck `json:"checks"`
}
ReadinessResult is the deterministic readiness report for one opportunity.
type ReadinessService ¶
type ReadinessService interface {
OpportunityReadiness(ctx context.Context, opportunityID string) (*ReadinessResult, error)
ExplainReadiness(ctx context.Context, checkID string) (*ReadinessCheck, error)
}
ReadinessService is the optional contribution readiness capability used by the CLI.
type RecordEvidenceOptions ¶
type ResearchService ¶
type ResearchService interface {
ThreadResearchBrief(ctx context.Context, ref research.ThreadRef) (*research.Brief, error)
}
ResearchService exposes deterministic local thread briefs as an optional offline-read capability.
type RunListResult ¶
type RunListResult struct {
Runs []RunResult `json:"runs"`
}
type RunValidationOptions ¶
RunValidationOptions carries the run target and explicit host-execution authorization.
type SearchMatch ¶
type SearchMatch struct {
Kind string `json:"kind"`
Repo RepoRef `json:"repo"`
Title string `json:"title"`
Number int `json:"number,omitempty"`
State string `json:"state,omitempty"`
Author string `json:"author,omitempty"`
Labels []string `json:"labels,omitempty"`
URL string `json:"url,omitempty"`
Score float64 `json:"score"`
Body string `json:"-"`
Freshness string `json:"freshness,omitempty"`
Coverage []string `json:"coverage,omitempty"`
}
SearchMatch is one local search result.
type SearchOptions ¶
type SearchOptions struct {
Kind string
Repo string
State string
Author string
Association string
Assignee string
Labels []string
UpdatedAfter time.Time
Limit int
Cursor string
Lens string
}
SearchOptions carries parameters for a local corpus search.
type SearchResult ¶
type SearchResult struct {
Query string `json:"query"`
Kind string `json:"kind"`
Repo string `json:"repo,omitempty"`
Limit int `json:"limit"`
Total int `json:"total"`
Matches []SearchMatch `json:"matches"`
NextCursor string `json:"next_cursor,omitempty"`
}
SearchResult is the result of a local corpus search.
type Service ¶
type Service interface {
Init(ctx context.Context) (*InitResult, error)
Status(ctx context.Context) (*StatusResult, error)
Sync(ctx context.Context, repo RepoRef) (*SyncResult, error)
Search(ctx context.Context, query string, opts SearchOptions) (*SearchResult, error)
Dossier(ctx context.Context, repo RepoRef) (*DossierResult, error)
Index(ctx context.Context, repo RepoRef, path string) (*IndexResult, error)
}
Service is the product-owned application interface used by the CLI and MCP adapters. Implementations live outside the CLI package and must not leak CLI or transport concerns.
func NewBootstrapService ¶
func NewBootstrapService() Service
NewBootstrapService returns a Service that reports ErrNotWired.
type SetupAuthentication ¶ added in v0.3.1
SetupAuthentication describes the credential source recorded by setup. It never contains a credential value and does not imply that credentials were read or validated.
type SetupClientDiscovery ¶ added in v0.3.0
type SetupClientDiscovery struct {
Name string
Path string
Detected bool
Registered bool
Error string
}
SetupClientDiscovery describes one supported coding client and the exact configuration file GitContribute would update.
type SetupDiscovery ¶ added in v0.3.0
type SetupDiscovery struct {
Clients []SetupClientDiscovery
ConfiguredTokenSource string
ConfiguredTokenKey string
GitHubCLIAvailable bool
EnvironmentKeyPresent bool
}
SetupDiscovery is a read-only snapshot used to choose sensible onboarding defaults. Discovery never authenticates, performs network access, or writes configuration.
type SetupObserver ¶ added in v0.3.0
type SetupObserver interface {
SetupStarted(phase SetupPhase)
SetupCompleted(step SetupStep)
}
SetupObserver receives repository-owned progress events. Implementations must return promptly and must not alter setup behavior.
type SetupOptions ¶
type SetupOptions struct {
Remove bool
Clients []string
AllClients bool
// InstallCLI explicitly authorizes a global npm installation of the running
// GitContribute version. It is never inferred in non-interactive operation.
InstallCLI bool
// SkipMCP selects terminal-only setup. An empty Clients slice without
// SkipMCP means detect installed clients rather than disable MCP.
SkipMCP bool
TokenSource string
TokenSourceKey string
Repository string
DryRun bool
// Version is the release used for both persistent installation and an npx
// MCP launcher. Empty values inherit the running service version.
Version string
// Executable and Environment are runtime evidence used to choose a stable
// MCP launcher. They are injectable so setup behavior is testable without
// capturing a temporary npm-cache executable.
Executable string
Environment map[string]string
}
SetupOptions selects independent onboarding capabilities. InstallCLI controls the package-manager mutation; Clients and AllClients control MCP registration. SkipMCP permits terminal-only setup and is mutually exclusive with client selections. DryRun plans every selected capability without invoking npm or writing local state.
type SetupPhase ¶ added in v0.3.0
type SetupPhase string
SetupPhase identifies a long-running application operation.
const ( // SetupPhaseTerminal installs and verifies the persistent terminal command. SetupPhaseTerminal SetupPhase = "terminal" // SetupPhaseConfiguration writes shared local configuration. SetupPhaseConfiguration SetupPhase = "configuration" // SetupPhaseCorpus initializes the local corpus. SetupPhaseCorpus SetupPhase = "corpus" // SetupPhaseClients registers the MCP server with selected clients. SetupPhaseClients SetupPhase = "clients" // SetupPhaseRepository adds the optional initial repository source. SetupPhaseRepository SetupPhase = "repository" // SetupPhaseVerification checks the completed local installation. SetupPhaseVerification SetupPhase = "verification" )
type SetupPromptQuestion ¶ added in v0.3.0
type SetupPromptQuestion string
SetupPromptQuestion identifies one unresolved onboarding decision.
const ( // SetupQuestionInstall asks whether to install the persistent terminal app. SetupQuestionInstall SetupPromptQuestion = "install" // SetupQuestionClients asks which detected clients to configure. SetupQuestionClients SetupPromptQuestion = "clients" // SetupQuestionAuth asks how later sync commands should authenticate. SetupQuestionAuth SetupPromptQuestion = "auth" )
type SetupPromptRequest ¶ added in v0.3.0
type SetupPromptRequest struct {
Discovery SetupDiscovery
Questions []SetupPromptQuestion
InstallCLI bool
Clients []string
TokenSource string
TokenSourceKey string
}
SetupPromptRequest contains resolved flags plus the questions that still require interactive consent.
type SetupPrompter ¶ added in v0.3.0
type SetupPrompter interface {
Select(context.Context, SetupPromptRequest) (SetupSelection, error)
Confirm(context.Context, string) (bool, error)
}
SetupPrompter owns interactive terminal mechanics. Application services never depend on Huh, Bubble Tea, or terminal styling types.
type SetupReport ¶
type SetupReport struct {
Operation string `json:"operation"`
DryRun bool `json:"dry_run"`
Launcher string `json:"launcher,omitempty"`
Authentication *SetupAuthentication `json:"authentication,omitempty"`
Steps []SetupStep `json:"steps"`
}
SetupReport records the effects attempted by setup. Launcher is populated only when MCP was selected and contains the exact command registered with clients. A report may contain both successful and failed independent steps.
func (*SetupReport) HasFailures ¶
func (r *SetupReport) HasFailures() bool
HasFailures reports whether setup could not produce a usable result. A nil report is a failure because callers cannot verify any planned or applied step.
type SetupSelection ¶ added in v0.3.0
type SetupSelection struct {
InstallCLI bool
Clients []string
TokenSource string
TokenSourceKey string
}
SetupSelection is the typed result of the interactive setup form.
type SetupService ¶
type SetupService interface {
DiscoverSetup(ctx context.Context) (*SetupDiscovery, error)
Setup(ctx context.Context, opts SetupOptions) (*SetupReport, error)
SetupWithProgress(ctx context.Context, opts SetupOptions, observer SetupObserver) (*SetupReport, error)
}
SetupService exposes local onboarding and client-registration capabilities. Setup may write local configuration, initialize the corpus, and explicitly invoke npm to install the terminal app. It must not perform GitHub network access or execute repository-controlled code.
type SetupStep ¶
type SetupStep struct {
Name string `json:"name"`
Path string `json:"path,omitempty"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
}
SetupStep describes one independently observable setup effect. Status is a stable human-readable state such as "would install", "installed", "configured", "not installed", or "failed".
type SourceListResult ¶
type SourceListResult struct {
Sources []SourceResult `json:"sources"`
}
type SourceResult ¶
type StatusResult ¶
type StatusResult struct {
Healthy bool `json:"healthy"`
Corpus string `json:"corpus"`
Version string `json:"version"`
Message string `json:"message"`
}
StatusResult reports the health and identity of the local corpus.
type SyncResult ¶
type SyncResult struct {
Repo RepoRef `json:"repo"`
Updated int `json:"updated"`
Message string `json:"message"`
}
SyncResult reports the outcome of syncing a repository.
type TUIOptions ¶
type TUIRunner ¶
type TUIRunner interface {
Run(ctx context.Context, opts TUIOptions) error
}
TUIRunner is the terminal UI adapter boundary.
type TailOptions ¶
type TailResult ¶
type TailResult struct {
Source string `json:"source"`
Iterations int `json:"iterations"`
Last *CrawlResult `json:"last,omitempty"`
}
type TailService ¶
type TailService interface {
TailSource(ctx context.Context, name string, opts TailOptions) (*TailResult, error)
}
TailService exposes continuous source execution separately from the stable discovery interface so lightweight clients can opt in explicitly.
type ThreadBaselineResult ¶
type ThreadBaselineResult struct {
Ref string `json:"ref"`
Repository string `json:"repository"`
Kind string `json:"kind"`
Number int `json:"number"`
ObservationID int64 `json:"observation_id"`
SourceUpdatedAt string `json:"source_updated_at,omitempty"`
ObservationSequence int64 `json:"observation_sequence"`
ObservedAt string `json:"observed_at,omitempty"`
Source WorkflowSourceRefResult `json:"source"`
DescriptionTruncated bool `json:"description_truncated"`
}
ThreadBaselineResult is the immutable observation revision saved at start.
type ThreadInvestigationResult ¶
type ThreadInvestigationResult struct {
Created bool `json:"created"`
Investigation *InvestigationResult `json:"investigation"`
Hypothesis *HypothesisResult `json:"hypothesis"`
}
ThreadInvestigationResult contains the atomically created or reused pair.
type ThreadInvestigationService ¶
type ThreadInvestigationService interface {
StartInvestigationFromThread(ctx context.Context, ref research.ThreadRef) (*ThreadInvestigationResult, error)
}
ThreadInvestigationService is the optional local-write capability for starting an investigation and seed hypothesis from one stored thread.
type ThreadListItem ¶
type ThreadListResult ¶
type ThreadListResult struct {
Repo RepoRef `json:"repo"`
Threads []ThreadListItem `json:"threads"`
Freshness string `json:"freshness,omitempty"`
Coverage []CoverageFacet `json:"coverage,omitempty"`
}
type TrackingService ¶
type TrackingService interface {
RecordTriageEvent(ctx context.Context, opts RecordTriageEventOptions) (*TriageEventResult, error)
ListTriageEvents(ctx context.Context, opts ListTriageEventsOptions) (*TriageEventListResult, error)
RecordContribution(ctx context.Context, opts RecordContributionOptions) (*ContributionResult, error)
GetContribution(ctx context.Context, id string) (*ContributionResult, error)
ListContributions(ctx context.Context, opts ListContributionsOptions) (*ContributionListResult, error)
RecordContributionOutcome(ctx context.Context, opts RecordContributionOutcomeOptions) (*ContributionOutcomeResult, error)
ListContributionOutcomes(ctx context.Context, contributionID string) (*ContributionOutcomeListResult, error)
ExportLocalMetadata(ctx context.Context, opts MetadataExportOptions) (*MetadataExportResult, error)
ImportLocalMetadata(ctx context.Context, opts MetadataImportOptions) (*MetadataImportResult, error)
}
TrackingService exposes local triage, contribution, and metadata portability operations. Implementations must keep local state separate from GitHub state and must not perform network access.
type TriageEventListResult ¶
type TriageEventListResult struct {
Events []TriageEventResult `json:"events"`
Limit int `json:"limit"`
Total int `json:"total"`
}
type TriageEventResult ¶
type TriageEventResult struct {
ID string `json:"id"`
TargetKind string `json:"target_kind"`
TargetRef string `json:"target_ref"`
Outcome string `json:"outcome"`
Reason string `json:"reason,omitempty"`
Lens string `json:"lens,omitempty"`
SourceEventAt string `json:"source_event_at,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type UpgradeOptions ¶
type UpgradeReport ¶
type UpgradeService ¶
type UpgradeService interface {
Upgrade(ctx context.Context, opts UpgradeOptions) (*UpgradeReport, error)
}
type ValidationComparisonResult ¶
type ValidationComparisonResult struct {
Base *ValidationRunResult `json:"base"`
Candidate *ValidationRunResult `json:"candidate"`
Classification string `json:"classification"`
Explanation string `json:"explanation"`
}
ValidationComparisonResult classifies a base run against a candidate run.
type ValidationResult ¶
type ValidationResult struct {
ID string `json:"id"`
InvestigationID string `json:"investigation_id"`
Kind string `json:"kind"`
Command []string `json:"command"`
WorkingDir string `json:"working_dir"`
BaseWorkingDir string `json:"base_working_dir,omitempty"`
CandidateDir string `json:"candidate_dir,omitempty"`
Env []string `json:"environment_allowlist,omitempty"`
Timeout string `json:"timeout,omitempty"`
MaxOutputBytes int64 `json:"max_output_bytes,omitempty"`
CreatedAt string `json:"created_at"`
}
ValidationResult is a stored validation definition view.
type ValidationRunResult ¶
type ValidationRunResult struct {
ID string `json:"id"`
DefinitionID string `json:"definition_id"`
InvestigationID string `json:"investigation_id"`
Kind string `json:"kind"`
ExitCode int `json:"exit_code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
Truncated bool `json:"truncated"`
Error string `json:"error,omitempty"`
Classification string `json:"classification"`
StartedAt string `json:"started_at"`
CompletedAt string `json:"completed_at"`
}
ValidationRunResult is the captured outcome of one validation run.
type ValidationService ¶
type ValidationService interface {
DefineValidation(ctx context.Context, investigationID string, opts DefineValidationOptions) (*ValidationResult, error)
ShowValidation(ctx context.Context, id string) (*ValidationResult, error)
RunValidation(ctx context.Context, id string, opts RunValidationOptions) (*ValidationRunResult, error)
CompareValidation(ctx context.Context, baseRunID, candidateRunID string) (*ValidationComparisonResult, error)
}
ValidationService is the optional validation management capability used by the CLI.
type WorkflowAuditResult ¶
type WorkflowAuditResult struct {
From string `json:"from,omitempty"`
To string `json:"to"`
Rationale string `json:"rationale"`
At string `json:"at"`
}
WorkflowAuditResult records why a local workflow object changed state.
type WorkflowExtensionService ¶
type WorkflowExtensionService interface {
UpdateHypothesisForCLI(ctx context.Context, id string, opts HypothesisUpdateOptions) (any, error)
TransitionHypothesisForCLI(ctx context.Context, id, status, rationale string) (any, error)
CheckDuplicatesForCLI(ctx context.Context, target, id string, limit int) (any, error)
CheckCollisionsForCLI(ctx context.Context, target, id string, limit int) (any, error)
SetCollisionForCLI(ctx context.Context, id, status, rationale string) (any, error)
RecordEvidenceForCLI(ctx context.Context, opts RecordEvidenceOptions) (any, error)
WorkspaceDiffForCLI(ctx context.Context, id string) (any, error)
PrepareReviewForCLI(ctx context.Context, opportunityID, workspaceID string) (any, error)
}
WorkflowExtensionService exposes the evidence-first workflow capabilities that sit beyond the original compact CLI service contract.
type WorkflowLinkResult ¶
type WorkflowLinkResult struct {
Kind string `json:"kind"`
Ref string `json:"ref"`
Source WorkflowSourceRefResult `json:"source"`
}
WorkflowLinkResult is an explicit hypothesis source link.
type WorkflowSourceRefResult ¶
type WorkflowSourceRefResult struct {
Source string `json:"source"`
URL string `json:"url,omitempty"`
CommitSHA string `json:"commit_sha,omitempty"`
ObservedAt string `json:"observed_at,omitempty"`
AsOf string `json:"as_of,omitempty"`
}
WorkflowSourceRefResult is a transport-stable workflow provenance record.
type WorkspaceCreateOptions ¶
WorkspaceCreateOptions carries explicit local-write intent for workspace creation.
type WorkspaceResult ¶
type WorkspaceResult struct {
ID string `json:"id"`
InvestigationID string `json:"investigation_id"`
Repo RepoRef `json:"repo"`
Path string `json:"path"`
Remote string `json:"remote"`
BaseSHA string `json:"base_sha"`
CandidateSHA string `json:"candidate_sha"`
MergeBase string `json:"merge_base"`
Dirty bool `json:"dirty"`
CreatedAt string `json:"created_at"`
}
WorkspaceResult is a durable view of a managed Git worktree.
type WorkspaceService ¶
type WorkspaceService interface {
CreateWorkspace(ctx context.Context, investigationID string, opts WorkspaceCreateOptions) (*WorkspaceResult, error)
ShowWorkspace(ctx context.Context, id string) (*WorkspaceResult, error)
}
WorkspaceService is the optional workspace management capability used by the CLI.
Source Files
¶
- bootstrap.go
- cli.go
- doc.go
- dossier_cli.go
- errors.go
- evidence_cmd.go
- evidence_output.go
- evidence_types.go
- health_cli.go
- interactive.go
- interfaces.go
- investigation_thread_cli.go
- investigation_thread_output.go
- investigation_types.go
- output.go
- radar_cli.go
- radar_interfaces.go
- readiness_cmd.go
- readiness_output.go
- readiness_types.go
- research_cli.go
- research_interfaces.go
- setup_cli.go
- setup_progress.go
- setup_prompt.go
- setup_render.go
- setup_types.go
- tracking.go
- tracking_bundle_types.go