typescript

package
v0.1.4 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: 15 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 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 Option added in v0.1.2

type Option func(*Provider)

Option configures a Provider at construction.

func WithAuthzHelpers added in v0.1.2

func WithAuthzHelpers(names []string) Option

WithAuthzHelpers registers project-specific authorization helper names the provider recognizes in addition to the built-in set. The names come from the committed baseline (a human-approved decision), never from guessing.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements providers.LanguageProvider for TypeScript and TSX. authzHelpers holds the project's registered custom authz helpers (in addition to the built-in NextAuth-style set), so surface recognition reflects per-project knowledge without the agent re-reasoning (ADR 0013). Empty for the stateless file-level surface tools; populated by the project-scan path from the baseline.

func New

func New(opts ...Option) *Provider

New returns a TypeScript language provider. With no options it recognizes only the built-in authz helpers (the stateless default).

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