config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package config handles Telescope configuration loading and defaults.

Package config handles loading and parsing of Telescope configuration files.

Loading Configuration

Load searches for configuration files in a workspace directory, trying each path in ConfigFiles order. The canonical location is .telescope/config.yaml, with legacy root-level config files still supported:

cfg, err := config.Load("/path/to/project")

If no configuration file is found, DefaultConfig is returned with sensible defaults (extends telescope:recommended, standard include patterns for YAML/JSON files).

LoadFile loads from a specific path:

cfg, err := config.LoadFile(".telescope/config.yaml")

Configuration Fields

The Config struct supports:

  • Workspace: shared targets, ignore globs, and env files
  • Generation: inline Cartographer config plus bundle/overlay defaults
  • Linting: rule presets, overrides, Spectral rulesets, and engine settings
  • Validation: OpenAPI validation, breaking changes, and schema validation
  • Testing: contract tests, workflow targets, and mock defaults
  • Documentation: printing-press generation and preview defaults
  • Extension: editor-only settings
  • Legacy fields: root-level .telescope.yaml compatibility

Index

Constants

This section is empty.

Variables

View Source
var ConfigFiles = []string{
	".telescope/config.yaml",
	".telescope/config.yml",
	".telescope.yaml",
	".telescope.yml",
}

ConfigFiles are the files searched for configuration, in priority order.

View Source
var DefaultEnvFiles = []string{".env", ".env.local"}

DefaultEnvFiles are loaded in order from the workspace root when contractTests.envFiles is unset. Later files override earlier ones (e.g. .env.local overrides .env).

View Source
var SpectralFiles = []string{
	".telescope/spectral.yaml",
	".telescope/spectral.yml",
	".telescope/spectral.json",
	".spectral.yaml",
	".spectral.yml",
	".spectral.json",
}

SpectralFiles lists the config filenames searched for Spectral rulesets, in priority order. The .telescope/ directory is searched first so that Telescope-specific configuration takes precedence over workspace-root Spectral configs.

Functions

func FindSpectralRuleset

func FindSpectralRuleset(workspaceRoot string) (string, error)

FindSpectralRuleset searches the workspace root for a Spectral ruleset file, returning the full path to the first match. Returns ("", nil) when no file is found.

func LoadSpectralRuleset

func LoadSpectralRuleset(workspaceRoot string) (*rulesets.RuleSet, error)

LoadSpectralRuleset discovers and loads the first available Spectral ruleset file in the workspace. Returns (nil, nil) when no file is found.

func LoadWorkspaceDotenv

func LoadWorkspaceDotenv(root string, files []string) (map[string]string, error)

LoadWorkspaceDotenv reads dotenv files from root and merges them. Missing files are skipped. If files is nil or empty, DefaultEnvFiles is used.

func LookupEnv

func LookupEnv(dotenv map[string]string, key string) string

LookupEnv returns dotenv[key] if non-empty, else os.Getenv(key).

func OAuth2TokenEndpointFromSpec

func OAuth2TokenEndpointFromSpec(idx *navigator.Index, schemeName string, override string) string

OAuth2TokenEndpointFromSpec returns a token URL from the OpenAPI oauth2/openIdConnect security scheme, if present.

func ParseDotEnv

func ParseDotEnv(data []byte) map[string]string

ParseDotEnv parses KEY=VALUE lines (export KEY= allowed). Empty lines and # comments are skipped. Values may be double- or single-quoted; basic escape sequences in double quotes are handled.

func ResolveRunner

func ResolveRunner(ref RuleRef) string

ResolveRunner determines the runner for a rule reference. "auto" or empty resolves to "bun" for .ts/.js files.

func ResolveTelescopePath

func ResolveTelescopePath(workspaceRoot, p string) string

ResolveTelescopePath resolves a Telescope-owned asset path under .telescope/, preserving absolute paths and explicit .telescope/ prefixes.

func ResolveWorkspacePath

func ResolveWorkspacePath(workspaceRoot, p string) string

ResolveWorkspacePath joins workspaceRoot with p when p is relative; absolute paths are cleaned as-is.

func TelescopeAssetRef

func TelescopeAssetRef(p string) string

TelescopeAssetRef converts a v2 asset path into a workspace-relative reference under .telescope/, preserving absolute paths.

func WorkspaceRootForConfigPath

func WorkspaceRootForConfigPath(configPath string) string

WorkspaceRootForConfigPath derives the workspace root from a config path. Config files under .telescope/ resolve to the parent directory.

Types

type ActionOutputSection

type ActionOutputSection struct {
	Format         string `yaml:"format,omitempty"`
	Color          string `yaml:"color,omitempty"`
	ReportMarkdown string `yaml:"reportMarkdown,omitempty"`
	ReportJSON     string `yaml:"reportJson,omitempty"`
	Path           string `yaml:"path,omitempty"`
}

type AutofixSection

type AutofixSection struct {
	Mode string `yaml:"mode,omitempty"`
}

type AutomationCISection

type AutomationCISection struct {
	Enabled        bool                     `yaml:"enabled,omitempty"`
	Actions        []string                 `yaml:"actions,omitempty"`
	ReportScope    string                   `yaml:"reportScope,omitempty"`
	FailOn         string                   `yaml:"failOn,omitempty"`
	FailOnBreaking bool                     `yaml:"failOnBreaking,omitempty"`
	GitHub         AutomationGitHubSection  `yaml:"github,omitempty"`
	Outputs        AutomationOutputsSection `yaml:"outputs,omitempty"`
}

type AutomationGitHubSection

type AutomationGitHubSection struct {
	CommentPR bool `yaml:"commentPR,omitempty"`
}

type AutomationOutputsSection

type AutomationOutputsSection struct {
	Markdown string `yaml:"markdown,omitempty"`
	JSON     string `yaml:"json,omitempty"`
	SARIF    string `yaml:"sarif,omitempty"`
}

type AutomationSection

type AutomationSection struct {
	CI AutomationCISection `yaml:"ci,omitempty"`
}

AutomationSection configures CI and GitHub Action defaults.

type BarrelmanEngineSection

type BarrelmanEngineSection struct {
	Enabled bool `yaml:"enabled,omitempty"`
}

type BreakingChangesSection

type BreakingChangesSection struct {
	Enabled   bool                  `yaml:"enabled,omitempty"`
	CompareTo string                `yaml:"compareTo,omitempty"`
	OnSave    bool                  `yaml:"onSave,omitempty"`
	Rules     string                `yaml:"rules,omitempty"`
	Output    BreakingOutputSection `yaml:"output,omitempty"`
}

type BreakingOutputSection

type BreakingOutputSection struct {
	Format string `yaml:"format,omitempty"`
	Path   string `yaml:"path,omitempty"`
}

type BunRuleConfig

type BunRuleConfig struct {
	Path     string         `yaml:"path,omitempty"`
	Severity string         `yaml:"severity,omitempty"`
	Targets  []string       `yaml:"targets,omitempty"`
	Options  map[string]any `yaml:"options,omitempty"`
}

type BundleGenerationSection

type BundleGenerationSection struct {
	Enabled bool     `yaml:"enabled,omitempty"`
	Targets []string `yaml:"targets,omitempty"`
	Output  string   `yaml:"output,omitempty"`
}

type CartographerConfigSection

type CartographerConfigSection struct {
	Config map[string]any `yaml:"config,omitempty"`
}

type ChangeDetectionSection

type ChangeDetectionSection struct {
	Scope string `yaml:"scope,omitempty"`
}

type Config

type Config struct {
	ConfigVersion        int                        `yaml:"configVersion,omitempty"`
	Workspace            WorkspaceSection           `yaml:"workspace,omitempty"`
	Generation           GenerationSection          `yaml:"generation,omitempty"`
	Linting              LintingSection             `yaml:"linting,omitempty"`
	Validation           ValidationSection          `yaml:"validation,omitempty"`
	Formatting           FormattingSection          `yaml:"formatting,omitempty"`
	Testing              TestingSection             `yaml:"testing,omitempty"`
	Documentation        DocumentationSection       `yaml:"documentation,omitempty"`
	Extension            ExtensionSection           `yaml:"extension,omitempty"`
	Automation           AutomationSection          `yaml:"automation,omitempty"`
	Extends              string                     `yaml:"extends,omitempty"`
	Roots                []string                   `yaml:"roots,omitempty"`
	Rules                map[string]string          `yaml:"rules,omitempty"`
	Include              []string                   `yaml:"include,omitempty"`
	Exclude              []string                   `yaml:"exclude,omitempty"`
	Lint                 LintConfig                 `yaml:"lint,omitempty"`
	SpectralRulesets     []string                   `yaml:"spectralRulesets,omitempty"`
	GuidelinesBaseURL    string                     `yaml:"guidelinesBaseURL,omitempty"`
	OpenAPI              OpenAPIConfig              `yaml:"openapi,omitempty"`
	AdditionalValidation map[string]ValidationGroup `yaml:"additionalValidation,omitempty"`
	Output               OutputConfig               `yaml:"output,omitempty"`
	LSP                  LSPConfig                  `yaml:"lsp,omitempty"`
	ContractTests        ContractTestsConfig        `yaml:"contractTests,omitempty"`
}

Config represents the Telescope configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a configuration with sensible defaults.

func Load

func Load(workspaceRoot string) (*Config, error)

Load finds and loads the telescope config from the given workspace root. Returns the default config if no config file is found.

func LoadFile

func LoadFile(path string) (*Config, error)

LoadFile loads config from a specific file path.

func (*Config) BuildEnabledRules

func (c *Config) BuildEnabledRules() map[string]bool

BuildEnabledRules resolves rule enables/disables from config + ruleset.

func (*Config) EffectiveContractBaseURL

func (c *Config) EffectiveContractBaseURL(explicit string) string

EffectiveContractBaseURL returns the configured base URL for contract tests.

func (*Config) EffectiveContractConcurrency

func (c *Config) EffectiveContractConcurrency() int

EffectiveContractConcurrency returns the worker pool size for contract tests.

func (*Config) EffectiveDiffCompareBaseRef

func (c *Config) EffectiveDiffCompareBaseRef() string

EffectiveDiffCompareBaseRef returns the git ref used for diff-on-save / breaking previews.

func (*Config) EffectiveEnvFiles

func (c *Config) EffectiveEnvFiles() []string

EffectiveEnvFiles returns the repo-level env file chain for runtime actions.

func (*Config) EffectiveGuidelinesBaseURL

func (c *Config) EffectiveGuidelinesBaseURL() string

EffectiveGuidelinesBaseURL returns the configured docs base URL, falling back to barrelman's env/default resolution.

func (*Config) EffectiveLintEngines

func (c *Config) EffectiveLintEngines() []string

EffectiveLintEngines returns the normalized list of configured lint engines. Supported values are "barrelman" and "vacuum"; "both" expands to both.

func (*Config) EffectivePresetNames

func (c *Config) EffectivePresetNames() []string

EffectivePresetNames returns the builtin preset list that should be applied.

func (*Config) EffectiveRuleSet

func (c *Config) EffectiveRuleSet() *rulesets.RuleSet

EffectiveRuleSet returns the merged builtin rulesets and config overrides that should drive enablement and severity decisions.

func (*Config) EffectiveSchemaValidationMode

func (c *Config) EffectiveSchemaValidationMode() string

EffectiveSchemaValidationMode returns the configured LSP schema-validation mode, defaulting to "go". Legacy "bun" and "compare" values are accepted for compatibility but are normalized to "go".

func (*Config) EffectiveWiretapEnabled

func (c *Config) EffectiveWiretapEnabled(override *bool) bool

EffectiveWiretapEnabled reports whether contract tests should use Wiretap.

func (*Config) HasCustomRules

func (c *Config) HasCustomRules() bool

HasCustomRules reports whether the config declares any custom rules.

func (*Config) HasSpectralRulesets

func (c *Config) HasSpectralRulesets() bool

HasSpectralRulesets reports whether the config declares any Spectral rulesets.

func (*Config) HasValidationSchemas

func (c *Config) HasValidationSchemas() bool

HasValidationSchemas reports whether any additionalValidation group references schema files that need the sidecar (AJV or Zod validation).

func (*Config) NeedsBunSidecar

func (c *Config) NeedsBunSidecar() bool

NeedsBunSidecar reports whether the config requires the Bun sidecar to be started (custom rules, Spectral rulesets, or additional validation schemas).

func (*Config) ResolveAndFetchCredentials

func (c *Config) ResolveAndFetchCredentials(ctx context.Context, navIdx *navigator.Index, tokenOverrides map[string]string, workspaceRoot string, dotenv map[string]string, httpClient *http.Client) (map[string]string, error)

ResolveAndFetchCredentials resolves contract credentials from either the v2 testing.contract block or the legacy contractTests block, then performs any configured OAuth token exchange.

func (*Config) UsesV2Layout

func (c *Config) UsesV2Layout() bool

UsesV2Layout reports whether any v2-only top-level sections are configured.

func (*Config) UsesVacuum

func (c *Config) UsesVacuum() bool

UsesVacuum reports whether the configured lint engine set includes vacuum.

type ContractTLSConfig

type ContractTLSConfig struct {
	ClientCertFile string `yaml:"clientCertFile,omitempty"`
	ClientKeyFile  string `yaml:"clientKeyFile,omitempty"`
	CACertFile     string `yaml:"caCertFile,omitempty"`
}

ContractTLSConfig configures the HTTP client used for contract tests (Barometer runner).

type ContractTarget

type ContractTarget struct {
	ID        string   `yaml:"id,omitempty"`
	Kind      string   `yaml:"kind,omitempty"` // openapi | arazzo
	Include   []string `yaml:"include,omitempty"`
	Tags      []string `yaml:"tags,omitempty"`
	Workflows []string `yaml:"workflows,omitempty"`
}

ContractTarget selects documents for batch contract runs (optional; single-doc runs use the open file).

type ContractTestingSection

type ContractTestingSection struct {
	Enabled       bool                          `yaml:"enabled,omitempty"`
	Targets       []string                      `yaml:"targets,omitempty"`
	BaseURL       string                        `yaml:"baseUrl,omitempty"`
	Concurrency   int                           `yaml:"concurrency,omitempty"`
	Timeout       time.Duration                 `yaml:"timeout,omitempty"`
	SkipTLSVerify bool                          `yaml:"skipTlsVerify,omitempty"`
	TLS           ContractTLSConfig             `yaml:"tls,omitempty"`
	Credentials   map[string]CredentialSourceV2 `yaml:"credentials,omitempty"`
	Wiretap       WiretapSettingsSection        `yaml:"wiretap,omitempty"`
}

type ContractTestsConfig

type ContractTestsConfig struct {
	Enabled        bool          `yaml:"enabled,omitempty"`
	DefaultBaseURL string        `yaml:"defaultBaseUrl,omitempty"`
	Concurrency    int           `yaml:"concurrency,omitempty"`
	RequestTimeout time.Duration `yaml:"requestTimeout,omitempty"`
	SkipTLSVerify  bool          `yaml:"skipTlsVerify,omitempty"`
	// TLS optionally loads client certificates and a custom CA for mTLS / private PKI (paths relative to workspace root unless absolute).
	TLS ContractTLSConfig `yaml:"tls,omitempty"`
	// EnvFiles lists dotenv files (relative to workspace root) merged in order for credential *Env lookups.
	// When empty, DefaultEnvFiles (.env then .env.local) is used.
	EnvFiles    []string                    `yaml:"envFiles,omitempty"`
	Credentials map[string]CredentialSource `yaml:"credentials,omitempty"`
	Targets     []ContractTarget            `yaml:"targets,omitempty"`
	Wiretap     WiretapConfig               `yaml:"wiretap,omitempty"`
}

ContractTestsConfig configures in-process Barometer contract testing.

func (*ContractTestsConfig) EffectiveConcurrency

func (c *ContractTestsConfig) EffectiveConcurrency() int

EffectiveConcurrency returns worker pool size (default 2).

func (*ContractTestsConfig) EffectiveContractBaseURL

func (c *ContractTestsConfig) EffectiveContractBaseURL(explicit string) string

EffectiveContractBaseURL returns base URL for a run.

func (*ContractTestsConfig) EffectiveEnvFiles

func (c *ContractTestsConfig) EffectiveEnvFiles() []string

EffectiveEnvFiles returns env file names to load for contract credential resolution.

func (*ContractTestsConfig) EffectiveWiretapEnabled

func (c *ContractTestsConfig) EffectiveWiretapEnabled(override *bool) bool

EffectiveWiretapEnabled reports whether wiretap should be used for a run. A non-nil override wins over config.

func (*ContractTestsConfig) ResolveAndFetchCredentials

func (c *ContractTestsConfig) ResolveAndFetchCredentials(ctx context.Context, navIdx *navigator.Index, tokenOverrides map[string]string, dotenv map[string]string, httpClient *http.Client) (map[string]string, error)

ResolveAndFetchCredentials runs static credential resolution, then optional OAuth2 token exchange for strategies oauth2ClientCredentials and oauth2Refresh. httpClient may be nil (uses http.DefaultClient).

func (*ContractTestsConfig) ResolveContractCredentials

func (c *ContractTestsConfig) ResolveContractCredentials(tokenOverrides map[string]string, dotenv map[string]string) map[string]string

ResolveContractCredentials expands env vars from config into scheme name -> secret strings for Barometer. dotenv is optional workspace dotenv map (from .env); lookups use LookupEnv(dotenv, key). tokenOverrides (e.g. from LSP command args / VS Code SecretStorage) take precedence per scheme name.

type CredentialSource

type CredentialSource struct {
	// Strategy is empty or "static" (default): only env-backed secrets above.
	// "oauth2ClientCredentials" exchanges client_id/client_secret at oauth2TokenUrl (or spec flows.clientCredentials.tokenUrl).
	// "oauth2Refresh" uses refresh_token grant with refreshTokenEnv, clientIdEnv, clientSecretEnv.
	Strategy         string   `yaml:"strategy,omitempty"`
	OAuth2TokenURL   string   `yaml:"oauth2TokenUrl,omitempty"`
	OAuth2Scopes     []string `yaml:"oauth2Scopes,omitempty"`
	APIKeyEnv        string   `yaml:"apiKeyEnv,omitempty"`
	AccessTokenEnv   string   `yaml:"accessTokenEnv,omitempty"`
	BasicAuthEnv     string   `yaml:"basicAuthEnv,omitempty"` // user:password in one variable
	UsernameEnv      string   `yaml:"usernameEnv,omitempty"`  // for http Basic when BasicAuthEnv is not used
	PasswordEnv      string   `yaml:"passwordEnv,omitempty"`
	RefreshTokenEnv  string   `yaml:"refreshTokenEnv,omitempty"`
	OAuthInteractive *bool    `yaml:"oauthInteractive,omitempty"`
	ClientIDEnv      string   `yaml:"clientIdEnv,omitempty"`
	ClientSecretEnv  string   `yaml:"clientSecretEnv,omitempty"`
}

CredentialSource maps one OpenAPI security scheme name to env-based secrets. Resolution order per scheme: tokenOverrides, then username+password (http Basic), apiKey, access token, basicAuthEnv single value, then OAuth strategies (see Strategy). Each *Env value is looked up in workspace dotenv files first, then the process environment.

func (CredentialSource) CredentialEnvHintString

func (s CredentialSource) CredentialEnvHintString() string

CredentialEnvHintString lists non-empty *Env field names for diagnostics when credentials are missing.

type CredentialSourceV2

type CredentialSourceV2 struct {
	Strategy     string                `yaml:"strategy,omitempty"`
	APIKey       CredentialValueSource `yaml:"apiKey,omitempty"`
	AccessToken  CredentialValueSource `yaml:"accessToken,omitempty"`
	Username     CredentialValueSource `yaml:"username,omitempty"`
	Password     CredentialValueSource `yaml:"password,omitempty"`
	Basic        CredentialValueSource `yaml:"basic,omitempty"`
	ClientID     CredentialValueSource `yaml:"clientId,omitempty"`
	ClientSecret CredentialValueSource `yaml:"clientSecret,omitempty"`
	RefreshToken CredentialValueSource `yaml:"refreshToken,omitempty"`
	TokenURL     string                `yaml:"tokenUrl,omitempty"`
	Scopes       []string              `yaml:"scopes,omitempty"`
}

CredentialSourceV2 is the action-oriented contract credential shape.

type CredentialValueSource

type CredentialValueSource struct {
	Env     string `yaml:"env,omitempty"`
	File    string `yaml:"file,omitempty"`
	Literal string `yaml:"literal,omitempty"`
}

CredentialValueSource resolves one secret or literal from the environment, a file in the workspace, or inline config.

type CustomRulesSection

type CustomRulesSection struct {
	Bun []BunRuleConfig `yaml:"bun,omitempty"`
}

type DedupeSection

type DedupeSection struct {
	Strategy string `yaml:"strategy,omitempty"`
}

type DocumentationSection

type DocumentationSection struct {
	PrintingPress PrintingPressSection `yaml:"printingPress,omitempty"`
}

DocumentationSection configures printing-press generation and preview.

type ExtensionDefaultsSection

type ExtensionDefaultsSection struct {
	LintEngine string `yaml:"lintEngine,omitempty"`
	DocsTheme  string `yaml:"docsTheme,omitempty"`
}

type ExtensionDiagnosticsSection

type ExtensionDiagnosticsSection struct {
	Debounce    time.Duration `yaml:"debounce,omitempty"`
	MaxFileSize string        `yaml:"maxFileSize,omitempty"`
}

type ExtensionSection

type ExtensionSection struct {
	Diagnostics    ExtensionDiagnosticsSection `yaml:"diagnostics,omitempty"`
	LanguageServer LanguageServerSection       `yaml:"languageServer,omitempty"`
	Defaults       ExtensionDefaultsSection    `yaml:"defaults,omitempty"`
}

ExtensionSection contains editor-only settings.

type ExtensionsConfig

type ExtensionsConfig struct {
	Schemas  []string `yaml:"schemas,omitempty"`  // .telescope/extensions/*.json filenames
	Required []string `yaml:"required,omitempty"` // extension names that must be present
}

ExtensionsConfig configures x-* extension validation.

type FormattingSection

type FormattingSection struct {
	Prettier PrettierFormattingSection `yaml:"prettier,omitempty"`
}

FormattingSection configures editor/CLI formatting behavior.

type GenerationSection

type GenerationSection struct {
	OpenAPI  OpenAPIGenerationSection `yaml:"openapi,omitempty"`
	Bundle   BundleGenerationSection  `yaml:"bundle,omitempty"`
	Overlays OverlayGenerationSection `yaml:"overlays,omitempty"`
}

GenerationSection configures spec generation and assembly workflows.

type LSPConfig

type LSPConfig struct {
	Debounce           time.Duration               `yaml:"debounce,omitempty"`
	MaxFileSize        int64                       `yaml:"maxFileSize,omitempty"`
	SchemaValidation   LSPSchemaValidationSettings `yaml:"schemaValidation,omitempty"`
	DiffOnSave         bool                        `yaml:"diffOnSave,omitempty"`
	BreakingRulesPath  string                      `yaml:"breakingRulesPath,omitempty"`
	DiffCompareBaseRef string                      `yaml:"diffCompareBaseRef,omitempty"` // default: HEAD
}

LSPConfig controls LSP server behavior.

type LSPSchemaValidationSettings

type LSPSchemaValidationSettings struct {
	Mode string `yaml:"mode,omitempty"` // go (legacy bun/compare values are treated as go)
}

LSPSchemaValidationSettings configures schema validation behavior.

type LanguageServerSection

type LanguageServerSection struct {
	Trace string `yaml:"trace,omitempty"`
}

type LintConfig

type LintConfig struct {
	Engines []string     `yaml:"engines,omitempty"` // barrelman, vacuum
	Vacuum  VacuumConfig `yaml:"vacuum,omitempty"`
}

LintConfig controls which lint engines run for CLI/LSP flows.

type LintingEnginesSection

type LintingEnginesSection struct {
	Barrelman BarrelmanEngineSection `yaml:"barrelman,omitempty"`
	Vacuum    VacuumEngineSection    `yaml:"vacuum,omitempty"`
}

type LintingRulesetSection

type LintingRulesetSection struct {
	Spectral []string `yaml:"spectral,omitempty"`
}

type LintingSection

type LintingSection struct {
	Enabled           bool                  `yaml:"enabled,omitempty"`
	Targets           []string              `yaml:"targets,omitempty"`
	Presets           []string              `yaml:"presets,omitempty"`
	Overrides         map[string]string     `yaml:"overrides,omitempty"`
	GuidelinesBaseURL string                `yaml:"guidelinesBaseUrl,omitempty"`
	Engines           LintingEnginesSection `yaml:"engines,omitempty"`
	Rulesets          LintingRulesetSection `yaml:"rulesets,omitempty"`
	CustomRules       CustomRulesSection    `yaml:"customRules,omitempty"`
	Output            ActionOutputSection   `yaml:"output,omitempty"`
}

LintingSection configures rule presets, overrides, and engines.

type MockGenerateSection

type MockGenerateSection struct {
	OutputDir string `yaml:"outputDir,omitempty"`
	Format    string `yaml:"format,omitempty"`
	Schema    string `yaml:"schema,omitempty"`
}

type MockServeSection

type MockServeSection struct {
	Port int `yaml:"port,omitempty"`
}

type MockTestingSection

type MockTestingSection struct {
	Enabled  bool                `yaml:"enabled,omitempty"`
	Targets  []string            `yaml:"targets,omitempty"`
	Generate MockGenerateSection `yaml:"generate,omitempty"`
	Serve    MockServeSection    `yaml:"serve,omitempty"`
}

type OpenAPIConfig

type OpenAPIConfig struct {
	TargetVersion string           `yaml:"targetVersion,omitempty"` // "3.0", "3.1", or "3.2"
	Patterns      []string         `yaml:"patterns,omitempty"`
	Rules         []RuleRef        `yaml:"rules,omitempty"`
	Extensions    ExtensionsConfig `yaml:"extensions,omitempty"`
}

OpenAPIConfig holds OpenAPI-specific configuration.

type OpenAPIGenerationSection

type OpenAPIGenerationSection struct {
	Enabled      bool                      `yaml:"enabled,omitempty"`
	Root         string                    `yaml:"root,omitempty"`
	Output       string                    `yaml:"output,omitempty"`
	Cartographer CartographerConfigSection `yaml:"cartographer,omitempty"`

	// TriggerMode is "always" (debounce + save) or "save" (save only).
	TriggerMode string `yaml:"triggerMode,omitempty"`
	// DebounceMs is the idle window for the in-memory loop; default 500.
	DebounceMs int `yaml:"debounceMs,omitempty"`
	// WriteMode controls disk materialisation:
	// never | onDemand | onSave | always.
	// Default is onDemand when Output is set, never otherwise.
	WriteMode string `yaml:"writeMode,omitempty"`
	// WriteSourceMap mirrors an openapi.sourcemap.json file alongside the
	// spec when a disk write is performed.
	WriteSourceMap bool `yaml:"writeSourceMap,omitempty"`
	// ShowCodeLens and ShowTreeView are extension-surface flags passed
	// through initializationOptions so a single config file can control
	// server + extension behaviour.
	ShowCodeLens *bool `yaml:"showCodeLens,omitempty"`
	ShowTreeView *bool `yaml:"showTreeView,omitempty"`
}

type OutputConfig

type OutputConfig struct {
	Format string `yaml:"format,omitempty"` // text, json, sarif, github
	Color  string `yaml:"color,omitempty"`  // auto, always, never
}

OutputConfig controls CLI output formatting.

type OverlayGenerationSection

type OverlayGenerationSection struct {
	Enabled bool     `yaml:"enabled,omitempty"`
	Targets []string `yaml:"targets,omitempty"`
	Files   []string `yaml:"files,omitempty"`
	Output  string   `yaml:"output,omitempty"`
}

type PrettierFormattingSection

type PrettierFormattingSection struct {
	Enabled bool           `yaml:"enabled,omitempty"`
	Targets []string       `yaml:"targets,omitempty"`
	Runtime string         `yaml:"runtime,omitempty"`
	Plugin  string         `yaml:"plugin,omitempty"`
	OnSave  bool           `yaml:"onSave,omitempty"`
	Options map[string]any `yaml:"options,omitempty"`
}

type PrintingPressOptionsSection

type PrintingPressOptionsSection struct {
	Title  string `yaml:"title,omitempty"`
	NoLLM  bool   `yaml:"noLLM,omitempty"`
	NoJSON bool   `yaml:"noJSON,omitempty"`
	NoHTML bool   `yaml:"noHTML,omitempty"`
	Binary string `yaml:"binary,omitempty"`
}

type PrintingPressPreviewSection

type PrintingPressPreviewSection struct {
	Port  int    `yaml:"port,omitempty"`
	Theme string `yaml:"theme,omitempty"`
}

type PrintingPressSection

type PrintingPressSection struct {
	Enabled bool                        `yaml:"enabled,omitempty"`
	Targets []string                    `yaml:"targets,omitempty"`
	Output  string                      `yaml:"output,omitempty"`
	Publish bool                        `yaml:"publish,omitempty"`
	Preview PrintingPressPreviewSection `yaml:"preview,omitempty"`
	Options PrintingPressOptionsSection `yaml:"options,omitempty"`
}

type RuleRef

type RuleRef struct {
	Rule     string         `yaml:"rule,omitempty" json:"rule,omitempty"`
	Severity string         `yaml:"severity,omitempty" json:"severity,omitempty"`
	Runner   string         `yaml:"runner,omitempty" json:"runner,omitempty"` // "bun", "auto" (default: auto)
	Options  map[string]any `yaml:"options,omitempty" json:"options,omitempty"`
}

RuleRef references a custom rule or schema file in .telescope/.

type SchemaPatternMapping

type SchemaPatternMapping struct {
	Schema   string   `yaml:"schema" json:"schema"`
	Patterns []string `yaml:"patterns,omitempty" json:"patterns,omitempty"`
}

SchemaPatternMapping maps a JSON Schema to file patterns.

type TargetConfig

type TargetConfig struct {
	Kind        string   `yaml:"kind,omitempty"`
	Include     []string `yaml:"include,omitempty"`
	Exclude     []string `yaml:"exclude,omitempty"`
	Description string   `yaml:"description,omitempty"`
}

TargetConfig is a named file-selection primitive for action blocks.

type TestingSection

type TestingSection struct {
	Contract  ContractTestingSection `yaml:"contract,omitempty"`
	Workflows WorkflowTestingSection `yaml:"workflows,omitempty"`
	Mocks     MockTestingSection     `yaml:"mocks,omitempty"`
}

TestingSection configures contract testing, workflows, and mocks.

type VacuumConfig

type VacuumConfig struct {
	Ruleset  string `yaml:"ruleset,omitempty"`
	Severity string `yaml:"severity,omitempty"` // error, warn, info, hint
	Turbo    bool   `yaml:"turbo,omitempty"`
}

VacuumConfig configures the optional pb33f/vacuum lint bridge.

type VacuumEngineSection

type VacuumEngineSection struct {
	Enabled         bool                   `yaml:"enabled,omitempty"`
	Rulesets        []VacuumRulesetRef     `yaml:"rulesets,omitempty"`
	SeverityFloor   string                 `yaml:"severityFloor,omitempty"`
	Turbo           bool                   `yaml:"turbo,omitempty"`
	Autofix         AutofixSection         `yaml:"autofix,omitempty"`
	Dedupe          DedupeSection          `yaml:"dedupe,omitempty"`
	ChangeDetection ChangeDetectionSection `yaml:"changeDetection,omitempty"`
}

type VacuumRulesetRef

type VacuumRulesetRef struct {
	Builtin string `yaml:"builtin,omitempty"`
	Path    string `yaml:"path,omitempty"`
}

type ValidationExtensionsSection

type ValidationExtensionsSection struct {
	Required []string `yaml:"required,omitempty"`
	Schemas  []string `yaml:"schemas,omitempty"`
}

type ValidationFileSection

type ValidationFileSection struct {
	Enabled bool     `yaml:"enabled,omitempty"`
	Targets []string `yaml:"targets,omitempty"`
	Schema  string   `yaml:"schema,omitempty"`
}

type ValidationGroup

type ValidationGroup struct {
	Patterns []string               `yaml:"patterns" json:"patterns"`
	Schemas  []SchemaPatternMapping `yaml:"schemas,omitempty" json:"schemas,omitempty"`
	Rules    []RuleRef              `yaml:"rules,omitempty" json:"rules,omitempty"`
}

ValidationGroup defines file patterns, schemas, and rules for additional validation.

type ValidationOpenAPISection

type ValidationOpenAPISection struct {
	Enabled              bool                        `yaml:"enabled,omitempty"`
	Targets              []string                    `yaml:"targets,omitempty"`
	TargetVersion        string                      `yaml:"targetVersion,omitempty"`
	SchemaValidationMode string                      `yaml:"schemaValidationMode,omitempty"`
	Extensions           ValidationExtensionsSection `yaml:"extensions,omitempty"`
	BreakingChanges      BreakingChangesSection      `yaml:"breakingChanges,omitempty"`
}

type ValidationSection

type ValidationSection struct {
	Telescope ValidationTelescopeSection       `yaml:"telescope,omitempty"`
	OpenAPI   ValidationOpenAPISection         `yaml:"openapi,omitempty"`
	Files     map[string]ValidationFileSection `yaml:"files,omitempty"`
}

ValidationSection configures OpenAPI validation, config validation, and schema validation for other files.

type ValidationTelescopeSection

type ValidationTelescopeSection struct {
	Enabled bool `yaml:"enabled,omitempty"`
}

type WiretapConfig

type WiretapConfig struct {
	Enabled     bool     `yaml:"enabled,omitempty"`
	BinaryPath  string   `yaml:"binaryPath,omitempty"`
	MonitorPort int      `yaml:"monitorPort,omitempty"`
	ExtraArgs   []string `yaml:"extraArgs,omitempty"`
}

WiretapConfig configures optional proxy-based contract validation.

type WiretapSettingsSection

type WiretapSettingsSection struct {
	Enabled     bool     `yaml:"enabled,omitempty"`
	Binary      string   `yaml:"binary,omitempty"`
	MonitorPort int      `yaml:"monitorPort,omitempty"`
	ExtraArgs   []string `yaml:"extraArgs,omitempty"`
}

type WorkflowTestingSection

type WorkflowTestingSection struct {
	Enabled bool     `yaml:"enabled,omitempty"`
	Targets []string `yaml:"targets,omitempty"`
}

type WorkspaceSection

type WorkspaceSection struct {
	Ignore   []string                `yaml:"ignore,omitempty"`
	EnvFiles []string                `yaml:"envFiles,omitempty"`
	Targets  map[string]TargetConfig `yaml:"targets,omitempty"`
}

WorkspaceSection defines repo-wide file selection and shared env loading.

Jump to

Keyboard shortcuts

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