providers

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 2 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

Overview

Package providers defines the LanguageProvider contract — the extensibility seam (PRD section 14). Each language implements this interface (tree-sitter queries, ecosystem best-practice rules, schema/ORM parsing, benchmark harness, test detection, review prompt context). Adding a language means implementing a provider; it never touches the core, the sensors, the MCP server, the CLI or the reporting.

The interface is parser-agnostic (ADR 0001): the provider owns its parser and returns findings via AnalyzeSecurity/AnalyzePractices, so adding a language never touches the core or the sensors. The Go provider (codefit's self-audit bootstrap) backs it with go/ast.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LanguageProvider

type LanguageProvider interface {
	// Identity.
	Language() string         // "go", "typescript", "java", "python"
	Frameworks() []string     // recognized frameworks
	FileExtensions() []string // e.g. [".go"], [".ts", ".tsx"]

	// DefaultPathCriticality returns sensible production/test/example defaults
	// for this ecosystem (RF-11), overridable in .codefit.yaml.
	DefaultPathCriticality() config.PathCriticality

	// AnalyzeSecurity runs the provider's language-specific static security
	// analysis (the AST layer of the pyramid) and returns deterministic
	// findings with their natural, pre-path-criticality severity.
	AnalyzeSecurity(src SourceFile) ([]findings.Finding, error)

	// AnalyzePractices runs the provider's best-practice checks.
	AnalyzePractices(src SourceFile) ([]findings.Finding, error)

	// AnalyzeSurface maps the auditable structural surface of a file (PRD
	// section 10): it enumerates, per category, every structure the agent
	// should reason about (e.g. HTTP handlers to verify authorization on). It
	// does not judge whether an item is vulnerable.
	//
	// Provisional: this parser-agnostic, provider-owns-analysis shape (ADR 0001)
	// is revisited in Fase 1 against the real TypeScript provider, where a
	// declarative SurfaceQuery model may replace it.
	AnalyzeSurface(src SourceFile) ([]findings.SurfaceItem, error)
}

LanguageProvider is the contract every supported language implements. The core depends only on this interface, never on a concrete language — which is what lets codefit scale to new languages without changing the engine.

The provider owns its parser (go/ast for Go, tree-sitter for TS/Java/Python later) and exposes analysis that returns findings, so the interface stays parser-agnostic (see ADR 0001).

type SourceFile

type SourceFile struct {
	Path    string
	Content []byte
}

SourceFile is the input to a provider's analysis: a project-relative path and the file's raw content.

Directories

Path Synopsis
Package golang is the Go LanguageProvider.
Package golang is the Go LanguageProvider.
Package typescript is the TypeScript/TSX LanguageProvider.
Package typescript is the TypeScript/TSX LanguageProvider.

Jump to

Keyboard shortcuts

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