typescript

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package typescript is the TypeScript/TSX LanguageProvider. It parses with gotreesitter (pure Go, no CGO — see ADR 0002) and adapts its AST to the core's parser-agnostic syntax.Node (ADR 0003).

This phase (Prompt 1.1) implements identity + parsing only. The deterministic rules and surface mapping (AnalyzeSecurity/Practices/Surface) are stubs here; they arrive in Prompts 1.2/1.3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct{}

Provider implements providers.LanguageProvider for TypeScript and TSX.

func New

func New() *Provider

New returns a TypeScript language provider.

func (*Provider) AnalyzePractices

func (*Provider) AnalyzePractices(providers.SourceFile) ([]findings.Finding, error)

AnalyzePractices is a stub; the best-practice rules arrive in Prompt 1.2.

func (*Provider) AnalyzeSecurity

func (p *Provider) AnalyzeSecurity(src providers.SourceFile) ([]findings.Finding, error)

AnalyzeSecurity runs the embedded deterministic security rules over src and returns the findings. The provider is a thin adapter: it loads/compiles the rules (once), parses the file, and hands both to the language-agnostic ruleengine — no detection logic lives here.

func (*Provider) AnalyzeSurface

func (p *Provider) AnalyzeSurface(src providers.SourceFile) ([]findings.SurfaceItem, error)

AnalyzeSurface maps the auditable structural surface of a TypeScript file by running the provider's surface queries through the agnostic framework, which stamps the stable ids. Today only IDOR (Next App Router) is wired; authz and over-fetching are added as their queries land.

func (*Provider) CoverageManifest

func (*Provider) CoverageManifest() coverage.Manifest

CoverageManifest declares, in plain prose, what codefit audits for TypeScript and how — the single source for the human-facing COVERAGE.md and the codefit-coverage tool (PRD §10, RF-07). The two categories that split between a deterministic rule and mapped surface (ADR 0004) appear in BOTH lists, each side describing exactly what it covers, so an evaluator reads a division of labor, not a gap.

CoverageManifest is a provider method (not yet on the shared LanguageProvider interface) — the interface convergence is deferred until the Go provider also emits this (ADR 0003).

func (*Provider) DefaultPathCriticality

func (*Provider) DefaultPathCriticality() config.PathCriticality

func (*Provider) FileExtensions

func (*Provider) FileExtensions() []string

func (*Provider) Frameworks

func (*Provider) Frameworks() []string

func (*Provider) Language

func (*Provider) Language() string

func (*Provider) Parse

func (*Provider) Parse(src providers.SourceFile) (syntax.Node, error)

Parse parses a TypeScript (.ts) or TSX (.tsx) file and returns the root of the parser-agnostic AST. The concrete gotreesitter tree is hidden behind syntax.Node so the core never depends on the parser.

Jump to

Keyboard shortcuts

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