@salesforce/agents
Version:
Client side APIs for working with Salesforce agents
38 lines (37 loc) • 1.57 kB
TypeScript
import { SfProject } from '@salesforce/core';
import type { ReplacementConfig } from '@salesforce/source-deploy-retrieve/lib/src/convert/types';
export type { ReplacementConfig };
/**
* Result of applying string replacements to content
*/
export type ReplacementResult = {
content: string;
replacementsMade: number;
replacements: Array<{
file: string;
stringReplaced: string;
replacedWith: string;
}>;
};
/**
* Applies string replacements to a specific file's content
*
* This uses SDR's replacement configuration format and helper functions
* to maintain compatibility with the standard sfdx-project.json replacement schema.
*
* @param filePath - The file to check for replacements
* @param content - The content of the file
* @param project - The SfProject instance
* @returns The modified content and replacement details
*/
export declare function applyStringReplacements(filePath: string, content: string, project: SfProject): Promise<ReplacementResult>;
/**
* Applies string replacements configured in sfdx-project.json to agent file content
* This follows the same pattern as the Salesforce CLI for source deployment
*
* @param agentFilePath - Path to the .agent file
* @param agentContent - The original agent file content
* @param project - The SfProject instance
* @returns Object containing modified content and details about replacements made
*/
export declare function applyStringReplacementsToAgent(agentFilePath: string, agentContent: string, project: SfProject): Promise<ReplacementResult>;