mock

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: GPL-3.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultCommitMessage = "feat(store): add user lookup by name\n\nSynthetic commit message from the mock provider."

DefaultCommitMessage is the canned plain-text response the mock returns for a FreeForm request (ADR-0015), exercising the --suggest-commit path.

View Source
const DefaultCommitMessages = "feat(store): add user lookup by name\n" +
	commitDelimiter + "\nfeat(store): support finding users by their name\n" +
	commitDelimiter + "\nfeat: add name-based user lookup to the store"

DefaultCommitMessages is the canned multi-suggestion FreeForm response (ADR-0019 --generate path), returned when the prompt requests delimited messages. Three distinct subjects, delimiter-joined.

View Source
const DefaultResponseContent = `` /* 265-byte string literal not displayed */

DefaultResponseContent is the canned JSON the mock provider returns when no override is set on ResponseContent. It matches the ADR-0014 JSON findings schema so the renderer's happy path is exercised end-to-end in any CLI integration test that doesn't explicitly stage its own payload. The single finding's title is "mock review output" — historically asserted by CLI tests that previously expected a plain-text body; the string survives the format change as a finding-title match.

Variables

This section is empty.

Functions

func Metadata added in v1.17.0

func Metadata() provider.Metadata

Metadata describes the mock provider so the two registries stay in step: anything that enumerates providers sees the same set either way. See ADR-0039.

It reads its facts off a fresh New() rather than restating them, so the canned name, model, window and pricing have exactly one definition. The mock has no supportedModels table because it serves a single synthetic model and bills nothing, hence the zero Pricing.

main.go does not blank-import this package, so the mock never reaches the shipped inventory — only test binaries that import it see this entry.

func Register

func Register()

Register installs a fresh mock provider under the name "mock" in the global registry. Tests that drive the CLI through config-driven provider lookup (Phase 5+) call this; production code never imports this package.

Types

type Provider

type Provider struct {
	NameValue        string
	DefaultModelName string
	Window           int
	PricingValue     provider.Pricing

	ResponseContent string
	Latency         time.Duration

	InputTokens  int
	OutputTokens int
	CachedInput  int

	// Error injection
	ReviewErr   error
	TestConnErr error

	// Call telemetry
	ReviewCalls int
	TestCalls   int
	LastRequest provider.Request
	// contains filtered or unexported fields
}

func New

func New() *Provider

func (*Provider) ContextWindow

func (m *Provider) ContextWindow(string) int

func (*Provider) DefaultModel

func (m *Provider) DefaultModel() string

func (*Provider) EstimateTokens

func (m *Provider) EstimateTokens(s string) int

func (*Provider) Name

func (m *Provider) Name() string

func (*Provider) Pricing

func (m *Provider) Pricing(string) provider.Pricing

func (*Provider) Review

func (m *Provider) Review(ctx context.Context, req provider.Request) (provider.Response, error)

func (*Provider) TestConnection

func (m *Provider) TestConnection(ctx context.Context) error

Jump to

Keyboard shortcuts

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