/** * The abaplint engine wrapper. * * Design rules: * - A fresh in-memory Registry per call — no shared state, safe under * concurrent tool calls (pattern proven in RAP Dojo's /api/lint-abap). * - abaplint PARSES the input, it never executes it. Inputs are still * bounded (file count / chars) to keep each call cheap. * - Filenames drive abaplint's object typing (zcl_x.clas.abap = a class). * Callers may omit them; we infer from the source's leading statement. */ import * as abaplint from "@abaplint/core"; export interface AbapSource { filename?: string | undefined; source: string; } export interface Finding { rule: string; message: string; severity: string; file: string; line: number; column: number; /** First ~100 chars of the offending line, for fix-it-without-reopening flows. */ excerpt: string; docsUrl: string; } export declare const MAX_FILES = 32; export declare const MAX_FILE_CHARS = 100000; export declare const MAX_FINDINGS = 500; /** ABAP language versions a caller may target. */ export declare const ABAP_VERSIONS: readonly ["Cloud", "v750", "v751", "v752", "v753", "v754", "v755", "v756", "v757", "v758"]; export type AbapVersion = (typeof ABAP_VERSIONS)[number]; /** * Infer an abapGit-conventional filename from the source's first meaningful * statement, so agents can lint snippets without knowing the convention. */ export declare function inferFilename(source: string, given?: string): string; export declare function boundFiles(files: AbapSource[]): { filename: string; source: string; }[]; /** * Curated rule-pack lenses — abaplint's own tags, so the pack is the * analyzer's taxonomy, not a hand-maintained list that can drift. */ export declare const FOCUS_TAGS: readonly ["Performance", "Security", "Styleguide"]; export type FocusTag = (typeof FOCUS_TAGS)[number]; export interface RunOptions { version: AbapVersion; /** abaplint rule config; merged over the preset (and over a focus filter). */ rules?: Record | undefined; /** * Keep only rules carrying this abaplint tag (parser errors always stay * on — focused findings on unparseable code would be garbage). Ignored * for "syntax-only", which has no opinionated rules to focus. */ focus?: FocusTag | undefined; /** * "style" — abaplint's default ruleset minus whole-program semantic * checks, so isolated snippets don't drown in noise about * objects that simply weren't provided. * "full" — abaplint's default ruleset as-is (expects you to provide * every referenced dev object). * "syntax-only" — parser + CDS parser errors only. */ preset: "style" | "full" | "syntax-only"; } export declare function buildConfig(opts: RunOptions): abaplint.Config; export interface RunResult { findings: Finding[]; truncated: boolean; fileCount: number; } export declare function runAbaplint(files: AbapSource[], opts: RunOptions): RunResult; /** A statically-resolved reference to a repository object found in the source. */ export interface ObjectReference { /** The referenced object name (upper-cased as written; tables are typically lowercased in source). */ name: string; /** SAP object type: "TABL" for DB tables, "FUNC" for function modules. */ objectType: "TABL" | "FUNC"; /** How the reference appears, for the human-facing note. */ kind: "db-access" | "call-function"; file: string; line: number; } /** * Walk the parsed AST and collect references to repository objects we can * resolve reliably: DB tables in ABAP-SQL statements (SELECT/INSERT/UPDATE/ * DELETE/MODIFY, including the tables in joins and FROM clauses) and function * modules in CALL FUNCTION ''. Parsing is done at a classic baseline so the * statements resolve even for code ABAP Cloud would reject; abaplint only * parses, never executes. References are de-duplicated by name+type+location. * * Deliberately conservative: we extract only what the parser exposes as a * first-class expression (DatabaseTable, FunctionName), not heuristic regexes, * so a reference we report is a reference that exists. */ export declare function extractObjectReferences(files: AbapSource[], baselineVersion?: AbapVersion): ObjectReference[];