sfcoe-ailabs
Version:
AI-powered code review tool with static analysis integration for comprehensive code quality assessment.
153 lines (152 loc) • 6.08 kB
TypeScript
import { AIProviderType } from '../aiProvider/index.js';
/**
* Supported AI providers
*/
export declare const AI_PROVIDERS: Record<string, AIProviderType>;
/**
* Default GitHub bot identifier and comment header/footer
*/
export declare const GITHUB_BOT_IDENTIFIER_DEFAULTS: {
IDENTIFIER: string;
COMMENT_HEADER: string;
USER_AGENT: string;
COMMENT_FOOTER: string;
};
/**
* Default GitHub REST API configuration values
*/
export declare const GITHUB_API_DEFAULTS: {
readonly PR_BASE_URL: "https://api.github.com/repos";
readonly USER_AGENT: string;
readonly API_VERSION: "2022-11-28";
readonly ACCEPT_HEADER: "application/vnd.github+json";
readonly START_SIDE: "RIGHT";
readonly RESPONSE_TYPE: "json";
readonly SAML_ERROR_MESSAGE: "🔒 GitHub SAML SSO Required! Your organization requires SAML Single Sign-On authentication for Personal Access Tokens.\n\n SOLUTION STEPS:\n 1. Go to your Personal Access Tokens page: https://github.com/settings/tokens\n 2. Find your token and click \"Configure SSO\" next to it\n 3. Authorize the token for your organization\n 4. Click \"Authorize\" to grant SAML SSO access\n\n Alternative: Create a new token and immediately authorize it for SSO:\n 1. Create new token: https://github.com/settings/tokens/new\n 2. Select required scopes (repo for private repos, public_repo for public)\n 3. Click \"Configure SSO\" and authorize for organization\n\n Documentation: https://docs.github.com/articles/authenticating-to-a-github-organization-with-saml-single-sign-on/";
};
/**
* Supported file extensions for code analysis
*/
export declare const SUPPORTED_FILE_EXTENSIONS: {
readonly APEX: readonly [".cls", ".trigger"];
readonly JAVASCRIPT: readonly [".js", ".mjs", ".cjs"];
readonly TYPESCRIPT: readonly [".ts"];
readonly HTML: readonly [".html"];
readonly CSS: readonly [".css"];
readonly XML: readonly [".xml"];
readonly AURA: readonly [".cmp"];
readonly METADATA: readonly [".xml", ".json", ".yaml", ".yml"];
readonly PLSQL: readonly [".sql", ".pks", ".pkb", ".prc", ".fnc", ".trg", ".typ", ".tps", ".tpb"];
readonly VISUALFORCE: readonly [".page", ".component"];
readonly JAVA: readonly [".java"];
};
/**
* Directories to exclude from analysis
*/
export declare const EXCLUDED_DIRECTORIES: string[];
/**
* Test framework patterns and identifiers
*/
export declare const TEST_PATTERNS: {
readonly APEX_TEST_ANNOTATION: "@isTest";
readonly SOBJECT_MOCKER: "SObjectMocker";
readonly CLASS_MOCKER: "ClassMocker";
readonly GENERATE_MOCK_SOBJECT: "generateMockSObject";
readonly TEST_FILE_PATTERN: "test";
};
/**
* Default Datadog configuration values
*/
export declare const DATADOG_DEFAULT_CONSTANTS: {
readonly ddsource: "AIPRReview";
readonly hostname: "sfcoe-aipr-review";
readonly service: "sfcoe-aipr-review";
readonly prefix: "sfcoe_aipr_review.";
readonly environment: "development";
readonly logLevel: "debug";
readonly timestampFormat: "MMM-DD-YYYY HH:mm:ss";
readonly observabilityFlags: readonly ["pull-request-id", "ai-provider", "git-provider", "git-owner", "git-repo"];
};
/**
* Default patterns for JavaScript code analysis
*/
export declare const JS_PATTERNS: {
pattern: string;
ruleType: string;
issue: string;
suggestedFix: string;
ruleId: string;
}[];
/**
* Package and message bundle identifiers
*/
export declare const PACKAGE_CONSTANTS: {
readonly NAME: "sfcoe-ailabs";
readonly REVIEW_COMMAND: "ks.review.diff";
};
/**
* Default values for command flags
*/
export declare const COMMAND_DEFAULTS: {
readonly GIT_FROM_REF: "HEAD~1";
readonly GIT_TO_REF: "HEAD";
readonly AI_PROVIDER: AIProviderType.AzureOpenAI;
readonly GIT_PROVIDER: "GitHub";
readonly AI_MODEL: "gpt-4o-mini-eastus2";
readonly AI_API_ENDPOINT: "https://dts-apigw-sandbox.docusignhq.com/";
readonly AI_API_VERSION: "2024-08-01-preview";
readonly SCA_RULESET: "../../common/contextProviders/scat/sf-code-analyzer-ruleset.yml";
readonly PMD_RULESET: "../../common/contextProviders/scat/pmd-ruleset.xml";
readonly DEFAULT_MAX_TOKENS: 4096;
readonly DEFAULT_PROMPT_TEMPLATE: "$prompt\n\n# Code Snippet:\n$codeSnippet\n\n# Hints:\n$hintsText";
readonly DEFAULT_SARIF_FILE_NAME: "results.sarif";
readonly SF_CODE_ANALYZER_LOGS_FOLDER: "code-analyzer-logs";
};
/**
* Default values for review command hints and messages
*/
export declare const REVIEW_COMMAND_HINTS_DEFAULTS: {
RULE_ID: string;
MESSAGE: string;
SUGGESTION: string;
SUGGESTION_RULE_TYPE: string;
RULE_TYPE: string;
FILE_NAME: string;
LINE_NUMBER: number;
AI_ANALYSIS_TABLE_HEADERS: string;
};
/**
* Regex to match file extensions
*/
export declare const LAST_EXTENSION_REGEX: RegExp;
/**
* DocuSign-specific issues and patterns
*/
export declare const DOCUSIGN_SPECIFIC_ISSUES: {
readonly TEST_FRAMEWORK: {
readonly ruleType: "Docusign Specific";
readonly issue: "Using old test framework which takes huge time to run";
readonly suggestedFix: "Use SObjectMocker, ClassMocker, or generateMockSObject. [More details](https://docusign.atlassian.net/wiki/spaces/EA/pages/720143853/DS+Apex+Test+-+Overview)";
};
readonly GLOBAL_DESCRIBE_USAGE: {
readonly ruleType: "Docusign Specific";
readonly issue: "Using Schema.getGlobalDescribe() at line $line_number which has performance issues";
readonly suggestedFix: "Use COE_SchemaUtils framework. [More details](https://docusign.atlassian.net/wiki/spaces/EA/pages/155880835/Better+getGlobalDescribe)";
};
};
/**
* Supported Salesforce file extensions
*/
export declare const SUPPORTED_SALESFORCE_EXTENSIONS: string[];
/**
* Mapping of rule types to human-readable categories
*/
export declare const RULE_TYPE_MAP: {
[key: string]: string;
};
/**
* Suggested fixes for common code issues
*/
export declare const SUGGESTED_FIXES: {
[key: string]: string;
};